@lightworkai.official/debug-capture 0.19.11 → 0.19.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var p3=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(J,Q)=>(typeof require<"u"?require:J)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});function d1($){if(!$)return null;let J=$===!0?{}:$,Q=(j,Z)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Z;return{side:J.position==="left"?"left":"right",x:Q(J.offset?.x,16),y:Q(J.offset?.y,16)}}var d3={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},Z0=null;function c3($){let J=[];if(!$.host?.trim())J.push("host");if(!$.realmKey?.trim())J.push("realmKey");if(!$.app?.name?.trim())J.push("app.name");if(typeof $.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.");Z0=$}function L(){if(!Z0)throw Error("[debug-capture] configureDebugCapture() has not been called");return Z0}function q1(){return Z0!==null}function P0(){let $=L().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??i3()}}function i3(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function S0($){let J=Z0?.capture?.[$];return typeof J==="number"?J:d3[$]}function c1($){let J=Z0?.module;if(!J)return null;try{return J($)??null}catch{return null}}function i1(){let $=Z0?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function $6(){return Z0?.capture?.overlaySelectors??[]}var l3='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',r3="[data-lw-mask]",e4={fps:1,quality:0.5};function F1(){let $=Z0?.replay;if(!$)return null;let J=$===!0?{}:$,Q=(X,V)=>typeof X==="number"&&X>0?X:V,j=J.maskInputs!==!1,Z=J.recordCanvas?{fps:Q(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,e4.fps),quality:Q(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,e4.quality)}:null;return{seconds:Q(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?l3:r3),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:Q(J.maxBytes,4000000),canvas:Z}}function J6($){if(typeof window>"u")return!1;let J;try{J=new URL($,window.location.href)}catch{return!1}if(o3(J))return!1;if(J.origin===window.location.origin)return!0;return(Z0?.capture?.bodyOrigins??[]).some((Q)=>{try{return new URL(Q).origin===J.origin}catch{return!1}})}function o3($){if(!Z0?.host)return!1;try{if(new URL(Z0.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function n3($){let J=Object.entries($).map(([Q,j])=>[Q.replace(/\/+$/,"")||"/",j]).sort((Q,j)=>j[0].length-Q[0].length);return(Q)=>{let j=(Q||"/").replace(/\/+$/,"")||"/";for(let[Z,X]of J)if(j===Z||j.startsWith(`${Z}/`))return{key:Z,label:X};return null}}var n0="‹redacted›",s3=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,a3=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),t3=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,e3=/[\w.+-]+@[\w-]+\.[\w.-]+/g,$5=/\d(?:[\d\s-]{7,})\d/g;function s0($){return $.replace(e3,n0).replace($5,n0)}function J5($){if(s3.test($))return!0;return i1().headers.some((Q)=>Q.toLowerCase()===$.toLowerCase())}function a0($){let J={};for(let[Q,j]of Object.entries($))J[Q]=J5(Q)?n0:j;return J}function _0($){try{let J=/^https?:\/\//i.test($),Q=new URL($,J?void 0:"http://local.invalid"),j=!1;if(Q.searchParams.forEach((Z,X)=>{if(a3.has(X.toLowerCase())||i1().queryKeys.includes(X.toLowerCase()))Q.searchParams.set(X,n0),j=!0}),!j)return $;return J?Q.toString():`${Q.pathname}${Q.search}`}catch{return $}}function y2($,J){if(J>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((j)=>y2(j,J+1));let Q={};for(let[j,Z]of Object.entries($)){let X=t3.test(j)||i1().bodyKeys.some((V)=>j.toLowerCase().includes(V));Q[j]=X?n0:y2(Z,J+1)}return Q}function t0($,J){if($==null)return null;let Q=$,j=$.trim();if(j.startsWith("{")||j.startsWith("["))try{let Z=JSON.parse(j);Q=JSON.stringify(y2(Z,0))}catch{}if(Q.length>J)return`${Q.slice(0,J)}… [truncated ${Q.length-J} chars]`;return Q}var g2=120,v2=40,$1=($,J)=>$.length>J?`${$.slice(0,J)}…`:$,b2=($)=>{try{return decodeURIComponent($)}catch{return $}},e0=[],Q6=0,j6=!1;function P1($,J,Q,j){let Z=$1(J,g2),X=e0[e0.length-1];if($==="navigate"&&X?.kind==="click"){let K=Z.replace(/^ไปที่\s*/,"");if(X.detail.includes(`→ ${K}`))return X.at=new Date().toISOString(),X;let Y=K.split(/[?#]/)[0]??K,W=X.source?b2(X.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(W&&(Y===W||Y.startsWith(W)))return X.detail=$1(`${X.detail} → ${K}`,g2),X.source=void 0,X.at=new Date().toISOString(),X}if(X&&X.kind===$&&X.detail===Z){if(X.at=new Date().toISOString(),$!=="navigate")X.count=(X.count??1)+1;return X}Q6+=1;let V={id:`act_${Q6}`,at:new Date().toISOString(),kind:$,detail:Z,count:1,source:Q,html:r1(j)};e0.push(V);while(e0.length>S0("maxActions"))j5(e0.shift());return V}var Q5=200000,B1=0;function r1($){if(!$)return;if(B1+$.length>Q5)return;return B1+=$.length,$}function j5($){if(!$)return;if(B1-=($.html?.length??0)+($.afterHtml?.length??0),B1<0)B1=0}function h2($){return $&&$>1?` (×${$})`:""}function l1($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var Z5='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',X5={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},Z6={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function V5($){let J=$.getAttribute("role");if(J&&Z6[J])return Z6[J];return X5[$.tagName.toLowerCase()]??"ปุ่ม"}function z5($,J){try{let Q=$,j=0;while(Q&&j<=J){let Z=W6(Q);if(Z&&typeof Z.memoizedProps?.onClick==="function")return Q;Q=Q.parentElement,j+=1}}catch{}return null}function K5($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("title")?.trim();if(Q)return Q;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLSelectElement)return($.getAttribute("placeholder")||$.getAttribute("name")||"").trim();if($ instanceof HTMLImageElement)return($.getAttribute("alt")||"").trim();let j=($.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if($ instanceof HTMLAnchorElement){let Z=$.getAttribute("href");if(Z?.startsWith("/"))return b2(Z)}return""}function Y5($){if(!($ instanceof Element))return null;let J=$.closest(Z5)??z5($,4);if(!J)return null;let Q=J.tagName.toLowerCase();if(Q==="html"||Q==="body")return null;return J}function W5($){let J=s0(K5($));if(!J)return null;return`${V5($)} “${$1(J,v2)}”`}var Y6=6000,G5=4000,D5=/(?:^|\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 U5($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Z)=>Z.remove());let J=[$,...Array.from($.querySelectorAll("*"))];for(let Z of J){for(let V of Array.from(Z.attributes)){let K=V.name.toLowerCase();if(K.startsWith("on")||K==="srcdoc"||K==="value"||K.startsWith("data-"))Z.removeAttribute(V.name)}if(Z instanceof HTMLAnchorElement)Z.setAttribute("href","#");if(Z instanceof HTMLImageElement)Z.removeAttribute("src");let X=Z.getAttribute("class");if(X){let V=X.replace(D5," ").replace(/\s+/g," ").trim();if(V)Z.setAttribute("class",V);else Z.removeAttribute("class")}}let Q=document.createTreeWalker($,NodeFilter.SHOW_TEXT),j=Q.nextNode();while(j){if(j.nodeValue)j.nodeValue=s0(j.nodeValue);j=Q.nextNode()}}function m2($,J,Q){try{let j=$.outerHTML;if(!j||j.length>J)return;let Z=$.cloneNode(!0);U5(Z);let X=Z.outerHTML;return X&&X.length<=Q?X:void 0}catch{return}}var H5=($)=>m2($,Y6,G5),q5=150000,F5=40000,X6=($)=>m2($,q5,F5);function P5($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let J=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${s0(J)}”`}var V6=80;function W6($){let J=Object.keys($).find((Q)=>Q.startsWith("__reactFiber$")||Q.startsWith("__reactInternalInstance$"));return J?$[J]:null}function B5($){if(typeof $!=="function")return null;try{let J=Function.prototype.toString.call($);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function z6($){if(!$)return;return`→ ${$.length>V6?`${$.slice(0,V6)}…`:$}`}function M5($){try{let J=$.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return z6(J);let Q=W6($),j=0;while(Q&&j<30){if(typeof Q.memoizedProps?.onClick==="function")return z6(B5(Q.memoizedProps.onClick));Q=Q.return,j+=1}return}catch{return}}var N5='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function _5(){let $=$6();return $.length?$.join(", "):N5}function C5($){let J=$.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function O5($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("aria-labelledby");if(Q){let X=Q.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(X)return X}let Z=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Z)return Z;return($.textContent??"").replace(/\s+/g," ").trim()}function G6($){let J=s0(O5($)),Q=C5($);return J?`เปิด ${Q} “${$1(J,v2)}”`:`เปิด ${Q}`}var I5='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',L5=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function R5($){if($.querySelector(I5))return!0;return L5.test($.textContent??"")}var S5=400,T5=250,A5=8000;function E5($,J){if(typeof MutationObserver>"u"){J.html=r1(X6($));return}let Q=Date.now(),j=!1,Z=()=>{j=!0,V.disconnect(),window.clearInterval(K),window.clearTimeout(Y)},X=()=>{if(j)return;if(Z(),!$.isConnected)return;J.detail=$1(G6($),g2),J.html=r1(X6($))},V=new MutationObserver(()=>{Q=Date.now()});V.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let K=window.setInterval(()=>{if(j)return;if(!$.isConnected){Z();return}if(Date.now()-Q>=S5&&!R5($))X()},T5),Y=window.setTimeout(X,A5)}function k5($){if(l1($))return;let J=P1("ui",G6($));if(J)E5($,J)}function x5(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((Q)=>{for(let j of Q)for(let Z of Array.from(j.addedNodes)){if(!(Z instanceof Element))continue;let X=_5(),V=Z.matches(X)?[Z]:Array.from(Z.querySelectorAll(X));for(let K of V){if($.has(K))continue;$.add(K),k5(K)}}}).observe(document.body,{childList:!0,subtree:!0})}var f5=1600,w5=2500;function K6($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:$1(($.textContent??"").replace(/\s+/g," ").trim(),v2)}}function y5($,J){if(!$.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function g5($,J){if(typeof MutationObserver>"u")return;let Q=K6($),j=!1,Z=(K,Y)=>{if(j)return;if(j=!0,X.disconnect(),window.clearTimeout(V),J.afterNote=K,Y)J.afterHtml=r1(m2($,Y6,w5))},X=new MutationObserver(()=>{if(!$.isConnected){Z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let K=y5(Q,K6($));if(K)Z(K,!0)});X.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!$.isConnected){Z("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,X.disconnect()},f5)}function D6(){if(j6||typeof window>"u")return;j6=!0,document.addEventListener("click",(j)=>{if(l1(j.target))return;let Z=Y5(j.target);if(!Z)return;let X=W5(Z);if(!X)return;let V=P1("click",`คลิก ${X}`,M5(Z),H5(Z));if(V)g5(Z,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(l1(j.target))return;let Z=P5(j.target);if(Z)P1("input",`แก้ไข ${Z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(l1(j.target))return;P1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>P1("navigate",`ไปที่ ${b2(_0(location.pathname+location.search))}`),J=history.pushState.bind(history),Q=history.replaceState.bind(history);history.pushState=(...j)=>{let Z=J(...j);return $(),Z},history.replaceState=(...j)=>{let Z=Q(...j);return $(),Z},window.addEventListener("popstate",$),x5()}function u2(){return e0.map(($)=>({...$}))}var U6=2000,o1=[],H6=0,q6=!1;function p2($,J){H6+=1,o1.push({id:`log_${H6}`,at:new Date().toISOString(),level:$,message:J.length>U6?`${J.slice(0,U6)}…`:J});while(o1.length>S0("maxConsoleEntries"))o1.shift()}function v5(){let $=new WeakSet;return(J,Q)=>{if(typeof Q==="object"&&Q!==null){if($.has(Q))return"[Circular]";$.add(Q)}if(typeof Q==="bigint")return Q.toString();return Q}}function F6($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let J=JSON.stringify($,v5());if(J!==void 0)return J}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function P6(){if(q6||typeof window>"u")return;q6=!0;let $=["log","info","warn","error","debug"];for(let J of $){let Q=console[J].bind(console);console[J]=(...j)=>{p2(J,j.map(F6).join(" ")),Q(...j)}}window.addEventListener("error",(J)=>{let Q=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";p2("exception",`${J.message}${Q}`)}),window.addEventListener("unhandledrejection",(J)=>{let Q=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:F6(J.reason);p2("unhandledrejection",Q)})}function d2(){return o1.map(($)=>({...$}))}var B6=new Set,M6=new Set;function N6($,J){return $.add(J),()=>$.delete(J)}function _6($,J){for(let Q of[...$])Q(J)}function c2($){return N6(B6,$)}function M1($={type:"manual"}){_6(B6,$)}function i2($){return N6(M6,$)}function l2($){_6(M6,$)}var b5=15000,h5=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],C6=!1,O6=0;function m5($){return h5.some((J)=>$.includes(J))}function I6($){let J=$.message??"";if(!J||m5(J))return;let Q=Date.now();if(Q-O6<b5)return;O6=Q,l2({...$,message:J})}function L6(){if(C6||typeof window>"u")return;C6=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let J=$.error instanceof Error?$.error:null;I6({type:"runtime-error",message:$.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",($)=>{let J=$.reason;I6({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var A6=4000,u5=1e6,p5=1e7,n1=[],R6=0,S6=!1;function E6($){n1.push($);while(n1.length>S0("maxRequests"))n1.shift()}function k6(){return R6+=1,`req_${R6}`}function T6($){let J={};if(!$)return J;if($ instanceof Headers)$.forEach((Q,j)=>{J[j]=Q});else if(Array.isArray($))for(let[Q,j]of $)J[Q]=j;else Object.assign(J,$);return J}function d5($){let J={};return $.forEach((Q,j)=>{J[j]=Q}),J}function c5($){if($==null)return null;if(typeof $==="string")return $;if($ instanceof URLSearchParams)return $.toString();if(typeof FormData<"u"&&$ instanceof FormData)return`[FormData: ${Array.from($.keys()).join(", ")}]`;if(typeof Blob<"u"&&$ instanceof Blob)return`[Blob ${$.size} bytes]`;if($ instanceof ArrayBuffer)return`[ArrayBuffer ${$.byteLength} bytes]`;return"[binary]"}function i5($,J){let Q="",j="GET",Z={},X=null;if(typeof $==="string")Q=$;else if($ instanceof URL)Q=$.toString();else Q=$.url,j=$.method||j,Z=T6($.headers);if(J){if(J.method)j=J.method;if(J.headers)Z={...Z,...T6(J.headers)};if(J.body!==void 0)X=c5(J.body)}return{method:j.toUpperCase(),url:Q,headers:Z,body:X}}function x6($){return!J6($)}function l5($,J){if(x6(J.url)){J.responseSnippet="[body not captured for this origin]";return}let Q=$.headers.get("content-type")??"",j=Number($.headers.get("content-length")??"0"),Z=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(Q)){J.responseSnippet=`[binary ${Q||"unknown"}${Z}]`;return}if(j>u5){J.responseSnippet=`[response ${Q||"text"}${Z} — omitted]`;return}try{$.clone().text().then((X)=>{J.responseSnippet=t0(X,S0("maxBodyChars"))}).catch(()=>{})}catch{}}function f6($,J){if(/[?&]_rsc=/.test($))return!0;for(let Q of Object.keys(J)){let j=Q.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function r5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(J,Q)=>{let j=i5(J,Q);if(f6(j.url,j.headers))return $(J,Q);let Z={id:k6(),startedAt:new Date().toISOString(),method:j.method,url:_0(j.url),requestHeaders:a0(j.headers),requestBody:t0(j.body,A6),status:null,statusText:null,durationMs:null,via:"fetch"};E6(Z);let X=performance.now();try{let V=await $(J,Q);return Z.status=V.status,Z.statusText=V.statusText,Z.durationMs=Math.round(performance.now()-X),Z.responseHeaders=a0(d5(V.headers)),l5(V,Z),V}catch(V){throw Z.durationMs=Math.round(performance.now()-X),Z.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},$)}function o5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,J=$.open,Q=$.send,j=function(X,V){let K=typeof V==="string"?V:V.toString();return this.__lwEntry=f6(K,{})?void 0:{id:k6(),startedAt:"",method:(X||"GET").toUpperCase(),url:_0(K),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Z=function(X){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof X==="string"?t0(X,A6):X==null?null:"[non-string body]";let K=performance.now();E6(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-K),x6(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=t0(this.responseText||"",S0("maxBodyChars"))}catch{}else{let Y=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${Y}]`}})}return Q.apply(this,arguments)};$.open=j,$.send=Z}function w6(){if(S6)return;S6=!0,r5(),o5()}function r2(){let $=n1.map((Q)=>({...Q})),J=0;for(let Q=$.length-1;Q>=0;Q-=1){let j=$[Q],Z=j?.responseSnippet;if(!j||typeof Z!=="string"||Z.length===0)continue;if(J+Z.length>p5)j.responseSnippet=`[response omitted — report size budget reached (${Z.length.toLocaleString()} chars)]`;else J+=Z.length}return $}var n5=4,y6=3,s5=4000,a5="[data-debug-reporter]",t5=()=>import("@rrweb/record");var X0=[],J1=null,s1=!1;function g6(){if(typeof window>"u"||J1||s1)return;let $=F1();if(!$)return;s1=!0;let J=()=>void e5($);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function e5($){let J;try{J=(await t5()).record}catch(Q){s1=!1,console.warn("[debug-capture] session replay could not start:",Q);return}if(J1)return;try{J1=J({emit:(Q)=>$9(Q),checkoutEveryNms:Math.max(1000,$.seconds*1000/2),checkoutEveryNth:s5,maskAllInputs:$.maskInputs,maskTextSelector:$.maskText?"*":$.maskTextSelector,blockSelector:`${$.blockSelector}, ${a5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...$.canvas?{canvas:$.canvas.fps}:{}},recordCanvas:$.canvas!==null,...$.canvas?{dataURLOptions:{type:"image/webp",quality:$.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(Q){console.warn("[debug-capture] session replay could not start:",Q)}finally{s1=!1}}function $9($){if($.type===n5||X0.length===0){if(X0.push([]),X0.length>y6)X0=X0.slice(-y6)}X0[X0.length-1].push($)}function o2($=Date.now()){let J=F1();if(!J||!X0.length)return null;let Q=$-J.seconds*1000,j=X0.length-1;while(j>0&&(X0[j][0]?.timestamp??$)>Q)j-=1;let Z=X0.slice(j).flat(),X=Z[0]?.timestamp,V=Z[Z.length-1]?.timestamp;if(X===void 0||V===void 0)return null;return{events:Z,startedAt:new Date(X).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-X)}}function J9(){return J1!==null}function Q9(){J1?.(),J1=null,X0=[]}var j9={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}",ringChat:"จากแชทกับทีมงาน",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก",chatOpen:"แชทกับทีมงาน",chatTitle:"แชทกับทีมงาน",chatUnread:"{n} ข้อความใหม่จากทีมงาน",chatMove:"แชทกับทีมงาน — ลากเพื่อย้ายไปที่อื่นได้ถ้าบังอะไรอยู่",chatLabel:"แชทกับทีมงาน",chatLabelNew:"มีข้อความใหม่จากทีมงาน"},Z9={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}",ringChat:"From your chat with support",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",chatOpen:"Chat with support",chatTitle:"Chat with support",chatUnread:"{n} new from support",chatMove:"Chat with support — drag to move it if it covers something",chatLabel:"Chat with us",chatLabelNew:"New message from support"};function $0($){return $==="en"?Z9:j9}var X9="lw-debug-toasts",V9=6000,z9=`
1
+ var p3=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(J,Q)=>(typeof require<"u"?require:J)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});function d1($){if(!$)return null;let J=$===!0?{}:$,Q=(j,Z)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Z;return{side:J.position==="left"?"left":"right",x:Q(J.offset?.x,16),y:Q(J.offset?.y,16)}}var d3={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},Z0=null;function c3($){let J=[];if(!$.host?.trim())J.push("host");if(!$.realmKey?.trim())J.push("realmKey");if(!$.app?.name?.trim())J.push("app.name");if(typeof $.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.");Z0=$}function L(){if(!Z0)throw Error("[debug-capture] configureDebugCapture() has not been called");return Z0}function q1(){return Z0!==null}function P0(){let $=L().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??i3()}}function i3(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function S0($){let J=Z0?.capture?.[$];return typeof J==="number"?J:d3[$]}function c1($){let J=Z0?.module;if(!J)return null;try{return J($)??null}catch{return null}}function i1(){let $=Z0?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function J6(){return Z0?.capture?.overlaySelectors??[]}var l3='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',r3="[data-lw-mask]",$6={fps:1,quality:0.5};function F1(){let $=Z0?.replay;if(!$)return null;let J=$===!0?{}:$,Q=(X,V)=>typeof X==="number"&&X>0?X:V,j=J.maskInputs!==!1,Z=J.recordCanvas?{fps:Q(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,$6.fps),quality:Q(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,$6.quality)}:null;return{seconds:Q(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?l3:r3),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:Q(J.maxBytes,4000000),canvas:Z}}function Q6($){if(typeof window>"u")return!1;let J;try{J=new URL($,window.location.href)}catch{return!1}if(o3(J))return!1;if(J.origin===window.location.origin)return!0;return(Z0?.capture?.bodyOrigins??[]).some((Q)=>{try{return new URL(Q).origin===J.origin}catch{return!1}})}function o3($){if(!Z0?.host)return!1;try{if(new URL(Z0.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function n3($){let J=Object.entries($).map(([Q,j])=>[Q.replace(/\/+$/,"")||"/",j]).sort((Q,j)=>j[0].length-Q[0].length);return(Q)=>{let j=(Q||"/").replace(/\/+$/,"")||"/";for(let[Z,X]of J)if(j===Z||j.startsWith(`${Z}/`))return{key:Z,label:X};return null}}var n0="‹redacted›",s3=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,a3=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),t3=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,e3=/[\w.+-]+@[\w-]+\.[\w.-]+/g,$5=/\d(?:[\d\s-]{7,})\d/g;function s0($){return $.replace(e3,n0).replace($5,n0)}function J5($){if(s3.test($))return!0;return i1().headers.some((Q)=>Q.toLowerCase()===$.toLowerCase())}function a0($){let J={};for(let[Q,j]of Object.entries($))J[Q]=J5(Q)?n0:j;return J}function _0($){try{let J=/^https?:\/\//i.test($),Q=new URL($,J?void 0:"http://local.invalid"),j=!1;if(Q.searchParams.forEach((Z,X)=>{if(a3.has(X.toLowerCase())||i1().queryKeys.includes(X.toLowerCase()))Q.searchParams.set(X,n0),j=!0}),!j)return $;return J?Q.toString():`${Q.pathname}${Q.search}`}catch{return $}}function y2($,J){if(J>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((j)=>y2(j,J+1));let Q={};for(let[j,Z]of Object.entries($)){let X=t3.test(j)||i1().bodyKeys.some((V)=>j.toLowerCase().includes(V));Q[j]=X?n0:y2(Z,J+1)}return Q}function t0($,J){if($==null)return null;let Q=$,j=$.trim();if(j.startsWith("{")||j.startsWith("["))try{let Z=JSON.parse(j);Q=JSON.stringify(y2(Z,0))}catch{}if(Q.length>J)return`${Q.slice(0,J)}… [truncated ${Q.length-J} chars]`;return Q}var g2=120,v2=40,$1=($,J)=>$.length>J?`${$.slice(0,J)}…`:$,b2=($)=>{try{return decodeURIComponent($)}catch{return $}},e0=[],j6=0,Z6=!1;function P1($,J,Q,j){let Z=$1(J,g2),X=e0[e0.length-1];if($==="navigate"&&X?.kind==="click"){let K=Z.replace(/^ไปที่\s*/,"");if(X.detail.includes(`→ ${K}`))return X.at=new Date().toISOString(),X;let Y=K.split(/[?#]/)[0]??K,W=X.source?b2(X.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(W&&(Y===W||Y.startsWith(W)))return X.detail=$1(`${X.detail} → ${K}`,g2),X.source=void 0,X.at=new Date().toISOString(),X}if(X&&X.kind===$&&X.detail===Z){if(X.at=new Date().toISOString(),$!=="navigate")X.count=(X.count??1)+1;return X}j6+=1;let V={id:`act_${j6}`,at:new Date().toISOString(),kind:$,detail:Z,count:1,source:Q,html:r1(j)};e0.push(V);while(e0.length>S0("maxActions"))j5(e0.shift());return V}var Q5=200000,B1=0;function r1($){if(!$)return;if(B1+$.length>Q5)return;return B1+=$.length,$}function j5($){if(!$)return;if(B1-=($.html?.length??0)+($.afterHtml?.length??0),B1<0)B1=0}function h2($){return $&&$>1?` (×${$})`:""}function l1($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var Z5='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',X5={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},X6={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function V5($){let J=$.getAttribute("role");if(J&&X6[J])return X6[J];return X5[$.tagName.toLowerCase()]??"ปุ่ม"}function z5($,J){try{let Q=$,j=0;while(Q&&j<=J){let Z=G6(Q);if(Z&&typeof Z.memoizedProps?.onClick==="function")return Q;Q=Q.parentElement,j+=1}}catch{}return null}function K5($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("title")?.trim();if(Q)return Q;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLSelectElement)return($.getAttribute("placeholder")||$.getAttribute("name")||"").trim();if($ instanceof HTMLImageElement)return($.getAttribute("alt")||"").trim();let j=($.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if($ instanceof HTMLAnchorElement){let Z=$.getAttribute("href");if(Z?.startsWith("/"))return b2(Z)}return""}function Y5($){if(!($ instanceof Element))return null;let J=$.closest(Z5)??z5($,4);if(!J)return null;let Q=J.tagName.toLowerCase();if(Q==="html"||Q==="body")return null;return J}function W5($){let J=s0(K5($));if(!J)return null;return`${V5($)} “${$1(J,v2)}”`}var W6=6000,G5=4000,U5=/(?:^|\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 D5($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Z)=>Z.remove());let J=[$,...Array.from($.querySelectorAll("*"))];for(let Z of J){for(let V of Array.from(Z.attributes)){let K=V.name.toLowerCase();if(K.startsWith("on")||K==="srcdoc"||K==="value"||K.startsWith("data-"))Z.removeAttribute(V.name)}if(Z instanceof HTMLAnchorElement)Z.setAttribute("href","#");if(Z instanceof HTMLImageElement)Z.removeAttribute("src");let X=Z.getAttribute("class");if(X){let V=X.replace(U5," ").replace(/\s+/g," ").trim();if(V)Z.setAttribute("class",V);else Z.removeAttribute("class")}}let Q=document.createTreeWalker($,NodeFilter.SHOW_TEXT),j=Q.nextNode();while(j){if(j.nodeValue)j.nodeValue=s0(j.nodeValue);j=Q.nextNode()}}function m2($,J,Q){try{let j=$.outerHTML;if(!j||j.length>J)return;let Z=$.cloneNode(!0);D5(Z);let X=Z.outerHTML;return X&&X.length<=Q?X:void 0}catch{return}}var H5=($)=>m2($,W6,G5),q5=150000,F5=40000,V6=($)=>m2($,q5,F5);function P5($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let J=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${s0(J)}”`}var z6=80;function G6($){let J=Object.keys($).find((Q)=>Q.startsWith("__reactFiber$")||Q.startsWith("__reactInternalInstance$"));return J?$[J]:null}function B5($){if(typeof $!=="function")return null;try{let J=Function.prototype.toString.call($);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function K6($){if(!$)return;return`→ ${$.length>z6?`${$.slice(0,z6)}…`:$}`}function M5($){try{let J=$.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return K6(J);let Q=G6($),j=0;while(Q&&j<30){if(typeof Q.memoizedProps?.onClick==="function")return K6(B5(Q.memoizedProps.onClick));Q=Q.return,j+=1}return}catch{return}}var N5='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function _5(){let $=J6();return $.length?$.join(", "):N5}function C5($){let J=$.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function O5($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("aria-labelledby");if(Q){let X=Q.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(X)return X}let Z=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Z)return Z;return($.textContent??"").replace(/\s+/g," ").trim()}function U6($){let J=s0(O5($)),Q=C5($);return J?`เปิด ${Q} “${$1(J,v2)}”`:`เปิด ${Q}`}var I5='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',L5=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function R5($){if($.querySelector(I5))return!0;return L5.test($.textContent??"")}var S5=400,T5=250,A5=8000;function E5($,J){if(typeof MutationObserver>"u"){J.html=r1(V6($));return}let Q=Date.now(),j=!1,Z=()=>{j=!0,V.disconnect(),window.clearInterval(K),window.clearTimeout(Y)},X=()=>{if(j)return;if(Z(),!$.isConnected)return;J.detail=$1(U6($),g2),J.html=r1(V6($))},V=new MutationObserver(()=>{Q=Date.now()});V.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let K=window.setInterval(()=>{if(j)return;if(!$.isConnected){Z();return}if(Date.now()-Q>=S5&&!R5($))X()},T5),Y=window.setTimeout(X,A5)}function k5($){if(l1($))return;let J=P1("ui",U6($));if(J)E5($,J)}function x5(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((Q)=>{for(let j of Q)for(let Z of Array.from(j.addedNodes)){if(!(Z instanceof Element))continue;let X=_5(),V=Z.matches(X)?[Z]:Array.from(Z.querySelectorAll(X));for(let K of V){if($.has(K))continue;$.add(K),k5(K)}}}).observe(document.body,{childList:!0,subtree:!0})}var f5=1600,w5=2500;function Y6($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:$1(($.textContent??"").replace(/\s+/g," ").trim(),v2)}}function y5($,J){if(!$.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function g5($,J){if(typeof MutationObserver>"u")return;let Q=Y6($),j=!1,Z=(K,Y)=>{if(j)return;if(j=!0,X.disconnect(),window.clearTimeout(V),J.afterNote=K,Y)J.afterHtml=r1(m2($,W6,w5))},X=new MutationObserver(()=>{if(!$.isConnected){Z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let K=y5(Q,Y6($));if(K)Z(K,!0)});X.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!$.isConnected){Z("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,X.disconnect()},f5)}function D6(){if(Z6||typeof window>"u")return;Z6=!0,document.addEventListener("click",(j)=>{if(l1(j.target))return;let Z=Y5(j.target);if(!Z)return;let X=W5(Z);if(!X)return;let V=P1("click",`คลิก ${X}`,M5(Z),H5(Z));if(V)g5(Z,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(l1(j.target))return;let Z=P5(j.target);if(Z)P1("input",`แก้ไข ${Z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(l1(j.target))return;P1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>P1("navigate",`ไปที่ ${b2(_0(location.pathname+location.search))}`),J=history.pushState.bind(history),Q=history.replaceState.bind(history);history.pushState=(...j)=>{let Z=J(...j);return $(),Z},history.replaceState=(...j)=>{let Z=Q(...j);return $(),Z},window.addEventListener("popstate",$),x5()}function u2(){return e0.map(($)=>({...$}))}var H6=2000,o1=[],q6=0,F6=!1;function p2($,J){q6+=1,o1.push({id:`log_${q6}`,at:new Date().toISOString(),level:$,message:J.length>H6?`${J.slice(0,H6)}…`:J});while(o1.length>S0("maxConsoleEntries"))o1.shift()}function v5(){let $=new WeakSet;return(J,Q)=>{if(typeof Q==="object"&&Q!==null){if($.has(Q))return"[Circular]";$.add(Q)}if(typeof Q==="bigint")return Q.toString();return Q}}function P6($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let J=JSON.stringify($,v5());if(J!==void 0)return J}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function B6(){if(F6||typeof window>"u")return;F6=!0;let $=["log","info","warn","error","debug"];for(let J of $){let Q=console[J].bind(console);console[J]=(...j)=>{p2(J,j.map(P6).join(" ")),Q(...j)}}window.addEventListener("error",(J)=>{let Q=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";p2("exception",`${J.message}${Q}`)}),window.addEventListener("unhandledrejection",(J)=>{let Q=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:P6(J.reason);p2("unhandledrejection",Q)})}function d2(){return o1.map(($)=>({...$}))}var M6=new Set,N6=new Set;function _6($,J){return $.add(J),()=>$.delete(J)}function C6($,J){for(let Q of[...$])Q(J)}function c2($){return _6(M6,$)}function M1($={type:"manual"}){C6(M6,$)}function i2($){return _6(N6,$)}function l2($){C6(N6,$)}var b5=15000,h5=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],O6=!1,I6=0;function m5($){return h5.some((J)=>$.includes(J))}function L6($){let J=$.message??"";if(!J||m5(J))return;let Q=Date.now();if(Q-I6<b5)return;I6=Q,l2({...$,message:J})}function R6(){if(O6||typeof window>"u")return;O6=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let J=$.error instanceof Error?$.error:null;L6({type:"runtime-error",message:$.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",($)=>{let J=$.reason;L6({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var E6=4000,u5=1e6,p5=1e7,n1=[],S6=0,T6=!1;function k6($){n1.push($);while(n1.length>S0("maxRequests"))n1.shift()}function x6(){return S6+=1,`req_${S6}`}function A6($){let J={};if(!$)return J;if($ instanceof Headers)$.forEach((Q,j)=>{J[j]=Q});else if(Array.isArray($))for(let[Q,j]of $)J[Q]=j;else Object.assign(J,$);return J}function d5($){let J={};return $.forEach((Q,j)=>{J[j]=Q}),J}function c5($){if($==null)return null;if(typeof $==="string")return $;if($ instanceof URLSearchParams)return $.toString();if(typeof FormData<"u"&&$ instanceof FormData)return`[FormData: ${Array.from($.keys()).join(", ")}]`;if(typeof Blob<"u"&&$ instanceof Blob)return`[Blob ${$.size} bytes]`;if($ instanceof ArrayBuffer)return`[ArrayBuffer ${$.byteLength} bytes]`;return"[binary]"}function i5($,J){let Q="",j="GET",Z={},X=null;if(typeof $==="string")Q=$;else if($ instanceof URL)Q=$.toString();else Q=$.url,j=$.method||j,Z=A6($.headers);if(J){if(J.method)j=J.method;if(J.headers)Z={...Z,...A6(J.headers)};if(J.body!==void 0)X=c5(J.body)}return{method:j.toUpperCase(),url:Q,headers:Z,body:X}}function f6($){return!Q6($)}function l5($,J){if(f6(J.url)){J.responseSnippet="[body not captured for this origin]";return}let Q=$.headers.get("content-type")??"",j=Number($.headers.get("content-length")??"0"),Z=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(Q)){J.responseSnippet=`[binary ${Q||"unknown"}${Z}]`;return}if(j>u5){J.responseSnippet=`[response ${Q||"text"}${Z} — omitted]`;return}try{$.clone().text().then((X)=>{J.responseSnippet=t0(X,S0("maxBodyChars"))}).catch(()=>{})}catch{}}function w6($,J){if(/[?&]_rsc=/.test($))return!0;for(let Q of Object.keys(J)){let j=Q.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function r5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(J,Q)=>{let j=i5(J,Q);if(w6(j.url,j.headers))return $(J,Q);let Z={id:x6(),startedAt:new Date().toISOString(),method:j.method,url:_0(j.url),requestHeaders:a0(j.headers),requestBody:t0(j.body,E6),status:null,statusText:null,durationMs:null,via:"fetch"};k6(Z);let X=performance.now();try{let V=await $(J,Q);return Z.status=V.status,Z.statusText=V.statusText,Z.durationMs=Math.round(performance.now()-X),Z.responseHeaders=a0(d5(V.headers)),l5(V,Z),V}catch(V){throw Z.durationMs=Math.round(performance.now()-X),Z.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},$)}function o5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,J=$.open,Q=$.send,j=function(X,V){let K=typeof V==="string"?V:V.toString();return this.__lwEntry=w6(K,{})?void 0:{id:x6(),startedAt:"",method:(X||"GET").toUpperCase(),url:_0(K),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Z=function(X){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof X==="string"?t0(X,E6):X==null?null:"[non-string body]";let K=performance.now();k6(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-K),f6(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=t0(this.responseText||"",S0("maxBodyChars"))}catch{}else{let Y=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${Y}]`}})}return Q.apply(this,arguments)};$.open=j,$.send=Z}function y6(){if(T6)return;T6=!0,r5(),o5()}function r2(){let $=n1.map((Q)=>({...Q})),J=0;for(let Q=$.length-1;Q>=0;Q-=1){let j=$[Q],Z=j?.responseSnippet;if(!j||typeof Z!=="string"||Z.length===0)continue;if(J+Z.length>p5)j.responseSnippet=`[response omitted — report size budget reached (${Z.length.toLocaleString()} chars)]`;else J+=Z.length}return $}var n5=4,g6=3,s5=4000,a5="[data-debug-reporter]",t5=()=>import("@rrweb/record");var X0=[],J1=null,s1=!1;function v6(){if(typeof window>"u"||J1||s1)return;let $=F1();if(!$)return;s1=!0;let J=()=>void e5($);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function e5($){let J;try{J=(await t5()).record}catch(Q){s1=!1,console.warn("[debug-capture] session replay could not start:",Q);return}if(J1)return;try{J1=J({emit:(Q)=>$9(Q),checkoutEveryNms:Math.max(1000,$.seconds*1000/2),checkoutEveryNth:s5,maskAllInputs:$.maskInputs,maskTextSelector:$.maskText?"*":$.maskTextSelector,blockSelector:`${$.blockSelector}, ${a5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...$.canvas?{canvas:$.canvas.fps}:{}},recordCanvas:$.canvas!==null,...$.canvas?{dataURLOptions:{type:"image/webp",quality:$.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(Q){console.warn("[debug-capture] session replay could not start:",Q)}finally{s1=!1}}function $9($){if($.type===n5||X0.length===0){if(X0.push([]),X0.length>g6)X0=X0.slice(-g6)}X0[X0.length-1].push($)}function o2($=Date.now()){let J=F1();if(!J||!X0.length)return null;let Q=$-J.seconds*1000,j=X0.length-1;while(j>0&&(X0[j][0]?.timestamp??$)>Q)j-=1;let Z=X0.slice(j).flat(),X=Z[0]?.timestamp,V=Z[Z.length-1]?.timestamp;if(X===void 0||V===void 0)return null;return{events:Z,startedAt:new Date(X).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-X)}}function J9(){return J1!==null}function Q9(){J1?.(),J1=null,X0=[]}var j9={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}",ringChat:"จากแชทกับทีมงาน",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก",chatOpen:"แชทกับทีมงาน",chatTitle:"แชทกับทีมงาน",chatUnread:"{n} ข้อความใหม่จากทีมงาน",chatMove:"แชทกับทีมงาน — ลากเพื่อย้ายไปที่อื่นได้ถ้าบังอะไรอยู่",chatLabel:"แชทกับทีมงาน",chatLabelNew:"มีข้อความใหม่จากทีมงาน"},Z9={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}",ringChat:"From your chat with support",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",chatOpen:"Chat with support",chatTitle:"Chat with support",chatUnread:"{n} new from support",chatMove:"Chat with support — drag to move it if it covers something",chatLabel:"Chat with us",chatLabelNew:"New message from support"};function $0($){return $==="en"?Z9:j9}var X9="lw-debug-toasts",V9=6000,z9=`
2
2
  :host { all: initial; }
3
3
  .stack {
4
4
  position: fixed; top: 16px; right: 16px; z-index: 2147483001;
@@ -30,15 +30,15 @@ var p3=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(J,Q)=
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
- `,n2=null;function K9(){if(typeof document>"u")return null;if(n2?.isConnected)return n2;let $=document.createElement(X9);$.dataset.debugReporter="true";let J=$.attachShadow({mode:"open"}),Q=document.createElement("style");Q.textContent=z9;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append(Q,j),document.body.append($),n2=j,j}function g0($,J="success",Q){let j=q1()?L().toast:void 0;if(j){j({message:$,tone:J,...Q?{action:Q}:{}});return}let Z=K9();if(!Z)return;let X=document.createElement("div");X.className="toast",X.dataset.tone=J;let V=document.createElement("span");V.className="dot";let K=document.createElement("span");K.textContent=$;let Y=document.createElement("button");Y.type="button",Y.className="close",Y.textContent="✕",Y.setAttribute("aria-label","ปิด");let W=()=>{window.clearTimeout(N),X.remove()};Y.addEventListener("click",W);let N=J==="error"||Q?0:window.setTimeout(W,V9);if(X.append(V,K),Q){let F=document.createElement("button");F.type="button",F.className="action",F.textContent=Q.label,F.addEventListener("click",()=>{W(),Q.onClick()}),X.append(F)}X.append(Y),Z.append(X)}function v6($,J,Q){let j=$.filter((X)=>Boolean(X.error)||X.status!=null&&X.status>=400).slice(-20).map((X)=>({method:X.method,url:X.url,status:X.status,error:X.error,at:X.startedAt})),Z=J.filter((X)=>X.level==="error"||X.level==="exception"||X.level==="unhandledrejection").slice(-20).map((X)=>X.message);return{failedRequests:j,errors:Z,erroredQueries:Q.slice(0,20)}}function b6($){return $.failedRequests.length+$.errors.length+$.erroredQueries.length}function Y9(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let J=performance.memory;if(J)$.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[Q]=performance.getEntriesByType("navigation");if(Q)$.domContentLoadedMs=Math.round(Q.domContentLoadedEventEnd),$.loadEventMs=Math.round(Q.loadEventEnd);return $}function s2($,J){if(!$)return J;try{return $()}catch{return J}}function h6(){let $=L(),{pathname:J,search:Q,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:Q},module:c1(J),user:s2($.user,{}),apiHeaders:a0(s2($.headers,{})),app:{name:P0().name,version:P0().version,environment:P0().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:Y9(),extra:s2($.extra,{})}}var W9=2,G9={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function N1($){let J=r2(),Q=d2();return{context:h6(),reason:$.reason,note:$.note,cause:v6(J,Q,$.erroredQueries),actionTrail:u2(),network:J,console:Q,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,replay:o2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:W9}}}function m6($){return $.replace(/'/g,"'\\''")}function u6($){let J=[`curl -X ${$.method} '${$.url}'`];for(let[Q,j]of Object.entries($.requestHeaders))J.push(` -H '${Q}: ${m6(j)}'`);if($.requestBody)J.push(` --data '${m6($.requestBody)}'`);return J.join(" \\\n")}function D9($){if($.error)return`ERR ${$.error}`;return`${$.status??"—"} ${$.statusText??""}`.trim()}function U9($){if($.length===0)return"No network activity captured.";return $.map((J)=>{let Q=J.durationMs!=null?`${J.durationMs}ms`:"—",j=`# [${D9(J)}] ${J.method} ${J.url} (${Q}, ${J.startedAt})`,Z=J.responseSnippet?`
33
+ `,n2=null;function K9(){if(typeof document>"u")return null;if(n2?.isConnected)return n2;let $=document.createElement(X9);$.dataset.debugReporter="true";let J=$.attachShadow({mode:"open"}),Q=document.createElement("style");Q.textContent=z9;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append(Q,j),document.body.append($),n2=j,j}function g0($,J="success",Q){let j=q1()?L().toast:void 0;if(j){j({message:$,tone:J,...Q?{action:Q}:{}});return}let Z=K9();if(!Z)return;let X=document.createElement("div");X.className="toast",X.dataset.tone=J;let V=document.createElement("span");V.className="dot";let K=document.createElement("span");K.textContent=$;let Y=document.createElement("button");Y.type="button",Y.className="close",Y.textContent="✕",Y.setAttribute("aria-label","ปิด");let W=()=>{window.clearTimeout(N),X.remove()};Y.addEventListener("click",W);let N=J==="error"||Q?0:window.setTimeout(W,V9);if(X.append(V,K),Q){let F=document.createElement("button");F.type="button",F.className="action",F.textContent=Q.label,F.addEventListener("click",()=>{W(),Q.onClick()}),X.append(F)}X.append(Y),Z.append(X)}function b6($,J,Q){let j=$.filter((X)=>Boolean(X.error)||X.status!=null&&X.status>=400).slice(-20).map((X)=>({method:X.method,url:X.url,status:X.status,error:X.error,at:X.startedAt})),Z=J.filter((X)=>X.level==="error"||X.level==="exception"||X.level==="unhandledrejection").slice(-20).map((X)=>X.message);return{failedRequests:j,errors:Z,erroredQueries:Q.slice(0,20)}}function h6($){return $.failedRequests.length+$.errors.length+$.erroredQueries.length}function Y9(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let J=performance.memory;if(J)$.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[Q]=performance.getEntriesByType("navigation");if(Q)$.domContentLoadedMs=Math.round(Q.domContentLoadedEventEnd),$.loadEventMs=Math.round(Q.loadEventEnd);return $}function s2($,J){if(!$)return J;try{return $()}catch{return J}}function m6(){let $=L(),{pathname:J,search:Q,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:Q},module:c1(J),user:s2($.user,{}),apiHeaders:a0(s2($.headers,{})),app:{name:P0().name,version:P0().version,environment:P0().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:Y9(),extra:s2($.extra,{})}}var W9=2,G9={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function N1($){let J=r2(),Q=d2();return{context:m6(),reason:$.reason,note:$.note,cause:b6(J,Q,$.erroredQueries),actionTrail:u2(),network:J,console:Q,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,replay:o2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:W9}}}function u6($){return $.replace(/'/g,"'\\''")}function p6($){let J=[`curl -X ${$.method} '${$.url}'`];for(let[Q,j]of Object.entries($.requestHeaders))J.push(` -H '${Q}: ${u6(j)}'`);if($.requestBody)J.push(` --data '${u6($.requestBody)}'`);return J.join(" \\\n")}function U9($){if($.error)return`ERR ${$.error}`;return`${$.status??"—"} ${$.statusText??""}`.trim()}function D9($){if($.length===0)return"No network activity captured.";return $.map((J)=>{let Q=J.durationMs!=null?`${J.durationMs}ms`:"—",j=`# [${U9(J)}] ${J.method} ${J.url} (${Q}, ${J.startedAt})`,Z=J.responseSnippet?`
34
34
  # response: ${J.responseSnippet}`:"";return`${j}
35
- ${u6(J)}${Z}`}).join(`
35
+ ${p6(J)}${Z}`}).join(`
36
36
 
37
37
  `)}function H9($){if($.length===0)return"No console output captured.";return $.map((J)=>`[${J.at}] ${J.level.toUpperCase()}: ${J.message}`).join(`
38
38
  `)}function q9($){if($.length===0)return"No user actions captured.";let J=0;return $.map((Q)=>{let j=Q.source?` (${Q.source})`:"",Z=`${Q.detail}${h2(Q.count)}${j}`;if(Q.kind==="ui")return` ↳ [${Q.at}] ${Z}`;J+=1;let X=`${J}. [${Q.at}] ${Z}`;return Q.afterNote?`${X}
39
39
  ↳ ${Q.afterNote}`:X}).join(`
40
- `)}function F9($){let J=[];for(let Q of $.failedRequests)J.push(`✗ ${Q.status??Q.error??"ERR"} ${Q.method} ${Q.url}`);for(let Q of $.errors)J.push(`⚠ ${Q}`);for(let Q of $.erroredQueries)J.push(`⚠ React Query error: ${Q.key} — ${Q.error}`);return J}function P9($){let{context:J}=$;return[`User : ${J.user.fullName??"—"} (${J.user.email??"—"})`,`Unit : ${J.user.unit??"—"}`,`Roles : ${J.user.roles?.join(", ")||"—"}`,`Route : ${J.route.href}`,`Module : ${J.module?`${J.module.label} (${J.module.key})`:"—"}`,`App : ${J.app.name} v${J.app.version} · ${J.app.environment}`,`Memory : ${J.performance.memoryUsedMb??"—"}/${J.performance.memoryLimitMb??"—"} MB`,`Client : ${J.client.userAgent}`,`Viewport : ${J.client.viewport.width}×${J.client.viewport.height} @${J.client.viewport.dpr}x`,`Reason : ${G9[$.reason.type]}${$.reason.message?` — ${$.reason.message}`:""}`,`Captured : ${$.network.length} requests · ${$.console.length} console · ${$.actionTrail.length} actions · screenshot=${$.screenshotMethod}${$.replay?` · replay=${Math.round($.replay.durationMs/1000)}s`:""}`]}function B9($){let J=F9($.cause),Q=[`## \uD83D\uDC1E ${$.context.app.name} — Debug Report`,`**Generated:** ${$.context.capturedAt}`,"",...P9($).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${$.note.trim()||"(ไม่มี)"}`];if(J.length>0)Q.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...J,"```");return Q.push("",`<details><summary>ขั้นตอน (${$.actionTrail.length})</summary>`,"","```",q9($.actionTrail),"```","</details>","",`<details><summary>Network (${$.network.length})</summary>`,"","```",U9($.network),"```","</details>","",`<details><summary>Console (${$.console.length})</summary>`,"","```",H9($.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),Q.join(`
41
- `)}function M9($){return $.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function N9($,J){return`debug-report_${M9($.context.capturedAt)}.${J}`}function _9($){return b6($.cause)>0}async function a1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let Q=await C9();if(Q.status==="ok")return{dataUrl:Q.dataUrl,method:"display-media"};if(Q.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await L9();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function C9(){let $=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(J);let Q=await O9($);return Q?{status:"ok",dataUrl:Q}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((J)=>J.stop())}}async function O9($){let J=document.createElement("video");J.srcObject=$,J.muted=!0,J.playsInline=!0,await new Promise((V)=>{let K=!1,Y=()=>{if(K)return;K=!0,V()};J.onloadedmetadata=()=>{J.play().then(Y).catch(Y)},window.setTimeout(Y,1500)}),await I9(J);let{videoWidth:Q,videoHeight:j}=J;if(!Q||!j)return null;let Z=document.createElement("canvas");Z.width=Q,Z.height=j;let X=Z.getContext("2d");if(!X)return null;X.drawImage(J,0,0,Q,j),J.pause(),J.srcObject=null;try{return Z.toDataURL("image/png")}catch{return null}}function I9($){return new Promise((J)=>{let Q=!1,j=()=>{if(Q)return;Q=!0,J()},Z=$;if(typeof Z.requestVideoFrameCallback==="function")Z.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function L9(){let $=L().screenshotFallback;if(!$)return null;let J=await $().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(Q)=>!(Q instanceof HTMLElement&&Q.dataset?.debugReporter==="true")})}catch{return null}}var R9=2000,S9=0.82,T9=3000000;function A9($){return new Promise((J,Q)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>Q(Error("could not read the screenshot")),j.src=$})}async function t1($){try{let J=await A9($),Q=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,R9/Q),Z=document.createElement("canvas");Z.width=Math.max(1,Math.round(J.naturalWidth*j)),Z.height=Math.max(1,Math.round(J.naturalHeight*j));let X=Z.getContext("2d");if(!X)return $;X.fillStyle="#fff",X.fillRect(0,0,Z.width,Z.height),X.drawImage(J,0,0,Z.width,Z.height);let V=S9,K=Z.toDataURL("image/jpeg",V);while(K.length>T9&&V>0.4)V-=0.15,K=Z.toDataURL("image/jpeg",V);return K}catch{return $}}var E9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,k9=/^\d+$/,x9=/^[0-9a-f]{16,}$/i;function a2($){if($.reason.type==="manual")return null;let J=$.cause?.failedRequests?.[0];if(!J?.url)return null;let Q;try{Q=new URL(J.url,"http://x").pathname}catch{Q=J.url}let j=Q.split("/").map((X)=>E9.test(X)||k9.test(X)||x9.test(X)?":id":X).join("/"),Z=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Z}`}var t2=2000000;function e1($){let{screenshotDataUrl:J,replay:Q,...j}=$;return JSON.stringify(j).length}function e2($,J=2000000){if(e1($)<=J)return $;let Q=$.network.map((Z)=>({...Z})),j={...$,network:Q};for(let Z of Q){if(e1(j)<=J)return j;if(typeof Z.responseSnippet==="string"&&Z.responseSnippet.length>35)Z.responseSnippet="[body dropped — report size budget]";if(typeof Z.requestBody==="string"&&Z.requestBody.length>35)Z.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&e1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&e1(j)>J)j.console=j.console.slice(1);return j}function v0($){let J="";for(let Q=0;Q<$.length;Q+=32768)J+=String.fromCharCode(...$.subarray(Q,Q+32768));return btoa(J)}var f9=4,w9=2,y9=3,g9=0,v9=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),b9=/^\s*javascript:/i;function h9($,J){let Q=$.toLowerCase();if(Q.startsWith("on")||Q==="srcdoc")return!0;return typeof J==="string"&&b9.test(J)}function p6($,J=!1){if(!$)return;for(let Q of Object.keys($)){let j=$[Q];if(h9(Q,j)){if(J)$[Q]=null;else delete $[Q];continue}if(typeof j!=="string"||!v9.has(Q)||!j.includes("?"))continue;$[Q]=_0(j)}}function $4($){if(!$)return;p6($.attributes);for(let J of $.childNodes??[])$4(J)}function d6($){let J=JSON.parse(JSON.stringify($));for(let Q of J){let j=Q.data;if(!j||typeof j!=="object")continue;if(Q.type===f9&&typeof j.href==="string")j.href=_0(j.href);else if(Q.type===w9)$4(j.node);else if(Q.type===y9&&j.source===g9){for(let Z of j.adds??[])$4(Z.node);for(let Z of j.attributes??[])p6(Z.attributes,!0)}}return J}var m9=30000,u9=2,c6=3,p9=0,d9=9,c9=/^data:([^;,]+);base64,/;function J4($,J){if(!$)return;let Q=$.attributes,j=Q?.rr_dataURL;if(Q&&typeof j==="string"){let Z=c9.exec(j);if(Z)J.push({picture:{type:Z[1],base64:j.slice(Z[0].length)},put:(X)=>Q.rr_dataURL=`data:${X.type};base64,${X.base64}`})}for(let Z of $.childNodes??[])J4(Z,J)}function i9($,J){if(!Array.isArray($))return;for(let Q of $)for(let j of Q.args??[]){let Z=j;if(Z?.rr_type!=="ImageBitmap")continue;let X=Z.args?.[0],V=X?.rr_type==="Blob"?X.data?.[0]:void 0;if(!X||V?.rr_type!=="ArrayBuffer"||typeof V.base64!=="string"||typeof X.type!=="string")continue;J.push({picture:{type:X.type,base64:V.base64},put:(K)=>{X.type=K.type,V.base64=K.base64}})}}function Q4($){let J=[];for(let Q of $){let j=Q.data;if(!j||typeof j!=="object")continue;if(Q.type===u9)J4(j.node,J);else if(Q.type===c6&&j.source===p9)for(let Z of j.adds??[])J4(Z.node,J);else if(Q.type===c6&&j.source===d9)i9(j.commands,J)}return J}function i6($){return Q4($).map((J)=>J.picture.base64)}var l6=($)=>$.picture.type==="image/png"&&$.picture.base64.length>=m9;function r6($){return Q4($).some(l6)}async function o6($,J){let Q=new Map,j=0;for(let Z of Q4($).filter(l6)){let X=Z.picture.base64;if(!Q.has(X)){let K=null;try{K=await J(Z.picture)}catch{K=null}Q.set(X,K&&K.base64.length<X.length?K:null)}let V=Q.get(X);if(V)Z.put(V),j+=1}return j}function l9($){let J=atob($),Q=new Uint8Array(J.length);for(let j=0;j<J.length;j++)Q[j]=J.charCodeAt(j);return Q}function r9($,J){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas($,J);if(typeof document>"u")return null;let Q=document.createElement("canvas");return Q.width=$,Q.height=J,Q}function o9($,J){if("convertToBlob"in $)return $.convertToBlob({type:"image/jpeg",quality:J});return new Promise((Q)=>$.toBlob(Q,"image/jpeg",J))}function n6($){if(typeof createImageBitmap!=="function"||typeof OffscreenCanvas>"u"&&typeof document>"u")return null;return async({base64:J,type:Q})=>{let j=await createImageBitmap(new Blob([l9(J)],{type:Q}));try{let{width:Z,height:X}=j,V=r9(Z,X),K=V?.getContext("2d",{willReadFrequently:!0});if(!V||!K)return null;K.drawImage(j,0,0);let Y=K.getImageData(0,0,Z,X).data;for(let N=3;N<Y.length;N+=4)if(Y[N]!==255)return null;let W=await o9(V,$);if(!W||W.type!=="image/jpeg")return null;return{base64:v0(new Uint8Array(await W.arrayBuffer())),type:"image/jpeg"}}finally{j.close()}}}var $8="session-replay.json.gz",n9="session-replay.json";function s9($){return Boolean($&&$.events.length>0)}async function J8($){if(typeof CompressionStream>"u")return null;try{let J=new Blob([$]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function _1($){let J=new TextEncoder().encode(JSON.stringify({events:$})),Q=await J8(J);return Q?{bytes:Q,compressed:!0}:{bytes:J,compressed:!1}}var s6=65536,a6=16;async function a9($){let J=i6($),Q=J.reduce((Y,W)=>Y+W.length,0);if(Q===0)return 0;let j=Math.max(1,Math.floor(J.length/a6)),Z="";for(let Y=0;Y<J.length&&Z.length<s6*a6;Y+=j)Z+=J[Y].slice(0,s6);let X=new TextEncoder().encode(Z),V=await J8(X),K=V?V.byteLength/X.byteLength:1;return Q*K*0.9}async function Z4($,J,Q={}){if(!s9($))return{summary:{omitted:"empty"}};let j=Math.round($.durationMs/1000),Z=d6($.events),X=await t9(Z,J,Q);if(!("events"in X))return{summary:{seconds:j,events:$.events.length,startedAt:$.startedAt,endedAt:$.endedAt,bytes:X.bytes,omitted:"too-large"}};let{bytes:V,compressed:K}=X.encoded,Y=X.events,W=Y[0].timestamp,N=Y[Y.length-1].timestamp,{trimmed:F,...R}=X.cuts,O=Date.parse($.endedAt);return{dataUri:`data:${K?"application/gzip":"application/json"};base64,${v0(V)}`,filename:K?$8:n9,summary:{seconds:Math.round((N-W)/1000),events:Y.length,startedAt:new Date(W).toISOString(),endedAt:new Date(N).toISOString(),bytes:V.byteLength,compressed:K,...R,...F?{recordedSeconds:j}:{},...F==="end"&&!Number.isNaN(O)?{endsEarlySeconds:Math.round((O-N)/1000)}:{}}}}async function t9($,J,Q){let j={},Z=0,X=async(O)=>{let P=await a9(O);if(P>J)return Z||=Math.round(P),null;let S=await _1(O);return Z||=S.bytes.byteLength,S.bytes.byteLength<=J?S:null},V=await X($);if(V)return{events:$,encoded:V,cuts:j};let K=Q.lighten===void 0?n6(Q.quality??0.5):Q.lighten;if(K&&r6($)&&await o6($,K)>0){if(V=await X($),V)return{events:$,encoded:V,cuts:j}}let Y=[...new Set($.filter(X8).map((O)=>O.timestamp))].sort((O,P)=>O-P);if(Y.length>1){let O=1,P=Y.length,S=null;while(O<P){let M=Math.floor((O+P)/2),U=Q7($,Y[M]),B=await X(U);if(B)S={events:U,encoded:B},P=M;else O=M+1}if(S)return{...S,cuts:{...j,canvasDropped:!0}}}if(j7($)){if(j.canvasDropped=!0,$=$.filter((O)=>!$2(O)),V=await X($),V)return{events:$,encoded:V,cuts:j}}if(V7($)){if(j.picturesDropped=!0,V=await X($),V)return{events:$,encoded:V,cuts:j}}let W=K7($);if(W.length>1){let O=[];for(let M of W)O.push((await _1(M)).bytes.byteLength);let P=W.length,S=0;while(P>0&&S+O[P-1]<=J)S+=O[--P];for(let M=Math.max(P,1);M<W.length;M++){let U=W.slice(M).flat();if(V=await _1(U),V.bytes.byteLength<=J)return{events:U,encoded:V,cuts:{...j,trimmed:"start"}}}}let N=W[W.length-1],F=await t6(N,J);if(!F&&z7(N))j.simplified=!0,F=await t6(N,J);if(!F)return{bytes:Z};let R=F.events.length<N.length?"end":W.length>1?"start":void 0;return{...F,cuts:{...j,...R?{trimmed:R}:{}}}}async function t6($,J){let Q=$.findIndex((X)=>X.type===X4)+1||1,j=$.length,Z={events:$.slice(0,Q),encoded:await _1($.slice(0,Q))};if(Z.encoded.bytes.byteLength>J)return null;while(Q<j){let X=Math.ceil((Q+j)/2),V=$.slice(0,X),K=await _1(V);if(K.bytes.byteLength<=J)Q=X,Z={events:V,encoded:K};else j=X-1}return Z}var e9=4,X4=2,Q8=3,$7=0,J7=9;function $2($){return $.type===Q8&&$.data?.source===J7}function j8($,J){let Q=$.data;if(!Q||typeof Q!=="object")return;if($.type===X4)J(Q.node);else if($.type===Q8&&Q.source===$7)for(let j of Q.adds??[])J(j.node)}function Z8($){if(!$)return!1;let J=!1;if($.attributes&&"rr_dataURL"in $.attributes)delete $.attributes.rr_dataURL,J=!0;for(let Q of $.childNodes??[])J=Z8(Q)||J;return J}function V4($){return!!$&&($.attributes!==void 0&&("rr_dataURL"in $.attributes)||($.childNodes??[]).some(V4))}function X8($){if($2($))return!0;let J=!1;return j8($,(Q)=>J||=V4(Q)),J}function j4($){if(!$||!V4($))return $;let{rr_dataURL:J,...Q}=$.attributes??{};return{...$,...$.attributes?{attributes:Q}:{},...$.childNodes?{childNodes:$.childNodes.map((j)=>j4(j))}:{}}}function Q7($,J){let Q=[];for(let j of $)if(j.timestamp>=J||!X8(j))Q.push(j);else if($2(j))continue;else if(j.type===X4){let Z=j.data;Q.push({...j,data:{...Z,node:j4(Z.node)}})}else{let Z=j.data;Q.push({...j,data:{...Z,adds:(Z.adds??[]).map((X)=>({...X,node:j4(X.node)}))}})}return Q}function j7($){let J=!1;for(let Q of $)if($2(Q))J=!0;else j8(Q,(j)=>J=Z8(j)||J);return J}var V8=16384,Z7="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",X7=new RegExp(`url\\(\\s*(['"]?)data:[^'")]{${V8},}\\1\\s*\\)`,"g");function z4($,J){if(!$||typeof $!=="object")return!1;let Q=!1,j=Array.isArray($)?$.map((Z,X)=>[X,Z]):Object.entries($);for(let[Z,X]of j)if(typeof X==="string"){let V=J(X);if(V!==X)$[Z]=V,Q=!0}else if(X&&typeof X==="object")Q=z4(X,J)||Q;return Q}function V7($){let J=!1;for(let Q of $)J=z4(Q.data,(j)=>{if(j.length<V8)return j;if(j.startsWith("data:"))return j.startsWith("data:image/")?Z7:"";return j.includes("data:")?j.replace(X7,"url()"):j})||J;return J}var e6=2000;function z7($){let J=!1;for(let Q of $)J=z4(Q.data,(j)=>j.length>e6?j.slice(0,e6):j)||J;return J}function K7($){let J=[[]],Q=!1;for(let j of $){if(j.type===e9){if(Q)J.push([]);Q=!0}J[J.length-1].push(j)}return J}var Y7=new Set([502,503,504]);class C0 extends Error{kind;retryAfter;status;constructor($,J,Q,j){super($);this.kind=J;this.retryAfter=Q;this.status=j;this.name="ReportError"}}function W7($){let{screenshotDataUrl:J,replay:Q,...j}=$;return{dataUri:`data:application/json;base64,${v0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function K4(){let $=L().identity;if(!$)return{};try{let J=await $();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function Y4($,J){let Q=L(),j=e2(J,t2),{context:Z,note:X}=j,V=[];if(j.screenshotDataUrl){let R=await t1(j.screenshotDataUrl);V.push({dataUri:R,filename:"screenshot.jpg"})}V.push(W7(j));let K,Y=F1();if(Y){let R=await Z4(j.replay,Y.maxBytes,{quality:Y.canvas?.quality});if(K=R.summary,"dataUri"in R)V.push({dataUri:R.dataUri,filename:R.filename})}let W=a2(j),N={title:$,description:X.trim()||void 0,appName:P0().name,category:Z.module?.label,routeUrl:Z.route.href,priority:"MEDIUM",requesterEmail:Z.user.email??void 0,requesterName:Z.user.fullName??void 0,customFields:{unit:Z.user.unit??"",appVersion:Z.app.version,environment:Z.app.environment,reasonType:j.reason.type,appName:P0().name,module:Z.module?.label??""},context:{...W?{signature:W}:{},capturedAt:Z.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Z.client,performance:Z.performance,apiHeaders:Z.apiHeaders,extra:Z.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...K?{replay:K}:{}},attachments:V,...j.reason.fromChat?{fromChat:!0}:{}},F=await fetch(`${Q.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,...await K4()},body:JSON.stringify(N)}).catch(()=>{throw new C0("report never left the browser","offline")});if(!F.ok)throw await W4(F);return await F.json()}async function W4($){let J=$.headers.get("retry-after"),Q=await $.json().then((j)=>j.error).catch(()=>null);if($.status===429)return new C0("rate limited","rateLimited",J??void 0);if(Y7.has($.status))return new C0("desk unavailable","unavailable");return new C0(Q??`Report failed (${$.status})`,"rejected",void 0,$.status)}var J2=null,C1=null,z8=()=>L().host.replace(/\/$/,"");function Q2(){return J2}function b0(){if(C1)return C1;return C1=(async()=>{try{let $=await fetch(`${z8()}/ingest/request-types`,{headers:{"x-realm-key":L().realmKey}}),J=$.ok?await $.json():null;J2=Array.isArray(J?.types)?J.types.filter(G7):[]}catch{J2=[],C1=null}return J2??[]})(),C1}function G7($){let J=$;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function G4($){let J=L(),Q={};try{Q=J.user?.()??{}}catch{Q={}}let j=typeof window>"u"?null:window.location,Z={title:$.title,description:$.description.trim()||void 0,ticketTypeId:$.ticketTypeId,appName:P0().name,category:j?c1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:Q.email??void 0,requesterName:Q.fullName??void 0,attachments:$.screenshotDataUrl?[{dataUri:await t1($.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},X=await fetch(`${z8()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await K4()},body:JSON.stringify(Z)}).catch(()=>{throw new C0("request never left the browser","offline")});if(!X.ok)throw await W4(X);return await X.json()}var O1=Math.PI/6;function K8($,J,Q){let j=J.x-$.x,Z=J.y-$.y,X=Math.hypot(j,Z),V=Math.atan2(Z,j),K=[{x:J.x,y:J.y},{x:J.x-Q*Math.cos(V-O1),y:J.y-Q*Math.sin(V-O1)},{x:J.x-Q*Math.cos(V+O1),y:J.y-Q*Math.sin(V+O1)}],Y=Q*Math.cos(O1)*0.92;if(X<=Y)return{shaft:null,head:K};return{shaft:{from:$,to:{x:J.x-Y*Math.cos(V),y:J.y-Y*Math.sin(V)}},head:K}}var D4="#f44336",D7="rgba(250, 204, 21, 0.4)",U4=22,Y8="#2563eb",W8=9,G8=11,D8=18,U8=4,j2=8,U7=[{id:"nw",fx:0,fy:0,cursor:"nwse-resize"},{id:"n",fx:0.5,fy:0,cursor:"ns-resize"},{id:"ne",fx:1,fy:0,cursor:"nesw-resize"},{id:"e",fx:1,fy:0.5,cursor:"ew-resize"},{id:"se",fx:1,fy:1,cursor:"nwse-resize"},{id:"s",fx:0.5,fy:1,cursor:"ns-resize"},{id:"sw",fx:0,fy:1,cursor:"nesw-resize"},{id:"w",fx:0,fy:0.5,cursor:"ew-resize"}];function H4($,J,Q){let j=[],Z=null,X=-1,V=null,K=null,Y=$.getContext("2d");function W(){let z=$.getBoundingClientRect().width;return z>0?$.width/z:1}function N(z){let G=$.getBoundingClientRect();return{x:(z.clientX-G.left)/G.width*$.width,y:(z.clientY-G.top)/G.height*$.height}}function F(z){let G=z.size??U4;if(!Y)return(z.text?.length??0)*G*0.6;Y.save(),Y.font=`600 ${G}px system-ui, sans-serif`;let H=Y.measureText(z.text??"").width;return Y.restore(),H}function R(z){if(z.tool==="text"){let G=z.size??U4;return{left:z.x1,top:z.y1,right:z.x1+F(z),bottom:z.y1+G*1.25}}return{left:Math.min(z.x1,z.x2),top:Math.min(z.y1,z.y2),right:Math.max(z.x1,z.x2),bottom:Math.max(z.y1,z.y2)}}function O(z){if(z.tool==="arrow")return[{id:"tail",x:z.x1,y:z.y1,cursor:"move"},{id:"head",x:z.x2,y:z.y2,cursor:"move"}];let G=R(z);if(z.tool==="text")return[{id:"size",x:G.right,y:G.bottom,cursor:"nwse-resize"}];return U7.map((H)=>({id:H.id,x:G.left+(G.right-G.left)*H.fx,y:G.top+(G.bottom-G.top)*H.fy,cursor:H.cursor}))}function P(z){let G=R(z);return{x:G.right+D8*W(),y:G.top-D8*W()}}function S(z,G,H){let{shaft:D,head:q}=K8({x:G.x1,y:G.y1},{x:G.x2,y:G.y2},Math.max(10,16*H));if(D)z.lineCap="butt",z.beginPath(),z.moveTo(D.from.x,D.from.y),z.lineTo(D.to.x,D.to.y),z.stroke();z.beginPath(),z.moveTo(q[0].x,q[0].y),z.lineTo(q[1].x,q[1].y),z.lineTo(q[2].x,q[2].y),z.closePath(),z.fill()}function M(z,G,H){z.save(),z.lineWidth=Math.max(2,3*H),z.strokeStyle=D4,z.fillStyle=D4;let D=R(G);if(G.tool==="rect")z.strokeRect(D.left,D.top,D.right-D.left,D.bottom-D.top);else if(G.tool==="arrow")S(z,G,H);else if(G.tool==="highlight")z.fillStyle=D7,z.fillRect(D.left,D.top,D.right-D.left,D.bottom-D.top);else if(G.tool==="text"&&G.text){let q=G.size??U4;z.font=`600 ${q}px system-ui, sans-serif`,z.textBaseline="top";let I=q*0.22;z.fillStyle="rgba(255,255,255,0.92)",z.fillRect(D.left-I,D.top-I,D.right-D.left+I*2,D.bottom-D.top+I*2),z.fillStyle=D4,z.fillText(G.text,D.left,D.top)}z.restore()}function U(z,G,H){let D=R(G);z.save(),z.strokeStyle=Y8,z.lineWidth=Math.max(1,1.5*H),z.setLineDash([6*H,4*H]),z.strokeRect(D.left,D.top,D.right-D.left,D.bottom-D.top),z.setLineDash([]);let q=W8*H;for(let e of O(G))z.fillStyle="#fff",z.strokeStyle=Y8,z.lineWidth=Math.max(1,1.5*H),z.beginPath(),z.rect(e.x-q/2,e.y-q/2,q,q),z.fill(),z.stroke();let I=P(G),v=G8*H;z.beginPath(),z.arc(I.x,I.y,v,0,Math.PI*2),z.fillStyle="#dc2626",z.fill(),z.strokeStyle="#fff",z.lineWidth=Math.max(1.5,2*H),z.beginPath(),z.moveTo(I.x-v*0.4,I.y-v*0.4),z.lineTo(I.x+v*0.4,I.y+v*0.4),z.moveTo(I.x+v*0.4,I.y-v*0.4),z.lineTo(I.x-v*0.4,I.y+v*0.4),z.stroke(),z.restore()}function B(){if(!Y)return;let z=W();if(Y.clearRect(0,0,$.width,$.height),Y.drawImage(J,0,0,$.width,$.height),j.forEach((H,D)=>{if(D!==x)M(Y,H,z)}),V)M(Y,V,z);let G=j[X];if(G&&!V)U(Y,G,z)}function y(z,G,H,D,q){return Math.abs(z-H)<=q&&Math.abs(G-D)<=q}function m(z,G){let H=j[X];if(!H)return null;let D=W8*W()/2+3*W();for(let q of O(H))if(y(z,G,q.x,q.y,D))return q.id;return null}function T(z,G){let H=j[X];if(!H)return!1;let D=P(H);return y(z,G,D.x,D.y,G8*W())}function g(z,G){let H=6*W();for(let D=j.length-1;D>=0;D-=1){let q=j[D];if(q.tool==="arrow"){let v=q.x2-q.x1,e=q.y2-q.y1,F0=Math.hypot(v,e)||1,_=Math.max(0,Math.min(1,((z-q.x1)*v+(G-q.y1)*e)/(F0*F0)));if(Math.hypot(z-(q.x1+_*v),G-(q.y1+_*e))<=H+4*W())return D;continue}let I=R(q);if(z>=I.left-H&&z<=I.right+H&&G>=I.top-H&&G<=I.bottom+H)return D}return-1}function A(z,G,H,D,q){if(G==="tail"){z.x1=H.x1+D,z.y1=H.y1+q;return}if(G==="head"){z.x2=H.x2+D,z.y2=H.y2+q;return}if(G==="size"){let b=(H.size??24)+q;z.size=Math.max(10,b);return}let I=R(H),{left:v,top:e,right:F0,bottom:_}=I;if(G.includes("w"))v=Math.min(F0-j2,v+D);if(G.includes("e"))F0=Math.max(v+j2,F0+D);if(G.includes("n"))e=Math.min(_-j2,e+q);if(G.includes("s"))_=Math.max(e+j2,_+q);z.x1=v,z.y1=e,z.x2=F0,z.y2=_}function u(z,G,H,D){z.x1=G.x1+H,z.y1=G.y1+D,z.x2=G.x2+H,z.y2=G.y2+D}let C=null,x=-1,E={x:0,y:0,size:24};function d(){let z=$.getBoundingClientRect().width;return z>0?z/$.width:1}function l0(z,G){if(!Y)return z.length*G*0.6;Y.save(),Y.font=`600 ${G}px system-ui, sans-serif`;let H=Y.measureText(z||" ").width;return Y.restore(),H}function U0(){if(!C)return;let z=$.parentElement;if(!z)return;let G=$.getBoundingClientRect(),H=z.getBoundingClientRect(),D=d(),q=E.size*D;C.style.left=`${G.left-H.left+E.x*D}px`,C.style.top=`${G.top-H.top+E.y*D}px`,C.style.fontSize=`${q}px`,C.style.width=`${Math.max(40,l0(C.value,q)+q)}px`}function J0(z){let G=C;if(!G)return;C=null;let H=G.value.trim(),D=x;if(x=-1,G.remove(),z&&H){if(D>=0&&j[D])j[D].text=H,X=D;else j.push({tool:"text",x1:E.x,y1:E.y,x2:E.x,y2:E.y,text:H,size:E.size}),X=j.length-1;Q()}else if(D>=0)X=D;$.focus(),B()}function n(z,G,H=-1){J0(!0);let D=$.parentElement;if(!D)return;if(getComputedStyle(D).position==="static")D.style.position="relative";let q=H>=0?j[H]:void 0;x=H,E={x:q?.x1??z,y:q?.y1??G,size:q?.size??Math.round(24*W())};let I=document.createElement("input");I.type="text",I.className="text-edit",I.value=q?.text??"",I.setAttribute("aria-label","ข้อความบนภาพ"),I.placeholder="ข้อความ",C=I,D.append(I),U0(),I.addEventListener("input",U0),I.addEventListener("keydown",(v)=>{if(v.stopPropagation(),v.key==="Enter")J0(!0);else if(v.key==="Escape")J0(!1)}),requestAnimationFrame(()=>{if(C!==I)return;I.focus(),I.select(),I.addEventListener("blur",()=>J0(!0))}),B()}function H0(z){let{x:G,y:H}=N(z);if($.setPointerCapture(z.pointerId),T(G,H)){q0();return}let D=m(G,H);if(D&&j[X]){K={grip:D,x:G,y:H,start:{...j[X]}};return}if(Z==="text"){if(z.preventDefault(),$.hasPointerCapture(z.pointerId))$.releasePointerCapture(z.pointerId);Z=null,Q(),n(G,H);return}if(Z){V={tool:Z,x1:G,y1:H,x2:G,y2:H},X=-1;return}let q=g(G,H);X=q,K=q>=0?{grip:"body",x:G,y:H,start:{...j[q]}}:null,B()}function r0(z){let{x:G,y:H}=N(z);if(V){V.x2=G,V.y2=H,B();return}if(K){let q=j[X];if(!q)return;let I=G-K.x,v=H-K.y;if(K.grip==="body")u(q,K.start,I,v);else A(q,K.grip,K.start,I,v);B();return}if(Z){$.style.cursor="crosshair";return}if(T(G,H)){$.style.cursor="pointer";return}let D=m(G,H);if(D){let q=j[X]?O(j[X]).find((I)=>I.id===D):null;$.style.cursor=q?.cursor??"pointer";return}$.style.cursor=g(G,H)>=0?"move":"default"}function w0(){if(V){if(!(Math.abs(V.x2-V.x1)<U8&&Math.abs(V.y2-V.y1)<U8))j.push(V),X=j.length-1,Z=null,Q();V=null}if(K)K=null,Q();B()}function L0(z){let G=$.getBoundingClientRect(),H=(z.clientX-G.left)/G.width*$.width,D=(z.clientY-G.top)/G.height*$.height,q=g(H,D),I=j[q];if(!I||I.tool!=="text")return;z.preventDefault(),n(I.x1,I.y1,q)}function R0(z){if(X<0)return;if(z.key==="Delete"||z.key==="Backspace")z.preventDefault(),q0();else if(z.key==="Escape")z.preventDefault(),X=-1,B()}function q0(){if(X<0)return;j.splice(X,1),X=-1,Q(),B()}return $.addEventListener("pointerdown",H0),$.addEventListener("pointermove",r0),$.addEventListener("pointerup",w0),$.addEventListener("pointercancel",w0),$.addEventListener("dblclick",L0),$.tabIndex=0,$.addEventListener("keydown",R0),B(),{setTool(z){Z=z,X=-1,$.style.cursor=z?"crosshair":"default",B()},deleteSelected:q0,clear(){j.length=0,X=-1,Q(),B()},hasShapes:()=>j.length>0,hasSelection:()=>X>=0,toDataUrl(){let z=document.createElement("canvas");z.width=J.naturalWidth,z.height=J.naturalHeight;let G=z.getContext("2d");if(!G)return $.toDataURL("image/png");G.drawImage(J,0,0);let H=W();for(let D of j)M(G,D,H);return z.toDataURL("image/png")},destroy(){J0(!1),$.removeEventListener("pointerdown",H0),$.removeEventListener("pointermove",r0),$.removeEventListener("pointerup",w0),$.removeEventListener("pointercancel",w0),$.removeEventListener("dblclick",L0),$.removeEventListener("keydown",R0)}}}var H7=["keydown","keyup","keypress"];function Q1($){for(let J of H7)$.addEventListener(J,(Q)=>Q.stopPropagation())}var H8=`
40
+ `)}function F9($){let J=[];for(let Q of $.failedRequests)J.push(`✗ ${Q.status??Q.error??"ERR"} ${Q.method} ${Q.url}`);for(let Q of $.errors)J.push(`⚠ ${Q}`);for(let Q of $.erroredQueries)J.push(`⚠ React Query error: ${Q.key} — ${Q.error}`);return J}function P9($){let{context:J}=$;return[`User : ${J.user.fullName??"—"} (${J.user.email??"—"})`,`Unit : ${J.user.unit??"—"}`,`Roles : ${J.user.roles?.join(", ")||"—"}`,`Route : ${J.route.href}`,`Module : ${J.module?`${J.module.label} (${J.module.key})`:"—"}`,`App : ${J.app.name} v${J.app.version} · ${J.app.environment}`,`Memory : ${J.performance.memoryUsedMb??"—"}/${J.performance.memoryLimitMb??"—"} MB`,`Client : ${J.client.userAgent}`,`Viewport : ${J.client.viewport.width}×${J.client.viewport.height} @${J.client.viewport.dpr}x`,`Reason : ${G9[$.reason.type]}${$.reason.message?` — ${$.reason.message}`:""}`,`Captured : ${$.network.length} requests · ${$.console.length} console · ${$.actionTrail.length} actions · screenshot=${$.screenshotMethod}${$.replay?` · replay=${Math.round($.replay.durationMs/1000)}s`:""}`]}function B9($){let J=F9($.cause),Q=[`## \uD83D\uDC1E ${$.context.app.name} — Debug Report`,`**Generated:** ${$.context.capturedAt}`,"",...P9($).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${$.note.trim()||"(ไม่มี)"}`];if(J.length>0)Q.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...J,"```");return Q.push("",`<details><summary>ขั้นตอน (${$.actionTrail.length})</summary>`,"","```",q9($.actionTrail),"```","</details>","",`<details><summary>Network (${$.network.length})</summary>`,"","```",D9($.network),"```","</details>","",`<details><summary>Console (${$.console.length})</summary>`,"","```",H9($.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),Q.join(`
41
+ `)}function M9($){return $.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function N9($,J){return`debug-report_${M9($.context.capturedAt)}.${J}`}function _9($){return h6($.cause)>0}async function a1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let Q=await C9();if(Q.status==="ok")return{dataUrl:Q.dataUrl,method:"display-media"};if(Q.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await L9();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function C9(){let $=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(J);let Q=await O9($);return Q?{status:"ok",dataUrl:Q}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((J)=>J.stop())}}async function O9($){let J=document.createElement("video");J.srcObject=$,J.muted=!0,J.playsInline=!0,await new Promise((V)=>{let K=!1,Y=()=>{if(K)return;K=!0,V()};J.onloadedmetadata=()=>{J.play().then(Y).catch(Y)},window.setTimeout(Y,1500)}),await I9(J);let{videoWidth:Q,videoHeight:j}=J;if(!Q||!j)return null;let Z=document.createElement("canvas");Z.width=Q,Z.height=j;let X=Z.getContext("2d");if(!X)return null;X.drawImage(J,0,0,Q,j),J.pause(),J.srcObject=null;try{return Z.toDataURL("image/png")}catch{return null}}function I9($){return new Promise((J)=>{let Q=!1,j=()=>{if(Q)return;Q=!0,J()},Z=$;if(typeof Z.requestVideoFrameCallback==="function")Z.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function L9(){let $=L().screenshotFallback;if(!$)return null;let J=await $().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(Q)=>!(Q instanceof HTMLElement&&Q.dataset?.debugReporter==="true")})}catch{return null}}var R9=2000,S9=0.82,T9=3000000;function A9($){return new Promise((J,Q)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>Q(Error("could not read the screenshot")),j.src=$})}async function t1($){try{let J=await A9($),Q=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,R9/Q),Z=document.createElement("canvas");Z.width=Math.max(1,Math.round(J.naturalWidth*j)),Z.height=Math.max(1,Math.round(J.naturalHeight*j));let X=Z.getContext("2d");if(!X)return $;X.fillStyle="#fff",X.fillRect(0,0,Z.width,Z.height),X.drawImage(J,0,0,Z.width,Z.height);let V=S9,K=Z.toDataURL("image/jpeg",V);while(K.length>T9&&V>0.4)V-=0.15,K=Z.toDataURL("image/jpeg",V);return K}catch{return $}}var E9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,k9=/^\d+$/,x9=/^[0-9a-f]{16,}$/i;function a2($){if($.reason.type==="manual")return null;let J=$.cause?.failedRequests?.[0];if(!J?.url)return null;let Q;try{Q=new URL(J.url,"http://x").pathname}catch{Q=J.url}let j=Q.split("/").map((X)=>E9.test(X)||k9.test(X)||x9.test(X)?":id":X).join("/"),Z=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Z}`}var t2=2000000;function e1($){let{screenshotDataUrl:J,replay:Q,...j}=$;return JSON.stringify(j).length}function e2($,J=2000000){if(e1($)<=J)return $;let Q=$.network.map((Z)=>({...Z})),j={...$,network:Q};for(let Z of Q){if(e1(j)<=J)return j;if(typeof Z.responseSnippet==="string"&&Z.responseSnippet.length>35)Z.responseSnippet="[body dropped — report size budget]";if(typeof Z.requestBody==="string"&&Z.requestBody.length>35)Z.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&e1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&e1(j)>J)j.console=j.console.slice(1);return j}function v0($){let J="";for(let Q=0;Q<$.length;Q+=32768)J+=String.fromCharCode(...$.subarray(Q,Q+32768));return btoa(J)}var f9=4,w9=2,y9=3,g9=0,v9=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),b9=/^\s*javascript:/i;function h9($,J){let Q=$.toLowerCase();if(Q.startsWith("on")||Q==="srcdoc")return!0;return typeof J==="string"&&b9.test(J)}function d6($,J=!1){if(!$)return;for(let Q of Object.keys($)){let j=$[Q];if(h9(Q,j)){if(J)$[Q]=null;else delete $[Q];continue}if(typeof j!=="string"||!v9.has(Q)||!j.includes("?"))continue;$[Q]=_0(j)}}function $4($){if(!$)return;d6($.attributes);for(let J of $.childNodes??[])$4(J)}function c6($){let J=JSON.parse(JSON.stringify($));for(let Q of J){let j=Q.data;if(!j||typeof j!=="object")continue;if(Q.type===f9&&typeof j.href==="string")j.href=_0(j.href);else if(Q.type===w9)$4(j.node);else if(Q.type===y9&&j.source===g9){for(let Z of j.adds??[])$4(Z.node);for(let Z of j.attributes??[])d6(Z.attributes,!0)}}return J}var m9=30000,u9=2,i6=3,p9=0,d9=9,c9=/^data:([^;,]+);base64,/;function J4($,J){if(!$)return;let Q=$.attributes,j=Q?.rr_dataURL;if(Q&&typeof j==="string"){let Z=c9.exec(j);if(Z)J.push({picture:{type:Z[1],base64:j.slice(Z[0].length)},put:(X)=>Q.rr_dataURL=`data:${X.type};base64,${X.base64}`})}for(let Z of $.childNodes??[])J4(Z,J)}function i9($,J){if(!Array.isArray($))return;for(let Q of $)for(let j of Q.args??[]){let Z=j;if(Z?.rr_type!=="ImageBitmap")continue;let X=Z.args?.[0],V=X?.rr_type==="Blob"?X.data?.[0]:void 0;if(!X||V?.rr_type!=="ArrayBuffer"||typeof V.base64!=="string"||typeof X.type!=="string")continue;J.push({picture:{type:X.type,base64:V.base64},put:(K)=>{X.type=K.type,V.base64=K.base64}})}}function Q4($){let J=[];for(let Q of $){let j=Q.data;if(!j||typeof j!=="object")continue;if(Q.type===u9)J4(j.node,J);else if(Q.type===i6&&j.source===p9)for(let Z of j.adds??[])J4(Z.node,J);else if(Q.type===i6&&j.source===d9)i9(j.commands,J)}return J}function l6($){return Q4($).map((J)=>J.picture.base64)}var r6=($)=>$.picture.type==="image/png"&&$.picture.base64.length>=m9;function o6($){return Q4($).some(r6)}async function n6($,J){let Q=new Map,j=0;for(let Z of Q4($).filter(r6)){let X=Z.picture.base64;if(!Q.has(X)){let K=null;try{K=await J(Z.picture)}catch{K=null}Q.set(X,K&&K.base64.length<X.length?K:null)}let V=Q.get(X);if(V)Z.put(V),j+=1}return j}function l9($){let J=atob($),Q=new Uint8Array(J.length);for(let j=0;j<J.length;j++)Q[j]=J.charCodeAt(j);return Q}function r9($,J){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas($,J);if(typeof document>"u")return null;let Q=document.createElement("canvas");return Q.width=$,Q.height=J,Q}function o9($,J){if("convertToBlob"in $)return $.convertToBlob({type:"image/jpeg",quality:J});return new Promise((Q)=>$.toBlob(Q,"image/jpeg",J))}function s6($){if(typeof createImageBitmap!=="function"||typeof OffscreenCanvas>"u"&&typeof document>"u")return null;return async({base64:J,type:Q})=>{let j=await createImageBitmap(new Blob([l9(J)],{type:Q}));try{let{width:Z,height:X}=j,V=r9(Z,X),K=V?.getContext("2d",{willReadFrequently:!0});if(!V||!K)return null;K.drawImage(j,0,0);let Y=K.getImageData(0,0,Z,X).data;for(let N=3;N<Y.length;N+=4)if(Y[N]!==255)return null;let W=await o9(V,$);if(!W||W.type!=="image/jpeg")return null;return{base64:v0(new Uint8Array(await W.arrayBuffer())),type:"image/jpeg"}}finally{j.close()}}}var J8="session-replay.json.gz",n9="session-replay.json";function s9($){return Boolean($&&$.events.length>0)}async function Q8($){if(typeof CompressionStream>"u")return null;try{let J=new Blob([$]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function _1($){let J=new TextEncoder().encode(JSON.stringify({events:$})),Q=await Q8(J);return Q?{bytes:Q,compressed:!0}:{bytes:J,compressed:!1}}var a6=65536,t6=16;async function a9($){let J=l6($),Q=J.reduce((Y,W)=>Y+W.length,0);if(Q===0)return 0;let j=Math.max(1,Math.floor(J.length/t6)),Z="";for(let Y=0;Y<J.length&&Z.length<a6*t6;Y+=j)Z+=J[Y].slice(0,a6);let X=new TextEncoder().encode(Z),V=await Q8(X),K=V?V.byteLength/X.byteLength:1;return Q*K*0.9}async function Z4($,J,Q={}){if(!s9($))return{summary:{omitted:"empty"}};let j=Math.round($.durationMs/1000),Z=c6($.events),X=await t9(Z,J,Q);if(!("events"in X))return{summary:{seconds:j,events:$.events.length,startedAt:$.startedAt,endedAt:$.endedAt,bytes:X.bytes,omitted:"too-large"}};let{bytes:V,compressed:K}=X.encoded,Y=X.events,W=Y[0].timestamp,N=Y[Y.length-1].timestamp,{trimmed:F,...R}=X.cuts,O=Date.parse($.endedAt);return{dataUri:`data:${K?"application/gzip":"application/json"};base64,${v0(V)}`,filename:K?J8:n9,summary:{seconds:Math.round((N-W)/1000),events:Y.length,startedAt:new Date(W).toISOString(),endedAt:new Date(N).toISOString(),bytes:V.byteLength,compressed:K,...R,...F?{recordedSeconds:j}:{},...F==="end"&&!Number.isNaN(O)?{endsEarlySeconds:Math.round((O-N)/1000)}:{}}}}async function t9($,J,Q){let j={},Z=0,X=async(O)=>{let P=await a9(O);if(P>J)return Z||=Math.round(P),null;let S=await _1(O);return Z||=S.bytes.byteLength,S.bytes.byteLength<=J?S:null},V=await X($);if(V)return{events:$,encoded:V,cuts:j};let K=Q.lighten===void 0?s6(Q.quality??0.5):Q.lighten;if(K&&o6($)&&await n6($,K)>0){if(V=await X($),V)return{events:$,encoded:V,cuts:j}}let Y=[...new Set($.filter(V8).map((O)=>O.timestamp))].sort((O,P)=>O-P);if(Y.length>1){let O=1,P=Y.length,S=null;while(O<P){let M=Math.floor((O+P)/2),D=Q7($,Y[M]),B=await X(D);if(B)S={events:D,encoded:B},P=M;else O=M+1}if(S)return{...S,cuts:{...j,canvasDropped:!0}}}if(j7($)){if(j.canvasDropped=!0,$=$.filter((O)=>!$2(O)),V=await X($),V)return{events:$,encoded:V,cuts:j}}if(V7($)){if(j.picturesDropped=!0,V=await X($),V)return{events:$,encoded:V,cuts:j}}let W=K7($);if(W.length>1){let O=[];for(let M of W)O.push((await _1(M)).bytes.byteLength);let P=W.length,S=0;while(P>0&&S+O[P-1]<=J)S+=O[--P];for(let M=Math.max(P,1);M<W.length;M++){let D=W.slice(M).flat();if(V=await _1(D),V.bytes.byteLength<=J)return{events:D,encoded:V,cuts:{...j,trimmed:"start"}}}}let N=W[W.length-1],F=await e6(N,J);if(!F&&z7(N))j.simplified=!0,F=await e6(N,J);if(!F)return{bytes:Z};let R=F.events.length<N.length?"end":W.length>1?"start":void 0;return{...F,cuts:{...j,...R?{trimmed:R}:{}}}}async function e6($,J){let Q=$.findIndex((X)=>X.type===X4)+1||1,j=$.length,Z={events:$.slice(0,Q),encoded:await _1($.slice(0,Q))};if(Z.encoded.bytes.byteLength>J)return null;while(Q<j){let X=Math.ceil((Q+j)/2),V=$.slice(0,X),K=await _1(V);if(K.bytes.byteLength<=J)Q=X,Z={events:V,encoded:K};else j=X-1}return Z}var e9=4,X4=2,j8=3,$7=0,J7=9;function $2($){return $.type===j8&&$.data?.source===J7}function Z8($,J){let Q=$.data;if(!Q||typeof Q!=="object")return;if($.type===X4)J(Q.node);else if($.type===j8&&Q.source===$7)for(let j of Q.adds??[])J(j.node)}function X8($){if(!$)return!1;let J=!1;if($.attributes&&"rr_dataURL"in $.attributes)delete $.attributes.rr_dataURL,J=!0;for(let Q of $.childNodes??[])J=X8(Q)||J;return J}function V4($){return!!$&&($.attributes!==void 0&&("rr_dataURL"in $.attributes)||($.childNodes??[]).some(V4))}function V8($){if($2($))return!0;let J=!1;return Z8($,(Q)=>J||=V4(Q)),J}function j4($){if(!$||!V4($))return $;let{rr_dataURL:J,...Q}=$.attributes??{};return{...$,...$.attributes?{attributes:Q}:{},...$.childNodes?{childNodes:$.childNodes.map((j)=>j4(j))}:{}}}function Q7($,J){let Q=[];for(let j of $)if(j.timestamp>=J||!V8(j))Q.push(j);else if($2(j))continue;else if(j.type===X4){let Z=j.data;Q.push({...j,data:{...Z,node:j4(Z.node)}})}else{let Z=j.data;Q.push({...j,data:{...Z,adds:(Z.adds??[]).map((X)=>({...X,node:j4(X.node)}))}})}return Q}function j7($){let J=!1;for(let Q of $)if($2(Q))J=!0;else Z8(Q,(j)=>J=X8(j)||J);return J}var z8=16384,Z7="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",X7=new RegExp(`url\\(\\s*(['"]?)data:[^'")]{${z8},}\\1\\s*\\)`,"g");function z4($,J){if(!$||typeof $!=="object")return!1;let Q=!1,j=Array.isArray($)?$.map((Z,X)=>[X,Z]):Object.entries($);for(let[Z,X]of j)if(typeof X==="string"){let V=J(X);if(V!==X)$[Z]=V,Q=!0}else if(X&&typeof X==="object")Q=z4(X,J)||Q;return Q}function V7($){let J=!1;for(let Q of $)J=z4(Q.data,(j)=>{if(j.length<z8)return j;if(j.startsWith("data:"))return j.startsWith("data:image/")?Z7:"";return j.includes("data:")?j.replace(X7,"url()"):j})||J;return J}var $8=2000;function z7($){let J=!1;for(let Q of $)J=z4(Q.data,(j)=>j.length>$8?j.slice(0,$8):j)||J;return J}function K7($){let J=[[]],Q=!1;for(let j of $){if(j.type===e9){if(Q)J.push([]);Q=!0}J[J.length-1].push(j)}return J}var Y7=new Set([502,503,504]);class C0 extends Error{kind;retryAfter;status;constructor($,J,Q,j){super($);this.kind=J;this.retryAfter=Q;this.status=j;this.name="ReportError"}}function W7($){let{screenshotDataUrl:J,replay:Q,...j}=$;return{dataUri:`data:application/json;base64,${v0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function K4(){let $=L().identity;if(!$)return{};try{let J=await $();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function Y4($,J){let Q=L(),j=e2(J,t2),{context:Z,note:X}=j,V=[];if(j.screenshotDataUrl){let R=await t1(j.screenshotDataUrl);V.push({dataUri:R,filename:"screenshot.jpg"})}V.push(W7(j));let K,Y=F1();if(Y){let R=await Z4(j.replay,Y.maxBytes,{quality:Y.canvas?.quality});if(K=R.summary,"dataUri"in R)V.push({dataUri:R.dataUri,filename:R.filename})}let W=a2(j),N={title:$,description:X.trim()||void 0,appName:P0().name,category:Z.module?.label,routeUrl:Z.route.href,priority:"MEDIUM",requesterEmail:Z.user.email??void 0,requesterName:Z.user.fullName??void 0,customFields:{unit:Z.user.unit??"",appVersion:Z.app.version,environment:Z.app.environment,reasonType:j.reason.type,appName:P0().name,module:Z.module?.label??""},context:{...W?{signature:W}:{},capturedAt:Z.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Z.client,performance:Z.performance,apiHeaders:Z.apiHeaders,extra:Z.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...K?{replay:K}:{}},attachments:V,...j.reason.fromChat?{fromChat:!0}:{}},F=await fetch(`${Q.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,...await K4()},body:JSON.stringify(N)}).catch(()=>{throw new C0("report never left the browser","offline")});if(!F.ok)throw await W4(F);return await F.json()}async function W4($){let J=$.headers.get("retry-after"),Q=await $.json().then((j)=>j.error).catch(()=>null);if($.status===429)return new C0("rate limited","rateLimited",J??void 0);if(Y7.has($.status))return new C0("desk unavailable","unavailable");return new C0(Q??`Report failed (${$.status})`,"rejected",void 0,$.status)}var J2=null,C1=null,K8=()=>L().host.replace(/\/$/,"");function Q2(){return J2}function b0(){if(C1)return C1;return C1=(async()=>{try{let $=await fetch(`${K8()}/ingest/request-types`,{headers:{"x-realm-key":L().realmKey}}),J=$.ok?await $.json():null;J2=Array.isArray(J?.types)?J.types.filter(G7):[]}catch{J2=[],C1=null}return J2??[]})(),C1}function G7($){let J=$;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function G4($){let J=L(),Q={};try{Q=J.user?.()??{}}catch{Q={}}let j=typeof window>"u"?null:window.location,Z={title:$.title,description:$.description.trim()||void 0,ticketTypeId:$.ticketTypeId,appName:P0().name,category:j?c1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:Q.email??void 0,requesterName:Q.fullName??void 0,attachments:$.screenshotDataUrl?[{dataUri:await t1($.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},X=await fetch(`${K8()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await K4()},body:JSON.stringify(Z)}).catch(()=>{throw new C0("request never left the browser","offline")});if(!X.ok)throw await W4(X);return await X.json()}var O1=Math.PI/6;function Y8($,J,Q){let j=J.x-$.x,Z=J.y-$.y,X=Math.hypot(j,Z),V=Math.atan2(Z,j),K=[{x:J.x,y:J.y},{x:J.x-Q*Math.cos(V-O1),y:J.y-Q*Math.sin(V-O1)},{x:J.x-Q*Math.cos(V+O1),y:J.y-Q*Math.sin(V+O1)}],Y=Q*Math.cos(O1)*0.92;if(X<=Y)return{shaft:null,head:K};return{shaft:{from:$,to:{x:J.x-Y*Math.cos(V),y:J.y-Y*Math.sin(V)}},head:K}}var U4="#f44336",U7="rgba(250, 204, 21, 0.4)",D4=22,W8="#2563eb",G8=9,U8=11,D8=18,H8=4,j2=8,D7=[{id:"nw",fx:0,fy:0,cursor:"nwse-resize"},{id:"n",fx:0.5,fy:0,cursor:"ns-resize"},{id:"ne",fx:1,fy:0,cursor:"nesw-resize"},{id:"e",fx:1,fy:0.5,cursor:"ew-resize"},{id:"se",fx:1,fy:1,cursor:"nwse-resize"},{id:"s",fx:0.5,fy:1,cursor:"ns-resize"},{id:"sw",fx:0,fy:1,cursor:"nesw-resize"},{id:"w",fx:0,fy:0.5,cursor:"ew-resize"}];function H4($,J,Q){let j=[],Z=null,X=-1,V=null,K=null,Y=$.getContext("2d");function W(){let z=$.getBoundingClientRect().width;return z>0?$.width/z:1}function N(z){let G=$.getBoundingClientRect();return{x:(z.clientX-G.left)/G.width*$.width,y:(z.clientY-G.top)/G.height*$.height}}function F(z){let G=z.size??D4;if(!Y)return(z.text?.length??0)*G*0.6;Y.save(),Y.font=`600 ${G}px system-ui, sans-serif`;let H=Y.measureText(z.text??"").width;return Y.restore(),H}function R(z){if(z.tool==="text"){let G=z.size??D4;return{left:z.x1,top:z.y1,right:z.x1+F(z),bottom:z.y1+G*1.25}}return{left:Math.min(z.x1,z.x2),top:Math.min(z.y1,z.y2),right:Math.max(z.x1,z.x2),bottom:Math.max(z.y1,z.y2)}}function O(z){if(z.tool==="arrow")return[{id:"tail",x:z.x1,y:z.y1,cursor:"move"},{id:"head",x:z.x2,y:z.y2,cursor:"move"}];let G=R(z);if(z.tool==="text")return[{id:"size",x:G.right,y:G.bottom,cursor:"nwse-resize"}];return D7.map((H)=>({id:H.id,x:G.left+(G.right-G.left)*H.fx,y:G.top+(G.bottom-G.top)*H.fy,cursor:H.cursor}))}function P(z){let G=R(z);return{x:G.right+D8*W(),y:G.top-D8*W()}}function S(z,G,H){let{shaft:U,head:q}=Y8({x:G.x1,y:G.y1},{x:G.x2,y:G.y2},Math.max(10,16*H));if(U)z.lineCap="butt",z.beginPath(),z.moveTo(U.from.x,U.from.y),z.lineTo(U.to.x,U.to.y),z.stroke();z.beginPath(),z.moveTo(q[0].x,q[0].y),z.lineTo(q[1].x,q[1].y),z.lineTo(q[2].x,q[2].y),z.closePath(),z.fill()}function M(z,G,H){z.save(),z.lineWidth=Math.max(2,3*H),z.strokeStyle=U4,z.fillStyle=U4;let U=R(G);if(G.tool==="rect")z.strokeRect(U.left,U.top,U.right-U.left,U.bottom-U.top);else if(G.tool==="arrow")S(z,G,H);else if(G.tool==="highlight")z.fillStyle=U7,z.fillRect(U.left,U.top,U.right-U.left,U.bottom-U.top);else if(G.tool==="text"&&G.text){let q=G.size??D4;z.font=`600 ${q}px system-ui, sans-serif`,z.textBaseline="top";let I=q*0.22;z.fillStyle="rgba(255,255,255,0.92)",z.fillRect(U.left-I,U.top-I,U.right-U.left+I*2,U.bottom-U.top+I*2),z.fillStyle=U4,z.fillText(G.text,U.left,U.top)}z.restore()}function D(z,G,H){let U=R(G);z.save(),z.strokeStyle=W8,z.lineWidth=Math.max(1,1.5*H),z.setLineDash([6*H,4*H]),z.strokeRect(U.left,U.top,U.right-U.left,U.bottom-U.top),z.setLineDash([]);let q=G8*H;for(let e of O(G))z.fillStyle="#fff",z.strokeStyle=W8,z.lineWidth=Math.max(1,1.5*H),z.beginPath(),z.rect(e.x-q/2,e.y-q/2,q,q),z.fill(),z.stroke();let I=P(G),v=U8*H;z.beginPath(),z.arc(I.x,I.y,v,0,Math.PI*2),z.fillStyle="#dc2626",z.fill(),z.strokeStyle="#fff",z.lineWidth=Math.max(1.5,2*H),z.beginPath(),z.moveTo(I.x-v*0.4,I.y-v*0.4),z.lineTo(I.x+v*0.4,I.y+v*0.4),z.moveTo(I.x+v*0.4,I.y-v*0.4),z.lineTo(I.x-v*0.4,I.y+v*0.4),z.stroke(),z.restore()}function B(){if(!Y)return;let z=W();if(Y.clearRect(0,0,$.width,$.height),Y.drawImage(J,0,0,$.width,$.height),j.forEach((H,U)=>{if(U!==x)M(Y,H,z)}),V)M(Y,V,z);let G=j[X];if(G&&!V)D(Y,G,z)}function y(z,G,H,U,q){return Math.abs(z-H)<=q&&Math.abs(G-U)<=q}function m(z,G){let H=j[X];if(!H)return null;let U=G8*W()/2+3*W();for(let q of O(H))if(y(z,G,q.x,q.y,U))return q.id;return null}function T(z,G){let H=j[X];if(!H)return!1;let U=P(H);return y(z,G,U.x,U.y,U8*W())}function g(z,G){let H=6*W();for(let U=j.length-1;U>=0;U-=1){let q=j[U];if(q.tool==="arrow"){let v=q.x2-q.x1,e=q.y2-q.y1,F0=Math.hypot(v,e)||1,_=Math.max(0,Math.min(1,((z-q.x1)*v+(G-q.y1)*e)/(F0*F0)));if(Math.hypot(z-(q.x1+_*v),G-(q.y1+_*e))<=H+4*W())return U;continue}let I=R(q);if(z>=I.left-H&&z<=I.right+H&&G>=I.top-H&&G<=I.bottom+H)return U}return-1}function A(z,G,H,U,q){if(G==="tail"){z.x1=H.x1+U,z.y1=H.y1+q;return}if(G==="head"){z.x2=H.x2+U,z.y2=H.y2+q;return}if(G==="size"){let b=(H.size??24)+q;z.size=Math.max(10,b);return}let I=R(H),{left:v,top:e,right:F0,bottom:_}=I;if(G.includes("w"))v=Math.min(F0-j2,v+U);if(G.includes("e"))F0=Math.max(v+j2,F0+U);if(G.includes("n"))e=Math.min(_-j2,e+q);if(G.includes("s"))_=Math.max(e+j2,_+q);z.x1=v,z.y1=e,z.x2=F0,z.y2=_}function u(z,G,H,U){z.x1=G.x1+H,z.y1=G.y1+U,z.x2=G.x2+H,z.y2=G.y2+U}let C=null,x=-1,E={x:0,y:0,size:24};function d(){let z=$.getBoundingClientRect().width;return z>0?z/$.width:1}function l0(z,G){if(!Y)return z.length*G*0.6;Y.save(),Y.font=`600 ${G}px system-ui, sans-serif`;let H=Y.measureText(z||" ").width;return Y.restore(),H}function D0(){if(!C)return;let z=$.parentElement;if(!z)return;let G=$.getBoundingClientRect(),H=z.getBoundingClientRect(),U=d(),q=E.size*U;C.style.left=`${G.left-H.left+E.x*U}px`,C.style.top=`${G.top-H.top+E.y*U}px`,C.style.fontSize=`${q}px`,C.style.width=`${Math.max(40,l0(C.value,q)+q)}px`}function J0(z){let G=C;if(!G)return;C=null;let H=G.value.trim(),U=x;if(x=-1,G.remove(),z&&H){if(U>=0&&j[U])j[U].text=H,X=U;else j.push({tool:"text",x1:E.x,y1:E.y,x2:E.x,y2:E.y,text:H,size:E.size}),X=j.length-1;Q()}else if(U>=0)X=U;$.focus(),B()}function n(z,G,H=-1){J0(!0);let U=$.parentElement;if(!U)return;if(getComputedStyle(U).position==="static")U.style.position="relative";let q=H>=0?j[H]:void 0;x=H,E={x:q?.x1??z,y:q?.y1??G,size:q?.size??Math.round(24*W())};let I=document.createElement("input");I.type="text",I.className="text-edit",I.value=q?.text??"",I.setAttribute("aria-label","ข้อความบนภาพ"),I.placeholder="ข้อความ",C=I,U.append(I),D0(),I.addEventListener("input",D0),I.addEventListener("keydown",(v)=>{if(v.stopPropagation(),v.key==="Enter")J0(!0);else if(v.key==="Escape")J0(!1)}),requestAnimationFrame(()=>{if(C!==I)return;I.focus(),I.select(),I.addEventListener("blur",()=>J0(!0))}),B()}function H0(z){let{x:G,y:H}=N(z);if($.setPointerCapture(z.pointerId),T(G,H)){q0();return}let U=m(G,H);if(U&&j[X]){K={grip:U,x:G,y:H,start:{...j[X]}};return}if(Z==="text"){if(z.preventDefault(),$.hasPointerCapture(z.pointerId))$.releasePointerCapture(z.pointerId);Z=null,Q(),n(G,H);return}if(Z){V={tool:Z,x1:G,y1:H,x2:G,y2:H},X=-1;return}let q=g(G,H);X=q,K=q>=0?{grip:"body",x:G,y:H,start:{...j[q]}}:null,B()}function r0(z){let{x:G,y:H}=N(z);if(V){V.x2=G,V.y2=H,B();return}if(K){let q=j[X];if(!q)return;let I=G-K.x,v=H-K.y;if(K.grip==="body")u(q,K.start,I,v);else A(q,K.grip,K.start,I,v);B();return}if(Z){$.style.cursor="crosshair";return}if(T(G,H)){$.style.cursor="pointer";return}let U=m(G,H);if(U){let q=j[X]?O(j[X]).find((I)=>I.id===U):null;$.style.cursor=q?.cursor??"pointer";return}$.style.cursor=g(G,H)>=0?"move":"default"}function w0(){if(V){if(!(Math.abs(V.x2-V.x1)<H8&&Math.abs(V.y2-V.y1)<H8))j.push(V),X=j.length-1,Z=null,Q();V=null}if(K)K=null,Q();B()}function L0(z){let G=$.getBoundingClientRect(),H=(z.clientX-G.left)/G.width*$.width,U=(z.clientY-G.top)/G.height*$.height,q=g(H,U),I=j[q];if(!I||I.tool!=="text")return;z.preventDefault(),n(I.x1,I.y1,q)}function R0(z){if(X<0)return;if(z.key==="Delete"||z.key==="Backspace")z.preventDefault(),q0();else if(z.key==="Escape")z.preventDefault(),X=-1,B()}function q0(){if(X<0)return;j.splice(X,1),X=-1,Q(),B()}return $.addEventListener("pointerdown",H0),$.addEventListener("pointermove",r0),$.addEventListener("pointerup",w0),$.addEventListener("pointercancel",w0),$.addEventListener("dblclick",L0),$.tabIndex=0,$.addEventListener("keydown",R0),B(),{setTool(z){Z=z,X=-1,$.style.cursor=z?"crosshair":"default",B()},deleteSelected:q0,clear(){j.length=0,X=-1,Q(),B()},hasShapes:()=>j.length>0,hasSelection:()=>X>=0,toDataUrl(){let z=document.createElement("canvas");z.width=J.naturalWidth,z.height=J.naturalHeight;let G=z.getContext("2d");if(!G)return $.toDataURL("image/png");G.drawImage(J,0,0);let H=W();for(let U of j)M(G,U,H);return z.toDataURL("image/png")},destroy(){J0(!1),$.removeEventListener("pointerdown",H0),$.removeEventListener("pointermove",r0),$.removeEventListener("pointerup",w0),$.removeEventListener("pointercancel",w0),$.removeEventListener("dblclick",L0),$.removeEventListener("keydown",R0)}}}var H7=["keydown","keyup","keypress"];function Q1($){for(let J of H7)$.addEventListener(J,(Q)=>Q.stopPropagation())}var q8=`
42
42
  :host { all: initial; }
43
43
  * { box-sizing: border-box; }
44
44
 
@@ -189,7 +189,7 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
189
189
  .shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
190
190
  .dropped { opacity: 0.35; pointer-events: none; }
191
191
  .draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
192
- `;var j1="lw-debug-reporter",T0=null;function q7($,J){if($ instanceof C0){if($.kind==="offline")return J.failedOffline;if($.kind==="unavailable")return J.failedUnavailable;if($.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",$.retryAfter??"60");return $.message||J.failed}return J.failed}var M8=()=>[];function F7($){M8=$}var P7=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function B7(){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"}),Q1(this.root),this.root.addEventListener("keydown",(J)=>{let Q=J;if(Q.key!=="Escape"||Q.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;Q.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=c2((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let Q=document.activeElement;this.returnFocus=Q instanceof HTMLElement&&Q!==document.body?Q:null;let j=$0(L().locale),Z=Q2();if(Z===null)b0();if(J.type==="manual"&&Z?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,Q){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Z=w("div","head"),X=Y0("✕","icon");X.setAttribute("aria-label",J.close),X.addEventListener("click",()=>this.close()),Z.append(w("h2","",J.chooseTitle),X);let V=B8("problem",N7,J.kindProblem,J.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report(Q,J)});let K=B8("request",F8,J.kindRequest,J.chooseRequestHint);K.dataset.choose="request",K.addEventListener("click",()=>{this.bundle=N1({reason:Q,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:q4()}),this.renderForm(J,Q,"request")});let Y=w("div","kinds choose");Y.append(V,K),Y.addEventListener("keydown",(W)=>{if(!q8.includes(W.key))return;W.preventDefault(),(this.root.activeElement===V?K:V).focus()}),j.append(Z,Y),V.focus()}async switchToReport(J,Q,j){this.root.replaceChildren();let Z=await a1();if(Z.method==="cancelled"){this.renderForm(J,Q,"request",{...j,asking:!0});return}this.bundle=N1({reason:Q,note:"",screenshotDataUrl:Z.dataUrl,screenshotMethod:Z.method,erroredQueries:q4()}),this.renderForm(J,Q,"problem",j)}async report(J,Q){let j=await a1();if(j.method==="cancelled"){this.close();return}this.bundle=N1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:q4()}),this.renderForm(Q,J,"problem")}close(J=!1){if(J)T0=null;else if(this.keep)T0=this.keep()??T0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let Q=this.returnFocus;if(this.returnFocus=null,Q?.isConnected)Q.focus()}shell(J){let Q=document.createElement("style");Q.textContent=H8;let j=document.createElement("div");j.className="backdrop";let Z=document.createElement("div");return Z.className="panel",Z.setAttribute("role","dialog"),Z.setAttribute("aria-modal","true"),Z.setAttribute("aria-label",J.title),j.append(Z),this.root.replaceChildren(Q,j),Z}renderShell(J,Q){let j=this.shell(J),Z=w("div","head");Z.append(w("h2","",J.title)),j.append(Z,w("p","status",Q))}renderForm(J,Q,j,Z){let X=this.bundle;if(!X)return;let V=this.shell(J),K=j,Y=j==="problem"||!!X.screenshotDataUrl,W=null,N=w("div","head"),F=w("h2","",J.title),R=Y0("✕","icon");R.setAttribute("aria-label",J.close),R.addEventListener("click",()=>this.close()),N.append(F,R);let O=w("p","door");O.hidden=!0;let P=w("span"),S=Y0("","link");S.dataset.switchKind="",S.addEventListener("click",()=>G(K==="problem"?"request":"problem")),O.append(P,S);let M=w("div","ask");M.hidden=!0;let U=document.createElement("input");U.type="search",U.className="type-search",U.placeholder=J.requestTypeSearch,U.setAttribute("aria-label",J.requestTypeSearch),U.dataset.requestTypeSearch="",U.hidden=!0;let B=w("div","types");B.setAttribute("role","radiogroup"),B.setAttribute("aria-label",J.requestTypeLabel);let y=w("p","status",J.requestTypeNone);y.hidden=!0;let m=w("p","status type-count","");m.hidden=!0,M.append(Z2(J.requestTypeLabel,"",!0),U,B,y,m);let T=[],g=()=>{for(let b of T){let k=b.dataset.requestType===W?.id;b.setAttribute("aria-checked",String(k)),b.tabIndex=k?0:-1}let _=T.find((b)=>b.dataset.requestType===W?.id);if(_&&B.scrollHeight>B.clientHeight){let b=_.offsetTop-B.offsetTop;if(b<B.scrollTop)B.scrollTop=b;else if(b+_.offsetHeight>B.scrollTop+B.clientHeight)B.scrollTop=b+_.offsetHeight-B.clientHeight}},A=document.createElement("input");A.type="text";let u=Z2(""),C=document.createElement("textarea"),x=Z2(""),E=w("div","meta"),{context:d}=X,l0=`${X.network.length} network · ${X.console.length} console · ${X.actionTrail.length} actions${X.replay?` · ${J.replay} ${Math.round(X.replay.durationMs/1000)}s`:""}`,U0=(_,b)=>{let k=document.createElement("div"),h=document.createElement("b");h.textContent=`${_}: `;let l=document.createTextNode(b);return k.append(h,l),E.append(k),{b:h,v:l}};U0(J.reporter,`${d.user.fullName??"—"} (${d.user.email??"—"})`),U0(J.page,d.route.href);let J0=U0(J.captured,l0),n=document.createElement("label");n.className="shot-choice",n.hidden=!0;let H0=document.createElement("input");H0.type="checkbox",H0.checked=!0,H0.dataset.requestShot="",n.append(H0,document.createTextNode(` ${J.requestWithShot}`));let r0=X.screenshotDataUrl?this.screenshotSection(J,X.screenshotDataUrl):[w("p","status",J.noScreenshot)],w0=X.screenshotDataUrl?r0[0]:null;if(!X.screenshotDataUrl)n.replaceChildren();let L0=w("p","status",""),R0=Y0(J.submit,"primary"),q0=()=>{R0.disabled=A.value.trim().length===0||K==="request"&&!W};A.addEventListener("input",q0);let z=()=>{let _=K==="request";if(F.textContent=_?J.requestTitle:J.title,V.setAttribute("aria-label",_?J.requestTitle:J.title),P.textContent=`${_?J.problemInstead:J.askInstead} `,S.textContent=_?Y?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,M.hidden=!_,X2(u,_?J.requestSummaryLabel:J.summaryLabel,_?"":J.summaryRequired,!0),A.placeholder=_?J.requestSummaryPlaceholder:J.summaryPlaceholder,X2(x,_?J.requestDetailLabel:J.detailLabel),C.placeholder=_?J.requestDetailPlaceholder:J.detailPlaceholder,J0.b.textContent=`${_?J.requestLeaves:J.captured}: `,J0.v.textContent=_?J.requestLeavesWhat:l0,n.hidden=!_||!X.screenshotDataUrl,w0)X2(w0,_?J.requestAnnotateHint:J.annotateHint);for(let b of r0)b.classList.toggle("dropped",_&&!H0.checked),b.hidden=_&&!X.screenshotDataUrl;R0.textContent=_?J.requestSubmit:J.submit,q0()};H0.addEventListener("change",z);let G=(_)=>{if(_===K)return;if(_==="problem"&&!Y){this.switchToReport(J,Q,{title:A.value,detail:C.value,asking:!1,typeId:W?.id??null});return}K=_,z()},H=(_)=>{if(this.bundle!==X||Q.type!=="manual"||!_.length)return;W=_[0],T.length=0;for(let k of _){let h=Y0("","type");h.setAttribute("role","radio"),h.dataset.requestType=k.id;let l=w("span","type-body");if(l.append(w("b","",k.name)),k.description)l.append(w("span","type-hint",k.description));if(k.targetHours){let o0=w("span","type-due");o0.append(V2(_7),document.createTextNode(J.requestTarget.replace("{time}",M7(J,k.targetHours)))),l.append(o0)}h.append(V2(F8),l),h.addEventListener("click",()=>{W=k,g(),q0()}),T.push(h)}B.replaceChildren(...T),B.onkeydown=(k)=>{if(!q8.includes(k.key)||!W)return;k.preventDefault();let h=_.filter((y0,u3)=>!T[u3].hidden);if(!h.length)return;let l=h.findIndex((y0)=>y0.id===W.id),o0=k.key==="ArrowUp"||k.key==="ArrowLeft"?-1:1;W=h[l<0?0:(l+o0+h.length)%h.length],g(),T.find((y0)=>y0.dataset.requestType===W.id)?.focus()},B.classList.toggle("long",_.length>=F4),U.hidden=_.length<F4;let b=(k)=>{m.hidden=_.length<F4||k===0,m.textContent=J.requestTypeCount.replace("{n}",String(k))};b(_.length),U.oninput=()=>{let k=U.value.trim().toLowerCase(),h=null;if(_.forEach((l,o0)=>{let y0=!k||`${l.name} ${l.description}`.toLowerCase().includes(k);if(T[o0].hidden=!y0,y0&&!h)h=l}),y.hidden=!!h,b(T.filter((l)=>!l.hidden).length),h&&W&&T[_.indexOf(W)].hidden)W=h;g(),q0()},U.onkeydown=(k)=>{if(k.key==="ArrowDown"||k.key==="Enter")k.preventDefault(),T.find((h)=>h.dataset.requestType===W?.id&&!h.hidden)?.focus()},g(),O.hidden=!1,z()},D=Z??(T0&&(T0.title||T0.detail)?T0:null),q=w("p","draft");if(q.hidden=!D||!!Z,D){A.value=D.title,C.value=D.detail;let _=Y0(J.draftClear,"link");_.dataset.draftClear="",_.addEventListener("click",()=>{A.value="",C.value="",T0=null,q.hidden=!0,q0(),A.focus()}),q.append(document.createTextNode(`${J.draftRestored} · `),_)}let I=Q2(),v=(_)=>{if(H(_),K!=="request"||O.hidden||!D?.typeId)return;let b=_.find((k)=>k.id===D.typeId);if(b)W=b,g()};if(I)v(I);else if(Q.type==="manual")b0().then(v);this.keep=()=>({title:A.value,detail:C.value,asking:K==="request",typeId:W?.id??null}),V.append(N,O,q,M,u,A,x,C,E,n,...r0);let e=w("div","foot"),F0=Y0(J.close);F0.addEventListener("click",()=>this.close()),e.append(F0,L0,w("span","grow"),R0),V.append(e),z(),R0.addEventListener("click",async()=>{R0.disabled=!0,L0.dataset.tone="",L0.textContent=J.submitting;let _=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():X.screenshotDataUrl;try{if(K==="request"&&W){let h=await G4({ticketTypeId:W.id,title:A.value.trim(),description:C.value,screenshotDataUrl:H0.checked?_():null}),l=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:h,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),l)g0(`${J.requestSubmitted} — #${h.number}`,"success");return}let b=await Y4(A.value.trim(),{...X,note:C.value,screenshotDataUrl:_()}),k=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:b,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),k)g0(`${J.submitted} — #${b.number}`,"success")}catch(b){let k=q7(b,J);L0.dataset.tone="error",L0.textContent=k,g0(k,"error"),q0()}}),A.focus()}screenshotSection(J,Q){let j=Z2(J.annotateHint),Z=w("div","tools"),X=document.createElement("canvas"),V=w("div","shot");V.append(X);let K=[],Y=(R)=>{for(let O of K)O.setAttribute("aria-pressed",String(O===R))};for(let{tool:R,key:O}of P7){let P=Y0(J[O]);P.setAttribute("aria-pressed","false"),P.addEventListener("click",()=>{let S=P.getAttribute("aria-pressed")==="true";Y(S?null:P),this.annotator?.setTool(S?null:R)}),K.push(P),Z.append(P)}Z.append(w("span","sep"));let W=Y0(J.deleteSelected);W.addEventListener("click",()=>this.annotator?.deleteSelected());let N=Y0(J.clearAll);N.addEventListener("click",()=>{this.annotator?.clear(),Y(null)}),Z.append(W,N);let F=new Image;return F.onload=()=>{X.width=F.naturalWidth,X.height=F.naturalHeight,this.annotator=H4(X,F,()=>{Y(null),W.disabled=!this.annotator?.hasSelection()})},F.src=Q,[j,Z,w("p","status",J.annotateHelp),V]}}}function q4(){try{return M8()}catch{return[]}}function w($,J="",Q=""){let j=document.createElement($);if(J)j.className=J;if(Q)j.textContent=Q;return j}function M7($,J){return J>=24&&J%24===0?$.days.replace("{n}",String(J/24)):$.hours.replace("{n}",String(J))}var q8=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],F4=7,N7=[["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"}]],F8=[["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"}]],_7=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],C7=[["path",{d:"M20 6 9 17l-5-5"}]],P8="http://www.w3.org/2000/svg";function B8($,J,Q,j){let Z=Y0("","kind");Z.dataset.kind=$;let X=w("span","kind-top");return X.append(V2(J),w("b","",Q)),Z.append(X,w("span","kind-hint",j),V2(C7,"tick")),Z}function V2($,J="icon"){let Q=document.createElementNS(P8,"svg");for(let[j,Z]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}))Q.setAttribute(j,Z);for(let[j,Z]of $){let X=document.createElementNS(P8,j);for(let[V,K]of Object.entries(Z))X.setAttribute(V,K);Q.append(X)}return Q}function Y0($,J=""){let Q=document.createElement("button");if(Q.type="button",Q.textContent=$,J)Q.className=J;return Q}function Z2($,J="",Q=!1){return X2(document.createElement("label"),$,J,Q)}function X2($,J,Q="",j=!1){if($.replaceChildren(document.createTextNode(J)),j){let Z=document.createElement("span");Z.className="req",Z.textContent=" *",$.append(Z)}if(Q){let Z=document.createElement("span");Z.className="hint",Z.textContent=` ${Q}`,$.append(Z)}return $}function P4(){if(typeof window>"u"||customElements.get(j1))return;customElements.define(j1,B7())}var O7="lw-portal-handoff",N8=138.23,I7=`
192
+ `;var j1="lw-debug-reporter",T0=null;function q7($,J){if($ instanceof C0){if($.kind==="offline")return J.failedOffline;if($.kind==="unavailable")return J.failedUnavailable;if($.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",$.retryAfter??"60");return $.message||J.failed}return J.failed}var N8=()=>[];function F7($){N8=$}var P7=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function B7(){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"}),Q1(this.root),this.root.addEventListener("keydown",(J)=>{let Q=J;if(Q.key!=="Escape"||Q.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;Q.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=c2((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let Q=document.activeElement;this.returnFocus=Q instanceof HTMLElement&&Q!==document.body?Q:null;let j=$0(L().locale),Z=Q2();if(Z===null)b0();if(J.type==="manual"&&Z?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,Q){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Z=w("div","head"),X=Y0("✕","icon");X.setAttribute("aria-label",J.close),X.addEventListener("click",()=>this.close()),Z.append(w("h2","",J.chooseTitle),X);let V=M8("problem",N7,J.kindProblem,J.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report(Q,J)});let K=M8("request",P8,J.kindRequest,J.chooseRequestHint);K.dataset.choose="request",K.addEventListener("click",()=>{this.bundle=N1({reason:Q,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:q4()}),this.renderForm(J,Q,"request")});let Y=w("div","kinds choose");Y.append(V,K),Y.addEventListener("keydown",(W)=>{if(!F8.includes(W.key))return;W.preventDefault(),(this.root.activeElement===V?K:V).focus()}),j.append(Z,Y),V.focus()}async switchToReport(J,Q,j){this.root.replaceChildren();let Z=await a1();if(Z.method==="cancelled"){this.renderForm(J,Q,"request",{...j,asking:!0});return}this.bundle=N1({reason:Q,note:"",screenshotDataUrl:Z.dataUrl,screenshotMethod:Z.method,erroredQueries:q4()}),this.renderForm(J,Q,"problem",j)}async report(J,Q){let j=await a1();if(j.method==="cancelled"){this.close();return}this.bundle=N1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:q4()}),this.renderForm(Q,J,"problem")}close(J=!1){if(J)T0=null;else if(this.keep)T0=this.keep()??T0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let Q=this.returnFocus;if(this.returnFocus=null,Q?.isConnected)Q.focus()}shell(J){let Q=document.createElement("style");Q.textContent=q8;let j=document.createElement("div");j.className="backdrop";let Z=document.createElement("div");return Z.className="panel",Z.setAttribute("role","dialog"),Z.setAttribute("aria-modal","true"),Z.setAttribute("aria-label",J.title),j.append(Z),this.root.replaceChildren(Q,j),Z}renderShell(J,Q){let j=this.shell(J),Z=w("div","head");Z.append(w("h2","",J.title)),j.append(Z,w("p","status",Q))}renderForm(J,Q,j,Z){let X=this.bundle;if(!X)return;let V=this.shell(J),K=j,Y=j==="problem"||!!X.screenshotDataUrl,W=null,N=w("div","head"),F=w("h2","",J.title),R=Y0("✕","icon");R.setAttribute("aria-label",J.close),R.addEventListener("click",()=>this.close()),N.append(F,R);let O=w("p","door");O.hidden=!0;let P=w("span"),S=Y0("","link");S.dataset.switchKind="",S.addEventListener("click",()=>G(K==="problem"?"request":"problem")),O.append(P,S);let M=w("div","ask");M.hidden=!0;let D=document.createElement("input");D.type="search",D.className="type-search",D.placeholder=J.requestTypeSearch,D.setAttribute("aria-label",J.requestTypeSearch),D.dataset.requestTypeSearch="",D.hidden=!0;let B=w("div","types");B.setAttribute("role","radiogroup"),B.setAttribute("aria-label",J.requestTypeLabel);let y=w("p","status",J.requestTypeNone);y.hidden=!0;let m=w("p","status type-count","");m.hidden=!0,M.append(Z2(J.requestTypeLabel,"",!0),D,B,y,m);let T=[],g=()=>{for(let b of T){let k=b.dataset.requestType===W?.id;b.setAttribute("aria-checked",String(k)),b.tabIndex=k?0:-1}let _=T.find((b)=>b.dataset.requestType===W?.id);if(_&&B.scrollHeight>B.clientHeight){let b=_.offsetTop-B.offsetTop;if(b<B.scrollTop)B.scrollTop=b;else if(b+_.offsetHeight>B.scrollTop+B.clientHeight)B.scrollTop=b+_.offsetHeight-B.clientHeight}},A=document.createElement("input");A.type="text";let u=Z2(""),C=document.createElement("textarea"),x=Z2(""),E=w("div","meta"),{context:d}=X,l0=`${X.network.length} network · ${X.console.length} console · ${X.actionTrail.length} actions${X.replay?` · ${J.replay} ${Math.round(X.replay.durationMs/1000)}s`:""}`,D0=(_,b)=>{let k=document.createElement("div"),h=document.createElement("b");h.textContent=`${_}: `;let l=document.createTextNode(b);return k.append(h,l),E.append(k),{b:h,v:l}};D0(J.reporter,`${d.user.fullName??"—"} (${d.user.email??"—"})`),D0(J.page,d.route.href);let J0=D0(J.captured,l0),n=document.createElement("label");n.className="shot-choice",n.hidden=!0;let H0=document.createElement("input");H0.type="checkbox",H0.checked=!0,H0.dataset.requestShot="",n.append(H0,document.createTextNode(` ${J.requestWithShot}`));let r0=X.screenshotDataUrl?this.screenshotSection(J,X.screenshotDataUrl):[w("p","status",J.noScreenshot)],w0=X.screenshotDataUrl?r0[0]:null;if(!X.screenshotDataUrl)n.replaceChildren();let L0=w("p","status",""),R0=Y0(J.submit,"primary"),q0=()=>{R0.disabled=A.value.trim().length===0||K==="request"&&!W};A.addEventListener("input",q0);let z=()=>{let _=K==="request";if(F.textContent=_?J.requestTitle:J.title,V.setAttribute("aria-label",_?J.requestTitle:J.title),P.textContent=`${_?J.problemInstead:J.askInstead} `,S.textContent=_?Y?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,M.hidden=!_,X2(u,_?J.requestSummaryLabel:J.summaryLabel,_?"":J.summaryRequired,!0),A.placeholder=_?J.requestSummaryPlaceholder:J.summaryPlaceholder,X2(x,_?J.requestDetailLabel:J.detailLabel),C.placeholder=_?J.requestDetailPlaceholder:J.detailPlaceholder,J0.b.textContent=`${_?J.requestLeaves:J.captured}: `,J0.v.textContent=_?J.requestLeavesWhat:l0,n.hidden=!_||!X.screenshotDataUrl,w0)X2(w0,_?J.requestAnnotateHint:J.annotateHint);for(let b of r0)b.classList.toggle("dropped",_&&!H0.checked),b.hidden=_&&!X.screenshotDataUrl;R0.textContent=_?J.requestSubmit:J.submit,q0()};H0.addEventListener("change",z);let G=(_)=>{if(_===K)return;if(_==="problem"&&!Y){this.switchToReport(J,Q,{title:A.value,detail:C.value,asking:!1,typeId:W?.id??null});return}K=_,z()},H=(_)=>{if(this.bundle!==X||Q.type!=="manual"||!_.length)return;W=_[0],T.length=0;for(let k of _){let h=Y0("","type");h.setAttribute("role","radio"),h.dataset.requestType=k.id;let l=w("span","type-body");if(l.append(w("b","",k.name)),k.description)l.append(w("span","type-hint",k.description));if(k.targetHours){let o0=w("span","type-due");o0.append(V2(_7),document.createTextNode(J.requestTarget.replace("{time}",M7(J,k.targetHours)))),l.append(o0)}h.append(V2(P8),l),h.addEventListener("click",()=>{W=k,g(),q0()}),T.push(h)}B.replaceChildren(...T),B.onkeydown=(k)=>{if(!F8.includes(k.key)||!W)return;k.preventDefault();let h=_.filter((y0,u3)=>!T[u3].hidden);if(!h.length)return;let l=h.findIndex((y0)=>y0.id===W.id),o0=k.key==="ArrowUp"||k.key==="ArrowLeft"?-1:1;W=h[l<0?0:(l+o0+h.length)%h.length],g(),T.find((y0)=>y0.dataset.requestType===W.id)?.focus()},B.classList.toggle("long",_.length>=F4),D.hidden=_.length<F4;let b=(k)=>{m.hidden=_.length<F4||k===0,m.textContent=J.requestTypeCount.replace("{n}",String(k))};b(_.length),D.oninput=()=>{let k=D.value.trim().toLowerCase(),h=null;if(_.forEach((l,o0)=>{let y0=!k||`${l.name} ${l.description}`.toLowerCase().includes(k);if(T[o0].hidden=!y0,y0&&!h)h=l}),y.hidden=!!h,b(T.filter((l)=>!l.hidden).length),h&&W&&T[_.indexOf(W)].hidden)W=h;g(),q0()},D.onkeydown=(k)=>{if(k.key==="ArrowDown"||k.key==="Enter")k.preventDefault(),T.find((h)=>h.dataset.requestType===W?.id&&!h.hidden)?.focus()},g(),O.hidden=!1,z()},U=Z??(T0&&(T0.title||T0.detail)?T0:null),q=w("p","draft");if(q.hidden=!U||!!Z,U){A.value=U.title,C.value=U.detail;let _=Y0(J.draftClear,"link");_.dataset.draftClear="",_.addEventListener("click",()=>{A.value="",C.value="",T0=null,q.hidden=!0,q0(),A.focus()}),q.append(document.createTextNode(`${J.draftRestored} · `),_)}let I=Q2(),v=(_)=>{if(H(_),K!=="request"||O.hidden||!U?.typeId)return;let b=_.find((k)=>k.id===U.typeId);if(b)W=b,g()};if(I)v(I);else if(Q.type==="manual")b0().then(v);this.keep=()=>({title:A.value,detail:C.value,asking:K==="request",typeId:W?.id??null}),V.append(N,O,q,M,u,A,x,C,E,n,...r0);let e=w("div","foot"),F0=Y0(J.close);F0.addEventListener("click",()=>this.close()),e.append(F0,L0,w("span","grow"),R0),V.append(e),z(),R0.addEventListener("click",async()=>{R0.disabled=!0,L0.dataset.tone="",L0.textContent=J.submitting;let _=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():X.screenshotDataUrl;try{if(K==="request"&&W){let h=await G4({ticketTypeId:W.id,title:A.value.trim(),description:C.value,screenshotDataUrl:H0.checked?_():null}),l=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:h,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),l)g0(`${J.requestSubmitted} — #${h.number}`,"success");return}let b=await Y4(A.value.trim(),{...X,note:C.value,screenshotDataUrl:_()}),k=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:b,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),k)g0(`${J.submitted} — #${b.number}`,"success")}catch(b){let k=q7(b,J);L0.dataset.tone="error",L0.textContent=k,g0(k,"error"),q0()}}),A.focus()}screenshotSection(J,Q){let j=Z2(J.annotateHint),Z=w("div","tools"),X=document.createElement("canvas"),V=w("div","shot");V.append(X);let K=[],Y=(R)=>{for(let O of K)O.setAttribute("aria-pressed",String(O===R))};for(let{tool:R,key:O}of P7){let P=Y0(J[O]);P.setAttribute("aria-pressed","false"),P.addEventListener("click",()=>{let S=P.getAttribute("aria-pressed")==="true";Y(S?null:P),this.annotator?.setTool(S?null:R)}),K.push(P),Z.append(P)}Z.append(w("span","sep"));let W=Y0(J.deleteSelected);W.addEventListener("click",()=>this.annotator?.deleteSelected());let N=Y0(J.clearAll);N.addEventListener("click",()=>{this.annotator?.clear(),Y(null)}),Z.append(W,N);let F=new Image;return F.onload=()=>{X.width=F.naturalWidth,X.height=F.naturalHeight,this.annotator=H4(X,F,()=>{Y(null),W.disabled=!this.annotator?.hasSelection()})},F.src=Q,[j,Z,w("p","status",J.annotateHelp),V]}}}function q4(){try{return N8()}catch{return[]}}function w($,J="",Q=""){let j=document.createElement($);if(J)j.className=J;if(Q)j.textContent=Q;return j}function M7($,J){return J>=24&&J%24===0?$.days.replace("{n}",String(J/24)):$.hours.replace("{n}",String(J))}var F8=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],F4=7,N7=[["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"}]],P8=[["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"}]],_7=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],C7=[["path",{d:"M20 6 9 17l-5-5"}]],B8="http://www.w3.org/2000/svg";function M8($,J,Q,j){let Z=Y0("","kind");Z.dataset.kind=$;let X=w("span","kind-top");return X.append(V2(J),w("b","",Q)),Z.append(X,w("span","kind-hint",j),V2(C7,"tick")),Z}function V2($,J="icon"){let Q=document.createElementNS(B8,"svg");for(let[j,Z]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}))Q.setAttribute(j,Z);for(let[j,Z]of $){let X=document.createElementNS(B8,j);for(let[V,K]of Object.entries(Z))X.setAttribute(V,K);Q.append(X)}return Q}function Y0($,J=""){let Q=document.createElement("button");if(Q.type="button",Q.textContent=$,J)Q.className=J;return Q}function Z2($,J="",Q=!1){return X2(document.createElement("label"),$,J,Q)}function X2($,J,Q="",j=!1){if($.replaceChildren(document.createTextNode(J)),j){let Z=document.createElement("span");Z.className="req",Z.textContent=" *",$.append(Z)}if(Q){let Z=document.createElement("span");Z.className="hint",Z.textContent=` ${Q}`,$.append(Z)}return $}function P4(){if(typeof window>"u"||customElements.get(j1))return;customElements.define(j1,B7())}var O7="lw-portal-handoff",_8=138.23,I7=`
193
193
  :host { all: initial; }
194
194
  .backdrop {
195
195
  position: fixed; inset: 0; z-index: 2147483002;
@@ -219,10 +219,10 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
219
219
  .ring .track { stroke: #e2e8f0; }
220
220
  .ring .bar {
221
221
  stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
222
- stroke-dasharray: ${N8}; stroke-dashoffset: 0;
222
+ stroke-dasharray: ${_8}; stroke-dashoffset: 0;
223
223
  animation: deplete var(--secs, 3s) linear forwards;
224
224
  }
225
- @keyframes deplete { to { stroke-dashoffset: ${N8}; } }
225
+ @keyframes deplete { to { stroke-dashoffset: ${_8}; } }
226
226
  .count {
227
227
  position: absolute; inset: 0; display: grid; place-items: center;
228
228
  font-size: 18px; font-weight: 600; color: #0f172a;
@@ -266,7 +266,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
266
266
  .ring .bar { animation: none; stroke-dashoffset: 0; }
267
267
  .spinner { animation-duration: 2s; }
268
268
  }
269
- `;function _8($){if(typeof document>"u")return $.prepare().then((U)=>void $.go(U),()=>{return});let J=$0(L().locale),Q=Math.max(1,Math.floor($.seconds??3)),j=document.createElement(O7),Z=j.attachShadow({mode:"open"});Q1(Z);let X=document.createElement("style");X.textContent=I7,Z.append(X);let V=document.createElement("div");V.className="backdrop",V.innerHTML=`
269
+ `;function C8($){if(typeof document>"u")return $.prepare().then((D)=>void $.go(D),()=>{return});let J=$0(L().locale),Q=Math.max(1,Math.floor($.seconds??3)),j=document.createElement(O7),Z=j.attachShadow({mode:"open"});Q1(Z);let X=document.createElement("style");X.textContent=I7,Z.append(X);let V=document.createElement("div");V.className="backdrop",V.innerHTML=`
270
270
  <div class="card" role="dialog" aria-modal="true" aria-labelledby="lw-ho-title">
271
271
  <div class="dial">
272
272
  <svg class="ring" viewBox="0 0 52 52" aria-hidden="true">
@@ -282,7 +282,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
282
282
  <button type="button" class="cancel"></button>
283
283
  <button type="button" class="go"></button>
284
284
  </div>
285
- </div>`,Z.append(V);let K=(U)=>V.querySelector(U),Y=K(".card"),W=K(".bar"),N=K(".count"),F=K("h2"),R=K(".body"),O=K(".host"),P=K(".go"),S=K(".cancel");F.textContent=J.handoffTitle,R.textContent=J.handoffBody;try{O.textContent=new URL(L().host).host}catch{O.textContent=""}P.textContent=J.handoffGo,S.textContent=J.cancel,Y.style.setProperty("--secs",`${Q}s`),N.textContent=String(Q),document.body.append(j),requestAnimationFrame(()=>V.setAttribute("data-open","1"));let M=document.activeElement;return P.focus({preventScroll:!0}),new Promise((U)=>{let B=!1,y=null,m=!1,T=Date.now()+Q*1000,g=window.setInterval(()=>{let E=Math.ceil((T-Date.now())/1000);if(N.textContent=String(Math.max(0,E)),Date.now()>=T)C()},100);function A(E){if(B)return;if(B=!0,window.clearInterval(g),document.removeEventListener("keydown",x,!0),V.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!E)M?.focus?.({preventScroll:!0});U()}function u(E){window.clearInterval(g),W.classList.remove("spinner"),W.style.animation="none",N.textContent="",F.textContent=J.handoffBlocked,R.textContent=J.handoffBody;let d=document.createElement("a");d.className="go",d.href=E,d.target="_blank",d.rel="noopener noreferrer",d.textContent=J.handoffOpen,d.addEventListener("click",()=>A(!0)),P.replaceWith(d),d.focus({preventScroll:!0})}function C(){if(B||m)return;if(y)return $.go(y)?A(!0):u(y);window.clearInterval(g),N.textContent="",W.classList.add("spinner"),F.textContent=J.handoffPreparing}function x(E){if(E.key==="Escape")E.stopPropagation(),A(!1)}document.addEventListener("keydown",x,!0),P.addEventListener("click",C),S.addEventListener("click",()=>A(!1)),V.addEventListener("click",(E)=>{if(E.target===V)A(!1)}),$.prepare().then((E)=>{if(y=E,!B&&Date.now()>=T)C()},()=>{m=!0,window.clearInterval(g),Y.classList.add("error"),W.classList.remove("spinner"),W.style.animation="none",N.textContent="",F.textContent=J.handoffFailed,R.textContent=J.handoffBody,P.remove(),S.textContent=J.close})})}var L7="/sso";function O8($,J,Q,j){let Z=new URL(L7,$.endsWith("/")?$:`${$}/`);if(Z.searchParams.set("realm",J),Z.searchParams.set("token",Q),j)Z.searchParams.set("return",j);return Z.toString()}class z2 extends Error{constructor($="No identity provider is configured, or nobody is signed in"){super($);this.name="NoIdentityError"}}async function B4($){let J=L();if(!J.identity)throw new z2;let Q=await J.identity();if(!Q)throw new z2;return O8(J.host,J.realmKey,Q,$)}var I8=B4;function C8($,J){if(J==="_self")return window.location.assign($),!0;let Q=window.open($,"_blank");if(!Q)return!1;try{Q.opener=null}catch{}return!0}async function M4($={}){if($.announce===!1){C8(await B4($.returnTo),$.target);return}await _8({seconds:$.seconds,prepare:()=>B4($.returnTo),go:(J)=>C8(J,$.target)})}var K2='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function R7($){let J=($??"").trim();return!J||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test(J)?"":J}function Y2($){if(!$||typeof document>"u"||!document.body)return;let J="";try{J=R7(getComputedStyle(document.body).fontFamily)}catch{}if(J)$.style.setProperty("--lw-host-font",J);else $.style.removeProperty("--lw-host-font")}var S7="lw-call-ring",T7=`
285
+ </div>`,Z.append(V);let K=(D)=>V.querySelector(D),Y=K(".card"),W=K(".bar"),N=K(".count"),F=K("h2"),R=K(".body"),O=K(".host"),P=K(".go"),S=K(".cancel");F.textContent=J.handoffTitle,R.textContent=J.handoffBody;try{O.textContent=new URL(L().host).host}catch{O.textContent=""}P.textContent=J.handoffGo,S.textContent=J.cancel,Y.style.setProperty("--secs",`${Q}s`),N.textContent=String(Q),document.body.append(j),requestAnimationFrame(()=>V.setAttribute("data-open","1"));let M=document.activeElement;return P.focus({preventScroll:!0}),new Promise((D)=>{let B=!1,y=null,m=!1,T=Date.now()+Q*1000,g=window.setInterval(()=>{let E=Math.ceil((T-Date.now())/1000);if(N.textContent=String(Math.max(0,E)),Date.now()>=T)C()},100);function A(E){if(B)return;if(B=!0,window.clearInterval(g),document.removeEventListener("keydown",x,!0),V.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!E)M?.focus?.({preventScroll:!0});D()}function u(E){window.clearInterval(g),W.classList.remove("spinner"),W.style.animation="none",N.textContent="",F.textContent=J.handoffBlocked,R.textContent=J.handoffBody;let d=document.createElement("a");d.className="go",d.href=E,d.target="_blank",d.rel="noopener noreferrer",d.textContent=J.handoffOpen,d.addEventListener("click",()=>A(!0)),P.replaceWith(d),d.focus({preventScroll:!0})}function C(){if(B||m)return;if(y)return $.go(y)?A(!0):u(y);window.clearInterval(g),N.textContent="",W.classList.add("spinner"),F.textContent=J.handoffPreparing}function x(E){if(E.key==="Escape")E.stopPropagation(),A(!1)}document.addEventListener("keydown",x,!0),P.addEventListener("click",C),S.addEventListener("click",()=>A(!1)),V.addEventListener("click",(E)=>{if(E.target===V)A(!1)}),$.prepare().then((E)=>{if(y=E,!B&&Date.now()>=T)C()},()=>{m=!0,window.clearInterval(g),Y.classList.add("error"),W.classList.remove("spinner"),W.style.animation="none",N.textContent="",F.textContent=J.handoffFailed,R.textContent=J.handoffBody,P.remove(),S.textContent=J.close})})}var L7="/sso";function I8($,J,Q,j){let Z=new URL(L7,$.endsWith("/")?$:`${$}/`);if(Z.searchParams.set("realm",J),Z.searchParams.set("token",Q),j)Z.searchParams.set("return",j);return Z.toString()}class z2 extends Error{constructor($="No identity provider is configured, or nobody is signed in"){super($);this.name="NoIdentityError"}}async function B4($){let J=L();if(!J.identity)throw new z2;let Q=await J.identity();if(!Q)throw new z2;return I8(J.host,J.realmKey,Q,$)}var L8=B4;function O8($,J){if(J==="_self")return window.location.assign($),!0;let Q=window.open($,"_blank");if(!Q)return!1;try{Q.opener=null}catch{}return!0}async function M4($={}){if($.announce===!1){O8(await B4($.returnTo),$.target);return}await C8({seconds:$.seconds,prepare:()=>B4($.returnTo),go:(J)=>O8(J,$.target)})}var K2='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function R7($){let J=($??"").trim();return!J||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test(J)?"":J}function Y2($){if(!$||typeof document>"u"||!document.body)return;let J="";try{J=R7(getComputedStyle(document.body).fontFamily)}catch{}if(J)$.style.setProperty("--lw-host-font",J);else $.style.removeProperty("--lw-host-font")}var S7="lw-call-ring",T7=`
286
286
  :host { all: initial; }
287
287
  .card {
288
288
  position: fixed; right: 16px; bottom: calc(16px + var(--lw-chat-lift, 0px)); z-index: 2147483002;
@@ -333,10 +333,10 @@ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #1a1
333
333
  @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
334
334
  @keyframes spin { to { transform: rotate(360deg); } }
335
335
  @media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } .spin { animation: none; } }
336
- `,G2=($)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${$}</svg>`,L8=G2('<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"/>'),A7=G2('<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"/>'),E7=G2('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),k7=G2('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),r=null,O0=null,Z1=null;function x7($,J,Q){if(J.chatId)return Q??J.ticketTitle;return $.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var X1=()=>$0(L().locale);function f7(){if(typeof document>"u")return null;if(r?.isConnected)return r.shadowRoot;r=document.createElement(S7),r.dataset.debugReporter="true",Y2(r);let $=r.attachShadow({mode:"open"});return Q1($),document.body.append(r),$}function W2($,J,Q,j){let Z=document.createElement("button");return Z.type="button",Z.className=$,Z.innerHTML=J,Z.dataset.lwRing=Q,Z.onclick=j,Z}var I1=($)=>{let J=document.createElement("span");return J.textContent=$,J.outerHTML};function S8($,J,Q,j,Z){let X=X1();$.innerHTML="";let V=document.createElement("style");V.textContent=T7;let K=document.createElement("div");K.className="card",K.setAttribute("role","alertdialog"),K.setAttribute("aria-label",X.ringTitle),K.dataset.lwCallRing=J.id,K.dataset.lwRingMode=j;let Y=document.createElement("div");Y.className="head";let W=document.createElement("span");W.className="icon",W.innerHTML=L8;let N=document.createElement("div");N.className="words";let F=document.createElement("h2");F.textContent=X.ringTitle;let R=document.createElement("p");R.className="about",R.textContent=x7(X.ringAbout,J,X.ringChat),R.title=R.textContent,N.append(F,R),Y.append(W,N);let O=document.createElement("p");O.className="how",O.textContent=Z??(j==="frame"?X.ringHint:X.ringHow);let P=document.createElement("div");P.className="actions";let S=W2("decline",A7+I1(X.ringDecline),"decline",()=>Q.decline());if(K.append(Y,O),j==="frame"&&Q.answer){if(Q.voice)K.append(W2("test",E7+I1(X.ringTest),"test",()=>Q.voice?.()));let M=W2("answer",L8+I1(X.ringAnswer),"answer",()=>Q.answer?.());P.append(S,M)}else P.append(S,W2("open",I1(X.ringOpen),"open",()=>Q.open()));K.append(P),$.append(V,K)}function D2($,J,Q="portal"){if(O0===$.id&&r?.isConnected)return;let j=f7();if(!j)return;if(O0=$.id,S8(j,$,J,Q),w7(),Z1===null)Z1=document.title,document.title=`${X1().ringTab} — ${Z1}`}function T8($){let J=r?.shadowRoot;if(!J||O0!==$)return;let Q=J.querySelector(".answer");if(Q)Q.innerHTML=k7+I1(X1().ringAnswering),Q.disabled=!0;let j=J.querySelector(".decline");if(j)j.disabled=!0}function A8($,J){let Q=r?.isConnected?r.shadowRoot:null;if(!Q||O0!==$.id)return D2($,J,"portal");r.style.display="",S8(Q,$,J,"portal",X1().ringFallback)}function U2($){let J=r?.shadowRoot;if(!J)return;_4(),x8();let Q=X1(),j=J.querySelector(".how"),Z=J.querySelector(".actions");if(j)if(j.textContent="",$){let X=document.createElement("a");X.href=$,X.target="_blank",X.rel="noopener",X.textContent=Q.ringBlocked,X.dataset.lwRing="link",X.onclick=()=>window.setTimeout(()=>U2(),0),j.append(X)}else j.textContent=Q.ringOpened;if(Z){Z.innerHTML="";let X=document.createElement("button");X.type="button",X.className="close",X.textContent=Q.ringClose,X.dataset.lwRing="close",X.onclick=()=>h0(),Z.append(X)}}function E8($,J=!0){if(!r?.isConnected||O0!==$)return;let Q=r;if(clearTimeout(R8),!J){Q.style.display="",Q.style.opacity="";return}Q.style.transition="opacity 150ms ease-out",Q.style.opacity="0",R8=setTimeout(()=>{if(Q.style.opacity==="0")Q.style.display="none"},160)}var R8;function h0($){if($&&O0&&$!==O0)return;_4(),x8(),r?.remove(),r=null,O0=null}function k8(){return r?.isConnected?O0:null}function x8(){if(Z1===null||typeof document>"u")return;if(document.title.startsWith(X1().ringTab))document.title=Z1;Z1=null}var A0=null,N4;function w7(){_4();let $=window,J=$.AudioContext??$.webkitAudioContext;if(!J)return;try{let j=A0??new J;A0=j,j.resume?.().catch(()=>{return})}catch{return}let Q=()=>{if(!A0||A0.state!=="running")return;let j=A0.currentTime;for(let[Z,X]of[660,880].entries()){let V=A0.createOscillator(),K=A0.createGain();V.frequency.value=X,K.gain.setValueAtTime(0.0001,j+Z*0.22),K.gain.exponentialRampToValueAtTime(0.08,j+Z*0.22+0.02),K.gain.exponentialRampToValueAtTime(0.0001,j+Z*0.22+0.2),V.connect(K).connect(A0.destination),V.start(j+Z*0.22),V.stop(j+Z*0.22+0.21)}};Q(),N4=setInterval(Q,2200)}function _4(){clearInterval(N4),N4=void 0}var y7=64,g7=3500,v7=700,b7=450,h7=900,m7=20000,g8={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var u7=/^[A-Za-z0-9_-]{1,32}$/,p7=/^#[0-9a-fA-F]{6}$/,d7=["pen","rect","laser"],f8=($)=>$<0?0:$>1?1:$;function w8($,J){if(!Array.isArray($)||$.length<J||$.length>64)return null;let Q=[];for(let j of $){if(!Array.isArray(j)||j.length!==2)return null;let[Z,X]=j;if(typeof Z!=="number"||typeof X!=="number"||!Number.isFinite(Z)||!Number.isFinite(X))return null;Q.push([f8(Z),f8(X)])}return Q}function L1($){if(!$||typeof $!=="object")return null;let J=$;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!u7.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let Q=w8(J.pts,1);return Q?{op:"add",id:J.id,pts:Q}:null}if(J.op==="begin"){if(!d7.includes(J.kind)||typeof J.color!=="string"||!p7.test(J.color))return null;let Q=w8(J.pts,1);return Q?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:Q}:null}return null}function C4($,J){if($.endedAt!==null)return $.endedAt;return J-$.lastAt>20000?$.lastAt:null}function O4($,J,Q){if(J===null)return 1;let j=Q-J;if($==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class H2{marks=new Map;apply($,J=Date.now()){if($.op==="clear"){this.marks.clear();return}if($.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete($.id),this.marks.set($.id,{kind:$.kind,color:$.color,pts:$.pts.map(([j,Z])=>({x:j,y:Z,t:J})),endedAt:null,lastAt:J});return}let Q=this.marks.get($.id);if(!Q||C4(Q,J)!==null)return;if($.op==="end"){Q.endedAt=J;return}if(Q.lastAt=J,Q.kind==="rect"){let[j,Z]=$.pts[$.pts.length-1];Q.pts=[Q.pts[0],{x:j,y:Z,t:J}];return}for(let[j,Z]of $.pts)Q.pts.push({x:j,y:Z,t:J});if(Q.pts.length>4000)Q.pts.splice(0,Q.pts.length-4000)}alive($=Date.now()){for(let[J,Q]of this.marks)if(O4(Q.kind,C4(Q,$),$)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw($,J,Q,j=Date.now()){$.clearRect(0,0,J,Q);let Z=Math.max(1,Math.min(J,Q));for(let X of this.marks.values()){let V=O4(X.kind,C4(X,j),j);if(V<=0||!X.pts.length)continue;if($.save(),$.lineCap="round",$.lineJoin="round",X.kind==="pen")i7($,X,J,Q,Math.max(3,Z*0.0045),V);else if(X.kind==="rect")l7($,X,J,Q,Math.max(2.5,Z*0.003),V);else r7($,X,J,Q,Math.max(6,Z*0.008),V,j);$.restore()}}}function c7($,J,Q,j){if($.beginPath(),$.moveTo(J[0].x*Q,J[0].y*j),J.length===1){$.lineTo(J[0].x*Q+0.01,J[0].y*j);return}for(let X=1;X<J.length-1;X++){let V=J[X],K=J[X+1];$.quadraticCurveTo(V.x*Q,V.y*j,(V.x+K.x)/2*Q,(V.y+K.y)/2*j)}let Z=J[J.length-1];$.lineTo(Z.x*Q,Z.y*j)}function i7($,J,Q,j,Z,X){$.globalAlpha=X,c7($,J.pts,Q,j),$.strokeStyle="rgba(255,255,255,0.92)",$.lineWidth=Z+3,$.stroke(),$.strokeStyle=J.color,$.lineWidth=Z,$.stroke()}function l7($,J,Q,j,Z,X){let V=J.pts[0],K=J.pts[J.pts.length-1],Y=Math.min(V.x,K.x)*Q,W=Math.min(V.y,K.y)*j,N=Math.abs(K.x-V.x)*Q,F=Math.abs(K.y-V.y)*j;$.globalAlpha=X,$.fillStyle=J.color,$.globalAlpha=X*0.14,$.fillRect(Y,W,N,F),$.globalAlpha=X,$.strokeStyle="rgba(255,255,255,0.92)",$.lineWidth=Z+3,$.strokeRect(Y,W,N,F),$.strokeStyle=J.color,$.lineWidth=Z,$.strokeRect(Y,W,N,F)}function r7($,J,Q,j,Z,X,V){let K=J.pts.filter((W)=>V-W.t<=450);for(let W=1;W<K.length;W++){let N=K[W-1],F=K[W];$.globalAlpha=X*Math.max(0,1-(V-F.t)/450)*0.7,$.strokeStyle=J.color,$.lineWidth=Z*0.9,$.beginPath(),$.moveTo(N.x*Q,N.y*j),$.lineTo(F.x*Q,F.y*j),$.stroke()}let Y=J.pts[J.pts.length-1];$.globalAlpha=X,$.shadowColor=J.color,$.shadowBlur=Z*2,$.fillStyle=J.color,$.beginPath(),$.arc(Y.x*Q,Y.y*j,Z,0,Math.PI*2),$.fill(),$.shadowBlur=0,$.strokeStyle="rgba(255,255,255,0.95)",$.lineWidth=2,$.stroke()}function v8($,J,Q,j=typeof window>"u"?1:window.devicePixelRatio||1){let Z=Math.max(1,Math.round(J*j)),X=Math.max(1,Math.round(Q*j));if($.width!==Z)$.width=Z;if($.height!==X)$.height=X;let V=$.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class q2{canvas;scene;box;frame=0;constructor($,J,Q){this.canvas=$;this.scene=J;this.box=Q}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let $=()=>{this.frame=0;let{w:J,h:Q}=this.box(),j=v8(this.canvas,J,Q),Z=Date.now(),X=this.scene.alive(Z);if(j)this.scene.draw(j,J,Q,Z);if(X)this.frame=requestAnimationFrame($)};this.frame=requestAnimationFrame($)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var b8=33,I4=5000,y8=0.0012,o7=0,n7=()=>`${Date.now().toString(36)}${(o7++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class h8{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor($,J,Q=()=>{return}){this.send=$;this.scene=J;this.onChange=Q}get drawing(){return this.id?this.kind:null}begin($,J){this.end(),this.id=n7(),this.kind=$,this.last=J,this.lastSent=Date.now();let Q={op:"begin",id:this.id,kind:$,color:g8[$],pts:[J]};this.scene.apply(Q),this.send(Q),this.keep=setInterval(()=>this.stillHere(),I4),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<I4)return;this.flush();let $={op:"add",id:this.id,pts:[this.last]};this.scene.apply($),this.send($),this.lastSent=Date.now()}move($){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,$);if(this.last&&Math.abs($[0]-this.last[0])<y8&&Math.abs($[1]-this.last[1])<y8)return;if(this.last=$,this.scene.apply({op:"add",id:this.id,pts:[$]}),this.onChange(),this.kind==="rect")this.pending=[$];else this.pending.push($);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,b8-(Date.now()-this.lastSent)))}flush(){if(clearTimeout(this.timer),this.timer=void 0,!this.id||!this.pending.length)return;this.send({op:"add",id:this.id,pts:this.pending}),this.pending=[],this.lastSent=Date.now()}end(){if(!this.id)return;clearInterval(this.keep),this.keep=void 0,this.flush();let $={op:"end",id:this.id};this.scene.apply($),this.send($),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let $={op:"clear"};this.scene.apply($),this.send($),this.onChange()}}var s7="lw-call-ink",E0=null,F2=null,R1=null;function a7(){if(E0?.isConnected&&R1)return;E0=document.createElement(s7),E0.dataset.debugReporter="true";let $=E0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
337
- canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let Q=document.createElement("canvas");Q.setAttribute("aria-hidden","true"),Q.dataset.lwCallInk="",$.append(J,Q),document.body.append(E0),F2=new H2,R1=new q2(Q,F2,()=>({w:window.innerWidth,h:window.innerHeight}))}function P2($){if(typeof document>"u")return;if($.op==="clear"&&!E0)return;a7(),F2.apply($),R1.kick()}function B2(){R1?.stop(),E0?.remove(),E0=null,F2=null,R1=null}var t7="lw-call-frame",e7="lw-call",V0=16,A4=368,B0=null,c=null,m0=null,_2="",T1=null,A1="card",E4={width:A4,height:0},k4,E1=!1,x4=null,z1={answer:!1,voice:!1},k0=null,Q0=null,L4="lw-call-frame-place";function m8($,J,Q,j){let Z=new URL("embed/call",$.endsWith("/")?$:`${$}/`);if(Z.searchParams.set("realm",J),Q)Z.searchParams.set("token",Q);else Z.searchParams.set("hand","1");return Z.searchParams.set("call",j),Z.toString()}function V1($){c?.contentWindow?.postMessage({source:"lw-call-host",...$},_2)}function u8($){if(m0!==$)return;if(z1.answer=!0,E1)V1({type:"answer"})}function p8($){if(m0!==$)return;if(z1.voice=!0,E1)V1({type:"voice"})}function d8($,J,Q){return{x:Math.min(Math.max($.x,V0/2),Math.max(V0/2,Q.w-J.w-V0/2)),y:Math.min(Math.max($.y,V0/2),Math.max(V0/2,Q.h-J.h-V0/2))}}function $$($,J){if($.origin!==J.origin||$.source!==J.window)return null;let Q=$.data;return Q&&typeof Q==="object"&&Q.source===e7&&typeof Q.type==="string"?Q:null}function Y1(){return B0?.isConnected?m0:null}function c8($,J,Q,j=15000,Z=null){if(typeof document>"u")return;if(m0===J&&B0?.isConnected)return;W1(),m0=J,T1=Q,E1=!1,x4=Z,z1={answer:!1,voice:!1},A1="card",E4={width:A4,height:0},_2=new URL($).origin;try{k0=JSON.parse(sessionStorage.getItem(L4)??"null")}catch{k0=null}B0=document.createElement(t7),B0.dataset.debugReporter="true";let X=B0.attachShadow({mode:"open"}),V=document.createElement("style");V.textContent=`:host { all: initial; }
336
+ `,G2=($)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${$}</svg>`,R8=G2('<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"/>'),A7=G2('<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"/>'),E7=G2('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),k7=G2('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),r=null,O0=null,Z1=null;function x7($,J,Q){if(J.chatId)return Q??J.ticketTitle;return $.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var X1=()=>$0(L().locale);function f7(){if(typeof document>"u")return null;if(r?.isConnected)return r.shadowRoot;r=document.createElement(S7),r.dataset.debugReporter="true",Y2(r);let $=r.attachShadow({mode:"open"});return Q1($),document.body.append(r),$}function W2($,J,Q,j){let Z=document.createElement("button");return Z.type="button",Z.className=$,Z.innerHTML=J,Z.dataset.lwRing=Q,Z.onclick=j,Z}var I1=($)=>{let J=document.createElement("span");return J.textContent=$,J.outerHTML};function T8($,J,Q,j,Z){let X=X1();$.innerHTML="";let V=document.createElement("style");V.textContent=T7;let K=document.createElement("div");K.className="card",K.setAttribute("role","alertdialog"),K.setAttribute("aria-label",X.ringTitle),K.dataset.lwCallRing=J.id,K.dataset.lwRingMode=j;let Y=document.createElement("div");Y.className="head";let W=document.createElement("span");W.className="icon",W.innerHTML=R8;let N=document.createElement("div");N.className="words";let F=document.createElement("h2");F.textContent=X.ringTitle;let R=document.createElement("p");R.className="about",R.textContent=x7(X.ringAbout,J,X.ringChat),R.title=R.textContent,N.append(F,R),Y.append(W,N);let O=document.createElement("p");O.className="how",O.textContent=Z??(j==="frame"?X.ringHint:X.ringHow);let P=document.createElement("div");P.className="actions";let S=W2("decline",A7+I1(X.ringDecline),"decline",()=>Q.decline());if(K.append(Y,O),j==="frame"&&Q.answer){if(Q.voice)K.append(W2("test",E7+I1(X.ringTest),"test",()=>Q.voice?.()));let M=W2("answer",R8+I1(X.ringAnswer),"answer",()=>Q.answer?.());P.append(S,M)}else P.append(S,W2("open",I1(X.ringOpen),"open",()=>Q.open()));K.append(P),$.append(V,K)}function U2($,J,Q="portal"){if(O0===$.id&&r?.isConnected)return;let j=f7();if(!j)return;if(O0=$.id,T8(j,$,J,Q),w7(),Z1===null)Z1=document.title,document.title=`${X1().ringTab} — ${Z1}`}function A8($){let J=r?.shadowRoot;if(!J||O0!==$)return;let Q=J.querySelector(".answer");if(Q)Q.innerHTML=k7+I1(X1().ringAnswering),Q.disabled=!0;let j=J.querySelector(".decline");if(j)j.disabled=!0}function E8($,J){let Q=r?.isConnected?r.shadowRoot:null;if(!Q||O0!==$.id)return U2($,J,"portal");r.style.display="",T8(Q,$,J,"portal",X1().ringFallback)}function D2($){let J=r?.shadowRoot;if(!J)return;_4(),f8();let Q=X1(),j=J.querySelector(".how"),Z=J.querySelector(".actions");if(j)if(j.textContent="",$){let X=document.createElement("a");X.href=$,X.target="_blank",X.rel="noopener",X.textContent=Q.ringBlocked,X.dataset.lwRing="link",X.onclick=()=>window.setTimeout(()=>D2(),0),j.append(X)}else j.textContent=Q.ringOpened;if(Z){Z.innerHTML="";let X=document.createElement("button");X.type="button",X.className="close",X.textContent=Q.ringClose,X.dataset.lwRing="close",X.onclick=()=>h0(),Z.append(X)}}function k8($,J=!0){if(!r?.isConnected||O0!==$)return;let Q=r;if(clearTimeout(S8),!J){Q.style.display="",Q.style.opacity="";return}Q.style.transition="opacity 150ms ease-out",Q.style.opacity="0",S8=setTimeout(()=>{if(Q.style.opacity==="0")Q.style.display="none"},160)}var S8;function h0($){if($&&O0&&$!==O0)return;_4(),f8(),r?.remove(),r=null,O0=null}function x8(){return r?.isConnected?O0:null}function f8(){if(Z1===null||typeof document>"u")return;if(document.title.startsWith(X1().ringTab))document.title=Z1;Z1=null}var A0=null,N4;function w7(){_4();let $=window,J=$.AudioContext??$.webkitAudioContext;if(!J)return;try{let j=A0??new J;A0=j,j.resume?.().catch(()=>{return})}catch{return}let Q=()=>{if(!A0||A0.state!=="running")return;let j=A0.currentTime;for(let[Z,X]of[660,880].entries()){let V=A0.createOscillator(),K=A0.createGain();V.frequency.value=X,K.gain.setValueAtTime(0.0001,j+Z*0.22),K.gain.exponentialRampToValueAtTime(0.08,j+Z*0.22+0.02),K.gain.exponentialRampToValueAtTime(0.0001,j+Z*0.22+0.2),V.connect(K).connect(A0.destination),V.start(j+Z*0.22),V.stop(j+Z*0.22+0.21)}};Q(),N4=setInterval(Q,2200)}function _4(){clearInterval(N4),N4=void 0}var y7=64,g7=3500,v7=700,b7=450,h7=900,m7=20000,v8={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var u7=/^[A-Za-z0-9_-]{1,32}$/,p7=/^#[0-9a-fA-F]{6}$/,d7=["pen","rect","laser"],w8=($)=>$<0?0:$>1?1:$;function y8($,J){if(!Array.isArray($)||$.length<J||$.length>64)return null;let Q=[];for(let j of $){if(!Array.isArray(j)||j.length!==2)return null;let[Z,X]=j;if(typeof Z!=="number"||typeof X!=="number"||!Number.isFinite(Z)||!Number.isFinite(X))return null;Q.push([w8(Z),w8(X)])}return Q}function L1($){if(!$||typeof $!=="object")return null;let J=$;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!u7.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let Q=y8(J.pts,1);return Q?{op:"add",id:J.id,pts:Q}:null}if(J.op==="begin"){if(!d7.includes(J.kind)||typeof J.color!=="string"||!p7.test(J.color))return null;let Q=y8(J.pts,1);return Q?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:Q}:null}return null}function C4($,J){if($.endedAt!==null)return $.endedAt;return J-$.lastAt>20000?$.lastAt:null}function O4($,J,Q){if(J===null)return 1;let j=Q-J;if($==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class H2{marks=new Map;apply($,J=Date.now()){if($.op==="clear"){this.marks.clear();return}if($.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete($.id),this.marks.set($.id,{kind:$.kind,color:$.color,pts:$.pts.map(([j,Z])=>({x:j,y:Z,t:J})),endedAt:null,lastAt:J});return}let Q=this.marks.get($.id);if(!Q||C4(Q,J)!==null)return;if($.op==="end"){Q.endedAt=J;return}if(Q.lastAt=J,Q.kind==="rect"){let[j,Z]=$.pts[$.pts.length-1];Q.pts=[Q.pts[0],{x:j,y:Z,t:J}];return}for(let[j,Z]of $.pts)Q.pts.push({x:j,y:Z,t:J});if(Q.pts.length>4000)Q.pts.splice(0,Q.pts.length-4000)}alive($=Date.now()){for(let[J,Q]of this.marks)if(O4(Q.kind,C4(Q,$),$)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw($,J,Q,j=Date.now()){$.clearRect(0,0,J,Q);let Z=Math.max(1,Math.min(J,Q));for(let X of this.marks.values()){let V=O4(X.kind,C4(X,j),j);if(V<=0||!X.pts.length)continue;if($.save(),$.lineCap="round",$.lineJoin="round",X.kind==="pen")i7($,X,J,Q,Math.max(3,Z*0.0045),V);else if(X.kind==="rect")l7($,X,J,Q,Math.max(2.5,Z*0.003),V);else r7($,X,J,Q,Math.max(6,Z*0.008),V,j);$.restore()}}}function c7($,J,Q,j){if($.beginPath(),$.moveTo(J[0].x*Q,J[0].y*j),J.length===1){$.lineTo(J[0].x*Q+0.01,J[0].y*j);return}for(let X=1;X<J.length-1;X++){let V=J[X],K=J[X+1];$.quadraticCurveTo(V.x*Q,V.y*j,(V.x+K.x)/2*Q,(V.y+K.y)/2*j)}let Z=J[J.length-1];$.lineTo(Z.x*Q,Z.y*j)}function i7($,J,Q,j,Z,X){$.globalAlpha=X,c7($,J.pts,Q,j),$.strokeStyle="rgba(255,255,255,0.92)",$.lineWidth=Z+3,$.stroke(),$.strokeStyle=J.color,$.lineWidth=Z,$.stroke()}function l7($,J,Q,j,Z,X){let V=J.pts[0],K=J.pts[J.pts.length-1],Y=Math.min(V.x,K.x)*Q,W=Math.min(V.y,K.y)*j,N=Math.abs(K.x-V.x)*Q,F=Math.abs(K.y-V.y)*j;$.globalAlpha=X,$.fillStyle=J.color,$.globalAlpha=X*0.14,$.fillRect(Y,W,N,F),$.globalAlpha=X,$.strokeStyle="rgba(255,255,255,0.92)",$.lineWidth=Z+3,$.strokeRect(Y,W,N,F),$.strokeStyle=J.color,$.lineWidth=Z,$.strokeRect(Y,W,N,F)}function r7($,J,Q,j,Z,X,V){let K=J.pts.filter((W)=>V-W.t<=450);for(let W=1;W<K.length;W++){let N=K[W-1],F=K[W];$.globalAlpha=X*Math.max(0,1-(V-F.t)/450)*0.7,$.strokeStyle=J.color,$.lineWidth=Z*0.9,$.beginPath(),$.moveTo(N.x*Q,N.y*j),$.lineTo(F.x*Q,F.y*j),$.stroke()}let Y=J.pts[J.pts.length-1];$.globalAlpha=X,$.shadowColor=J.color,$.shadowBlur=Z*2,$.fillStyle=J.color,$.beginPath(),$.arc(Y.x*Q,Y.y*j,Z,0,Math.PI*2),$.fill(),$.shadowBlur=0,$.strokeStyle="rgba(255,255,255,0.95)",$.lineWidth=2,$.stroke()}function b8($,J,Q,j=typeof window>"u"?1:window.devicePixelRatio||1){let Z=Math.max(1,Math.round(J*j)),X=Math.max(1,Math.round(Q*j));if($.width!==Z)$.width=Z;if($.height!==X)$.height=X;let V=$.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class q2{canvas;scene;box;frame=0;constructor($,J,Q){this.canvas=$;this.scene=J;this.box=Q}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let $=()=>{this.frame=0;let{w:J,h:Q}=this.box(),j=b8(this.canvas,J,Q),Z=Date.now(),X=this.scene.alive(Z);if(j)this.scene.draw(j,J,Q,Z);if(X)this.frame=requestAnimationFrame($)};this.frame=requestAnimationFrame($)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var h8=33,I4=5000,g8=0.0012,o7=0,n7=()=>`${Date.now().toString(36)}${(o7++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class m8{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor($,J,Q=()=>{return}){this.send=$;this.scene=J;this.onChange=Q}get drawing(){return this.id?this.kind:null}begin($,J){this.end(),this.id=n7(),this.kind=$,this.last=J,this.lastSent=Date.now();let Q={op:"begin",id:this.id,kind:$,color:v8[$],pts:[J]};this.scene.apply(Q),this.send(Q),this.keep=setInterval(()=>this.stillHere(),I4),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<I4)return;this.flush();let $={op:"add",id:this.id,pts:[this.last]};this.scene.apply($),this.send($),this.lastSent=Date.now()}move($){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,$);if(this.last&&Math.abs($[0]-this.last[0])<g8&&Math.abs($[1]-this.last[1])<g8)return;if(this.last=$,this.scene.apply({op:"add",id:this.id,pts:[$]}),this.onChange(),this.kind==="rect")this.pending=[$];else this.pending.push($);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,h8-(Date.now()-this.lastSent)))}flush(){if(clearTimeout(this.timer),this.timer=void 0,!this.id||!this.pending.length)return;this.send({op:"add",id:this.id,pts:this.pending}),this.pending=[],this.lastSent=Date.now()}end(){if(!this.id)return;clearInterval(this.keep),this.keep=void 0,this.flush();let $={op:"end",id:this.id};this.scene.apply($),this.send($),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let $={op:"clear"};this.scene.apply($),this.send($),this.onChange()}}var s7="lw-call-ink",E0=null,F2=null,R1=null;function a7(){if(E0?.isConnected&&R1)return;E0=document.createElement(s7),E0.dataset.debugReporter="true";let $=E0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
337
+ canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let Q=document.createElement("canvas");Q.setAttribute("aria-hidden","true"),Q.dataset.lwCallInk="",$.append(J,Q),document.body.append(E0),F2=new H2,R1=new q2(Q,F2,()=>({w:window.innerWidth,h:window.innerHeight}))}function P2($){if(typeof document>"u")return;if($.op==="clear"&&!E0)return;a7(),F2.apply($),R1.kick()}function B2(){R1?.stop(),E0?.remove(),E0=null,F2=null,R1=null}var t7="lw-call-frame",e7="lw-call",V0=16,A4=368,B0=null,c=null,m0=null,_2="",T1=null,A1="card",E4={width:A4,height:0},k4,E1=!1,x4=null,z1={answer:!1,voice:!1},k0=null,Q0=null,L4="lw-call-frame-place";function u8($,J,Q,j){let Z=new URL("embed/call",$.endsWith("/")?$:`${$}/`);if(Z.searchParams.set("realm",J),Q)Z.searchParams.set("token",Q);else Z.searchParams.set("hand","1");return Z.searchParams.set("call",j),Z.toString()}function V1($){c?.contentWindow?.postMessage({source:"lw-call-host",...$},_2)}function p8($){if(m0!==$)return;if(z1.answer=!0,E1)V1({type:"answer"})}function d8($){if(m0!==$)return;if(z1.voice=!0,E1)V1({type:"voice"})}function c8($,J,Q){return{x:Math.min(Math.max($.x,V0/2),Math.max(V0/2,Q.w-J.w-V0/2)),y:Math.min(Math.max($.y,V0/2),Math.max(V0/2,Q.h-J.h-V0/2))}}function $$($,J){if($.origin!==J.origin||$.source!==J.window)return null;let Q=$.data;return Q&&typeof Q==="object"&&Q.source===e7&&typeof Q.type==="string"?Q:null}function Y1(){return B0?.isConnected?m0:null}function i8($,J,Q,j=15000,Z=null){if(typeof document>"u")return;if(m0===J&&B0?.isConnected)return;W1(),m0=J,T1=Q,E1=!1,x4=Z,z1={answer:!1,voice:!1},A1="card",E4={width:A4,height:0},_2=new URL($).origin;try{k0=JSON.parse(sessionStorage.getItem(L4)??"null")}catch{k0=null}B0=document.createElement(t7),B0.dataset.debugReporter="true";let X=B0.attachShadow({mode:"open"}),V=document.createElement("style");V.textContent=`:host { all: initial; }
338
338
  iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
339
- iframe.on { visibility: visible; }`,c=document.createElement("iframe"),c.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",c.title="สายจากทีมงาน",c.dataset.lwCallFrame=J,c.setAttribute("allowtransparency","true"),c.src=$,X.append(V,c),document.body.append(B0),K1(),window.addEventListener("message",i8),window.addEventListener("resize",K1),f4(`lw-call:${J}`),k4=setTimeout(()=>{if(!E1)R4("timeout")},j)}function W1(){if(B0)f4(S4?.handle??null,S4?.readableBy);B2(),clearTimeout(k4),window.removeEventListener("message",i8),window.removeEventListener("resize",K1),M2(!1),B0?.remove(),B0=null,c=null,m0=null,T1=null,Q0=null,x4=null,z1={answer:!1,voice:!1}}function R4($){let J=T1;W1(),J?.failed($)}function i8($){if(!c)return;let J=$$($,{origin:_2,window:c.contentWindow});if(!J)return;switch(J.type){case"hello":x4?.then((Q)=>{if(!c||m0===null)return;if(Q)V1({type:"token",token:Q});else R4("no_token")});return;case"ready":if(E1=!0,clearTimeout(k4),c.classList.add("on"),T1?.ready(),z1.answer)V1({type:"answer"});if(z1.voice)V1({type:"voice"});return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")E4={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&A1==="card")J$();A1=J.layout}return K1();case"drag":return T4(J);case"home":return k0=null,r8(),K1();case"done":{let Q=T1;W1(),Q?.done();return}case"failed":return R4(J.reason??"failed");case"ink":{let Q=L1(J.op);if(Q)P2(Q);return}}}function f4($,J=_2){let Q=typeof navigator>"u"?void 0:navigator.mediaDevices;try{Q?.setCaptureHandleConfig?.($&&J?{handle:$,exposeOrigin:!1,permittedOrigins:[J]}:{})}catch{}}var S4=null;function l8($,J){if(S4={handle:$,readableBy:J},!B0?.isConnected)f4($,J)}function T4($){if(!c||A1!=="card"||typeof $.x!=="number"||typeof $.y!=="number")return;if($.phase==="start"){let J=c.getBoundingClientRect();Q0={sx:$.x,sy:$.y,x:J.left,y:J.top,lx:$.x,ly:$.y},M2(!0);return}if(!Q0)return;if(Q0.lx=$.x,Q0.ly=$.y,k0=d8({x:Q0.x+($.x-Q0.sx),y:Q0.y+($.y-Q0.sy)},o8(),N2()),K1(),$.phase==="end")Q0=null,M2(!1),r8()}var S1=null;function M2($){if(S1){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,S1,!0);S1=null}if(!$)return;S1=(J)=>{if(!Q0)return M2(!1);if(J.type==="pointermove"&&J.buttons!==0)return T4({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let Q=J.type==="pointerup";T4({type:"drag",phase:"end",x:Q?J.screenX:Q0.lx,y:Q?J.screenY:Q0.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,S1,!0)}function J$(){if(!c?.contentWindow)return;let $=c.getBoundingClientRect();V1({type:"corner",x:Math.round($.left),y:Math.round($.top),width:Math.round($.width)})}function r8(){try{if(k0)sessionStorage.setItem(L4,JSON.stringify(k0));else sessionStorage.removeItem(L4)}catch{}}var N2=()=>({w:window.innerWidth,h:window.innerHeight});function o8(){let $=N2();return{w:Math.min(A4,$.w-V0),h:Math.min(E4.height||0,$.h-V0)}}function K1(){if(!c)return;let $=c.style;if(A1==="full"){Object.assign($,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=o8(),Q=N2().w<480;if($.width=Q?`calc(100vw - ${V0}px)`:`${J.w}px`,$.height=`${J.h}px`,k0&&!Q){let j=d8(k0,J,N2());Object.assign($,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign($,{left:Q?`${V0/2}px`:"",top:"",right:Q?"":`${V0/2}px`,bottom:`calc(${V0/2}px + var(--lw-chat-lift, 0px))`})}var C2=[2000,5000,15000,30000,60000],n8=new Set(["ringing","active"]),Q$=20000,w4=!1,u0=!1,s8=0,j$=5,x1=null,Q3=0,O2,y4,g4,j3=($)=>$.endsWith("/")?$:`${$}/`;function Z$($,J){let Q=new URL("api/presence/ws",j3($));return Q.protocol=Q.protocol==="https:"?"wss:":"ws:",Q.searchParams.set("t",J),Q.toString()}function X$($){if($.chatId||!$.ticketId)return`/me/chat?call=${$.id}`;return`/me/tickets/${$.ticketId}?call=${$.id}`}function V$($){return $.status==="ringing"&&($.side==="reporter"||$.side===void 0||$.side===null)}var v4=new Set;function Z3($){return v4.add($),()=>v4.delete($)}var a8=()=>L().ring!==!1;async function p0(){let $=L().identity;if(!$)return null;try{return await $()??null}catch{return null}}async function u4($,J){let Q=L();return fetch(new URL($,j3(Q.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function L2(){if(w4||typeof window>"u"||typeof WebSocket>"u")return;let $=L();if(!$.identity||$.ring===!1&&!$.chat)return;w4=!0,u0=!1,Y$($.host);try{l8(`lw-tab:${V3()}`,new URL($.host).origin)}catch{}X3()}function z$(){u0=!0,w4=!1,clearTimeout(y4),clearInterval(O2),clearTimeout(g4);try{x1?.close(1000,"bye")}catch{}x1=null,h0(),W1()}function k1($=!1){if(u0)return;let J=$?C2[C2.length-1]:C2[Math.min(Q3++,C2.length-1)];clearTimeout(y4),y4=setTimeout(()=>void X3(),J)}async function X3(){if(u0)return;let $=await p0();if(!$){if(++s8>=j$){u0=!0;return}return k1(!0)}s8=0;let J;try{J=await u4(L().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",$)}catch{return k1()}if(J.status===401||J.status===404||J.status===403){u0=!0;return}if(!J.ok)return k1(J.status===429);let Q;try{Q=await J.json()}catch{return k1()}if(!Q.ticket){u0=!0;return}if(Q.calls&&Q.call&&a8())J3(Q.call);let j=new WebSocket(Z$(L().host,Q.ticket));x1=j,j.onopen=()=>{Q3=0,j.send(JSON.stringify({type:"tab",id:V3()})),clearInterval(O2),O2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},Q$)},j.onmessage=(Z)=>{try{let X=JSON.parse(String(Z.data));if(X.type==="chat-changed"||X.type==="ticket-changed"||X.type==="chat-seen"){for(let V of v4)V(X);return}if(X.type==="call-state"&&X.call&&typeof X.call==="object"){if(a8())J3(X.call)}else if(X.type==="call-ink"&&typeof X.call==="string"){let V=L1(X.op);if(V)m4=X.call,P2(V)}}catch{}},j.onclose=()=>{if(clearInterval(O2),x1===j)x1=null;k1()}}var b4="lw-call-framed";function K$(){try{return sessionStorage.getItem(b4)}catch{return null}}function I2($){try{if($)sessionStorage.setItem(b4,$);else sessionStorage.removeItem(b4)}catch{}}var t8=!1;function Y$($){if(t8||typeof document>"u")return;t8=!0;try{let J=new URL($).origin;for(let Q of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=Q,j.href=J,Q==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function e8($){let J=L();if(J.callFrame===!1||Y1()===$.id)return;I2($.id),c8(m8(J.host,J.realmKey,null,$.id),$.id,{ready:()=>E8($.id),done:()=>{I2(null),h0($.id)},failed:()=>{I2(null),A8($,h4($))}},15000,p0())}var h4=($)=>({open:()=>W$($),decline:()=>void G$($)}),x0=null;function V3(){if(x0)return x0;try{x0=sessionStorage.getItem($3)}catch{}if(!x0||!/^[A-Za-z0-9_-]{8,40}$/.test(x0)){let $=new Uint8Array(12);crypto.getRandomValues($),x0=Array.from($,(J)=>J.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem($3,x0)}catch{}}return x0}var $3="lw-tab-id",m4=null;function J3($){if(!n8.has($.status)&&m4===$.id&&Y1()!==$.id)m4=null,B2();if(!V$($)){if(h0($.id),$.status==="active"&&K$()===$.id&&!Y1())e8($);if(!n8.has($.status)&&Y1()===$.id)setTimeout(()=>{if(Y1()===$.id)W1(),I2(null)},12000);return}if(L().callFrame===!1)D2($,h4($),"portal");else D2($,{...h4($),answer:()=>{T8($.id),u8($.id)},voice:()=>p8($.id)},"frame"),e8($);clearTimeout(g4);let J=new Date($.ringUntil).getTime()-Date.now();g4=setTimeout(()=>{if(k8()===$.id)h0($.id)},Math.max(5000,J+5000))}function W$($){let J=window.open("about:blank","_blank");(async()=>{let Q=await p0();if(Q)u4(`ingest/calls/${$.id}/coming`,Q).catch(()=>{return});let j;try{j=await I8(X$($))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}U2()}else U2(j)})()}async function G$($){h0($.id);let J=await p0();if(J)await u4(`ingest/calls/${$.id}/decline`,J).catch(()=>{return})}function p4($,J,Q,j){let Z=[];for(let X of $){if(X.right<=J.left||X.left>=J.right||X.bottom<=X.top)continue;Z.push([Q-X.bottom-8-j,Q-X.top+8])}return Z.sort((X,V)=>X[0]-V[0])}function z3($,J,Q,j){if(j<Q)return null;let Z=(Y)=>J.some(([W,N])=>Y>W&&Y<N),X=(Y)=>Math.min(Math.max(Y,Q),j),V=X($);if(!Z(V))return V;let K=[Q,j,...J.flatMap(([Y,W])=>[Y,W])].map(X).filter((Y)=>!Z(Y));if(!K.length)return null;return K.reduce((Y,W)=>{let N=Math.abs(W-V),F=Math.abs(Y-V);return N<F||N===F&&W>Y?W:Y})}var D$=3;function W3($,J,Q,j,Z,X,V=null){let K=new Map,Y=(M,U)=>{let B=`${M}:${U}`;if(!K.has(B))K.set(B,J(M,U));return K.get(B)},W=(M,U)=>M==="right"?{left:Q.w-U-j,right:Q.w-U}:{left:U,right:U+j},N=(M,U)=>p4(Y(M,U),W(M,U),Q.h,j),F=(M)=>Math.abs(M.y-$.y)+Math.abs(M.x-$.x)+(M.side===$.side?0:160),R=(M)=>z3(M.y,N(M.side,M.x),Z,X)===M.y,O=(M)=>V&&(V.side!==M.side||V.x!==M.x||V.y!==M.y)&&F(V)<=F(M)+48&&R(V)?V:M;if(R($))return O($);let P=null,S=$.side==="right"?"left":"right";for(let M of[$.side,S]){let U=M===$.side?0:160;if(P&&U>=F(P))break;let B=$.x;for(let y=0;y<=D$;y++){let m=z3($.y,N(M,B),Z,X);if(m!==null&&(!P||F({side:M,x:B,y:m})<F(P)))P={side:M,x:B,y:m};let T=W(M,B),g={top:Q.h-$.y-j-8,bottom:Q.h-$.y+8},A=Y(M,B).filter((C)=>C.top<g.bottom&&C.bottom>g.top&&C.left<T.right&&C.right>T.left);if(!A.length)break;let u=Math.round(M==="right"?Math.max(...A.map((C)=>Q.w-C.left+8)):Math.max(...A.map((C)=>C.right+8)));if(u<=B||u+j>Q.w/2||P&&U+u-$.x>=F(P))break;B=u}}return P?O(P):$}function U$($){if(typeof $!=="string"||!$.startsWith("/")||$.length>200)return null;let Q=($.length>1?$.replace(/\/+$/,""):"").split(/(\*\*|\*)/).map((j)=>j==="**"?".*":j==="*"?"[^/]*":j.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("");try{return new RegExp(`^${Q}(?:/.*)?$`)}catch{return null}}function G3($,J){let Q=null;for(let j of J??[]){let Z=U$(j.path);if(!Z||!Z.test($))continue;if(!Q||j.path.replace(/\*/g,"").length>Q.path.replace(/\*/g,"").length)Q=j}return Q}var K3=/^LW-/,H$='a[href],button,input,select,textarea,summary,label,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[role="radio"],[role="option"],[role="slider"],[role="combobox"],[role="textbox"],[contenteditable=""],[contenteditable="true"],[tabindex]:not([tabindex="-1"])',Y3=/(auto|scroll|overlay)/,q$='button:disabled,input:disabled,select:disabled,textarea:disabled,[aria-disabled="true"]';function D3($,J,Q={}){if(typeof document>"u"||typeof document.elementsFromPoint!=="function")return $.map(()=>[]);let j=Q.step??16,Z=document.documentElement,X=document.body,V=new Map,K=(U)=>V.get(U)??(V.set(U,getComputedStyle(U)),V.get(U)),Y=J.w*J.h,W=(U)=>U.width*U.height>0.34*Y||U.width>=J.w*0.9&&U.height>=J.h*0.9,N=(U)=>{let B=K(U);return Y3.test(B.overflowY)&&U.scrollHeight>U.clientHeight+1||Y3.test(B.overflowX)&&U.scrollWidth>U.clientWidth+1},F=document.scrollingElement??Z,R=F.scrollHeight>F.clientHeight+1&&K(Z).overflowY!=="hidden"&&(!X||K(X).overflowY!=="hidden"),O=(U,B)=>{let y={top:0,bottom:J.h};for(let A=U.parentElement;A&&A!==Z&&A!==X;A=A.parentElement){let u=K(A);if(u.overflowY!=="visible"&&u.overflowY!=="clip"){let C=A.getBoundingClientRect();y={top:C.top,bottom:C.bottom};break}}let m=U.getBoundingClientRect(),T=parseFloat(B.top),g=parseFloat(B.bottom);return!Number.isNaN(g)&&m.bottom>=y.bottom-g-1||!Number.isNaN(T)&&m.top<=y.top+T+1},P=(U)=>{let B=null,y=!1,m=1;for(let T=U;T&&T!==Z&&T!==X;T=T.parentElement){let g=K(T),A=parseFloat(g.opacity);if(!Number.isNaN(A))m*=A;if(g.position==="fixed"||g.position==="sticky"&&O(T,g)){B=T;break}if(T!==U&&N(T))y=!0}if(!B&&R)y=!0;return{float:B,scrolled:y,opacity:m}},S=new Map,M=(U,B)=>{let y=document.elementFromPoint(U,B);if(!y||!K3.test(y.tagName))return y;return document.elementsFromPoint(U,B).find((m)=>!K3.test(m.tagName))??null};return $.map((U)=>{let B=new Set,y=new Set,m=[],T=(u)=>{if(y.has(u))return;y.add(u);let C=u.getBoundingClientRect();if(C.width>0&&C.height>0)m.push({top:C.top,bottom:C.bottom,left:C.left,right:C.right})},g=new Set,A=[U.left+6,(U.left+U.right)/2,U.right-6];for(let u=j/2;u<J.h;u+=j)for(let C of A){let x=M(C,u);if(!x||x===Z||x===X||B.has(x))continue;if(B.add(x),Q.extra){let n=null;try{n=x.closest(Q.extra)}catch{n=null}if(n){T(n);continue}}let{float:E,scrolled:d,opacity:l0}=S.get(x)??(S.set(x,P(x)),S.get(x));if(l0<0.05)continue;let U0=x.closest(H$),J0=U0&&(!E||E.contains(U0))?U0:null;if(E&&!W(E.getBoundingClientRect())){let n=J0??x;if(!W(n.getBoundingClientRect()))T(n);continue}if(!d&&(E||!R))g.add(E);if(d||!J0||W(J0.getBoundingClientRect()))continue;T(J0)}for(let u of g)for(let C of(u??X)?.querySelectorAll(q$)??[]){let x=C.getBoundingClientRect();if(!x.width||!x.height||x.right<=U.left||x.left>=U.right||W(x)||K(C).visibility==="hidden")continue;let E=S.get(C)??(S.set(C,P(C)),S.get(C));if(E.float!==u||E.scrolled||E.opacity<0.05)continue;let d=M(Math.min(Math.max((x.left+x.right)/2,U.left+6),U.right-6),(x.top+x.bottom)/2);if(d&&d!==C&&!C.contains(d)&&!d.contains(C))continue;T(C)}return m})}var F$="lw-support-chat",P$="lw-support-frame",B$="lw-support-host",s=56,c0=12;function M$($){return typeof $==="number"&&Number.isFinite($)?Math.round(Math.min(Math.max($,32),96)):s}var i=s,N$='<svg viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/></svg>',_$=`
339
+ iframe.on { visibility: visible; }`,c=document.createElement("iframe"),c.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",c.title="สายจากทีมงาน",c.dataset.lwCallFrame=J,c.setAttribute("allowtransparency","true"),c.src=$,X.append(V,c),document.body.append(B0),K1(),window.addEventListener("message",l8),window.addEventListener("resize",K1),f4(`lw-call:${J}`),k4=setTimeout(()=>{if(!E1)R4("timeout")},j)}function W1(){if(B0)f4(S4?.handle??null,S4?.readableBy);B2(),clearTimeout(k4),window.removeEventListener("message",l8),window.removeEventListener("resize",K1),M2(!1),B0?.remove(),B0=null,c=null,m0=null,T1=null,Q0=null,x4=null,z1={answer:!1,voice:!1}}function R4($){let J=T1;W1(),J?.failed($)}function l8($){if(!c)return;let J=$$($,{origin:_2,window:c.contentWindow});if(!J)return;switch(J.type){case"hello":x4?.then((Q)=>{if(!c||m0===null)return;if(Q)V1({type:"token",token:Q});else R4("no_token")});return;case"ready":if(E1=!0,clearTimeout(k4),c.classList.add("on"),T1?.ready(),z1.answer)V1({type:"answer"});if(z1.voice)V1({type:"voice"});return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")E4={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&A1==="card")J$();A1=J.layout}return K1();case"drag":return T4(J);case"home":return k0=null,o8(),K1();case"done":{let Q=T1;W1(),Q?.done();return}case"failed":return R4(J.reason??"failed");case"ink":{let Q=L1(J.op);if(Q)P2(Q);return}}}function f4($,J=_2){let Q=typeof navigator>"u"?void 0:navigator.mediaDevices;try{Q?.setCaptureHandleConfig?.($&&J?{handle:$,exposeOrigin:!1,permittedOrigins:[J]}:{})}catch{}}var S4=null;function r8($,J){if(S4={handle:$,readableBy:J},!B0?.isConnected)f4($,J)}function T4($){if(!c||A1!=="card"||typeof $.x!=="number"||typeof $.y!=="number")return;if($.phase==="start"){let J=c.getBoundingClientRect();Q0={sx:$.x,sy:$.y,x:J.left,y:J.top,lx:$.x,ly:$.y},M2(!0);return}if(!Q0)return;if(Q0.lx=$.x,Q0.ly=$.y,k0=c8({x:Q0.x+($.x-Q0.sx),y:Q0.y+($.y-Q0.sy)},n8(),N2()),K1(),$.phase==="end")Q0=null,M2(!1),o8()}var S1=null;function M2($){if(S1){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,S1,!0);S1=null}if(!$)return;S1=(J)=>{if(!Q0)return M2(!1);if(J.type==="pointermove"&&J.buttons!==0)return T4({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let Q=J.type==="pointerup";T4({type:"drag",phase:"end",x:Q?J.screenX:Q0.lx,y:Q?J.screenY:Q0.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,S1,!0)}function J$(){if(!c?.contentWindow)return;let $=c.getBoundingClientRect();V1({type:"corner",x:Math.round($.left),y:Math.round($.top),width:Math.round($.width)})}function o8(){try{if(k0)sessionStorage.setItem(L4,JSON.stringify(k0));else sessionStorage.removeItem(L4)}catch{}}var N2=()=>({w:window.innerWidth,h:window.innerHeight});function n8(){let $=N2();return{w:Math.min(A4,$.w-V0),h:Math.min(E4.height||0,$.h-V0)}}function K1(){if(!c)return;let $=c.style;if(A1==="full"){Object.assign($,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=n8(),Q=N2().w<480;if($.width=Q?`calc(100vw - ${V0}px)`:`${J.w}px`,$.height=`${J.h}px`,k0&&!Q){let j=c8(k0,J,N2());Object.assign($,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign($,{left:Q?`${V0/2}px`:"",top:"",right:Q?"":`${V0/2}px`,bottom:`calc(${V0/2}px + var(--lw-chat-lift, 0px))`})}var C2=[2000,5000,15000,30000,60000],Q$=15000;function j$($,J,Q=Math.random){if($==="restart")return 1000+Math.round(Q()*Q$);let j=$==="slow"?C2[C2.length-1]:C2[Math.min(J,C2.length-1)];return Math.round(j*(0.5+Q()))}var s8=new Set(["ringing","active"]),Z$=20000,w4=!1,u0=!1,a8=0,X$=5,x1=null,y4=0,O2,g4,v4,j3=($)=>$.endsWith("/")?$:`${$}/`;function V$($,J){let Q=new URL("api/presence/ws",j3($));return Q.protocol=Q.protocol==="https:"?"wss:":"ws:",Q.searchParams.set("t",J),Q.toString()}function z$($){if($.chatId||!$.ticketId)return`/me/chat?call=${$.id}`;return`/me/tickets/${$.ticketId}?call=${$.id}`}function K$($){return $.status==="ringing"&&($.side==="reporter"||$.side===void 0||$.side===null)}var b4=new Set;function Z3($){return b4.add($),()=>b4.delete($)}var t8=()=>L().ring!==!1;async function p0(){let $=L().identity;if(!$)return null;try{return await $()??null}catch{return null}}async function p4($,J){let Q=L();return fetch(new URL($,j3(Q.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function L2(){if(w4||typeof window>"u"||typeof WebSocket>"u")return;let $=L();if(!$.identity||$.ring===!1&&!$.chat)return;w4=!0,u0=!1,G$($.host);try{r8(`lw-tab:${V3()}`,new URL($.host).origin)}catch{}X3()}function Y$(){u0=!0,w4=!1,clearTimeout(g4),clearInterval(O2),clearTimeout(v4);try{x1?.close(1000,"bye")}catch{}x1=null,h0(),W1()}function k1($=null){if(u0)return;let J=j$($,$?y4:y4++);clearTimeout(g4),g4=setTimeout(()=>void X3(),J)}async function X3(){if(u0)return;let $=await p0();if(!$){if(++a8>=X$){u0=!0;return}return k1("slow")}a8=0;let J;try{J=await p4(L().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",$)}catch{return k1()}if(J.status===401||J.status===404||J.status===403){u0=!0;return}if(!J.ok)return k1(J.status===429?"slow":J.status===502||J.status===503?"restart":null);let Q;try{Q=await J.json()}catch{return k1()}if(!Q.ticket){u0=!0;return}if(Q.calls&&Q.call&&t8())Q3(Q.call);let j=new WebSocket(V$(L().host,Q.ticket));x1=j,j.onopen=()=>{y4=0,j.send(JSON.stringify({type:"tab",id:V3()})),clearInterval(O2),O2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},Z$)},j.onmessage=(Z)=>{try{let X=JSON.parse(String(Z.data));if(X.type==="chat-changed"||X.type==="ticket-changed"||X.type==="chat-seen"){for(let V of b4)V(X);return}if(X.type==="call-state"&&X.call&&typeof X.call==="object"){if(t8())Q3(X.call)}else if(X.type==="call-ink"&&typeof X.call==="string"){let V=L1(X.op);if(V)u4=X.call,P2(V)}}catch{}},j.onclose=(Z)=>{if(clearInterval(O2),x1===j)x1=null;k1(Z.code===1012?"restart":null)}}var h4="lw-call-framed";function W$(){try{return sessionStorage.getItem(h4)}catch{return null}}function I2($){try{if($)sessionStorage.setItem(h4,$);else sessionStorage.removeItem(h4)}catch{}}var e8=!1;function G$($){if(e8||typeof document>"u")return;e8=!0;try{let J=new URL($).origin;for(let Q of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=Q,j.href=J,Q==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function $3($){let J=L();if(J.callFrame===!1||Y1()===$.id)return;I2($.id),i8(u8(J.host,J.realmKey,null,$.id),$.id,{ready:()=>k8($.id),done:()=>{I2(null),h0($.id)},failed:()=>{I2(null),E8($,m4($))}},15000,p0())}var m4=($)=>({open:()=>U$($),decline:()=>void D$($)}),x0=null;function V3(){if(x0)return x0;try{x0=sessionStorage.getItem(J3)}catch{}if(!x0||!/^[A-Za-z0-9_-]{8,40}$/.test(x0)){let $=new Uint8Array(12);crypto.getRandomValues($),x0=Array.from($,(J)=>J.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(J3,x0)}catch{}}return x0}var J3="lw-tab-id",u4=null;function Q3($){if(!s8.has($.status)&&u4===$.id&&Y1()!==$.id)u4=null,B2();if(!K$($)){if(h0($.id),$.status==="active"&&W$()===$.id&&!Y1())$3($);if(!s8.has($.status)&&Y1()===$.id)setTimeout(()=>{if(Y1()===$.id)W1(),I2(null)},12000);return}if(L().callFrame===!1)U2($,m4($),"portal");else U2($,{...m4($),answer:()=>{A8($.id),p8($.id)},voice:()=>d8($.id)},"frame"),$3($);clearTimeout(v4);let J=new Date($.ringUntil).getTime()-Date.now();v4=setTimeout(()=>{if(x8()===$.id)h0($.id)},Math.max(5000,J+5000))}function U$($){let J=window.open("about:blank","_blank");(async()=>{let Q=await p0();if(Q)p4(`ingest/calls/${$.id}/coming`,Q).catch(()=>{return});let j;try{j=await L8(z$($))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}D2()}else D2(j)})()}async function D$($){h0($.id);let J=await p0();if(J)await p4(`ingest/calls/${$.id}/decline`,J).catch(()=>{return})}function d4($,J,Q,j){let Z=[];for(let X of $){if(X.right<=J.left||X.left>=J.right||X.bottom<=X.top)continue;Z.push([Q-X.bottom-8-j,Q-X.top+8])}return Z.sort((X,V)=>X[0]-V[0])}function z3($,J,Q,j){if(j<Q)return null;let Z=(Y)=>J.some(([W,N])=>Y>W&&Y<N),X=(Y)=>Math.min(Math.max(Y,Q),j),V=X($);if(!Z(V))return V;let K=[Q,j,...J.flatMap(([Y,W])=>[Y,W])].map(X).filter((Y)=>!Z(Y));if(!K.length)return null;return K.reduce((Y,W)=>{let N=Math.abs(W-V),F=Math.abs(Y-V);return N<F||N===F&&W>Y?W:Y})}var H$=3;function W3($,J,Q,j,Z,X,V=null){let K=new Map,Y=(M,D)=>{let B=`${M}:${D}`;if(!K.has(B))K.set(B,J(M,D));return K.get(B)},W=(M,D)=>M==="right"?{left:Q.w-D-j,right:Q.w-D}:{left:D,right:D+j},N=(M,D)=>d4(Y(M,D),W(M,D),Q.h,j),F=(M)=>Math.abs(M.y-$.y)+Math.abs(M.x-$.x)+(M.side===$.side?0:160),R=(M)=>z3(M.y,N(M.side,M.x),Z,X)===M.y,O=(M)=>V&&(V.side!==M.side||V.x!==M.x||V.y!==M.y)&&F(V)<=F(M)+48&&R(V)?V:M;if(R($))return O($);let P=null,S=$.side==="right"?"left":"right";for(let M of[$.side,S]){let D=M===$.side?0:160;if(P&&D>=F(P))break;let B=$.x;for(let y=0;y<=H$;y++){let m=z3($.y,N(M,B),Z,X);if(m!==null&&(!P||F({side:M,x:B,y:m})<F(P)))P={side:M,x:B,y:m};let T=W(M,B),g={top:Q.h-$.y-j-8,bottom:Q.h-$.y+8},A=Y(M,B).filter((C)=>C.top<g.bottom&&C.bottom>g.top&&C.left<T.right&&C.right>T.left);if(!A.length)break;let u=Math.round(M==="right"?Math.max(...A.map((C)=>Q.w-C.left+8)):Math.max(...A.map((C)=>C.right+8)));if(u<=B||u+j>Q.w/2||P&&D+u-$.x>=F(P))break;B=u}}return P?O(P):$}function q$($){if(typeof $!=="string"||!$.startsWith("/")||$.length>200)return null;let Q=($.length>1?$.replace(/\/+$/,""):"").split(/(\*\*|\*)/).map((j)=>j==="**"?".*":j==="*"?"[^/]*":j.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("");try{return new RegExp(`^${Q}(?:/.*)?$`)}catch{return null}}function G3($,J){let Q=null;for(let j of J??[]){let Z=q$(j.path);if(!Z||!Z.test($))continue;if(!Q||j.path.replace(/\*/g,"").length>Q.path.replace(/\*/g,"").length)Q=j}return Q}var K3=/^LW-/,F$='a[href],button,input,select,textarea,summary,label,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[role="radio"],[role="option"],[role="slider"],[role="combobox"],[role="textbox"],[contenteditable=""],[contenteditable="true"],[tabindex]:not([tabindex="-1"])',Y3=/(auto|scroll|overlay)/,P$='button:disabled,input:disabled,select:disabled,textarea:disabled,[aria-disabled="true"]';function U3($,J,Q={}){if(typeof document>"u"||typeof document.elementsFromPoint!=="function")return $.map(()=>[]);let j=Q.step??16,Z=document.documentElement,X=document.body,V=new Map,K=(D)=>V.get(D)??(V.set(D,getComputedStyle(D)),V.get(D)),Y=J.w*J.h,W=(D)=>D.width*D.height>0.34*Y||D.width>=J.w*0.9&&D.height>=J.h*0.9,N=(D)=>{let B=K(D);return Y3.test(B.overflowY)&&D.scrollHeight>D.clientHeight+1||Y3.test(B.overflowX)&&D.scrollWidth>D.clientWidth+1},F=document.scrollingElement??Z,R=F.scrollHeight>F.clientHeight+1&&K(Z).overflowY!=="hidden"&&(!X||K(X).overflowY!=="hidden"),O=(D,B)=>{let y={top:0,bottom:J.h};for(let A=D.parentElement;A&&A!==Z&&A!==X;A=A.parentElement){let u=K(A);if(u.overflowY!=="visible"&&u.overflowY!=="clip"){let C=A.getBoundingClientRect();y={top:C.top,bottom:C.bottom};break}}let m=D.getBoundingClientRect(),T=parseFloat(B.top),g=parseFloat(B.bottom);return!Number.isNaN(g)&&m.bottom>=y.bottom-g-1||!Number.isNaN(T)&&m.top<=y.top+T+1},P=(D)=>{let B=null,y=!1,m=1;for(let T=D;T&&T!==Z&&T!==X;T=T.parentElement){let g=K(T),A=parseFloat(g.opacity);if(!Number.isNaN(A))m*=A;if(g.position==="fixed"||g.position==="sticky"&&O(T,g)){B=T;break}if(T!==D&&N(T))y=!0}if(!B&&R)y=!0;return{float:B,scrolled:y,opacity:m}},S=new Map,M=(D,B)=>{let y=document.elementFromPoint(D,B);if(!y||!K3.test(y.tagName))return y;return document.elementsFromPoint(D,B).find((m)=>!K3.test(m.tagName))??null};return $.map((D)=>{let B=new Set,y=new Set,m=[],T=(u)=>{if(y.has(u))return;y.add(u);let C=u.getBoundingClientRect();if(C.width>0&&C.height>0)m.push({top:C.top,bottom:C.bottom,left:C.left,right:C.right})},g=new Set,A=[D.left+6,(D.left+D.right)/2,D.right-6];for(let u=j/2;u<J.h;u+=j)for(let C of A){let x=M(C,u);if(!x||x===Z||x===X||B.has(x))continue;if(B.add(x),Q.extra){let n=null;try{n=x.closest(Q.extra)}catch{n=null}if(n){T(n);continue}}let{float:E,scrolled:d,opacity:l0}=S.get(x)??(S.set(x,P(x)),S.get(x));if(l0<0.05)continue;let D0=x.closest(F$),J0=D0&&(!E||E.contains(D0))?D0:null;if(E&&!W(E.getBoundingClientRect())){let n=J0??x;if(!W(n.getBoundingClientRect()))T(n);continue}if(!d&&(E||!R))g.add(E);if(d||!J0||W(J0.getBoundingClientRect()))continue;T(J0)}for(let u of g)for(let C of(u??X)?.querySelectorAll(P$)??[]){let x=C.getBoundingClientRect();if(!x.width||!x.height||x.right<=D.left||x.left>=D.right||W(x)||K(C).visibility==="hidden")continue;let E=S.get(C)??(S.set(C,P(C)),S.get(C));if(E.float!==u||E.scrolled||E.opacity<0.05)continue;let d=M(Math.min(Math.max((x.left+x.right)/2,D.left+6),D.right-6),(x.top+x.bottom)/2);if(d&&d!==C&&!C.contains(d)&&!d.contains(C))continue;T(C)}return m})}var B$="lw-support-chat",M$="lw-support-frame",N$="lw-support-host",s=56,c0=12;function _$($){return typeof $==="number"&&Number.isFinite($)?Math.round(Math.min(Math.max($,32),96)):s}var i=s,C$='<svg viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/></svg>',O$=`
340
340
  :host { all: initial; }
341
341
  .bubble {
342
342
  position: fixed; z-index: 2147483000; width: var(--lw-chat-size, ${s}px); height: var(--lw-chat-size, ${s}px); border-radius: 50%;
@@ -392,4 +392,4 @@ iframe.on { visibility: visible; }`,c=document.createElement("iframe"),c.allow="
392
392
  .open .bubble { display: none; }
393
393
  }
394
394
  @media (prefers-reduced-motion: reduce) { .panel { animation: none; } .bubble, .label { transition: none; } }
395
- `,p=null,z0=null,t=null,W0=null,f=null,g1=null,A2=null,K0=!1,d0=0,f2=($)=>$.endsWith("/")?$:`${$}/`,C$=()=>{try{return new URL(L().host).origin}catch{return"*"}};function C3($,J){let Q=new URL("embed/support",f2($));return Q.searchParams.set("realm",J),Q.searchParams.set("hand","1"),Q.toString()}function O$($){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test($)?$:"/me/chat"}function c4($){return new URL("support-face.webp",f2($)).toString()}function O3($,J=s){return $+J+c0-16}function I$($,J=s){return`min(640px, calc(100vh - ${$+J+c0+16}px))`}var o=8,L$=200,R$=24;function S$($,J,Q,j,Z=s){let X=$<Q.w/2?"left":"right",V=X==="left"?$-Z/2:Q.w-$-Z/2;return{side:X,x:V<=j+R$?j:I3(V,Q.w,Z),y:L3(Q.h-J-Z/2,Q.h,Z)}}function I3($,J,Q=s){return Math.round(Math.min(Math.max($,o),Math.max(o,J-Q-o)))}function L3($,J,Q=s){return Math.round(Math.min(Math.max($,o),Math.max(o,J-Q-o)))}function T$($,J=s){return $.side==="right"&&$.y<L$?O3($.y,J):0}function A$($,J,Q=s){let j=J-($.y+Q+c0)-16,Z=$.y-c0-16;if(j>=420||j>=Z)return{bottom:$.y+Q+c0,height:Math.max(240,Math.min(640,j))};return{top:J-$.y+c0,height:Math.max(240,Math.min(640,Z))}}function E$($,J){return Math.round(Math.max(o,Math.min($,J-Math.min(E3,J-32)-o)))}function R3($,J,Q){return{x:Math.round(Math.min(Math.max($.x,o),Math.max(o,Q.w-J.w-o))),y:Math.round(Math.min(Math.max($.y,o),Math.max(o,Q.h-J.h-o)))}}function S3($){return $<=0?"":$>99?"99+":String($)}function T3($){if(d0=Math.max(0,Math.floor($)||0),!g1||!f)return;let J=$0(L().locale);g1.textContent=S3(d0),g1.hidden=d0===0,f.setAttribute("aria-label",d0?`${J.chatOpen} · ${J.chatUnread.replace("{n}",String(d0))}`:J.chatOpen),u1()}function k$($,J){if($.own===!1)return null;let Q=$.unread>0,j=typeof $.own==="string"?$.own.trim().slice(0,60):"";return{text:Q?J.chatLabelNew:j||J.chatLabel,shown:!$.open&&(Q||!$.opened),isNew:Q}}var D1=!1;function u1(){if(!A2||!f)return;let $=L(),J=$.chat&&$.chat!==!0?$.chat.label:void 0,Q=J!==void 0?J:H1?.label,j=k$({own:Q,unread:d0,opened:D1,open:K0},$0($.locale));f.classList.toggle("unlabelled",!j),f.classList.toggle("labelled",!!j?.shown),f.classList.toggle("new",!!j?.isNew),f.classList.toggle("at-left",(M0??D0).side==="left"),A2.querySelector(".text").textContent=j?.text??""}var H1=null;function A3($,J){if(!J||J.faceUrl===void 0)return c4($);if(J.faceUrl===null)return null;try{return new URL(J.faceUrl.replace(/^\//,""),f2($)).toString()}catch{return c4($)}}function x$($){if(H1=$,!p||!f)return;let J=$?.color&&/^#[0-9a-f]{6}$/i.test($.color)?$.color:null;if(J)p.style.setProperty("--lw-chat-color",J);else p.style.removeProperty("--lw-chat-color");let Q=M$($?.size);if(Q!==i){if(i=Q,Q===s)p.style.removeProperty("--lw-chat-size");else p.style.setProperty("--lw-chat-size",`${Q}px`);G0=null,N0()}let j=z0?.querySelector(".face"),Z=A3(L().host,$);if(I0("now"),j){if(!Z)f.classList.remove("has-face"),j.removeAttribute("src");else if(j.getAttribute("src")!==Z)f.classList.remove("has-face"),j.src=Z}u1()}var f1=null;async function b1(){if(f1)return f1;let $=f$();f1=$;try{await $}finally{if(f1===$)f1=null}}async function f$(){try{let $=L(),J=$.chat&&$.chat!==!0?$.chat:null;if(J?.show&&!J.show())return void R2(!1);let Q=await p0();if(!Q)return void R2(!1);let j=await fetch(new URL("ingest/support-unread",f2($.host)).toString(),{headers:{"x-realm-key":$.realmKey,authorization:`Bearer ${Q}`}});if(j.status===404||j.status===401||j.status===403)return void R2(!1);if(!j.ok)return;let Z=await j.json();if(Z.look&&typeof Z.look==="object")x$(Z.look);if(R2(!0),!K0)T3(typeof Z.total==="number"?Z.total:0)}catch{}}function R2($){if(!p)return;if(p.style.display=$?"":"none",$)Y2(p);if(N0(),$)I0("now")}var D0={side:"right",x:16,y:16},f0=null,E3=380,k3=()=>`lw-support-chat-place:${L().realmKey}`,i0=()=>({w:window.innerWidth,h:window.innerHeight}),U1=!1;function w$(){let $=d1(L().chat);if($)D0={side:$.side,x:$.x,y:$.y};try{let J=JSON.parse(localStorage.getItem(k3())??"null"),Q=J?.bubble;if(U1=!!Q&&(Q.side==="left"||Q.side==="right")&&typeof Q.y==="number"&&Number.isFinite(Q.y),U1)D0={...D0,side:Q.side,y:Q.y,...typeof Q.x==="number"&&Number.isFinite(Q.x)?{x:Q.x}:{}};let j=J?.panel;f0=j&&typeof j.x==="number"&&typeof j.y==="number"&&Number.isFinite(j.x)&&Number.isFinite(j.y)?{x:j.x,y:j.y,h:typeof j.h==="number"&&j.h>=240?j.h:640}:null,D1=J?.opened===!0}catch{}}function n4(){try{localStorage.setItem(k3(),JSON.stringify({...U1?{bubble:{side:D0.side,x:D0.x,y:D0.y}}:{},panel:f0,...D1?{opened:!0}:{}}))}catch{}}var v1=()=>window.location?.pathname??"/",M0=null,i4="",G0=null,E2="";function U3($,J){let Q=i0();if(!G0||G0.w!==Q.w||G0.h!==Q.h)G0={w:Q.w,h:Q.h,boxes:new Map};let j=`${$}:${J}`,Z=G0.boxes.get(j);if(!Z){let X=$==="right"?{left:Q.w-J-i,right:Q.w-J}:{left:J,right:J+i};Z=D3([X],Q,{extra:w2().extra})[0]??[],G0.boxes.set(j,Z)}return Z}var s4=!1;function w2(){let $=L().chat,J=$&&$!==!0?$.avoid:void 0;if(J===!1||H1?.avoid===!1)return{on:!1,extra:null};return{on:!0,extra:typeof J==="string"&&J.trim()?J.trim():null}}var y1=null;function y$(){let $=G3(v1(),H1?.places);if(s4=$?.show==="hide",y1=typeof $?.z==="number"&&Number.isFinite($.z)?Math.round(Math.min(Math.max($.z,0),2147483000)):null,U1||!$||$.show==="hide")return D0;return{side:$.show,x:typeof $.x==="number"&&Number.isFinite($.x)?$.x:D0.x,y:$.y}}function x3(){if(!f)return;if(!w2().on)return G0=null,N0();let $=E2,J=i0();G0={w:J.w,h:J.h,boxes:new Map},N0(),h1=E2===$?Math.min(h1+1,v$):0}var g$=400,v$=3,b$=60,G1,H3=0,q3=0,h1=0;function I0($="later"){if(!p)return;let J=Date.now();if($!=="later")h1=0;let Q=$==="now"?b$:Math.max(0,g$*2**h1-(J-q3));if(G1&&H3<=J+Q)return;clearTimeout(G1),H3=J+Q,G1=setTimeout(()=>{if(G1=void 0,!p||K0||j0?.moved||typeof document<"u"&&document.hidden)return;q3=Date.now(),x3()},Q)}var S2=null,d4="",F3,a4=($)=>$ instanceof Element&&($===p||/^LW-/.test($.tagName)),P3=($)=>{if(!a4($.target))I0()},B3=($)=>{if(a4($.target))return;let J=$.target instanceof Element?$.target.getBoundingClientRect():null,Q=i0(),j=(M0??D0).x,Z=!!J&&J.width>0&&(J.left<j+i||J.right>Q.w-j-i);I0(Z?"soon":"later")},T2=($)=>{if(!a4($.target))I0("now")},M3=["popstate","hashchange","pointerup","keyup"];function f3($){S2?.disconnect(),S2=null,clearInterval(F3);for(let J of M3)window.removeEventListener(J,T2,!0);window.removeEventListener("scroll",P3,!0);for(let J of["transitionend","animationend"])window.removeEventListener(J,B3,!0);if(document.removeEventListener("visibilitychange",T2),!$)return;if(typeof MutationObserver<"u")S2=new MutationObserver((J)=>{if(J.some((j)=>{let Z=j.target;if(Z===document.documentElement&&j.type==="attributes")return!1;return!(Z.nodeType===1&&/^LW-/.test(Z.tagName))&&Z!==p}))I0()}),S2.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded","disabled","aria-disabled"]});for(let J of M3)window.addEventListener(J,T2,{capture:!0,passive:!0});window.addEventListener("scroll",P3,{capture:!0,passive:!0});for(let J of["transitionend","animationend"])window.addEventListener(J,B3,{capture:!0,passive:!0});document.addEventListener("visibilitychange",T2),d4=v1(),F3=setInterval(()=>{if(v1()===d4)return;d4=v1(),N0(),I0("now")},1000)}function N0(){if(!f||!t)return;let $=i0(),J=y$(),Q=L3(J.y,$.h,i),j=I3(J.x,$.w,i),Z=`${v1()}|${J.side}|${j}|${Q}`,X=M0&&i4===Z?M0:null,V={side:J.side,x:j,y:Q},K=!!G0&&w2().on,Y=!K0||!M0?K?W3(V,U3,$,i,o,Math.max(o,$.h-i-o),X):V:M0;if(M0={side:Y.side,x:Y.x,y:Y.y},i4=Z,K)E2=JSON.stringify([p4(U3(V.side,V.x),V.side==="right"?{left:$.w-V.x-i,right:$.w-V.x}:{left:V.x,right:V.x+i},$.h,i),M0]);let W=M0,N=W.y,F=W.side==="right"?"left":"right";if(f.style.display=s4&&!K0?"none":"",Object.assign(f.style,{[W.side]:`${W.x}px`,[F]:"",bottom:`${N}px`,top:""}),f.style.zIndex=y1===null?"":String(y1),t.style.zIndex=y1===null?"":String(y1+1),f0){let P={w:Math.min(E3,$.w-32),h:Math.min(f0.h,$.h-2*o)},S=R3(f0,P,$);Object.assign(t.style,{left:`${S.x}px`,top:`${S.y}px`,right:"",bottom:"",height:`${P.h}px`})}else{let P=A$(W,$.h,i);Object.assign(t.style,{[W.side]:`${E$(W.x,$.w)}px`,[F]:"",bottom:P.bottom!==void 0?`${P.bottom}px`:"",top:P.top!==void 0?`${P.top}px`:"",height:`${P.height}px`})}let R=p&&p.style.display!=="none"&&f.style.display!=="none"?T$(W,i):0,O=R?`${R}px`:"";if(document.documentElement.style.getPropertyValue("--lw-chat-lift")!==O)if(O)document.documentElement.style.setProperty("--lw-chat-lift",O);else document.documentElement.style.removeProperty("--lw-chat-lift");u1()}var j0=null,l4=!1;function h$($){if($.button!==0)return;$.preventDefault(),j0={id:$.pointerId,sx:$.clientX,sy:$.clientY,moved:!1};try{f?.setPointerCapture($.pointerId)}catch{}}function m$($){if(!j0||$.pointerId!==j0.id||!f)return;if(!j0.moved&&Math.hypot($.clientX-j0.sx,$.clientY-j0.sy)<6)return;j0.moved=!0,f.classList.add("dragging"),Object.assign(f.style,{left:`${$.clientX-i/2}px`,top:`${$.clientY-i/2}px`,right:"",bottom:""})}function N3($){if(!j0||$.pointerId!==j0.id)return;let J=j0;if(j0=null,f?.classList.remove("dragging"),!J.moved)return;if(l4=!0,setTimeout(()=>l4=!1,0),$.type==="pointerup")D0=S$($.clientX,$.clientY,i0(),d1(L().chat)?.x??16,i),U1=!0,f0=null,n4();if(w2().on)x3();else N0()}var a=null;function r4($){if(!t||typeof $.x!=="number"||typeof $.y!=="number"||i0().w<640)return;if($.phase==="start"){let J=t.getBoundingClientRect();a={sx:$.x,sy:$.y,x:J.left,y:J.top,lx:$.x,ly:$.y,h:Math.round(J.height)||640},k2(!0);return}if(!a)return;if(a.lx=$.x,a.ly=$.y,f0={...R3({x:a.x+($.x-a.sx),y:a.y+($.y-a.sy)},{w:t.offsetWidth,h:a.h},i0()),h:a.h},N0(),$.phase==="end")a=null,k2(!1),n4()}var w1=null;function k2($){if(w1){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,w1,!0);w1=null}if(!$)return;w1=(J)=>{if(!a)return k2(!1);if(J.type==="pointermove"&&J.buttons!==0)return r4({phase:"move",x:J.screenX,y:J.screenY});let Q=J.type==="pointerup";r4({phase:"end",x:Q?J.screenX:a.lx,y:Q?J.screenY:a.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,w1,!0)}var w3=()=>{N0(),I0("now")};function x2($){W0?.contentWindow?.postMessage({source:B$,...$},C$())}async function u$($){if(!W0||$.source!==W0.contentWindow)return;let J=$.data;if(!J||J.source!==P$)return;if(J.type==="hello"){let Q=await p0();if(Q)x2({type:"token",token:Q,can:["portal"]});return}if(J.type==="portal"){M4({returnTo:O$(typeof J.path==="string"?J.path:"")});return}if(J.type==="ready")return x2({type:K0?"shown":"hidden"});if(J.type==="close")return m1();if(J.type==="drag")return r4(J);if(J.type==="unread"&&typeof J.total==="number")return T3(J.total);if(J.type==="report")m1(!1),M1({type:"manual",fromChat:!0})}var y3=($)=>void u$($);function g3($){if(K0&&$.key==="Escape")m1()}function v3(){if(!p||!t||!z0)p1();if(!t)return;let $=L();if(!W0)W0=document.createElement("iframe"),W0.src=C3($.host,$.realmKey),W0.title=$0($.locale).chatTitle,W0.setAttribute("allow","clipboard-write"),t.append(W0);if(K0=!0,!D1)D1=!0,n4();t.hidden=!1,z0?.querySelector(".wrap")?.classList.add("open"),f?.setAttribute("aria-expanded","true"),u1(),x2({type:"shown"}),W0.focus()}function m1($=!0){if(!t)return;if(K0=!1,t.hidden=!0,z0?.querySelector(".wrap")?.classList.remove("open"),f?.setAttribute("aria-expanded","false"),u1(),x2({type:"hidden"}),$)f?.focus();b1(),N0(),I0("now")}var o4=null,_3=0;function b3(){if(Date.now()-_3<30000)return;_3=Date.now(),b1()}function p1(){if(p||typeof document>"u")return;let $=L();if(!d1($.chat)||!$.identity)return;let Q=$0($.locale);p=document.createElement(F$),p.style.display="none",z0=p.attachShadow({mode:"open"}),z0.innerHTML=`<style>${_$}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${Q.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${Q.chatOpen}" title="${Q.chatMove}">${N$}<img class="face" alt="" draggable="false" decoding="async"><span class="badge" hidden></span><span class="label" aria-hidden="true"><span class="text"></span></span></button></div>`,t=z0.querySelector(".panel"),f=z0.querySelector(".bubble"),g1=z0.querySelector(".badge"),A2=z0.querySelector(".label");let j=z0.querySelector(".face");j.addEventListener("load",()=>{if(j.getAttribute("src"))f?.classList.add("has-face")}),j.addEventListener("error",()=>f?.classList.remove("has-face")),j.src=A3($.host,H1)??c4($.host),w$(),N0(),f.addEventListener("click",()=>{if(l4)return;if(K0)m1();else v3()}),f.addEventListener("pointerdown",h$),f.addEventListener("pointermove",m$),f.addEventListener("pointerup",N3),f.addEventListener("pointercancel",N3),document.body.append(p),window.addEventListener("message",y3),document.addEventListener("keydown",g3),window.addEventListener("focus",b3),window.addEventListener("resize",w3),f3(!0);let Z;o4=Z3(()=>{if(K0)return;clearTimeout(Z),Z=setTimeout(()=>void b1(),500)}),b1()}function p$(){return p?b1():Promise.resolve()}function d$(){H1=null,i=s,o4?.(),o4=null,window.removeEventListener("message",y3),document.removeEventListener("keydown",g3),window.removeEventListener("focus",b3),window.removeEventListener("resize",w3),f3(!1),clearTimeout(G1),G1=void 0,h1=0,M0=null,i4="",G0=null,E2="",s4=!1,k2(!1),p?.remove(),p=z0=t=W0=f=g1=A2=null,K0=!1,j0=a=null,f0=null,U1=D1=!1,d0=0,document.documentElement.style.removeProperty("--lw-chat-lift")}var h3=!1;function c$($={}){if(h3||typeof window>"u")return;if(!q1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(h3=!0,w6(),P6(),D6(),L6(),g6(),$.ui===!1)return;let J=$0(L().locale);if(i2((j)=>{g0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>M1(j)})}),P4(),!document.querySelector(j1))document.body.append(document.createElement(j1));let Q=window.requestIdleCallback;if(Q)Q(()=>void b0(),{timeout:5000});else setTimeout(()=>void b0(),2000);if(Q)Q(()=>L2(),{timeout:8000});else setTimeout(()=>L2(),3000);if(L().chat)if(!L().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if(Q)Q(()=>p1(),{timeout:4000});else setTimeout(()=>p1(),1500)}var i$=new Set(["error","exception","unhandledrejection"]);function m3($){if($.error)return!0;return $.status!==null&&$.status>=400}function t4($){if(!$)return null;let J=Date.parse($);return Number.isNaN(J)?null:J}function l$($){try{let{pathname:J}=new URL($,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return $.split(/[?#]/)[0]??$}}function r$($,J,Q){let j=(V)=>({elapsedMs:V,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if($.length===0)return[];let Z=$.map((V)=>t4(V.at)),X=(V)=>{for(let K=V+1;K<Z.length;K+=1){let Y=Z[K];if(Y!=null)return Y}return Number.POSITIVE_INFINITY};return $.map((V,K)=>{let Y=Z[K]??null,W=(K>0?Z[K-1]:null)??null,N=Y!==null&&W!==null?Math.max(0,Y-W):null;if(Y===null)return j(N);let F=Y,R=Math.max(F,X(K)),O=(U)=>U!==null&&U>=F&&(U<R||R===Number.POSITIVE_INFINITY),P=J.filter((U)=>O(t4(U.startedAt))),S=Q.filter((U)=>i$.has(U.level)&&O(t4(U.at))),M=P.map((U)=>U.durationMs).filter((U)=>typeof U==="number");return{elapsedMs:N,requests:P,failedRequests:P.filter(m3),consoleErrors:S,slowestMs:M.length>0?Math.max(...M):null}})}function o$($,J){return $.requests.length===0&&$.consoleErrors.length===0&&($.elapsedMs===null||$.elapsedMs<J)}function n$($){if($<1000)return`${Math.round($)} มิลลิวินาที`;let J=$/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let Q=Math.floor(J/60),j=Math.round(J%60);return j===0?`${Q} นาที`:`${Q} นาที ${j} วิ`}export{d$ as unmountSupportChat,e2 as trimToBudget,u6 as toCurl,o2 as takeReplay,O8 as supportPortalUrl,C3 as supportFrameUrl,G4 as submitRequest,Y4 as submitBundle,Q9 as stopReplay,z$ as stopLiveRing,L2 as startLiveRing,v8 as sizeInkCanvas,g0 as showToast,F7 as setErroredQueriesSource,Q2 as requestTypesNow,l$ as requestPath,$0 as reporterStrings,p$ as refreshSupportChat,_0 as redactUrl,s0 as redactLabel,a0 as redactHeaders,t0 as redactBody,L1 as readInkOp,I$ as panelHeight,Z4 as packReplay,M4 as openSupportPortal,v3 as openSupportChat,c2 as onLaunch,i2 as onCrash,p1 as mountSupportChat,n3 as moduleResolver,b0 as loadRequestTypes,M1 as launch,J9 as isReplayRecording,o$ as isQuietStep,m3 as isFailedRequest,q1 as isConfigured,c$ as installDebugCapture,O4 as inkAlpha,_9 as hasCause,r2 as getNetworkLog,d2 as getConsoleLog,L as getConfig,u2 as getActionTrail,n$ as formatDuration,a2 as errorSignature,l2 as emitCrash,P4 as defineReporterElement,H4 as createAnnotator,r$ as correlateActionTrail,c3 as configureDebugCapture,m1 as closeSupportChat,O3 as chatLift,a1 as captureScreen,B9 as bundleToMarkdown,N9 as bundleFileName,N1 as buildBundle,S3 as badgeText,P0 as appInfo,h2 as actionCountSuffix,j1 as REPORTER_TAG,$8 as REPLAY_FILENAME,n0 as REDACTED,z2 as NoIdentityError,b7 as LASER_TRAIL_MS,h7 as LASER_LINGER_MS,h8 as InkSender,H2 as InkScene,q2 as InkPainter,m7 as INK_STALE_MS,b8 as INK_SEND_EVERY_MS,y7 as INK_MAX_POINTS_PER_OP,I4 as INK_KEEP_MS,g7 as INK_HOLD_MS,v7 as INK_FADE_MS,g8 as INK_COLORS,t2 as BUNDLE_BUDGET_BYTES};
395
+ `,p=null,z0=null,t=null,W0=null,f=null,g1=null,A2=null,K0=!1,d0=0,f2=($)=>$.endsWith("/")?$:`${$}/`,I$=()=>{try{return new URL(L().host).origin}catch{return"*"}};function C3($,J){let Q=new URL("embed/support",f2($));return Q.searchParams.set("realm",J),Q.searchParams.set("hand","1"),Q.toString()}function L$($){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test($)?$:"/me/chat"}function i4($){return new URL("support-face.webp",f2($)).toString()}function O3($,J=s){return $+J+c0-16}function R$($,J=s){return`min(640px, calc(100vh - ${$+J+c0+16}px))`}var o=8,S$=200,T$=24;function A$($,J,Q,j,Z=s){let X=$<Q.w/2?"left":"right",V=X==="left"?$-Z/2:Q.w-$-Z/2;return{side:X,x:V<=j+T$?j:I3(V,Q.w,Z),y:L3(Q.h-J-Z/2,Q.h,Z)}}function I3($,J,Q=s){return Math.round(Math.min(Math.max($,o),Math.max(o,J-Q-o)))}function L3($,J,Q=s){return Math.round(Math.min(Math.max($,o),Math.max(o,J-Q-o)))}function E$($,J=s){return $.side==="right"&&$.y<S$?O3($.y,J):0}function k$($,J,Q=s){let j=J-($.y+Q+c0)-16,Z=$.y-c0-16;if(j>=420||j>=Z)return{bottom:$.y+Q+c0,height:Math.max(240,Math.min(640,j))};return{top:J-$.y+c0,height:Math.max(240,Math.min(640,Z))}}function x$($,J){return Math.round(Math.max(o,Math.min($,J-Math.min(E3,J-32)-o)))}function R3($,J,Q){return{x:Math.round(Math.min(Math.max($.x,o),Math.max(o,Q.w-J.w-o))),y:Math.round(Math.min(Math.max($.y,o),Math.max(o,Q.h-J.h-o)))}}function S3($){return $<=0?"":$>99?"99+":String($)}function T3($){if(d0=Math.max(0,Math.floor($)||0),!g1||!f)return;let J=$0(L().locale);g1.textContent=S3(d0),g1.hidden=d0===0,f.setAttribute("aria-label",d0?`${J.chatOpen} · ${J.chatUnread.replace("{n}",String(d0))}`:J.chatOpen),u1()}function f$($,J){if($.own===!1)return null;let Q=$.unread>0,j=typeof $.own==="string"?$.own.trim().slice(0,60):"";return{text:Q?J.chatLabelNew:j||J.chatLabel,shown:!$.open&&(Q||!$.opened),isNew:Q}}var U1=!1;function u1(){if(!A2||!f)return;let $=L(),J=$.chat&&$.chat!==!0?$.chat.label:void 0,Q=J!==void 0?J:H1?.label,j=f$({own:Q,unread:d0,opened:U1,open:K0},$0($.locale));f.classList.toggle("unlabelled",!j),f.classList.toggle("labelled",!!j?.shown),f.classList.toggle("new",!!j?.isNew),f.classList.toggle("at-left",(M0??U0).side==="left"),A2.querySelector(".text").textContent=j?.text??""}var H1=null;function A3($,J){if(!J||J.faceUrl===void 0)return i4($);if(J.faceUrl===null)return null;try{return new URL(J.faceUrl.replace(/^\//,""),f2($)).toString()}catch{return i4($)}}function w$($){if(H1=$,!p||!f)return;let J=$?.color&&/^#[0-9a-f]{6}$/i.test($.color)?$.color:null;if(J)p.style.setProperty("--lw-chat-color",J);else p.style.removeProperty("--lw-chat-color");let Q=_$($?.size);if(Q!==i){if(i=Q,Q===s)p.style.removeProperty("--lw-chat-size");else p.style.setProperty("--lw-chat-size",`${Q}px`);G0=null,N0()}let j=z0?.querySelector(".face"),Z=A3(L().host,$);if(I0("now"),j){if(!Z)f.classList.remove("has-face"),j.removeAttribute("src");else if(j.getAttribute("src")!==Z)f.classList.remove("has-face"),j.src=Z}u1()}var f1=null;async function b1(){if(f1)return f1;let $=y$();f1=$;try{await $}finally{if(f1===$)f1=null}}async function y$(){try{let $=L(),J=$.chat&&$.chat!==!0?$.chat:null;if(J?.show&&!J.show())return void R2(!1);let Q=await p0();if(!Q)return void R2(!1);let j=await fetch(new URL("ingest/support-unread",f2($.host)).toString(),{headers:{"x-realm-key":$.realmKey,authorization:`Bearer ${Q}`}});if(j.status===404||j.status===401||j.status===403)return void R2(!1);if(!j.ok)return;let Z=await j.json();if(Z.look&&typeof Z.look==="object")w$(Z.look);if(R2(!0),!K0)T3(typeof Z.total==="number"?Z.total:0)}catch{}}function R2($){if(!p)return;if(p.style.display=$?"":"none",$)Y2(p);if(N0(),$)I0("now")}var U0={side:"right",x:16,y:16},f0=null,E3=380,k3=()=>`lw-support-chat-place:${L().realmKey}`,i0=()=>({w:window.innerWidth,h:window.innerHeight}),D1=!1;function g$(){let $=d1(L().chat);if($)U0={side:$.side,x:$.x,y:$.y};try{let J=JSON.parse(localStorage.getItem(k3())??"null"),Q=J?.bubble;if(D1=!!Q&&(Q.side==="left"||Q.side==="right")&&typeof Q.y==="number"&&Number.isFinite(Q.y),D1)U0={...U0,side:Q.side,y:Q.y,...typeof Q.x==="number"&&Number.isFinite(Q.x)?{x:Q.x}:{}};let j=J?.panel;f0=j&&typeof j.x==="number"&&typeof j.y==="number"&&Number.isFinite(j.x)&&Number.isFinite(j.y)?{x:j.x,y:j.y,h:typeof j.h==="number"&&j.h>=240?j.h:640}:null,U1=J?.opened===!0}catch{}}function s4(){try{localStorage.setItem(k3(),JSON.stringify({...D1?{bubble:{side:U0.side,x:U0.x,y:U0.y}}:{},panel:f0,...U1?{opened:!0}:{}}))}catch{}}var v1=()=>window.location?.pathname??"/",M0=null,l4="",G0=null,E2="";function D3($,J){let Q=i0();if(!G0||G0.w!==Q.w||G0.h!==Q.h)G0={w:Q.w,h:Q.h,boxes:new Map};let j=`${$}:${J}`,Z=G0.boxes.get(j);if(!Z){let X=$==="right"?{left:Q.w-J-i,right:Q.w-J}:{left:J,right:J+i};Z=U3([X],Q,{extra:w2().extra})[0]??[],G0.boxes.set(j,Z)}return Z}var a4=!1;function w2(){let $=L().chat,J=$&&$!==!0?$.avoid:void 0;if(J===!1||H1?.avoid===!1)return{on:!1,extra:null};return{on:!0,extra:typeof J==="string"&&J.trim()?J.trim():null}}var y1=null;function v$(){let $=G3(v1(),H1?.places);if(a4=$?.show==="hide",y1=typeof $?.z==="number"&&Number.isFinite($.z)?Math.round(Math.min(Math.max($.z,0),2147483000)):null,D1||!$||$.show==="hide")return U0;return{side:$.show,x:typeof $.x==="number"&&Number.isFinite($.x)?$.x:U0.x,y:$.y}}function x3(){if(!f)return;if(!w2().on)return G0=null,N0();let $=E2,J=i0();G0={w:J.w,h:J.h,boxes:new Map},N0(),h1=E2===$?Math.min(h1+1,h$):0}var b$=400,h$=3,m$=60,G1,H3=0,q3=0,h1=0;function I0($="later"){if(!p)return;let J=Date.now();if($!=="later")h1=0;let Q=$==="now"?m$:Math.max(0,b$*2**h1-(J-q3));if(G1&&H3<=J+Q)return;clearTimeout(G1),H3=J+Q,G1=setTimeout(()=>{if(G1=void 0,!p||K0||j0?.moved||typeof document<"u"&&document.hidden)return;q3=Date.now(),x3()},Q)}var S2=null,c4="",F3,t4=($)=>$ instanceof Element&&($===p||/^LW-/.test($.tagName)),P3=($)=>{if(!t4($.target))I0()},B3=($)=>{if(t4($.target))return;let J=$.target instanceof Element?$.target.getBoundingClientRect():null,Q=i0(),j=(M0??U0).x,Z=!!J&&J.width>0&&(J.left<j+i||J.right>Q.w-j-i);I0(Z?"soon":"later")},T2=($)=>{if(!t4($.target))I0("now")},M3=["popstate","hashchange","pointerup","keyup"];function f3($){S2?.disconnect(),S2=null,clearInterval(F3);for(let J of M3)window.removeEventListener(J,T2,!0);window.removeEventListener("scroll",P3,!0);for(let J of["transitionend","animationend"])window.removeEventListener(J,B3,!0);if(document.removeEventListener("visibilitychange",T2),!$)return;if(typeof MutationObserver<"u")S2=new MutationObserver((J)=>{if(J.some((j)=>{let Z=j.target;if(Z===document.documentElement&&j.type==="attributes")return!1;return!(Z.nodeType===1&&/^LW-/.test(Z.tagName))&&Z!==p}))I0()}),S2.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded","disabled","aria-disabled"]});for(let J of M3)window.addEventListener(J,T2,{capture:!0,passive:!0});window.addEventListener("scroll",P3,{capture:!0,passive:!0});for(let J of["transitionend","animationend"])window.addEventListener(J,B3,{capture:!0,passive:!0});document.addEventListener("visibilitychange",T2),c4=v1(),F3=setInterval(()=>{if(v1()===c4)return;c4=v1(),N0(),I0("now")},1000)}function N0(){if(!f||!t)return;let $=i0(),J=v$(),Q=L3(J.y,$.h,i),j=I3(J.x,$.w,i),Z=`${v1()}|${J.side}|${j}|${Q}`,X=M0&&l4===Z?M0:null,V={side:J.side,x:j,y:Q},K=!!G0&&w2().on,Y=!K0||!M0?K?W3(V,D3,$,i,o,Math.max(o,$.h-i-o),X):V:M0;if(M0={side:Y.side,x:Y.x,y:Y.y},l4=Z,K)E2=JSON.stringify([d4(D3(V.side,V.x),V.side==="right"?{left:$.w-V.x-i,right:$.w-V.x}:{left:V.x,right:V.x+i},$.h,i),M0]);let W=M0,N=W.y,F=W.side==="right"?"left":"right";if(f.style.display=a4&&!K0?"none":"",Object.assign(f.style,{[W.side]:`${W.x}px`,[F]:"",bottom:`${N}px`,top:""}),f.style.zIndex=y1===null?"":String(y1),t.style.zIndex=y1===null?"":String(y1+1),f0){let P={w:Math.min(E3,$.w-32),h:Math.min(f0.h,$.h-2*o)},S=R3(f0,P,$);Object.assign(t.style,{left:`${S.x}px`,top:`${S.y}px`,right:"",bottom:"",height:`${P.h}px`})}else{let P=k$(W,$.h,i);Object.assign(t.style,{[W.side]:`${x$(W.x,$.w)}px`,[F]:"",bottom:P.bottom!==void 0?`${P.bottom}px`:"",top:P.top!==void 0?`${P.top}px`:"",height:`${P.height}px`})}let R=p&&p.style.display!=="none"&&f.style.display!=="none"?E$(W,i):0,O=R?`${R}px`:"";if(document.documentElement.style.getPropertyValue("--lw-chat-lift")!==O)if(O)document.documentElement.style.setProperty("--lw-chat-lift",O);else document.documentElement.style.removeProperty("--lw-chat-lift");u1()}var j0=null,r4=!1;function u$($){if($.button!==0)return;$.preventDefault(),j0={id:$.pointerId,sx:$.clientX,sy:$.clientY,moved:!1};try{f?.setPointerCapture($.pointerId)}catch{}}function p$($){if(!j0||$.pointerId!==j0.id||!f)return;if(!j0.moved&&Math.hypot($.clientX-j0.sx,$.clientY-j0.sy)<6)return;j0.moved=!0,f.classList.add("dragging"),Object.assign(f.style,{left:`${$.clientX-i/2}px`,top:`${$.clientY-i/2}px`,right:"",bottom:""})}function N3($){if(!j0||$.pointerId!==j0.id)return;let J=j0;if(j0=null,f?.classList.remove("dragging"),!J.moved)return;if(r4=!0,setTimeout(()=>r4=!1,0),$.type==="pointerup")U0=A$($.clientX,$.clientY,i0(),d1(L().chat)?.x??16,i),D1=!0,f0=null,s4();if(w2().on)x3();else N0()}var a=null;function o4($){if(!t||typeof $.x!=="number"||typeof $.y!=="number"||i0().w<640)return;if($.phase==="start"){let J=t.getBoundingClientRect();a={sx:$.x,sy:$.y,x:J.left,y:J.top,lx:$.x,ly:$.y,h:Math.round(J.height)||640},k2(!0);return}if(!a)return;if(a.lx=$.x,a.ly=$.y,f0={...R3({x:a.x+($.x-a.sx),y:a.y+($.y-a.sy)},{w:t.offsetWidth,h:a.h},i0()),h:a.h},N0(),$.phase==="end")a=null,k2(!1),s4()}var w1=null;function k2($){if(w1){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,w1,!0);w1=null}if(!$)return;w1=(J)=>{if(!a)return k2(!1);if(J.type==="pointermove"&&J.buttons!==0)return o4({phase:"move",x:J.screenX,y:J.screenY});let Q=J.type==="pointerup";o4({phase:"end",x:Q?J.screenX:a.lx,y:Q?J.screenY:a.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,w1,!0)}var w3=()=>{N0(),I0("now")};function x2($){W0?.contentWindow?.postMessage({source:N$,...$},I$())}async function d$($){if(!W0||$.source!==W0.contentWindow)return;let J=$.data;if(!J||J.source!==M$)return;if(J.type==="hello"){let Q=await p0();if(Q)x2({type:"token",token:Q,can:["portal"]});return}if(J.type==="portal"){M4({returnTo:L$(typeof J.path==="string"?J.path:"")});return}if(J.type==="ready")return x2({type:K0?"shown":"hidden"});if(J.type==="close")return m1();if(J.type==="drag")return o4(J);if(J.type==="unread"&&typeof J.total==="number")return T3(J.total);if(J.type==="report")m1(!1),M1({type:"manual",fromChat:!0})}var y3=($)=>void d$($);function g3($){if(K0&&$.key==="Escape")m1()}function v3(){if(!p||!t||!z0)p1();if(!t)return;let $=L();if(!W0)W0=document.createElement("iframe"),W0.src=C3($.host,$.realmKey),W0.title=$0($.locale).chatTitle,W0.setAttribute("allow","clipboard-write"),t.append(W0);if(K0=!0,!U1)U1=!0,s4();t.hidden=!1,z0?.querySelector(".wrap")?.classList.add("open"),f?.setAttribute("aria-expanded","true"),u1(),x2({type:"shown"}),W0.focus()}function m1($=!0){if(!t)return;if(K0=!1,t.hidden=!0,z0?.querySelector(".wrap")?.classList.remove("open"),f?.setAttribute("aria-expanded","false"),u1(),x2({type:"hidden"}),$)f?.focus();b1(),N0(),I0("now")}var n4=null,_3=0;function b3(){if(Date.now()-_3<30000)return;_3=Date.now(),b1()}function p1(){if(p||typeof document>"u")return;let $=L();if(!d1($.chat)||!$.identity)return;let Q=$0($.locale);p=document.createElement(B$),p.style.display="none",z0=p.attachShadow({mode:"open"}),z0.innerHTML=`<style>${O$}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${Q.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${Q.chatOpen}" title="${Q.chatMove}">${C$}<img class="face" alt="" draggable="false" decoding="async"><span class="badge" hidden></span><span class="label" aria-hidden="true"><span class="text"></span></span></button></div>`,t=z0.querySelector(".panel"),f=z0.querySelector(".bubble"),g1=z0.querySelector(".badge"),A2=z0.querySelector(".label");let j=z0.querySelector(".face");j.addEventListener("load",()=>{if(j.getAttribute("src"))f?.classList.add("has-face")}),j.addEventListener("error",()=>f?.classList.remove("has-face")),j.src=A3($.host,H1)??i4($.host),g$(),N0(),f.addEventListener("click",()=>{if(r4)return;if(K0)m1();else v3()}),f.addEventListener("pointerdown",u$),f.addEventListener("pointermove",p$),f.addEventListener("pointerup",N3),f.addEventListener("pointercancel",N3),document.body.append(p),window.addEventListener("message",y3),document.addEventListener("keydown",g3),window.addEventListener("focus",b3),window.addEventListener("resize",w3),f3(!0);let Z;n4=Z3(()=>{if(K0)return;clearTimeout(Z),Z=setTimeout(()=>void b1(),500)}),b1()}function c$(){return p?b1():Promise.resolve()}function i$(){H1=null,i=s,n4?.(),n4=null,window.removeEventListener("message",y3),document.removeEventListener("keydown",g3),window.removeEventListener("focus",b3),window.removeEventListener("resize",w3),f3(!1),clearTimeout(G1),G1=void 0,h1=0,M0=null,l4="",G0=null,E2="",a4=!1,k2(!1),p?.remove(),p=z0=t=W0=f=g1=A2=null,K0=!1,j0=a=null,f0=null,D1=U1=!1,d0=0,document.documentElement.style.removeProperty("--lw-chat-lift")}var h3=!1;function l$($={}){if(h3||typeof window>"u")return;if(!q1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(h3=!0,y6(),B6(),D6(),R6(),v6(),$.ui===!1)return;let J=$0(L().locale);if(i2((j)=>{g0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>M1(j)})}),P4(),!document.querySelector(j1))document.body.append(document.createElement(j1));let Q=window.requestIdleCallback;if(Q)Q(()=>void b0(),{timeout:5000});else setTimeout(()=>void b0(),2000);if(Q)Q(()=>L2(),{timeout:8000});else setTimeout(()=>L2(),3000);if(L().chat)if(!L().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if(Q)Q(()=>p1(),{timeout:4000});else setTimeout(()=>p1(),1500)}var r$=new Set(["error","exception","unhandledrejection"]);function m3($){if($.error)return!0;return $.status!==null&&$.status>=400}function e4($){if(!$)return null;let J=Date.parse($);return Number.isNaN(J)?null:J}function o$($){try{let{pathname:J}=new URL($,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return $.split(/[?#]/)[0]??$}}function n$($,J,Q){let j=(V)=>({elapsedMs:V,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if($.length===0)return[];let Z=$.map((V)=>e4(V.at)),X=(V)=>{for(let K=V+1;K<Z.length;K+=1){let Y=Z[K];if(Y!=null)return Y}return Number.POSITIVE_INFINITY};return $.map((V,K)=>{let Y=Z[K]??null,W=(K>0?Z[K-1]:null)??null,N=Y!==null&&W!==null?Math.max(0,Y-W):null;if(Y===null)return j(N);let F=Y,R=Math.max(F,X(K)),O=(D)=>D!==null&&D>=F&&(D<R||R===Number.POSITIVE_INFINITY),P=J.filter((D)=>O(e4(D.startedAt))),S=Q.filter((D)=>r$.has(D.level)&&O(e4(D.at))),M=P.map((D)=>D.durationMs).filter((D)=>typeof D==="number");return{elapsedMs:N,requests:P,failedRequests:P.filter(m3),consoleErrors:S,slowestMs:M.length>0?Math.max(...M):null}})}function s$($,J){return $.requests.length===0&&$.consoleErrors.length===0&&($.elapsedMs===null||$.elapsedMs<J)}function a$($){if($<1000)return`${Math.round($)} มิลลิวินาที`;let J=$/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let Q=Math.floor(J/60),j=Math.round(J%60);return j===0?`${Q} นาที`:`${Q} นาที ${j} วิ`}export{i$ as unmountSupportChat,e2 as trimToBudget,p6 as toCurl,o2 as takeReplay,I8 as supportPortalUrl,C3 as supportFrameUrl,G4 as submitRequest,Y4 as submitBundle,Q9 as stopReplay,Y$ as stopLiveRing,L2 as startLiveRing,b8 as sizeInkCanvas,g0 as showToast,F7 as setErroredQueriesSource,Q2 as requestTypesNow,o$ as requestPath,$0 as reporterStrings,c$ as refreshSupportChat,_0 as redactUrl,s0 as redactLabel,a0 as redactHeaders,t0 as redactBody,L1 as readInkOp,R$ as panelHeight,Z4 as packReplay,M4 as openSupportPortal,v3 as openSupportChat,c2 as onLaunch,i2 as onCrash,p1 as mountSupportChat,n3 as moduleResolver,b0 as loadRequestTypes,M1 as launch,J9 as isReplayRecording,s$ as isQuietStep,m3 as isFailedRequest,q1 as isConfigured,l$ as installDebugCapture,O4 as inkAlpha,_9 as hasCause,r2 as getNetworkLog,d2 as getConsoleLog,L as getConfig,u2 as getActionTrail,a$ as formatDuration,a2 as errorSignature,l2 as emitCrash,P4 as defineReporterElement,H4 as createAnnotator,n$ as correlateActionTrail,c3 as configureDebugCapture,m1 as closeSupportChat,O3 as chatLift,a1 as captureScreen,B9 as bundleToMarkdown,N9 as bundleFileName,N1 as buildBundle,S3 as badgeText,P0 as appInfo,h2 as actionCountSuffix,j1 as REPORTER_TAG,J8 as REPLAY_FILENAME,n0 as REDACTED,z2 as NoIdentityError,b7 as LASER_TRAIL_MS,h7 as LASER_LINGER_MS,m8 as InkSender,H2 as InkScene,q2 as InkPainter,m7 as INK_STALE_MS,h8 as INK_SEND_EVERY_MS,y7 as INK_MAX_POINTS_PER_OP,I4 as INK_KEEP_MS,g7 as INK_HOLD_MS,v7 as INK_FADE_MS,v8 as INK_COLORS,t2 as BUNDLE_BUDGET_BYTES};