@lightworkai.official/debug-capture 0.17.1 → 0.17.3

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