@lightworkai.official/debug-capture 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +241 -0
  2. package/dist/budget.d.ts +22 -0
  3. package/dist/bundle.d.ts +20 -0
  4. package/dist/capture/actionTrail.d.ts +7 -0
  5. package/dist/capture/cause.d.ts +3 -0
  6. package/dist/capture/consoleBuffer.d.ts +4 -0
  7. package/dist/capture/crashWatcher.d.ts +1 -0
  8. package/dist/capture/networkBuffer.d.ts +4 -0
  9. package/dist/capture/redact.d.ts +9 -0
  10. package/dist/capture/stepCorrelation.d.ts +41 -0
  11. package/dist/config.d.ts +217 -0
  12. package/dist/context.d.ts +2 -0
  13. package/dist/debug-capture.js +116 -0
  14. package/dist/embed.d.ts +1 -0
  15. package/dist/index.d.ts +45 -0
  16. package/dist/index.mjs +129 -0
  17. package/dist/install.d.ts +5 -0
  18. package/dist/mytickets/api.d.ts +115 -0
  19. package/dist/mytickets/format.d.ts +84 -0
  20. package/dist/mytickets/sanitize.d.ts +66 -0
  21. package/dist/mytickets/strings.d.ts +74 -0
  22. package/dist/mytickets/toolbar.d.ts +17 -0
  23. package/dist/reporter.d.ts +27 -0
  24. package/dist/screenshot.d.ts +7 -0
  25. package/dist/signature.d.ts +18 -0
  26. package/dist/submit.d.ts +8 -0
  27. package/dist/types.d.ts +175 -0
  28. package/dist/ui/annotator.d.ts +34 -0
  29. package/dist/ui/arrow.d.ts +25 -0
  30. package/dist/ui/element.d.ts +9 -0
  31. package/dist/ui/strings.d.ts +42 -0
  32. package/dist/ui/styles.d.ts +13 -0
  33. package/dist/ui/toast.d.ts +11 -0
  34. package/package.json +53 -0
  35. package/src/budget.ts +62 -0
  36. package/src/bundle.ts +274 -0
  37. package/src/capture/actionTrail.ts +693 -0
  38. package/src/capture/cause.ts +49 -0
  39. package/src/capture/consoleBuffer.ts +80 -0
  40. package/src/capture/crashWatcher.ts +61 -0
  41. package/src/capture/networkBuffer.ts +315 -0
  42. package/src/capture/redact.ts +117 -0
  43. package/src/capture/stepCorrelation.ts +160 -0
  44. package/src/config.ts +299 -0
  45. package/src/context.ts +81 -0
  46. package/src/embed.ts +35 -0
  47. package/src/index.ts +109 -0
  48. package/src/install.ts +59 -0
  49. package/src/mytickets/api.ts +226 -0
  50. package/src/mytickets/format.ts +191 -0
  51. package/src/mytickets/sanitize.ts +221 -0
  52. package/src/mytickets/strings.ts +217 -0
  53. package/src/mytickets/toolbar.ts +48 -0
  54. package/src/reporter.ts +53 -0
  55. package/src/screenshot.ts +238 -0
  56. package/src/signature.ts +40 -0
  57. package/src/styles.css +400 -0
  58. package/src/submit.ts +143 -0
  59. package/src/types.ts +169 -0
  60. package/src/ui/annotator.ts +698 -0
  61. package/src/ui/arrow.ts +62 -0
  62. package/src/ui/element.ts +362 -0
  63. package/src/ui/strings.ts +113 -0
  64. package/src/ui/styles.ts +96 -0
  65. package/src/ui/toast.ts +138 -0
@@ -0,0 +1,116 @@
1
+ (()=>{var c1={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},S=null;function T0($){S=$}function R(){if(!S)throw Error("[debug-capture] configureDebugCapture() has not been called");return S}function A0(){return S!==null}function h(){let $=R().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??l1()}}function l1(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function A($){let j=S?.capture?.[$];return typeof j==="number"?j:c1[$]}function L0($){let j=S?.module;if(!j)return null;try{return j($)??null}catch{return null}}function e(){let $=S?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((j)=>j.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((j)=>j.toLowerCase())}}function E0(){return S?.capture?.overlaySelectors??[]}function x0($){if(typeof window>"u")return!1;let j;try{j=new URL($,window.location.href)}catch{return!1}if(r1(j))return!1;if(j.origin===window.location.origin)return!0;return(S?.capture?.bodyOrigins??[]).some((J)=>{try{return new URL(J).origin===j.origin}catch{return!1}})}function r1($){if(!S?.host)return!1;try{if(new URL(S.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}var v="‹redacted›",n1=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,s1=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),a1=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,t1=/[\w.+-]+@[\w-]+\.[\w.-]+/g,e1=/\d(?:[\d\s-]{7,})\d/g;function b($){return $.replace(t1,v).replace(e1,v)}function $2($){if(n1.test($))return!0;return e().headers.some((J)=>J.toLowerCase()===$.toLowerCase())}function u($){let j={};for(let[J,Q]of Object.entries($))j[J]=$2(J)?v:Q;return j}function i($){try{let j=/^https?:\/\//i.test($),J=new URL($,j?void 0:"http://local.invalid"),Q=!1;if(J.searchParams.forEach((z,W)=>{if(s1.has(W.toLowerCase())||e().queryKeys.includes(W.toLowerCase()))J.searchParams.set(W,v),Q=!0}),!Q)return $;return j?J.toString():`${J.pathname}${J.search}`}catch{return $}}function w0($,j){if(j>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Q)=>w0(Q,j+1));let J={};for(let[Q,z]of Object.entries($)){let W=a1.test(Q)||e().bodyKeys.some((V)=>Q.toLowerCase().includes(V));J[Q]=W?v:w0(z,j+1)}return J}function o($,j){if($==null)return null;let J=$,Q=$.trim();if(Q.startsWith("{")||Q.startsWith("["))try{let z=JSON.parse(Q);J=JSON.stringify(w0(z,0))}catch{}if(J.length>j)return`${J.slice(0,j)}… [truncated ${J.length-j} chars]`;return J}var X0=120,Y0=40,g=($,j)=>$.length>j?`${$.slice(0,j)}…`:$,F0=($)=>{try{return decodeURIComponent($)}catch{return $}},p=[],h0=0,p0=!1;function d($,j,J,Q){let z=g(j,X0),W=p[p.length-1];if($==="navigate"&&W?.kind==="click"){let X=z.replace(/^ไปที่\s*/,"");if(W.detail.includes(`→ ${X}`))return W.at=new Date().toISOString(),W;let F=X.split(/[?#]/)[0]??X,H=W.source?F0(W.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(H&&(F===H||F.startsWith(H)))return W.detail=g(`${W.detail} → ${X}`,X0),W.source=void 0,W.at=new Date().toISOString(),W}if(W&&W.kind===$&&W.detail===z){if(W.at=new Date().toISOString(),$!=="navigate")W.count=(W.count??1)+1;return W}h0+=1;let V={id:`act_${h0}`,at:new Date().toISOString(),kind:$,detail:z,count:1,source:J,html:j0(Q)};p.push(V);while(p.length>A("maxActions"))J2(p.shift());return V}var j2=200000,c=0;function j0($){if(!$)return;if(c+$.length>j2)return;return c+=$.length,$}function J2($){if(!$)return;if(c-=($.html?.length??0)+($.afterHtml?.length??0),c<0)c=0}function $0($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var Q2='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',z2={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},g0={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function Z2($){let j=$.getAttribute("role");if(j&&g0[j])return g0[j];return z2[$.tagName.toLowerCase()]??"ปุ่ม"}function W2($,j){try{let J=$,Q=0;while(J&&Q<=j){let z=i0(J);if(z&&typeof z.memoizedProps?.onClick==="function")return J;J=J.parentElement,Q+=1}}catch{}return null}function K2($){let j=$.getAttribute("aria-label")?.trim();if(j)return j;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 Q=($.textContent??"").replace(/\s+/g," ").trim();if(Q)return Q;if($ instanceof HTMLAnchorElement){let z=$.getAttribute("href");if(z?.startsWith("/"))return F0(z)}return""}function V2($){if(!($ instanceof Element))return null;let j=$.closest(Q2)??W2($,4);if(!j)return null;let J=j.tagName.toLowerCase();if(J==="html"||J==="body")return null;return j}function G2($){let j=b(K2($));if(!j)return null;return`${Z2($)} “${g(j,Y0)}”`}var u0=6000,w2=4000,X2=/(?:^|\s)!?(?:fixed|absolute|sticky|inset-\S+|z-\S+|top-\S+|bottom-\S+|left-\S+|right-\S+|w-screen|h-screen|min-h-screen|max-h-screen|translate-\S+|scale-\S+)(?=\s|$)/g;function Y2($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((z)=>z.remove());let j=[$,...Array.from($.querySelectorAll("*"))];for(let z of j){for(let V of Array.from(z.attributes)){let X=V.name.toLowerCase();if(X.startsWith("on")||X==="srcdoc"||X==="value"||X.startsWith("data-"))z.removeAttribute(V.name)}if(z instanceof HTMLAnchorElement)z.setAttribute("href","#");if(z instanceof HTMLImageElement)z.removeAttribute("src");let W=z.getAttribute("class");if(W){let V=W.replace(X2," ").replace(/\s+/g," ").trim();if(V)z.setAttribute("class",V);else z.removeAttribute("class")}}let J=document.createTreeWalker($,NodeFilter.SHOW_TEXT),Q=J.nextNode();while(Q){if(Q.nodeValue)Q.nodeValue=b(Q.nodeValue);Q=J.nextNode()}}function M0($,j,J){try{let Q=$.outerHTML;if(!Q||Q.length>j)return;let z=$.cloneNode(!0);Y2(z);let W=z.outerHTML;return W&&W.length<=J?W:void 0}catch{return}}var F2=($)=>M0($,u0,w2),M2=150000,H2=40000,m0=($)=>M0($,M2,H2);function I2($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let j=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${b(j)}”`}var y0=80;function i0($){let j=Object.keys($).find((J)=>J.startsWith("__reactFiber$")||J.startsWith("__reactInternalInstance$"));return j?$[j]:null}function C2($){if(typeof $!=="function")return null;try{let j=Function.prototype.toString.call($);return(j.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??j.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function v0($){if(!$)return;return`→ ${$.length>y0?`${$.slice(0,y0)}…`:$}`}function U2($){try{let j=$.closest("a[href]")?.getAttribute("href");if(j&&j.startsWith("/"))return v0(j);let J=i0($),Q=0;while(J&&Q<30){if(typeof J.memoizedProps?.onClick==="function")return v0(C2(J.memoizedProps.onClick));J=J.return,Q+=1}return}catch{return}}var P2='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function N2(){let $=E0();return $.length?$.join(", "):P2}function B2($){let j=$.getAttribute("role");if(j==="status"||j==="alert")return"ข้อความแจ้งเตือน";if(j==="menu")return"เมนู";if(j==="listbox")return"รายการตัวเลือก";if(j==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function q2($){let j=$.getAttribute("aria-label")?.trim();if(j)return j;let J=$.getAttribute("aria-labelledby");if(J){let W=J.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(W)return W}let z=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(z)return z;return($.textContent??"").replace(/\s+/g," ").trim()}function o0($){let j=b(q2($)),J=B2($);return j?`เปิด ${J} “${g(j,Y0)}”`:`เปิด ${J}`}var D2='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',f2=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function k2($){if($.querySelector(D2))return!0;return f2.test($.textContent??"")}var S2=400,R2=250,O2=8000;function _2($,j){if(typeof MutationObserver>"u"){j.html=j0(m0($));return}let J=Date.now(),Q=!1,z=()=>{Q=!0,V.disconnect(),window.clearInterval(X),window.clearTimeout(F)},W=()=>{if(Q)return;if(z(),!$.isConnected)return;j.detail=g(o0($),X0),j.html=j0(m0($))},V=new MutationObserver(()=>{J=Date.now()});V.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let X=window.setInterval(()=>{if(Q)return;if(!$.isConnected){z();return}if(Date.now()-J>=S2&&!k2($))W()},R2),F=window.setTimeout(W,O2)}function T2($){if($0($))return;let j=d("ui",o0($));if(j)_2($,j)}function A2(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((J)=>{for(let Q of J)for(let z of Array.from(Q.addedNodes)){if(!(z instanceof Element))continue;let W=N2(),V=z.matches(W)?[z]:Array.from(z.querySelectorAll(W));for(let X of V){if($.has(X))continue;$.add(X),T2(X)}}}).observe(document.body,{childList:!0,subtree:!0})}var L2=1600,E2=2500;function b0($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:g(($.textContent??"").replace(/\s+/g," ").trim(),Y0)}}function x2($,j){if(!$.disabled&&j.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&j.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==j.text&&j.text)return`ข้อความเปลี่ยนเป็น “${j.text}”`;return null}function h2($,j){if(typeof MutationObserver>"u")return;let J=b0($),Q=!1,z=(X,F)=>{if(Q)return;if(Q=!0,W.disconnect(),window.clearTimeout(V),j.afterNote=X,F)j.afterHtml=j0(M0($,u0,E2))},W=new MutationObserver(()=>{if(!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let X=x2(J,b0($));if(X)z(X,!0)});W.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!Q&&!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}Q=!0,W.disconnect()},L2)}function d0(){if(p0||typeof window>"u")return;p0=!0,document.addEventListener("click",(Q)=>{if($0(Q.target))return;let z=V2(Q.target);if(!z)return;let W=G2(z);if(!W)return;let V=d("click",`คลิก ${W}`,U2(z),F2(z));if(V)h2(z,V)},{capture:!0,passive:!0}),document.addEventListener("change",(Q)=>{if($0(Q.target))return;let z=I2(Q.target);if(z)d("input",`แก้ไข ${z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(Q)=>{if($0(Q.target))return;d("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>d("navigate",`ไปที่ ${F0(i(location.pathname+location.search))}`),j=history.pushState.bind(history),J=history.replaceState.bind(history);history.pushState=(...Q)=>{let z=j(...Q);return $(),z},history.replaceState=(...Q)=>{let z=J(...Q);return $(),z},window.addEventListener("popstate",$),A2()}function c0(){return p.map(($)=>({...$}))}var l0=2000,J0=[],r0=0,n0=!1;function H0($,j){r0+=1,J0.push({id:`log_${r0}`,at:new Date().toISOString(),level:$,message:j.length>l0?`${j.slice(0,l0)}…`:j});while(J0.length>A("maxConsoleEntries"))J0.shift()}function p2(){let $=new WeakSet;return(j,J)=>{if(typeof J==="object"&&J!==null){if($.has(J))return"[Circular]";$.add(J)}if(typeof J==="bigint")return J.toString();return J}}function s0($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{return JSON.stringify($,p2())??String($)}catch{return String($)}}function a0(){if(n0||typeof window>"u")return;n0=!0;let $=["log","info","warn","error","debug"];for(let j of $){let J=console[j].bind(console);console[j]=(...Q)=>{H0(j,Q.map(s0).join(" ")),J(...Q)}}window.addEventListener("error",(j)=>{let J=j.filename?` (${j.filename}:${j.lineno}:${j.colno})`:"";H0("exception",`${j.message}${J}`)}),window.addEventListener("unhandledrejection",(j)=>{let J=j.reason instanceof Error?`${j.reason.name}: ${j.reason.message}`:s0(j.reason);H0("unhandledrejection",J)})}function t0(){return J0.map(($)=>({...$}))}var e0=new Set,$1=new Set;function j1($,j){return $.add(j),()=>$.delete(j)}function J1($,j){for(let J of[...$])J(j)}function Q1($){return j1(e0,$)}function Q0($={type:"manual"}){J1(e0,$)}function z1($){return j1($1,$)}function Z1($){J1($1,$)}var g2=15000,m2=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],W1=!1,K1=0;function y2($){return m2.some((j)=>$.includes(j))}function V1($){let j=$.message??"";if(!j||y2(j))return;let J=Date.now();if(J-K1<g2)return;K1=J,Z1({...$,message:j})}function G1(){if(W1||typeof window>"u")return;W1=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let j=$.error instanceof Error?$.error:null;V1({type:"runtime-error",message:$.message||(j?j.message:"Unknown error"),stack:j?.stack})}),window.addEventListener("unhandledrejection",($)=>{let j=$.reason;V1({type:"unhandledrejection",message:j instanceof Error?j.message:String(j),stack:j instanceof Error?j.stack:void 0})})}var F1=4000,v2=1e6,b2=1e7,z0=[],w1=0,X1=!1;function M1($){z0.push($);while(z0.length>A("maxRequests"))z0.shift()}function H1(){return w1+=1,`req_${w1}`}function Y1($){let j={};if(!$)return j;if($ instanceof Headers)$.forEach((J,Q)=>{j[Q]=J});else if(Array.isArray($))for(let[J,Q]of $)j[J]=Q;else Object.assign(j,$);return j}function u2($){let j={};return $.forEach((J,Q)=>{j[Q]=J}),j}function i2($){if($==null)return null;if(typeof $==="string")return $;if($ instanceof URLSearchParams)return $.toString();if(typeof FormData<"u"&&$ instanceof FormData)return`[FormData: ${Array.from($.keys()).join(", ")}]`;if(typeof Blob<"u"&&$ instanceof Blob)return`[Blob ${$.size} bytes]`;if($ instanceof ArrayBuffer)return`[ArrayBuffer ${$.byteLength} bytes]`;return"[binary]"}function o2($,j){let J="",Q="GET",z={},W=null;if(typeof $==="string")J=$;else if($ instanceof URL)J=$.toString();else J=$.url,Q=$.method||Q,z=Y1($.headers);if(j){if(j.method)Q=j.method;if(j.headers)z={...z,...Y1(j.headers)};if(j.body!==void 0)W=i2(j.body)}return{method:Q.toUpperCase(),url:J,headers:z,body:W}}function I1($){return!x0($)}function d2($,j){if(I1(j.url)){j.responseSnippet="[body not captured for this origin]";return}let J=$.headers.get("content-type")??"",Q=Number($.headers.get("content-length")??"0"),z=Q?`, ~${Q} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(J)){j.responseSnippet=`[binary ${J||"unknown"}${z}]`;return}if(Q>v2){j.responseSnippet=`[response ${J||"text"}${z} — omitted]`;return}try{$.clone().text().then((W)=>{j.responseSnippet=o(W,A("maxBodyChars"))}).catch(()=>{})}catch{}}function C1($,j){if(/[?&]_rsc=/.test($))return!0;for(let J of Object.keys(j)){let Q=J.toLowerCase();if(Q==="rsc"||Q==="next-router-prefetch"||Q==="next-router-state-tree")return!0}return!1}function c2(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(j,J)=>{let Q=o2(j,J);if(C1(Q.url,Q.headers))return $(j,J);let z={id:H1(),startedAt:new Date().toISOString(),method:Q.method,url:i(Q.url),requestHeaders:u(Q.headers),requestBody:o(Q.body,F1),status:null,statusText:null,durationMs:null,via:"fetch"};M1(z);let W=performance.now();try{let V=await $(j,J);return z.status=V.status,z.statusText=V.statusText,z.durationMs=Math.round(performance.now()-W),z.responseHeaders=u(u2(V.headers)),d2(V,z),V}catch(V){throw z.durationMs=Math.round(performance.now()-W),z.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},$)}function l2(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,j=$.open,J=$.send,Q=function(W,V){let X=typeof V==="string"?V:V.toString();return this.__cibEntry=C1(X,{})?void 0:{id:H1(),startedAt:"",method:(W||"GET").toUpperCase(),url:i(X),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},j.apply(this,arguments)},z=function(W){let V=this.__cibEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof W==="string"?o(W,F1):W==null?null:"[non-string body]";let X=performance.now();M1(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-X),I1(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=o(this.responseText||"",A("maxBodyChars"))}catch{}else{let F=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${F}]`}})}return J.apply(this,arguments)};$.open=Q,$.send=z}function U1(){if(X1)return;X1=!0,c2(),l2()}function P1(){let $=z0.map((J)=>({...J})),j=0;for(let J=$.length-1;J>=0;J-=1){let Q=$[J],z=Q?.responseSnippet;if(!Q||typeof z!=="string"||z.length===0)continue;if(j+z.length>b2)Q.responseSnippet=`[response omitted — report size budget reached (${z.length.toLocaleString()} chars)]`;else j+=z.length}return $}var r2={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า"},n2={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",captured:"Captured",reporter:"Reporter",page:"Page"};function Z0($){return $==="en"?n2:r2}var I0=null;function s2(){if(typeof document>"u")return null;if(I0?.isConnected)return I0;let $=document.createElement("lw-debug-toasts");$.dataset.debugReporter="true";let j=$.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`
2
+ :host { all: initial; }
3
+ .stack {
4
+ position: fixed; top: 16px; right: 16px; z-index: 2147483001;
5
+ display: flex; flex-direction: column; gap: 8px; pointer-events: none;
6
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
7
+ }
8
+ .toast {
9
+ pointer-events: auto; display: flex; align-items: center; gap: 8px;
10
+ max-width: 380px; padding: 12px 14px; border-radius: 10px;
11
+ font-size: 14px; line-height: 1.5; color: #0f172a;
12
+ background: #fff; border: 1px solid #e2e8f0;
13
+ box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
14
+ animation: in 160ms ease-out;
15
+ }
16
+ .toast[data-tone="success"] { border-left: 3px solid #10b981; }
17
+ .toast[data-tone="error"] { border-left: 3px solid #e11d48; }
18
+ .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
19
+ .toast[data-tone="success"] .dot { background: #10b981; }
20
+ .toast[data-tone="error"] .dot { background: #e11d48; }
21
+ .action {
22
+ flex: none; cursor: pointer; padding: 5px 10px; margin-left: auto;
23
+ font: inherit; font-size: 13px; font-weight: 600;
24
+ color: #fff; background: #0f172a; border: none; border-radius: 7px;
25
+ }
26
+ .action + .close { margin-left: 4px; }
27
+ .close {
28
+ margin-left: auto; flex: none; cursor: pointer; border: none; background: none;
29
+ padding: 0 2px; font: inherit; font-size: 16px; line-height: 1; color: #94a3b8;
30
+ }
31
+ @keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
32
+ @media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
33
+ `;let Q=document.createElement("div");return Q.className="stack",Q.setAttribute("role","status"),Q.setAttribute("aria-live","polite"),j.append(J,Q),document.body.append($),I0=Q,Q}function l($,j="success",J){let Q=s2();if(!Q)return;let z=document.createElement("div");z.className="toast",z.dataset.tone=j;let W=document.createElement("span");W.className="dot";let V=document.createElement("span");V.textContent=$;let X=document.createElement("button");X.type="button",X.className="close",X.textContent="✕",X.setAttribute("aria-label","ปิด");let F=()=>{window.clearTimeout(H),z.remove()};X.addEventListener("click",F);let H=j==="error"||J?0:window.setTimeout(F,6000);if(z.append(W,V),J){let C=document.createElement("button");C.type="button",C.className="action",C.textContent=J.label,C.addEventListener("click",()=>{F(),J.onClick()}),z.append(C)}z.append(X),Q.append(z)}function N1($,j,J){let Q=$.filter((W)=>Boolean(W.error)||W.status!=null&&W.status>=400).slice(-20).map((W)=>({method:W.method,url:W.url,status:W.status,error:W.error,at:W.startedAt})),z=j.filter((W)=>W.level==="error"||W.level==="exception"||W.level==="unhandledrejection").slice(-20).map((W)=>W.message);return{failedRequests:Q,errors:z,erroredQueries:J.slice(0,20)}}function a2(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let j=performance.memory;if(j)$.memoryUsedMb=Math.round(j.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(j.jsHeapSizeLimit/1024/1024);let[J]=performance.getEntriesByType("navigation");if(J)$.domContentLoadedMs=Math.round(J.domContentLoadedEventEnd),$.loadEventMs=Math.round(J.loadEventEnd);return $}function C0($,j){if(!$)return j;try{return $()}catch{return j}}function B1(){let $=R(),{pathname:j,search:J,href:Q}=window.location;return{capturedAt:new Date().toISOString(),route:{href:Q,pathname:j,search:J},module:L0(j),user:C0($.user,{}),apiHeaders:u(C0($.headers,{})),app:{name:h().name,version:h().version,environment:h().environment},client:{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,online:navigator.onLine,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio},screen:{width:window.screen.width,height:window.screen.height}},performance:a2(),extra:C0($.extra,{})}}var t2=2;function q1($){let j=P1(),J=t0();return{context:B1(),reason:$.reason,note:$.note,cause:N1(j,J,$.erroredQueries),actionTrail:c0(),network:j,console:J,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:t2}}}async function D1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let J=await e2();if(J.status==="ok")return{dataUrl:J.dataUrl,method:"display-media"};if(J.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let j=await J4();if(j)return{dataUrl:j,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function e2(){let $=null;try{let j={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(j);let J=await $4($);return J?{status:"ok",dataUrl:J}:{status:"error"}}catch(j){if(j instanceof DOMException&&(j.name==="NotAllowedError"||j.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((j)=>j.stop())}}async function $4($){let j=document.createElement("video");j.srcObject=$,j.muted=!0,j.playsInline=!0,await new Promise((V)=>{let X=!1,F=()=>{if(X)return;X=!0,V()};j.onloadedmetadata=()=>{j.play().then(F).catch(F)},window.setTimeout(F,1500)}),await j4(j);let{videoWidth:J,videoHeight:Q}=j;if(!J||!Q)return null;let z=document.createElement("canvas");z.width=J,z.height=Q;let W=z.getContext("2d");if(!W)return null;W.drawImage(j,0,0,J,Q),j.pause(),j.srcObject=null;try{return z.toDataURL("image/png")}catch{return null}}function j4($){return new Promise((j)=>{let J=!1,Q=()=>{if(J)return;J=!0,j()},z=$;if(typeof z.requestVideoFrameCallback==="function")z.requestVideoFrameCallback(()=>Q()),window.setTimeout(Q,1000);else window.setTimeout(Q,250)})}async function J4(){let $=R().screenshotFallback;if(!$)return null;let j=await $().catch(()=>null);if(!j)return null;try{return await j(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(J)=>!(J instanceof HTMLElement&&J.dataset?.debugReporter==="true")})}catch{return null}}var Q4=2000,z4=0.82,Z4=3000000;function W4($){return new Promise((j,J)=>{let Q=new Image;Q.onload=()=>j(Q),Q.onerror=()=>J(Error("could not read the screenshot")),Q.src=$})}async function f1($){try{let j=await W4($),J=Math.max(j.naturalWidth,j.naturalHeight),Q=Math.min(1,Q4/J),z=document.createElement("canvas");z.width=Math.max(1,Math.round(j.naturalWidth*Q)),z.height=Math.max(1,Math.round(j.naturalHeight*Q));let W=z.getContext("2d");if(!W)return $;W.fillStyle="#fff",W.fillRect(0,0,z.width,z.height),W.drawImage(j,0,0,z.width,z.height);let V=z4,X=z.toDataURL("image/jpeg",V);while(X.length>Z4&&V>0.4)V-=0.15,X=z.toDataURL("image/jpeg",V);return X}catch{return $}}var K4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,V4=/^\d+$/,G4=/^[0-9a-f]{16,}$/i;function k1($){if($.reason.type==="manual")return null;let j=$.cause?.failedRequests?.[0];if(!j?.url)return null;let J;try{J=new URL(j.url,"http://x").pathname}catch{J=j.url}let Q=J.split("/").map((W)=>K4.test(W)||V4.test(W)||G4.test(W)?":id":W).join("/"),z=j.status??(j.error?"ERR":"?");return`${j.method??"REQ"} ${Q} ${z}`}var S1=2000000;function W0($){let{screenshotDataUrl:j,...J}=$;return JSON.stringify(J).length}function R1($,j=2000000){if(W0($)<=j)return $;let J=$.network.map((z)=>({...z})),Q={...$,network:J};for(let z of J){if(W0(Q)<=j)return Q;if(typeof z.responseSnippet==="string"&&z.responseSnippet.length>35)z.responseSnippet="[body dropped — report size budget]";if(typeof z.requestBody==="string"&&z.requestBody.length>35)z.requestBody="[body dropped — report size budget]"}while(Q.network.length>1&&W0(Q)>j)Q.network=Q.network.slice(1);while(Q.console.length>1&&W0(Q)>j)Q.console=Q.console.slice(1);return Q}var O1=32768;function w4($){let j="";for(let J=0;J<$.length;J+=O1)j+=String.fromCharCode(...$.subarray(J,J+O1));return btoa(j)}function X4($){return{dataUri:`data:application/json;base64,${w4(new TextEncoder().encode(JSON.stringify($)))}`,filename:"debug-bundle.json"}}async function _1($,j){let J=R(),Q=R1(j,S1),{context:z,note:W}=Q,V=[];if(Q.screenshotDataUrl){let C=await f1(Q.screenshotDataUrl);V.push({dataUri:C,filename:"screenshot.jpg"})}V.push(X4(Q));let X=k1(Q),F={title:$,description:W.trim()||void 0,category:z.module?.label||h().name,routeUrl:z.route.href,priority:"MEDIUM",requesterEmail:z.user.email??void 0,requesterName:z.user.fullName??void 0,customFields:{unit:z.user.unit??"",appVersion:z.app.version,environment:z.app.environment,reasonType:Q.reason.type,appName:h().name,module:z.module?.label??""},context:{...X?{signature:X}:{},capturedAt:z.capturedAt,reason:Q.reason,cause:Q.cause,actionTrail:Q.actionTrail,client:z.client,performance:z.performance,apiHeaders:z.apiHeaders,extra:z.extra,counts:{network:Q.network.length,console:Q.console.length,actions:Q.actionTrail.length},screenshotMethod:Q.screenshotMethod},attachments:V},H=await fetch(`${J.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey},body:JSON.stringify(F)});if(!H.ok){let C=H.headers.get("retry-after"),P=await H.json().then((U)=>U.error).catch(()=>null);throw Error(H.status===429?`Too many reports — try again in ${C??"a moment"}s`:P??`Report failed (${H.status})`)}return await H.json()}var r=Math.PI/6;function T1($,j,J){let Q=j.x-$.x,z=j.y-$.y,W=Math.hypot(Q,z),V=Math.atan2(z,Q),X=[{x:j.x,y:j.y},{x:j.x-J*Math.cos(V-r),y:j.y-J*Math.sin(V-r)},{x:j.x-J*Math.cos(V+r),y:j.y-J*Math.sin(V+r)}],F=J*Math.cos(r)*0.92;if(W<=F)return{shaft:null,head:X};return{shaft:{from:$,to:{x:j.x-F*Math.cos(V),y:j.y-F*Math.sin(V)}},head:X}}var U0="#f44336",Y4="rgba(250, 204, 21, 0.4)",P0=22,A1="#2563eb",L1=9,E1=11,x1=18,h1=4,K0=8,F4=[{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 p1($,j,J){let Q=[],z=null,W=-1,V=null,X=null,F=$.getContext("2d");function H(){let Z=$.getBoundingClientRect().width;return Z>0?$.width/Z:1}function C(Z){let K=$.getBoundingClientRect();return{x:(Z.clientX-K.left)/K.width*$.width,y:(Z.clientY-K.top)/K.height*$.height}}function P(Z){let K=Z.size??P0;if(!F)return(Z.text?.length??0)*K*0.6;F.save(),F.font=`600 ${K}px system-ui, sans-serif`;let w=F.measureText(Z.text??"").width;return F.restore(),w}function U(Z){if(Z.tool==="text"){let K=Z.size??P0;return{left:Z.x1,top:Z.y1,right:Z.x1+P(Z),bottom:Z.y1+K*1.25}}return{left:Math.min(Z.x1,Z.x2),top:Math.min(Z.y1,Z.y2),right:Math.max(Z.x1,Z.x2),bottom:Math.max(Z.y1,Z.y2)}}function f(Z){if(Z.tool==="arrow")return[{id:"tail",x:Z.x1,y:Z.y1,cursor:"move"},{id:"head",x:Z.x2,y:Z.y2,cursor:"move"}];let K=U(Z);if(Z.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return F4.map((w)=>({id:w.id,x:K.left+(K.right-K.left)*w.fx,y:K.top+(K.bottom-K.top)*w.fy,cursor:w.cursor}))}function q(Z){let K=U(Z);return{x:K.right+x1*H(),y:K.top-x1*H()}}function D(Z,K,w){let{shaft:G,head:Y}=T1({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*w));if(G)Z.lineCap="butt",Z.beginPath(),Z.moveTo(G.from.x,G.from.y),Z.lineTo(G.to.x,G.to.y),Z.stroke();Z.beginPath(),Z.moveTo(Y[0].x,Y[0].y),Z.lineTo(Y[1].x,Y[1].y),Z.lineTo(Y[2].x,Y[2].y),Z.closePath(),Z.fill()}function O(Z,K,w){Z.save(),Z.lineWidth=Math.max(2,3*w),Z.strokeStyle=U0,Z.fillStyle=U0;let G=U(K);if(K.tool==="rect")Z.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(K.tool==="arrow")D(Z,K,w);else if(K.tool==="highlight")Z.fillStyle=Y4,Z.fillRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(K.tool==="text"&&K.text){let Y=K.size??P0;Z.font=`600 ${Y}px system-ui, sans-serif`,Z.textBaseline="top";let M=Y*0.22;Z.fillStyle="rgba(255,255,255,0.92)",Z.fillRect(G.left-M,G.top-M,G.right-G.left+M*2,G.bottom-G.top+M*2),Z.fillStyle=U0,Z.fillText(K.text,G.left,G.top)}Z.restore()}function s(Z,K,w){let G=U(K);Z.save(),Z.strokeStyle=A1,Z.lineWidth=Math.max(1,1.5*w),Z.setLineDash([6*w,4*w]),Z.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top),Z.setLineDash([]);let Y=L1*w;for(let k of f(K))Z.fillStyle="#fff",Z.strokeStyle=A1,Z.lineWidth=Math.max(1,1.5*w),Z.beginPath(),Z.rect(k.x-Y/2,k.y-Y/2,Y,Y),Z.fill(),Z.stroke();let M=q(K),I=E1*w;Z.beginPath(),Z.arc(M.x,M.y,I,0,Math.PI*2),Z.fillStyle="#dc2626",Z.fill(),Z.strokeStyle="#fff",Z.lineWidth=Math.max(1.5,2*w),Z.beginPath(),Z.moveTo(M.x-I*0.4,M.y-I*0.4),Z.lineTo(M.x+I*0.4,M.y+I*0.4),Z.moveTo(M.x+I*0.4,M.y-I*0.4),Z.lineTo(M.x-I*0.4,M.y+I*0.4),Z.stroke(),Z.restore()}function N(){if(!F)return;let Z=H();if(F.clearRect(0,0,$.width,$.height),F.drawImage(j,0,0,$.width,$.height),Q.forEach((w,G)=>{if(G!==a)O(F,w,Z)}),V)O(F,V,Z);let K=Q[W];if(K&&!V)s(F,K,Z)}function B0(Z,K,w,G,Y){return Math.abs(Z-w)<=Y&&Math.abs(K-G)<=Y}function q0(Z,K){let w=Q[W];if(!w)return null;let G=L1*H()/2+3*H();for(let Y of f(w))if(B0(Z,K,Y.x,Y.y,G))return Y.id;return null}function D0(Z,K){let w=Q[W];if(!w)return!1;let G=q(w);return B0(Z,K,G.x,G.y,E1*H())}function V0(Z,K){let w=6*H();for(let G=Q.length-1;G>=0;G-=1){let Y=Q[G];if(Y.tool==="arrow"){let I=Y.x2-Y.x1,k=Y.y2-Y.y1,E=Math.hypot(I,k)||1,x=Math.max(0,Math.min(1,((Z-Y.x1)*I+(K-Y.y1)*k)/(E*E)));if(Math.hypot(Z-(Y.x1+x*I),K-(Y.y1+x*k))<=w+4*H())return G;continue}let M=U(Y);if(Z>=M.left-w&&Z<=M.right+w&&K>=M.top-w&&K<=M.bottom+w)return G}return-1}function b1(Z,K,w,G,Y){if(K==="tail"){Z.x1=w.x1+G,Z.y1=w.y1+Y;return}if(K==="head"){Z.x2=w.x2+G,Z.y2=w.y2+Y;return}if(K==="size"){let d1=(w.size??24)+Y;Z.size=Math.max(10,d1);return}let M=U(w),{left:I,top:k,right:E,bottom:x}=M;if(K.includes("w"))I=Math.min(E-K0,I+G);if(K.includes("e"))E=Math.max(I+K0,E+G);if(K.includes("n"))k=Math.min(x-K0,k+Y);if(K.includes("s"))x=Math.max(k+K0,x+Y);Z.x1=I,Z.y1=k,Z.x2=E,Z.y2=x}function u1(Z,K,w,G){Z.x1=K.x1+w,Z.y1=K.y1+G,Z.x2=K.x2+w,Z.y2=K.y2+G}let _=null,a=-1,T={x:0,y:0,size:24};function i1(){let Z=$.getBoundingClientRect().width;return Z>0?Z/$.width:1}function o1(Z,K){if(!F)return Z.length*K*0.6;F.save(),F.font=`600 ${K}px system-ui, sans-serif`;let w=F.measureText(Z||" ").width;return F.restore(),w}function f0(){if(!_)return;let Z=$.parentElement;if(!Z)return;let K=$.getBoundingClientRect(),w=Z.getBoundingClientRect(),G=i1(),Y=T.size*G;_.style.left=`${K.left-w.left+T.x*G}px`,_.style.top=`${K.top-w.top+T.y*G}px`,_.style.fontSize=`${Y}px`,_.style.width=`${Math.max(40,o1(_.value,Y)+Y)}px`}function y(Z){let K=_;if(!K)return;_=null;let w=K.value.trim(),G=a;if(a=-1,K.remove(),Z&&w){if(G>=0&&Q[G])Q[G].text=w,W=G;else Q.push({tool:"text",x1:T.x,y1:T.y,x2:T.x,y2:T.y,text:w,size:T.size}),W=Q.length-1;J()}else if(G>=0)W=G;$.focus(),N()}function k0(Z,K,w=-1){y(!0);let G=$.parentElement;if(!G)return;if(getComputedStyle(G).position==="static")G.style.position="relative";let Y=w>=0?Q[w]:void 0;a=w,T={x:Y?.x1??Z,y:Y?.y1??K,size:Y?.size??Math.round(24*H())};let M=document.createElement("input");M.type="text",M.className="text-edit",M.value=Y?.text??"",M.setAttribute("aria-label","ข้อความบนภาพ"),M.placeholder="ข้อความ",_=M,G.append(M),f0(),M.addEventListener("input",f0),M.addEventListener("keydown",(I)=>{if(I.stopPropagation(),I.key==="Enter")y(!0);else if(I.key==="Escape")y(!1)}),requestAnimationFrame(()=>{if(_!==M)return;M.focus(),M.select(),M.addEventListener("blur",()=>y(!0))}),N()}function S0(Z){let{x:K,y:w}=C(Z);if($.setPointerCapture(Z.pointerId),D0(K,w)){G0();return}let G=q0(K,w);if(G&&Q[W]){X={grip:G,x:K,y:w,start:{...Q[W]}};return}if(z==="text"){if(Z.preventDefault(),$.hasPointerCapture(Z.pointerId))$.releasePointerCapture(Z.pointerId);z=null,J(),k0(K,w);return}if(z){V={tool:z,x1:K,y1:w,x2:K,y2:w},W=-1;return}let Y=V0(K,w);W=Y,X=Y>=0?{grip:"body",x:K,y:w,start:{...Q[Y]}}:null,N()}function R0(Z){let{x:K,y:w}=C(Z);if(V){V.x2=K,V.y2=w,N();return}if(X){let Y=Q[W];if(!Y)return;let M=K-X.x,I=w-X.y;if(X.grip==="body")u1(Y,X.start,M,I);else b1(Y,X.grip,X.start,M,I);N();return}if(z){$.style.cursor="crosshair";return}if(D0(K,w)){$.style.cursor="pointer";return}let G=q0(K,w);if(G){let Y=Q[W]?f(Q[W]).find((M)=>M.id===G):null;$.style.cursor=Y?.cursor??"pointer";return}$.style.cursor=V0(K,w)>=0?"move":"default"}function t(){if(V){if(!(Math.abs(V.x2-V.x1)<h1&&Math.abs(V.y2-V.y1)<h1))Q.push(V),W=Q.length-1,z=null,J();V=null}if(X)X=null,J();N()}function O0(Z){let K=$.getBoundingClientRect(),w=(Z.clientX-K.left)/K.width*$.width,G=(Z.clientY-K.top)/K.height*$.height,Y=V0(w,G),M=Q[Y];if(!M||M.tool!=="text")return;Z.preventDefault(),k0(M.x1,M.y1,Y)}function _0(Z){if(W<0)return;if(Z.key==="Delete"||Z.key==="Backspace")Z.preventDefault(),G0();else if(Z.key==="Escape")W=-1,N()}function G0(){if(W<0)return;Q.splice(W,1),W=-1,J(),N()}return $.addEventListener("pointerdown",S0),$.addEventListener("pointermove",R0),$.addEventListener("pointerup",t),$.addEventListener("pointercancel",t),$.addEventListener("dblclick",O0),$.tabIndex=0,$.addEventListener("keydown",_0),N(),{setTool(Z){z=Z,W=-1,$.style.cursor=Z?"crosshair":"default",N()},deleteSelected:G0,clear(){Q.length=0,W=-1,J(),N()},hasShapes:()=>Q.length>0,hasSelection:()=>W>=0,toDataUrl(){let Z=document.createElement("canvas");Z.width=j.naturalWidth,Z.height=j.naturalHeight;let K=Z.getContext("2d");if(!K)return $.toDataURL("image/png");K.drawImage(j,0,0);let w=H();for(let G of Q)O(K,G,w);return Z.toDataURL("image/png")},destroy(){y(!1),$.removeEventListener("pointerdown",S0),$.removeEventListener("pointermove",R0),$.removeEventListener("pointerup",t),$.removeEventListener("pointercancel",t),$.removeEventListener("dblclick",O0),$.removeEventListener("keydown",_0)}}}var g1=`
34
+ :host { all: initial; }
35
+ * { box-sizing: border-box; }
36
+
37
+ .backdrop {
38
+ position: fixed; inset: 0; z-index: 2147483000;
39
+ display: flex; align-items: center; justify-content: center;
40
+ padding: 24px; background: rgba(15, 23, 42, 0.55);
41
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
42
+ color: #0f172a;
43
+ }
44
+ .panel {
45
+ display: flex; flex-direction: column; gap: 16px;
46
+ width: min(820px, 100%); max-height: 90vh; overflow-y: auto;
47
+ /* No bottom padding: the footer supplies its own and sits flush, so it can
48
+ stick to the panel's edge without a gap under it. */
49
+ padding: 24px 24px 0; border-radius: 16px; background: #fff;
50
+ box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
51
+ }
52
+ .head { display: flex; align-items: flex-start; gap: 12px; }
53
+ h2 { margin: 0; font-size: 20px; font-weight: 700; flex: 1; }
54
+ label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
55
+ .req { color: #dc2626; }
56
+ .hint { font-weight: 400; color: #64748b; }
57
+ input[type="text"], textarea {
58
+ width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
59
+ border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: inherit;
60
+ }
61
+ input[type="text"]:focus, textarea:focus {
62
+ outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
63
+ }
64
+ textarea { min-height: 88px; resize: vertical; }
65
+
66
+ .meta {
67
+ padding: 12px 14px; border-radius: 10px; background: #f8fafc;
68
+ font-size: 13px; line-height: 1.7; color: #475569; word-break: break-all;
69
+ }
70
+ .meta b { color: #0f172a; font-weight: 600; }
71
+
72
+ .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
73
+ .sep { width: 1px; align-self: stretch; background: #e2e8f0; margin: 0 4px; }
74
+ button {
75
+ display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
76
+ padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 500;
77
+ border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: inherit;
78
+ }
79
+ button:hover:not(:disabled) { background: #f1f5f9; }
80
+ button:disabled { opacity: 0.5; cursor: not-allowed; }
81
+ button[aria-pressed="true"] { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
82
+ button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
83
+ button.primary:hover:not(:disabled) { background: #1d4ed8; }
84
+ button.icon { padding: 6px 10px; border-color: transparent; font-size: 18px; line-height: 1; }
85
+
86
+ /* The on-image text editor. Absolutely placed over the canvas and matched to
87
+ the shape it becomes — same weight, same red, same white plate — so what you
88
+ type is what gets drawn, at the position you clicked. Sized in JS, because
89
+ the font size tracks the image's own scale. */
90
+ .text-edit {
91
+ position: absolute; z-index: 2; margin: 0; padding: 2px 4px;
92
+ font-family: system-ui, sans-serif; font-weight: 600; line-height: 1.25;
93
+ color: #e11d48; background: rgba(255, 255, 255, 0.92);
94
+ border: 1px dashed #e11d48; border-radius: 4px; outline: none;
95
+ box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
96
+ }
97
+ .text-edit::placeholder { color: rgba(225, 29, 72, 0.45); }
98
+
99
+ canvas { width: 100%; height: auto; display: block; border: 1px solid #e2e8f0; border-radius: 10px; touch-action: none; }
100
+ .shot { position: relative; }
101
+ .status { font-size: 13px; color: #64748b; }
102
+ .status[data-tone="error"] { color: #dc2626; }
103
+ /* Pinned to the bottom of the scrolling panel.
104
+ A screenshot is tall — often taller than the viewport — so แจ้งปัญหา sat
105
+ below the fold and the last step of filing a report was "scroll to the end
106
+ and find the button". Sticky, with its own ground and a rule above it so the
107
+ annotated image scrolls underneath rather than bleeding into it. */
108
+ .foot {
109
+ position: sticky; bottom: 0; z-index: 3;
110
+ display: flex; align-items: center; gap: 12px;
111
+ margin: 4px -24px 0; padding: 12px 24px;
112
+ background: #fff; border-top: 1px solid #e2e8f0;
113
+ border-radius: 0 0 16px 16px;
114
+ }
115
+ .foot .grow { flex: 1; }
116
+ `;var n="lw-debug-reporter",M4=()=>[];var H4=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function I4(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;constructor(){super();this.root=this.attachShadow({mode:"open"})}connectedCallback(){this.dataset.debugReporter="true",this.stop=Q1((j)=>void this.open(j))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(j){if(this.busy)return;this.busy=!0;let J=Z0(R().locale),Q=await D1();if(Q.method==="cancelled"){this.close();return}this.bundle=q1({reason:j,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:C4()}),this.renderForm(J)}close(){this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren()}shell(j){let J=document.createElement("style");J.textContent=g1;let Q=document.createElement("div");Q.className="backdrop";let z=document.createElement("div");return z.className="panel",z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label",j.title),Q.append(z),this.root.replaceChildren(J,Q),z}renderShell(j,J){let Q=this.shell(j),z=B("div","head");z.append(B("h2","",j.title)),Q.append(z,B("p","status",J))}renderForm(j){let J=this.bundle;if(!J)return;let Q=this.shell(j),z=B("div","head"),W=m("✕","icon");W.setAttribute("aria-label",j.close),W.addEventListener("click",()=>this.close()),z.append(B("h2","",j.title),W);let V=document.createElement("input");V.type="text",V.placeholder=j.summaryPlaceholder;let X=N0(j.summaryLabel,j.summaryRequired,!0),F=document.createElement("textarea");F.placeholder=j.detailPlaceholder;let H=B("div","meta");H.innerHTML="";let{context:C}=J;for(let[D,O]of[[j.reporter,`${C.user.fullName??"—"} (${C.user.email??"—"})`],[j.page,C.route.href],[j.captured,`${J.network.length} network · ${J.console.length} console · ${J.actionTrail.length} actions`]]){let s=document.createElement("div"),N=document.createElement("b");N.textContent=`${D}: `,s.append(N,document.createTextNode(O)),H.append(s)}let P=B("p","status",""),U=m(j.submit,"primary");if(U.disabled=!0,V.addEventListener("input",()=>{U.disabled=V.value.trim().length===0}),Q.append(z,X,V,N0(j.detailLabel),F,H),J.screenshotDataUrl)Q.append(...this.screenshotSection(j,J.screenshotDataUrl));else Q.append(B("p","status",j.noScreenshot));let f=B("div","foot"),q=m(j.close);q.addEventListener("click",()=>this.close()),f.append(q,P,B("span","grow"),U),Q.append(f),U.addEventListener("click",async()=>{U.disabled=!0,P.dataset.tone="",P.textContent=j.submitting;try{let D=await _1(V.value.trim(),{...J,note:F.value,screenshotDataUrl:this.annotator?.hasShapes()?this.annotator.toDataUrl():J.screenshotDataUrl}),O=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:D,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(),O)l(`${j.submitted} — #${D.number}`,"success")}catch(D){let O=D instanceof Error?D.message:j.failed;P.dataset.tone="error",P.textContent=O,l(`${j.failed} — ${O}`,"error"),U.disabled=!1}}),V.focus()}screenshotSection(j,J){let Q=N0(j.annotateHint),z=B("div","tools"),W=document.createElement("canvas"),V=B("div","shot");V.append(W);let X=[],F=(U)=>{for(let f of X)f.setAttribute("aria-pressed",String(f===U))};for(let{tool:U,key:f}of H4){let q=m(j[f]);q.setAttribute("aria-pressed","false"),q.addEventListener("click",()=>{let D=q.getAttribute("aria-pressed")==="true";F(D?null:q),this.annotator?.setTool(D?null:U)}),X.push(q),z.append(q)}z.append(B("span","sep"));let H=m(j.deleteSelected);H.addEventListener("click",()=>this.annotator?.deleteSelected());let C=m(j.clearAll);C.addEventListener("click",()=>{this.annotator?.clear(),F(null)}),z.append(H,C);let P=new Image;return P.onload=()=>{W.width=P.naturalWidth,W.height=P.naturalHeight,this.annotator=p1(W,P,()=>{F(null),H.disabled=!this.annotator?.hasSelection()})},P.src=J,[Q,z,B("p","status",j.annotateHelp),V]}}}function C4(){try{return M4()}catch{return[]}}function B($,j="",J=""){let Q=document.createElement($);if(j)Q.className=j;if(J)Q.textContent=J;return Q}function m($,j=""){let J=document.createElement("button");if(J.type="button",J.textContent=$,j)J.className=j;return J}function N0($,j="",J=!1){let Q=document.createElement("label");if(Q.append(document.createTextNode($)),J){let z=document.createElement("span");z.className="req",z.textContent=" *",Q.append(z)}if(j){let z=document.createElement("span");z.className="hint",z.textContent=` ${j}`,Q.append(z)}return Q}function m1(){if(typeof window>"u"||customElements.get(n))return;customElements.define(n,I4())}var y1=!1;function v1($={}){if(y1||typeof window>"u")return;if(!A0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(y1=!0,U1(),a0(),d0(),G1(),$.ui===!1)return;let j=Z0(R().locale);if(z1((J)=>{l(J.message??j.crashed,"error",{label:j.crashAction,onClick:()=>Q0(J)})}),m1(),!document.querySelector(n))document.body.append(document.createElement(n))}var U4=document.currentScript,L=U4?.dataset??{};if(L.host&&L.realmKey)T0({host:L.host,realmKey:L.realmKey,app:{name:L.appName??document.title??"app",version:L.appVersion??"0.0.0",environment:L.environment??"production"},locale:L.locale==="en"?"en":"th"}),v1();window.lwReportProblem=Q0;})();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @lightworkai.official/debug-capture
3
+ *
4
+ * Rolling capture of what a user was doing — network, console, actions — plus a
5
+ * screenshot they can draw on, filed as a ticket on a Lightwork Support host.
6
+ *
7
+ * Extracted from an in-app reporter built for a single app. What changed is
8
+ * everything that made it one app's: the user store, the env module, the API
9
+ * client and a hard-coded Thai module vocabulary are all config now. Nothing in
10
+ * this package is confidential, and the realm key it takes is public by design.
11
+ */
12
+ export { configureDebugCapture, isConfigured, getConfig, appInfo } from "./config";
13
+ export type { DebugCaptureConfig, CaptureOptions, RedactOptions } from "./config";
14
+ export { installDebugCapture } from "./install";
15
+ export type { InstallOptions } from "./install";
16
+ export { launch, onLaunch, onCrash, emitCrash } from "./reporter";
17
+ export { buildBundle, bundleToMarkdown, hasCause, bundleFileName, toCurl } from "./bundle";
18
+ export { submitBundle } from "./submit";
19
+ export type { FiledTicket } from "./submit";
20
+ export { errorSignature } from "./signature";
21
+ export { trimToBudget, BUNDLE_BUDGET_BYTES } from "./budget";
22
+ export { captureScreen } from "./screenshot";
23
+ export { getNetworkLog } from "./capture/networkBuffer";
24
+ export { getConsoleLog } from "./capture/consoleBuffer";
25
+ export { getActionTrail, actionCountSuffix } from "./capture/actionTrail";
26
+ export { correlateActionTrail, isQuietStep, isFailedRequest, requestPath, formatDuration } from "./capture/stepCorrelation";
27
+ export type { StepActivity } from "./capture/stepCorrelation";
28
+ export { redactBody, redactHeaders, redactLabel, redactUrl, REDACTED } from "./capture/redact";
29
+ export { defineReporterElement, setErroredQueriesSource, REPORTER_TAG } from "./ui/element";
30
+ export { showToast } from "./ui/toast";
31
+ export { createAnnotator } from "./ui/annotator";
32
+ export type { Annotator, AnnotatorTool } from "./ui/annotator";
33
+ export { strings as reporterStrings } from "./ui/strings";
34
+ export type { Strings as ReporterStrings } from "./ui/strings";
35
+ export { listMyTickets, getMyTicket, getMyTicketByNumber, getMyTicketHistory, replyToTicket, editMyMessage, reopenMyTicket, uploadInlineImage, getAttachmentUrl, fetchRealmConfig, TicketApiError, NoIdentityError, } from "./mytickets/api";
36
+ export type { MyTicket, MyTicketListItem, MyTicketDetail, TicketMessage, TicketAttachment, StatusEvent, StatusColumn, RealmConfig, } from "./mytickets/api";
37
+ export { ticketKey, formatDateTime, statusMaps, hasSolution, hasTeamReply, responseRank, compareBy, matchesKeyword, pageOf, pageCount, PAGE_SIZE, } from "./mytickets/format";
38
+ export type { StatusMaps, Sort, SortKey } from "./mytickets/format";
39
+ export { toPlainText, looksLikeHtml, renderBody, cleanHtml, htmlIsEmpty, ALLOWED_TAGS, ALLOWED_ATTR, isAllowedHref, isAllowedImageSrc, } from "./mytickets/sanitize";
40
+ export { NOTE_TOOLBAR, FULL_TOOLBAR } from "./mytickets/toolbar";
41
+ export type { EditorTool } from "./mytickets/toolbar";
42
+ export { ticketStrings } from "./mytickets/strings";
43
+ export type { TicketStrings } from "./mytickets/strings";
44
+ export { statusTone, STATUS_TONES } from "./mytickets/format";
45
+ export type * from "./types";
package/dist/index.mjs ADDED
@@ -0,0 +1,129 @@
1
+ var M2={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},L=null;function C2($){L=$}function B(){if(!L)throw Error("[debug-capture] configureDebugCapture() has not been called");return L}function F0(){return L!==null}function x(){let $=B().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??U2()}}function U2(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function E($){let j=L?.capture?.[$];return typeof j==="number"?j:M2[$]}function $1($){let j=L?.module;if(!j)return null;try{return j($)??null}catch{return null}}function $0(){let $=L?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((j)=>j.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((j)=>j.toLowerCase())}}function j1(){return L?.capture?.overlaySelectors??[]}function J1($){if(typeof window>"u")return!1;let j;try{j=new URL($,window.location.href)}catch{return!1}if(P2(j))return!1;if(j.origin===window.location.origin)return!0;return(L?.capture?.bodyOrigins??[]).some((J)=>{try{return new URL(J).origin===j.origin}catch{return!1}})}function P2($){if(!L?.host)return!1;try{if(new URL(L.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}var v="‹redacted›",w2=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,I2=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),D2=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,B2=/[\w.+-]+@[\w-]+\.[\w.-]+/g,N2=/\d(?:[\d\s-]{7,})\d/g;function g($){return $.replace(B2,v).replace(N2,v)}function q2($){if(w2.test($))return!0;return $0().headers.some((J)=>J.toLowerCase()===$.toLowerCase())}function m($){let j={};for(let[J,Q]of Object.entries($))j[J]=q2(J)?v:Q;return j}function y($){try{let j=/^https?:\/\//i.test($),J=new URL($,j?void 0:"http://local.invalid"),Q=!1;if(J.searchParams.forEach((Z,z)=>{if(I2.has(z.toLowerCase())||$0().queryKeys.includes(z.toLowerCase()))J.searchParams.set(z,v),Q=!0}),!Q)return $;return j?J.toString():`${J.pathname}${J.search}`}catch{return $}}function H0($,j){if(j>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Q)=>H0(Q,j+1));let J={};for(let[Q,Z]of Object.entries($)){let z=D2.test(Q)||$0().bodyKeys.some((V)=>Q.toLowerCase().includes(V));J[Q]=z?v:H0(Z,j+1)}return J}function b($,j){if($==null)return null;let J=$,Q=$.trim();if(Q.startsWith("{")||Q.startsWith("["))try{let Z=JSON.parse(Q);J=JSON.stringify(H0(Z,0))}catch{}if(J.length>j)return`${J.slice(0,j)}… [truncated ${J.length-j} chars]`;return J}var M0=120,C0=40,d=($,j)=>$.length>j?`${$.slice(0,j)}…`:$,U0=($)=>{try{return decodeURIComponent($)}catch{return $}},u=[],Q1=0,Z1=!1;function n($,j,J,Q){let Z=d(j,M0),z=u[u.length-1];if($==="navigate"&&z?.kind==="click"){let Y=Z.replace(/^ไปที่\s*/,"");if(z.detail.includes(`→ ${Y}`))return z.at=new Date().toISOString(),z;let F=Y.split(/[?#]/)[0]??Y,C=z.source?U0(z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(C&&(F===C||F.startsWith(C)))return z.detail=d(`${z.detail} → ${Y}`,M0),z.source=void 0,z.at=new Date().toISOString(),z}if(z&&z.kind===$&&z.detail===Z){if(z.at=new Date().toISOString(),$!=="navigate")z.count=(z.count??1)+1;return z}Q1+=1;let V={id:`act_${Q1}`,at:new Date().toISOString(),kind:$,detail:Z,count:1,source:J,html:J0(Q)};u.push(V);while(u.length>E("maxActions"))S2(u.shift());return V}var R2=200000,r=0;function J0($){if(!$)return;if(r+$.length>R2)return;return r+=$.length,$}function S2($){if(!$)return;if(r-=($.html?.length??0)+($.afterHtml?.length??0),r<0)r=0}function P0($){return $&&$>1?` (×${$})`:""}function j0($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var O2='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',_2={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},z1={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function f2($){let j=$.getAttribute("role");if(j&&z1[j])return z1[j];return _2[$.tagName.toLowerCase()]??"ปุ่ม"}function L2($,j){try{let J=$,Q=0;while(J&&Q<=j){let Z=G1(J);if(Z&&typeof Z.memoizedProps?.onClick==="function")return J;J=J.parentElement,Q+=1}}catch{}return null}function k2($){let j=$.getAttribute("aria-label")?.trim();if(j)return j;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 Q=($.textContent??"").replace(/\s+/g," ").trim();if(Q)return Q;if($ instanceof HTMLAnchorElement){let Z=$.getAttribute("href");if(Z?.startsWith("/"))return U0(Z)}return""}function A2($){if(!($ instanceof Element))return null;let j=$.closest(O2)??L2($,4);if(!j)return null;let J=j.tagName.toLowerCase();if(J==="html"||J==="body")return null;return j}function T2($){let j=g(k2($));if(!j)return null;return`${f2($)} “${d(j,C0)}”`}var Y1=6000,x2=4000,E2=/(?:^|\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 p2($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Z)=>Z.remove());let j=[$,...Array.from($.querySelectorAll("*"))];for(let Z of j){for(let V of Array.from(Z.attributes)){let Y=V.name.toLowerCase();if(Y.startsWith("on")||Y==="srcdoc"||Y==="value"||Y.startsWith("data-"))Z.removeAttribute(V.name)}if(Z instanceof HTMLAnchorElement)Z.setAttribute("href","#");if(Z instanceof HTMLImageElement)Z.removeAttribute("src");let z=Z.getAttribute("class");if(z){let V=z.replace(E2," ").replace(/\s+/g," ").trim();if(V)Z.setAttribute("class",V);else Z.removeAttribute("class")}}let J=document.createTreeWalker($,NodeFilter.SHOW_TEXT),Q=J.nextNode();while(Q){if(Q.nodeValue)Q.nodeValue=g(Q.nodeValue);Q=J.nextNode()}}function w0($,j,J){try{let Q=$.outerHTML;if(!Q||Q.length>j)return;let Z=$.cloneNode(!0);p2(Z);let z=Z.outerHTML;return z&&z.length<=J?z:void 0}catch{return}}var h2=($)=>w0($,Y1,x2),v2=150000,g2=40000,W1=($)=>w0($,v2,g2);function m2($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let j=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${g(j)}”`}var V1=80;function G1($){let j=Object.keys($).find((J)=>J.startsWith("__reactFiber$")||J.startsWith("__reactInternalInstance$"));return j?$[j]:null}function y2($){if(typeof $!=="function")return null;try{let j=Function.prototype.toString.call($);return(j.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??j.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function K1($){if(!$)return;return`→ ${$.length>V1?`${$.slice(0,V1)}…`:$}`}function b2($){try{let j=$.closest("a[href]")?.getAttribute("href");if(j&&j.startsWith("/"))return K1(j);let J=G1($),Q=0;while(J&&Q<30){if(typeof J.memoizedProps?.onClick==="function")return K1(y2(J.memoizedProps.onClick));J=J.return,Q+=1}return}catch{return}}var u2='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function d2(){let $=j1();return $.length?$.join(", "):u2}function c2($){let j=$.getAttribute("role");if(j==="status"||j==="alert")return"ข้อความแจ้งเตือน";if(j==="menu")return"เมนู";if(j==="listbox")return"รายการตัวเลือก";if(j==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function i2($){let j=$.getAttribute("aria-label")?.trim();if(j)return j;let J=$.getAttribute("aria-labelledby");if(J){let z=J.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(z)return z}let Z=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Z)return Z;return($.textContent??"").replace(/\s+/g," ").trim()}function F1($){let j=g(i2($)),J=c2($);return j?`เปิด ${J} “${d(j,C0)}”`:`เปิด ${J}`}var o2='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',l2=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function n2($){if($.querySelector(o2))return!0;return l2.test($.textContent??"")}var r2=400,s2=250,a2=8000;function t2($,j){if(typeof MutationObserver>"u"){j.html=J0(W1($));return}let J=Date.now(),Q=!1,Z=()=>{Q=!0,V.disconnect(),window.clearInterval(Y),window.clearTimeout(F)},z=()=>{if(Q)return;if(Z(),!$.isConnected)return;j.detail=d(F1($),M0),j.html=J0(W1($))},V=new MutationObserver(()=>{J=Date.now()});V.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let Y=window.setInterval(()=>{if(Q)return;if(!$.isConnected){Z();return}if(Date.now()-J>=r2&&!n2($))z()},s2),F=window.setTimeout(z,a2)}function e2($){if(j0($))return;let j=n("ui",F1($));if(j)t2($,j)}function $4(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((J)=>{for(let Q of J)for(let Z of Array.from(Q.addedNodes)){if(!(Z instanceof Element))continue;let z=d2(),V=Z.matches(z)?[Z]:Array.from(Z.querySelectorAll(z));for(let Y of V){if($.has(Y))continue;$.add(Y),e2(Y)}}}).observe(document.body,{childList:!0,subtree:!0})}var j4=1600,J4=2500;function X1($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:d(($.textContent??"").replace(/\s+/g," ").trim(),C0)}}function Q4($,j){if(!$.disabled&&j.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&j.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==j.text&&j.text)return`ข้อความเปลี่ยนเป็น “${j.text}”`;return null}function Z4($,j){if(typeof MutationObserver>"u")return;let J=X1($),Q=!1,Z=(Y,F)=>{if(Q)return;if(Q=!0,z.disconnect(),window.clearTimeout(V),j.afterNote=Y,F)j.afterHtml=J0(w0($,Y1,J4))},z=new MutationObserver(()=>{if(!$.isConnected){Z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let Y=Q4(J,X1($));if(Y)Z(Y,!0)});z.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!Q&&!$.isConnected){Z("องค์ประกอบหายไปจากหน้าจอ",!1);return}Q=!0,z.disconnect()},j4)}function H1(){if(Z1||typeof window>"u")return;Z1=!0,document.addEventListener("click",(Q)=>{if(j0(Q.target))return;let Z=A2(Q.target);if(!Z)return;let z=T2(Z);if(!z)return;let V=n("click",`คลิก ${z}`,b2(Z),h2(Z));if(V)Z4(Z,V)},{capture:!0,passive:!0}),document.addEventListener("change",(Q)=>{if(j0(Q.target))return;let Z=m2(Q.target);if(Z)n("input",`แก้ไข ${Z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(Q)=>{if(j0(Q.target))return;n("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>n("navigate",`ไปที่ ${U0(y(location.pathname+location.search))}`),j=history.pushState.bind(history),J=history.replaceState.bind(history);history.pushState=(...Q)=>{let Z=j(...Q);return $(),Z},history.replaceState=(...Q)=>{let Z=J(...Q);return $(),Z},window.addEventListener("popstate",$),$4()}function I0(){return u.map(($)=>({...$}))}var M1=2000,Q0=[],C1=0,U1=!1;function D0($,j){C1+=1,Q0.push({id:`log_${C1}`,at:new Date().toISOString(),level:$,message:j.length>M1?`${j.slice(0,M1)}…`:j});while(Q0.length>E("maxConsoleEntries"))Q0.shift()}function z4(){let $=new WeakSet;return(j,J)=>{if(typeof J==="object"&&J!==null){if($.has(J))return"[Circular]";$.add(J)}if(typeof J==="bigint")return J.toString();return J}}function P1($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{return JSON.stringify($,z4())??String($)}catch{return String($)}}function w1(){if(U1||typeof window>"u")return;U1=!0;let $=["log","info","warn","error","debug"];for(let j of $){let J=console[j].bind(console);console[j]=(...Q)=>{D0(j,Q.map(P1).join(" ")),J(...Q)}}window.addEventListener("error",(j)=>{let J=j.filename?` (${j.filename}:${j.lineno}:${j.colno})`:"";D0("exception",`${j.message}${J}`)}),window.addEventListener("unhandledrejection",(j)=>{let J=j.reason instanceof Error?`${j.reason.name}: ${j.reason.message}`:P1(j.reason);D0("unhandledrejection",J)})}function B0(){return Q0.map(($)=>({...$}))}var I1=new Set,D1=new Set;function B1($,j){return $.add(j),()=>$.delete(j)}function N1($,j){for(let J of[...$])J(j)}function N0($){return B1(I1,$)}function q0($={type:"manual"}){N1(I1,$)}function R0($){return B1(D1,$)}function S0($){N1(D1,$)}var W4=15000,V4=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],q1=!1,R1=0;function K4($){return V4.some((j)=>$.includes(j))}function S1($){let j=$.message??"";if(!j||K4(j))return;let J=Date.now();if(J-R1<W4)return;R1=J,S0({...$,message:j})}function O1(){if(q1||typeof window>"u")return;q1=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let j=$.error instanceof Error?$.error:null;S1({type:"runtime-error",message:$.message||(j?j.message:"Unknown error"),stack:j?.stack})}),window.addEventListener("unhandledrejection",($)=>{let j=$.reason;S1({type:"unhandledrejection",message:j instanceof Error?j.message:String(j),stack:j instanceof Error?j.stack:void 0})})}var k1=4000,X4=1e6,Y4=1e7,Z0=[],_1=0,f1=!1;function A1($){Z0.push($);while(Z0.length>E("maxRequests"))Z0.shift()}function T1(){return _1+=1,`req_${_1}`}function L1($){let j={};if(!$)return j;if($ instanceof Headers)$.forEach((J,Q)=>{j[Q]=J});else if(Array.isArray($))for(let[J,Q]of $)j[J]=Q;else Object.assign(j,$);return j}function G4($){let j={};return $.forEach((J,Q)=>{j[Q]=J}),j}function F4($){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 H4($,j){let J="",Q="GET",Z={},z=null;if(typeof $==="string")J=$;else if($ instanceof URL)J=$.toString();else J=$.url,Q=$.method||Q,Z=L1($.headers);if(j){if(j.method)Q=j.method;if(j.headers)Z={...Z,...L1(j.headers)};if(j.body!==void 0)z=F4(j.body)}return{method:Q.toUpperCase(),url:J,headers:Z,body:z}}function x1($){return!J1($)}function M4($,j){if(x1(j.url)){j.responseSnippet="[body not captured for this origin]";return}let J=$.headers.get("content-type")??"",Q=Number($.headers.get("content-length")??"0"),Z=Q?`, ~${Q} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(J)){j.responseSnippet=`[binary ${J||"unknown"}${Z}]`;return}if(Q>X4){j.responseSnippet=`[response ${J||"text"}${Z} — omitted]`;return}try{$.clone().text().then((z)=>{j.responseSnippet=b(z,E("maxBodyChars"))}).catch(()=>{})}catch{}}function E1($,j){if(/[?&]_rsc=/.test($))return!0;for(let J of Object.keys(j)){let Q=J.toLowerCase();if(Q==="rsc"||Q==="next-router-prefetch"||Q==="next-router-state-tree")return!0}return!1}function C4(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(j,J)=>{let Q=H4(j,J);if(E1(Q.url,Q.headers))return $(j,J);let Z={id:T1(),startedAt:new Date().toISOString(),method:Q.method,url:y(Q.url),requestHeaders:m(Q.headers),requestBody:b(Q.body,k1),status:null,statusText:null,durationMs:null,via:"fetch"};A1(Z);let z=performance.now();try{let V=await $(j,J);return Z.status=V.status,Z.statusText=V.statusText,Z.durationMs=Math.round(performance.now()-z),Z.responseHeaders=m(G4(V.headers)),M4(V,Z),V}catch(V){throw Z.durationMs=Math.round(performance.now()-z),Z.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},$)}function U4(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,j=$.open,J=$.send,Q=function(z,V){let Y=typeof V==="string"?V:V.toString();return this.__cibEntry=E1(Y,{})?void 0:{id:T1(),startedAt:"",method:(z||"GET").toUpperCase(),url:y(Y),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},j.apply(this,arguments)},Z=function(z){let V=this.__cibEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof z==="string"?b(z,k1):z==null?null:"[non-string body]";let Y=performance.now();A1(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-Y),x1(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=b(this.responseText||"",E("maxBodyChars"))}catch{}else{let F=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${F}]`}})}return J.apply(this,arguments)};$.open=Q,$.send=Z}function p1(){if(f1)return;f1=!0,C4(),U4()}function O0(){let $=Z0.map((J)=>({...J})),j=0;for(let J=$.length-1;J>=0;J-=1){let Q=$[J],Z=Q?.responseSnippet;if(!Q||typeof Z!=="string"||Z.length===0)continue;if(j+Z.length>Y4)Q.responseSnippet=`[response omitted — report size budget reached (${Z.length.toLocaleString()} chars)]`;else j+=Z.length}return $}var P4={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า"},w4={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",captured:"Captured",reporter:"Reporter",page:"Page"};function s($){return $==="en"?w4:P4}var _0=null;function I4(){if(typeof document>"u")return null;if(_0?.isConnected)return _0;let $=document.createElement("lw-debug-toasts");$.dataset.debugReporter="true";let j=$.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`
2
+ :host { all: initial; }
3
+ .stack {
4
+ position: fixed; top: 16px; right: 16px; z-index: 2147483001;
5
+ display: flex; flex-direction: column; gap: 8px; pointer-events: none;
6
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
7
+ }
8
+ .toast {
9
+ pointer-events: auto; display: flex; align-items: center; gap: 8px;
10
+ max-width: 380px; padding: 12px 14px; border-radius: 10px;
11
+ font-size: 14px; line-height: 1.5; color: #0f172a;
12
+ background: #fff; border: 1px solid #e2e8f0;
13
+ box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
14
+ animation: in 160ms ease-out;
15
+ }
16
+ .toast[data-tone="success"] { border-left: 3px solid #10b981; }
17
+ .toast[data-tone="error"] { border-left: 3px solid #e11d48; }
18
+ .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
19
+ .toast[data-tone="success"] .dot { background: #10b981; }
20
+ .toast[data-tone="error"] .dot { background: #e11d48; }
21
+ .action {
22
+ flex: none; cursor: pointer; padding: 5px 10px; margin-left: auto;
23
+ font: inherit; font-size: 13px; font-weight: 600;
24
+ color: #fff; background: #0f172a; border: none; border-radius: 7px;
25
+ }
26
+ .action + .close { margin-left: 4px; }
27
+ .close {
28
+ margin-left: auto; flex: none; cursor: pointer; border: none; background: none;
29
+ padding: 0 2px; font: inherit; font-size: 16px; line-height: 1; color: #94a3b8;
30
+ }
31
+ @keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
32
+ @media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
33
+ `;let Q=document.createElement("div");return Q.className="stack",Q.setAttribute("role","status"),Q.setAttribute("aria-live","polite"),j.append(J,Q),document.body.append($),_0=Q,Q}function c($,j="success",J){let Q=I4();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=j;let z=document.createElement("span");z.className="dot";let V=document.createElement("span");V.textContent=$;let Y=document.createElement("button");Y.type="button",Y.className="close",Y.textContent="✕",Y.setAttribute("aria-label","ปิด");let F=()=>{window.clearTimeout(C),Z.remove()};Y.addEventListener("click",F);let C=j==="error"||J?0:window.setTimeout(F,6000);if(Z.append(z,V),J){let P=document.createElement("button");P.type="button",P.className="action",P.textContent=J.label,P.addEventListener("click",()=>{F(),J.onClick()}),Z.append(P)}Z.append(Y),Q.append(Z)}function h1($,j,J){let Q=$.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})),Z=j.filter((z)=>z.level==="error"||z.level==="exception"||z.level==="unhandledrejection").slice(-20).map((z)=>z.message);return{failedRequests:Q,errors:Z,erroredQueries:J.slice(0,20)}}function v1($){return $.failedRequests.length+$.errors.length+$.erroredQueries.length}function D4(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let j=performance.memory;if(j)$.memoryUsedMb=Math.round(j.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(j.jsHeapSizeLimit/1024/1024);let[J]=performance.getEntriesByType("navigation");if(J)$.domContentLoadedMs=Math.round(J.domContentLoadedEventEnd),$.loadEventMs=Math.round(J.loadEventEnd);return $}function f0($,j){if(!$)return j;try{return $()}catch{return j}}function g1(){let $=B(),{pathname:j,search:J,href:Q}=window.location;return{capturedAt:new Date().toISOString(),route:{href:Q,pathname:j,search:J},module:$1(j),user:f0($.user,{}),apiHeaders:m(f0($.headers,{})),app:{name:x().name,version:x().version,environment:x().environment},client:{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,online:navigator.onLine,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio},screen:{width:window.screen.width,height:window.screen.height}},performance:D4(),extra:f0($.extra,{})}}var B4=2,N4={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function L0($){let j=O0(),J=B0();return{context:g1(),reason:$.reason,note:$.note,cause:h1(j,J,$.erroredQueries),actionTrail:I0(),network:j,console:J,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:B4}}}function m1($){return $.replace(/'/g,"'\\''")}function y1($){let j=[`curl -X ${$.method} '${$.url}'`];for(let[J,Q]of Object.entries($.requestHeaders))j.push(` -H '${J}: ${m1(Q)}'`);if($.requestBody)j.push(` --data '${m1($.requestBody)}'`);return j.join(" \\\n")}function q4($){if($.error)return`ERR ${$.error}`;return`${$.status??"—"} ${$.statusText??""}`.trim()}function R4($){if($.length===0)return"No network activity captured.";return $.map((j)=>{let J=j.durationMs!=null?`${j.durationMs}ms`:"—",Q=`# [${q4(j)}] ${j.method} ${j.url} (${J}, ${j.startedAt})`,Z=j.responseSnippet?`
34
+ # response: ${j.responseSnippet}`:"";return`${Q}
35
+ ${y1(j)}${Z}`}).join(`
36
+
37
+ `)}function S4($){if($.length===0)return"No console output captured.";return $.map((j)=>`[${j.at}] ${j.level.toUpperCase()}: ${j.message}`).join(`
38
+ `)}function O4($){if($.length===0)return"No user actions captured.";let j=0;return $.map((J)=>{let Q=J.source?` (${J.source})`:"",Z=`${J.detail}${P0(J.count)}${Q}`;if(J.kind==="ui")return` ↳ [${J.at}] ${Z}`;j+=1;let z=`${j}. [${J.at}] ${Z}`;return J.afterNote?`${z}
39
+ ↳ ${J.afterNote}`:z}).join(`
40
+ `)}function _4($){let j=[];for(let J of $.failedRequests)j.push(`✗ ${J.status??J.error??"ERR"} ${J.method} ${J.url}`);for(let J of $.errors)j.push(`⚠ ${J}`);for(let J of $.erroredQueries)j.push(`⚠ React Query error: ${J.key} — ${J.error}`);return j}function f4($){let{context:j}=$;return[`User : ${j.user.fullName??"—"} (${j.user.email??"—"})`,`Unit : ${j.user.unit??"—"}`,`Roles : ${j.user.roles?.join(", ")||"—"}`,`Route : ${j.route.href}`,`Module : ${j.module?`${j.module.label} (${j.module.key})`:"—"}`,`App : ${j.app.name} v${j.app.version} · ${j.app.environment}`,`Memory : ${j.performance.memoryUsedMb??"—"}/${j.performance.memoryLimitMb??"—"} MB`,`Client : ${j.client.userAgent}`,`Viewport : ${j.client.viewport.width}×${j.client.viewport.height} @${j.client.viewport.dpr}x`,`Reason : ${N4[$.reason.type]}${$.reason.message?` — ${$.reason.message}`:""}`,`Captured : ${$.network.length} requests · ${$.console.length} console · ${$.actionTrail.length} actions · screenshot=${$.screenshotMethod}`]}function L4($){let j=_4($.cause),J=[`## \uD83D\uDC1E ${$.context.app.name} — Debug Report`,`**Generated:** ${$.context.capturedAt}`,"",...f4($).map((Q)=>`- ${Q.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${$.note.trim()||"(ไม่มี)"}`];if(j.length>0)J.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...j,"```");return J.push("",`<details><summary>ขั้นตอน (${$.actionTrail.length})</summary>`,"","```",O4($.actionTrail),"```","</details>","",`<details><summary>Network (${$.network.length})</summary>`,"","```",R4($.network),"```","</details>","",`<details><summary>Console (${$.console.length})</summary>`,"","```",S4($.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),J.join(`
41
+ `)}function k4($){return $.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function A4($,j){return`debug-report_${k4($.context.capturedAt)}.${j}`}function T4($){return v1($.cause)>0}async function k0(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let J=await x4();if(J.status==="ok")return{dataUrl:J.dataUrl,method:"display-media"};if(J.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let j=await h4();if(j)return{dataUrl:j,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function x4(){let $=null;try{let j={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(j);let J=await E4($);return J?{status:"ok",dataUrl:J}:{status:"error"}}catch(j){if(j instanceof DOMException&&(j.name==="NotAllowedError"||j.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((j)=>j.stop())}}async function E4($){let j=document.createElement("video");j.srcObject=$,j.muted=!0,j.playsInline=!0,await new Promise((V)=>{let Y=!1,F=()=>{if(Y)return;Y=!0,V()};j.onloadedmetadata=()=>{j.play().then(F).catch(F)},window.setTimeout(F,1500)}),await p4(j);let{videoWidth:J,videoHeight:Q}=j;if(!J||!Q)return null;let Z=document.createElement("canvas");Z.width=J,Z.height=Q;let z=Z.getContext("2d");if(!z)return null;z.drawImage(j,0,0,J,Q),j.pause(),j.srcObject=null;try{return Z.toDataURL("image/png")}catch{return null}}function p4($){return new Promise((j)=>{let J=!1,Q=()=>{if(J)return;J=!0,j()},Z=$;if(typeof Z.requestVideoFrameCallback==="function")Z.requestVideoFrameCallback(()=>Q()),window.setTimeout(Q,1000);else window.setTimeout(Q,250)})}async function h4(){let $=B().screenshotFallback;if(!$)return null;let j=await $().catch(()=>null);if(!j)return null;try{return await j(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(J)=>!(J instanceof HTMLElement&&J.dataset?.debugReporter==="true")})}catch{return null}}var v4=2000,g4=0.82,m4=3000000;function y4($){return new Promise((j,J)=>{let Q=new Image;Q.onload=()=>j(Q),Q.onerror=()=>J(Error("could not read the screenshot")),Q.src=$})}async function b1($){try{let j=await y4($),J=Math.max(j.naturalWidth,j.naturalHeight),Q=Math.min(1,v4/J),Z=document.createElement("canvas");Z.width=Math.max(1,Math.round(j.naturalWidth*Q)),Z.height=Math.max(1,Math.round(j.naturalHeight*Q));let z=Z.getContext("2d");if(!z)return $;z.fillStyle="#fff",z.fillRect(0,0,Z.width,Z.height),z.drawImage(j,0,0,Z.width,Z.height);let V=g4,Y=Z.toDataURL("image/jpeg",V);while(Y.length>m4&&V>0.4)V-=0.15,Y=Z.toDataURL("image/jpeg",V);return Y}catch{return $}}var b4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,u4=/^\d+$/,d4=/^[0-9a-f]{16,}$/i;function A0($){if($.reason.type==="manual")return null;let j=$.cause?.failedRequests?.[0];if(!j?.url)return null;let J;try{J=new URL(j.url,"http://x").pathname}catch{J=j.url}let Q=J.split("/").map((z)=>b4.test(z)||u4.test(z)||d4.test(z)?":id":z).join("/"),Z=j.status??(j.error?"ERR":"?");return`${j.method??"REQ"} ${Q} ${Z}`}var T0=2000000;function z0($){let{screenshotDataUrl:j,...J}=$;return JSON.stringify(J).length}function x0($,j=2000000){if(z0($)<=j)return $;let J=$.network.map((Z)=>({...Z})),Q={...$,network:J};for(let Z of J){if(z0(Q)<=j)return Q;if(typeof Z.responseSnippet==="string"&&Z.responseSnippet.length>35)Z.responseSnippet="[body dropped — report size budget]";if(typeof Z.requestBody==="string"&&Z.requestBody.length>35)Z.requestBody="[body dropped — report size budget]"}while(Q.network.length>1&&z0(Q)>j)Q.network=Q.network.slice(1);while(Q.console.length>1&&z0(Q)>j)Q.console=Q.console.slice(1);return Q}var u1=32768;function c4($){let j="";for(let J=0;J<$.length;J+=u1)j+=String.fromCharCode(...$.subarray(J,J+u1));return btoa(j)}function i4($){return{dataUri:`data:application/json;base64,${c4(new TextEncoder().encode(JSON.stringify($)))}`,filename:"debug-bundle.json"}}async function E0($,j){let J=B(),Q=x0(j,T0),{context:Z,note:z}=Q,V=[];if(Q.screenshotDataUrl){let P=await b1(Q.screenshotDataUrl);V.push({dataUri:P,filename:"screenshot.jpg"})}V.push(i4(Q));let Y=A0(Q),F={title:$,description:z.trim()||void 0,category:Z.module?.label||x().name,routeUrl:Z.route.href,priority:"MEDIUM",requesterEmail:Z.user.email??void 0,requesterName:Z.user.fullName??void 0,customFields:{unit:Z.user.unit??"",appVersion:Z.app.version,environment:Z.app.environment,reasonType:Q.reason.type,appName:x().name,module:Z.module?.label??""},context:{...Y?{signature:Y}:{},capturedAt:Z.capturedAt,reason:Q.reason,cause:Q.cause,actionTrail:Q.actionTrail,client:Z.client,performance:Z.performance,apiHeaders:Z.apiHeaders,extra:Z.extra,counts:{network:Q.network.length,console:Q.console.length,actions:Q.actionTrail.length},screenshotMethod:Q.screenshotMethod},attachments:V},C=await fetch(`${J.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey},body:JSON.stringify(F)});if(!C.ok){let P=C.headers.get("retry-after"),I=await C.json().then((w)=>w.error).catch(()=>null);throw Error(C.status===429?`Too many reports — try again in ${P??"a moment"}s`:I??`Report failed (${C.status})`)}return await C.json()}var a=Math.PI/6;function d1($,j,J){let Q=j.x-$.x,Z=j.y-$.y,z=Math.hypot(Q,Z),V=Math.atan2(Z,Q),Y=[{x:j.x,y:j.y},{x:j.x-J*Math.cos(V-a),y:j.y-J*Math.sin(V-a)},{x:j.x-J*Math.cos(V+a),y:j.y-J*Math.sin(V+a)}],F=J*Math.cos(a)*0.92;if(z<=F)return{shaft:null,head:Y};return{shaft:{from:$,to:{x:j.x-F*Math.cos(V),y:j.y-F*Math.sin(V)}},head:Y}}var p0="#f44336",o4="rgba(250, 204, 21, 0.4)",h0=22,c1="#2563eb",i1=9,o1=11,l1=18,n1=4,W0=8,l4=[{id:"nw",fx:0,fy:0,cursor:"nwse-resize"},{id:"n",fx:0.5,fy:0,cursor:"ns-resize"},{id:"ne",fx:1,fy:0,cursor:"nesw-resize"},{id:"e",fx:1,fy:0.5,cursor:"ew-resize"},{id:"se",fx:1,fy:1,cursor:"nwse-resize"},{id:"s",fx:0.5,fy:1,cursor:"ns-resize"},{id:"sw",fx:0,fy:1,cursor:"nesw-resize"},{id:"w",fx:0,fy:0.5,cursor:"ew-resize"}];function v0($,j,J){let Q=[],Z=null,z=-1,V=null,Y=null,F=$.getContext("2d");function C(){let W=$.getBoundingClientRect().width;return W>0?$.width/W:1}function P(W){let K=$.getBoundingClientRect();return{x:(W.clientX-K.left)/K.width*$.width,y:(W.clientY-K.top)/K.height*$.height}}function I(W){let K=W.size??h0;if(!F)return(W.text?.length??0)*K*0.6;F.save(),F.font=`600 ${K}px system-ui, sans-serif`;let G=F.measureText(W.text??"").width;return F.restore(),G}function w(W){if(W.tool==="text"){let K=W.size??h0;return{left:W.x1,top:W.y1,right:W.x1+I(W),bottom:W.y1+K*1.25}}return{left:Math.min(W.x1,W.x2),top:Math.min(W.y1,W.y2),right:Math.max(W.x1,W.x2),bottom:Math.max(W.y1,W.y2)}}function q(W){if(W.tool==="arrow")return[{id:"tail",x:W.x1,y:W.y1,cursor:"move"},{id:"head",x:W.x2,y:W.y2,cursor:"move"}];let K=w(W);if(W.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return l4.map((G)=>({id:G.id,x:K.left+(K.right-K.left)*G.fx,y:K.top+(K.bottom-K.top)*G.fy,cursor:G.cursor}))}function N(W){let K=w(W);return{x:K.right+l1*C(),y:K.top-l1*C()}}function R(W,K,G){let{shaft:X,head:H}=d1({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*G));if(X)W.lineCap="butt",W.beginPath(),W.moveTo(X.from.x,X.from.y),W.lineTo(X.to.x,X.to.y),W.stroke();W.beginPath(),W.moveTo(H[0].x,H[0].y),W.lineTo(H[1].x,H[1].y),W.lineTo(H[2].x,H[2].y),W.closePath(),W.fill()}function _(W,K,G){W.save(),W.lineWidth=Math.max(2,3*G),W.strokeStyle=p0,W.fillStyle=p0;let X=w(K);if(K.tool==="rect")W.strokeRect(X.left,X.top,X.right-X.left,X.bottom-X.top);else if(K.tool==="arrow")R(W,K,G);else if(K.tool==="highlight")W.fillStyle=o4,W.fillRect(X.left,X.top,X.right-X.left,X.bottom-X.top);else if(K.tool==="text"&&K.text){let H=K.size??h0;W.font=`600 ${H}px system-ui, sans-serif`,W.textBaseline="top";let M=H*0.22;W.fillStyle="rgba(255,255,255,0.92)",W.fillRect(X.left-M,X.top-M,X.right-X.left+M*2,X.bottom-X.top+M*2),W.fillStyle=p0,W.fillText(K.text,X.left,X.top)}W.restore()}function D(W,K,G){let X=w(K);W.save(),W.strokeStyle=c1,W.lineWidth=Math.max(1,1.5*G),W.setLineDash([6*G,4*G]),W.strokeRect(X.left,X.top,X.right-X.left,X.bottom-X.top),W.setLineDash([]);let H=i1*G;for(let f of q(K))W.fillStyle="#fff",W.strokeStyle=c1,W.lineWidth=Math.max(1,1.5*G),W.beginPath(),W.rect(f.x-H/2,f.y-H/2,H,H),W.fill(),W.stroke();let M=N(K),U=o1*G;W.beginPath(),W.arc(M.x,M.y,U,0,Math.PI*2),W.fillStyle="#dc2626",W.fill(),W.strokeStyle="#fff",W.lineWidth=Math.max(1.5,2*G),W.beginPath(),W.moveTo(M.x-U*0.4,M.y-U*0.4),W.lineTo(M.x+U*0.4,M.y+U*0.4),W.moveTo(M.x+U*0.4,M.y-U*0.4),W.lineTo(M.x-U*0.4,M.y+U*0.4),W.stroke(),W.restore()}function S(){if(!F)return;let W=C();if(F.clearRect(0,0,$.width,$.height),F.drawImage(j,0,0,$.width,$.height),Q.forEach((G,X)=>{if(X!==t)_(F,G,W)}),V)_(F,V,W);let K=Q[z];if(K&&!V)D(F,K,W)}function i0(W,K,G,X,H){return Math.abs(W-G)<=H&&Math.abs(K-X)<=H}function o0(W,K){let G=Q[z];if(!G)return null;let X=i1*C()/2+3*C();for(let H of q(G))if(i0(W,K,H.x,H.y,X))return H.id;return null}function l0(W,K){let G=Q[z];if(!G)return!1;let X=N(G);return i0(W,K,X.x,X.y,o1*C())}function Y0(W,K){let G=6*C();for(let X=Q.length-1;X>=0;X-=1){let H=Q[X];if(H.tool==="arrow"){let U=H.x2-H.x1,f=H.y2-H.y1,p=Math.hypot(U,f)||1,h=Math.max(0,Math.min(1,((W-H.x1)*U+(K-H.y1)*f)/(p*p)));if(Math.hypot(W-(H.x1+h*U),K-(H.y1+h*f))<=G+4*C())return X;continue}let M=w(H);if(W>=M.left-G&&W<=M.right+G&&K>=M.top-G&&K<=M.bottom+G)return X}return-1}function X2(W,K,G,X,H){if(K==="tail"){W.x1=G.x1+X,W.y1=G.y1+H;return}if(K==="head"){W.x2=G.x2+X,W.y2=G.y2+H;return}if(K==="size"){let H2=(G.size??24)+H;W.size=Math.max(10,H2);return}let M=w(G),{left:U,top:f,right:p,bottom:h}=M;if(K.includes("w"))U=Math.min(p-W0,U+X);if(K.includes("e"))p=Math.max(U+W0,p+X);if(K.includes("n"))f=Math.min(h-W0,f+H);if(K.includes("s"))h=Math.max(f+W0,h+H);W.x1=U,W.y1=f,W.x2=p,W.y2=h}function Y2(W,K,G,X){W.x1=K.x1+G,W.y1=K.y1+X,W.x2=K.x2+G,W.y2=K.y2+X}let k=null,t=-1,A={x:0,y:0,size:24};function G2(){let W=$.getBoundingClientRect().width;return W>0?W/$.width:1}function F2(W,K){if(!F)return W.length*K*0.6;F.save(),F.font=`600 ${K}px system-ui, sans-serif`;let G=F.measureText(W||" ").width;return F.restore(),G}function n0(){if(!k)return;let W=$.parentElement;if(!W)return;let K=$.getBoundingClientRect(),G=W.getBoundingClientRect(),X=G2(),H=A.size*X;k.style.left=`${K.left-G.left+A.x*X}px`,k.style.top=`${K.top-G.top+A.y*X}px`,k.style.fontSize=`${H}px`,k.style.width=`${Math.max(40,F2(k.value,H)+H)}px`}function l(W){let K=k;if(!K)return;k=null;let G=K.value.trim(),X=t;if(t=-1,K.remove(),W&&G){if(X>=0&&Q[X])Q[X].text=G,z=X;else Q.push({tool:"text",x1:A.x,y1:A.y,x2:A.x,y2:A.y,text:G,size:A.size}),z=Q.length-1;J()}else if(X>=0)z=X;$.focus(),S()}function r0(W,K,G=-1){l(!0);let X=$.parentElement;if(!X)return;if(getComputedStyle(X).position==="static")X.style.position="relative";let H=G>=0?Q[G]:void 0;t=G,A={x:H?.x1??W,y:H?.y1??K,size:H?.size??Math.round(24*C())};let M=document.createElement("input");M.type="text",M.className="text-edit",M.value=H?.text??"",M.setAttribute("aria-label","ข้อความบนภาพ"),M.placeholder="ข้อความ",k=M,X.append(M),n0(),M.addEventListener("input",n0),M.addEventListener("keydown",(U)=>{if(U.stopPropagation(),U.key==="Enter")l(!0);else if(U.key==="Escape")l(!1)}),requestAnimationFrame(()=>{if(k!==M)return;M.focus(),M.select(),M.addEventListener("blur",()=>l(!0))}),S()}function s0(W){let{x:K,y:G}=P(W);if($.setPointerCapture(W.pointerId),l0(K,G)){G0();return}let X=o0(K,G);if(X&&Q[z]){Y={grip:X,x:K,y:G,start:{...Q[z]}};return}if(Z==="text"){if(W.preventDefault(),$.hasPointerCapture(W.pointerId))$.releasePointerCapture(W.pointerId);Z=null,J(),r0(K,G);return}if(Z){V={tool:Z,x1:K,y1:G,x2:K,y2:G},z=-1;return}let H=Y0(K,G);z=H,Y=H>=0?{grip:"body",x:K,y:G,start:{...Q[H]}}:null,S()}function a0(W){let{x:K,y:G}=P(W);if(V){V.x2=K,V.y2=G,S();return}if(Y){let H=Q[z];if(!H)return;let M=K-Y.x,U=G-Y.y;if(Y.grip==="body")Y2(H,Y.start,M,U);else X2(H,Y.grip,Y.start,M,U);S();return}if(Z){$.style.cursor="crosshair";return}if(l0(K,G)){$.style.cursor="pointer";return}let X=o0(K,G);if(X){let H=Q[z]?q(Q[z]).find((M)=>M.id===X):null;$.style.cursor=H?.cursor??"pointer";return}$.style.cursor=Y0(K,G)>=0?"move":"default"}function e(){if(V){if(!(Math.abs(V.x2-V.x1)<n1&&Math.abs(V.y2-V.y1)<n1))Q.push(V),z=Q.length-1,Z=null,J();V=null}if(Y)Y=null,J();S()}function t0(W){let K=$.getBoundingClientRect(),G=(W.clientX-K.left)/K.width*$.width,X=(W.clientY-K.top)/K.height*$.height,H=Y0(G,X),M=Q[H];if(!M||M.tool!=="text")return;W.preventDefault(),r0(M.x1,M.y1,H)}function e0(W){if(z<0)return;if(W.key==="Delete"||W.key==="Backspace")W.preventDefault(),G0();else if(W.key==="Escape")z=-1,S()}function G0(){if(z<0)return;Q.splice(z,1),z=-1,J(),S()}return $.addEventListener("pointerdown",s0),$.addEventListener("pointermove",a0),$.addEventListener("pointerup",e),$.addEventListener("pointercancel",e),$.addEventListener("dblclick",t0),$.tabIndex=0,$.addEventListener("keydown",e0),S(),{setTool(W){Z=W,z=-1,$.style.cursor=W?"crosshair":"default",S()},deleteSelected:G0,clear(){Q.length=0,z=-1,J(),S()},hasShapes:()=>Q.length>0,hasSelection:()=>z>=0,toDataUrl(){let W=document.createElement("canvas");W.width=j.naturalWidth,W.height=j.naturalHeight;let K=W.getContext("2d");if(!K)return $.toDataURL("image/png");K.drawImage(j,0,0);let G=C();for(let X of Q)_(K,X,G);return W.toDataURL("image/png")},destroy(){l(!1),$.removeEventListener("pointerdown",s0),$.removeEventListener("pointermove",a0),$.removeEventListener("pointerup",e),$.removeEventListener("pointercancel",e),$.removeEventListener("dblclick",t0),$.removeEventListener("keydown",e0)}}}var r1=`
42
+ :host { all: initial; }
43
+ * { box-sizing: border-box; }
44
+
45
+ .backdrop {
46
+ position: fixed; inset: 0; z-index: 2147483000;
47
+ display: flex; align-items: center; justify-content: center;
48
+ padding: 24px; background: rgba(15, 23, 42, 0.55);
49
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
50
+ color: #0f172a;
51
+ }
52
+ .panel {
53
+ display: flex; flex-direction: column; gap: 16px;
54
+ width: min(820px, 100%); max-height: 90vh; overflow-y: auto;
55
+ /* No bottom padding: the footer supplies its own and sits flush, so it can
56
+ stick to the panel's edge without a gap under it. */
57
+ padding: 24px 24px 0; border-radius: 16px; background: #fff;
58
+ box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
59
+ }
60
+ .head { display: flex; align-items: flex-start; gap: 12px; }
61
+ h2 { margin: 0; font-size: 20px; font-weight: 700; flex: 1; }
62
+ label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
63
+ .req { color: #dc2626; }
64
+ .hint { font-weight: 400; color: #64748b; }
65
+ input[type="text"], textarea {
66
+ width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
67
+ border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: inherit;
68
+ }
69
+ input[type="text"]:focus, textarea:focus {
70
+ outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
71
+ }
72
+ textarea { min-height: 88px; resize: vertical; }
73
+
74
+ .meta {
75
+ padding: 12px 14px; border-radius: 10px; background: #f8fafc;
76
+ font-size: 13px; line-height: 1.7; color: #475569; word-break: break-all;
77
+ }
78
+ .meta b { color: #0f172a; font-weight: 600; }
79
+
80
+ .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
81
+ .sep { width: 1px; align-self: stretch; background: #e2e8f0; margin: 0 4px; }
82
+ button {
83
+ display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
84
+ padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 500;
85
+ border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: inherit;
86
+ }
87
+ button:hover:not(:disabled) { background: #f1f5f9; }
88
+ button:disabled { opacity: 0.5; cursor: not-allowed; }
89
+ button[aria-pressed="true"] { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
90
+ button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
91
+ button.primary:hover:not(:disabled) { background: #1d4ed8; }
92
+ button.icon { padding: 6px 10px; border-color: transparent; font-size: 18px; line-height: 1; }
93
+
94
+ /* The on-image text editor. Absolutely placed over the canvas and matched to
95
+ the shape it becomes — same weight, same red, same white plate — so what you
96
+ type is what gets drawn, at the position you clicked. Sized in JS, because
97
+ the font size tracks the image's own scale. */
98
+ .text-edit {
99
+ position: absolute; z-index: 2; margin: 0; padding: 2px 4px;
100
+ font-family: system-ui, sans-serif; font-weight: 600; line-height: 1.25;
101
+ color: #e11d48; background: rgba(255, 255, 255, 0.92);
102
+ border: 1px dashed #e11d48; border-radius: 4px; outline: none;
103
+ box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
104
+ }
105
+ .text-edit::placeholder { color: rgba(225, 29, 72, 0.45); }
106
+
107
+ canvas { width: 100%; height: auto; display: block; border: 1px solid #e2e8f0; border-radius: 10px; touch-action: none; }
108
+ .shot { position: relative; }
109
+ .status { font-size: 13px; color: #64748b; }
110
+ .status[data-tone="error"] { color: #dc2626; }
111
+ /* Pinned to the bottom of the scrolling panel.
112
+ A screenshot is tall — often taller than the viewport — so แจ้งปัญหา sat
113
+ below the fold and the last step of filing a report was "scroll to the end
114
+ and find the button". Sticky, with its own ground and a rule above it so the
115
+ annotated image scrolls underneath rather than bleeding into it. */
116
+ .foot {
117
+ position: sticky; bottom: 0; z-index: 3;
118
+ display: flex; align-items: center; gap: 12px;
119
+ margin: 4px -24px 0; padding: 12px 24px;
120
+ background: #fff; border-top: 1px solid #e2e8f0;
121
+ border-radius: 0 0 16px 16px;
122
+ }
123
+ .foot .grow { flex: 1; }
124
+ `;var o="lw-debug-reporter",s1=()=>[];function n4($){s1=$}var r4=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function s4(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;constructor(){super();this.root=this.attachShadow({mode:"open"})}connectedCallback(){this.dataset.debugReporter="true",this.stop=N0((j)=>void this.open(j))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(j){if(this.busy)return;this.busy=!0;let J=s(B().locale),Q=await k0();if(Q.method==="cancelled"){this.close();return}this.bundle=L0({reason:j,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:a4()}),this.renderForm(J)}close(){this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren()}shell(j){let J=document.createElement("style");J.textContent=r1;let Q=document.createElement("div");Q.className="backdrop";let Z=document.createElement("div");return Z.className="panel",Z.setAttribute("role","dialog"),Z.setAttribute("aria-modal","true"),Z.setAttribute("aria-label",j.title),Q.append(Z),this.root.replaceChildren(J,Q),Z}renderShell(j,J){let Q=this.shell(j),Z=O("div","head");Z.append(O("h2","",j.title)),Q.append(Z,O("p","status",J))}renderForm(j){let J=this.bundle;if(!J)return;let Q=this.shell(j),Z=O("div","head"),z=i("✕","icon");z.setAttribute("aria-label",j.close),z.addEventListener("click",()=>this.close()),Z.append(O("h2","",j.title),z);let V=document.createElement("input");V.type="text",V.placeholder=j.summaryPlaceholder;let Y=g0(j.summaryLabel,j.summaryRequired,!0),F=document.createElement("textarea");F.placeholder=j.detailPlaceholder;let C=O("div","meta");C.innerHTML="";let{context:P}=J;for(let[R,_]of[[j.reporter,`${P.user.fullName??"—"} (${P.user.email??"—"})`],[j.page,P.route.href],[j.captured,`${J.network.length} network · ${J.console.length} console · ${J.actionTrail.length} actions`]]){let D=document.createElement("div"),S=document.createElement("b");S.textContent=`${R}: `,D.append(S,document.createTextNode(_)),C.append(D)}let I=O("p","status",""),w=i(j.submit,"primary");if(w.disabled=!0,V.addEventListener("input",()=>{w.disabled=V.value.trim().length===0}),Q.append(Z,Y,V,g0(j.detailLabel),F,C),J.screenshotDataUrl)Q.append(...this.screenshotSection(j,J.screenshotDataUrl));else Q.append(O("p","status",j.noScreenshot));let q=O("div","foot"),N=i(j.close);N.addEventListener("click",()=>this.close()),q.append(N,I,O("span","grow"),w),Q.append(q),w.addEventListener("click",async()=>{w.disabled=!0,I.dataset.tone="",I.textContent=j.submitting;try{let R=await E0(V.value.trim(),{...J,note:F.value,screenshotDataUrl:this.annotator?.hasShapes()?this.annotator.toDataUrl():J.screenshotDataUrl}),_=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:R,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(),_)c(`${j.submitted} — #${R.number}`,"success")}catch(R){let _=R instanceof Error?R.message:j.failed;I.dataset.tone="error",I.textContent=_,c(`${j.failed} — ${_}`,"error"),w.disabled=!1}}),V.focus()}screenshotSection(j,J){let Q=g0(j.annotateHint),Z=O("div","tools"),z=document.createElement("canvas"),V=O("div","shot");V.append(z);let Y=[],F=(w)=>{for(let q of Y)q.setAttribute("aria-pressed",String(q===w))};for(let{tool:w,key:q}of r4){let N=i(j[q]);N.setAttribute("aria-pressed","false"),N.addEventListener("click",()=>{let R=N.getAttribute("aria-pressed")==="true";F(R?null:N),this.annotator?.setTool(R?null:w)}),Y.push(N),Z.append(N)}Z.append(O("span","sep"));let C=i(j.deleteSelected);C.addEventListener("click",()=>this.annotator?.deleteSelected());let P=i(j.clearAll);P.addEventListener("click",()=>{this.annotator?.clear(),F(null)}),Z.append(C,P);let I=new Image;return I.onload=()=>{z.width=I.naturalWidth,z.height=I.naturalHeight,this.annotator=v0(z,I,()=>{F(null),C.disabled=!this.annotator?.hasSelection()})},I.src=J,[Q,Z,O("p","status",j.annotateHelp),V]}}}function a4(){try{return s1()}catch{return[]}}function O($,j="",J=""){let Q=document.createElement($);if(j)Q.className=j;if(J)Q.textContent=J;return Q}function i($,j=""){let J=document.createElement("button");if(J.type="button",J.textContent=$,j)J.className=j;return J}function g0($,j="",J=!1){let Q=document.createElement("label");if(Q.append(document.createTextNode($)),J){let Z=document.createElement("span");Z.className="req",Z.textContent=" *",Q.append(Z)}if(j){let Z=document.createElement("span");Z.className="hint",Z.textContent=` ${j}`,Q.append(Z)}return Q}function m0(){if(typeof window>"u"||customElements.get(o))return;customElements.define(o,s4())}var a1=!1;function t4($={}){if(a1||typeof window>"u")return;if(!F0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(a1=!0,p1(),w1(),H1(),O1(),$.ui===!1)return;let j=s(B().locale);if(R0((J)=>{c(J.message??j.crashed,"error",{label:j.crashAction,onClick:()=>q0(J)})}),m0(),!document.querySelector(o))document.body.append(document.createElement(o))}var e4=new Set(["error","exception","unhandledrejection"]);function t1($){if($.error)return!0;return $.status!==null&&$.status>=400}function y0($){if(!$)return null;let j=Date.parse($);return Number.isNaN(j)?null:j}function $5($){try{let{pathname:j}=new URL($,"http://x");try{return decodeURIComponent(j)}catch{return j}}catch{return $.split(/[?#]/)[0]??$}}function j5($,j,J){let Q=(V)=>({elapsedMs:V,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if($.length===0)return[];let Z=$.map((V)=>y0(V.at)),z=(V)=>{for(let Y=V+1;Y<Z.length;Y+=1){let F=Z[Y];if(F!=null)return F}return Number.POSITIVE_INFINITY};return $.map((V,Y)=>{let F=Z[Y]??null,C=(Y>0?Z[Y-1]:null)??null,P=F!==null&&C!==null?Math.max(0,F-C):null;if(F===null)return Q(P);let I=F,w=Math.max(I,z(Y)),q=(D)=>D!==null&&D>=I&&(D<w||w===Number.POSITIVE_INFINITY),N=j.filter((D)=>q(y0(D.startedAt))),R=J.filter((D)=>e4.has(D.level)&&q(y0(D.at))),_=N.map((D)=>D.durationMs).filter((D)=>typeof D==="number");return{elapsedMs:P,requests:N,failedRequests:N.filter(t1),consoleErrors:R,slowestMs:_.length>0?Math.max(..._):null}})}function J5($,j){return $.requests.length===0&&$.consoleErrors.length===0&&($.elapsedMs===null||$.elapsedMs<j)}function Q5($){if($<1000)return`${Math.round($)} มิลลิวินาที`;let j=$/1000;if(j<10)return`${j.toFixed(1)} วิ`;if(j<60)return`${Math.round(j)} วิ`;let J=Math.floor(j/60),Q=Math.round(j%60);return Q===0?`${J} นาที`:`${J} นาที ${Q} วิ`}class X0 extends Error{status;constructor($,j){super($);this.status=j}}class K0 extends Error{constructor(){super("[debug-capture] no reporter identity — configure `identity` to use the tickets panel")}}function e1(){return B().host.replace(/\/$/,"")}async function Z5(){let $=B().identity;if(!$)throw new K0;let j=await $();if(!j)throw new K0;return j}async function T($,j={}){let J=await Z5(),Q=await fetch(`${e1()}/ingest/me${$}`,{...j,headers:{"x-realm-key":B().realmKey,authorization:`Bearer ${J}`,...j.body?{"content-type":"application/json"}:{},...j.headers}});if(!Q.ok){let Z=await Q.json().then((z)=>z.error).catch(()=>null);throw new X0(Z??`Request failed (${Q.status})`,Q.status)}return await Q.json()}async function z5(){let{items:$}=await T("/tickets");return $}function W5($){return T(`/tickets/${encodeURIComponent($)}`)}function V5($){return T(`/tickets/by-number/${$}`)}function K5($){return T(`/attachments/${encodeURIComponent($)}`)}function X5($){return T(`/tickets/${encodeURIComponent($)}/history`)}function Y5($,j){return T(`/tickets/${encodeURIComponent($)}/messages`,{method:"POST",body:JSON.stringify({body:j})})}function G5($,j,J){return T(`/tickets/${encodeURIComponent($)}/messages/${encodeURIComponent(j)}`,{method:"PUT",body:JSON.stringify({body:J})})}function F5($,j){return T(`/tickets/${encodeURIComponent($)}/reopen`,{method:"POST",body:JSON.stringify({note:j?.trim()||void 0})})}function H5($,j,J){return T(`/tickets/${encodeURIComponent($)}/inline-image`,{method:"POST",body:JSON.stringify({dataUri:j,filename:J})})}var V0=null;function M5(){if(!V0){let $=encodeURIComponent(B().realmKey);V0=fetch(`${e1()}/ingest/config?key=${$}`).then((j)=>{if(!j.ok)throw new X0(`Config failed (${j.status})`,j.status);return j.json()}).catch((j)=>{throw V0=null,j})}return V0}function $2($,j){let J=($??"").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"");return J?`${J}-${j}`:`#${j}`}function C5($,j,J){if(!$)return"—";let Q=new Date($);if(Number.isNaN(Q.getTime()))return"—";try{return new Intl.DateTimeFormat(J==="en"?"en-GB":"th-TH-u-ca-buddhist",{dateStyle:"medium",timeStyle:"short",timeZone:j}).format(Q)}catch{return Q.toISOString().slice(0,16).replace("T"," ")}}function U5($,j){let J=new Map($.map((Z)=>[Z.key,Z])),Q=$.map((Z)=>Z.key);return{labelOf:(Z)=>J.get(Z)?.label??Z,columnOf:(Z)=>J.get(Z),isAwaitingReply:(Z)=>J.get(Z)?.awaitingReply===!0,isClosed:(Z)=>J.get(Z)?.bucket==="closed",rankOf:(Z)=>{let z=Q.indexOf(Z);return z===-1?Q.length:z},options:[{value:"",label:j},...$.map((Z)=>({value:Z.key,label:Z.label}))]}}function j2($){return Boolean($.resolutionNote&&$.resolutionNote.trim())}function J2($){return $.agentReplyCount>0}function b0($){return j2($)?2:J2($)?1:0}function P5($,j,J,Q){let Z=j.trim().toLowerCase();if(!Z)return!0;return[$2(J,$.number),String($.number),$.title,$.category??"",Q($.status)].join(" ").toLowerCase().includes(Z)}function w5($,j,J){let Q=$.direction==="asc"?1:-1;return(Z,z)=>{let V=0;switch($.key){case"number":V=Z.number-z.number;break;case"title":V=(Z.title??"").localeCompare(z.title??"","th");break;case"module":V=(Z.category??"").localeCompare(z.category??"","th");break;case"status":V=j.rankOf(Z.status)-j.rankOf(z.status);break;case"response":V=b0(Z)-b0(z);break;case"createdAt":V=Date.parse(Z.createdAt)-Date.parse(z.createdAt);break;case"updatedAt":V=Date.parse(Z.updatedAt)-Date.parse(z.updatedAt);break}return V!==0?V*Q:(Z.number-z.number)*Q}}var d0=10;function I5($,j,J=d0){return $.slice((j-1)*J,j*J)}function D5($,j=d0){return Math.max(1,Math.ceil($/j))}var u0={blue:{fg:"#1c5cab",bg:"#e8f1fd"},amber:{fg:"#92400e",bg:"#fef3c7"},violet:{fg:"#4a3aa7",bg:"#ece9fb"},emerald:{fg:"#0f766e",bg:"#d9f2ec"},gray:{fg:"#4b5563",bg:"#f1f2f4"},red:{fg:"#b91c1c",bg:"#fde8e8"},sky:{fg:"#0369a1",bg:"#e0f2fe"},rose:{fg:"#be123c",bg:"#ffe4e9"},teal:{fg:"#0f766e",bg:"#d7f2ef"},orange:{fg:"#c2410c",bg:"#ffedd5"}};function B5($){return u0[$??""]??u0.gray}var Q2=new Set(["p","br","strong","b","em","i","u","s","code","pre","ul","ol","li","blockquote","h1","h2","h3","a","img","span"]),Z2=new Set(["href","target","rel","src","alt","title"]),N5=/^\/api\/inline\/[a-f0-9]{64}$/i;function z2($){return/^(?:https?:\/\/|mailto:|#|\/)/i.test($.trim())}function W2($,j){try{let J=new URL($.trim(),j);return J.origin===new URL(j).origin&&N5.test(J.pathname)}catch{return!1}}var q5=/<\/(p|div|li|h[1-6]|tr)\s*>/gi,R5=/<br\s*\/?>/gi,S5=/<[^>]*>/g,O5={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};function c0($){return/<[a-z/][^>]*>/i.test($)}function _5($){if(!c0($))return $;return $.replace(R5,`
125
+ `).replace(q5,`
126
+ `).replace(S5,"").replace(/&[a-z#0-9]+;/gi,(j)=>O5[j.toLowerCase()]??j).split(`
127
+ `).map((j)=>j.trim()).filter(Boolean).join(`
128
+ `)}function V2($,j,J){if($.textContent="",!c0(j)){for(let[Z,z]of j.split(`
129
+ `).entries()){if(Z)$.append(document.createElement("br"));$.append(document.createTextNode(z))}return}let Q=new DOMParser().parseFromString(j,"text/html");for(let Z of Array.from(Q.body.childNodes)){let z=K2(Z,J);if(z)$.append(z)}}var f5=new Set(["script","style","iframe","object","embed","noscript","template","svg","math"]);function K2($,j){if($.nodeType===3)return document.createTextNode($.nodeValue??"");if($.nodeType!==1)return null;let J=$,Q=J.tagName.toLowerCase();if(f5.has(Q))return null;let Z=Q2.has(Q),z=Z?document.createElement(Q):document.createDocumentFragment();if(Z){let V=z;for(let Y of Array.from(J.attributes)){let F=Y.name.toLowerCase();if(!Z2.has(F))continue;if(F==="href"&&!z2(Y.value))continue;if(F==="src"){if(Q!=="img"||!W2(Y.value,j))continue;V.setAttribute("src",T5(Y.value,j));continue}V.setAttribute(F,Y.value)}if(Q==="a")V.setAttribute("target","_blank"),V.setAttribute("rel","noopener noreferrer nofollow");if(Q==="img"&&!V.getAttribute("src"))return null}for(let V of Array.from(J.childNodes)){let Y=K2(V,j);if(Y)z.append(Y)}return z}function L5($,j){let J=document.createElement("div");V2(J,$,j);let Q=k5(j);if(Q)for(let Z of Array.from(J.querySelectorAll("img"))){let z=Z.getAttribute("src")??"";if(z.startsWith(`${Q}/`))Z.setAttribute("src",z.slice(Q.length))}return J.innerHTML}function k5($){try{return new URL($).origin}catch{return null}}function A5($){if(!$)return!0;if(/<img\b/i.test($))return!1;return $.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim()===""}function T5($,j){let J=$.trim();if(!J.startsWith("/"))return J;return`${j.replace(/\/$/,"")}${J}`}var x5=["bold","italic","underline","bulletList","orderedList","link","image"],E5=["bold","italic","underline","strike","code","bulletList","orderedList","blockquote","link","image"];var p5={title:"ปัญหาที่แจ้ง",intro:"ปัญหาที่คุณแจ้งไว้ พร้อมสถานะล่าสุด",searchPlaceholder:"ค้นหาเลขที่/หัวข้อ/โมดูล",searchLabel:"ค้นหาปัญหาที่แจ้ง",allStatuses:"ทุกสถานะ",count:($)=>`${$} รายการ`,colNumber:"เลขที่",colTitle:"หัวข้อ",colModule:"โมดูล",colStatus:"สถานะ",colResponse:"คำตอบจากทีม",colCreated:"แจ้งเมื่อ",colUpdated:"อัปเดตล่าสุด",awaitingReply:"รอคุณตอบกลับ",hasSolution:"มีวิธีแก้ไข",hasReply:"ตอบกลับแล้ว",noReply:"ยังไม่มีการตอบกลับ",empty:"คุณยังไม่ได้แจ้งปัญหา",emptyFiltered:"ไม่พบรายการที่ตรงกับการค้นหา",loading:"กำลังโหลด…",listFailed:"โหลดรายการไม่สำเร็จ",detailFailed:"โหลดรายงานไม่สำเร็จ",signedOut:"กรุณาเข้าสู่ระบบเพื่อดูปัญหาที่แจ้งไว้",back:"กลับไปรายการ",reportedBy:"แจ้งเมื่อ",conversation:"การสนทนา",resolution:"วิธีแก้ไข",noMessages:"ยังไม่มีข้อความ",you:"คุณ",team:"ทีมงาน",reporterRole:"ผู้แจ้ง",edited:"แก้ไขแล้ว",edit:"แก้ไข",saveEdit:"บันทึกการแก้ไข",cancel:"ยกเลิก",replyPlaceholder:"พิมพ์ข้อความถึงทีมงาน",bold:"ตัวหนา",italic:"ตัวเอียง",underline:"ขีดเส้นใต้",strike:"ขีดฆ่า",code:"โค้ด",blockquote:"ยกคำพูด",bulletList:"รายการหัวข้อ",orderedList:"รายการตัวเลข",link:"ลิงก์",linkPrompt:"ใส่ลิงก์",linkNeedsSelection:"เลือกข้อความที่ต้องการทำลิงก์ก่อน",linkInvalid:"ลิงก์ต้องขึ้นต้นด้วย http:// หรือ https://",attachImage:"แนบรูป",uploading:"กำลังอัปโหลดรูป…",send:"ส่งข้อความ",sending:"กำลังส่ง…",sent:"ส่งข้อความแล้ว",sendFailed:"ส่งไม่สำเร็จ ลองใหม่อีกครั้ง",reopen:"ยังมีปัญหา",reopenHint:"ถ้าปัญหายังไม่หาย แจ้งทีมงานอีกครั้งได้",reopening:"กำลังแจ้ง…",reopened:"แจ้งทีมงานอีกครั้งแล้ว — เรากำลังดูให้ครับ",reopenFailed:"เปิดเรื่องไม่สำเร็จ ลองใหม่อีกครั้ง",close:"ปิด",retry:"ลองใหม่",page:"หน้า",of:($,j)=>`หน้า ${$} จาก ${j}`,prev:"ก่อนหน้า",next:"ถัดไป"},h5={title:"My reports",intro:"The problems you have reported, with their latest status",searchPlaceholder:"Search number / title / module",searchLabel:"Search my reports",allStatuses:"All statuses",count:($)=>`${$} item${$===1?"":"s"}`,colNumber:"No.",colTitle:"Title",colModule:"Module",colStatus:"Status",colResponse:"Team response",colCreated:"Reported",colUpdated:"Last update",awaitingReply:"Awaiting your reply",hasSolution:"Solution provided",hasReply:"Replied",noReply:"No reply yet",empty:"You have not reported anything yet",emptyFiltered:"Nothing matches that search",loading:"Loading…",listFailed:"Could not load your reports",detailFailed:"Could not load this report",signedOut:"Sign in to see the problems you have reported",back:"Back to the list",reportedBy:"Reported",conversation:"Conversation",resolution:"Solution",noMessages:"No messages yet",you:"You",team:"Support",reporterRole:"Reporter",edited:"edited",edit:"Edit",saveEdit:"Save changes",cancel:"Cancel",replyPlaceholder:"Write a message to the team",bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",code:"Code",blockquote:"Quote",bulletList:"Bulleted list",orderedList:"Numbered list",link:"Link",linkPrompt:"Enter a link",linkNeedsSelection:"Select the text you want to link first",linkInvalid:"A link must start with http:// or https://",attachImage:"Add an image",uploading:"Uploading the image…",send:"Send",sending:"Sending…",sent:"Message sent",sendFailed:"Could not send — try again",reopen:"Still a problem",reopenHint:"If the problem is not fixed, tell the team again",reopening:"Sending…",reopened:"The team has been notified — we are looking at it",reopenFailed:"Could not reopen — try again",close:"Close",retry:"Try again",page:"Page",of:($,j)=>`Page ${$} of ${j}`,prev:"Previous",next:"Next"};function v5($){return $==="en"?h5:p5}export{H5 as uploadInlineImage,x0 as trimToBudget,_5 as toPlainText,y1 as toCurl,v5 as ticketStrings,$2 as ticketKey,E0 as submitBundle,B5 as statusTone,U5 as statusMaps,c as showToast,n4 as setErroredQueriesSource,b0 as responseRank,$5 as requestPath,s as reporterStrings,Y5 as replyToTicket,F5 as reopenMyTicket,V2 as renderBody,y as redactUrl,g as redactLabel,m as redactHeaders,b as redactBody,I5 as pageOf,D5 as pageCount,N0 as onLaunch,R0 as onCrash,P5 as matchesKeyword,c0 as looksLikeHtml,z5 as listMyTickets,q0 as launch,J5 as isQuietStep,t1 as isFailedRequest,F0 as isConfigured,W2 as isAllowedImageSrc,z2 as isAllowedHref,t4 as installDebugCapture,A5 as htmlIsEmpty,J2 as hasTeamReply,j2 as hasSolution,T4 as hasCause,O0 as getNetworkLog,X5 as getMyTicketHistory,V5 as getMyTicketByNumber,W5 as getMyTicket,B0 as getConsoleLog,B as getConfig,K5 as getAttachmentUrl,I0 as getActionTrail,Q5 as formatDuration,C5 as formatDateTime,M5 as fetchRealmConfig,A0 as errorSignature,S0 as emitCrash,G5 as editMyMessage,m0 as defineReporterElement,v0 as createAnnotator,j5 as correlateActionTrail,C2 as configureDebugCapture,w5 as compareBy,L5 as cleanHtml,k0 as captureScreen,L4 as bundleToMarkdown,A4 as bundleFileName,L0 as buildBundle,x as appInfo,P0 as actionCountSuffix,X0 as TicketApiError,u0 as STATUS_TONES,o as REPORTER_TAG,v as REDACTED,d0 as PAGE_SIZE,K0 as NoIdentityError,x5 as NOTE_TOOLBAR,E5 as FULL_TOOLBAR,T0 as BUNDLE_BUDGET_BYTES,Q2 as ALLOWED_TAGS,Z2 as ALLOWED_ATTR};
@@ -0,0 +1,5 @@
1
+ export interface InstallOptions {
2
+ /** Mount the built-in reporter UI. Off if the host renders its own. */
3
+ ui?: boolean;
4
+ }
5
+ export declare function installDebugCapture(options?: InstallOptions): void;