@lightworkai.official/debug-capture 0.17.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/debug-capture.js +44 -32
- package/dist/index.mjs +50 -38
- package/dist/ui/callFrame.d.ts +10 -3
- package/dist/ui/ring.d.ts +12 -2
- package/dist/ui/strings.d.ts +7 -0
- package/package.json +1 -1
- package/src/live.ts +65 -23
- package/src/ui/callFrame.ts +85 -7
- package/src/ui/ring.ts +128 -49
- package/src/ui/strings.ts +17 -0
package/dist/debug-capture.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var Q6=((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 Z6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},y=null;function Q2(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 N(){if(!y)throw Error("[debug-capture] configureDebugCapture() has not been called");return y}function r0(){return y!==null}function n(){let z=N().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??V6()}}function V6(){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=y?.capture?.[z];return typeof J==="number"?J:Z6[z]}function n0(z){let J=y?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function s0(){let z=y?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function Z2(){return y?.capture?.overlaySelectors??[]}var X6='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',W6="[data-lw-mask]",j2={fps:1,quality:0.5};function k0(){let z=y?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,X)=>typeof Z==="number"&&Z>0?Z:X,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,j2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,j2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?X6:W6),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function V2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(Y6(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 Y6(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 X2(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 A0="‹redacted›",K6=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,G6=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),H6=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,U6=/[\w.+-]+@[\w-]+\.[\w.-]+/g,F6=/\d(?:[\d\s-]{7,})\d/g;function T0(z){return z.replace(U6,A0).replace(F6,A0)}function P6(z){if(K6.test(z))return!0;return s0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function f0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=P6($)?A0:j;return J}function j0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(G6.has(Z.toLowerCase())||s0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,A0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function M1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>M1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=H6.test(j)||s0().bodyKeys.some((X)=>j.toLowerCase().includes(X));$[j]=Z?A0:M1(Q,J+1)}return $}function w0(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(M1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var N1=120,I1=40,N0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,C1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},M0=[],W2=0,Y2=!1;function x0(z,J,$,j){let Q=N0(J,N1),Z=M0[M0.length-1];if(z==="navigate"&&Z?.kind==="click"){let Y=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${Y}`))return Z.at=new Date().toISOString(),Z;let H=Y.split(/[?#]/)[0]??Y,F=Z.source?C1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(F&&(H===F||H.startsWith(F)))return Z.detail=N0(`${Z.detail} → ${Y}`,N1),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}W2+=1;let X={id:`act_${W2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:t0(j)};M0.push(X);while(M0.length>$0("maxActions"))D6(M0.shift());return X}var q6=200000,E0=0;function t0(z){if(!z)return;if(E0+z.length>q6)return;return E0+=z.length,z}function D6(z){if(!z)return;if(E0-=(z.html?.length??0)+(z.afterHtml?.length??0),E0<0)E0=0}function a0(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var B6='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',M6={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},K2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function N6(z){let J=z.getAttribute("role");if(J&&K2[J])return K2[J];return M6[z.tagName.toLowerCase()]??"ปุ่ม"}function I6(z,J){try{let $=z,j=0;while($&&j<=J){let Q=q2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function C6(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 C1(Q)}return""}function O6(z){if(!(z instanceof Element))return null;let J=z.closest(B6)??I6(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function _6(z){let J=T0(C6(z));if(!J)return null;return`${N6(z)} “${N0(J,I1)}”`}var P2=6000,S6=4000,L6=/(?:^|\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 R6(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 X of Array.from(Q.attributes)){let Y=X.name.toLowerCase();if(Y.startsWith("on")||Y==="srcdoc"||Y==="value"||Y.startsWith("data-"))Q.removeAttribute(X.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let X=Z.replace(L6," ").replace(/\s+/g," ").trim();if(X)Q.setAttribute("class",X);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=T0(j.nodeValue);j=$.nextNode()}}function O1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);R6(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var k6=(z)=>O1(z,P2,S6),A6=150000,T6=40000,G2=(z)=>O1(z,A6,T6);function f6(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`ช่อง “${T0(J)}”`}var H2=80;function q2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function w6(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 U2(z){if(!z)return;return`→ ${z.length>H2?`${z.slice(0,H2)}…`:z}`}function x6(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return U2(J);let $=q2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return U2(w6($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var E6='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function b6(){let z=Z2();return z.length?z.join(", "):E6}function g6(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 h6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((X)=>document.getElementById(X)?.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 D2(z){let J=T0(h6(z)),$=g6(z);return J?`เปิด ${$} “${N0(J,I1)}”`:`เปิด ${$}`}var y6='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',m6=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function v6(z){if(z.querySelector(y6))return!0;return m6.test(z.textContent??"")}var u6=400,p6=250,d6=8000;function i6(z,J){if(typeof MutationObserver>"u"){J.html=t0(G2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,X.disconnect(),window.clearInterval(Y),window.clearTimeout(H)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=N0(D2(z),N1),J.html=t0(G2(z))},X=new MutationObserver(()=>{$=Date.now()});X.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let Y=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=u6&&!v6(z))Z()},p6),H=window.setTimeout(Z,d6)}function c6(z){if(a0(z))return;let J=x0("ui",D2(z));if(J)i6(z,J)}function l6(){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=b6(),X=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let Y of X){if(z.has(Y))continue;z.add(Y),c6(Y)}}}).observe(document.body,{childList:!0,subtree:!0})}var o6=1600,r6=2500;function F2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:N0((z.textContent??"").replace(/\s+/g," ").trim(),I1)}}function n6(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 s6(z,J){if(typeof MutationObserver>"u")return;let $=F2(z),j=!1,Q=(Y,H)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(X),J.afterNote=Y,H)J.afterHtml=t0(O1(z,P2,r6))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let Y=n6($,F2(z));if(Y)Q(Y,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let X=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},o6)}function B2(){if(Y2||typeof window>"u")return;Y2=!0,document.addEventListener("click",(j)=>{if(a0(j.target))return;let Q=O6(j.target);if(!Q)return;let Z=_6(Q);if(!Z)return;let X=x0("click",`คลิก ${Z}`,x6(Q),k6(Q));if(X)s6(Q,X)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(a0(j.target))return;let Q=f6(j.target);if(Q)x0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(a0(j.target))return;x0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>x0("navigate",`ไปที่ ${C1(j0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),l6()}function M2(){return M0.map((z)=>({...z}))}var N2=2000,e0=[],I2=0,C2=!1;function _1(z,J){I2+=1,e0.push({id:`log_${I2}`,at:new Date().toISOString(),level:z,message:J.length>N2?`${J.slice(0,N2)}…`:J});while(e0.length>$0("maxConsoleEntries"))e0.shift()}function a6(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function O2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,a6());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function _2(){if(C2||typeof window>"u")return;C2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{_1(J,j.map(O2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";_1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:O2(J.reason);_1("unhandledrejection",$)})}function S2(){return e0.map((z)=>({...z}))}var L2=new Set,R2=new Set;function k2(z,J){return z.add(J),()=>z.delete(J)}function A2(z,J){for(let $ of[...z])$(J)}function T2(z){return k2(L2,z)}function z1(z={type:"manual"}){A2(L2,z)}function f2(z){return k2(R2,z)}function w2(z){A2(R2,z)}var t6=15000,e6=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],x2=!1,E2=0;function z8(z){return e6.some((J)=>z.includes(J))}function b2(z){let J=z.message??"";if(!J||z8(J))return;let $=Date.now();if($-E2<t6)return;E2=$,w2({...z,message:J})}function g2(){if(x2||typeof window>"u")return;x2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;b2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;b2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var v2=4000,J8=1e6,$8=1e7,J1=[],h2=0,y2=!1;function u2(z){J1.push(z);while(J1.length>$0("maxRequests"))J1.shift()}function p2(){return h2+=1,`req_${h2}`}function m2(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 j8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function Q8(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 Z8(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=m2(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...m2(J.headers)};if(J.body!==void 0)Z=Q8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function d2(z){return!V2(z)}function V8(z,J){if(d2(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>J8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=w0(Z,$0("maxBodyChars"))}).catch(()=>{})}catch{}}function i2(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 X8(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=Z8(J,$);if(i2(j.url,j.headers))return z(J,$);let Q={id:p2(),startedAt:new Date().toISOString(),method:j.method,url:j0(j.url),requestHeaders:f0(j.headers),requestBody:w0(j.body,v2),status:null,statusText:null,durationMs:null,via:"fetch"};u2(Q);let Z=performance.now();try{let X=await z(J,$);return Q.status=X.status,Q.statusText=X.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=f0(j8(X.headers)),V8(X,Q),X}catch(X){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=X instanceof Error?`${X.name}: ${X.message}`:String(X),X}},z)}function W8(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,X){let Y=typeof X==="string"?X:X.toString();return this.__lwEntry=i2(Y,{})?void 0:{id:p2(),startedAt:"",method:(Z||"GET").toUpperCase(),url:j0(Y),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let X=this.__lwEntry;if(X){X.startedAt=new Date().toISOString(),X.requestBody=typeof Z==="string"?w0(Z,v2):Z==null?null:"[non-string body]";let Y=performance.now();u2(X),this.addEventListener("loadend",()=>{if(X.status=this.status||null,X.statusText=this.statusText||null,X.durationMs=Math.round(performance.now()-Y),d2(X.url))X.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{X.responseSnippet=w0(this.responseText||"",$0("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;X.responseSnippet=`[binary ${H}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function c2(){if(y2)return;y2=!0,X8(),W8()}function l2(){let z=J1.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>$8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var Y8=4,o2=3,K8=4000,G8="[data-debug-reporter]",r2=()=>import("@rrweb/record");function n2(z){r2=z}var v=[],S1=null,$1=!1;function s2(){if(typeof window>"u"||S1||$1)return;let z=k0();if(!z)return;$1=!0;let J=()=>void H8(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function H8(z){let J;try{J=(await r2()).record}catch($){$1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(S1)return;try{S1=J({emit:($)=>U8($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:K8,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${G8}`,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{$1=!1}}function U8(z){if(z.type===Y8||v.length===0){if(v.push([]),v.length>o2)v=v.slice(-o2)}v[v.length-1].push(z)}function a2(z=Date.now()){let J=k0();if(!J||!v.length)return null;let $=z-J.seconds*1000,j=v.length-1;while(j>0&&(v[j][0]?.timestamp??z)>$)j-=1;let Q=v.slice(j).flat(),Z=Q[0]?.timestamp,X=Q[Q.length-1]?.timestamp;if(Z===void 0||X===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(X).toISOString(),durationMs:Math.max(0,X-Z)}}var F8={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 สายเข้า"},P8={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 U0(z){return z==="en"?P8:F8}var q8="lw-debug-toasts",D8=6000,B8=`
|
|
1
|
+
(()=>{var I6=((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 C6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},m=null;function P2(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.");m=z}function N(){if(!m)throw Error("[debug-capture] configureDebugCapture() has not been called");return m}function J1(){return m!==null}function a(){let z=N().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??O6()}}function O6(){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=m?.capture?.[z];return typeof J==="number"?J:C6[z]}function $1(z){let J=m?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function j1(){let z=m?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function q2(){return m?.capture?.overlaySelectors??[]}var _6='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',S6="[data-lw-mask]",H2={fps:1,quality:0.5};function E0(){let z=m?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,V)=>typeof Z==="number"&&Z>0?Z:V,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,H2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,H2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?_6:S6),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function F2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(L6(J))return!1;if(J.origin===window.location.origin)return!0;return(m?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function L6(z){if(!m?.host)return!1;try{if(new URL(m.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function D2(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 f0="‹redacted›",R6=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,A6=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),T6=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,k6=/[\w.+-]+@[\w-]+\.[\w.-]+/g,x6=/\d(?:[\d\s-]{7,})\d/g;function w0(z){return z.replace(k6,f0).replace(x6,f0)}function E6(z){if(R6.test(z))return!0;return j1().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function b0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=E6($)?f0:j;return J}function Z0(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(A6.has(Z.toLowerCase())||j1().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,f0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function T1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>T1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=T6.test(j)||j1().bodyKeys.some((V)=>j.toLowerCase().includes(V));$[j]=Z?f0:T1(Q,J+1)}return $}function g0(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(T1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var k1=120,x1=40,I0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,E1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},N0=[],B2=0,M2=!1;function y0(z,J,$,j){let Q=I0(J,k1),Z=N0[N0.length-1];if(z==="navigate"&&Z?.kind==="click"){let Y=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${Y}`))return Z.at=new Date().toISOString(),Z;let U=Y.split(/[?#]/)[0]??Y,P=Z.source?E1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(P&&(U===P||U.startsWith(P)))return Z.detail=I0(`${Z.detail} → ${Y}`,k1),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}B2+=1;let V={id:`act_${B2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:Z1(j)};N0.push(V);while(N0.length>Q0("maxActions"))w6(N0.shift());return V}var f6=200000,v0=0;function Z1(z){if(!z)return;if(v0+z.length>f6)return;return v0+=z.length,z}function w6(z){if(!z)return;if(v0-=(z.html?.length??0)+(z.afterHtml?.length??0),v0<0)v0=0}function Q1(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var b6='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',g6={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},N2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function y6(z){let J=z.getAttribute("role");if(J&&N2[J])return N2[J];return g6[z.tagName.toLowerCase()]??"ปุ่ม"}function v6(z,J){try{let $=z,j=0;while($&&j<=J){let Q=L2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function h6(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 E1(Q)}return""}function m6(z){if(!(z instanceof Element))return null;let J=z.closest(b6)??v6(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function u6(z){let J=w0(h6(z));if(!J)return null;return`${y6(z)} “${I0(J,x1)}”`}var S2=6000,p6=4000,d6=/(?:^|\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 i6(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 V of Array.from(Q.attributes)){let Y=V.name.toLowerCase();if(Y.startsWith("on")||Y==="srcdoc"||Y==="value"||Y.startsWith("data-"))Q.removeAttribute(V.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let V=Z.replace(d6," ").replace(/\s+/g," ").trim();if(V)Q.setAttribute("class",V);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=w0(j.nodeValue);j=$.nextNode()}}function f1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);i6(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var c6=(z)=>f1(z,S2,p6),l6=150000,o6=40000,I2=(z)=>f1(z,l6,o6);function r6(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`ช่อง “${w0(J)}”`}var C2=80;function L2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function n6(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 O2(z){if(!z)return;return`→ ${z.length>C2?`${z.slice(0,C2)}…`:z}`}function s6(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return O2(J);let $=L2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return O2(n6($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var a6='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function t6(){let z=q2();return z.length?z.join(", "):a6}function e6(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 z8(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((V)=>document.getElementById(V)?.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 R2(z){let J=w0(z8(z)),$=e6(z);return J?`เปิด ${$} “${I0(J,x1)}”`:`เปิด ${$}`}var J8='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',$8=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function j8(z){if(z.querySelector(J8))return!0;return $8.test(z.textContent??"")}var Q8=400,Z8=250,X8=8000;function V8(z,J){if(typeof MutationObserver>"u"){J.html=Z1(I2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,V.disconnect(),window.clearInterval(Y),window.clearTimeout(U)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=I0(R2(z),k1),J.html=Z1(I2(z))},V=new MutationObserver(()=>{$=Date.now()});V.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let Y=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=Q8&&!j8(z))Z()},Z8),U=window.setTimeout(Z,X8)}function Y8(z){if(Q1(z))return;let J=y0("ui",R2(z));if(J)V8(z,J)}function K8(){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=t6(),V=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let Y of V){if(z.has(Y))continue;z.add(Y),Y8(Y)}}}).observe(document.body,{childList:!0,subtree:!0})}var W8=1600,G8=2500;function _2(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(),x1)}}function U8(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 H8(z,J){if(typeof MutationObserver>"u")return;let $=_2(z),j=!1,Q=(Y,U)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(V),J.afterNote=Y,U)J.afterHtml=Z1(f1(z,S2,G8))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let Y=U8($,_2(z));if(Y)Q(Y,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},W8)}function A2(){if(M2||typeof window>"u")return;M2=!0,document.addEventListener("click",(j)=>{if(Q1(j.target))return;let Q=m6(j.target);if(!Q)return;let Z=u6(Q);if(!Z)return;let V=y0("click",`คลิก ${Z}`,s6(Q),c6(Q));if(V)H8(Q,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(Q1(j.target))return;let Q=r6(j.target);if(Q)y0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(Q1(j.target))return;y0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>y0("navigate",`ไปที่ ${E1(Z0(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),K8()}function T2(){return N0.map((z)=>({...z}))}var k2=2000,X1=[],x2=0,E2=!1;function w1(z,J){x2+=1,X1.push({id:`log_${x2}`,at:new Date().toISOString(),level:z,message:J.length>k2?`${J.slice(0,k2)}…`:J});while(X1.length>Q0("maxConsoleEntries"))X1.shift()}function P8(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function f2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,P8());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function w2(){if(E2||typeof window>"u")return;E2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{w1(J,j.map(f2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";w1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:f2(J.reason);w1("unhandledrejection",$)})}function b2(){return X1.map((z)=>({...z}))}var g2=new Set,y2=new Set;function v2(z,J){return z.add(J),()=>z.delete(J)}function h2(z,J){for(let $ of[...z])$(J)}function m2(z){return v2(g2,z)}function V1(z={type:"manual"}){h2(g2,z)}function u2(z){return v2(y2,z)}function p2(z){h2(y2,z)}var q8=15000,F8=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],d2=!1,i2=0;function D8(z){return F8.some((J)=>z.includes(J))}function c2(z){let J=z.message??"";if(!J||D8(J))return;let $=Date.now();if($-i2<q8)return;i2=$,p2({...z,message:J})}function l2(){if(d2||typeof window>"u")return;d2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;c2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;c2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var s2=4000,B8=1e6,M8=1e7,Y1=[],o2=0,r2=!1;function a2(z){Y1.push(z);while(Y1.length>Q0("maxRequests"))Y1.shift()}function t2(){return o2+=1,`req_${o2}`}function n2(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 N8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function I8(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 C8(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=n2(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...n2(J.headers)};if(J.body!==void 0)Z=I8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function e2(z){return!F2(z)}function O8(z,J){if(e2(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>B8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=g0(Z,Q0("maxBodyChars"))}).catch(()=>{})}catch{}}function z4(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 _8(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=C8(J,$);if(z4(j.url,j.headers))return z(J,$);let Q={id:t2(),startedAt:new Date().toISOString(),method:j.method,url:Z0(j.url),requestHeaders:b0(j.headers),requestBody:g0(j.body,s2),status:null,statusText:null,durationMs:null,via:"fetch"};a2(Q);let Z=performance.now();try{let V=await z(J,$);return Q.status=V.status,Q.statusText=V.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=b0(N8(V.headers)),O8(V,Q),V}catch(V){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},z)}function S8(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,V){let Y=typeof V==="string"?V:V.toString();return this.__lwEntry=z4(Y,{})?void 0:{id:t2(),startedAt:"",method:(Z||"GET").toUpperCase(),url:Z0(Y),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof Z==="string"?g0(Z,s2):Z==null?null:"[non-string body]";let Y=performance.now();a2(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-Y),e2(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=g0(this.responseText||"",Q0("maxBodyChars"))}catch{}else{let U=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${U}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function J4(){if(r2)return;r2=!0,_8(),S8()}function $4(){let z=Y1.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>M8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var L8=4,j4=3,R8=4000,A8="[data-debug-reporter]",Q4=()=>import("@rrweb/record");function Z4(z){Q4=z}var p=[],b1=null,K1=!1;function X4(){if(typeof window>"u"||b1||K1)return;let z=E0();if(!z)return;K1=!0;let J=()=>void T8(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function T8(z){let J;try{J=(await Q4()).record}catch($){K1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(b1)return;try{b1=J({emit:($)=>k8($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:R8,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${A8}`,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{K1=!1}}function k8(z){if(z.type===L8||p.length===0){if(p.push([]),p.length>j4)p=p.slice(-j4)}p[p.length-1].push(z)}function V4(z=Date.now()){let J=E0();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,V=Q[Q.length-1]?.timestamp;if(Z===void 0||V===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-Z)}}var x8={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 สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก"},E8={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",ringHint:"When you answer, your browser asks for the microphone · during the call the team may ask to see your screen — you always choose",ringTest:"Test the microphone and speaker first",ringAnswer:"Answer",ringAnswering:"Answering…",ringFallback:"The call can't open on this page — answer in a new tab instead, already signed in"};function P0(z){return z==="en"?E8:x8}var f8="lw-debug-toasts",w8=6000,b8=`
|
|
2
2
|
:host { all: initial; }
|
|
3
3
|
.stack {
|
|
4
4
|
position: fixed; top: 16px; right: 16px; z-index: 2147483001;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
@keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
|
|
32
32
|
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
|
|
33
|
-
`,L1=null;function M8(){if(typeof document>"u")return null;if(L1?.isConnected)return L1;let z=document.createElement(q8);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=B8;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),L1=j,j}function I0(z,J="success",$){let j=r0()?N().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=M8();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let X=document.createElement("span");X.className="dot";let Y=document.createElement("span");Y.textContent=z;let H=document.createElement("button");H.type="button",H.className="close",H.textContent="✕",H.setAttribute("aria-label","ปิด");let F=()=>{window.clearTimeout(S),Z.remove()};H.addEventListener("click",F);let S=J==="error"||$?0:window.setTimeout(F,D8);if(Z.append(X,Y),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{F(),$.onClick()}),Z.append(B)}Z.append(H),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 N8(){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 R1(z,J){if(!z)return J;try{return z()}catch{return J}}function e2(){let z=N(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:n0(J),user:R1(z.user,{}),apiHeaders:f0(R1(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:N8(),extra:R1(z.extra,{})}}var I8=2;function j1(z){let J=l2(),$=S2();return{context:e2(),reason:z.reason,note:z.note,cause:t2(J,$,z.erroredQueries),actionTrail:M2(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:a2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:I8}}}async function k1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await C8();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await S8();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function C8(){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 O8(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 O8(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((X)=>{let Y=!1,H=()=>{if(Y)return;Y=!0,X()};J.onloadedmetadata=()=>{J.play().then(H).catch(H)},window.setTimeout(H,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 S8(){let z=N().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 L8=2000,R8=0.82,k8=3000000;function A8(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 Q1(z){try{let J=await A8(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,L8/$),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 X=R8,Y=Q.toDataURL("image/jpeg",X);while(Y.length>k8&&X>0.4)X-=0.15,Y=Q.toDataURL("image/jpeg",X);return Y}catch{return z}}var T8=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,f8=/^\d+$/,w8=/^[0-9a-f]{16,}$/i;function z4(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)=>T8.test(Z)||f8.test(Z)||w8.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var J4=2000000;function Z1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function $4(z,J=2000000){if(Z1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(Z1(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&&Z1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&Z1(j)>J)j.console=j.console.slice(1);return j}function b0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var x8=4,E8=2,b8=3,g8=0,h8=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),y8=/^\s*javascript:/i;function m8(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&y8.test(J)}function j4(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"||!h8.has($)||!j.includes("?"))continue;z[$]=j0(j)}}function A1(z){if(!z)return;j4(z.attributes);for(let J of z.childNodes??[])A1(J)}function Q4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===x8&&typeof j.href==="string")j.href=j0(j.href);else if($.type===E8)A1(j.node);else if($.type===b8&&j.source===g8){for(let Q of j.adds??[])A1(Q.node);for(let Q of j.attributes??[])j4(Q.attributes,!0)}}return J}var v8="session-replay.json.gz",u8="session-replay.json";function p8(z){return Boolean(z&&z.events.length>0)}async function d8(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 V4(z,J){if(!p8(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=Q4(z.events),Z=await Z4(Q),X=!1;if(Z.bytes.byteLength>J&&l8(Q))Q=o8(Q),Z=await Z4(Q),X=!0;let{bytes:Y,compressed:H}=Z;if(Y.byteLength>J)return{summary:{...j,bytes:Y.byteLength,omitted:"too-large"}};return{dataUri:`data:${H?"application/gzip":"application/json"};base64,${b0(Y)}`,filename:H?v8:u8,summary:{...j,events:Q.length,bytes:Y.byteLength,compressed:H,...X?{canvasDropped:X}:{}}}}async function Z4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await d8(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var i8=3,X4=2,c8=9;function W4(z){return z.type===i8&&z.data?.source===c8}function l8(z){return z.some(W4)||z.some((J)=>J.type===X4&&Y4(J.data.node))}function Y4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(Y4)}function K4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])K4(J)}function o8(z){let J=[];for(let $ of z){if(W4($))continue;if($.type===X4)K4($.data.node);J.push($)}return J}var r8=new Set([502,503,504]);class s extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function n8(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${b0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function T1(){let z=N().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function G4(z,J){let $=N(),j=$4(J,J4),{context:Q,note:Z}=j,X=[];if(j.screenshotDataUrl){let L=await Q1(j.screenshotDataUrl);X.push({dataUri:L,filename:"screenshot.jpg"})}X.push(n8(j));let Y,H=k0();if(H){let L=await V4(j.replay,H.maxBytes);if(Y=L.summary,"dataUri"in L)X.push({dataUri:L.dataUri,filename:L.filename})}let F=z4(j),S={title:z,description:Z.trim()||void 0,appName:n().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:n().name,module:Q.module?.label??""},context:{...F?{signature:F}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...Y?{replay:Y}:{}},attachments:X},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await T1()},body:JSON.stringify(S)}).catch(()=>{throw new s("report never left the browser","offline")});if(!B.ok)throw await f1(B);return await B.json()}async function f1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new s("rate limited","rateLimited",J??void 0);if(r8.has(z.status))return new s("desk unavailable","unavailable");return new s($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var V1=null,g0=null,H4=()=>N().host.replace(/\/$/,"");function w1(){return V1}function C0(){if(g0)return g0;return g0=(async()=>{try{let z=await fetch(`${H4()}/ingest/request-types`,{headers:{"x-realm-key":N().realmKey}}),J=z.ok?await z.json():null;V1=Array.isArray(J?.types)?J.types.filter(s8):[]}catch{V1=[],g0=null}return V1??[]})(),g0}function s8(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function U4(z){let J=N(),$={};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?n0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await Q1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${H4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await T1()},body:JSON.stringify(Q)}).catch(()=>{throw new s("request never left the browser","offline")});if(!Z.ok)throw await f1(Z);return await Z.json()}var h0=Math.PI/6;function F4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),X=Math.atan2(Q,j),Y=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(X-h0),y:J.y-$*Math.sin(X-h0)},{x:J.x-$*Math.cos(X+h0),y:J.y-$*Math.sin(X+h0)}],H=$*Math.cos(h0)*0.92;if(Z<=H)return{shaft:null,head:Y};return{shaft:{from:z,to:{x:J.x-H*Math.cos(X),y:J.y-H*Math.sin(X)}},head:Y}}var x1="#f44336",a8="rgba(250, 204, 21, 0.4)",E1=22,P4="#2563eb",q4=9,D4=11,B4=18,M4=4,X1=8,t8=[{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 N4(z,J,$){let j=[],Q=null,Z=-1,X=null,Y=null,H=z.getContext("2d");function F(){let V=z.getBoundingClientRect().width;return V>0?z.width/V:1}function S(V){let W=z.getBoundingClientRect();return{x:(V.clientX-W.left)/W.width*z.width,y:(V.clientY-W.top)/W.height*z.height}}function B(V){let W=V.size??E1;if(!H)return(V.text?.length??0)*W*0.6;H.save(),H.font=`600 ${W}px system-ui, sans-serif`;let G=H.measureText(V.text??"").width;return H.restore(),G}function L(V){if(V.tool==="text"){let W=V.size??E1;return{left:V.x1,top:V.y1,right:V.x1+B(V),bottom:V.y1+W*1.25}}return{left:Math.min(V.x1,V.x2),top:Math.min(V.y1,V.y2),right:Math.max(V.x1,V.x2),bottom:Math.max(V.y1,V.y2)}}function R(V){if(V.tool==="arrow")return[{id:"tail",x:V.x1,y:V.y1,cursor:"move"},{id:"head",x:V.x2,y:V.y2,cursor:"move"}];let W=L(V);if(V.tool==="text")return[{id:"size",x:W.right,y:W.bottom,cursor:"nwse-resize"}];return t8.map((G)=>({id:G.id,x:W.left+(W.right-W.left)*G.fx,y:W.top+(W.bottom-W.top)*G.fy,cursor:G.cursor}))}function k(V){let W=L(V);return{x:W.right+B4*F(),y:W.top-B4*F()}}function l(V,W,G){let{shaft:K,head:U}=F4({x:W.x1,y:W.y1},{x:W.x2,y:W.y2},Math.max(10,16*G));if(K)V.lineCap="butt",V.beginPath(),V.moveTo(K.from.x,K.from.y),V.lineTo(K.to.x,K.to.y),V.stroke();V.beginPath(),V.moveTo(U[0].x,U[0].y),V.lineTo(U[1].x,U[1].y),V.lineTo(U[2].x,U[2].y),V.closePath(),V.fill()}function t(V,W,G){V.save(),V.lineWidth=Math.max(2,3*G),V.strokeStyle=x1,V.fillStyle=x1;let K=L(W);if(W.tool==="rect")V.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(W.tool==="arrow")l(V,W,G);else if(W.tool==="highlight")V.fillStyle=a8,V.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(W.tool==="text"&&W.text){let U=W.size??E1;V.font=`600 ${U}px system-ui, sans-serif`,V.textBaseline="top";let q=U*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(K.left-q,K.top-q,K.right-K.left+q*2,K.bottom-K.top+q*2),V.fillStyle=x1,V.fillText(W.text,K.left,K.top)}V.restore()}function b(V,W,G){let K=L(W);V.save(),V.strokeStyle=P4,V.lineWidth=Math.max(1,1.5*G),V.setLineDash([6*G,4*G]),V.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),V.setLineDash([]);let U=q4*G;for(let E of R(W))V.fillStyle="#fff",V.strokeStyle=P4,V.lineWidth=Math.max(1,1.5*G),V.beginPath(),V.rect(E.x-U/2,E.y-U/2,U,U),V.fill(),V.stroke();let q=k(W),I=D4*G;V.beginPath(),V.arc(q.x,q.y,I,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*G),V.beginPath(),V.moveTo(q.x-I*0.4,q.y-I*0.4),V.lineTo(q.x+I*0.4,q.y+I*0.4),V.moveTo(q.x+I*0.4,q.y-I*0.4),V.lineTo(q.x-I*0.4,q.y+I*0.4),V.stroke(),V.restore()}function O(){if(!H)return;let V=F();if(H.clearRect(0,0,z.width,z.height),H.drawImage(J,0,0,z.width,z.height),j.forEach((G,K)=>{if(K!==K0)t(H,G,V)}),X)t(H,X,V);let W=j[Z];if(W&&!X)b(H,W,V)}function P0(V,W,G,K,U){return Math.abs(V-G)<=U&&Math.abs(W-K)<=U}function Y0(V,W){let G=j[Z];if(!G)return null;let K=q4*F()/2+3*F();for(let U of R(G))if(P0(V,W,U.x,U.y,K))return U.id;return null}function x(V,W){let G=j[Z];if(!G)return!1;let K=k(G);return P0(V,W,K.x,K.y,D4*F())}function o(V,W){let G=6*F();for(let K=j.length-1;K>=0;K-=1){let U=j[K];if(U.tool==="arrow"){let I=U.x2-U.x1,E=U.y2-U.y1,c=Math.hypot(I,E)||1,P=Math.max(0,Math.min(1,((V-U.x1)*I+(W-U.y1)*E)/(c*c)));if(Math.hypot(V-(U.x1+P*I),W-(U.y1+P*E))<=G+4*F())return K;continue}let q=L(U);if(V>=q.left-G&&V<=q.right+G&&W>=q.top-G&&W<=q.bottom+G)return K}return-1}function w(V,W,G,K,U){if(W==="tail"){V.x1=G.x1+K,V.y1=G.y1+U;return}if(W==="head"){V.x2=G.x2+K,V.y2=G.y2+U;return}if(W==="size"){let C=(G.size??24)+U;V.size=Math.max(10,C);return}let q=L(G),{left:I,top:E,right:c,bottom:P}=q;if(W.includes("w"))I=Math.min(c-X1,I+K);if(W.includes("e"))c=Math.max(I+X1,c+K);if(W.includes("n"))E=Math.min(P-X1,E+U);if(W.includes("s"))P=Math.max(E+X1,P+U);V.x1=I,V.y1=E,V.x2=c,V.y2=P}function l0(V,W,G,K){V.x1=W.x1+G,V.y1=W.y1+K,V.x2=W.x2+G,V.y2=W.y2+K}let A=null,K0=-1,h={x:0,y:0,size:24};function R0(){let V=z.getBoundingClientRect().width;return V>0?V/z.width:1}function o0(V,W){if(!H)return V.length*W*0.6;H.save(),H.font=`600 ${W}px system-ui, sans-serif`;let G=H.measureText(V||" ").width;return H.restore(),G}function q0(){if(!A)return;let V=z.parentElement;if(!V)return;let W=z.getBoundingClientRect(),G=V.getBoundingClientRect(),K=R0(),U=h.size*K;A.style.left=`${W.left-G.left+h.x*K}px`,A.style.top=`${W.top-G.top+h.y*K}px`,A.style.fontSize=`${U}px`,A.style.width=`${Math.max(40,o0(A.value,U)+U)}px`}function e(V){let W=A;if(!W)return;A=null;let G=W.value.trim(),K=K0;if(K0=-1,W.remove(),V&&G){if(K>=0&&j[K])j[K].text=G,Z=K;else j.push({tool:"text",x1:h.x,y1:h.y,x2:h.x,y2:h.y,text:G,size:h.size}),Z=j.length-1;$()}else if(K>=0)Z=K;z.focus(),O()}function r(V,W,G=-1){e(!0);let K=z.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let U=G>=0?j[G]:void 0;K0=G,h={x:U?.x1??V,y:U?.y1??W,size:U?.size??Math.round(24*F())};let q=document.createElement("input");q.type="text",q.className="text-edit",q.value=U?.text??"",q.setAttribute("aria-label","ข้อความบนภาพ"),q.placeholder="ข้อความ",A=q,K.append(q),q0(),q.addEventListener("input",q0),q.addEventListener("keydown",(I)=>{if(I.stopPropagation(),I.key==="Enter")e(!0);else if(I.key==="Escape")e(!1)}),requestAnimationFrame(()=>{if(A!==q)return;q.focus(),q.select(),q.addEventListener("blur",()=>e(!0))}),O()}function d(V){let{x:W,y:G}=S(V);if(z.setPointerCapture(V.pointerId),x(W,G)){i();return}let K=Y0(W,G);if(K&&j[Z]){Y={grip:K,x:W,y:G,start:{...j[Z]}};return}if(Q==="text"){if(V.preventDefault(),z.hasPointerCapture(V.pointerId))z.releasePointerCapture(V.pointerId);Q=null,$(),r(W,G);return}if(Q){X={tool:Q,x1:W,y1:G,x2:W,y2:G},Z=-1;return}let U=o(W,G);Z=U,Y=U>=0?{grip:"body",x:W,y:G,start:{...j[U]}}:null,O()}function D0(V){let{x:W,y:G}=S(V);if(X){X.x2=W,X.y2=G,O();return}if(Y){let U=j[Z];if(!U)return;let q=W-Y.x,I=G-Y.y;if(Y.grip==="body")l0(U,Y.start,q,I);else w(U,Y.grip,Y.start,q,I);O();return}if(Q){z.style.cursor="crosshair";return}if(x(W,G)){z.style.cursor="pointer";return}let K=Y0(W,G);if(K){let U=j[Z]?R(j[Z]).find((q)=>q.id===K):null;z.style.cursor=U?.cursor??"pointer";return}z.style.cursor=o(W,G)>=0?"move":"default"}function G0(){if(X){if(!(Math.abs(X.x2-X.x1)<M4&&Math.abs(X.y2-X.y1)<M4))j.push(X),Z=j.length-1,Q=null,$();X=null}if(Y)Y=null,$();O()}function z0(V){let W=z.getBoundingClientRect(),G=(V.clientX-W.left)/W.width*z.width,K=(V.clientY-W.top)/W.height*z.height,U=o(G,K),q=j[U];if(!q||q.tool!=="text")return;V.preventDefault(),r(q.x1,q.y1,U)}function J0(V){if(Z<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),i();else if(V.key==="Escape")V.preventDefault(),Z=-1,O()}function i(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),O()}return z.addEventListener("pointerdown",d),z.addEventListener("pointermove",D0),z.addEventListener("pointerup",G0),z.addEventListener("pointercancel",G0),z.addEventListener("dblclick",z0),z.tabIndex=0,z.addEventListener("keydown",J0),O(),{setTool(V){Q=V,Z=-1,z.style.cursor=V?"crosshair":"default",O()},deleteSelected:i,clear(){j.length=0,Z=-1,$(),O()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let V=document.createElement("canvas");V.width=J.naturalWidth,V.height=J.naturalHeight;let W=V.getContext("2d");if(!W)return z.toDataURL("image/png");W.drawImage(J,0,0);let G=F();for(let K of j)t(W,K,G);return V.toDataURL("image/png")},destroy(){e(!1),z.removeEventListener("pointerdown",d),z.removeEventListener("pointermove",D0),z.removeEventListener("pointerup",G0),z.removeEventListener("pointercancel",G0),z.removeEventListener("dblclick",z0),z.removeEventListener("keydown",J0)}}}var e8=["keydown","keyup","keypress"];function y0(z){for(let J of e8)z.addEventListener(J,($)=>$.stopPropagation())}var I4=`
|
|
33
|
+
`,g1=null;function g8(){if(typeof document>"u")return null;if(g1?.isConnected)return g1;let z=document.createElement(f8);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=b8;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 C0(z,J="success",$){let j=J1()?N().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=g8();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let V=document.createElement("span");V.className="dot";let Y=document.createElement("span");Y.textContent=z;let U=document.createElement("button");U.type="button",U.className="close",U.textContent="✕",U.setAttribute("aria-label","ปิด");let P=()=>{window.clearTimeout(L),Z.remove()};U.addEventListener("click",P);let L=J==="error"||$?0:window.setTimeout(P,w8);if(Z.append(V,Y),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{P(),$.onClick()}),Z.append(B)}Z.append(U),Q.append(Z)}function Y4(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 y8(){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 y1(z,J){if(!z)return J;try{return z()}catch{return J}}function K4(){let z=N(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:$1(J),user:y1(z.user,{}),apiHeaders:b0(y1(z.headers,{})),app:{name:a().name,version:a().version,environment:a().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:y8(),extra:y1(z.extra,{})}}var v8=2;function W1(z){let J=$4(),$=b2();return{context:K4(),reason:z.reason,note:z.note,cause:Y4(J,$,z.erroredQueries),actionTrail:T2(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:V4()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:v8}}}async function v1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await h8();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await p8();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function h8(){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 m8(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 m8(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((V)=>{let Y=!1,U=()=>{if(Y)return;Y=!0,V()};J.onloadedmetadata=()=>{J.play().then(U).catch(U)},window.setTimeout(U,1500)}),await u8(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 u8(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 p8(){let z=N().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 d8=2000,i8=0.82,c8=3000000;function l8(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 G1(z){try{let J=await l8(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,d8/$),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 V=i8,Y=Q.toDataURL("image/jpeg",V);while(Y.length>c8&&V>0.4)V-=0.15,Y=Q.toDataURL("image/jpeg",V);return Y}catch{return z}}var o8=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,r8=/^\d+$/,n8=/^[0-9a-f]{16,}$/i;function W4(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)=>o8.test(Z)||r8.test(Z)||n8.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var G4=2000000;function U1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function U4(z,J=2000000){if(U1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(U1(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&&U1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&U1(j)>J)j.console=j.console.slice(1);return j}function h0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var s8=4,a8=2,t8=3,e8=0,z5=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),J5=/^\s*javascript:/i;function $5(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&J5.test(J)}function H4(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if($5($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!z5.has($)||!j.includes("?"))continue;z[$]=Z0(j)}}function h1(z){if(!z)return;H4(z.attributes);for(let J of z.childNodes??[])h1(J)}function P4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===s8&&typeof j.href==="string")j.href=Z0(j.href);else if($.type===a8)h1(j.node);else if($.type===t8&&j.source===e8){for(let Q of j.adds??[])h1(Q.node);for(let Q of j.attributes??[])H4(Q.attributes,!0)}}return J}var j5="session-replay.json.gz",Q5="session-replay.json";function Z5(z){return Boolean(z&&z.events.length>0)}async function X5(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 F4(z,J){if(!Z5(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=P4(z.events),Z=await q4(Q),V=!1;if(Z.bytes.byteLength>J&&K5(Q))Q=W5(Q),Z=await q4(Q),V=!0;let{bytes:Y,compressed:U}=Z;if(Y.byteLength>J)return{summary:{...j,bytes:Y.byteLength,omitted:"too-large"}};return{dataUri:`data:${U?"application/gzip":"application/json"};base64,${h0(Y)}`,filename:U?j5:Q5,summary:{...j,events:Q.length,bytes:Y.byteLength,compressed:U,...V?{canvasDropped:V}:{}}}}async function q4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await X5(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var V5=3,D4=2,Y5=9;function B4(z){return z.type===V5&&z.data?.source===Y5}function K5(z){return z.some(B4)||z.some((J)=>J.type===D4&&M4(J.data.node))}function M4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(M4)}function N4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])N4(J)}function W5(z){let J=[];for(let $ of z){if(B4($))continue;if($.type===D4)N4($.data.node);J.push($)}return J}var G5=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 U5(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${h0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function m1(){let z=N().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function I4(z,J){let $=N(),j=U4(J,G4),{context:Q,note:Z}=j,V=[];if(j.screenshotDataUrl){let O=await G1(j.screenshotDataUrl);V.push({dataUri:O,filename:"screenshot.jpg"})}V.push(U5(j));let Y,U=E0();if(U){let O=await F4(j.replay,U.maxBytes);if(Y=O.summary,"dataUri"in O)V.push({dataUri:O.dataUri,filename:O.filename})}let P=W4(j),L={title:z,description:Z.trim()||void 0,appName:a().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:a().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,...Y?{replay:Y}:{}},attachments:V},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await m1()},body:JSON.stringify(L)}).catch(()=>{throw new t("report never left the browser","offline")});if(!B.ok)throw await u1(B);return await B.json()}async function u1(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(G5.has(z.status))return new t("desk unavailable","unavailable");return new t($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var H1=null,m0=null,C4=()=>N().host.replace(/\/$/,"");function p1(){return H1}function O0(){if(m0)return m0;return m0=(async()=>{try{let z=await fetch(`${C4()}/ingest/request-types`,{headers:{"x-realm-key":N().realmKey}}),J=z.ok?await z.json():null;H1=Array.isArray(J?.types)?J.types.filter(H5):[]}catch{H1=[],m0=null}return H1??[]})(),m0}function H5(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function O4(z){let J=N(),$={};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:a().name,category:j?$1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await G1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${C4()}/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 u1(Z);return await Z.json()}var u0=Math.PI/6;function _4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),V=Math.atan2(Q,j),Y=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(V-u0),y:J.y-$*Math.sin(V-u0)},{x:J.x-$*Math.cos(V+u0),y:J.y-$*Math.sin(V+u0)}],U=$*Math.cos(u0)*0.92;if(Z<=U)return{shaft:null,head:Y};return{shaft:{from:z,to:{x:J.x-U*Math.cos(V),y:J.y-U*Math.sin(V)}},head:Y}}var d1="#f44336",P5="rgba(250, 204, 21, 0.4)",i1=22,S4="#2563eb",L4=9,R4=11,A4=18,T4=4,P1=8,q5=[{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 k4(z,J,$){let j=[],Q=null,Z=-1,V=null,Y=null,U=z.getContext("2d");function P(){let X=z.getBoundingClientRect().width;return X>0?z.width/X:1}function L(X){let K=z.getBoundingClientRect();return{x:(X.clientX-K.left)/K.width*z.width,y:(X.clientY-K.top)/K.height*z.height}}function B(X){let K=X.size??i1;if(!U)return(X.text?.length??0)*K*0.6;U.save(),U.font=`600 ${K}px system-ui, sans-serif`;let G=U.measureText(X.text??"").width;return U.restore(),G}function O(X){if(X.tool==="text"){let K=X.size??i1;return{left:X.x1,top:X.y1,right:X.x1+B(X),bottom:X.y1+K*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function T(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let K=O(X);if(X.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return q5.map((G)=>({id:G.id,x:K.left+(K.right-K.left)*G.fx,y:K.top+(K.bottom-K.top)*G.fy,cursor:G.cursor}))}function x(X){let K=O(X);return{x:K.right+A4*P(),y:K.top-A4*P()}}function v(X,K,G){let{shaft:W,head:H}=_4({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*G));if(W)X.lineCap="butt",X.beginPath(),X.moveTo(W.from.x,W.from.y),X.lineTo(W.to.x,W.to.y),X.stroke();X.beginPath(),X.moveTo(H[0].x,H[0].y),X.lineTo(H[1].x,H[1].y),X.lineTo(H[2].x,H[2].y),X.closePath(),X.fill()}function c(X,K,G){X.save(),X.lineWidth=Math.max(2,3*G),X.strokeStyle=d1,X.fillStyle=d1;let W=O(K);if(K.tool==="rect")X.strokeRect(W.left,W.top,W.right-W.left,W.bottom-W.top);else if(K.tool==="arrow")v(X,K,G);else if(K.tool==="highlight")X.fillStyle=P5,X.fillRect(W.left,W.top,W.right-W.left,W.bottom-W.top);else if(K.tool==="text"&&K.text){let H=K.size??i1;X.font=`600 ${H}px system-ui, sans-serif`,X.textBaseline="top";let F=H*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(W.left-F,W.top-F,W.right-W.left+F*2,W.bottom-W.top+F*2),X.fillStyle=d1,X.fillText(K.text,W.left,W.top)}X.restore()}function g(X,K,G){let W=O(K);X.save(),X.strokeStyle=S4,X.lineWidth=Math.max(1,1.5*G),X.setLineDash([6*G,4*G]),X.strokeRect(W.left,W.top,W.right-W.left,W.bottom-W.top),X.setLineDash([]);let H=L4*G;for(let b of T(K))X.fillStyle="#fff",X.strokeStyle=S4,X.lineWidth=Math.max(1,1.5*G),X.beginPath(),X.rect(b.x-H/2,b.y-H/2,H,H),X.fill(),X.stroke();let F=x(K),I=R4*G;X.beginPath(),X.arc(F.x,F.y,I,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*G),X.beginPath(),X.moveTo(F.x-I*0.4,F.y-I*0.4),X.lineTo(F.x+I*0.4,F.y+I*0.4),X.moveTo(F.x+I*0.4,F.y-I*0.4),X.lineTo(F.x-I*0.4,F.y+I*0.4),X.stroke(),X.restore()}function _(){if(!U)return;let X=P();if(U.clearRect(0,0,z.width,z.height),U.drawImage(J,0,0,z.width,z.height),j.forEach((G,W)=>{if(W!==G0)c(U,G,X)}),V)c(U,V,X);let K=j[Z];if(K&&!V)g(U,K,X)}function F0(X,K,G,W,H){return Math.abs(X-G)<=H&&Math.abs(K-W)<=H}function W0(X,K){let G=j[Z];if(!G)return null;let W=L4*P()/2+3*P();for(let H of T(G))if(F0(X,K,H.x,H.y,W))return H.id;return null}function w(X,K){let G=j[Z];if(!G)return!1;let W=x(G);return F0(X,K,W.x,W.y,R4*P())}function n(X,K){let G=6*P();for(let W=j.length-1;W>=0;W-=1){let H=j[W];if(H.tool==="arrow"){let I=H.x2-H.x1,b=H.y2-H.y1,r=Math.hypot(I,b)||1,q=Math.max(0,Math.min(1,((X-H.x1)*I+(K-H.y1)*b)/(r*r)));if(Math.hypot(X-(H.x1+q*I),K-(H.y1+q*b))<=G+4*P())return W;continue}let F=O(H);if(X>=F.left-G&&X<=F.right+G&&K>=F.top-G&&K<=F.bottom+G)return W}return-1}function f(X,K,G,W,H){if(K==="tail"){X.x1=G.x1+W,X.y1=G.y1+H;return}if(K==="head"){X.x2=G.x2+W,X.y2=G.y2+H;return}if(K==="size"){let C=(G.size??24)+H;X.size=Math.max(10,C);return}let F=O(G),{left:I,top:b,right:r,bottom:q}=F;if(K.includes("w"))I=Math.min(r-P1,I+W);if(K.includes("e"))r=Math.max(I+P1,r+W);if(K.includes("n"))b=Math.min(q-P1,b+H);if(K.includes("s"))q=Math.max(b+P1,q+H);X.x1=I,X.y1=b,X.x2=r,X.y2=q}function e0(X,K,G,W){X.x1=K.x1+G,X.y1=K.y1+W,X.x2=K.x2+G,X.y2=K.y2+W}let R=null,G0=-1,h={x:0,y:0,size:24};function x0(){let X=z.getBoundingClientRect().width;return X>0?X/z.width:1}function z1(X,K){if(!U)return X.length*K*0.6;U.save(),U.font=`600 ${K}px system-ui, sans-serif`;let G=U.measureText(X||" ").width;return U.restore(),G}function D0(){if(!R)return;let X=z.parentElement;if(!X)return;let K=z.getBoundingClientRect(),G=X.getBoundingClientRect(),W=x0(),H=h.size*W;R.style.left=`${K.left-G.left+h.x*W}px`,R.style.top=`${K.top-G.top+h.y*W}px`,R.style.fontSize=`${H}px`,R.style.width=`${Math.max(40,z1(R.value,H)+H)}px`}function J0(X){let K=R;if(!K)return;R=null;let G=K.value.trim(),W=G0;if(G0=-1,K.remove(),X&&G){if(W>=0&&j[W])j[W].text=G,Z=W;else j.push({tool:"text",x1:h.x,y1:h.y,x2:h.x,y2:h.y,text:G,size:h.size}),Z=j.length-1;$()}else if(W>=0)Z=W;z.focus(),_()}function s(X,K,G=-1){J0(!0);let W=z.parentElement;if(!W)return;if(getComputedStyle(W).position==="static")W.style.position="relative";let H=G>=0?j[G]:void 0;G0=G,h={x:H?.x1??X,y:H?.y1??K,size:H?.size??Math.round(24*P())};let F=document.createElement("input");F.type="text",F.className="text-edit",F.value=H?.text??"",F.setAttribute("aria-label","ข้อความบนภาพ"),F.placeholder="ข้อความ",R=F,W.append(F),D0(),F.addEventListener("input",D0),F.addEventListener("keydown",(I)=>{if(I.stopPropagation(),I.key==="Enter")J0(!0);else if(I.key==="Escape")J0(!1)}),requestAnimationFrame(()=>{if(R!==F)return;F.focus(),F.select(),F.addEventListener("blur",()=>J0(!0))}),_()}function l(X){let{x:K,y:G}=L(X);if(z.setPointerCapture(X.pointerId),w(K,G)){o();return}let W=W0(K,G);if(W&&j[Z]){Y={grip:W,x:K,y:G,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),z.hasPointerCapture(X.pointerId))z.releasePointerCapture(X.pointerId);Q=null,$(),s(K,G);return}if(Q){V={tool:Q,x1:K,y1:G,x2:K,y2:G},Z=-1;return}let H=n(K,G);Z=H,Y=H>=0?{grip:"body",x:K,y:G,start:{...j[H]}}:null,_()}function B0(X){let{x:K,y:G}=L(X);if(V){V.x2=K,V.y2=G,_();return}if(Y){let H=j[Z];if(!H)return;let F=K-Y.x,I=G-Y.y;if(Y.grip==="body")e0(H,Y.start,F,I);else f(H,Y.grip,Y.start,F,I);_();return}if(Q){z.style.cursor="crosshair";return}if(w(K,G)){z.style.cursor="pointer";return}let W=W0(K,G);if(W){let H=j[Z]?T(j[Z]).find((F)=>F.id===W):null;z.style.cursor=H?.cursor??"pointer";return}z.style.cursor=n(K,G)>=0?"move":"default"}function U0(){if(V){if(!(Math.abs(V.x2-V.x1)<T4&&Math.abs(V.y2-V.y1)<T4))j.push(V),Z=j.length-1,Q=null,$();V=null}if(Y)Y=null,$();_()}function $0(X){let K=z.getBoundingClientRect(),G=(X.clientX-K.left)/K.width*z.width,W=(X.clientY-K.top)/K.height*z.height,H=n(G,W),F=j[H];if(!F||F.tool!=="text")return;X.preventDefault(),s(F.x1,F.y1,H)}function j0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),o();else if(X.key==="Escape")X.preventDefault(),Z=-1,_()}function o(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),_()}return z.addEventListener("pointerdown",l),z.addEventListener("pointermove",B0),z.addEventListener("pointerup",U0),z.addEventListener("pointercancel",U0),z.addEventListener("dblclick",$0),z.tabIndex=0,z.addEventListener("keydown",j0),_(),{setTool(X){Q=X,Z=-1,z.style.cursor=X?"crosshair":"default",_()},deleteSelected:o,clear(){j.length=0,Z=-1,$(),_()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=J.naturalWidth,X.height=J.naturalHeight;let K=X.getContext("2d");if(!K)return z.toDataURL("image/png");K.drawImage(J,0,0);let G=P();for(let W of j)c(K,W,G);return X.toDataURL("image/png")},destroy(){J0(!1),z.removeEventListener("pointerdown",l),z.removeEventListener("pointermove",B0),z.removeEventListener("pointerup",U0),z.removeEventListener("pointercancel",U0),z.removeEventListener("dblclick",$0),z.removeEventListener("keydown",j0)}}}var F5=["keydown","keyup","keypress"];function p0(z){for(let J of F5)z.addEventListener(J,($)=>$.stopPropagation())}var x4=`
|
|
34
34
|
:host { all: initial; }
|
|
35
35
|
* { box-sizing: border-box; }
|
|
36
36
|
|
|
@@ -181,7 +181,7 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
|
|
|
181
181
|
.shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
|
|
182
182
|
.dropped { opacity: 0.35; pointer-events: none; }
|
|
183
183
|
.draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
|
|
184
|
-
`;var m0="lw-debug-reporter",Q0=null;function z5(z,J){if(z instanceof s){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 J5=()=>[];var $5=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function j5(){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"}),y0(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=T2((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=U0(N().locale),Q=w1();if(Q===null)C0();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=M("div","head"),Z=u("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(M("h2","",J.chooseTitle),Z);let X=S4("problem",Z5,J.kindProblem,J.chooseProblemHint);X.dataset.choose="problem",X.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let Y=S4("request",O4,J.kindRequest,J.chooseRequestHint);Y.dataset.choose="request",Y.addEventListener("click",()=>{this.bundle=j1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:b1()}),this.renderForm(J,$,"request")});let H=M("div","kinds choose");H.append(X,Y),H.addEventListener("keydown",(F)=>{if(!C4.includes(F.key))return;F.preventDefault(),(this.root.activeElement===X?Y:X).focus()}),j.append(Q,H),X.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await k1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=j1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:b1()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await k1();if(j.method==="cancelled"){this.close();return}this.bundle=j1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:b1()}),this.renderForm($,J,"problem")}close(J=!1){if(J)Q0=null;else if(this.keep)Q0=this.keep()??Q0;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=I4;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=M("div","head");Q.append(M("h2","",J.title)),j.append(Q,M("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let X=this.shell(J),Y=j,H=j==="problem"||!!Z.screenshotDataUrl,F=null,S=M("div","head"),B=M("h2","",J.title),L=u("✕","icon");L.setAttribute("aria-label",J.close),L.addEventListener("click",()=>this.close()),S.append(B,L);let R=M("p","door");R.hidden=!0;let k=M("span"),l=u("","link");l.dataset.switchKind="",l.addEventListener("click",()=>W(Y==="problem"?"request":"problem")),R.append(k,l);let t=M("div","ask");t.hidden=!0;let b=document.createElement("input");b.type="search",b.className="type-search",b.placeholder=J.requestTypeSearch,b.setAttribute("aria-label",J.requestTypeSearch),b.dataset.requestTypeSearch="",b.hidden=!0;let O=M("div","types");O.setAttribute("role","radiogroup"),O.setAttribute("aria-label",J.requestTypeLabel);let P0=M("p","status",J.requestTypeNone);P0.hidden=!0;let Y0=M("p","status type-count","");Y0.hidden=!0,t.append(W1(J.requestTypeLabel,"",!0),b,O,P0,Y0);let x=[],o=()=>{for(let C of x){let D=C.dataset.requestType===F?.id;C.setAttribute("aria-checked",String(D)),C.tabIndex=D?0:-1}let P=x.find((C)=>C.dataset.requestType===F?.id);if(P&&O.scrollHeight>O.clientHeight){let C=P.offsetTop-O.offsetTop;if(C<O.scrollTop)O.scrollTop=C;else if(C+P.offsetHeight>O.scrollTop+O.clientHeight)O.scrollTop=C+P.offsetHeight-O.clientHeight}},w=document.createElement("input");w.type="text";let l0=W1(""),A=document.createElement("textarea"),K0=W1(""),h=M("div","meta"),{context:R0}=Z,o0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,q0=(P,C)=>{let D=document.createElement("div"),_=document.createElement("b");_.textContent=`${P}: `;let T=document.createTextNode(C);return D.append(_,T),h.append(D),{b:_,v:T}};q0(J.reporter,`${R0.user.fullName??"—"} (${R0.user.email??"—"})`),q0(J.page,R0.route.href);let e=q0(J.captured,o0),r=document.createElement("label");r.className="shot-choice",r.hidden=!0;let d=document.createElement("input");d.type="checkbox",d.checked=!0,d.dataset.requestShot="",r.append(d,document.createTextNode(` ${J.requestWithShot}`));let D0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[M("p","status",J.noScreenshot)],G0=Z.screenshotDataUrl?D0[0]:null;if(!Z.screenshotDataUrl)r.replaceChildren();let z0=M("p","status",""),J0=u(J.submit,"primary"),i=()=>{J0.disabled=w.value.trim().length===0||Y==="request"&&!F};w.addEventListener("input",i);let V=()=>{let P=Y==="request";if(B.textContent=P?J.requestTitle:J.title,X.setAttribute("aria-label",P?J.requestTitle:J.title),k.textContent=`${P?J.problemInstead:J.askInstead} `,l.textContent=P?H?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,t.hidden=!P,Y1(l0,P?J.requestSummaryLabel:J.summaryLabel,P?"":J.summaryRequired,!0),w.placeholder=P?J.requestSummaryPlaceholder:J.summaryPlaceholder,Y1(K0,P?J.requestDetailLabel:J.detailLabel),A.placeholder=P?J.requestDetailPlaceholder:J.detailPlaceholder,e.b.textContent=`${P?J.requestLeaves:J.captured}: `,e.v.textContent=P?J.requestLeavesWhat:o0,r.hidden=!P||!Z.screenshotDataUrl,G0)Y1(G0,P?J.requestAnnotateHint:J.annotateHint);for(let C of D0)C.classList.toggle("dropped",P&&!d.checked),C.hidden=P&&!Z.screenshotDataUrl;J0.textContent=P?J.requestSubmit:J.submit,i()};d.addEventListener("change",V);let W=(P)=>{if(P===Y)return;if(P==="problem"&&!H){this.switchToReport(J,$,{title:w.value,detail:A.value,asking:!1,typeId:F?.id??null});return}Y=P,V()},G=(P)=>{if(this.bundle!==Z||$.type!=="manual"||!P.length)return;F=P[0],x.length=0;for(let D of P){let _=u("","type");_.setAttribute("role","radio"),_.dataset.requestType=D.id;let T=M("span","type-body");if(T.append(M("b","",D.name)),D.description)T.append(M("span","type-hint",D.description));if(D.targetHours){let B0=M("span","type-due");B0.append(K1(V5),document.createTextNode(J.requestTarget.replace("{time}",Q5(J,D.targetHours)))),T.append(B0)}_.append(K1(O4),T),_.addEventListener("click",()=>{F=D,o(),i()}),x.push(_)}O.replaceChildren(...x),O.onkeydown=(D)=>{if(!C4.includes(D.key)||!F)return;D.preventDefault();let _=P.filter((H0,j6)=>!x[j6].hidden);if(!_.length)return;let T=_.findIndex((H0)=>H0.id===F.id),B0=D.key==="ArrowUp"||D.key==="ArrowLeft"?-1:1;F=_[T<0?0:(T+B0+_.length)%_.length],o(),x.find((H0)=>H0.dataset.requestType===F.id)?.focus()},O.classList.toggle("long",P.length>=g1),b.hidden=P.length<g1;let C=(D)=>{Y0.hidden=P.length<g1||D===0,Y0.textContent=J.requestTypeCount.replace("{n}",String(D))};C(P.length),b.oninput=()=>{let D=b.value.trim().toLowerCase(),_=null;if(P.forEach((T,B0)=>{let H0=!D||`${T.name} ${T.description}`.toLowerCase().includes(D);if(x[B0].hidden=!H0,H0&&!_)_=T}),P0.hidden=!!_,C(x.filter((T)=>!T.hidden).length),_&&F&&x[P.indexOf(F)].hidden)F=_;o(),i()},b.onkeydown=(D)=>{if(D.key==="ArrowDown"||D.key==="Enter")D.preventDefault(),x.find((_)=>_.dataset.requestType===F?.id&&!_.hidden)?.focus()},o(),R.hidden=!1,V()},K=Q??(Q0&&(Q0.title||Q0.detail)?Q0:null),U=M("p","draft");if(U.hidden=!K||!!Q,K){w.value=K.title,A.value=K.detail;let P=u(J.draftClear,"link");P.dataset.draftClear="",P.addEventListener("click",()=>{w.value="",A.value="",Q0=null,U.hidden=!0,i(),w.focus()}),U.append(document.createTextNode(`${J.draftRestored} · `),P)}let q=w1(),I=(P)=>{if(G(P),Y!=="request"||R.hidden||!K?.typeId)return;let C=P.find((D)=>D.id===K.typeId);if(C)F=C,o()};if(q)I(q);else if($.type==="manual")C0().then(I);this.keep=()=>({title:w.value,detail:A.value,asking:Y==="request",typeId:F?.id??null}),X.append(S,R,U,t,l0,w,K0,A,h,r,...D0);let E=M("div","foot"),c=u(J.close);c.addEventListener("click",()=>this.close()),E.append(c,z0,M("span","grow"),J0),X.append(E),V(),J0.addEventListener("click",async()=>{J0.disabled=!0,z0.dataset.tone="",z0.textContent=J.submitting;let P=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(Y==="request"&&F){let _=await U4({ticketTypeId:F.id,title:w.value.trim(),description:A.value,screenshotDataUrl:d.checked?P():null}),T=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:_,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),T)I0(`${J.requestSubmitted} — #${_.number}`,"success");return}let C=await G4(w.value.trim(),{...Z,note:A.value,screenshotDataUrl:P()}),D=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:C,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),D)I0(`${J.submitted} — #${C.number}`,"success")}catch(C){let D=z5(C,J);z0.dataset.tone="error",z0.textContent=D,I0(D,"error"),i()}}),w.focus()}screenshotSection(J,$){let j=W1(J.annotateHint),Q=M("div","tools"),Z=document.createElement("canvas"),X=M("div","shot");X.append(Z);let Y=[],H=(L)=>{for(let R of Y)R.setAttribute("aria-pressed",String(R===L))};for(let{tool:L,key:R}of $5){let k=u(J[R]);k.setAttribute("aria-pressed","false"),k.addEventListener("click",()=>{let l=k.getAttribute("aria-pressed")==="true";H(l?null:k),this.annotator?.setTool(l?null:L)}),Y.push(k),Q.append(k)}Q.append(M("span","sep"));let F=u(J.deleteSelected);F.addEventListener("click",()=>this.annotator?.deleteSelected());let S=u(J.clearAll);S.addEventListener("click",()=>{this.annotator?.clear(),H(null)}),Q.append(F,S);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=N4(Z,B,()=>{H(null),F.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,M("p","status",J.annotateHelp),X]}}}function b1(){try{return J5()}catch{return[]}}function M(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function Q5(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var C4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],g1=7,Z5=[["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"}]],O4=[["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"}]],V5=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],X5=[["path",{d:"M20 6 9 17l-5-5"}]],_4="http://www.w3.org/2000/svg";function S4(z,J,$,j){let Q=u("","kind");Q.dataset.kind=z;let Z=M("span","kind-top");return Z.append(K1(J),M("b","",$)),Q.append(Z,M("span","kind-hint",j),K1(X5,"tick")),Q}function K1(z,J="icon"){let $=document.createElementNS(_4,"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(_4,j);for(let[X,Y]of Object.entries(Q))Z.setAttribute(X,Y);$.append(Z)}return $}function u(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function W1(z,J="",$=!1){return Y1(document.createElement("label"),z,J,$)}function Y1(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 L4(){if(typeof window>"u"||customElements.get(m0))return;customElements.define(m0,j5())}var R4=138.23,G9=`
|
|
184
|
+
`;var d0="lw-debug-reporter",X0=null;function D5(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 B5=()=>[];var M5=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function N5(){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"}),p0(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=m2((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=P0(N().locale),Q=p1();if(Q===null)O0();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=M("div","head"),Z=d("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(M("h2","",J.chooseTitle),Z);let V=b4("problem",C5,J.kindProblem,J.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let Y=b4("request",f4,J.kindRequest,J.chooseRequestHint);Y.dataset.choose="request",Y.addEventListener("click",()=>{this.bundle=W1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:c1()}),this.renderForm(J,$,"request")});let U=M("div","kinds choose");U.append(V,Y),U.addEventListener("keydown",(P)=>{if(!E4.includes(P.key))return;P.preventDefault(),(this.root.activeElement===V?Y:V).focus()}),j.append(Q,U),V.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await v1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=W1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:c1()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await v1();if(j.method==="cancelled"){this.close();return}this.bundle=W1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:c1()}),this.renderForm($,J,"problem")}close(J=!1){if(J)X0=null;else if(this.keep)X0=this.keep()??X0;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=x4;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=M("div","head");Q.append(M("h2","",J.title)),j.append(Q,M("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let V=this.shell(J),Y=j,U=j==="problem"||!!Z.screenshotDataUrl,P=null,L=M("div","head"),B=M("h2","",J.title),O=d("✕","icon");O.setAttribute("aria-label",J.close),O.addEventListener("click",()=>this.close()),L.append(B,O);let T=M("p","door");T.hidden=!0;let x=M("span"),v=d("","link");v.dataset.switchKind="",v.addEventListener("click",()=>K(Y==="problem"?"request":"problem")),T.append(x,v);let c=M("div","ask");c.hidden=!0;let g=document.createElement("input");g.type="search",g.className="type-search",g.placeholder=J.requestTypeSearch,g.setAttribute("aria-label",J.requestTypeSearch),g.dataset.requestTypeSearch="",g.hidden=!0;let _=M("div","types");_.setAttribute("role","radiogroup"),_.setAttribute("aria-label",J.requestTypeLabel);let F0=M("p","status",J.requestTypeNone);F0.hidden=!0;let W0=M("p","status type-count","");W0.hidden=!0,c.append(q1(J.requestTypeLabel,"",!0),g,_,F0,W0);let w=[],n=()=>{for(let C of w){let D=C.dataset.requestType===P?.id;C.setAttribute("aria-checked",String(D)),C.tabIndex=D?0:-1}let q=w.find((C)=>C.dataset.requestType===P?.id);if(q&&_.scrollHeight>_.clientHeight){let C=q.offsetTop-_.offsetTop;if(C<_.scrollTop)_.scrollTop=C;else if(C+q.offsetHeight>_.scrollTop+_.clientHeight)_.scrollTop=C+q.offsetHeight-_.clientHeight}},f=document.createElement("input");f.type="text";let e0=q1(""),R=document.createElement("textarea"),G0=q1(""),h=M("div","meta"),{context:x0}=Z,z1=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,D0=(q,C)=>{let D=document.createElement("div"),S=document.createElement("b");S.textContent=`${q}: `;let k=document.createTextNode(C);return D.append(S,k),h.append(D),{b:S,v:k}};D0(J.reporter,`${x0.user.fullName??"—"} (${x0.user.email??"—"})`),D0(J.page,x0.route.href);let J0=D0(J.captured,z1),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 B0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[M("p","status",J.noScreenshot)],U0=Z.screenshotDataUrl?B0[0]:null;if(!Z.screenshotDataUrl)s.replaceChildren();let $0=M("p","status",""),j0=d(J.submit,"primary"),o=()=>{j0.disabled=f.value.trim().length===0||Y==="request"&&!P};f.addEventListener("input",o);let X=()=>{let q=Y==="request";if(B.textContent=q?J.requestTitle:J.title,V.setAttribute("aria-label",q?J.requestTitle:J.title),x.textContent=`${q?J.problemInstead:J.askInstead} `,v.textContent=q?U?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,c.hidden=!q,F1(e0,q?J.requestSummaryLabel:J.summaryLabel,q?"":J.summaryRequired,!0),f.placeholder=q?J.requestSummaryPlaceholder:J.summaryPlaceholder,F1(G0,q?J.requestDetailLabel:J.detailLabel),R.placeholder=q?J.requestDetailPlaceholder:J.detailPlaceholder,J0.b.textContent=`${q?J.requestLeaves:J.captured}: `,J0.v.textContent=q?J.requestLeavesWhat:z1,s.hidden=!q||!Z.screenshotDataUrl,U0)F1(U0,q?J.requestAnnotateHint:J.annotateHint);for(let C of B0)C.classList.toggle("dropped",q&&!l.checked),C.hidden=q&&!Z.screenshotDataUrl;j0.textContent=q?J.requestSubmit:J.submit,o()};l.addEventListener("change",X);let K=(q)=>{if(q===Y)return;if(q==="problem"&&!U){this.switchToReport(J,$,{title:f.value,detail:R.value,asking:!1,typeId:P?.id??null});return}Y=q,X()},G=(q)=>{if(this.bundle!==Z||$.type!=="manual"||!q.length)return;P=q[0],w.length=0;for(let D of q){let S=d("","type");S.setAttribute("role","radio"),S.dataset.requestType=D.id;let k=M("span","type-body");if(k.append(M("b","",D.name)),D.description)k.append(M("span","type-hint",D.description));if(D.targetHours){let M0=M("span","type-due");M0.append(D1(O5),document.createTextNode(J.requestTarget.replace("{time}",I5(J,D.targetHours)))),k.append(M0)}S.append(D1(f4),k),S.addEventListener("click",()=>{P=D,n(),o()}),w.push(S)}_.replaceChildren(...w),_.onkeydown=(D)=>{if(!E4.includes(D.key)||!P)return;D.preventDefault();let S=q.filter((H0,N6)=>!w[N6].hidden);if(!S.length)return;let k=S.findIndex((H0)=>H0.id===P.id),M0=D.key==="ArrowUp"||D.key==="ArrowLeft"?-1:1;P=S[k<0?0:(k+M0+S.length)%S.length],n(),w.find((H0)=>H0.dataset.requestType===P.id)?.focus()},_.classList.toggle("long",q.length>=l1),g.hidden=q.length<l1;let C=(D)=>{W0.hidden=q.length<l1||D===0,W0.textContent=J.requestTypeCount.replace("{n}",String(D))};C(q.length),g.oninput=()=>{let D=g.value.trim().toLowerCase(),S=null;if(q.forEach((k,M0)=>{let H0=!D||`${k.name} ${k.description}`.toLowerCase().includes(D);if(w[M0].hidden=!H0,H0&&!S)S=k}),F0.hidden=!!S,C(w.filter((k)=>!k.hidden).length),S&&P&&w[q.indexOf(P)].hidden)P=S;n(),o()},g.onkeydown=(D)=>{if(D.key==="ArrowDown"||D.key==="Enter")D.preventDefault(),w.find((S)=>S.dataset.requestType===P?.id&&!S.hidden)?.focus()},n(),T.hidden=!1,X()},W=Q??(X0&&(X0.title||X0.detail)?X0:null),H=M("p","draft");if(H.hidden=!W||!!Q,W){f.value=W.title,R.value=W.detail;let q=d(J.draftClear,"link");q.dataset.draftClear="",q.addEventListener("click",()=>{f.value="",R.value="",X0=null,H.hidden=!0,o(),f.focus()}),H.append(document.createTextNode(`${J.draftRestored} · `),q)}let F=p1(),I=(q)=>{if(G(q),Y!=="request"||T.hidden||!W?.typeId)return;let C=q.find((D)=>D.id===W.typeId);if(C)P=C,n()};if(F)I(F);else if($.type==="manual")O0().then(I);this.keep=()=>({title:f.value,detail:R.value,asking:Y==="request",typeId:P?.id??null}),V.append(L,T,H,c,e0,f,G0,R,h,s,...B0);let b=M("div","foot"),r=d(J.close);r.addEventListener("click",()=>this.close()),b.append(r,$0,M("span","grow"),j0),V.append(b),X(),j0.addEventListener("click",async()=>{j0.disabled=!0,$0.dataset.tone="",$0.textContent=J.submitting;let q=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(Y==="request"&&P){let S=await O4({ticketTypeId:P.id,title:f.value.trim(),description:R.value,screenshotDataUrl:l.checked?q():null}),k=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:S,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),k)C0(`${J.requestSubmitted} — #${S.number}`,"success");return}let C=await I4(f.value.trim(),{...Z,note:R.value,screenshotDataUrl:q()}),D=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:C,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),D)C0(`${J.submitted} — #${C.number}`,"success")}catch(C){let D=D5(C,J);$0.dataset.tone="error",$0.textContent=D,C0(D,"error"),o()}}),f.focus()}screenshotSection(J,$){let j=q1(J.annotateHint),Q=M("div","tools"),Z=document.createElement("canvas"),V=M("div","shot");V.append(Z);let Y=[],U=(O)=>{for(let T of Y)T.setAttribute("aria-pressed",String(T===O))};for(let{tool:O,key:T}of M5){let x=d(J[T]);x.setAttribute("aria-pressed","false"),x.addEventListener("click",()=>{let v=x.getAttribute("aria-pressed")==="true";U(v?null:x),this.annotator?.setTool(v?null:O)}),Y.push(x),Q.append(x)}Q.append(M("span","sep"));let P=d(J.deleteSelected);P.addEventListener("click",()=>this.annotator?.deleteSelected());let L=d(J.clearAll);L.addEventListener("click",()=>{this.annotator?.clear(),U(null)}),Q.append(P,L);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=k4(Z,B,()=>{U(null),P.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,M("p","status",J.annotateHelp),V]}}}function c1(){try{return B5()}catch{return[]}}function M(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function I5(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var E4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],l1=7,C5=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],f4=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],O5=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],_5=[["path",{d:"M20 6 9 17l-5-5"}]],w4="http://www.w3.org/2000/svg";function b4(z,J,$,j){let Q=d("","kind");Q.dataset.kind=z;let Z=M("span","kind-top");return Z.append(D1(J),M("b","",$)),Q.append(Z,M("span","kind-hint",j),D1(_5,"tick")),Q}function D1(z,J="icon"){let $=document.createElementNS(w4,"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(w4,j);for(let[V,Y]of Object.entries(Q))Z.setAttribute(V,Y);$.append(Z)}return $}function d(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function q1(z,J="",$=!1){return F1(document.createElement("label"),z,J,$)}function F1(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 g4(){if(typeof window>"u"||customElements.get(d0))return;customElements.define(d0,N5())}var y4=138.23,k9=`
|
|
185
185
|
:host { all: initial; }
|
|
186
186
|
.backdrop {
|
|
187
187
|
position: fixed; inset: 0; z-index: 2147483002;
|
|
@@ -211,10 +211,10 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
|
|
|
211
211
|
.ring .track { stroke: #e2e8f0; }
|
|
212
212
|
.ring .bar {
|
|
213
213
|
stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
|
|
214
|
-
stroke-dasharray: ${
|
|
214
|
+
stroke-dasharray: ${y4}; stroke-dashoffset: 0;
|
|
215
215
|
animation: deplete var(--secs, 3s) linear forwards;
|
|
216
216
|
}
|
|
217
|
-
@keyframes deplete { to { stroke-dashoffset: ${
|
|
217
|
+
@keyframes deplete { to { stroke-dashoffset: ${y4}; } }
|
|
218
218
|
.count {
|
|
219
219
|
position: absolute; inset: 0; display: grid; place-items: center;
|
|
220
220
|
font-size: 18px; font-weight: 600; color: #0f172a;
|
|
@@ -258,46 +258,58 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
|
|
|
258
258
|
.ring .bar { animation: none; stroke-dashoffset: 0; }
|
|
259
259
|
.spinner { animation-duration: 2s; }
|
|
260
260
|
}
|
|
261
|
-
`;var
|
|
261
|
+
`;var S5="/sso";function L5(z,J,$,j){let Q=new URL(S5,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class o1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function R5(z){let J=N();if(!J.identity)throw new o1;let $=await J.identity();if(!$)throw new o1;return L5(J.host,J.realmKey,$,z)}var v4=R5;var A5="lw-call-ring",T5=`
|
|
262
262
|
:host { all: initial; }
|
|
263
263
|
.card {
|
|
264
264
|
position: fixed; right: 16px; bottom: 16px; z-index: 2147483002;
|
|
265
|
-
width: min(
|
|
266
|
-
padding: 16px; border-radius: 16px; background: #fff; color: #
|
|
267
|
-
border: 1px solid #
|
|
268
|
-
font-family:
|
|
265
|
+
width: min(352px, calc(100vw - 32px)); box-sizing: border-box;
|
|
266
|
+
padding: 16px; border-radius: 16px; background: #fff; color: #1a1a1e;
|
|
267
|
+
border: 1px solid #e8e8ec; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
268
|
+
font-family: "Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
|
|
269
269
|
animation: in 200ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
270
270
|
}
|
|
271
|
-
@media (max-width:
|
|
271
|
+
@media (max-width: 639px) { .card { right: 8px; left: 8px; bottom: 8px; width: auto; } }
|
|
272
272
|
.head { display: flex; align-items: center; gap: 12px; }
|
|
273
273
|
.icon {
|
|
274
|
-
position: relative; flex: none; width:
|
|
275
|
-
display: grid; place-items: center; background:
|
|
274
|
+
position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%;
|
|
275
|
+
display: grid; place-items: center; background: rgba(0, 70, 143, 0.1); color: #00468f;
|
|
276
276
|
}
|
|
277
277
|
.icon::after {
|
|
278
278
|
content: ""; position: absolute; inset: 0; border-radius: 50%;
|
|
279
|
-
background: rgba(
|
|
279
|
+
background: rgba(0, 70, 143, 0.2); animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
|
|
280
280
|
}
|
|
281
281
|
.icon svg { position: relative; width: 20px; height: 20px; }
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
.
|
|
285
|
-
.how
|
|
286
|
-
.
|
|
282
|
+
.words { min-width: 0; }
|
|
283
|
+
h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #1a1a1e; }
|
|
284
|
+
.about { margin: 0; font-size: 12px; line-height: 1.5; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
285
|
+
.how { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: #6b7280; }
|
|
286
|
+
.how a { color: #00468f; font-weight: 600; }
|
|
287
|
+
.test {
|
|
288
|
+
margin: 6px 0 0; padding: 0; border: 0; background: none; cursor: pointer;
|
|
289
|
+
display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 12px; font-weight: 500; color: #00468f;
|
|
290
|
+
}
|
|
291
|
+
.test:hover { text-decoration: underline; text-underline-offset: 2px; }
|
|
292
|
+
.test svg { width: 14px; height: 14px; }
|
|
293
|
+
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
|
|
294
|
+
.actions.one { grid-template-columns: 1fr; }
|
|
287
295
|
.actions button {
|
|
288
|
-
|
|
289
|
-
height:
|
|
296
|
+
box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
|
297
|
+
height: 44px; padding: 0 12px; border: none; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; color: #fff;
|
|
290
298
|
}
|
|
291
|
-
.
|
|
292
|
-
.
|
|
293
|
-
.
|
|
294
|
-
.
|
|
295
|
-
.
|
|
296
|
-
.
|
|
299
|
+
.actions button svg { width: 16px; height: 16px; }
|
|
300
|
+
.actions button:disabled { opacity: 0.6; cursor: default; }
|
|
301
|
+
.decline { background: #f44336; }
|
|
302
|
+
.decline:hover:not(:disabled) { background: #dd3a2f; }
|
|
303
|
+
.open, .answer { background: #059669; }
|
|
304
|
+
.open:hover, .answer:hover:not(:disabled) { background: #04875f; }
|
|
305
|
+
.close { border: 1px solid #e8e8ec !important; background: #fff; color: #1a1a1e !important; }
|
|
306
|
+
.spin { animation: spin 0.9s linear infinite; }
|
|
307
|
+
.actions button:focus-visible, .test:focus-visible { outline: 2px solid #00468f; outline-offset: 2px; }
|
|
297
308
|
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
|
|
298
|
-
@keyframes ping {
|
|
299
|
-
@
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
|
|
310
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
311
|
+
@media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } .spin { animation: none; } }
|
|
312
|
+
`,M1=(z)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${z}</svg>`,h4=M1('<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"/>'),k5=M1('<path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/><line x1="22" x2="2" y1="2" y2="22"/>'),x5=M1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),E5=M1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),E=null,e=null,_0=null;function f5(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var S0=()=>P0(N().locale);function w5(){if(typeof document>"u")return null;if(E?.isConnected)return E.shadowRoot;E=document.createElement(A5),E.dataset.debugReporter="true";let z=E.attachShadow({mode:"open"});return p0(z),document.body.append(E),z}function B1(z,J,$,j){let Q=document.createElement("button");return Q.type="button",Q.className=z,Q.innerHTML=J,Q.dataset.lwRing=$,Q.onclick=j,Q}var i0=(z)=>{let J=document.createElement("span");return J.textContent=z,J.outerHTML};function u4(z,J,$,j,Q){let Z=S0();z.innerHTML="";let V=document.createElement("style");V.textContent=T5;let Y=document.createElement("div");Y.className="card",Y.setAttribute("role","alertdialog"),Y.setAttribute("aria-label",Z.ringTitle),Y.dataset.lwCallRing=J.id,Y.dataset.lwRingMode=j;let U=document.createElement("div");U.className="head";let P=document.createElement("span");P.className="icon",P.innerHTML=h4;let L=document.createElement("div");L.className="words";let B=document.createElement("h2");B.textContent=Z.ringTitle;let O=document.createElement("p");O.className="about",O.textContent=f5(Z.ringAbout,J),O.title=O.textContent,L.append(B,O),U.append(P,L);let T=document.createElement("p");T.className="how",T.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let x=document.createElement("div");x.className="actions";let v=B1("decline",k5+i0(Z.ringDecline),"decline",()=>$.decline());if(Y.append(U,T),j==="frame"&&$.answer){if($.voice)Y.append(B1("test",x5+i0(Z.ringTest),"test",()=>$.voice?.()));let c=B1("answer",h4+i0(Z.ringAnswer),"answer",()=>$.answer?.());x.append(v,c)}else x.append(v,B1("open",i0(Z.ringOpen),"open",()=>$.open()));Y.append(x),z.append(V,Y)}function N1(z,J,$="portal"){if(e===z.id&&E?.isConnected)return;let j=w5();if(!j)return;if(e=z.id,u4(j,z,J,$),b5(),_0===null)_0=document.title,document.title=`${S0().ringTab} — ${_0}`}function p4(z){let J=E?.shadowRoot;if(!J||e!==z)return;let $=J.querySelector(".answer");if($)$.innerHTML=E5+i0(S0().ringAnswering),$.disabled=!0;let j=J.querySelector(".decline");if(j)j.disabled=!0}function d4(z,J){let $=E?.isConnected?E.shadowRoot:null;if(!$||e!==z.id)return N1(z,J,"portal");E.style.display="",u4($,z,J,"portal",S0().ringFallback)}function I1(z){let J=E?.shadowRoot;if(!J)return;n1(),l4();let $=S0(),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(()=>I1(),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=()=>L0(),Q.append(Z)}}function i4(z,J=!0){if(!E?.isConnected||e!==z)return;let $=E;if(clearTimeout(m4),!J){$.style.display="",$.style.opacity="";return}$.style.transition="opacity 150ms ease-out",$.style.opacity="0",m4=setTimeout(()=>{if($.style.opacity==="0")$.style.display="none"},160)}var m4;function L0(z){if(z&&e&&z!==e)return;n1(),l4(),E?.remove(),E=null,e=null}function c4(){return E?.isConnected?e:null}function l4(){if(_0===null||typeof document>"u")return;if(document.title.startsWith(S0().ringTab))document.title=_0;_0=null}var V0=null,r1;function b5(){n1();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=V0??new J;V0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!V0||V0.state!=="running")return;let j=V0.currentTime;for(let[Q,Z]of[660,880].entries()){let V=V0.createOscillator(),Y=V0.createGain();V.frequency.value=Z,Y.gain.setValueAtTime(0.0001,j+Q*0.22),Y.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),Y.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),V.connect(Y).connect(V0.destination),V.start(j+Q*0.22),V.stop(j+Q*0.22+0.21)}};$(),r1=setInterval($,2200)}function n1(){clearInterval(r1),r1=void 0}var g5=/^[A-Za-z0-9_-]{1,32}$/,y5=/^#[0-9a-fA-F]{6}$/,v5=["pen","rect","laser"],o4=(z)=>z<0?0:z>1?1:z;function r4(z,J){if(!Array.isArray(z)||z.length<J||z.length>64)return null;let $=[];for(let j of z){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([o4(Q),o4(Z)])}return $}function s4(z){if(!z||typeof z!=="object")return null;let J=z;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!g5.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let $=r4(J.pts,1);return $?{op:"add",id:J.id,pts:$}:null}if(J.op==="begin"){if(!v5.includes(J.kind)||typeof J.color!=="string"||!y5.test(J.color))return null;let $=r4(J.pts,1);return $?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:$}:null}return null}function s1(z,J){if(z.endedAt!==null)return z.endedAt;return J-z.lastAt>20000?z.lastAt:null}function n4(z,J,$){if(J===null)return 1;let j=$-J;if(z==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class a1{marks=new Map;apply(z,J=Date.now()){if(z.op==="clear"){this.marks.clear();return}if(z.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(z.id),this.marks.set(z.id,{kind:z.kind,color:z.color,pts:z.pts.map(([j,Q])=>({x:j,y:Q,t:J})),endedAt:null,lastAt:J});return}let $=this.marks.get(z.id);if(!$||s1($,J)!==null)return;if(z.op==="end"){$.endedAt=J;return}if($.lastAt=J,$.kind==="rect"){let[j,Q]=z.pts[z.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:J}];return}for(let[j,Q]of z.pts)$.pts.push({x:j,y:Q,t:J});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(z=Date.now()){for(let[J,$]of this.marks)if(n4($.kind,s1($,z),z)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw(z,J,$,j=Date.now()){z.clearRect(0,0,J,$);let Q=Math.max(1,Math.min(J,$));for(let Z of this.marks.values()){let V=n4(Z.kind,s1(Z,j),j);if(V<=0||!Z.pts.length)continue;if(z.save(),z.lineCap="round",z.lineJoin="round",Z.kind==="pen")m5(z,Z,J,$,Math.max(3,Q*0.0045),V);else if(Z.kind==="rect")u5(z,Z,J,$,Math.max(2.5,Q*0.003),V);else p5(z,Z,J,$,Math.max(6,Q*0.008),V,j);z.restore()}}}function h5(z,J,$,j){if(z.beginPath(),z.moveTo(J[0].x*$,J[0].y*j),J.length===1){z.lineTo(J[0].x*$+0.01,J[0].y*j);return}for(let Z=1;Z<J.length-1;Z++){let V=J[Z],Y=J[Z+1];z.quadraticCurveTo(V.x*$,V.y*j,(V.x+Y.x)/2*$,(V.y+Y.y)/2*j)}let Q=J[J.length-1];z.lineTo(Q.x*$,Q.y*j)}function m5(z,J,$,j,Q,Z){z.globalAlpha=Z,h5(z,J.pts,$,j),z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.stroke(),z.strokeStyle=J.color,z.lineWidth=Q,z.stroke()}function u5(z,J,$,j,Q,Z){let V=J.pts[0],Y=J.pts[J.pts.length-1],U=Math.min(V.x,Y.x)*$,P=Math.min(V.y,Y.y)*j,L=Math.abs(Y.x-V.x)*$,B=Math.abs(Y.y-V.y)*j;z.globalAlpha=Z,z.fillStyle=J.color,z.globalAlpha=Z*0.14,z.fillRect(U,P,L,B),z.globalAlpha=Z,z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.strokeRect(U,P,L,B),z.strokeStyle=J.color,z.lineWidth=Q,z.strokeRect(U,P,L,B)}function p5(z,J,$,j,Q,Z,V){let Y=J.pts.filter((P)=>V-P.t<=450);for(let P=1;P<Y.length;P++){let L=Y[P-1],B=Y[P];z.globalAlpha=Z*Math.max(0,1-(V-B.t)/450)*0.7,z.strokeStyle=J.color,z.lineWidth=Q*0.9,z.beginPath(),z.moveTo(L.x*$,L.y*j),z.lineTo(B.x*$,B.y*j),z.stroke()}let U=J.pts[J.pts.length-1];z.globalAlpha=Z,z.shadowColor=J.color,z.shadowBlur=Q*2,z.fillStyle=J.color,z.beginPath(),z.arc(U.x*$,U.y*j,Q,0,Math.PI*2),z.fill(),z.shadowBlur=0,z.strokeStyle="rgba(255,255,255,0.95)",z.lineWidth=2,z.stroke()}function d5(z,J,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(J*j)),Z=Math.max(1,Math.round($*j));if(z.width!==Q)z.width=Q;if(z.height!==Z)z.height=Z;let V=z.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class t1{canvas;scene;box;frame=0;constructor(z,J,$){this.canvas=z;this.scene=J;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let z=()=>{this.frame=0;let{w:J,h:$}=this.box(),j=d5(this.canvas,J,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,J,$,Q);if(Z)this.frame=requestAnimationFrame(z)};this.frame=requestAnimationFrame(z)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var i5="lw-call-ink",Y0=null,C1=null,c0=null;function c5(){if(Y0?.isConnected&&c0)return;Y0=document.createElement(i5),Y0.dataset.debugReporter="true";let z=Y0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
|
|
313
|
+
canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",z.append(J,$),document.body.append(Y0),C1=new a1,c0=new t1($,C1,()=>({w:window.innerWidth,h:window.innerHeight}))}function a4(z){if(typeof document>"u")return;if(z.op==="clear"&&!Y0)return;c5(),C1.apply(z),c0.kick()}function t4(){c0?.stop(),Y0?.remove(),Y0=null,C1=null,c0=null}var l5="lw-call-frame",o5="lw-call",u=16,$2=368,z0=null,A=null,q0=null,S1="",o0=null,r0="card",j2={width:$2,height:0},Q2,n0=!1,Z2=null,A0={answer:!1,voice:!1},K0=null,y=null,e1="lw-call-frame-place";function e4(z,J,$,j){let Q=new URL("embed/call",z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),$)Q.searchParams.set("token",$);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function R0(z){A?.contentWindow?.postMessage({source:"lw-call-host",...z},S1)}function z6(z){if(q0!==z)return;if(A0.answer=!0,n0)R0({type:"answer"})}function J6(z){if(q0!==z)return;if(A0.voice=!0,n0)R0({type:"voice"})}function $6(z,J,$){return{x:Math.min(Math.max(z.x,u/2),Math.max(u/2,$.w-J.w-u/2)),y:Math.min(Math.max(z.y,u/2),Math.max(u/2,$.h-J.h-u/2))}}function r5(z,J){if(z.origin!==J.origin||z.source!==J.window)return null;let $=z.data;return $&&typeof $==="object"&&$.source===o5&&typeof $.type==="string"?$:null}function s0(){return z0?.isConnected?q0:null}function j6(z,J,$,j=15000,Q=null){if(typeof document>"u")return;if(q0===J&&z0?.isConnected)return;a0(),q0=J,o0=$,n0=!1,Z2=Q,A0={answer:!1,voice:!1},r0="card",j2={width:$2,height:0},S1=new URL(z).origin;try{K0=JSON.parse(sessionStorage.getItem(e1)??"null")}catch{K0=null}z0=document.createElement(l5),z0.dataset.debugReporter="true";let Z=z0.attachShadow({mode:"open"}),V=document.createElement("style");V.textContent=`:host { all: initial; }
|
|
302
314
|
iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
|
|
303
|
-
iframe.on { visibility: visible; }`,
|
|
315
|
+
iframe.on { visibility: visible; }`,A=document.createElement("iframe"),A.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",A.title="สายจากทีมงาน",A.dataset.lwCallFrame=J,A.setAttribute("allowtransparency","true"),A.src=z,Z.append(V,A),document.body.append(z0),T0(),window.addEventListener("message",Q6),window.addEventListener("resize",T0),Z6(`lw-call:${J}`),Q2=setTimeout(()=>{if(!n0)z2("timeout")},j)}function a0(){if(z0)Z6(null);t4(),clearTimeout(Q2),window.removeEventListener("message",Q6),window.removeEventListener("resize",T0),O1(!1),z0?.remove(),z0=null,A=null,q0=null,o0=null,y=null,Z2=null,A0={answer:!1,voice:!1}}function z2(z){let J=o0;a0(),J?.failed(z)}function Q6(z){if(!A)return;let J=r5(z,{origin:S1,window:A.contentWindow});if(!J)return;switch(J.type){case"hello":Z2?.then(($)=>{if(!A||q0===null)return;if($)R0({type:"token",token:$});else z2("no_token")});return;case"ready":if(n0=!0,clearTimeout(Q2),A.classList.add("on"),o0?.ready(),A0.answer)R0({type:"answer"});if(A0.voice)R0({type:"voice"});return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")j2={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&r0==="card")n5();r0=J.layout}return T0();case"drag":return J2(J);case"home":return K0=null,X6(),T0();case"done":{let $=o0;a0(),$?.done();return}case"failed":return z2(J.reason??"failed");case"ink":{let $=s4(J.op);if($)a4($);return}}}function Z6(z){let J=typeof navigator>"u"?void 0:navigator.mediaDevices;try{J?.setCaptureHandleConfig?.(z?{handle:z,exposeOrigin:!1,permittedOrigins:[S1]}:{})}catch{}}function J2(z){if(!A||r0!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=A.getBoundingClientRect();y={sx:z.x,sy:z.y,x:J.left,y:J.top,lx:z.x,ly:z.y},O1(!0);return}if(!y)return;if(y.lx=z.x,y.ly=z.y,K0=$6({x:y.x+(z.x-y.sx),y:y.y+(z.y-y.sy)},V6(),_1()),T0(),z.phase==="end")y=null,O1(!1),X6()}var l0=null;function O1(z){if(l0){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,l0,!0);l0=null}if(!z)return;l0=(J)=>{if(!y)return O1(!1);if(J.type==="pointermove"&&J.buttons!==0)return J2({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let $=J.type==="pointerup";J2({type:"drag",phase:"end",x:$?J.screenX:y.lx,y:$?J.screenY:y.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,l0,!0)}function n5(){if(!A?.contentWindow)return;let z=A.getBoundingClientRect();R0({type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)})}function X6(){try{if(K0)sessionStorage.setItem(e1,JSON.stringify(K0));else sessionStorage.removeItem(e1)}catch{}}var _1=()=>({w:window.innerWidth,h:window.innerHeight});function V6(){let z=_1();return{w:Math.min($2,z.w-u),h:Math.min(j2.height||0,z.h-u)}}function T0(){if(!A)return;let z=A.style;if(r0==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=V6(),$=_1().w<480;if(z.width=$?`calc(100vw - ${u}px)`:`${J.w}px`,z.height=`${J.h}px`,K0&&!$){let j=$6(K0,J,_1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?`${u/2}px`:"",top:"",right:$?"":`${u/2}px`,bottom:`${u/2}px`})}var L1=[2000,5000,15000,30000,60000],s5=new Set(["ringing","active"]),a5=20000,Y6=!1,k0=!1,K6=0,t5=5,X2=null,q6=0,V2,W6,G6,F6=(z)=>z.endsWith("/")?z:`${z}/`;function e5(z,J){let $=new URL("api/presence/ws",F6(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function z3(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function J3(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function A1(){let z=N().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function W2(z,J){let $=N();return fetch(new URL(z,F6($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function G2(){if(Y6||typeof window>"u"||typeof WebSocket>"u")return;let z=N();if(!z.identity||z.ring===!1)return;Y6=!0,k0=!1,j3(z.host),D6()}function t0(z=!1){if(k0)return;let J=z?L1[L1.length-1]:L1[Math.min(q6++,L1.length-1)];clearTimeout(W6),W6=setTimeout(()=>void D6(),J)}async function D6(){if(k0)return;let z=await A1();if(!z){if(++K6>=t5){k0=!0;return}return t0(!0)}K6=0;let J;try{J=await W2("ingest/live-ticket",z)}catch{return t0()}if(J.status===401||J.status===404||J.status===403){k0=!0;return}if(!J.ok)return t0(J.status===429);let $;try{$=await J.json()}catch{return t0()}if(!$.calls||!$.ticket){k0=!0;return}if($.call)P6($.call);let j=new WebSocket(e5(N().host,$.ticket));X2=j,j.onopen=()=>{q6=0,clearInterval(V2),V2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},a5)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)P6(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(V2),X2===j)X2=null;t0()}}var Y2="lw-call-framed";function $3(){try{return sessionStorage.getItem(Y2)}catch{return null}}function R1(z){try{if(z)sessionStorage.setItem(Y2,z);else sessionStorage.removeItem(Y2)}catch{}}var U6=!1;function j3(z){if(U6||typeof document>"u")return;U6=!0;try{let J=new URL(z).origin;for(let $ of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=$,j.href=J,$==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function H6(z){let J=N();if(J.callFrame===!1||s0()===z.id)return;R1(z.id),j6(e4(J.host,J.realmKey,null,z.id),z.id,{ready:()=>i4(z.id),done:()=>{R1(null),L0(z.id)},failed:()=>{R1(null),d4(z,K2(z))}},15000,A1())}var K2=(z)=>({open:()=>Q3(z),decline:()=>void Z3(z)});function P6(z){if(!J3(z)){if(L0(z.id),z.status==="active"&&$3()===z.id&&!s0())H6(z);if(!s5.has(z.status)&&s0()===z.id)setTimeout(()=>{if(s0()===z.id)a0(),R1(null)},12000);return}if(N().callFrame===!1)N1(z,K2(z),"portal");else N1(z,{...K2(z),answer:()=>{p4(z.id),z6(z.id)},voice:()=>J6(z.id)},"frame"),H6(z);clearTimeout(G6);let J=new Date(z.ringUntil).getTime()-Date.now();G6=setTimeout(()=>{if(c4()===z.id)L0(z.id)},Math.max(5000,J+5000))}function Q3(z){let J=window.open("about:blank","_blank");(async()=>{let $=await A1();if($)W2(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await v4(z3(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}I1()}else I1(j)})()}async function Z3(z){L0(z.id);let J=await A1();if(J)await W2(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var B6=!1;function U2(z={}){if(B6||typeof window>"u")return;if(!J1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(B6=!0,J4(),w2(),A2(),l2(),X4(),z.ui===!1)return;let J=P0(N().locale);if(u2((j)=>{C0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>V1(j)})}),g4(),!document.querySelector(d0))document.body.append(document.createElement(d0));let $=window.requestIdleCallback;if($)$(()=>void O0(),{timeout:5000});else setTimeout(()=>void O0(),2000);if($)$(()=>G2(),{timeout:8000});else setTimeout(()=>G2(),3000)}var M6=document.currentScript,i=M6?.dataset??{},X3="rrweb-record.mjs";Z4(()=>import(new URL(X3,M6?.src??location.href).href));function V3(z){if(!z)return{};try{let J=JSON.parse(z);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(i.host&&i.realmKey)if(P2({host:i.host,realmKey:i.realmKey,app:{name:i.appName??document.title??"app",version:i.appVersion??"0.0.0",environment:i.environment??"production"},module:D2(V3(i.modules)),locale:i.locale==="en"?"en":"th",...i.replay!==void 0?{replay:{seconds:Number(i.replay)||void 0}}:{}}),document.body)U2();else document.addEventListener("DOMContentLoaded",()=>U2(),{once:!0});window.lwReportProblem=V1;})();
|