@lightworkai.official/debug-capture 0.14.3 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var c2=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var l2={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},v=null;function o2(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");v=z}function S(){if(!v)throw Error("[debug-capture] configureDebugCapture() has not been called");return v}function B0(){return v!==null}function n(){let z=S().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??r2()}}function r2(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function $0(z){let J=v?.capture?.[z];return typeof J==="number"?J:l2[z]}function A0(z){let J=v?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function L0(){let z=v?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function k1(){return v?.capture?.overlaySelectors??[]}var n2='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',s2="[data-lw-mask]",S1={fps:1,quality:0.5};function N0(){let z=v?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,Y)=>typeof Z==="number"&&Z>0?Z:Y,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,S1.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,S1.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?n2:s2),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function R1(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(a2(J))return!1;if(J.origin===window.location.origin)return!0;return(v?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function a2(z){if(!v?.host)return!1;try{if(new URL(v.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function t2(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var H0="‹redacted›",e2=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,z4=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),J4=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,$4=/[\w.+-]+@[\w-]+\.[\w.-]+/g,j4=/\d(?:[\d\s-]{7,})\d/g;function P0(z){return z.replace($4,H0).replace(j4,H0)}function Q4(z){if(e2.test(z))return!0;return L0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function U0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=Q4($)?H0:j;return J}function a(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(z4.has(Z.toLowerCase())||L0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,H0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function r0(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>r0(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=J4.test(j)||L0().bodyKeys.some((Y)=>j.toLowerCase().includes(Y));$[j]=Z?H0:r0(Q,J+1)}return $}function M0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(r0(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var n0=120,s0=40,I0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,a0=(z)=>{try{return decodeURIComponent(z)}catch{return z}},D0=[],A1=0,L1=!1;function x0(z,J,$,j){let Q=I0(J,n0),Z=D0[D0.length-1];if(z==="navigate"&&Z?.kind==="click"){let G=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${G}`))return Z.at=new Date().toISOString(),Z;let F=G.split(/[?#]/)[0]??G,P=Z.source?a0(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(P&&(F===P||F.startsWith(P)))return Z.detail=I0(`${Z.detail} → ${G}`,n0),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}A1+=1;let Y={id:`act_${A1}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:T0(j)};D0.push(Y);while(D0.length>$0("maxActions"))K4(D0.shift());return Y}var Z4=200000,C0=0;function T0(z){if(!z)return;if(C0+z.length>Z4)return;return C0+=z.length,z}function K4(z){if(!z)return;if(C0-=(z.html?.length??0)+(z.afterHtml?.length??0),C0<0)C0=0}function t0(z){return z&&z>1?` (×${z})`:""}function f0(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var Y4='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',X4={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},f1={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function G4(z){let J=z.getAttribute("role");if(J&&f1[J])return f1[J];return X4[z.tagName.toLowerCase()]??"ปุ่ม"}function V4(z,J){try{let $=z,j=0;while($&&j<=J){let Q=b1($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function W4(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return a0(Q)}return""}function F4(z){if(!(z instanceof Element))return null;let J=z.closest(Y4)??V4(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function H4(z){let J=P0(W4(z));if(!J)return null;return`${G4(z)} “${I0(J,s0)}”`}var g1=6000,P4=4000,U4=/(?:^|\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 M4(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let Y of Array.from(Q.attributes)){let G=Y.name.toLowerCase();if(G.startsWith("on")||G==="srcdoc"||G==="value"||G.startsWith("data-"))Q.removeAttribute(Y.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let Y=Z.replace(U4," ").replace(/\s+/g," ").trim();if(Y)Q.setAttribute("class",Y);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=P0(j.nodeValue);j=$.nextNode()}}function e0(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);M4(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var D4=(z)=>e0(z,g1,P4),I4=150000,w4=40000,T1=(z)=>e0(z,I4,w4);function q4(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${P0(J)}”`}var E1=80;function b1(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function B4(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function h1(z){if(!z)return;return`→ ${z.length>E1?`${z.slice(0,E1)}…`:z}`}function N4(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return h1(J);let $=b1(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return h1(B4($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var x4='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function C4(){let z=k1();return z.length?z.join(", "):x4}function O4(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function _4(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((Y)=>document.getElementById(Y)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function p1(z){let J=P0(_4(z)),$=O4(z);return J?`เปิด ${$} “${I0(J,s0)}”`:`เปิด ${$}`}var S4='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',k4=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function R4(z){if(z.querySelector(S4))return!0;return k4.test(z.textContent??"")}var A4=400,L4=250,f4=8000;function T4(z,J){if(typeof MutationObserver>"u"){J.html=T0(T1(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,Y.disconnect(),window.clearInterval(G),window.clearTimeout(F)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=I0(p1(z),n0),J.html=T0(T1(z))},Y=new MutationObserver(()=>{$=Date.now()});Y.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let G=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=A4&&!R4(z))Z()},L4),F=window.setTimeout(Z,f4)}function E4(z){if(f0(z))return;let J=x0("ui",p1(z));if(J)T4(z,J)}function h4(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=C4(),Y=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let G of Y){if(z.has(G))continue;z.add(G),E4(G)}}}).observe(document.body,{childList:!0,subtree:!0})}var m4=1600,g4=2500;function m1(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:I0((z.textContent??"").replace(/\s+/g," ").trim(),s0)}}function b4(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function p4(z,J){if(typeof MutationObserver>"u")return;let $=m1(z),j=!1,Q=(G,F)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(Y),J.afterNote=G,F)J.afterHtml=T0(e0(z,g1,g4))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let G=b4($,m1(z));if(G)Q(G,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Y=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},m4)}function v1(){if(L1||typeof window>"u")return;L1=!0,document.addEventListener("click",(j)=>{if(f0(j.target))return;let Q=F4(j.target);if(!Q)return;let Z=H4(Q);if(!Z)return;let Y=x0("click",`คลิก ${Z}`,N4(Q),D4(Q));if(Y)p4(Q,Y)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(f0(j.target))return;let Q=q4(j.target);if(Q)x0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(f0(j.target))return;x0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>x0("navigate",`ไปที่ ${a0(a(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),h4()}function z1(){return D0.map((z)=>({...z}))}var y1=2000,E0=[],u1=0,d1=!1;function J1(z,J){u1+=1,E0.push({id:`log_${u1}`,at:new Date().toISOString(),level:z,message:J.length>y1?`${J.slice(0,y1)}…`:J});while(E0.length>$0("maxConsoleEntries"))E0.shift()}function v4(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function i1(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,v4());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function c1(){if(d1||typeof window>"u")return;d1=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{J1(J,j.map(i1).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";J1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:i1(J.reason);J1("unhandledrejection",$)})}function $1(){return E0.map((z)=>({...z}))}var l1=new Set,o1=new Set;function r1(z,J){return z.add(J),()=>z.delete(J)}function n1(z,J){for(let $ of[...z])$(J)}function j1(z){return r1(l1,z)}function Q1(z={type:"manual"}){n1(l1,z)}function Z1(z){return r1(o1,z)}function K1(z){n1(o1,z)}var y4=15000,u4=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],s1=!1,a1=0;function d4(z){return u4.some((J)=>z.includes(J))}function t1(z){let J=z.message??"";if(!J||d4(J))return;let $=Date.now();if($-a1<y4)return;a1=$,K1({...z,message:J})}function e1(){if(s1||typeof window>"u")return;s1=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;t1({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;t1({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var j2=4000,i4=1e6,c4=1e7,h0=[],z2=0,J2=!1;function Q2(z){h0.push(z);while(h0.length>$0("maxRequests"))h0.shift()}function Z2(){return z2+=1,`req_${z2}`}function $2(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function l4(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function o4(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function r4(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=$2(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...$2(J.headers)};if(J.body!==void 0)Z=o4(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function K2(z){return!R1(z)}function n4(z,J){if(K2(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>i4){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=M0(Z,$0("maxBodyChars"))}).catch(()=>{})}catch{}}function Y2(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function s4(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=r4(J,$);if(Y2(j.url,j.headers))return z(J,$);let Q={id:Z2(),startedAt:new Date().toISOString(),method:j.method,url:a(j.url),requestHeaders:U0(j.headers),requestBody:M0(j.body,j2),status:null,statusText:null,durationMs:null,via:"fetch"};Q2(Q);let Z=performance.now();try{let Y=await z(J,$);return Q.status=Y.status,Q.statusText=Y.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=U0(l4(Y.headers)),n4(Y,Q),Y}catch(Y){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=Y instanceof Error?`${Y.name}: ${Y.message}`:String(Y),Y}},z)}function a4(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,Y){let G=typeof Y==="string"?Y:Y.toString();return this.__lwEntry=Y2(G,{})?void 0:{id:Z2(),startedAt:"",method:(Z||"GET").toUpperCase(),url:a(G),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let Y=this.__lwEntry;if(Y){Y.startedAt=new Date().toISOString(),Y.requestBody=typeof Z==="string"?M0(Z,j2):Z==null?null:"[non-string body]";let G=performance.now();Q2(Y),this.addEventListener("loadend",()=>{if(Y.status=this.status||null,Y.statusText=this.statusText||null,Y.durationMs=Math.round(performance.now()-G),K2(Y.url))Y.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Y.responseSnippet=M0(this.responseText||"",$0("maxBodyChars"))}catch{}else{let F=this.getResponseHeader("content-type")??this.responseType;Y.responseSnippet=`[binary ${F}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function X2(){if(J2)return;J2=!0,s4(),a4()}function Y1(){let z=h0.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>c4)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var t4=4,G2=3,e4=4000,z6="[data-debug-reporter]",J6=()=>import("@rrweb/record");var y=[],w0=null,m0=!1;function V2(){if(typeof window>"u"||w0||m0)return;let z=N0();if(!z)return;m0=!0;let J=()=>void $6(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function $6(z){let J;try{J=(await J6()).record}catch($){m0=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(w0)return;try{w0=J({emit:($)=>j6($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:e4,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${z6}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{m0=!1}}function j6(z){if(z.type===t4||y.length===0){if(y.push([]),y.length>G2)y=y.slice(-G2)}y[y.length-1].push(z)}function X1(z=Date.now()){let J=N0();if(!J||!y.length)return null;let $=z-J.seconds*1000,j=y.length-1;while(j>0&&(y[j][0]?.timestamp??z)>$)j-=1;let Q=y.slice(j).flat(),Z=Q[0]?.timestamp,Y=Q[Q.length-1]?.timestamp;if(Z===void 0||Y===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(Y).toISOString(),durationMs:Math.max(0,Y-Z)}}function Q6(){return w0!==null}function Z6(){w0?.(),w0=null,y=[]}var K6={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง"},Y6={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours"};function K0(z){return z==="en"?Y6:K6}var X6="lw-debug-toasts",G6=6000,V6=`
1
+ var N4=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var B4={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},y=null;function x4(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");y=z}function x(){if(!y)throw Error("[debug-capture] configureDebugCapture() has not been called");return y}function R0(){return y!==null}function s(){let z=x().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??C4()}}function C4(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function Q0(z){let J=y?.capture?.[z];return typeof J==="number"?J:B4[z]}function v0(z){let J=y?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function y0(){let z=y?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function n1(){return y?.capture?.overlaySelectors??[]}var w4='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',O4="[data-lw-mask]",r1={fps:1,quality:0.5};function A0(){let z=y?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,Y)=>typeof Z==="number"&&Z>0?Z:Y,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,r1.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,r1.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?w4:O4),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function s1(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(_4(J))return!1;if(J.origin===window.location.origin)return!0;return(y?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function _4(z){if(!y?.host)return!1;try{if(new URL(y.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function S4(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var D0="‹redacted›",R4=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,A4=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),L4=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,k4=/[\w.+-]+@[\w-]+\.[\w.-]+/g,T4=/\d(?:[\d\s-]{7,})\d/g;function M0(z){return z.replace(k4,D0).replace(T4,D0)}function f4(z){if(R4.test(z))return!0;return y0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function I0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=f4($)?D0:j;return J}function t(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(A4.has(Z.toLowerCase())||y0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,D0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function K1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>K1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=L4.test(j)||y0().bodyKeys.some((Y)=>j.toLowerCase().includes(Y));$[j]=Z?D0:K1(Q,J+1)}return $}function q0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(K1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var Y1=120,W1=40,B0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,V1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},N0=[],a1=0,t1=!1;function L0(z,J,$,j){let Q=B0(J,Y1),Z=N0[N0.length-1];if(z==="navigate"&&Z?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${W}`))return Z.at=new Date().toISOString(),Z;let F=W.split(/[?#]/)[0]??W,P=Z.source?V1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(P&&(F===P||F.startsWith(P)))return Z.detail=B0(`${Z.detail} → ${W}`,Y1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}a1+=1;let Y={id:`act_${a1}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:u0(j)};N0.push(Y);while(N0.length>Q0("maxActions"))h4(N0.shift());return Y}var E4=200000,k0=0;function u0(z){if(!z)return;if(k0+z.length>E4)return;return k0+=z.length,z}function h4(z){if(!z)return;if(k0-=(z.html?.length??0)+(z.afterHtml?.length??0),k0<0)k0=0}function X1(z){return z&&z>1?` (×${z})`:""}function p0(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var m4='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',b4={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},e1={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function g4(z){let J=z.getAttribute("role");if(J&&e1[J])return e1[J];return b4[z.tagName.toLowerCase()]??"ปุ่ม"}function v4(z,J){try{let $=z,j=0;while($&&j<=J){let Q=Z2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function y4(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return V1(Q)}return""}function p4(z){if(!(z instanceof Element))return null;let J=z.closest(m4)??v4(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function u4(z){let J=M0(y4(z));if(!J)return null;return`${g4(z)} “${B0(J,W1)}”`}var Q2=6000,d4=4000,i4=/(?:^|\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 c4(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let Y of Array.from(Q.attributes)){let W=Y.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(Y.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let Y=Z.replace(i4," ").replace(/\s+/g," ").trim();if(Y)Q.setAttribute("class",Y);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=M0(j.nodeValue);j=$.nextNode()}}function G1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);c4(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var l4=(z)=>G1(z,Q2,d4),o4=150000,r4=40000,z2=(z)=>G1(z,o4,r4);function n4(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${M0(J)}”`}var J2=80;function Z2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function s4(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function $2(z){if(!z)return;return`→ ${z.length>J2?`${z.slice(0,J2)}…`:z}`}function a4(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return $2(J);let $=Z2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return $2(s4($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var t4='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function e4(){let z=n1();return z.length?z.join(", "):t4}function z6(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function J6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((Y)=>document.getElementById(Y)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function K2(z){let J=M0(J6(z)),$=z6(z);return J?`เปิด ${$} “${B0(J,W1)}”`:`เปิด ${$}`}var $6='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',j6=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function Q6(z){if(z.querySelector($6))return!0;return j6.test(z.textContent??"")}var Z6=400,K6=250,Y6=8000;function W6(z,J){if(typeof MutationObserver>"u"){J.html=u0(z2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,Y.disconnect(),window.clearInterval(W),window.clearTimeout(F)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=B0(K2(z),Y1),J.html=u0(z2(z))},Y=new MutationObserver(()=>{$=Date.now()});Y.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=Z6&&!Q6(z))Z()},K6),F=window.setTimeout(Z,Y6)}function V6(z){if(p0(z))return;let J=L0("ui",K2(z));if(J)W6(z,J)}function X6(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=e4(),Y=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of Y){if(z.has(W))continue;z.add(W),V6(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var G6=1600,F6=2500;function j2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:B0((z.textContent??"").replace(/\s+/g," ").trim(),W1)}}function H6(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function P6(z,J){if(typeof MutationObserver>"u")return;let $=j2(z),j=!1,Q=(W,F)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(Y),J.afterNote=W,F)J.afterHtml=u0(G1(z,Q2,F6))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=H6($,j2(z));if(W)Q(W,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Y=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},G6)}function Y2(){if(t1||typeof window>"u")return;t1=!0,document.addEventListener("click",(j)=>{if(p0(j.target))return;let Q=p4(j.target);if(!Q)return;let Z=u4(Q);if(!Z)return;let Y=L0("click",`คลิก ${Z}`,a4(Q),l4(Q));if(Y)P6(Q,Y)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(p0(j.target))return;let Q=n4(j.target);if(Q)L0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(p0(j.target))return;L0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>L0("navigate",`ไปที่ ${V1(t(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),X6()}function F1(){return N0.map((z)=>({...z}))}var W2=2000,d0=[],V2=0,X2=!1;function H1(z,J){V2+=1,d0.push({id:`log_${V2}`,at:new Date().toISOString(),level:z,message:J.length>W2?`${J.slice(0,W2)}…`:J});while(d0.length>Q0("maxConsoleEntries"))d0.shift()}function U6(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function G2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,U6());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function F2(){if(X2||typeof window>"u")return;X2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{H1(J,j.map(G2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";H1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:G2(J.reason);H1("unhandledrejection",$)})}function P1(){return d0.map((z)=>({...z}))}var H2=new Set,P2=new Set;function U2(z,J){return z.add(J),()=>z.delete(J)}function D2(z,J){for(let $ of[...z])$(J)}function U1(z){return U2(H2,z)}function D1(z={type:"manual"}){D2(H2,z)}function M1(z){return U2(P2,z)}function I1(z){D2(P2,z)}var D6=15000,M6=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],M2=!1,I2=0;function I6(z){return M6.some((J)=>z.includes(J))}function q2(z){let J=z.message??"";if(!J||I6(J))return;let $=Date.now();if($-I2<D6)return;I2=$,I1({...z,message:J})}function N2(){if(M2||typeof window>"u")return;M2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;q2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;q2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var w2=4000,q6=1e6,N6=1e7,i0=[],B2=0,x2=!1;function O2(z){i0.push(z);while(i0.length>Q0("maxRequests"))i0.shift()}function _2(){return B2+=1,`req_${B2}`}function C2(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function B6(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function x6(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function C6(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=C2(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...C2(J.headers)};if(J.body!==void 0)Z=x6(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function S2(z){return!s1(z)}function w6(z,J){if(S2(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>q6){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=q0(Z,Q0("maxBodyChars"))}).catch(()=>{})}catch{}}function R2(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function O6(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=C6(J,$);if(R2(j.url,j.headers))return z(J,$);let Q={id:_2(),startedAt:new Date().toISOString(),method:j.method,url:t(j.url),requestHeaders:I0(j.headers),requestBody:q0(j.body,w2),status:null,statusText:null,durationMs:null,via:"fetch"};O2(Q);let Z=performance.now();try{let Y=await z(J,$);return Q.status=Y.status,Q.statusText=Y.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=I0(B6(Y.headers)),w6(Y,Q),Y}catch(Y){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=Y instanceof Error?`${Y.name}: ${Y.message}`:String(Y),Y}},z)}function _6(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,Y){let W=typeof Y==="string"?Y:Y.toString();return this.__lwEntry=R2(W,{})?void 0:{id:_2(),startedAt:"",method:(Z||"GET").toUpperCase(),url:t(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let Y=this.__lwEntry;if(Y){Y.startedAt=new Date().toISOString(),Y.requestBody=typeof Z==="string"?q0(Z,w2):Z==null?null:"[non-string body]";let W=performance.now();O2(Y),this.addEventListener("loadend",()=>{if(Y.status=this.status||null,Y.statusText=this.statusText||null,Y.durationMs=Math.round(performance.now()-W),S2(Y.url))Y.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Y.responseSnippet=q0(this.responseText||"",Q0("maxBodyChars"))}catch{}else{let F=this.getResponseHeader("content-type")??this.responseType;Y.responseSnippet=`[binary ${F}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function A2(){if(x2)return;x2=!0,O6(),_6()}function q1(){let z=i0.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>N6)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var S6=4,L2=3,R6=4000,A6="[data-debug-reporter]",L6=()=>import("@rrweb/record");var p=[],x0=null,c0=!1;function k2(){if(typeof window>"u"||x0||c0)return;let z=A0();if(!z)return;c0=!0;let J=()=>void k6(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function k6(z){let J;try{J=(await L6()).record}catch($){c0=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(x0)return;try{x0=J({emit:($)=>T6($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:R6,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${A6}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{c0=!1}}function T6(z){if(z.type===S6||p.length===0){if(p.push([]),p.length>L2)p=p.slice(-L2)}p[p.length-1].push(z)}function N1(z=Date.now()){let J=A0();if(!J||!p.length)return null;let $=z-J.seconds*1000,j=p.length-1;while(j>0&&(p[j][0]?.timestamp??z)>$)j-=1;let Q=p.slice(j).flat(),Z=Q[0]?.timestamp,Y=Q[Q.length-1]?.timestamp;if(Z===void 0||Y===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(Y).toISOString(),durationMs:Math.max(0,Y-Z)}}function f6(){return x0!==null}function E6(){x0?.(),x0=null,p=[]}var h6={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า"},m6={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call"};function e(z){return z==="en"?m6:h6}var b6="lw-debug-toasts",g6=6000,v6=`
2
2
  :host { all: initial; }
3
3
  .stack {
4
4
  position: fixed; top: 16px; right: 16px; z-index: 2147483001;
@@ -30,15 +30,15 @@ var c2=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=
30
30
  }
31
31
  @keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
32
32
  @media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
33
- `,G1=null;function W6(){if(typeof document>"u")return null;if(G1?.isConnected)return G1;let z=document.createElement(X6);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=V6;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),G1=j,j}function Y0(z,J="success",$){let j=B0()?S().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=W6();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let Y=document.createElement("span");Y.className="dot";let G=document.createElement("span");G.textContent=z;let F=document.createElement("button");F.type="button",F.className="close",F.textContent="✕",F.setAttribute("aria-label","ปิด");let P=()=>{window.clearTimeout(A),Z.remove()};F.addEventListener("click",P);let A=J==="error"||$?0:window.setTimeout(P,G6);if(Z.append(Y,G),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{P(),$.onClick()}),Z.append(B)}Z.append(F),Q.append(Z)}function W2(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function F2(z){return z.failedRequests.length+z.errors.length+z.erroredQueries.length}function F6(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function V1(z,J){if(!z)return J;try{return z()}catch{return J}}function H2(){let z=S(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:A0(J),user:V1(z.user,{}),apiHeaders:U0(V1(z.headers,{})),app:{name:n().name,version:n().version,environment:n().environment},client:{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,online:navigator.onLine,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio},screen:{width:window.screen.width,height:window.screen.height}},performance:F6(),extra:V1(z.extra,{})}}var H6=2,P6={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function O0(z){let J=Y1(),$=$1();return{context:H2(),reason:z.reason,note:z.note,cause:W2(J,$,z.erroredQueries),actionTrail:z1(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:X1()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:H6}}}function P2(z){return z.replace(/'/g,"'\\''")}function U2(z){let J=[`curl -X ${z.method} '${z.url}'`];for(let[$,j]of Object.entries(z.requestHeaders))J.push(` -H '${$}: ${P2(j)}'`);if(z.requestBody)J.push(` --data '${P2(z.requestBody)}'`);return J.join(" \\\n")}function U6(z){if(z.error)return`ERR ${z.error}`;return`${z.status??"—"} ${z.statusText??""}`.trim()}function M6(z){if(z.length===0)return"No network activity captured.";return z.map((J)=>{let $=J.durationMs!=null?`${J.durationMs}ms`:"—",j=`# [${U6(J)}] ${J.method} ${J.url} (${$}, ${J.startedAt})`,Q=J.responseSnippet?`
33
+ `,B1=null;function y6(){if(typeof document>"u")return null;if(B1?.isConnected)return B1;let z=document.createElement(b6);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=v6;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),B1=j,j}function V0(z,J="success",$){let j=R0()?x().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=y6();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let Y=document.createElement("span");Y.className="dot";let W=document.createElement("span");W.textContent=z;let F=document.createElement("button");F.type="button",F.className="close",F.textContent="✕",F.setAttribute("aria-label","ปิด");let P=()=>{window.clearTimeout(S),Z.remove()};F.addEventListener("click",P);let S=J==="error"||$?0:window.setTimeout(P,g6);if(Z.append(Y,W),$){let I=document.createElement("button");I.type="button",I.className="action",I.textContent=$.label,I.addEventListener("click",()=>{P(),$.onClick()}),Z.append(I)}Z.append(F),Q.append(Z)}function T2(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function f2(z){return z.failedRequests.length+z.errors.length+z.erroredQueries.length}function p6(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function x1(z,J){if(!z)return J;try{return z()}catch{return J}}function E2(){let z=x(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:v0(J),user:x1(z.user,{}),apiHeaders:I0(x1(z.headers,{})),app:{name:s().name,version:s().version,environment:s().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:p6(),extra:x1(z.extra,{})}}var u6=2,d6={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function T0(z){let J=q1(),$=P1();return{context:E2(),reason:z.reason,note:z.note,cause:T2(J,$,z.erroredQueries),actionTrail:F1(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:N1()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:u6}}}function h2(z){return z.replace(/'/g,"'\\''")}function m2(z){let J=[`curl -X ${z.method} '${z.url}'`];for(let[$,j]of Object.entries(z.requestHeaders))J.push(` -H '${$}: ${h2(j)}'`);if(z.requestBody)J.push(` --data '${h2(z.requestBody)}'`);return J.join(" \\\n")}function i6(z){if(z.error)return`ERR ${z.error}`;return`${z.status??"—"} ${z.statusText??""}`.trim()}function c6(z){if(z.length===0)return"No network activity captured.";return z.map((J)=>{let $=J.durationMs!=null?`${J.durationMs}ms`:"—",j=`# [${i6(J)}] ${J.method} ${J.url} (${$}, ${J.startedAt})`,Q=J.responseSnippet?`
34
34
  # response: ${J.responseSnippet}`:"";return`${j}
35
- ${U2(J)}${Q}`}).join(`
35
+ ${m2(J)}${Q}`}).join(`
36
36
 
37
- `)}function D6(z){if(z.length===0)return"No console output captured.";return z.map((J)=>`[${J.at}] ${J.level.toUpperCase()}: ${J.message}`).join(`
38
- `)}function I6(z){if(z.length===0)return"No user actions captured.";let J=0;return z.map(($)=>{let j=$.source?` (${$.source})`:"",Q=`${$.detail}${t0($.count)}${j}`;if($.kind==="ui")return` ↳ [${$.at}] ${Q}`;J+=1;let Z=`${J}. [${$.at}] ${Q}`;return $.afterNote?`${Z}
37
+ `)}function l6(z){if(z.length===0)return"No console output captured.";return z.map((J)=>`[${J.at}] ${J.level.toUpperCase()}: ${J.message}`).join(`
38
+ `)}function o6(z){if(z.length===0)return"No user actions captured.";let J=0;return z.map(($)=>{let j=$.source?` (${$.source})`:"",Q=`${$.detail}${X1($.count)}${j}`;if($.kind==="ui")return` ↳ [${$.at}] ${Q}`;J+=1;let Z=`${J}. [${$.at}] ${Q}`;return $.afterNote?`${Z}
39
39
  ↳ ${$.afterNote}`:Z}).join(`
40
- `)}function w6(z){let J=[];for(let $ of z.failedRequests)J.push(`✗ ${$.status??$.error??"ERR"} ${$.method} ${$.url}`);for(let $ of z.errors)J.push(`⚠ ${$}`);for(let $ of z.erroredQueries)J.push(`⚠ React Query error: ${$.key} — ${$.error}`);return J}function q6(z){let{context:J}=z;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 : ${P6[z.reason.type]}${z.reason.message?` — ${z.reason.message}`:""}`,`Captured : ${z.network.length} requests · ${z.console.length} console · ${z.actionTrail.length} actions · screenshot=${z.screenshotMethod}${z.replay?` · replay=${Math.round(z.replay.durationMs/1000)}s`:""}`]}function B6(z){let J=w6(z.cause),$=[`## \uD83D\uDC1E ${z.context.app.name} — Debug Report`,`**Generated:** ${z.context.capturedAt}`,"",...q6(z).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${z.note.trim()||"(ไม่มี)"}`];if(J.length>0)$.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...J,"```");return $.push("",`<details><summary>ขั้นตอน (${z.actionTrail.length})</summary>`,"","```",I6(z.actionTrail),"```","</details>","",`<details><summary>Network (${z.network.length})</summary>`,"","```",M6(z.network),"```","</details>","",`<details><summary>Console (${z.console.length})</summary>`,"","```",D6(z.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),$.join(`
41
- `)}function N6(z){return z.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function x6(z,J){return`debug-report_${N6(z.context.capturedAt)}.${J}`}function C6(z){return F2(z.cause)>0}async function g0(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await O6();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await k6();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function O6(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await _6(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function _6(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((Y)=>{let G=!1,F=()=>{if(G)return;G=!0,Y()};J.onloadedmetadata=()=>{J.play().then(F).catch(F)},window.setTimeout(F,1500)}),await S6(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function S6(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function k6(){let z=S().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var R6=2000,A6=0.82,L6=3000000;function f6(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function b0(z){try{let J=await f6(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,R6/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let Y=A6,G=Q.toDataURL("image/jpeg",Y);while(G.length>L6&&Y>0.4)Y-=0.15,G=Q.toDataURL("image/jpeg",Y);return G}catch{return z}}var T6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,E6=/^\d+$/,h6=/^[0-9a-f]{16,}$/i;function W1(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>T6.test(Z)||E6.test(Z)||h6.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var F1=2000000;function p0(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function H1(z,J=2000000){if(p0(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(p0(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&p0(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&p0(j)>J)j.console=j.console.slice(1);return j}function _0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var m6=4,g6=2,b6=3,p6=0,v6=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),y6=/^\s*javascript:/i;function u6(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&y6.test(J)}function M2(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(u6($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!v6.has($)||!j.includes("?"))continue;z[$]=a(j)}}function P1(z){if(!z)return;M2(z.attributes);for(let J of z.childNodes??[])P1(J)}function D2(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===m6&&typeof j.href==="string")j.href=a(j.href);else if($.type===g6)P1(j.node);else if($.type===b6&&j.source===p6){for(let Q of j.adds??[])P1(Q.node);for(let Q of j.attributes??[])M2(Q.attributes,!0)}}return J}var w2="session-replay.json.gz",d6="session-replay.json";function i6(z){return Boolean(z&&z.events.length>0)}async function c6(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function U1(z,J){if(!i6(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=D2(z.events),Z=await I2(Q),Y=!1;if(Z.bytes.byteLength>J&&r6(Q))Q=n6(Q),Z=await I2(Q),Y=!0;let{bytes:G,compressed:F}=Z;if(G.byteLength>J)return{summary:{...j,bytes:G.byteLength,omitted:"too-large"}};return{dataUri:`data:${F?"application/gzip":"application/json"};base64,${_0(G)}`,filename:F?w2:d6,summary:{...j,events:Q.length,bytes:G.byteLength,compressed:F,...Y?{canvasDropped:Y}:{}}}}async function I2(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await c6(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var l6=3,q2=2,o6=9;function B2(z){return z.type===l6&&z.data?.source===o6}function r6(z){return z.some(B2)||z.some((J)=>J.type===q2&&N2(J.data.node))}function N2(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(N2)}function x2(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])x2(J)}function n6(z){let J=[];for(let $ of z){if(B2($))continue;if($.type===q2)x2($.data.node);J.push($)}return J}var s6=new Set([502,503,504]);class t extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function a6(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${_0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function M1(){let z=S().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function D1(z,J){let $=S(),j=H1(J,F1),{context:Q,note:Z}=j,Y=[];if(j.screenshotDataUrl){let N=await b0(j.screenshotDataUrl);Y.push({dataUri:N,filename:"screenshot.jpg"})}Y.push(a6(j));let G,F=N0();if(F){let N=await U1(j.replay,F.maxBytes);if(G=N.summary,"dataUri"in N)Y.push({dataUri:N.dataUri,filename:N.filename})}let P=W1(j),A={title:z,description:Z.trim()||void 0,appName:n().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:n().name,module:Q.module?.label??""},context:{...P?{signature:P}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...G?{replay:G}:{}},attachments:Y},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await M1()},body:JSON.stringify(A)}).catch(()=>{throw new t("report never left the browser","offline")});if(!B.ok)throw await I1(B);return await B.json()}async function I1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new t("rate limited","rateLimited",J??void 0);if(s6.has(z.status))return new t("desk unavailable","unavailable");return new t($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var v0=null,S0=null,C2=()=>S().host.replace(/\/$/,"");function y0(){return v0}function X0(){if(S0)return S0;return S0=(async()=>{try{let z=await fetch(`${C2()}/ingest/request-types`,{headers:{"x-realm-key":S().realmKey}}),J=z.ok?await z.json():null;v0=Array.isArray(J?.types)?J.types.filter(t6):[]}catch{v0=[],S0=null}return v0??[]})(),S0}function t6(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function w1(z){let J=S(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:n().name,category:j?A0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await b0(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${C2()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await M1()},body:JSON.stringify(Q)}).catch(()=>{throw new t("request never left the browser","offline")});if(!Z.ok)throw await I1(Z);return await Z.json()}var k0=Math.PI/6;function O2(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),Y=Math.atan2(Q,j),G=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(Y-k0),y:J.y-$*Math.sin(Y-k0)},{x:J.x-$*Math.cos(Y+k0),y:J.y-$*Math.sin(Y+k0)}],F=$*Math.cos(k0)*0.92;if(Z<=F)return{shaft:null,head:G};return{shaft:{from:z,to:{x:J.x-F*Math.cos(Y),y:J.y-F*Math.sin(Y)}},head:G}}var q1="#f44336",e6="rgba(250, 204, 21, 0.4)",B1=22,_2="#2563eb",S2=9,k2=11,R2=18,A2=4,u0=8,z8=[{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 N1(z,J,$){let j=[],Q=null,Z=-1,Y=null,G=null,F=z.getContext("2d");function P(){let K=z.getBoundingClientRect().width;return K>0?z.width/K:1}function A(K){let X=z.getBoundingClientRect();return{x:(K.clientX-X.left)/X.width*z.width,y:(K.clientY-X.top)/X.height*z.height}}function B(K){let X=K.size??B1;if(!F)return(K.text?.length??0)*X*0.6;F.save(),F.font=`600 ${X}px system-ui, sans-serif`;let W=F.measureText(K.text??"").width;return F.restore(),W}function N(K){if(K.tool==="text"){let X=K.size??B1;return{left:K.x1,top:K.y1,right:K.x1+B(K),bottom:K.y1+X*1.25}}return{left:Math.min(K.x1,K.x2),top:Math.min(K.y1,K.y2),right:Math.max(K.x1,K.x2),bottom:Math.max(K.y1,K.y2)}}function f(K){if(K.tool==="arrow")return[{id:"tail",x:K.x1,y:K.y1,cursor:"move"},{id:"head",x:K.x2,y:K.y2,cursor:"move"}];let X=N(K);if(K.tool==="text")return[{id:"size",x:X.right,y:X.bottom,cursor:"nwse-resize"}];return z8.map((W)=>({id:W.id,x:X.left+(X.right-X.left)*W.fx,y:X.top+(X.bottom-X.top)*W.fy,cursor:W.cursor}))}function R(K){let X=N(K);return{x:X.right+R2*P(),y:X.top-R2*P()}}function h(K,X,W){let{shaft:V,head:H}=O2({x:X.x1,y:X.y1},{x:X.x2,y:X.y2},Math.max(10,16*W));if(V)K.lineCap="butt",K.beginPath(),K.moveTo(V.from.x,V.from.y),K.lineTo(V.to.x,V.to.y),K.stroke();K.beginPath(),K.moveTo(H[0].x,H[0].y),K.lineTo(H[1].x,H[1].y),K.lineTo(H[2].x,H[2].y),K.closePath(),K.fill()}function p(K,X,W){K.save(),K.lineWidth=Math.max(2,3*W),K.strokeStyle=q1,K.fillStyle=q1;let V=N(X);if(X.tool==="rect")K.strokeRect(V.left,V.top,V.right-V.left,V.bottom-V.top);else if(X.tool==="arrow")h(K,X,W);else if(X.tool==="highlight")K.fillStyle=e6,K.fillRect(V.left,V.top,V.right-V.left,V.bottom-V.top);else if(X.tool==="text"&&X.text){let H=X.size??B1;K.font=`600 ${H}px system-ui, sans-serif`,K.textBaseline="top";let M=H*0.22;K.fillStyle="rgba(255,255,255,0.92)",K.fillRect(V.left-M,V.top-M,V.right-V.left+M*2,V.bottom-V.top+M*2),K.fillStyle=q1,K.fillText(X.text,V.left,V.top)}K.restore()}function I(K,X,W){let V=N(X);K.save(),K.strokeStyle=_2,K.lineWidth=Math.max(1,1.5*W),K.setLineDash([6*W,4*W]),K.strokeRect(V.left,V.top,V.right-V.left,V.bottom-V.top),K.setLineDash([]);let H=S2*W;for(let b of f(X))K.fillStyle="#fff",K.strokeStyle=_2,K.lineWidth=Math.max(1,1.5*W),K.beginPath(),K.rect(b.x-H/2,b.y-H/2,H,H),K.fill(),K.stroke();let M=R(X),x=k2*W;K.beginPath(),K.arc(M.x,M.y,x,0,Math.PI*2),K.fillStyle="#dc2626",K.fill(),K.strokeStyle="#fff",K.lineWidth=Math.max(1.5,2*W),K.beginPath(),K.moveTo(M.x-x*0.4,M.y-x*0.4),K.lineTo(M.x+x*0.4,M.y+x*0.4),K.moveTo(M.x+x*0.4,M.y-x*0.4),K.lineTo(M.x-x*0.4,M.y+x*0.4),K.stroke(),K.restore()}function w(){if(!F)return;let K=P();if(F.clearRect(0,0,z.width,z.height),F.drawImage(J,0,0,z.width,z.height),j.forEach((W,V)=>{if(V!==c)p(F,W,K)}),Y)p(F,Y,K);let X=j[Z];if(X&&!Y)I(F,X,K)}function u(K,X,W,V,H){return Math.abs(K-W)<=H&&Math.abs(X-V)<=H}function i(K,X){let W=j[Z];if(!W)return null;let V=S2*P()/2+3*P();for(let H of f(W))if(u(K,X,H.x,H.y,V))return H.id;return null}function T(K,X){let W=j[Z];if(!W)return!1;let V=R(W);return u(K,X,V.x,V.y,k2*P())}function m(K,X){let W=6*P();for(let V=j.length-1;V>=0;V-=1){let H=j[V];if(H.tool==="arrow"){let x=H.x2-H.x1,b=H.y2-H.y1,r=Math.hypot(x,b)||1,U=Math.max(0,Math.min(1,((K-H.x1)*x+(X-H.y1)*b)/(r*r)));if(Math.hypot(K-(H.x1+U*x),X-(H.y1+U*b))<=W+4*P())return V;continue}let M=N(H);if(K>=M.left-W&&K<=M.right+W&&X>=M.top-W&&X<=M.bottom+W)return V}return-1}function L(K,X,W,V,H){if(X==="tail"){K.x1=W.x1+V,K.y1=W.y1+H;return}if(X==="head"){K.x2=W.x2+V,K.y2=W.y2+H;return}if(X==="size"){let C=(W.size??24)+H;K.size=Math.max(10,C);return}let M=N(W),{left:x,top:b,right:r,bottom:U}=M;if(X.includes("w"))x=Math.min(r-u0,x+V);if(X.includes("e"))r=Math.max(x+u0,r+V);if(X.includes("n"))b=Math.min(U-u0,b+H);if(X.includes("s"))U=Math.max(b+u0,U+H);K.x1=x,K.y1=b,K.x2=r,K.y2=U}function G0(K,X,W,V){K.x1=X.x1+W,K.y1=X.y1+V,K.x2=X.x2+W,K.y2=X.y2+V}let k=null,c=-1,_={x:0,y:0,size:24};function g(){let K=z.getBoundingClientRect().width;return K>0?K/z.width:1}function R0(K,X){if(!F)return K.length*X*0.6;F.save(),F.font=`600 ${X}px system-ui, sans-serif`;let W=F.measureText(K||" ").width;return F.restore(),W}function V0(){if(!k)return;let K=z.parentElement;if(!K)return;let X=z.getBoundingClientRect(),W=K.getBoundingClientRect(),V=g(),H=_.size*V;k.style.left=`${X.left-W.left+_.x*V}px`,k.style.top=`${X.top-W.top+_.y*V}px`,k.style.fontSize=`${H}px`,k.style.width=`${Math.max(40,R0(k.value,H)+H)}px`}function e(K){let X=k;if(!X)return;k=null;let W=X.value.trim(),V=c;if(c=-1,X.remove(),K&&W){if(V>=0&&j[V])j[V].text=W,Z=V;else j.push({tool:"text",x1:_.x,y1:_.y,x2:_.x,y2:_.y,text:W,size:_.size}),Z=j.length-1;$()}else if(V>=0)Z=V;z.focus(),w()}function s(K,X,W=-1){e(!0);let V=z.parentElement;if(!V)return;if(getComputedStyle(V).position==="static")V.style.position="relative";let H=W>=0?j[W]:void 0;c=W,_={x:H?.x1??K,y:H?.y1??X,size:H?.size??Math.round(24*P())};let M=document.createElement("input");M.type="text",M.className="text-edit",M.value=H?.text??"",M.setAttribute("aria-label","ข้อความบนภาพ"),M.placeholder="ข้อความ",k=M,V.append(M),V0(),M.addEventListener("input",V0),M.addEventListener("keydown",(x)=>{if(x.stopPropagation(),x.key==="Enter")e(!0);else if(x.key==="Escape")e(!1)}),requestAnimationFrame(()=>{if(k!==M)return;M.focus(),M.select(),M.addEventListener("blur",()=>e(!0))}),w()}function l(K){let{x:X,y:W}=A(K);if(z.setPointerCapture(K.pointerId),T(X,W)){o();return}let V=i(X,W);if(V&&j[Z]){G={grip:V,x:X,y:W,start:{...j[Z]}};return}if(Q==="text"){if(K.preventDefault(),z.hasPointerCapture(K.pointerId))z.releasePointerCapture(K.pointerId);Q=null,$(),s(X,W);return}if(Q){Y={tool:Q,x1:X,y1:W,x2:X,y2:W},Z=-1;return}let H=m(X,W);Z=H,G=H>=0?{grip:"body",x:X,y:W,start:{...j[H]}}:null,w()}function W0(K){let{x:X,y:W}=A(K);if(Y){Y.x2=X,Y.y2=W,w();return}if(G){let H=j[Z];if(!H)return;let M=X-G.x,x=W-G.y;if(G.grip==="body")G0(H,G.start,M,x);else L(H,G.grip,G.start,M,x);w();return}if(Q){z.style.cursor="crosshair";return}if(T(X,W)){z.style.cursor="pointer";return}let V=i(X,W);if(V){let H=j[Z]?f(j[Z]).find((M)=>M.id===V):null;z.style.cursor=H?.cursor??"pointer";return}z.style.cursor=m(X,W)>=0?"move":"default"}function Q0(){if(Y){if(!(Math.abs(Y.x2-Y.x1)<A2&&Math.abs(Y.y2-Y.y1)<A2))j.push(Y),Z=j.length-1,Q=null,$();Y=null}if(G)G=null,$();w()}function z0(K){let X=z.getBoundingClientRect(),W=(K.clientX-X.left)/X.width*z.width,V=(K.clientY-X.top)/X.height*z.height,H=m(W,V),M=j[H];if(!M||M.tool!=="text")return;K.preventDefault(),s(M.x1,M.y1,H)}function J0(K){if(Z<0)return;if(K.key==="Delete"||K.key==="Backspace")K.preventDefault(),o();else if(K.key==="Escape")K.preventDefault(),Z=-1,w()}function o(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),w()}return z.addEventListener("pointerdown",l),z.addEventListener("pointermove",W0),z.addEventListener("pointerup",Q0),z.addEventListener("pointercancel",Q0),z.addEventListener("dblclick",z0),z.tabIndex=0,z.addEventListener("keydown",J0),w(),{setTool(K){Q=K,Z=-1,z.style.cursor=K?"crosshair":"default",w()},deleteSelected:o,clear(){j.length=0,Z=-1,$(),w()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let K=document.createElement("canvas");K.width=J.naturalWidth,K.height=J.naturalHeight;let X=K.getContext("2d");if(!X)return z.toDataURL("image/png");X.drawImage(J,0,0);let W=P();for(let V of j)p(X,V,W);return K.toDataURL("image/png")},destroy(){e(!1),z.removeEventListener("pointerdown",l),z.removeEventListener("pointermove",W0),z.removeEventListener("pointerup",Q0),z.removeEventListener("pointercancel",Q0),z.removeEventListener("dblclick",z0),z.removeEventListener("keydown",J0)}}}var J8=["keydown","keyup","keypress"];function d0(z){for(let J of J8)z.addEventListener(J,($)=>$.stopPropagation())}var L2=`
40
+ `)}function r6(z){let J=[];for(let $ of z.failedRequests)J.push(`✗ ${$.status??$.error??"ERR"} ${$.method} ${$.url}`);for(let $ of z.errors)J.push(`⚠ ${$}`);for(let $ of z.erroredQueries)J.push(`⚠ React Query error: ${$.key} — ${$.error}`);return J}function n6(z){let{context:J}=z;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 : ${d6[z.reason.type]}${z.reason.message?` — ${z.reason.message}`:""}`,`Captured : ${z.network.length} requests · ${z.console.length} console · ${z.actionTrail.length} actions · screenshot=${z.screenshotMethod}${z.replay?` · replay=${Math.round(z.replay.durationMs/1000)}s`:""}`]}function s6(z){let J=r6(z.cause),$=[`## \uD83D\uDC1E ${z.context.app.name} — Debug Report`,`**Generated:** ${z.context.capturedAt}`,"",...n6(z).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${z.note.trim()||"(ไม่มี)"}`];if(J.length>0)$.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...J,"```");return $.push("",`<details><summary>ขั้นตอน (${z.actionTrail.length})</summary>`,"","```",o6(z.actionTrail),"```","</details>","",`<details><summary>Network (${z.network.length})</summary>`,"","```",c6(z.network),"```","</details>","",`<details><summary>Console (${z.console.length})</summary>`,"","```",l6(z.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),$.join(`
41
+ `)}function a6(z){return z.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function t6(z,J){return`debug-report_${a6(z.context.capturedAt)}.${J}`}function e6(z){return f2(z.cause)>0}async function l0(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await z8();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await j8();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function z8(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await J8(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function J8(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((Y)=>{let W=!1,F=()=>{if(W)return;W=!0,Y()};J.onloadedmetadata=()=>{J.play().then(F).catch(F)},window.setTimeout(F,1500)}),await $8(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function $8(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function j8(){let z=x().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var Q8=2000,Z8=0.82,K8=3000000;function Y8(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function o0(z){try{let J=await Y8(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,Q8/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let Y=Z8,W=Q.toDataURL("image/jpeg",Y);while(W.length>K8&&Y>0.4)Y-=0.15,W=Q.toDataURL("image/jpeg",Y);return W}catch{return z}}var W8=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,V8=/^\d+$/,X8=/^[0-9a-f]{16,}$/i;function C1(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>W8.test(Z)||V8.test(Z)||X8.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var w1=2000000;function r0(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function O1(z,J=2000000){if(r0(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(r0(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&r0(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&r0(j)>J)j.console=j.console.slice(1);return j}function f0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var G8=4,F8=2,H8=3,P8=0,U8=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),D8=/^\s*javascript:/i;function M8(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&D8.test(J)}function b2(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(M8($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!U8.has($)||!j.includes("?"))continue;z[$]=t(j)}}function _1(z){if(!z)return;b2(z.attributes);for(let J of z.childNodes??[])_1(J)}function g2(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===G8&&typeof j.href==="string")j.href=t(j.href);else if($.type===F8)_1(j.node);else if($.type===H8&&j.source===P8){for(let Q of j.adds??[])_1(Q.node);for(let Q of j.attributes??[])b2(Q.attributes,!0)}}return J}var y2="session-replay.json.gz",I8="session-replay.json";function q8(z){return Boolean(z&&z.events.length>0)}async function N8(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function S1(z,J){if(!q8(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=g2(z.events),Z=await v2(Q),Y=!1;if(Z.bytes.byteLength>J&&C8(Q))Q=w8(Q),Z=await v2(Q),Y=!0;let{bytes:W,compressed:F}=Z;if(W.byteLength>J)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${F?"application/gzip":"application/json"};base64,${f0(W)}`,filename:F?y2:I8,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:F,...Y?{canvasDropped:Y}:{}}}}async function v2(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await N8(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var B8=3,p2=2,x8=9;function u2(z){return z.type===B8&&z.data?.source===x8}function C8(z){return z.some(u2)||z.some((J)=>J.type===p2&&d2(J.data.node))}function d2(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(d2)}function i2(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])i2(J)}function w8(z){let J=[];for(let $ of z){if(u2($))continue;if($.type===p2)i2($.data.node);J.push($)}return J}var O8=new Set([502,503,504]);class z0 extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function _8(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${f0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function R1(){let z=x().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function A1(z,J){let $=x(),j=O1(J,w1),{context:Q,note:Z}=j,Y=[];if(j.screenshotDataUrl){let q=await o0(j.screenshotDataUrl);Y.push({dataUri:q,filename:"screenshot.jpg"})}Y.push(_8(j));let W,F=A0();if(F){let q=await S1(j.replay,F.maxBytes);if(W=q.summary,"dataUri"in q)Y.push({dataUri:q.dataUri,filename:q.filename})}let P=C1(j),S={title:z,description:Z.trim()||void 0,appName:s().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:s().name,module:Q.module?.label??""},context:{...P?{signature:P}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:Y},I=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await R1()},body:JSON.stringify(S)}).catch(()=>{throw new z0("report never left the browser","offline")});if(!I.ok)throw await L1(I);return await I.json()}async function L1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new z0("rate limited","rateLimited",J??void 0);if(O8.has(z.status))return new z0("desk unavailable","unavailable");return new z0($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var n0=null,E0=null,c2=()=>x().host.replace(/\/$/,"");function s0(){return n0}function X0(){if(E0)return E0;return E0=(async()=>{try{let z=await fetch(`${c2()}/ingest/request-types`,{headers:{"x-realm-key":x().realmKey}}),J=z.ok?await z.json():null;n0=Array.isArray(J?.types)?J.types.filter(S8):[]}catch{n0=[],E0=null}return n0??[]})(),E0}function S8(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function k1(z){let J=x(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:s().name,category:j?v0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await o0(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${c2()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await R1()},body:JSON.stringify(Q)}).catch(()=>{throw new z0("request never left the browser","offline")});if(!Z.ok)throw await L1(Z);return await Z.json()}var h0=Math.PI/6;function l2(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),Y=Math.atan2(Q,j),W=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(Y-h0),y:J.y-$*Math.sin(Y-h0)},{x:J.x-$*Math.cos(Y+h0),y:J.y-$*Math.sin(Y+h0)}],F=$*Math.cos(h0)*0.92;if(Z<=F)return{shaft:null,head:W};return{shaft:{from:z,to:{x:J.x-F*Math.cos(Y),y:J.y-F*Math.sin(Y)}},head:W}}var T1="#f44336",R8="rgba(250, 204, 21, 0.4)",f1=22,o2="#2563eb",r2=9,n2=11,s2=18,a2=4,a0=8,A8=[{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 E1(z,J,$){let j=[],Q=null,Z=-1,Y=null,W=null,F=z.getContext("2d");function P(){let K=z.getBoundingClientRect().width;return K>0?z.width/K:1}function S(K){let V=z.getBoundingClientRect();return{x:(K.clientX-V.left)/V.width*z.width,y:(K.clientY-V.top)/V.height*z.height}}function I(K){let V=K.size??f1;if(!F)return(K.text?.length??0)*V*0.6;F.save(),F.font=`600 ${V}px system-ui, sans-serif`;let G=F.measureText(K.text??"").width;return F.restore(),G}function q(K){if(K.tool==="text"){let V=K.size??f1;return{left:K.x1,top:K.y1,right:K.x1+I(K),bottom:K.y1+V*1.25}}return{left:Math.min(K.x1,K.x2),top:Math.min(K.y1,K.y2),right:Math.max(K.x1,K.x2),bottom:Math.max(K.y1,K.y2)}}function R(K){if(K.tool==="arrow")return[{id:"tail",x:K.x1,y:K.y1,cursor:"move"},{id:"head",x:K.x2,y:K.y2,cursor:"move"}];let V=q(K);if(K.tool==="text")return[{id:"size",x:V.right,y:V.bottom,cursor:"nwse-resize"}];return A8.map((G)=>({id:G.id,x:V.left+(V.right-V.left)*G.fx,y:V.top+(V.bottom-V.top)*G.fy,cursor:G.cursor}))}function w(K){let V=q(K);return{x:V.right+s2*P(),y:V.top-s2*P()}}function h(K,V,G){let{shaft:X,head:H}=l2({x:V.x1,y:V.y1},{x:V.x2,y:V.y2},Math.max(10,16*G));if(X)K.lineCap="butt",K.beginPath(),K.moveTo(X.from.x,X.from.y),K.lineTo(X.to.x,X.to.y),K.stroke();K.beginPath(),K.moveTo(H[0].x,H[0].y),K.lineTo(H[1].x,H[1].y),K.lineTo(H[2].x,H[2].y),K.closePath(),K.fill()}function v(K,V,G){K.save(),K.lineWidth=Math.max(2,3*G),K.strokeStyle=T1,K.fillStyle=T1;let X=q(V);if(V.tool==="rect")K.strokeRect(X.left,X.top,X.right-X.left,X.bottom-X.top);else if(V.tool==="arrow")h(K,V,G);else if(V.tool==="highlight")K.fillStyle=R8,K.fillRect(X.left,X.top,X.right-X.left,X.bottom-X.top);else if(V.tool==="text"&&V.text){let H=V.size??f1;K.font=`600 ${H}px system-ui, sans-serif`,K.textBaseline="top";let D=H*0.22;K.fillStyle="rgba(255,255,255,0.92)",K.fillRect(X.left-D,X.top-D,X.right-X.left+D*2,X.bottom-X.top+D*2),K.fillStyle=T1,K.fillText(V.text,X.left,X.top)}K.restore()}function N(K,V,G){let X=q(V);K.save(),K.strokeStyle=o2,K.lineWidth=Math.max(1,1.5*G),K.setLineDash([6*G,4*G]),K.strokeRect(X.left,X.top,X.right-X.left,X.bottom-X.top),K.setLineDash([]);let H=r2*G;for(let g of R(V))K.fillStyle="#fff",K.strokeStyle=o2,K.lineWidth=Math.max(1,1.5*G),K.beginPath(),K.rect(g.x-H/2,g.y-H/2,H,H),K.fill(),K.stroke();let D=w(V),O=n2*G;K.beginPath(),K.arc(D.x,D.y,O,0,Math.PI*2),K.fillStyle="#dc2626",K.fill(),K.strokeStyle="#fff",K.lineWidth=Math.max(1.5,2*G),K.beginPath(),K.moveTo(D.x-O*0.4,D.y-O*0.4),K.lineTo(D.x+O*0.4,D.y+O*0.4),K.moveTo(D.x+O*0.4,D.y-O*0.4),K.lineTo(D.x-O*0.4,D.y+O*0.4),K.stroke(),K.restore()}function B(){if(!F)return;let K=P();if(F.clearRect(0,0,z.width,z.height),F.drawImage(J,0,0,z.width,z.height),j.forEach((G,X)=>{if(X!==l)v(F,G,K)}),Y)v(F,Y,K);let V=j[Z];if(V&&!Y)N(F,V,K)}function u(K,V,G,X,H){return Math.abs(K-G)<=H&&Math.abs(V-X)<=H}function c(K,V){let G=j[Z];if(!G)return null;let X=r2*P()/2+3*P();for(let H of R(G))if(u(K,V,H.x,H.y,X))return H.id;return null}function f(K,V){let G=j[Z];if(!G)return!1;let X=w(G);return u(K,V,X.x,X.y,n2*P())}function m(K,V){let G=6*P();for(let X=j.length-1;X>=0;X-=1){let H=j[X];if(H.tool==="arrow"){let O=H.x2-H.x1,g=H.y2-H.y1,n=Math.hypot(O,g)||1,U=Math.max(0,Math.min(1,((K-H.x1)*O+(V-H.y1)*g)/(n*n)));if(Math.hypot(K-(H.x1+U*O),V-(H.y1+U*g))<=G+4*P())return X;continue}let D=q(H);if(K>=D.left-G&&K<=D.right+G&&V>=D.top-G&&V<=D.bottom+G)return X}return-1}function T(K,V,G,X,H){if(V==="tail"){K.x1=G.x1+X,K.y1=G.y1+H;return}if(V==="head"){K.x2=G.x2+X,K.y2=G.y2+H;return}if(V==="size"){let _=(G.size??24)+H;K.size=Math.max(10,_);return}let D=q(G),{left:O,top:g,right:n,bottom:U}=D;if(V.includes("w"))O=Math.min(n-a0,O+X);if(V.includes("e"))n=Math.max(O+a0,n+X);if(V.includes("n"))g=Math.min(U-a0,g+H);if(V.includes("s"))U=Math.max(g+a0,U+H);K.x1=O,K.y1=g,K.x2=n,K.y2=U}function F0(K,V,G,X){K.x1=V.x1+G,K.y1=V.y1+X,K.x2=V.x2+G,K.y2=V.y2+X}let k=null,l=-1,L={x:0,y:0,size:24};function b(){let K=z.getBoundingClientRect().width;return K>0?K/z.width:1}function g0(K,V){if(!F)return K.length*V*0.6;F.save(),F.font=`600 ${V}px system-ui, sans-serif`;let G=F.measureText(K||" ").width;return F.restore(),G}function H0(){if(!k)return;let K=z.parentElement;if(!K)return;let V=z.getBoundingClientRect(),G=K.getBoundingClientRect(),X=b(),H=L.size*X;k.style.left=`${V.left-G.left+L.x*X}px`,k.style.top=`${V.top-G.top+L.y*X}px`,k.style.fontSize=`${H}px`,k.style.width=`${Math.max(40,g0(k.value,H)+H)}px`}function J0(K){let V=k;if(!V)return;k=null;let G=V.value.trim(),X=l;if(l=-1,V.remove(),K&&G){if(X>=0&&j[X])j[X].text=G,Z=X;else j.push({tool:"text",x1:L.x,y1:L.y,x2:L.x,y2:L.y,text:G,size:L.size}),Z=j.length-1;$()}else if(X>=0)Z=X;z.focus(),B()}function a(K,V,G=-1){J0(!0);let X=z.parentElement;if(!X)return;if(getComputedStyle(X).position==="static")X.style.position="relative";let H=G>=0?j[G]:void 0;l=G,L={x:H?.x1??K,y:H?.y1??V,size:H?.size??Math.round(24*P())};let D=document.createElement("input");D.type="text",D.className="text-edit",D.value=H?.text??"",D.setAttribute("aria-label","ข้อความบนภาพ"),D.placeholder="ข้อความ",k=D,X.append(D),H0(),D.addEventListener("input",H0),D.addEventListener("keydown",(O)=>{if(O.stopPropagation(),O.key==="Enter")J0(!0);else if(O.key==="Escape")J0(!1)}),requestAnimationFrame(()=>{if(k!==D)return;D.focus(),D.select(),D.addEventListener("blur",()=>J0(!0))}),B()}function o(K){let{x:V,y:G}=S(K);if(z.setPointerCapture(K.pointerId),f(V,G)){r();return}let X=c(V,G);if(X&&j[Z]){W={grip:X,x:V,y:G,start:{...j[Z]}};return}if(Q==="text"){if(K.preventDefault(),z.hasPointerCapture(K.pointerId))z.releasePointerCapture(K.pointerId);Q=null,$(),a(V,G);return}if(Q){Y={tool:Q,x1:V,y1:G,x2:V,y2:G},Z=-1;return}let H=m(V,G);Z=H,W=H>=0?{grip:"body",x:V,y:G,start:{...j[H]}}:null,B()}function P0(K){let{x:V,y:G}=S(K);if(Y){Y.x2=V,Y.y2=G,B();return}if(W){let H=j[Z];if(!H)return;let D=V-W.x,O=G-W.y;if(W.grip==="body")F0(H,W.start,D,O);else T(H,W.grip,W.start,D,O);B();return}if(Q){z.style.cursor="crosshair";return}if(f(V,G)){z.style.cursor="pointer";return}let X=c(V,G);if(X){let H=j[Z]?R(j[Z]).find((D)=>D.id===X):null;z.style.cursor=H?.cursor??"pointer";return}z.style.cursor=m(V,G)>=0?"move":"default"}function Y0(){if(Y){if(!(Math.abs(Y.x2-Y.x1)<a2&&Math.abs(Y.y2-Y.y1)<a2))j.push(Y),Z=j.length-1,Q=null,$();Y=null}if(W)W=null,$();B()}function $0(K){let V=z.getBoundingClientRect(),G=(K.clientX-V.left)/V.width*z.width,X=(K.clientY-V.top)/V.height*z.height,H=m(G,X),D=j[H];if(!D||D.tool!=="text")return;K.preventDefault(),a(D.x1,D.y1,H)}function j0(K){if(Z<0)return;if(K.key==="Delete"||K.key==="Backspace")K.preventDefault(),r();else if(K.key==="Escape")K.preventDefault(),Z=-1,B()}function r(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),B()}return z.addEventListener("pointerdown",o),z.addEventListener("pointermove",P0),z.addEventListener("pointerup",Y0),z.addEventListener("pointercancel",Y0),z.addEventListener("dblclick",$0),z.tabIndex=0,z.addEventListener("keydown",j0),B(),{setTool(K){Q=K,Z=-1,z.style.cursor=K?"crosshair":"default",B()},deleteSelected:r,clear(){j.length=0,Z=-1,$(),B()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let K=document.createElement("canvas");K.width=J.naturalWidth,K.height=J.naturalHeight;let V=K.getContext("2d");if(!V)return z.toDataURL("image/png");V.drawImage(J,0,0);let G=P();for(let X of j)v(V,X,G);return K.toDataURL("image/png")},destroy(){J0(!1),z.removeEventListener("pointerdown",o),z.removeEventListener("pointermove",P0),z.removeEventListener("pointerup",Y0),z.removeEventListener("pointercancel",Y0),z.removeEventListener("dblclick",$0),z.removeEventListener("keydown",j0)}}}var L8=["keydown","keyup","keypress"];function C0(z){for(let J of L8)z.addEventListener(J,($)=>$.stopPropagation())}var t2=`
42
42
  :host { all: initial; }
43
43
  * { box-sizing: border-box; }
44
44
 
@@ -189,7 +189,7 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
189
189
  .shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
190
190
  .dropped { opacity: 0.35; pointer-events: none; }
191
191
  .draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
192
- `;var q0="lw-debug-reporter",j0=null;function $8(z,J){if(z instanceof t){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var m2=()=>[];function j8(z){m2=z}var Q8=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function Z8(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;keep=null;returnFocus=null;constructor(){super();this.root=this.attachShadow({mode:"open"}),d0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=j1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=K0(S().locale),Q=y0();if(Q===null)X0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=q("div","head"),Z=d("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(q("h2","",J.chooseTitle),Z);let Y=h2("problem",Y8,J.kindProblem,J.chooseProblemHint);Y.dataset.choose="problem",Y.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let G=h2("request",T2,J.kindRequest,J.chooseRequestHint);G.dataset.choose="request",G.addEventListener("click",()=>{this.bundle=O0({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:x1()}),this.renderForm(J,$,"request")});let F=q("div","kinds choose");F.append(Y,G),F.addEventListener("keydown",(P)=>{if(!f2.includes(P.key))return;P.preventDefault(),(this.root.activeElement===Y?G:Y).focus()}),j.append(Q,F),Y.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await g0();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=O0({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:x1()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await g0();if(j.method==="cancelled"){this.close();return}this.bundle=O0({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:x1()}),this.renderForm($,J,"problem")}close(J=!1){if(J)j0=null;else if(this.keep)j0=this.keep()??j0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=L2;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=q("div","head");Q.append(q("h2","",J.title)),j.append(Q,q("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let Y=this.shell(J),G=j,F=j==="problem"||!!Z.screenshotDataUrl,P=null,A=q("div","head"),B=q("h2","",J.title),N=d("✕","icon");N.setAttribute("aria-label",J.close),N.addEventListener("click",()=>this.close()),A.append(B,N);let f=q("p","door");f.hidden=!0;let R=q("span"),h=d("","link");h.dataset.switchKind="",h.addEventListener("click",()=>X(G==="problem"?"request":"problem")),f.append(R,h);let p=q("div","ask");p.hidden=!0;let I=document.createElement("input");I.type="search",I.className="type-search",I.placeholder=J.requestTypeSearch,I.setAttribute("aria-label",J.requestTypeSearch),I.dataset.requestTypeSearch="",I.hidden=!0;let w=q("div","types");w.setAttribute("role","radiogroup"),w.setAttribute("aria-label",J.requestTypeLabel);let u=q("p","status",J.requestTypeNone);u.hidden=!0;let i=q("p","status type-count","");i.hidden=!0,p.append(i0(J.requestTypeLabel,"",!0),I,w,u,i);let T=[],m=()=>{for(let C of T){let D=C.dataset.requestType===P?.id;C.setAttribute("aria-checked",String(D)),C.tabIndex=D?0:-1}let U=T.find((C)=>C.dataset.requestType===P?.id);if(U&&w.scrollHeight>w.clientHeight){let C=U.offsetTop-w.offsetTop;if(C<w.scrollTop)w.scrollTop=C;else if(C+U.offsetHeight>w.scrollTop+w.clientHeight)w.scrollTop=C+U.offsetHeight-w.clientHeight}},L=document.createElement("input");L.type="text";let G0=i0(""),k=document.createElement("textarea"),c=i0(""),_=q("div","meta"),{context:g}=Z,R0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,V0=(U,C)=>{let D=document.createElement("div"),O=document.createElement("b");O.textContent=`${U}: `;let E=document.createTextNode(C);return D.append(O,E),_.append(D),{b:O,v:E}};V0(J.reporter,`${g.user.fullName??"—"} (${g.user.email??"—"})`),V0(J.page,g.route.href);let e=V0(J.captured,R0),s=document.createElement("label");s.className="shot-choice",s.hidden=!0;let l=document.createElement("input");l.type="checkbox",l.checked=!0,l.dataset.requestShot="",s.append(l,document.createTextNode(` ${J.requestWithShot}`));let W0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[q("p","status",J.noScreenshot)],Q0=Z.screenshotDataUrl?W0[0]:null;if(!Z.screenshotDataUrl)s.replaceChildren();let z0=q("p","status",""),J0=d(J.submit,"primary"),o=()=>{J0.disabled=L.value.trim().length===0||G==="request"&&!P};L.addEventListener("input",o);let K=()=>{let U=G==="request";if(B.textContent=U?J.requestTitle:J.title,Y.setAttribute("aria-label",U?J.requestTitle:J.title),R.textContent=`${U?J.problemInstead:J.askInstead} `,h.textContent=U?F?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,p.hidden=!U,c0(G0,U?J.requestSummaryLabel:J.summaryLabel,U?"":J.summaryRequired,!0),L.placeholder=U?J.requestSummaryPlaceholder:J.summaryPlaceholder,c0(c,U?J.requestDetailLabel:J.detailLabel),k.placeholder=U?J.requestDetailPlaceholder:J.detailPlaceholder,e.b.textContent=`${U?J.requestLeaves:J.captured}: `,e.v.textContent=U?J.requestLeavesWhat:R0,s.hidden=!U||!Z.screenshotDataUrl,Q0)c0(Q0,U?J.requestAnnotateHint:J.annotateHint);for(let C of W0)C.classList.toggle("dropped",U&&!l.checked),C.hidden=U&&!Z.screenshotDataUrl;J0.textContent=U?J.requestSubmit:J.submit,o()};l.addEventListener("change",K);let X=(U)=>{if(U===G)return;if(U==="problem"&&!F){this.switchToReport(J,$,{title:L.value,detail:k.value,asking:!1,typeId:P?.id??null});return}G=U,K()},W=(U)=>{if(this.bundle!==Z||$.type!=="manual"||!U.length)return;P=U[0],T.length=0;for(let D of U){let O=d("","type");O.setAttribute("role","radio"),O.dataset.requestType=D.id;let E=q("span","type-body");if(E.append(q("b","",D.name)),D.description)E.append(q("span","type-hint",D.description));if(D.targetHours){let F0=q("span","type-due");F0.append(l0(X8),document.createTextNode(J.requestTarget.replace("{time}",K8(J,D.targetHours)))),E.append(F0)}O.append(l0(T2),E),O.addEventListener("click",()=>{P=D,m(),o()}),T.push(O)}w.replaceChildren(...T),w.onkeydown=(D)=>{if(!f2.includes(D.key)||!P)return;D.preventDefault();let O=U.filter((Z0,i2)=>!T[i2].hidden);if(!O.length)return;let E=O.findIndex((Z0)=>Z0.id===P.id),F0=D.key==="ArrowUp"||D.key==="ArrowLeft"?-1:1;P=O[E<0?0:(E+F0+O.length)%O.length],m(),T.find((Z0)=>Z0.dataset.requestType===P.id)?.focus()},w.classList.toggle("long",U.length>=C1),I.hidden=U.length<C1;let C=(D)=>{i.hidden=U.length<C1||D===0,i.textContent=J.requestTypeCount.replace("{n}",String(D))};C(U.length),I.oninput=()=>{let D=I.value.trim().toLowerCase(),O=null;if(U.forEach((E,F0)=>{let Z0=!D||`${E.name} ${E.description}`.toLowerCase().includes(D);if(T[F0].hidden=!Z0,Z0&&!O)O=E}),u.hidden=!!O,C(T.filter((E)=>!E.hidden).length),O&&P&&T[U.indexOf(P)].hidden)P=O;m(),o()},I.onkeydown=(D)=>{if(D.key==="ArrowDown"||D.key==="Enter")D.preventDefault(),T.find((O)=>O.dataset.requestType===P?.id&&!O.hidden)?.focus()},m(),f.hidden=!1,K()},V=Q??(j0&&(j0.title||j0.detail)?j0:null),H=q("p","draft");if(H.hidden=!V||!!Q,V){L.value=V.title,k.value=V.detail;let U=d(J.draftClear,"link");U.dataset.draftClear="",U.addEventListener("click",()=>{L.value="",k.value="",j0=null,H.hidden=!0,o(),L.focus()}),H.append(document.createTextNode(`${J.draftRestored} · `),U)}let M=y0(),x=(U)=>{if(W(U),G!=="request"||f.hidden||!V?.typeId)return;let C=U.find((D)=>D.id===V.typeId);if(C)P=C,m()};if(M)x(M);else if($.type==="manual")X0().then(x);this.keep=()=>({title:L.value,detail:k.value,asking:G==="request",typeId:P?.id??null}),Y.append(A,f,H,p,G0,L,c,k,_,s,...W0);let b=q("div","foot"),r=d(J.close);r.addEventListener("click",()=>this.close()),b.append(r,z0,q("span","grow"),J0),Y.append(b),K(),J0.addEventListener("click",async()=>{J0.disabled=!0,z0.dataset.tone="",z0.textContent=J.submitting;let U=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(G==="request"&&P){let O=await w1({ticketTypeId:P.id,title:L.value.trim(),description:k.value,screenshotDataUrl:l.checked?U():null}),E=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:O,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),E)Y0(`${J.requestSubmitted} — #${O.number}`,"success");return}let C=await D1(L.value.trim(),{...Z,note:k.value,screenshotDataUrl:U()}),D=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:C,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),D)Y0(`${J.submitted} — #${C.number}`,"success")}catch(C){let D=$8(C,J);z0.dataset.tone="error",z0.textContent=D,Y0(D,"error"),o()}}),L.focus()}screenshotSection(J,$){let j=i0(J.annotateHint),Q=q("div","tools"),Z=document.createElement("canvas"),Y=q("div","shot");Y.append(Z);let G=[],F=(N)=>{for(let f of G)f.setAttribute("aria-pressed",String(f===N))};for(let{tool:N,key:f}of Q8){let R=d(J[f]);R.setAttribute("aria-pressed","false"),R.addEventListener("click",()=>{let h=R.getAttribute("aria-pressed")==="true";F(h?null:R),this.annotator?.setTool(h?null:N)}),G.push(R),Q.append(R)}Q.append(q("span","sep"));let P=d(J.deleteSelected);P.addEventListener("click",()=>this.annotator?.deleteSelected());let A=d(J.clearAll);A.addEventListener("click",()=>{this.annotator?.clear(),F(null)}),Q.append(P,A);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=N1(Z,B,()=>{F(null),P.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,q("p","status",J.annotateHelp),Y]}}}function x1(){try{return m2()}catch{return[]}}function q(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function K8(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var f2=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],C1=7,Y8=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],T2=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],X8=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],G8=[["path",{d:"M20 6 9 17l-5-5"}]],E2="http://www.w3.org/2000/svg";function h2(z,J,$,j){let Q=d("","kind");Q.dataset.kind=z;let Z=q("span","kind-top");return Z.append(l0(J),q("b","",$)),Q.append(Z,q("span","kind-hint",j),l0(G8,"tick")),Q}function l0(z,J="icon"){let $=document.createElementNS(E2,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(E2,j);for(let[Y,G]of Object.entries(Q))Z.setAttribute(Y,G);$.append(Z)}return $}function d(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function i0(z,J="",$=!1){return c0(document.createElement("label"),z,J,$)}function c0(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function O1(){if(typeof window>"u"||customElements.get(q0))return;customElements.define(q0,Z8())}var g2=!1;function V8(z={}){if(g2||typeof window>"u")return;if(!B0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(g2=!0,X2(),c1(),v1(),e1(),V2(),z.ui===!1)return;let J=K0(S().locale);if(Z1((j)=>{Y0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>Q1(j)})}),O1(),!document.querySelector(q0))document.body.append(document.createElement(q0));let $=window.requestIdleCallback;if($)$(()=>void X0(),{timeout:5000});else setTimeout(()=>void X0(),2000)}var W8=new Set(["error","exception","unhandledrejection"]);function b2(z){if(z.error)return!0;return z.status!==null&&z.status>=400}function _1(z){if(!z)return null;let J=Date.parse(z);return Number.isNaN(J)?null:J}function F8(z){try{let{pathname:J}=new URL(z,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return z.split(/[?#]/)[0]??z}}function H8(z,J,$){let j=(Y)=>({elapsedMs:Y,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(z.length===0)return[];let Q=z.map((Y)=>_1(Y.at)),Z=(Y)=>{for(let G=Y+1;G<Q.length;G+=1){let F=Q[G];if(F!=null)return F}return Number.POSITIVE_INFINITY};return z.map((Y,G)=>{let F=Q[G]??null,P=(G>0?Q[G-1]:null)??null,A=F!==null&&P!==null?Math.max(0,F-P):null;if(F===null)return j(A);let B=F,N=Math.max(B,Z(G)),f=(I)=>I!==null&&I>=B&&(I<N||N===Number.POSITIVE_INFINITY),R=J.filter((I)=>f(_1(I.startedAt))),h=$.filter((I)=>W8.has(I.level)&&f(_1(I.at))),p=R.map((I)=>I.durationMs).filter((I)=>typeof I==="number");return{elapsedMs:A,requests:R,failedRequests:R.filter(b2),consoleErrors:h,slowestMs:p.length>0?Math.max(...p):null}})}function P8(z,J){return z.requests.length===0&&z.consoleErrors.length===0&&(z.elapsedMs===null||z.elapsedMs<J)}function U8(z){if(z<1000)return`${Math.round(z)} มิลลิวินาที`;let J=z/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let $=Math.floor(J/60),j=Math.round(J%60);return j===0?`${$} นาที`:`${$} นาที ${j} วิ`}var M8="lw-portal-handoff",p2=138.23,D8=`
192
+ `;var w0="lw-debug-reporter",Z0=null;function k8(z,J){if(z instanceof z0){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var j4=()=>[];function T8(z){j4=z}var f8=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function E8(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;keep=null;returnFocus=null;constructor(){super();this.root=this.attachShadow({mode:"open"}),C0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=U1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=e(x().locale),Q=s0();if(Q===null)X0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=C("div","head"),Z=d("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(C("h2","",J.chooseTitle),Z);let Y=$4("problem",m8,J.kindProblem,J.chooseProblemHint);Y.dataset.choose="problem",Y.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let W=$4("request",z4,J.kindRequest,J.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=T0({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:h1()}),this.renderForm(J,$,"request")});let F=C("div","kinds choose");F.append(Y,W),F.addEventListener("keydown",(P)=>{if(!e2.includes(P.key))return;P.preventDefault(),(this.root.activeElement===Y?W:Y).focus()}),j.append(Q,F),Y.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await l0();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=T0({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:h1()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await l0();if(j.method==="cancelled"){this.close();return}this.bundle=T0({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:h1()}),this.renderForm($,J,"problem")}close(J=!1){if(J)Z0=null;else if(this.keep)Z0=this.keep()??Z0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=t2;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=C("div","head");Q.append(C("h2","",J.title)),j.append(Q,C("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let Y=this.shell(J),W=j,F=j==="problem"||!!Z.screenshotDataUrl,P=null,S=C("div","head"),I=C("h2","",J.title),q=d("✕","icon");q.setAttribute("aria-label",J.close),q.addEventListener("click",()=>this.close()),S.append(I,q);let R=C("p","door");R.hidden=!0;let w=C("span"),h=d("","link");h.dataset.switchKind="",h.addEventListener("click",()=>V(W==="problem"?"request":"problem")),R.append(w,h);let v=C("div","ask");v.hidden=!0;let N=document.createElement("input");N.type="search",N.className="type-search",N.placeholder=J.requestTypeSearch,N.setAttribute("aria-label",J.requestTypeSearch),N.dataset.requestTypeSearch="",N.hidden=!0;let B=C("div","types");B.setAttribute("role","radiogroup"),B.setAttribute("aria-label",J.requestTypeLabel);let u=C("p","status",J.requestTypeNone);u.hidden=!0;let c=C("p","status type-count","");c.hidden=!0,v.append(t0(J.requestTypeLabel,"",!0),N,B,u,c);let f=[],m=()=>{for(let _ of f){let M=_.dataset.requestType===P?.id;_.setAttribute("aria-checked",String(M)),_.tabIndex=M?0:-1}let U=f.find((_)=>_.dataset.requestType===P?.id);if(U&&B.scrollHeight>B.clientHeight){let _=U.offsetTop-B.offsetTop;if(_<B.scrollTop)B.scrollTop=_;else if(_+U.offsetHeight>B.scrollTop+B.clientHeight)B.scrollTop=_+U.offsetHeight-B.clientHeight}},T=document.createElement("input");T.type="text";let F0=t0(""),k=document.createElement("textarea"),l=t0(""),L=C("div","meta"),{context:b}=Z,g0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,H0=(U,_)=>{let M=document.createElement("div"),A=document.createElement("b");A.textContent=`${U}: `;let E=document.createTextNode(_);return M.append(A,E),L.append(M),{b:A,v:E}};H0(J.reporter,`${b.user.fullName??"—"} (${b.user.email??"—"})`),H0(J.page,b.route.href);let J0=H0(J.captured,g0),a=document.createElement("label");a.className="shot-choice",a.hidden=!0;let o=document.createElement("input");o.type="checkbox",o.checked=!0,o.dataset.requestShot="",a.append(o,document.createTextNode(` ${J.requestWithShot}`));let P0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[C("p","status",J.noScreenshot)],Y0=Z.screenshotDataUrl?P0[0]:null;if(!Z.screenshotDataUrl)a.replaceChildren();let $0=C("p","status",""),j0=d(J.submit,"primary"),r=()=>{j0.disabled=T.value.trim().length===0||W==="request"&&!P};T.addEventListener("input",r);let K=()=>{let U=W==="request";if(I.textContent=U?J.requestTitle:J.title,Y.setAttribute("aria-label",U?J.requestTitle:J.title),w.textContent=`${U?J.problemInstead:J.askInstead} `,h.textContent=U?F?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,v.hidden=!U,e0(F0,U?J.requestSummaryLabel:J.summaryLabel,U?"":J.summaryRequired,!0),T.placeholder=U?J.requestSummaryPlaceholder:J.summaryPlaceholder,e0(l,U?J.requestDetailLabel:J.detailLabel),k.placeholder=U?J.requestDetailPlaceholder:J.detailPlaceholder,J0.b.textContent=`${U?J.requestLeaves:J.captured}: `,J0.v.textContent=U?J.requestLeavesWhat:g0,a.hidden=!U||!Z.screenshotDataUrl,Y0)e0(Y0,U?J.requestAnnotateHint:J.annotateHint);for(let _ of P0)_.classList.toggle("dropped",U&&!o.checked),_.hidden=U&&!Z.screenshotDataUrl;j0.textContent=U?J.requestSubmit:J.submit,r()};o.addEventListener("change",K);let V=(U)=>{if(U===W)return;if(U==="problem"&&!F){this.switchToReport(J,$,{title:T.value,detail:k.value,asking:!1,typeId:P?.id??null});return}W=U,K()},G=(U)=>{if(this.bundle!==Z||$.type!=="manual"||!U.length)return;P=U[0],f.length=0;for(let M of U){let A=d("","type");A.setAttribute("role","radio"),A.dataset.requestType=M.id;let E=C("span","type-body");if(E.append(C("b","",M.name)),M.description)E.append(C("span","type-hint",M.description));if(M.targetHours){let U0=C("span","type-due");U0.append(z1(b8),document.createTextNode(J.requestTarget.replace("{time}",h8(J,M.targetHours)))),E.append(U0)}A.append(z1(z4),E),A.addEventListener("click",()=>{P=M,m(),r()}),f.push(A)}B.replaceChildren(...f),B.onkeydown=(M)=>{if(!e2.includes(M.key)||!P)return;M.preventDefault();let A=U.filter((W0,q4)=>!f[q4].hidden);if(!A.length)return;let E=A.findIndex((W0)=>W0.id===P.id),U0=M.key==="ArrowUp"||M.key==="ArrowLeft"?-1:1;P=A[E<0?0:(E+U0+A.length)%A.length],m(),f.find((W0)=>W0.dataset.requestType===P.id)?.focus()},B.classList.toggle("long",U.length>=m1),N.hidden=U.length<m1;let _=(M)=>{c.hidden=U.length<m1||M===0,c.textContent=J.requestTypeCount.replace("{n}",String(M))};_(U.length),N.oninput=()=>{let M=N.value.trim().toLowerCase(),A=null;if(U.forEach((E,U0)=>{let W0=!M||`${E.name} ${E.description}`.toLowerCase().includes(M);if(f[U0].hidden=!W0,W0&&!A)A=E}),u.hidden=!!A,_(f.filter((E)=>!E.hidden).length),A&&P&&f[U.indexOf(P)].hidden)P=A;m(),r()},N.onkeydown=(M)=>{if(M.key==="ArrowDown"||M.key==="Enter")M.preventDefault(),f.find((A)=>A.dataset.requestType===P?.id&&!A.hidden)?.focus()},m(),R.hidden=!1,K()},X=Q??(Z0&&(Z0.title||Z0.detail)?Z0:null),H=C("p","draft");if(H.hidden=!X||!!Q,X){T.value=X.title,k.value=X.detail;let U=d(J.draftClear,"link");U.dataset.draftClear="",U.addEventListener("click",()=>{T.value="",k.value="",Z0=null,H.hidden=!0,r(),T.focus()}),H.append(document.createTextNode(`${J.draftRestored} · `),U)}let D=s0(),O=(U)=>{if(G(U),W!=="request"||R.hidden||!X?.typeId)return;let _=U.find((M)=>M.id===X.typeId);if(_)P=_,m()};if(D)O(D);else if($.type==="manual")X0().then(O);this.keep=()=>({title:T.value,detail:k.value,asking:W==="request",typeId:P?.id??null}),Y.append(S,R,H,v,F0,T,l,k,L,a,...P0);let g=C("div","foot"),n=d(J.close);n.addEventListener("click",()=>this.close()),g.append(n,$0,C("span","grow"),j0),Y.append(g),K(),j0.addEventListener("click",async()=>{j0.disabled=!0,$0.dataset.tone="",$0.textContent=J.submitting;let U=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&P){let A=await k1({ticketTypeId:P.id,title:T.value.trim(),description:k.value,screenshotDataUrl:o.checked?U():null}),E=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:A,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),E)V0(`${J.requestSubmitted} — #${A.number}`,"success");return}let _=await A1(T.value.trim(),{...Z,note:k.value,screenshotDataUrl:U()}),M=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:_,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),M)V0(`${J.submitted} — #${_.number}`,"success")}catch(_){let M=k8(_,J);$0.dataset.tone="error",$0.textContent=M,V0(M,"error"),r()}}),T.focus()}screenshotSection(J,$){let j=t0(J.annotateHint),Q=C("div","tools"),Z=document.createElement("canvas"),Y=C("div","shot");Y.append(Z);let W=[],F=(q)=>{for(let R of W)R.setAttribute("aria-pressed",String(R===q))};for(let{tool:q,key:R}of f8){let w=d(J[R]);w.setAttribute("aria-pressed","false"),w.addEventListener("click",()=>{let h=w.getAttribute("aria-pressed")==="true";F(h?null:w),this.annotator?.setTool(h?null:q)}),W.push(w),Q.append(w)}Q.append(C("span","sep"));let P=d(J.deleteSelected);P.addEventListener("click",()=>this.annotator?.deleteSelected());let S=d(J.clearAll);S.addEventListener("click",()=>{this.annotator?.clear(),F(null)}),Q.append(P,S);let I=new Image;return I.onload=()=>{Z.width=I.naturalWidth,Z.height=I.naturalHeight,this.annotator=E1(Z,I,()=>{F(null),P.disabled=!this.annotator?.hasSelection()})},I.src=$,[j,Q,C("p","status",J.annotateHelp),Y]}}}function h1(){try{return j4()}catch{return[]}}function C(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function h8(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var e2=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],m1=7,m8=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],z4=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],b8=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],g8=[["path",{d:"M20 6 9 17l-5-5"}]],J4="http://www.w3.org/2000/svg";function $4(z,J,$,j){let Q=d("","kind");Q.dataset.kind=z;let Z=C("span","kind-top");return Z.append(z1(J),C("b","",$)),Q.append(Z,C("span","kind-hint",j),z1(g8,"tick")),Q}function z1(z,J="icon"){let $=document.createElementNS(J4,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(J4,j);for(let[Y,W]of Object.entries(Q))Z.setAttribute(Y,W);$.append(Z)}return $}function d(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function t0(z,J="",$=!1){return e0(document.createElement("label"),z,J,$)}function e0(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function b1(){if(typeof window>"u"||customElements.get(w0))return;customElements.define(w0,E8())}var v8="lw-portal-handoff",Q4=138.23,y8=`
193
193
  :host { all: initial; }
194
194
  .backdrop {
195
195
  position: fixed; inset: 0; z-index: 2147483002;
@@ -219,10 +219,10 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
219
219
  .ring .track { stroke: #e2e8f0; }
220
220
  .ring .bar {
221
221
  stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
222
- stroke-dasharray: ${p2}; stroke-dashoffset: 0;
222
+ stroke-dasharray: ${Q4}; stroke-dashoffset: 0;
223
223
  animation: deplete var(--secs, 3s) linear forwards;
224
224
  }
225
- @keyframes deplete { to { stroke-dashoffset: ${p2}; } }
225
+ @keyframes deplete { to { stroke-dashoffset: ${Q4}; } }
226
226
  .count {
227
227
  position: absolute; inset: 0; display: grid; place-items: center;
228
228
  font-size: 18px; font-weight: 600; color: #0f172a;
@@ -266,7 +266,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
266
266
  .ring .bar { animation: none; stroke-dashoffset: 0; }
267
267
  .spinner { animation-duration: 2s; }
268
268
  }
269
- `;function v2(z){if(typeof document>"u")return z.prepare().then((I)=>void z.go(I),()=>{return});let J=K0(S().locale),$=Math.max(1,Math.floor(z.seconds??3)),j=document.createElement(M8),Q=j.attachShadow({mode:"open"});d0(Q);let Z=document.createElement("style");Z.textContent=D8,Q.append(Z);let Y=document.createElement("div");Y.className="backdrop",Y.innerHTML=`
269
+ `;function Z4(z){if(typeof document>"u")return z.prepare().then((N)=>void z.go(N),()=>{return});let J=e(x().locale),$=Math.max(1,Math.floor(z.seconds??3)),j=document.createElement(v8),Q=j.attachShadow({mode:"open"});C0(Q);let Z=document.createElement("style");Z.textContent=y8,Q.append(Z);let Y=document.createElement("div");Y.className="backdrop",Y.innerHTML=`
270
270
  <div class="card" role="dialog" aria-modal="true" aria-labelledby="lw-ho-title">
271
271
  <div class="dial">
272
272
  <svg class="ring" viewBox="0 0 52 52" aria-hidden="true">
@@ -282,4 +282,43 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
282
282
  <button type="button" class="cancel"></button>
283
283
  <button type="button" class="go"></button>
284
284
  </div>
285
- </div>`,Q.append(Y);let G=(I)=>Y.querySelector(I),F=G(".card"),P=G(".bar"),A=G(".count"),B=G("h2"),N=G(".body"),f=G(".host"),R=G(".go"),h=G(".cancel");B.textContent=J.handoffTitle,N.textContent=J.handoffBody;try{f.textContent=new URL(S().host).host}catch{f.textContent=""}R.textContent=J.handoffGo,h.textContent=J.cancel,F.style.setProperty("--secs",`${$}s`),A.textContent=String($),document.body.append(j),requestAnimationFrame(()=>Y.setAttribute("data-open","1"));let p=document.activeElement;return R.focus({preventScroll:!0}),new Promise((I)=>{let w=!1,u=null,i=!1,T=Date.now()+$*1000,m=window.setInterval(()=>{let _=Math.ceil((T-Date.now())/1000);if(A.textContent=String(Math.max(0,_)),Date.now()>=T)k()},100);function L(_){if(w)return;if(w=!0,window.clearInterval(m),document.removeEventListener("keydown",c,!0),Y.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!_)p?.focus?.({preventScroll:!0});I()}function G0(_){window.clearInterval(m),P.classList.remove("spinner"),P.style.animation="none",A.textContent="",B.textContent=J.handoffBlocked,N.textContent=J.handoffBody;let g=document.createElement("a");g.className="go",g.href=_,g.target="_blank",g.rel="noopener noreferrer",g.textContent=J.handoffOpen,g.addEventListener("click",()=>L(!0)),R.replaceWith(g),g.focus({preventScroll:!0})}function k(){if(w||i)return;if(u)return z.go(u)?L(!0):G0(u);window.clearInterval(m),A.textContent="",P.classList.add("spinner"),B.textContent=J.handoffPreparing}function c(_){if(_.key==="Escape")_.stopPropagation(),L(!1)}document.addEventListener("keydown",c,!0),R.addEventListener("click",k),h.addEventListener("click",()=>L(!1)),Y.addEventListener("click",(_)=>{if(_.target===Y)L(!1)}),z.prepare().then((_)=>{if(u=_,!w&&Date.now()>=T)k()},()=>{i=!0,window.clearInterval(m),F.classList.add("error"),P.classList.remove("spinner"),P.style.animation="none",A.textContent="",B.textContent=J.handoffFailed,N.textContent=J.handoffBody,R.remove(),h.textContent=J.close})})}var I8="/sso";function d2(z,J,$,j){let Q=new URL(I8,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class o0 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function y2(z){let J=S();if(!J.identity)throw new o0;let $=await J.identity();if(!$)throw new o0;return d2(J.host,J.realmKey,$,z)}function u2(z,J){if(J==="_self")return window.location.assign(z),!0;let $=window.open(z,"_blank");if(!$)return!1;try{$.opener=null}catch{}return!0}async function w8(z={}){if(z.announce===!1){u2(await y2(z.returnTo),z.target);return}await v2({seconds:z.seconds,prepare:()=>y2(z.returnTo),go:(J)=>u2(J,z.target)})}export{H1 as trimToBudget,U2 as toCurl,X1 as takeReplay,d2 as supportPortalUrl,w1 as submitRequest,D1 as submitBundle,Z6 as stopReplay,Y0 as showToast,j8 as setErroredQueriesSource,y0 as requestTypesNow,F8 as requestPath,K0 as reporterStrings,a as redactUrl,P0 as redactLabel,U0 as redactHeaders,M0 as redactBody,U1 as packReplay,w8 as openSupportPortal,j1 as onLaunch,Z1 as onCrash,t2 as moduleResolver,X0 as loadRequestTypes,Q1 as launch,Q6 as isReplayRecording,P8 as isQuietStep,b2 as isFailedRequest,B0 as isConfigured,V8 as installDebugCapture,C6 as hasCause,Y1 as getNetworkLog,$1 as getConsoleLog,S as getConfig,z1 as getActionTrail,U8 as formatDuration,W1 as errorSignature,K1 as emitCrash,O1 as defineReporterElement,N1 as createAnnotator,H8 as correlateActionTrail,o2 as configureDebugCapture,g0 as captureScreen,B6 as bundleToMarkdown,x6 as bundleFileName,O0 as buildBundle,n as appInfo,t0 as actionCountSuffix,q0 as REPORTER_TAG,w2 as REPLAY_FILENAME,H0 as REDACTED,o0 as NoIdentityError,F1 as BUNDLE_BUDGET_BYTES};
285
+ </div>`,Q.append(Y);let W=(N)=>Y.querySelector(N),F=W(".card"),P=W(".bar"),S=W(".count"),I=W("h2"),q=W(".body"),R=W(".host"),w=W(".go"),h=W(".cancel");I.textContent=J.handoffTitle,q.textContent=J.handoffBody;try{R.textContent=new URL(x().host).host}catch{R.textContent=""}w.textContent=J.handoffGo,h.textContent=J.cancel,F.style.setProperty("--secs",`${$}s`),S.textContent=String($),document.body.append(j),requestAnimationFrame(()=>Y.setAttribute("data-open","1"));let v=document.activeElement;return w.focus({preventScroll:!0}),new Promise((N)=>{let B=!1,u=null,c=!1,f=Date.now()+$*1000,m=window.setInterval(()=>{let L=Math.ceil((f-Date.now())/1000);if(S.textContent=String(Math.max(0,L)),Date.now()>=f)k()},100);function T(L){if(B)return;if(B=!0,window.clearInterval(m),document.removeEventListener("keydown",l,!0),Y.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!L)v?.focus?.({preventScroll:!0});N()}function F0(L){window.clearInterval(m),P.classList.remove("spinner"),P.style.animation="none",S.textContent="",I.textContent=J.handoffBlocked,q.textContent=J.handoffBody;let b=document.createElement("a");b.className="go",b.href=L,b.target="_blank",b.rel="noopener noreferrer",b.textContent=J.handoffOpen,b.addEventListener("click",()=>T(!0)),w.replaceWith(b),b.focus({preventScroll:!0})}function k(){if(B||c)return;if(u)return z.go(u)?T(!0):F0(u);window.clearInterval(m),S.textContent="",P.classList.add("spinner"),I.textContent=J.handoffPreparing}function l(L){if(L.key==="Escape")L.stopPropagation(),T(!1)}document.addEventListener("keydown",l,!0),w.addEventListener("click",k),h.addEventListener("click",()=>T(!1)),Y.addEventListener("click",(L)=>{if(L.target===Y)T(!1)}),z.prepare().then((L)=>{if(u=L,!B&&Date.now()>=f)k()},()=>{c=!0,window.clearInterval(m),F.classList.add("error"),P.classList.remove("spinner"),P.style.animation="none",S.textContent="",I.textContent=J.handoffFailed,q.textContent=J.handoffBody,w.remove(),h.textContent=J.close})})}var p8="/sso";function Y4(z,J,$,j){let Q=new URL(p8,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class J1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function g1(z){let J=x();if(!J.identity)throw new J1;let $=await J.identity();if(!$)throw new J1;return Y4(J.host,J.realmKey,$,z)}var W4=g1;function K4(z,J){if(J==="_self")return window.location.assign(z),!0;let $=window.open(z,"_blank");if(!$)return!1;try{$.opener=null}catch{}return!0}async function u8(z={}){if(z.announce===!1){K4(await g1(z.returnTo),z.target);return}await Z4({seconds:z.seconds,prepare:()=>g1(z.returnTo),go:(J)=>K4(J,z.target)})}var d8="lw-call-ring",i8=`
286
+ :host { all: initial; }
287
+ .card {
288
+ position: fixed; right: 16px; bottom: 16px; z-index: 2147483002;
289
+ width: min(340px, calc(100vw - 32px)); box-sizing: border-box;
290
+ padding: 16px; border-radius: 16px; background: #fff; color: #0f172a;
291
+ border: 1px solid #e2e8f0; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
292
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
293
+ animation: in 200ms cubic-bezier(0.16, 1, 0.3, 1);
294
+ }
295
+ @media (max-width: 480px) { .card { right: 8px; left: 8px; bottom: 8px; width: auto; } }
296
+ .head { display: flex; align-items: center; gap: 12px; }
297
+ .icon {
298
+ position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%;
299
+ display: grid; place-items: center; background: #ecfdf5; color: #059669;
300
+ }
301
+ .icon::after {
302
+ content: ""; position: absolute; inset: 0; border-radius: 50%;
303
+ background: rgba(16, 185, 129, 0.25); animation: ping 1.4s ease-out infinite;
304
+ }
305
+ .icon svg { position: relative; width: 20px; height: 20px; }
306
+ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
307
+ .about { margin: 2px 0 0; font-size: 12px; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }
308
+ .how { margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: #64748b; }
309
+ .how a { color: #0369a1; font-weight: 600; }
310
+ .actions { display: flex; gap: 8px; margin-top: 12px; }
311
+ .actions button {
312
+ flex: 1; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
313
+ height: 40px; padding: 0 12px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
314
+ }
315
+ .decline { border: 1px solid #fecdd3; background: #fff1f2; color: #be123c; }
316
+ .decline:hover { background: #ffe4e6; }
317
+ .open { border: none; background: #059669; color: #fff; }
318
+ .open:hover { background: #047857; }
319
+ .close { border: 1px solid #e2e8f0; background: #fff; color: #334155; }
320
+ .actions button:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }
321
+ @keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
322
+ @keyframes ping { from { transform: scale(1); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
323
+ @media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } }
324
+ `,c8='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z"/></svg>',i=null,O0=null,_0=null;function l8(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var y1=()=>e(x().locale);function o8(){if(typeof document>"u")return null;if(i?.isConnected)return i.shadowRoot;i=document.createElement(d8),i.dataset.debugReporter="true";let z=i.attachShadow({mode:"open"});return C0(z),document.body.append(i),z}function V4(z,J){if(O0===z.id&&i?.isConnected)return;let $=o8();if(!$)return;O0=z.id;let j=y1();$.innerHTML="";let Q=document.createElement("style");Q.textContent=i8;let Z=document.createElement("div");Z.className="card",Z.setAttribute("role","alertdialog"),Z.setAttribute("aria-label",j.ringTitle),Z.dataset.lwCallRing=z.id;let Y=document.createElement("div");Y.className="head";let W=document.createElement("span");W.className="icon",W.innerHTML=c8;let F=document.createElement("div"),P=document.createElement("h2");P.textContent=j.ringTitle;let S=document.createElement("p");S.className="about",S.textContent=l8(j.ringAbout,z),S.title=S.textContent,F.append(P,S),Y.append(W,F);let I=document.createElement("p");I.className="how",I.textContent=j.ringHow;let q=document.createElement("div");q.className="actions";let R=document.createElement("button");R.type="button",R.className="decline",R.textContent=j.ringDecline,R.dataset.lwRing="decline",R.onclick=()=>J.decline();let w=document.createElement("button");if(w.type="button",w.className="open",w.textContent=j.ringOpen,w.dataset.lwRing="open",w.onclick=()=>J.open(),q.append(R,w),Z.append(Y,I,q),$.append(Q,Z),r8(),_0===null)_0=document.title,document.title=`${j.ringTab} — ${_0}`;w.focus({preventScroll:!0})}function $1(z){let J=i?.shadowRoot;if(!J)return;p1(),G4();let $=y1(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>$1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>S0(),Q.append(Z)}}function S0(z){if(z&&O0&&z!==O0)return;p1(),G4(),i?.remove(),i=null,O0=null}function X4(){return i?.isConnected?O0:null}function G4(){if(_0===null||typeof document>"u")return;if(document.title.startsWith(y1().ringTab))document.title=_0;_0=null}var K0=null,v1;function r8(){p1();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=K0??new J;K0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!K0||K0.state!=="running")return;let j=K0.currentTime;for(let[Q,Z]of[660,880].entries()){let Y=K0.createOscillator(),W=K0.createGain();Y.frequency.value=Z,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),Y.connect(W).connect(K0.destination),Y.start(j+Q*0.22),Y.stop(j+Q*0.22+0.21)}};$(),v1=setInterval($,2200)}function p1(){clearInterval(v1),v1=void 0}var j1=[2000,5000,15000,30000,60000],n8=20000,u1=!1,G0=!1,F4=0,s8=5,b0=null,P4=0,Q1,d1,i1,U4=(z)=>z.endsWith("/")?z:`${z}/`;function a8(z,J){let $=new URL("api/presence/ws",U4(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function t8(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function e8(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function c1(){let z=x().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function l1(z,J){let $=x();return fetch(new URL(z,U4($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function Z1(){if(u1||typeof window>"u"||typeof WebSocket>"u")return;let z=x();if(!z.identity||z.ring===!1)return;u1=!0,G0=!1,D4()}function z3(){G0=!0,u1=!1,clearTimeout(d1),clearInterval(Q1),clearTimeout(i1);try{b0?.close(1000,"bye")}catch{}b0=null,S0()}function m0(z=!1){if(G0)return;let J=z?j1[j1.length-1]:j1[Math.min(P4++,j1.length-1)];clearTimeout(d1),d1=setTimeout(()=>void D4(),J)}async function D4(){if(G0)return;let z=await c1();if(!z){if(++F4>=s8){G0=!0;return}return m0(!0)}F4=0;let J;try{J=await l1("ingest/live-ticket",z)}catch{return m0()}if(J.status===401||J.status===404||J.status===403){G0=!0;return}if(!J.ok)return m0(J.status===429);let $;try{$=await J.json()}catch{return m0()}if(!$.calls||!$.ticket){G0=!0;return}if($.call)H4($.call);let j=new WebSocket(a8(x().host,$.ticket));b0=j,j.onopen=()=>{P4=0,clearInterval(Q1),Q1=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},n8)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)H4(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(Q1),b0===j)b0=null;m0()}}function H4(z){if(!e8(z))return S0(z.id);V4(z,{open:()=>J3(z),decline:()=>void $3(z)}),clearTimeout(i1);let J=new Date(z.ringUntil).getTime()-Date.now();i1=setTimeout(()=>{if(X4()===z.id)S0(z.id)},Math.max(5000,J+5000))}function J3(z){let J=window.open("about:blank","_blank");(async()=>{let $=await c1();if($)l1(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await W4(t8(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}$1()}else $1(j)})()}async function $3(z){S0(z.id);let J=await c1();if(J)await l1(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var M4=!1;function j3(z={}){if(M4||typeof window>"u")return;if(!R0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(M4=!0,A2(),F2(),Y2(),N2(),k2(),z.ui===!1)return;let J=e(x().locale);if(M1((j)=>{V0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>D1(j)})}),b1(),!document.querySelector(w0))document.body.append(document.createElement(w0));let $=window.requestIdleCallback;if($)$(()=>void X0(),{timeout:5000});else setTimeout(()=>void X0(),2000);if($)$(()=>Z1(),{timeout:8000});else setTimeout(()=>Z1(),3000)}var Q3=new Set(["error","exception","unhandledrejection"]);function I4(z){if(z.error)return!0;return z.status!==null&&z.status>=400}function o1(z){if(!z)return null;let J=Date.parse(z);return Number.isNaN(J)?null:J}function Z3(z){try{let{pathname:J}=new URL(z,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return z.split(/[?#]/)[0]??z}}function K3(z,J,$){let j=(Y)=>({elapsedMs:Y,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(z.length===0)return[];let Q=z.map((Y)=>o1(Y.at)),Z=(Y)=>{for(let W=Y+1;W<Q.length;W+=1){let F=Q[W];if(F!=null)return F}return Number.POSITIVE_INFINITY};return z.map((Y,W)=>{let F=Q[W]??null,P=(W>0?Q[W-1]:null)??null,S=F!==null&&P!==null?Math.max(0,F-P):null;if(F===null)return j(S);let I=F,q=Math.max(I,Z(W)),R=(N)=>N!==null&&N>=I&&(N<q||q===Number.POSITIVE_INFINITY),w=J.filter((N)=>R(o1(N.startedAt))),h=$.filter((N)=>Q3.has(N.level)&&R(o1(N.at))),v=w.map((N)=>N.durationMs).filter((N)=>typeof N==="number");return{elapsedMs:S,requests:w,failedRequests:w.filter(I4),consoleErrors:h,slowestMs:v.length>0?Math.max(...v):null}})}function Y3(z,J){return z.requests.length===0&&z.consoleErrors.length===0&&(z.elapsedMs===null||z.elapsedMs<J)}function W3(z){if(z<1000)return`${Math.round(z)} มิลลิวินาที`;let J=z/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let $=Math.floor(J/60),j=Math.round(J%60);return j===0?`${$} นาที`:`${$} นาที ${j} วิ`}export{O1 as trimToBudget,m2 as toCurl,N1 as takeReplay,Y4 as supportPortalUrl,k1 as submitRequest,A1 as submitBundle,E6 as stopReplay,z3 as stopLiveRing,Z1 as startLiveRing,V0 as showToast,T8 as setErroredQueriesSource,s0 as requestTypesNow,Z3 as requestPath,e as reporterStrings,t as redactUrl,M0 as redactLabel,I0 as redactHeaders,q0 as redactBody,S1 as packReplay,u8 as openSupportPortal,U1 as onLaunch,M1 as onCrash,S4 as moduleResolver,X0 as loadRequestTypes,D1 as launch,f6 as isReplayRecording,Y3 as isQuietStep,I4 as isFailedRequest,R0 as isConfigured,j3 as installDebugCapture,e6 as hasCause,q1 as getNetworkLog,P1 as getConsoleLog,x as getConfig,F1 as getActionTrail,W3 as formatDuration,C1 as errorSignature,I1 as emitCrash,b1 as defineReporterElement,E1 as createAnnotator,K3 as correlateActionTrail,x4 as configureDebugCapture,l0 as captureScreen,s6 as bundleToMarkdown,t6 as bundleFileName,T0 as buildBundle,s as appInfo,X1 as actionCountSuffix,w0 as REPORTER_TAG,y2 as REPLAY_FILENAME,D0 as REDACTED,J1 as NoIdentityError,w1 as BUNDLE_BUDGET_BYTES};
package/dist/live.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ export interface RingingCall {
2
+ id: string;
3
+ ticketId: string;
4
+ ticketKey: string;
5
+ ticketTitle: string;
6
+ status: string;
7
+ ringUntil: string;
8
+ side?: string | null;
9
+ }
10
+ /** `wss://support.example/api/presence/ws?t=…` — the support host's scheme, the socket's own path. Pure, for the tests. */
11
+ export declare function liveSocketUrl(host: string, ticket: string): string;
12
+ /** Where the card sends them: their request, with the call — the support host rings it there. Pure, for the tests. */
13
+ export declare function answerPath(call: Pick<RingingCall, "id" | "ticketId">): string;
14
+ /** Is this a call ringing for the person at this widget? */
15
+ export declare function ringsHere(call: Pick<RingingCall, "status" | "side">): boolean;
16
+ /** Start listening for calls. Idempotent; a no-op without identity, or with `ring: false`. */
17
+ export declare function startLiveRing(): void;
18
+ /** Let go — the socket, the card, the timers. For a host that unmounts, and for the tests. */
19
+ export declare function stopLiveRing(): void;
package/dist/portal.d.ts CHANGED
@@ -30,6 +30,10 @@ export interface OpenPortalOptions {
30
30
  */
31
31
  returnTo?: string;
32
32
  }
33
+ /** Build the destination. Separated so it can run UNDER the countdown. */
34
+ declare function prepareUrl(returnTo?: string): Promise<string>;
35
+ /** The signed-in link to a path on the support host — for a caller that opened its own tab first (the call ring, ui/ring). */
36
+ export declare const preparePortalUrl: typeof prepareUrl;
33
37
  /**
34
38
  * Open the portal, signed in as the current user.
35
39
  *
@@ -56,3 +60,4 @@ export interface OpenPortalOptions {
56
60
  * put the message and the other does not.
57
61
  */
58
62
  export declare function openSupportPortal(options?: OpenPortalOptions): Promise<void>;
63
+ export {};
@@ -0,0 +1,19 @@
1
+ export interface RingCall {
2
+ id: string;
3
+ ticketKey: string;
4
+ ticketTitle: string;
5
+ }
6
+ export interface RingHandlers {
7
+ /** Runs INSIDE the press: a tab can be opened only there, before anything is awaited. */
8
+ open: () => void;
9
+ decline: () => void;
10
+ }
11
+ /** "เรื่อง CALL-12 · title" — the line under the card's title. Pure, for the tests. */
12
+ export declare function ringAbout(template: string, call: RingCall): string;
13
+ /** Show the ring for this call — once; the same call again changes nothing. */
14
+ export declare function showRing(call: RingCall, handlers: RingHandlers): void;
15
+ /** Opened: the card says where to answer, and stops ringing. `blockedUrl` — the browser refused the tab: a link, which is a fresh press. */
16
+ export declare function ringOpened(blockedUrl?: string): void;
17
+ /** The call is no longer ringing for this person — answered, declined, missed or ended. */
18
+ export declare function hideRing(id?: string): void;
19
+ export declare function ringShownFor(): string | null;
@@ -103,5 +103,15 @@ export interface Strings {
103
103
  /** Carry `{n}`. */
104
104
  days: string;
105
105
  hours: string;
106
+ /** A call from the support team (ui/ring). `ringAbout` carries `{key}` and `{title}`. */
107
+ ringTitle: string;
108
+ ringAbout: string;
109
+ ringHow: string;
110
+ ringOpen: string;
111
+ ringDecline: string;
112
+ ringOpened: string;
113
+ ringBlocked: string;
114
+ ringClose: string;
115
+ ringTab: string;
106
116
  }
107
117
  export declare function strings(locale: "th" | "en" | undefined): Strings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightworkai.official/debug-capture",
3
- "version": "0.14.3",
3
+ "version": "0.15.0",
4
4
  "description": "Report-a-problem widget: rolling network/console/action capture, optional rrweb session replay, annotated screenshot, and submission to a Lightwork Support host",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",