@lightworkai.official/debug-capture 0.19.4 → 0.19.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (()=>{var O8=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:(z,$)=>(typeof require<"u"?require:z)[$]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});function _1(J){if(!J)return null;let z=J===!0?{}:J,$=(j,Q)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Q;return{side:z.position==="left"?"left":"right",x:$(z.offset?.x,16),y:$(z.offset?.y,16)}}var L8={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},n=null;function X4(J){let z=[];if(!J.host?.trim())z.push("host");if(!J.realmKey?.trim())z.push("realmKey");if(!J.app?.name?.trim())z.push("app.name");if(typeof J.module!=="function")z.push("module");if(z.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${z.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");n=J}function M(){if(!n)throw Error("[debug-capture] configureDebugCapture() has not been called");return n}function I1(){return n!==null}function q0(){let J=M().app;return{name:J.name,version:J.version??"0.0.0",environment:J.environment??S8()}}function S8(){if(typeof window>"u")return"unknown";let J=window.location.hostname;if(J==="localhost"||J==="127.0.0.1"||J.endsWith(".local"))return"development";return"production"}function B0(J){let z=n?.capture?.[J];return typeof z==="number"?z:L8[J]}function C1(J){let z=n?.module;if(!z)return null;try{return z(J)??null}catch{return null}}function O1(){let J=n?.redact;return{headers:J?.headers??[],queryKeys:(J?.queryKeys??[]).map((z)=>z.toLowerCase()),bodyKeys:(J?.bodyKeys??[]).map((z)=>z.toLowerCase())}}function V4(){return n?.capture?.overlaySelectors??[]}var R8='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',T8="[data-lw-mask]",Z4={fps:1,quality:0.5};function t0(){let J=n?.replay;if(!J)return null;let z=J===!0?{}:J,$=(Z,V)=>typeof Z==="number"&&Z>0?Z:V,j=z.maskInputs!==!1,Q=z.recordCanvas?{fps:$(typeof z.recordCanvas==="object"?z.recordCanvas.fps:void 0,Z4.fps),quality:$(typeof z.recordCanvas==="object"?z.recordCanvas.quality:void 0,Z4.quality)}:null;return{seconds:$(z.seconds,60),maskInputs:j,maskTextSelector:z.maskTextSelector?.trim()||(j?R8:T8),maskText:z.maskText===!0,blockSelector:z.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(z.maxBytes,4000000),canvas:Q}}function W4(J){if(typeof window>"u")return!1;let z;try{z=new URL(J,window.location.href)}catch{return!1}if(A8(z))return!1;if(z.origin===window.location.origin)return!0;return(n?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===z.origin}catch{return!1}})}function A8(J){if(!n?.host)return!1;try{if(new URL(n.host).origin!==J.origin)return!1}catch{return!1}return J.pathname.startsWith("/ingest/")}function Y4(J){let z=Object.entries(J).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of z)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var e0="‹redacted›",k8=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,x8=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),E8=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,f8=/[\w.+-]+@[\w-]+\.[\w.-]+/g,w8=/\d(?:[\d\s-]{7,})\d/g;function J1(J){return J.replace(f8,e0).replace(w8,e0)}function y8(J){if(k8.test(J))return!0;return O1().headers.some(($)=>$.toLowerCase()===J.toLowerCase())}function z1(J){let z={};for(let[$,j]of Object.entries(J))z[$]=y8($)?e0:j;return z}function N0(J){try{let z=/^https?:\/\//i.test(J),$=new URL(J,z?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(x8.has(Z.toLowerCase())||O1().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,e0),j=!0}),!j)return J;return z?$.toString():`${$.pathname}${$.search}`}catch{return J}}function V2(J,z){if(z>6||J===null||typeof J!=="object")return J;if(Array.isArray(J))return J.map((j)=>V2(j,z+1));let $={};for(let[j,Q]of Object.entries(J)){let Z=E8.test(j)||O1().bodyKeys.some((V)=>j.toLowerCase().includes(V));$[j]=Z?e0:V2(Q,z+1)}return $}function $1(J,z){if(J==null)return null;let $=J,j=J.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(V2(Q,0))}catch{}if($.length>z)return`${$.slice(0,z)}… [truncated ${$.length-z} chars]`;return $}var W2=120,Y2=40,v0=(J,z)=>J.length>z?`${J.slice(0,z)}…`:J,K2=(J)=>{try{return decodeURIComponent(J)}catch{return J}},g0=[],K4=0,G4=!1;function j1(J,z,$,j){let Q=v0(z,W2),Z=g0[g0.length-1];if(J==="navigate"&&Z?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${W}`))return Z.at=new Date().toISOString(),Z;let U=W.split(/[?#]/)[0]??W,q=Z.source?K2(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(q&&(U===q||U.startsWith(q)))return Z.detail=v0(`${Z.detail} → ${W}`,W2),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===J&&Z.detail===Q){if(Z.at=new Date().toISOString(),J!=="navigate")Z.count=(Z.count??1)+1;return Z}K4+=1;let V={id:`act_${K4}`,at:new Date().toISOString(),kind:J,detail:Q,count:1,source:$,html:S1(j)};g0.push(V);while(g0.length>B0("maxActions"))v8(g0.shift());return V}var g8=200000,Q1=0;function S1(J){if(!J)return;if(Q1+J.length>g8)return;return Q1+=J.length,J}function v8(J){if(!J)return;if(Q1-=(J.html?.length??0)+(J.afterHtml?.length??0),Q1<0)Q1=0}function L1(J){return J instanceof Element&&Boolean(J.closest("[data-debug-reporter]"))}var h8='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',m8={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},U4={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function b8(J){let z=J.getAttribute("role");if(z&&U4[z])return U4[z];return m8[J.tagName.toLowerCase()]??"ปุ่ม"}function u8(J,z){try{let $=J,j=0;while($&&j<=z){let Q=F4($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function p8(J){let z=J.getAttribute("aria-label")?.trim();if(z)return z;let $=J.getAttribute("title")?.trim();if($)return $;if(J instanceof HTMLInputElement||J instanceof HTMLTextAreaElement||J instanceof HTMLSelectElement)return(J.getAttribute("placeholder")||J.getAttribute("name")||"").trim();if(J instanceof HTMLImageElement)return(J.getAttribute("alt")||"").trim();let j=(J.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(J instanceof HTMLAnchorElement){let Q=J.getAttribute("href");if(Q?.startsWith("/"))return K2(Q)}return""}function i8(J){if(!(J instanceof Element))return null;let z=J.closest(h8)??u8(J,4);if(!z)return null;let $=z.tagName.toLowerCase();if($==="html"||$==="body")return null;return z}function d8(J){let z=J1(p8(J));if(!z)return null;return`${b8(J)} “${v0(z,Y2)}”`}var M4=6000,c8=4000,l8=/(?:^|\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 o8(J){J.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let z=[J,...Array.from(J.querySelectorAll("*"))];for(let Q of z){for(let V of Array.from(Q.attributes)){let W=V.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(V.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let V=Z.replace(l8," ").replace(/\s+/g," ").trim();if(V)Q.setAttribute("class",V);else Q.removeAttribute("class")}}let $=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=J1(j.nodeValue);j=$.nextNode()}}function G2(J,z,$){try{let j=J.outerHTML;if(!j||j.length>z)return;let Q=J.cloneNode(!0);o8(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var r8=(J)=>G2(J,M4,c8),n8=150000,s8=40000,q4=(J)=>G2(J,n8,s8);function a8(J){if(!(J instanceof HTMLInputElement)&&!(J instanceof HTMLTextAreaElement)&&!(J instanceof HTMLSelectElement))return null;let z=J.name||J.id||J.getAttribute("aria-label")||J.getAttribute("placeholder")||J.tagName.toLowerCase();return`ช่อง “${J1(z)}”`}var H4=80;function F4(J){let z=Object.keys(J).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return z?J[z]:null}function t8(J){if(typeof J!=="function")return null;try{let z=Function.prototype.toString.call(J);return(z.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??z.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function D4(J){if(!J)return;return`→ ${J.length>H4?`${J.slice(0,H4)}…`:J}`}function e8(J){try{let z=J.closest("a[href]")?.getAttribute("href");if(z&&z.startsWith("/"))return D4(z);let $=F4(J),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return D4(t8($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var J5='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function z5(){let J=V4();return J.length?J.join(", "):J5}function $5(J){let z=J.getAttribute("role");if(z==="status"||z==="alert")return"ข้อความแจ้งเตือน";if(z==="menu")return"เมนู";if(z==="listbox")return"รายการตัวเลือก";if(z==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function j5(J){let z=J.getAttribute("aria-label")?.trim();if(z)return z;let $=J.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=J.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(J.textContent??"").replace(/\s+/g," ").trim()}function B4(J){let z=J1(j5(J)),$=$5(J);return z?`เปิด ${$} “${v0(z,Y2)}”`:`เปิด ${$}`}var Q5='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',Z5=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function X5(J){if(J.querySelector(Q5))return!0;return Z5.test(J.textContent??"")}var V5=400,W5=250,Y5=8000;function K5(J,z){if(typeof MutationObserver>"u"){z.html=S1(q4(J));return}let $=Date.now(),j=!1,Q=()=>{j=!0,V.disconnect(),window.clearInterval(W),window.clearTimeout(U)},Z=()=>{if(j)return;if(Q(),!J.isConnected)return;z.detail=v0(B4(J),W2),z.html=S1(q4(J))},V=new MutationObserver(()=>{$=Date.now()});V.observe(J,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!J.isConnected){Q();return}if(Date.now()-$>=V5&&!X5(J))Z()},W5),U=window.setTimeout(Z,Y5)}function G5(J){if(L1(J))return;let z=j1("ui",B4(J));if(z)K5(J,z)}function U5(){if(typeof MutationObserver>"u")return;let J=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=z5(),V=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of V){if(J.has(W))continue;J.add(W),G5(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var q5=1600,H5=2500;function P4(J){return{disabled:J.hasAttribute("disabled")||J.getAttribute("aria-disabled")==="true",busy:J.getAttribute("aria-busy")==="true",text:v0((J.textContent??"").replace(/\s+/g," ").trim(),Y2)}}function D5(J,z){if(!J.disabled&&z.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!J.busy&&z.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(J.text!==z.text&&z.text)return`ข้อความเปลี่ยนเป็น “${z.text}”`;return null}function P5(J,z){if(typeof MutationObserver>"u")return;let $=P4(J),j=!1,Q=(W,U)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(V),z.afterNote=W,U)z.afterHtml=S1(G2(J,M4,H5))},Z=new MutationObserver(()=>{if(!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=D5($,P4(J));if(W)Q(W,!0)});Z.observe(J,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},q5)}function N4(){if(G4||typeof window>"u")return;G4=!0,document.addEventListener("click",(j)=>{if(L1(j.target))return;let Q=i8(j.target);if(!Q)return;let Z=d8(Q);if(!Z)return;let V=j1("click",`คลิก ${Z}`,e8(Q),r8(Q));if(V)P5(Q,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(L1(j.target))return;let Q=a8(j.target);if(Q)j1("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(L1(j.target))return;j1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let J=()=>j1("navigate",`ไปที่ ${K2(N0(location.pathname+location.search))}`),z=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=z(...j);return J(),Q},history.replaceState=(...j)=>{let Q=$(...j);return J(),Q},window.addEventListener("popstate",J),U5()}function _4(){return g0.map((J)=>({...J}))}var I4=2000,R1=[],C4=0,O4=!1;function U2(J,z){C4+=1,R1.push({id:`log_${C4}`,at:new Date().toISOString(),level:J,message:z.length>I4?`${z.slice(0,I4)}…`:z});while(R1.length>B0("maxConsoleEntries"))R1.shift()}function M5(){let J=new WeakSet;return(z,$)=>{if(typeof $==="object"&&$!==null){if(J.has($))return"[Circular]";J.add($)}if(typeof $==="bigint")return $.toString();return $}}function L4(J){if(typeof J==="string")return J;if(J instanceof Error)return`${J.name}: ${J.message}`;try{let z=JSON.stringify(J,M5());if(z!==void 0)return z}catch{}try{return String(J)}catch{}try{return Object.prototype.toString.call(J)}catch{return`[${typeof J}]`}}function S4(){if(O4||typeof window>"u")return;O4=!0;let J=["log","info","warn","error","debug"];for(let z of J){let $=console[z].bind(console);console[z]=(...j)=>{U2(z,j.map(L4).join(" ")),$(...j)}}window.addEventListener("error",(z)=>{let $=z.filename?` (${z.filename}:${z.lineno}:${z.colno})`:"";U2("exception",`${z.message}${$}`)}),window.addEventListener("unhandledrejection",(z)=>{let $=z.reason instanceof Error?`${z.reason.name}: ${z.reason.message}`:L4(z.reason);U2("unhandledrejection",$)})}function R4(){return R1.map((J)=>({...J}))}var T4=new Set,A4=new Set;function k4(J,z){return J.add(z),()=>J.delete(z)}function x4(J,z){for(let $ of[...J])$(z)}function E4(J){return k4(T4,J)}function h0(J={type:"manual"}){x4(T4,J)}function f4(J){return k4(A4,J)}function w4(J){x4(A4,J)}var F5=15000,B5=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],y4=!1,g4=0;function N5(J){return B5.some((z)=>J.includes(z))}function v4(J){let z=J.message??"";if(!z||N5(z))return;let $=Date.now();if($-g4<F5)return;g4=$,w4({...J,message:z})}function h4(){if(y4||typeof window>"u")return;y4=!0,window.addEventListener("error",(J)=>{if(!J.message&&!J.error)return;let z=J.error instanceof Error?J.error:null;v4({type:"runtime-error",message:J.message||(z?z.message:"Unknown error"),stack:z?.stack})}),window.addEventListener("unhandledrejection",(J)=>{let z=J.reason;v4({type:"unhandledrejection",message:z instanceof Error?z.message:String(z),stack:z instanceof Error?z.stack:void 0})})}var p4=4000,_5=1e6,I5=1e7,T1=[],m4=0,b4=!1;function i4(J){T1.push(J);while(T1.length>B0("maxRequests"))T1.shift()}function d4(){return m4+=1,`req_${m4}`}function u4(J){let z={};if(!J)return z;if(J instanceof Headers)J.forEach(($,j)=>{z[j]=$});else if(Array.isArray(J))for(let[$,j]of J)z[$]=j;else Object.assign(z,J);return z}function C5(J){let z={};return J.forEach(($,j)=>{z[j]=$}),z}function O5(J){if(J==null)return null;if(typeof J==="string")return J;if(J instanceof URLSearchParams)return J.toString();if(typeof FormData<"u"&&J instanceof FormData)return`[FormData: ${Array.from(J.keys()).join(", ")}]`;if(typeof Blob<"u"&&J instanceof Blob)return`[Blob ${J.size} bytes]`;if(J instanceof ArrayBuffer)return`[ArrayBuffer ${J.byteLength} bytes]`;return"[binary]"}function L5(J,z){let $="",j="GET",Q={},Z=null;if(typeof J==="string")$=J;else if(J instanceof URL)$=J.toString();else $=J.url,j=J.method||j,Q=u4(J.headers);if(z){if(z.method)j=z.method;if(z.headers)Q={...Q,...u4(z.headers)};if(z.body!==void 0)Z=O5(z.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function c4(J){return!W4(J)}function S5(J,z){if(c4(z.url)){z.responseSnippet="[body not captured for this origin]";return}let $=J.headers.get("content-type")??"",j=Number(J.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){z.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>_5){z.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{J.clone().text().then((Z)=>{z.responseSnippet=$1(Z,B0("maxBodyChars"))}).catch(()=>{})}catch{}}function l4(J,z){if(/[?&]_rsc=/.test(J))return!0;for(let $ of Object.keys(z)){let j=$.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 J=window.fetch.bind(window);window.fetch=Object.assign(async(z,$)=>{let j=L5(z,$);if(l4(j.url,j.headers))return J(z,$);let Q={id:d4(),startedAt:new Date().toISOString(),method:j.method,url:N0(j.url),requestHeaders:z1(j.headers),requestBody:$1(j.body,p4),status:null,statusText:null,durationMs:null,via:"fetch"};i4(Q);let Z=performance.now();try{let V=await J(z,$);return Q.status=V.status,Q.statusText=V.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=z1(C5(V.headers)),S5(V,Q),V}catch(V){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},J)}function T5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let J=XMLHttpRequest.prototype,z=J.open,$=J.send,j=function(Z,V){let W=typeof V==="string"?V:V.toString();return this.__lwEntry=l4(W,{})?void 0:{id:d4(),startedAt:"",method:(Z||"GET").toUpperCase(),url:N0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},z.apply(this,arguments)},Q=function(Z){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof Z==="string"?$1(Z,p4):Z==null?null:"[non-string body]";let W=performance.now();i4(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-W),c4(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=$1(this.responseText||"",B0("maxBodyChars"))}catch{}else{let U=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${U}]`}})}return $.apply(this,arguments)};J.open=j,J.send=Q}function o4(){if(b4)return;b4=!0,R5(),T5()}function r4(){let J=T1.map(($)=>({...$})),z=0;for(let $=J.length-1;$>=0;$-=1){let j=J[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(z+Q.length>I5)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else z+=Q.length}return J}var A5=4,n4=3,k5=4000,x5="[data-debug-reporter]",s4=()=>import("@rrweb/record");function a4(J){s4=J}var t=[],q2=null,A1=!1;function t4(){if(typeof window>"u"||q2||A1)return;let J=t0();if(!J)return;A1=!0;let z=()=>void E5(J);if("requestIdleCallback"in window)window.requestIdleCallback(z,{timeout:3000});else setTimeout(z,1000)}async function E5(J){let z;try{z=(await s4()).record}catch($){A1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(q2)return;try{q2=z({emit:($)=>f5($),checkoutEveryNms:Math.max(1000,J.seconds*1000/2),checkoutEveryNth:k5,maskAllInputs:J.maskInputs,maskTextSelector:J.maskText?"*":J.maskTextSelector,blockSelector:`${J.blockSelector}, ${x5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...J.canvas?{canvas:J.canvas.fps}:{}},recordCanvas:J.canvas!==null,...J.canvas?{dataURLOptions:{type:"image/webp",quality:J.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{A1=!1}}function f5(J){if(J.type===A5||t.length===0){if(t.push([]),t.length>n4)t=t.slice(-n4)}t[t.length-1].push(J)}function e4(J=Date.now()){let z=t0();if(!z||!t.length)return null;let $=J-z.seconds*1000,j=t.length-1;while(j>0&&(t[j][0]?.timestamp??J)>$)j-=1;let Q=t.slice(j).flat(),Z=Q[0]?.timestamp,V=Q[Q.length-1]?.timestamp;if(Z===void 0||V===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-Z)}}var w5={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:"มีข้อความใหม่จากทีมงาน"},y5={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 c(J){return J==="en"?y5:w5}var g5="lw-debug-toasts",v5=6000,h5=`
1
+ (()=>{var R8=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:(z,$)=>(typeof require<"u"?require:z)[$]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});function C1(J){if(!J)return null;let z=J===!0?{}:J,$=(j,Q)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Q;return{side:z.position==="left"?"left":"right",x:$(z.offset?.x,16),y:$(z.offset?.y,16)}}var T8={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},s=null;function W4(J){let z=[];if(!J.host?.trim())z.push("host");if(!J.realmKey?.trim())z.push("realmKey");if(!J.app?.name?.trim())z.push("app.name");if(typeof J.module!=="function")z.push("module");if(z.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${z.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");s=J}function M(){if(!s)throw Error("[debug-capture] configureDebugCapture() has not been called");return s}function O1(){return s!==null}function U0(){let J=M().app;return{name:J.name,version:J.version??"0.0.0",environment:J.environment??A8()}}function A8(){if(typeof window>"u")return"unknown";let J=window.location.hostname;if(J==="localhost"||J==="127.0.0.1"||J.endsWith(".local"))return"development";return"production"}function F0(J){let z=s?.capture?.[J];return typeof z==="number"?z:T8[J]}function L1(J){let z=s?.module;if(!z)return null;try{return z(J)??null}catch{return null}}function S1(){let J=s?.redact;return{headers:J?.headers??[],queryKeys:(J?.queryKeys??[]).map((z)=>z.toLowerCase()),bodyKeys:(J?.bodyKeys??[]).map((z)=>z.toLowerCase())}}function Y4(){return s?.capture?.overlaySelectors??[]}var x8='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',E8="[data-lw-mask]",V4={fps:1,quality:0.5};function t0(){let J=s?.replay;if(!J)return null;let z=J===!0?{}:J,$=(Z,V)=>typeof Z==="number"&&Z>0?Z:V,j=z.maskInputs!==!1,Q=z.recordCanvas?{fps:$(typeof z.recordCanvas==="object"?z.recordCanvas.fps:void 0,V4.fps),quality:$(typeof z.recordCanvas==="object"?z.recordCanvas.quality:void 0,V4.quality)}:null;return{seconds:$(z.seconds,60),maskInputs:j,maskTextSelector:z.maskTextSelector?.trim()||(j?x8:E8),maskText:z.maskText===!0,blockSelector:z.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(z.maxBytes,4000000),canvas:Q}}function K4(J){if(typeof window>"u")return!1;let z;try{z=new URL(J,window.location.href)}catch{return!1}if(k8(z))return!1;if(z.origin===window.location.origin)return!0;return(s?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===z.origin}catch{return!1}})}function k8(J){if(!s?.host)return!1;try{if(new URL(s.host).origin!==J.origin)return!1}catch{return!1}return J.pathname.startsWith("/ingest/")}function G4(J){let z=Object.entries(J).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of z)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var e0="‹redacted›",f8=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,w8=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),y8=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,v8=/[\w.+-]+@[\w-]+\.[\w.-]+/g,g8=/\d(?:[\d\s-]{7,})\d/g;function J1(J){return J.replace(v8,e0).replace(g8,e0)}function m8(J){if(f8.test(J))return!0;return S1().headers.some(($)=>$.toLowerCase()===J.toLowerCase())}function z1(J){let z={};for(let[$,j]of Object.entries(J))z[$]=m8($)?e0:j;return z}function N0(J){try{let z=/^https?:\/\//i.test(J),$=new URL(J,z?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(w8.has(Z.toLowerCase())||S1().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,e0),j=!0}),!j)return J;return z?$.toString():`${$.pathname}${$.search}`}catch{return J}}function K2(J,z){if(z>6||J===null||typeof J!=="object")return J;if(Array.isArray(J))return J.map((j)=>K2(j,z+1));let $={};for(let[j,Q]of Object.entries(J)){let Z=y8.test(j)||S1().bodyKeys.some((V)=>j.toLowerCase().includes(V));$[j]=Z?e0:K2(Q,z+1)}return $}function $1(J,z){if(J==null)return null;let $=J,j=J.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(K2(Q,0))}catch{}if($.length>z)return`${$.slice(0,z)}… [truncated ${$.length-z} chars]`;return $}var G2=120,q2=40,g0=(J,z)=>J.length>z?`${J.slice(0,z)}…`:J,U2=(J)=>{try{return decodeURIComponent(J)}catch{return J}},v0=[],q4=0,U4=!1;function j1(J,z,$,j){let Q=g0(z,G2),Z=v0[v0.length-1];if(J==="navigate"&&Z?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${W}`))return Z.at=new Date().toISOString(),Z;let q=W.split(/[?#]/)[0]??W,U=Z.source?U2(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(U&&(q===U||q.startsWith(U)))return Z.detail=g0(`${Z.detail} → ${W}`,G2),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===J&&Z.detail===Q){if(Z.at=new Date().toISOString(),J!=="navigate")Z.count=(Z.count??1)+1;return Z}q4+=1;let V={id:`act_${q4}`,at:new Date().toISOString(),kind:J,detail:Q,count:1,source:$,html:T1(j)};v0.push(V);while(v0.length>F0("maxActions"))b8(v0.shift());return V}var h8=200000,Q1=0;function T1(J){if(!J)return;if(Q1+J.length>h8)return;return Q1+=J.length,J}function b8(J){if(!J)return;if(Q1-=(J.html?.length??0)+(J.afterHtml?.length??0),Q1<0)Q1=0}function R1(J){return J instanceof Element&&Boolean(J.closest("[data-debug-reporter]"))}var u8='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',p8={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},H4={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function i8(J){let z=J.getAttribute("role");if(z&&H4[z])return H4[z];return p8[J.tagName.toLowerCase()]??"ปุ่ม"}function d8(J,z){try{let $=J,j=0;while($&&j<=z){let Q=N4($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function c8(J){let z=J.getAttribute("aria-label")?.trim();if(z)return z;let $=J.getAttribute("title")?.trim();if($)return $;if(J instanceof HTMLInputElement||J instanceof HTMLTextAreaElement||J instanceof HTMLSelectElement)return(J.getAttribute("placeholder")||J.getAttribute("name")||"").trim();if(J instanceof HTMLImageElement)return(J.getAttribute("alt")||"").trim();let j=(J.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(J instanceof HTMLAnchorElement){let Q=J.getAttribute("href");if(Q?.startsWith("/"))return U2(Q)}return""}function l8(J){if(!(J instanceof Element))return null;let z=J.closest(u8)??d8(J,4);if(!z)return null;let $=z.tagName.toLowerCase();if($==="html"||$==="body")return null;return z}function r8(J){let z=J1(c8(J));if(!z)return null;return`${i8(J)} “${g0(z,q2)}”`}var F4=6000,n8=4000,o8=/(?:^|\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 s8(J){J.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let z=[J,...Array.from(J.querySelectorAll("*"))];for(let Q of z){for(let V of Array.from(Q.attributes)){let W=V.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(V.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let V=Z.replace(o8," ").replace(/\s+/g," ").trim();if(V)Q.setAttribute("class",V);else Q.removeAttribute("class")}}let $=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=J1(j.nodeValue);j=$.nextNode()}}function H2(J,z,$){try{let j=J.outerHTML;if(!j||j.length>z)return;let Q=J.cloneNode(!0);s8(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var a8=(J)=>H2(J,F4,n8),t8=150000,e8=40000,D4=(J)=>H2(J,t8,e8);function J3(J){if(!(J instanceof HTMLInputElement)&&!(J instanceof HTMLTextAreaElement)&&!(J instanceof HTMLSelectElement))return null;let z=J.name||J.id||J.getAttribute("aria-label")||J.getAttribute("placeholder")||J.tagName.toLowerCase();return`ช่อง “${J1(z)}”`}var P4=80;function N4(J){let z=Object.keys(J).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return z?J[z]:null}function z3(J){if(typeof J!=="function")return null;try{let z=Function.prototype.toString.call(J);return(z.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??z.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function M4(J){if(!J)return;return`→ ${J.length>P4?`${J.slice(0,P4)}…`:J}`}function $3(J){try{let z=J.closest("a[href]")?.getAttribute("href");if(z&&z.startsWith("/"))return M4(z);let $=N4(J),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return M4(z3($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var j3='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function Q3(){let J=Y4();return J.length?J.join(", "):j3}function Z3(J){let z=J.getAttribute("role");if(z==="status"||z==="alert")return"ข้อความแจ้งเตือน";if(z==="menu")return"เมนู";if(z==="listbox")return"รายการตัวเลือก";if(z==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function X3(J){let z=J.getAttribute("aria-label")?.trim();if(z)return z;let $=J.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=J.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(J.textContent??"").replace(/\s+/g," ").trim()}function _4(J){let z=J1(X3(J)),$=Z3(J);return z?`เปิด ${$} “${g0(z,q2)}”`:`เปิด ${$}`}var V3='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',W3=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function Y3(J){if(J.querySelector(V3))return!0;return W3.test(J.textContent??"")}var K3=400,G3=250,q3=8000;function U3(J,z){if(typeof MutationObserver>"u"){z.html=T1(D4(J));return}let $=Date.now(),j=!1,Q=()=>{j=!0,V.disconnect(),window.clearInterval(W),window.clearTimeout(q)},Z=()=>{if(j)return;if(Q(),!J.isConnected)return;z.detail=g0(_4(J),G2),z.html=T1(D4(J))},V=new MutationObserver(()=>{$=Date.now()});V.observe(J,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!J.isConnected){Q();return}if(Date.now()-$>=K3&&!Y3(J))Z()},G3),q=window.setTimeout(Z,q3)}function H3(J){if(R1(J))return;let z=j1("ui",_4(J));if(z)U3(J,z)}function D3(){if(typeof MutationObserver>"u")return;let J=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=Q3(),V=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of V){if(J.has(W))continue;J.add(W),H3(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var P3=1600,M3=2500;function B4(J){return{disabled:J.hasAttribute("disabled")||J.getAttribute("aria-disabled")==="true",busy:J.getAttribute("aria-busy")==="true",text:g0((J.textContent??"").replace(/\s+/g," ").trim(),q2)}}function B3(J,z){if(!J.disabled&&z.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!J.busy&&z.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(J.text!==z.text&&z.text)return`ข้อความเปลี่ยนเป็น “${z.text}”`;return null}function F3(J,z){if(typeof MutationObserver>"u")return;let $=B4(J),j=!1,Q=(W,q)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(V),z.afterNote=W,q)z.afterHtml=T1(H2(J,F4,M3))},Z=new MutationObserver(()=>{if(!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=B3($,B4(J));if(W)Q(W,!0)});Z.observe(J,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},P3)}function I4(){if(U4||typeof window>"u")return;U4=!0,document.addEventListener("click",(j)=>{if(R1(j.target))return;let Q=l8(j.target);if(!Q)return;let Z=r8(Q);if(!Z)return;let V=j1("click",`คลิก ${Z}`,$3(Q),a8(Q));if(V)F3(Q,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(R1(j.target))return;let Q=J3(j.target);if(Q)j1("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(R1(j.target))return;j1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let J=()=>j1("navigate",`ไปที่ ${U2(N0(location.pathname+location.search))}`),z=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=z(...j);return J(),Q},history.replaceState=(...j)=>{let Q=$(...j);return J(),Q},window.addEventListener("popstate",J),D3()}function C4(){return v0.map((J)=>({...J}))}var O4=2000,A1=[],L4=0,S4=!1;function D2(J,z){L4+=1,A1.push({id:`log_${L4}`,at:new Date().toISOString(),level:J,message:z.length>O4?`${z.slice(0,O4)}…`:z});while(A1.length>F0("maxConsoleEntries"))A1.shift()}function N3(){let J=new WeakSet;return(z,$)=>{if(typeof $==="object"&&$!==null){if(J.has($))return"[Circular]";J.add($)}if(typeof $==="bigint")return $.toString();return $}}function R4(J){if(typeof J==="string")return J;if(J instanceof Error)return`${J.name}: ${J.message}`;try{let z=JSON.stringify(J,N3());if(z!==void 0)return z}catch{}try{return String(J)}catch{}try{return Object.prototype.toString.call(J)}catch{return`[${typeof J}]`}}function T4(){if(S4||typeof window>"u")return;S4=!0;let J=["log","info","warn","error","debug"];for(let z of J){let $=console[z].bind(console);console[z]=(...j)=>{D2(z,j.map(R4).join(" ")),$(...j)}}window.addEventListener("error",(z)=>{let $=z.filename?` (${z.filename}:${z.lineno}:${z.colno})`:"";D2("exception",`${z.message}${$}`)}),window.addEventListener("unhandledrejection",(z)=>{let $=z.reason instanceof Error?`${z.reason.name}: ${z.reason.message}`:R4(z.reason);D2("unhandledrejection",$)})}function A4(){return A1.map((J)=>({...J}))}var x4=new Set,E4=new Set;function k4(J,z){return J.add(z),()=>J.delete(z)}function f4(J,z){for(let $ of[...J])$(z)}function w4(J){return k4(x4,J)}function m0(J={type:"manual"}){f4(x4,J)}function y4(J){return k4(E4,J)}function v4(J){f4(E4,J)}var _3=15000,I3=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],g4=!1,m4=0;function C3(J){return I3.some((z)=>J.includes(z))}function h4(J){let z=J.message??"";if(!z||C3(z))return;let $=Date.now();if($-m4<_3)return;m4=$,v4({...J,message:z})}function b4(){if(g4||typeof window>"u")return;g4=!0,window.addEventListener("error",(J)=>{if(!J.message&&!J.error)return;let z=J.error instanceof Error?J.error:null;h4({type:"runtime-error",message:J.message||(z?z.message:"Unknown error"),stack:z?.stack})}),window.addEventListener("unhandledrejection",(J)=>{let z=J.reason;h4({type:"unhandledrejection",message:z instanceof Error?z.message:String(z),stack:z instanceof Error?z.stack:void 0})})}var d4=4000,O3=1e6,L3=1e7,x1=[],u4=0,p4=!1;function c4(J){x1.push(J);while(x1.length>F0("maxRequests"))x1.shift()}function l4(){return u4+=1,`req_${u4}`}function i4(J){let z={};if(!J)return z;if(J instanceof Headers)J.forEach(($,j)=>{z[j]=$});else if(Array.isArray(J))for(let[$,j]of J)z[$]=j;else Object.assign(z,J);return z}function S3(J){let z={};return J.forEach(($,j)=>{z[j]=$}),z}function R3(J){if(J==null)return null;if(typeof J==="string")return J;if(J instanceof URLSearchParams)return J.toString();if(typeof FormData<"u"&&J instanceof FormData)return`[FormData: ${Array.from(J.keys()).join(", ")}]`;if(typeof Blob<"u"&&J instanceof Blob)return`[Blob ${J.size} bytes]`;if(J instanceof ArrayBuffer)return`[ArrayBuffer ${J.byteLength} bytes]`;return"[binary]"}function T3(J,z){let $="",j="GET",Q={},Z=null;if(typeof J==="string")$=J;else if(J instanceof URL)$=J.toString();else $=J.url,j=J.method||j,Q=i4(J.headers);if(z){if(z.method)j=z.method;if(z.headers)Q={...Q,...i4(z.headers)};if(z.body!==void 0)Z=R3(z.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function r4(J){return!K4(J)}function A3(J,z){if(r4(z.url)){z.responseSnippet="[body not captured for this origin]";return}let $=J.headers.get("content-type")??"",j=Number(J.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){z.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>O3){z.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{J.clone().text().then((Z)=>{z.responseSnippet=$1(Z,F0("maxBodyChars"))}).catch(()=>{})}catch{}}function n4(J,z){if(/[?&]_rsc=/.test(J))return!0;for(let $ of Object.keys(z)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function x3(){if(typeof window>"u"||typeof window.fetch!=="function")return;let J=window.fetch.bind(window);window.fetch=Object.assign(async(z,$)=>{let j=T3(z,$);if(n4(j.url,j.headers))return J(z,$);let Q={id:l4(),startedAt:new Date().toISOString(),method:j.method,url:N0(j.url),requestHeaders:z1(j.headers),requestBody:$1(j.body,d4),status:null,statusText:null,durationMs:null,via:"fetch"};c4(Q);let Z=performance.now();try{let V=await J(z,$);return Q.status=V.status,Q.statusText=V.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=z1(S3(V.headers)),A3(V,Q),V}catch(V){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},J)}function E3(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let J=XMLHttpRequest.prototype,z=J.open,$=J.send,j=function(Z,V){let W=typeof V==="string"?V:V.toString();return this.__lwEntry=n4(W,{})?void 0:{id:l4(),startedAt:"",method:(Z||"GET").toUpperCase(),url:N0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},z.apply(this,arguments)},Q=function(Z){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof Z==="string"?$1(Z,d4):Z==null?null:"[non-string body]";let W=performance.now();c4(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-W),r4(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=$1(this.responseText||"",F0("maxBodyChars"))}catch{}else{let q=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${q}]`}})}return $.apply(this,arguments)};J.open=j,J.send=Q}function o4(){if(p4)return;p4=!0,x3(),E3()}function s4(){let J=x1.map(($)=>({...$})),z=0;for(let $=J.length-1;$>=0;$-=1){let j=J[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(z+Q.length>L3)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else z+=Q.length}return J}var k3=4,a4=3,f3=4000,w3="[data-debug-reporter]",t4=()=>import("@rrweb/record");function e4(J){t4=J}var e=[],P2=null,E1=!1;function J6(){if(typeof window>"u"||P2||E1)return;let J=t0();if(!J)return;E1=!0;let z=()=>void y3(J);if("requestIdleCallback"in window)window.requestIdleCallback(z,{timeout:3000});else setTimeout(z,1000)}async function y3(J){let z;try{z=(await t4()).record}catch($){E1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(P2)return;try{P2=z({emit:($)=>v3($),checkoutEveryNms:Math.max(1000,J.seconds*1000/2),checkoutEveryNth:f3,maskAllInputs:J.maskInputs,maskTextSelector:J.maskText?"*":J.maskTextSelector,blockSelector:`${J.blockSelector}, ${w3}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...J.canvas?{canvas:J.canvas.fps}:{}},recordCanvas:J.canvas!==null,...J.canvas?{dataURLOptions:{type:"image/webp",quality:J.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{E1=!1}}function v3(J){if(J.type===k3||e.length===0){if(e.push([]),e.length>a4)e=e.slice(-a4)}e[e.length-1].push(J)}function z6(J=Date.now()){let z=t0();if(!z||!e.length)return null;let $=J-z.seconds*1000,j=e.length-1;while(j>0&&(e[j][0]?.timestamp??J)>$)j-=1;let Q=e.slice(j).flat(),Z=Q[0]?.timestamp,V=Q[Q.length-1]?.timestamp;if(Z===void 0||V===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-Z)}}var g3={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:"มีข้อความใหม่จากทีมงาน"},m3={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 l(J){return J==="en"?m3:g3}var h3="lw-debug-toasts",b3=6000,u3=`
2
2
  :host { all: initial; }
3
3
  .stack {
4
4
  position: fixed; top: 16px; right: 16px; z-index: 2147483001;
@@ -30,7 +30,7 @@
30
30
  }
31
31
  @keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
32
32
  @media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
33
- `,H2=null;function m5(){if(typeof document>"u")return null;if(H2?.isConnected)return H2;let J=document.createElement(g5);J.dataset.debugReporter="true";let z=J.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=h5;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),z.append($,j),document.body.append(J),H2=j,j}function m0(J,z="success",$){let j=I1()?M().toast:void 0;if(j){j({message:J,tone:z,...$?{action:$}:{}});return}let Q=m5();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=z;let V=document.createElement("span");V.className="dot";let W=document.createElement("span");W.textContent=J;let U=document.createElement("button");U.type="button",U.className="close",U.textContent="✕",U.setAttribute("aria-label","ปิด");let q=()=>{window.clearTimeout(C),Z.remove()};U.addEventListener("click",q);let C=z==="error"||$?0:window.setTimeout(q,v5);if(Z.append(V,W),$){let F=document.createElement("button");F.type="button",F.className="action",F.textContent=$.label,F.addEventListener("click",()=>{q(),$.onClick()}),Z.append(F)}Z.append(U),Q.append(Z)}function J6(J,z,$){let j=J.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=z.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function b5(){let J={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return J;let z=performance.memory;if(z)J.memoryUsedMb=Math.round(z.usedJSHeapSize/1024/1024),J.memoryLimitMb=Math.round(z.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)J.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),J.loadEventMs=Math.round($.loadEventEnd);return J}function D2(J,z){if(!J)return z;try{return J()}catch{return z}}function z6(){let J=M(),{pathname:z,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:z,search:$},module:C1(z),user:D2(J.user,{}),apiHeaders:z1(D2(J.headers,{})),app:{name:q0().name,version:q0().version,environment:q0().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:b5(),extra:D2(J.extra,{})}}var u5=2;function k1(J){let z=r4(),$=R4();return{context:z6(),reason:J.reason,note:J.note,cause:J6(z,$,J.erroredQueries),actionTrail:_4(),network:z,console:$,screenshotDataUrl:J.screenshotDataUrl,screenshotMethod:J.screenshotMethod,replay:e4()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:u5}}}async function P2(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await p5();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let z=await c5();if(z)return{dataUrl:z,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function p5(){let J=null;try{let z={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};J=await navigator.mediaDevices.getDisplayMedia(z);let $=await i5(J);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(z){if(z instanceof DOMException&&(z.name==="NotAllowedError"||z.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{J?.getTracks().forEach((z)=>z.stop())}}async function i5(J){let z=document.createElement("video");z.srcObject=J,z.muted=!0,z.playsInline=!0,await new Promise((V)=>{let W=!1,U=()=>{if(W)return;W=!0,V()};z.onloadedmetadata=()=>{z.play().then(U).catch(U)},window.setTimeout(U,1500)}),await d5(z);let{videoWidth:$,videoHeight:j}=z;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(z,0,0,$,j),z.pause(),z.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function d5(J){return new Promise((z)=>{let $=!1,j=()=>{if($)return;$=!0,z()},Q=J;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function c5(){let J=M().screenshotFallback;if(!J)return null;let z=await J().catch(()=>null);if(!z)return null;try{return await z(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var l5=2000,o5=0.82,r5=3000000;function n5(J){return new Promise((z,$)=>{let j=new Image;j.onload=()=>z(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=J})}async function x1(J){try{let z=await n5(J),$=Math.max(z.naturalWidth,z.naturalHeight),j=Math.min(1,l5/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(z.naturalWidth*j)),Q.height=Math.max(1,Math.round(z.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return J;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(z,0,0,Q.width,Q.height);let V=o5,W=Q.toDataURL("image/jpeg",V);while(W.length>r5&&V>0.4)V-=0.15,W=Q.toDataURL("image/jpeg",V);return W}catch{return J}}var s5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,a5=/^\d+$/,t5=/^[0-9a-f]{16,}$/i;function $6(J){if(J.reason.type==="manual")return null;let z=J.cause?.failedRequests?.[0];if(!z?.url)return null;let $;try{$=new URL(z.url,"http://x").pathname}catch{$=z.url}let j=$.split("/").map((Z)=>s5.test(Z)||a5.test(Z)||t5.test(Z)?":id":Z).join("/"),Q=z.status??(z.error?"ERR":"?");return`${z.method??"REQ"} ${j} ${Q}`}var j6=2000000;function E1(J){let{screenshotDataUrl:z,replay:$,...j}=J;return JSON.stringify(j).length}function Q6(J,z=2000000){if(E1(J)<=z)return J;let $=J.network.map((Q)=>({...Q})),j={...J,network:$};for(let Q of $){if(E1(j)<=z)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&E1(j)>z)j.network=j.network.slice(1);while(j.console.length>1&&E1(j)>z)j.console=j.console.slice(1);return j}function Z1(J){let z="";for(let $=0;$<J.length;$+=32768)z+=String.fromCharCode(...J.subarray($,$+32768));return btoa(z)}var e5=4,J3=2,z3=3,$3=0,j3=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),Q3=/^\s*javascript:/i;function Z3(J,z){let $=J.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof z==="string"&&Q3.test(z)}function Z6(J,z=!1){if(!J)return;for(let $ of Object.keys(J)){let j=J[$];if(Z3($,j)){if(z)J[$]=null;else delete J[$];continue}if(typeof j!=="string"||!j3.has($)||!j.includes("?"))continue;J[$]=N0(j)}}function M2(J){if(!J)return;Z6(J.attributes);for(let z of J.childNodes??[])M2(z)}function X6(J){let z=JSON.parse(JSON.stringify(J));for(let $ of z){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===e5&&typeof j.href==="string")j.href=N0(j.href);else if($.type===J3)M2(j.node);else if($.type===z3&&j.source===$3){for(let Q of j.adds??[])M2(Q.node);for(let Q of j.attributes??[])Z6(Q.attributes,!0)}}return z}var X3="session-replay.json.gz",V3="session-replay.json";function W3(J){return Boolean(J&&J.events.length>0)}async function Y3(J){if(typeof CompressionStream>"u")return null;try{let z=new Blob([J]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(z).arrayBuffer())}catch{return null}}async function W6(J,z){if(!W3(J))return{summary:{omitted:"empty"}};let j={seconds:Math.round(J.durationMs/1000),events:J.events.length,startedAt:J.startedAt,endedAt:J.endedAt},Q=X6(J.events),Z=await V6(Q),V=!1;if(Z.bytes.byteLength>z&&U3(Q))Q=q3(Q),Z=await V6(Q),V=!0;let{bytes:W,compressed:U}=Z;if(W.byteLength>z)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${U?"application/gzip":"application/json"};base64,${Z1(W)}`,filename:U?X3:V3,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:U,...V?{canvasDropped:V}:{}}}}async function V6(J){let z=new TextEncoder().encode(JSON.stringify({events:J})),$=await Y3(z);return $?{bytes:$,compressed:!0}:{bytes:z,compressed:!1}}var K3=3,Y6=2,G3=9;function K6(J){return J.type===K3&&J.data?.source===G3}function U3(J){return J.some(K6)||J.some((z)=>z.type===Y6&&G6(z.data.node))}function G6(J){if(!J)return!1;if(J.attributes&&"rr_dataURL"in J.attributes)return!0;return(J.childNodes??[]).some(G6)}function U6(J){if(!J)return;if(J.attributes&&"rr_dataURL"in J.attributes)delete J.attributes.rr_dataURL;for(let z of J.childNodes??[])U6(z)}function q3(J){let z=[];for(let $ of J){if(K6($))continue;if($.type===Y6)U6($.data.node);z.push($)}return z}var H3=new Set([502,503,504]);class H0 extends Error{kind;retryAfter;status;constructor(J,z,$,j){super(J);this.kind=z;this.retryAfter=$;this.status=j;this.name="ReportError"}}function D3(J){let{screenshotDataUrl:z,replay:$,...j}=J;return{dataUri:`data:application/json;base64,${Z1(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function F2(){let J=M().identity;if(!J)return{};try{let z=await J();return z?{authorization:`Bearer ${z}`}:{}}catch{return{}}}async function q6(J,z){let $=M(),j=Q6(z,j6),{context:Q,note:Z}=j,V=[];if(j.screenshotDataUrl){let _=await x1(j.screenshotDataUrl);V.push({dataUri:_,filename:"screenshot.jpg"})}V.push(D3(j));let W,U=t0();if(U){let _=await W6(j.replay,U.maxBytes);if(W=_.summary,"dataUri"in _)V.push({dataUri:_.dataUri,filename:_.filename})}let q=$6(j),C={title:J,description:Z.trim()||void 0,appName:q0().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:q0().name,module:Q.module?.label??""},context:{...q?{signature:q}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:V,...j.reason.fromChat?{fromChat:!0}:{}},F=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await F2()},body:JSON.stringify(C)}).catch(()=>{throw new H0("report never left the browser","offline")});if(!F.ok)throw await B2(F);return await F.json()}async function B2(J){let z=J.headers.get("retry-after"),$=await J.json().then((j)=>j.error).catch(()=>null);if(J.status===429)return new H0("rate limited","rateLimited",z??void 0);if(H3.has(J.status))return new H0("desk unavailable","unavailable");return new H0($??`Report failed (${J.status})`,"rejected",void 0,J.status)}var f1=null,X1=null,H6=()=>M().host.replace(/\/$/,"");function N2(){return f1}function b0(){if(X1)return X1;return X1=(async()=>{try{let J=await fetch(`${H6()}/ingest/request-types`,{headers:{"x-realm-key":M().realmKey}}),z=J.ok?await J.json():null;f1=Array.isArray(z?.types)?z.types.filter(P3):[]}catch{f1=[],X1=null}return f1??[]})(),X1}function P3(J){let z=J;return!!z&&typeof z.id==="string"&&typeof z.name==="string"}async function D6(J){let z=M(),$={};try{$=z.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:J.title,description:J.description.trim()||void 0,ticketTypeId:J.ticketTypeId,appName:q0().name,category:j?C1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:J.screenshotDataUrl?[{dataUri:await x1(J.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${H6()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await F2()},body:JSON.stringify(Q)}).catch(()=>{throw new H0("request never left the browser","offline")});if(!Z.ok)throw await B2(Z);return await Z.json()}var V1=Math.PI/6;function P6(J,z,$){let j=z.x-J.x,Q=z.y-J.y,Z=Math.hypot(j,Q),V=Math.atan2(Q,j),W=[{x:z.x,y:z.y},{x:z.x-$*Math.cos(V-V1),y:z.y-$*Math.sin(V-V1)},{x:z.x-$*Math.cos(V+V1),y:z.y-$*Math.sin(V+V1)}],U=$*Math.cos(V1)*0.92;if(Z<=U)return{shaft:null,head:W};return{shaft:{from:J,to:{x:z.x-U*Math.cos(V),y:z.y-U*Math.sin(V)}},head:W}}var _2="#f44336",M3="rgba(250, 204, 21, 0.4)",I2=22,M6="#2563eb",F6=9,B6=11,N6=18,_6=4,w1=8,F3=[{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 I6(J,z,$){let j=[],Q=null,Z=-1,V=null,W=null,U=J.getContext("2d");function q(){let X=J.getBoundingClientRect().width;return X>0?J.width/X:1}function C(X){let Y=J.getBoundingClientRect();return{x:(X.clientX-Y.left)/Y.width*J.width,y:(X.clientY-Y.top)/Y.height*J.height}}function F(X){let Y=X.size??I2;if(!U)return(X.text?.length??0)*Y*0.6;U.save(),U.font=`600 ${Y}px system-ui, sans-serif`;let G=U.measureText(X.text??"").width;return U.restore(),G}function _(X){if(X.tool==="text"){let Y=X.size??I2;return{left:X.x1,top:X.y1,right:X.x1+F(X),bottom:X.y1+Y*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function x(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let Y=_(X);if(X.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return F3.map((G)=>({id:G.id,x:Y.left+(Y.right-Y.left)*G.fx,y:Y.top+(Y.bottom-Y.top)*G.fy,cursor:G.cursor}))}function A(X){let Y=_(X);return{x:Y.right+N6*q(),y:Y.top-N6*q()}}function h(X,Y,G){let{shaft:K,head:H}=P6({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*G));if(K)X.lineCap="butt",X.beginPath(),X.moveTo(K.from.x,K.from.y),X.lineTo(K.to.x,K.to.y),X.stroke();X.beginPath(),X.moveTo(H[0].x,H[0].y),X.lineTo(H[1].x,H[1].y),X.lineTo(H[2].x,H[2].y),X.closePath(),X.fill()}function r(X,Y,G){X.save(),X.lineWidth=Math.max(2,3*G),X.strokeStyle=_2,X.fillStyle=_2;let K=_(Y);if(Y.tool==="rect")X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="arrow")h(X,Y,G);else if(Y.tool==="highlight")X.fillStyle=M3,X.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="text"&&Y.text){let H=Y.size??I2;X.font=`600 ${H}px system-ui, sans-serif`,X.textBaseline="top";let P=H*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(K.left-P,K.top-P,K.right-K.left+P*2,K.bottom-K.top+P*2),X.fillStyle=_2,X.fillText(Y.text,K.left,K.top)}X.restore()}function f(X,Y,G){let K=_(Y);X.save(),X.strokeStyle=M6,X.lineWidth=Math.max(1,1.5*G),X.setLineDash([6*G,4*G]),X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),X.setLineDash([]);let H=F6*G;for(let i of x(Y))X.fillStyle="#fff",X.strokeStyle=M6,X.lineWidth=Math.max(1,1.5*G),X.beginPath(),X.rect(i.x-H/2,i.y-H/2,H,H),X.fill(),X.stroke();let P=A(Y),O=B6*G;X.beginPath(),X.arc(P.x,P.y,O,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*G),X.beginPath(),X.moveTo(P.x-O*0.4,P.y-O*0.4),X.lineTo(P.x+O*0.4,P.y+O*0.4),X.moveTo(P.x+O*0.4,P.y-O*0.4),X.lineTo(P.x-O*0.4,P.y+O*0.4),X.stroke(),X.restore()}function N(){if(!U)return;let X=q();if(U.clearRect(0,0,J.width,J.height),U.drawImage(z,0,0,J.width,J.height),j.forEach((G,K)=>{if(K!==Q0)r(U,G,X)}),V)r(U,V,X);let Y=j[Z];if(Y&&!V)f(U,Y,X)}function a(X,Y,G,K,H){return Math.abs(X-G)<=H&&Math.abs(Y-K)<=H}function j0(X,Y){let G=j[Z];if(!G)return null;let K=F6*q()/2+3*q();for(let H of x(G))if(a(X,Y,H.x,H.y,K))return H.id;return null}function y(X,Y){let G=j[Z];if(!G)return!1;let K=A(G);return a(X,Y,K.x,K.y,B6*q())}function u(X,Y){let G=6*q();for(let K=j.length-1;K>=0;K-=1){let H=j[K];if(H.tool==="arrow"){let O=H.x2-H.x1,i=H.y2-H.y1,V0=Math.hypot(O,i)||1,D=Math.max(0,Math.min(1,((X-H.x1)*O+(Y-H.y1)*i)/(V0*V0)));if(Math.hypot(X-(H.x1+D*O),Y-(H.y1+D*i))<=G+4*q())return K;continue}let P=_(H);if(X>=P.left-G&&X<=P.right+G&&Y>=P.top-G&&Y<=P.bottom+G)return K}return-1}function E(X,Y,G,K,H){if(Y==="tail"){X.x1=G.x1+K,X.y1=G.y1+H;return}if(Y==="head"){X.x2=G.x2+K,X.y2=G.y2+H;return}if(Y==="size"){let L=(G.size??24)+H;X.size=Math.max(10,L);return}let P=_(G),{left:O,top:i,right:V0,bottom:D}=P;if(Y.includes("w"))O=Math.min(V0-w1,O+K);if(Y.includes("e"))V0=Math.max(O+w1,V0+K);if(Y.includes("n"))i=Math.min(D-w1,i+H);if(Y.includes("s"))D=Math.max(i+w1,D+H);X.x1=O,X.y1=i,X.x2=V0,X.y2=D}function E0(X,Y,G,K){X.x1=Y.x1+G,X.y1=Y.y1+K,X.x2=Y.x2+G,X.y2=Y.y2+K}let k=null,Q0=-1,R={x:0,y:0,size:24};function p(){let X=J.getBoundingClientRect().width;return X>0?X/J.width:1}function N1(X,Y){if(!U)return X.length*Y*0.6;U.save(),U.font=`600 ${Y}px system-ui, sans-serif`;let G=U.measureText(X||" ").width;return U.restore(),G}function f0(){if(!k)return;let X=J.parentElement;if(!X)return;let Y=J.getBoundingClientRect(),G=X.getBoundingClientRect(),K=p(),H=R.size*K;k.style.left=`${Y.left-G.left+R.x*K}px`,k.style.top=`${Y.top-G.top+R.y*K}px`,k.style.fontSize=`${H}px`,k.style.width=`${Math.max(40,N1(k.value,H)+H)}px`}function P0(X){let Y=k;if(!Y)return;k=null;let G=Y.value.trim(),K=Q0;if(Q0=-1,Y.remove(),X&&G){if(K>=0&&j[K])j[K].text=G,Z=K;else j.push({tool:"text",x1:R.x,y1:R.y,x2:R.x,y2:R.y,text:G,size:R.size}),Z=j.length-1;$()}else if(K>=0)Z=K;J.focus(),N()}function U0(X,Y,G=-1){P0(!0);let K=J.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let H=G>=0?j[G]:void 0;Q0=G,R={x:H?.x1??X,y:H?.y1??Y,size:H?.size??Math.round(24*q())};let P=document.createElement("input");P.type="text",P.className="text-edit",P.value=H?.text??"",P.setAttribute("aria-label","ข้อความบนภาพ"),P.placeholder="ข้อความ",k=P,K.append(P),f0(),P.addEventListener("input",f0),P.addEventListener("keydown",(O)=>{if(O.stopPropagation(),O.key==="Enter")P0(!0);else if(O.key==="Escape")P0(!1)}),requestAnimationFrame(()=>{if(k!==P)return;P.focus(),P.select(),P.addEventListener("blur",()=>P0(!0))}),N()}function Z0(X){let{x:Y,y:G}=C(X);if(J.setPointerCapture(X.pointerId),y(Y,G)){X0();return}let K=j0(Y,G);if(K&&j[Z]){W={grip:K,x:Y,y:G,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),J.hasPointerCapture(X.pointerId))J.releasePointerCapture(X.pointerId);Q=null,$(),U0(Y,G);return}if(Q){V={tool:Q,x1:Y,y1:G,x2:Y,y2:G},Z=-1;return}let H=u(Y,G);Z=H,W=H>=0?{grip:"body",x:Y,y:G,start:{...j[H]}}:null,N()}function w0(X){let{x:Y,y:G}=C(X);if(V){V.x2=Y,V.y2=G,N();return}if(W){let H=j[Z];if(!H)return;let P=Y-W.x,O=G-W.y;if(W.grip==="body")E0(H,W.start,P,O);else E(H,W.grip,W.start,P,O);N();return}if(Q){J.style.cursor="crosshair";return}if(y(Y,G)){J.style.cursor="pointer";return}let K=j0(Y,G);if(K){let H=j[Z]?x(j[Z]).find((P)=>P.id===K):null;J.style.cursor=H?.cursor??"pointer";return}J.style.cursor=u(Y,G)>=0?"move":"default"}function R0(){if(V){if(!(Math.abs(V.x2-V.x1)<_6&&Math.abs(V.y2-V.y1)<_6))j.push(V),Z=j.length-1,Q=null,$();V=null}if(W)W=null,$();N()}function M0(X){let Y=J.getBoundingClientRect(),G=(X.clientX-Y.left)/Y.width*J.width,K=(X.clientY-Y.top)/Y.height*J.height,H=u(G,K),P=j[H];if(!P||P.tool!=="text")return;X.preventDefault(),U0(P.x1,P.y1,H)}function F0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),X0();else if(X.key==="Escape")X.preventDefault(),Z=-1,N()}function X0(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),N()}return J.addEventListener("pointerdown",Z0),J.addEventListener("pointermove",w0),J.addEventListener("pointerup",R0),J.addEventListener("pointercancel",R0),J.addEventListener("dblclick",M0),J.tabIndex=0,J.addEventListener("keydown",F0),N(),{setTool(X){Q=X,Z=-1,J.style.cursor=X?"crosshair":"default",N()},deleteSelected:X0,clear(){j.length=0,Z=-1,$(),N()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=z.naturalWidth,X.height=z.naturalHeight;let Y=X.getContext("2d");if(!Y)return J.toDataURL("image/png");Y.drawImage(z,0,0);let G=q();for(let K of j)r(Y,K,G);return X.toDataURL("image/png")},destroy(){P0(!1),J.removeEventListener("pointerdown",Z0),J.removeEventListener("pointermove",w0),J.removeEventListener("pointerup",R0),J.removeEventListener("pointercancel",R0),J.removeEventListener("dblclick",M0),J.removeEventListener("keydown",F0)}}}var B3=["keydown","keyup","keypress"];function u0(J){for(let z of B3)J.addEventListener(z,($)=>$.stopPropagation())}var C6=`
33
+ `,M2=null;function p3(){if(typeof document>"u")return null;if(M2?.isConnected)return M2;let J=document.createElement(h3);J.dataset.debugReporter="true";let z=J.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=u3;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),z.append($,j),document.body.append(J),M2=j,j}function h0(J,z="success",$){let j=O1()?M().toast:void 0;if(j){j({message:J,tone:z,...$?{action:$}:{}});return}let Q=p3();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=z;let V=document.createElement("span");V.className="dot";let W=document.createElement("span");W.textContent=J;let q=document.createElement("button");q.type="button",q.className="close",q.textContent="✕",q.setAttribute("aria-label","ปิด");let U=()=>{window.clearTimeout(C),Z.remove()};q.addEventListener("click",U);let C=z==="error"||$?0:window.setTimeout(U,b3);if(Z.append(V,W),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{U(),$.onClick()}),Z.append(B)}Z.append(q),Q.append(Z)}function $6(J,z,$){let j=J.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=z.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function i3(){let J={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return J;let z=performance.memory;if(z)J.memoryUsedMb=Math.round(z.usedJSHeapSize/1024/1024),J.memoryLimitMb=Math.round(z.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)J.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),J.loadEventMs=Math.round($.loadEventEnd);return J}function B2(J,z){if(!J)return z;try{return J()}catch{return z}}function j6(){let J=M(),{pathname:z,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:z,search:$},module:L1(z),user:B2(J.user,{}),apiHeaders:z1(B2(J.headers,{})),app:{name:U0().name,version:U0().version,environment:U0().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:i3(),extra:B2(J.extra,{})}}var d3=2;function k1(J){let z=s4(),$=A4();return{context:j6(),reason:J.reason,note:J.note,cause:$6(z,$,J.erroredQueries),actionTrail:C4(),network:z,console:$,screenshotDataUrl:J.screenshotDataUrl,screenshotMethod:J.screenshotMethod,replay:z6()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:d3}}}async function F2(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await c3();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let z=await n3();if(z)return{dataUrl:z,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function c3(){let J=null;try{let z={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};J=await navigator.mediaDevices.getDisplayMedia(z);let $=await l3(J);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(z){if(z instanceof DOMException&&(z.name==="NotAllowedError"||z.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{J?.getTracks().forEach((z)=>z.stop())}}async function l3(J){let z=document.createElement("video");z.srcObject=J,z.muted=!0,z.playsInline=!0,await new Promise((V)=>{let W=!1,q=()=>{if(W)return;W=!0,V()};z.onloadedmetadata=()=>{z.play().then(q).catch(q)},window.setTimeout(q,1500)}),await r3(z);let{videoWidth:$,videoHeight:j}=z;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(z,0,0,$,j),z.pause(),z.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function r3(J){return new Promise((z)=>{let $=!1,j=()=>{if($)return;$=!0,z()},Q=J;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function n3(){let J=M().screenshotFallback;if(!J)return null;let z=await J().catch(()=>null);if(!z)return null;try{return await z(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var o3=2000,s3=0.82,a3=3000000;function t3(J){return new Promise((z,$)=>{let j=new Image;j.onload=()=>z(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=J})}async function f1(J){try{let z=await t3(J),$=Math.max(z.naturalWidth,z.naturalHeight),j=Math.min(1,o3/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(z.naturalWidth*j)),Q.height=Math.max(1,Math.round(z.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return J;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(z,0,0,Q.width,Q.height);let V=s3,W=Q.toDataURL("image/jpeg",V);while(W.length>a3&&V>0.4)V-=0.15,W=Q.toDataURL("image/jpeg",V);return W}catch{return J}}var e3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,J5=/^\d+$/,z5=/^[0-9a-f]{16,}$/i;function Q6(J){if(J.reason.type==="manual")return null;let z=J.cause?.failedRequests?.[0];if(!z?.url)return null;let $;try{$=new URL(z.url,"http://x").pathname}catch{$=z.url}let j=$.split("/").map((Z)=>e3.test(Z)||J5.test(Z)||z5.test(Z)?":id":Z).join("/"),Q=z.status??(z.error?"ERR":"?");return`${z.method??"REQ"} ${j} ${Q}`}var Z6=2000000;function w1(J){let{screenshotDataUrl:z,replay:$,...j}=J;return JSON.stringify(j).length}function X6(J,z=2000000){if(w1(J)<=z)return J;let $=J.network.map((Q)=>({...Q})),j={...J,network:$};for(let Q of $){if(w1(j)<=z)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&w1(j)>z)j.network=j.network.slice(1);while(j.console.length>1&&w1(j)>z)j.console=j.console.slice(1);return j}function Z1(J){let z="";for(let $=0;$<J.length;$+=32768)z+=String.fromCharCode(...J.subarray($,$+32768));return btoa(z)}var $5=4,j5=2,Q5=3,Z5=0,X5=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),V5=/^\s*javascript:/i;function W5(J,z){let $=J.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof z==="string"&&V5.test(z)}function V6(J,z=!1){if(!J)return;for(let $ of Object.keys(J)){let j=J[$];if(W5($,j)){if(z)J[$]=null;else delete J[$];continue}if(typeof j!=="string"||!X5.has($)||!j.includes("?"))continue;J[$]=N0(j)}}function N2(J){if(!J)return;V6(J.attributes);for(let z of J.childNodes??[])N2(z)}function W6(J){let z=JSON.parse(JSON.stringify(J));for(let $ of z){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===$5&&typeof j.href==="string")j.href=N0(j.href);else if($.type===j5)N2(j.node);else if($.type===Q5&&j.source===Z5){for(let Q of j.adds??[])N2(Q.node);for(let Q of j.attributes??[])V6(Q.attributes,!0)}}return z}var Y5="session-replay.json.gz",K5="session-replay.json";function G5(J){return Boolean(J&&J.events.length>0)}async function q5(J){if(typeof CompressionStream>"u")return null;try{let z=new Blob([J]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(z).arrayBuffer())}catch{return null}}async function K6(J,z){if(!G5(J))return{summary:{omitted:"empty"}};let j={seconds:Math.round(J.durationMs/1000),events:J.events.length,startedAt:J.startedAt,endedAt:J.endedAt},Q=W6(J.events),Z=await Y6(Q),V=!1;if(Z.bytes.byteLength>z&&D5(Q))Q=P5(Q),Z=await Y6(Q),V=!0;let{bytes:W,compressed:q}=Z;if(W.byteLength>z)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${q?"application/gzip":"application/json"};base64,${Z1(W)}`,filename:q?Y5:K5,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:q,...V?{canvasDropped:V}:{}}}}async function Y6(J){let z=new TextEncoder().encode(JSON.stringify({events:J})),$=await q5(z);return $?{bytes:$,compressed:!0}:{bytes:z,compressed:!1}}var U5=3,G6=2,H5=9;function q6(J){return J.type===U5&&J.data?.source===H5}function D5(J){return J.some(q6)||J.some((z)=>z.type===G6&&U6(z.data.node))}function U6(J){if(!J)return!1;if(J.attributes&&"rr_dataURL"in J.attributes)return!0;return(J.childNodes??[]).some(U6)}function H6(J){if(!J)return;if(J.attributes&&"rr_dataURL"in J.attributes)delete J.attributes.rr_dataURL;for(let z of J.childNodes??[])H6(z)}function P5(J){let z=[];for(let $ of J){if(q6($))continue;if($.type===G6)H6($.data.node);z.push($)}return z}var M5=new Set([502,503,504]);class H0 extends Error{kind;retryAfter;status;constructor(J,z,$,j){super(J);this.kind=z;this.retryAfter=$;this.status=j;this.name="ReportError"}}function B5(J){let{screenshotDataUrl:z,replay:$,...j}=J;return{dataUri:`data:application/json;base64,${Z1(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function _2(){let J=M().identity;if(!J)return{};try{let z=await J();return z?{authorization:`Bearer ${z}`}:{}}catch{return{}}}async function D6(J,z){let $=M(),j=X6(z,Z6),{context:Q,note:Z}=j,V=[];if(j.screenshotDataUrl){let _=await f1(j.screenshotDataUrl);V.push({dataUri:_,filename:"screenshot.jpg"})}V.push(B5(j));let W,q=t0();if(q){let _=await K6(j.replay,q.maxBytes);if(W=_.summary,"dataUri"in _)V.push({dataUri:_.dataUri,filename:_.filename})}let U=Q6(j),C={title:J,description:Z.trim()||void 0,appName:U0().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:U0().name,module:Q.module?.label??""},context:{...U?{signature:U}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:V,...j.reason.fromChat?{fromChat:!0}:{}},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await _2()},body:JSON.stringify(C)}).catch(()=>{throw new H0("report never left the browser","offline")});if(!B.ok)throw await I2(B);return await B.json()}async function I2(J){let z=J.headers.get("retry-after"),$=await J.json().then((j)=>j.error).catch(()=>null);if(J.status===429)return new H0("rate limited","rateLimited",z??void 0);if(M5.has(J.status))return new H0("desk unavailable","unavailable");return new H0($??`Report failed (${J.status})`,"rejected",void 0,J.status)}var y1=null,X1=null,P6=()=>M().host.replace(/\/$/,"");function C2(){return y1}function b0(){if(X1)return X1;return X1=(async()=>{try{let J=await fetch(`${P6()}/ingest/request-types`,{headers:{"x-realm-key":M().realmKey}}),z=J.ok?await J.json():null;y1=Array.isArray(z?.types)?z.types.filter(F5):[]}catch{y1=[],X1=null}return y1??[]})(),X1}function F5(J){let z=J;return!!z&&typeof z.id==="string"&&typeof z.name==="string"}async function M6(J){let z=M(),$={};try{$=z.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:J.title,description:J.description.trim()||void 0,ticketTypeId:J.ticketTypeId,appName:U0().name,category:j?L1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:J.screenshotDataUrl?[{dataUri:await f1(J.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${P6()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await _2()},body:JSON.stringify(Q)}).catch(()=>{throw new H0("request never left the browser","offline")});if(!Z.ok)throw await I2(Z);return await Z.json()}var V1=Math.PI/6;function B6(J,z,$){let j=z.x-J.x,Q=z.y-J.y,Z=Math.hypot(j,Q),V=Math.atan2(Q,j),W=[{x:z.x,y:z.y},{x:z.x-$*Math.cos(V-V1),y:z.y-$*Math.sin(V-V1)},{x:z.x-$*Math.cos(V+V1),y:z.y-$*Math.sin(V+V1)}],q=$*Math.cos(V1)*0.92;if(Z<=q)return{shaft:null,head:W};return{shaft:{from:J,to:{x:z.x-q*Math.cos(V),y:z.y-q*Math.sin(V)}},head:W}}var O2="#f44336",N5="rgba(250, 204, 21, 0.4)",L2=22,F6="#2563eb",N6=9,_6=11,I6=18,C6=4,v1=8,_5=[{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 O6(J,z,$){let j=[],Q=null,Z=-1,V=null,W=null,q=J.getContext("2d");function U(){let X=J.getBoundingClientRect().width;return X>0?J.width/X:1}function C(X){let Y=J.getBoundingClientRect();return{x:(X.clientX-Y.left)/Y.width*J.width,y:(X.clientY-Y.top)/Y.height*J.height}}function B(X){let Y=X.size??L2;if(!q)return(X.text?.length??0)*Y*0.6;q.save(),q.font=`600 ${Y}px system-ui, sans-serif`;let G=q.measureText(X.text??"").width;return q.restore(),G}function _(X){if(X.tool==="text"){let Y=X.size??L2;return{left:X.x1,top:X.y1,right:X.x1+B(X),bottom:X.y1+Y*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function E(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let Y=_(X);if(X.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return _5.map((G)=>({id:G.id,x:Y.left+(Y.right-Y.left)*G.fx,y:Y.top+(Y.bottom-Y.top)*G.fy,cursor:G.cursor}))}function A(X){let Y=_(X);return{x:Y.right+I6*U(),y:Y.top-I6*U()}}function m(X,Y,G){let{shaft:K,head:H}=B6({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*G));if(K)X.lineCap="butt",X.beginPath(),X.moveTo(K.from.x,K.from.y),X.lineTo(K.to.x,K.to.y),X.stroke();X.beginPath(),X.moveTo(H[0].x,H[0].y),X.lineTo(H[1].x,H[1].y),X.lineTo(H[2].x,H[2].y),X.closePath(),X.fill()}function o(X,Y,G){X.save(),X.lineWidth=Math.max(2,3*G),X.strokeStyle=O2,X.fillStyle=O2;let K=_(Y);if(Y.tool==="rect")X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="arrow")m(X,Y,G);else if(Y.tool==="highlight")X.fillStyle=N5,X.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="text"&&Y.text){let H=Y.size??L2;X.font=`600 ${H}px system-ui, sans-serif`,X.textBaseline="top";let P=H*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(K.left-P,K.top-P,K.right-K.left+P*2,K.bottom-K.top+P*2),X.fillStyle=O2,X.fillText(Y.text,K.left,K.top)}X.restore()}function f(X,Y,G){let K=_(Y);X.save(),X.strokeStyle=F6,X.lineWidth=Math.max(1,1.5*G),X.setLineDash([6*G,4*G]),X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),X.setLineDash([]);let H=N6*G;for(let i of E(Y))X.fillStyle="#fff",X.strokeStyle=F6,X.lineWidth=Math.max(1,1.5*G),X.beginPath(),X.rect(i.x-H/2,i.y-H/2,H,H),X.fill(),X.stroke();let P=A(Y),O=_6*G;X.beginPath(),X.arc(P.x,P.y,O,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*G),X.beginPath(),X.moveTo(P.x-O*0.4,P.y-O*0.4),X.lineTo(P.x+O*0.4,P.y+O*0.4),X.moveTo(P.x+O*0.4,P.y-O*0.4),X.lineTo(P.x-O*0.4,P.y+O*0.4),X.stroke(),X.restore()}function N(){if(!q)return;let X=U();if(q.clearRect(0,0,J.width,J.height),q.drawImage(z,0,0,J.width,J.height),j.forEach((G,K)=>{if(K!==Z0)o(q,G,X)}),V)o(q,V,X);let Y=j[Z];if(Y&&!V)f(q,Y,X)}function t(X,Y,G,K,H){return Math.abs(X-G)<=H&&Math.abs(Y-K)<=H}function Q0(X,Y){let G=j[Z];if(!G)return null;let K=N6*U()/2+3*U();for(let H of E(G))if(t(X,Y,H.x,H.y,K))return H.id;return null}function y(X,Y){let G=j[Z];if(!G)return!1;let K=A(G);return t(X,Y,K.x,K.y,_6*U())}function u(X,Y){let G=6*U();for(let K=j.length-1;K>=0;K-=1){let H=j[K];if(H.tool==="arrow"){let O=H.x2-H.x1,i=H.y2-H.y1,W0=Math.hypot(O,i)||1,D=Math.max(0,Math.min(1,((X-H.x1)*O+(Y-H.y1)*i)/(W0*W0)));if(Math.hypot(X-(H.x1+D*O),Y-(H.y1+D*i))<=G+4*U())return K;continue}let P=_(H);if(X>=P.left-G&&X<=P.right+G&&Y>=P.top-G&&Y<=P.bottom+G)return K}return-1}function k(X,Y,G,K,H){if(Y==="tail"){X.x1=G.x1+K,X.y1=G.y1+H;return}if(Y==="head"){X.x2=G.x2+K,X.y2=G.y2+H;return}if(Y==="size"){let L=(G.size??24)+H;X.size=Math.max(10,L);return}let P=_(G),{left:O,top:i,right:W0,bottom:D}=P;if(Y.includes("w"))O=Math.min(W0-v1,O+K);if(Y.includes("e"))W0=Math.max(O+v1,W0+K);if(Y.includes("n"))i=Math.min(D-v1,i+H);if(Y.includes("s"))D=Math.max(i+v1,D+H);X.x1=O,X.y1=i,X.x2=W0,X.y2=D}function k0(X,Y,G,K){X.x1=Y.x1+G,X.y1=Y.y1+K,X.x2=Y.x2+G,X.y2=Y.y2+K}let x=null,Z0=-1,T={x:0,y:0,size:24};function p(){let X=J.getBoundingClientRect().width;return X>0?X/J.width:1}function I1(X,Y){if(!q)return X.length*Y*0.6;q.save(),q.font=`600 ${Y}px system-ui, sans-serif`;let G=q.measureText(X||" ").width;return q.restore(),G}function f0(){if(!x)return;let X=J.parentElement;if(!X)return;let Y=J.getBoundingClientRect(),G=X.getBoundingClientRect(),K=p(),H=T.size*K;x.style.left=`${Y.left-G.left+T.x*K}px`,x.style.top=`${Y.top-G.top+T.y*K}px`,x.style.fontSize=`${H}px`,x.style.width=`${Math.max(40,I1(x.value,H)+H)}px`}function P0(X){let Y=x;if(!Y)return;x=null;let G=Y.value.trim(),K=Z0;if(Z0=-1,Y.remove(),X&&G){if(K>=0&&j[K])j[K].text=G,Z=K;else j.push({tool:"text",x1:T.x,y1:T.y,x2:T.x,y2:T.y,text:G,size:T.size}),Z=j.length-1;$()}else if(K>=0)Z=K;J.focus(),N()}function q0(X,Y,G=-1){P0(!0);let K=J.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let H=G>=0?j[G]:void 0;Z0=G,T={x:H?.x1??X,y:H?.y1??Y,size:H?.size??Math.round(24*U())};let P=document.createElement("input");P.type="text",P.className="text-edit",P.value=H?.text??"",P.setAttribute("aria-label","ข้อความบนภาพ"),P.placeholder="ข้อความ",x=P,K.append(P),f0(),P.addEventListener("input",f0),P.addEventListener("keydown",(O)=>{if(O.stopPropagation(),O.key==="Enter")P0(!0);else if(O.key==="Escape")P0(!1)}),requestAnimationFrame(()=>{if(x!==P)return;P.focus(),P.select(),P.addEventListener("blur",()=>P0(!0))}),N()}function X0(X){let{x:Y,y:G}=C(X);if(J.setPointerCapture(X.pointerId),y(Y,G)){V0();return}let K=Q0(Y,G);if(K&&j[Z]){W={grip:K,x:Y,y:G,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),J.hasPointerCapture(X.pointerId))J.releasePointerCapture(X.pointerId);Q=null,$(),q0(Y,G);return}if(Q){V={tool:Q,x1:Y,y1:G,x2:Y,y2:G},Z=-1;return}let H=u(Y,G);Z=H,W=H>=0?{grip:"body",x:Y,y:G,start:{...j[H]}}:null,N()}function w0(X){let{x:Y,y:G}=C(X);if(V){V.x2=Y,V.y2=G,N();return}if(W){let H=j[Z];if(!H)return;let P=Y-W.x,O=G-W.y;if(W.grip==="body")k0(H,W.start,P,O);else k(H,W.grip,W.start,P,O);N();return}if(Q){J.style.cursor="crosshair";return}if(y(Y,G)){J.style.cursor="pointer";return}let K=Q0(Y,G);if(K){let H=j[Z]?E(j[Z]).find((P)=>P.id===K):null;J.style.cursor=H?.cursor??"pointer";return}J.style.cursor=u(Y,G)>=0?"move":"default"}function R0(){if(V){if(!(Math.abs(V.x2-V.x1)<C6&&Math.abs(V.y2-V.y1)<C6))j.push(V),Z=j.length-1,Q=null,$();V=null}if(W)W=null,$();N()}function M0(X){let Y=J.getBoundingClientRect(),G=(X.clientX-Y.left)/Y.width*J.width,K=(X.clientY-Y.top)/Y.height*J.height,H=u(G,K),P=j[H];if(!P||P.tool!=="text")return;X.preventDefault(),q0(P.x1,P.y1,H)}function B0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),V0();else if(X.key==="Escape")X.preventDefault(),Z=-1,N()}function V0(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),N()}return J.addEventListener("pointerdown",X0),J.addEventListener("pointermove",w0),J.addEventListener("pointerup",R0),J.addEventListener("pointercancel",R0),J.addEventListener("dblclick",M0),J.tabIndex=0,J.addEventListener("keydown",B0),N(),{setTool(X){Q=X,Z=-1,J.style.cursor=X?"crosshair":"default",N()},deleteSelected:V0,clear(){j.length=0,Z=-1,$(),N()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=z.naturalWidth,X.height=z.naturalHeight;let Y=X.getContext("2d");if(!Y)return J.toDataURL("image/png");Y.drawImage(z,0,0);let G=U();for(let K of j)o(Y,K,G);return X.toDataURL("image/png")},destroy(){P0(!1),J.removeEventListener("pointerdown",X0),J.removeEventListener("pointermove",w0),J.removeEventListener("pointerup",R0),J.removeEventListener("pointercancel",R0),J.removeEventListener("dblclick",M0),J.removeEventListener("keydown",B0)}}}var I5=["keydown","keyup","keypress"];function u0(J){for(let z of I5)J.addEventListener(z,($)=>$.stopPropagation())}var L6=`
34
34
  :host { all: initial; }
35
35
  * { box-sizing: border-box; }
36
36
 
@@ -181,7 +181,7 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
181
181
  .shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
182
182
  .dropped { opacity: 0.35; pointer-events: none; }
183
183
  .draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
184
- `;var W1="lw-debug-reporter",_0=null;function N3(J,z){if(J instanceof H0){if(J.kind==="offline")return z.failedOffline;if(J.kind==="unavailable")return z.failedUnavailable;if(J.kind==="rateLimited")return z.failedTooMany.replace("{seconds}",J.retryAfter??"60");return J.message||z.failed}return z.failed}var _3=()=>[];var I3=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function C3(){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"}),u0(this.root),this.root.addEventListener("keydown",(z)=>{let $=z;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=E4((z)=>void this.open(z))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(z){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=c(M().locale),Q=N2();if(Q===null)b0();if(z.type==="manual"&&Q?.length){this.renderChooser(j,z);return}await this.report(z,j)}renderChooser(z,$){let j=this.shell(z);j.classList.add("narrow"),j.setAttribute("aria-label",z.chooseTitle);let Q=I("div","head"),Z=e("✕","icon");Z.setAttribute("aria-label",z.close),Z.addEventListener("click",()=>this.close()),Q.append(I("h2","",z.chooseTitle),Z);let V=R6("problem",L3,z.kindProblem,z.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,z)});let W=R6("request",L6,z.kindRequest,z.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=k1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:C2()}),this.renderForm(z,$,"request")});let U=I("div","kinds choose");U.append(V,W),U.addEventListener("keydown",(q)=>{if(!O6.includes(q.key))return;q.preventDefault(),(this.root.activeElement===V?W:V).focus()}),j.append(Q,U),V.focus()}async switchToReport(z,$,j){this.root.replaceChildren();let Q=await P2();if(Q.method==="cancelled"){this.renderForm(z,$,"request",{...j,asking:!0});return}this.bundle=k1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:C2()}),this.renderForm(z,$,"problem",j)}async report(z,$){let j=await P2();if(j.method==="cancelled"){this.close();return}this.bundle=k1({reason:z,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:C2()}),this.renderForm($,z,"problem")}close(z=!1){if(z)_0=null;else if(this.keep)_0=this.keep()??_0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(z){let $=document.createElement("style");$.textContent=C6;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",z.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(z,$){let j=this.shell(z),Q=I("div","head");Q.append(I("h2","",z.title)),j.append(Q,I("p","status",$))}renderForm(z,$,j,Q){let Z=this.bundle;if(!Z)return;let V=this.shell(z),W=j,U=j==="problem"||!!Z.screenshotDataUrl,q=null,C=I("div","head"),F=I("h2","",z.title),_=e("✕","icon");_.setAttribute("aria-label",z.close),_.addEventListener("click",()=>this.close()),C.append(F,_);let x=I("p","door");x.hidden=!0;let A=I("span"),h=e("","link");h.dataset.switchKind="",h.addEventListener("click",()=>Y(W==="problem"?"request":"problem")),x.append(A,h);let r=I("div","ask");r.hidden=!0;let f=document.createElement("input");f.type="search",f.className="type-search",f.placeholder=z.requestTypeSearch,f.setAttribute("aria-label",z.requestTypeSearch),f.dataset.requestTypeSearch="",f.hidden=!0;let N=I("div","types");N.setAttribute("role","radiogroup"),N.setAttribute("aria-label",z.requestTypeLabel);let a=I("p","status",z.requestTypeNone);a.hidden=!0;let j0=I("p","status type-count","");j0.hidden=!0,r.append(y1(z.requestTypeLabel,"",!0),f,N,a,j0);let y=[],u=()=>{for(let L of y){let B=L.dataset.requestType===q?.id;L.setAttribute("aria-checked",String(B)),L.tabIndex=B?0:-1}let D=y.find((L)=>L.dataset.requestType===q?.id);if(D&&N.scrollHeight>N.clientHeight){let L=D.offsetTop-N.offsetTop;if(L<N.scrollTop)N.scrollTop=L;else if(L+D.offsetHeight>N.scrollTop+N.clientHeight)N.scrollTop=L+D.offsetHeight-N.clientHeight}},E=document.createElement("input");E.type="text";let E0=y1(""),k=document.createElement("textarea"),Q0=y1(""),R=I("div","meta"),{context:p}=Z,N1=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${z.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,f0=(D,L)=>{let B=document.createElement("div"),S=document.createElement("b");S.textContent=`${D}: `;let g=document.createTextNode(L);return B.append(S,g),R.append(B),{b:S,v:g}};f0(z.reporter,`${p.user.fullName??"—"} (${p.user.email??"—"})`),f0(z.page,p.route.href);let P0=f0(z.captured,N1),U0=document.createElement("label");U0.className="shot-choice",U0.hidden=!0;let Z0=document.createElement("input");Z0.type="checkbox",Z0.checked=!0,Z0.dataset.requestShot="",U0.append(Z0,document.createTextNode(` ${z.requestWithShot}`));let w0=Z.screenshotDataUrl?this.screenshotSection(z,Z.screenshotDataUrl):[I("p","status",z.noScreenshot)],R0=Z.screenshotDataUrl?w0[0]:null;if(!Z.screenshotDataUrl)U0.replaceChildren();let M0=I("p","status",""),F0=e(z.submit,"primary"),X0=()=>{F0.disabled=E.value.trim().length===0||W==="request"&&!q};E.addEventListener("input",X0);let X=()=>{let D=W==="request";if(F.textContent=D?z.requestTitle:z.title,V.setAttribute("aria-label",D?z.requestTitle:z.title),A.textContent=`${D?z.problemInstead:z.askInstead} `,h.textContent=D?U?z.problemInsteadAction:z.problemInsteadShare:z.askInsteadAction,r.hidden=!D,g1(E0,D?z.requestSummaryLabel:z.summaryLabel,D?"":z.summaryRequired,!0),E.placeholder=D?z.requestSummaryPlaceholder:z.summaryPlaceholder,g1(Q0,D?z.requestDetailLabel:z.detailLabel),k.placeholder=D?z.requestDetailPlaceholder:z.detailPlaceholder,P0.b.textContent=`${D?z.requestLeaves:z.captured}: `,P0.v.textContent=D?z.requestLeavesWhat:N1,U0.hidden=!D||!Z.screenshotDataUrl,R0)g1(R0,D?z.requestAnnotateHint:z.annotateHint);for(let L of w0)L.classList.toggle("dropped",D&&!Z0.checked),L.hidden=D&&!Z.screenshotDataUrl;F0.textContent=D?z.requestSubmit:z.submit,X0()};Z0.addEventListener("change",X);let Y=(D)=>{if(D===W)return;if(D==="problem"&&!U){this.switchToReport(z,$,{title:E.value,detail:k.value,asking:!1,typeId:q?.id??null});return}W=D,X()},G=(D)=>{if(this.bundle!==Z||$.type!=="manual"||!D.length)return;q=D[0],y.length=0;for(let B of D){let S=e("","type");S.setAttribute("role","radio"),S.dataset.requestType=B.id;let g=I("span","type-body");if(g.append(I("b","",B.name)),B.description)g.append(I("span","type-hint",B.description));if(B.targetHours){let y0=I("span","type-due");y0.append(v1(S3),document.createTextNode(z.requestTarget.replace("{time}",O3(z,B.targetHours)))),g.append(y0)}S.append(v1(L6),g),S.addEventListener("click",()=>{q=B,u(),X0()}),y.push(S)}N.replaceChildren(...y),N.onkeydown=(B)=>{if(!O6.includes(B.key)||!q)return;B.preventDefault();let S=D.filter((T0,C8)=>!y[C8].hidden);if(!S.length)return;let g=S.findIndex((T0)=>T0.id===q.id),y0=B.key==="ArrowUp"||B.key==="ArrowLeft"?-1:1;q=S[g<0?0:(g+y0+S.length)%S.length],u(),y.find((T0)=>T0.dataset.requestType===q.id)?.focus()},N.classList.toggle("long",D.length>=O2),f.hidden=D.length<O2;let L=(B)=>{j0.hidden=D.length<O2||B===0,j0.textContent=z.requestTypeCount.replace("{n}",String(B))};L(D.length),f.oninput=()=>{let B=f.value.trim().toLowerCase(),S=null;if(D.forEach((g,y0)=>{let T0=!B||`${g.name} ${g.description}`.toLowerCase().includes(B);if(y[y0].hidden=!T0,T0&&!S)S=g}),a.hidden=!!S,L(y.filter((g)=>!g.hidden).length),S&&q&&y[D.indexOf(q)].hidden)q=S;u(),X0()},f.onkeydown=(B)=>{if(B.key==="ArrowDown"||B.key==="Enter")B.preventDefault(),y.find((S)=>S.dataset.requestType===q?.id&&!S.hidden)?.focus()},u(),x.hidden=!1,X()},K=Q??(_0&&(_0.title||_0.detail)?_0:null),H=I("p","draft");if(H.hidden=!K||!!Q,K){E.value=K.title,k.value=K.detail;let D=e(z.draftClear,"link");D.dataset.draftClear="",D.addEventListener("click",()=>{E.value="",k.value="",_0=null,H.hidden=!0,X0(),E.focus()}),H.append(document.createTextNode(`${z.draftRestored} · `),D)}let P=N2(),O=(D)=>{if(G(D),W!=="request"||x.hidden||!K?.typeId)return;let L=D.find((B)=>B.id===K.typeId);if(L)q=L,u()};if(P)O(P);else if($.type==="manual")b0().then(O);this.keep=()=>({title:E.value,detail:k.value,asking:W==="request",typeId:q?.id??null}),V.append(C,x,H,r,E0,E,Q0,k,R,U0,...w0);let i=I("div","foot"),V0=e(z.close);V0.addEventListener("click",()=>this.close()),i.append(V0,M0,I("span","grow"),F0),V.append(i),X(),F0.addEventListener("click",async()=>{F0.disabled=!0,M0.dataset.tone="",M0.textContent=z.submitting;let D=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&q){let S=await D6({ticketTypeId:q.id,title:E.value.trim(),description:k.value,screenshotDataUrl:Z0.checked?D():null}),g=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:S,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),g)m0(`${z.requestSubmitted} — #${S.number}`,"success");return}let L=await q6(E.value.trim(),{...Z,note:k.value,screenshotDataUrl:D()}),B=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:L,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),B)m0(`${z.submitted} — #${L.number}`,"success")}catch(L){let B=N3(L,z);M0.dataset.tone="error",M0.textContent=B,m0(B,"error"),X0()}}),E.focus()}screenshotSection(z,$){let j=y1(z.annotateHint),Q=I("div","tools"),Z=document.createElement("canvas"),V=I("div","shot");V.append(Z);let W=[],U=(_)=>{for(let x of W)x.setAttribute("aria-pressed",String(x===_))};for(let{tool:_,key:x}of I3){let A=e(z[x]);A.setAttribute("aria-pressed","false"),A.addEventListener("click",()=>{let h=A.getAttribute("aria-pressed")==="true";U(h?null:A),this.annotator?.setTool(h?null:_)}),W.push(A),Q.append(A)}Q.append(I("span","sep"));let q=e(z.deleteSelected);q.addEventListener("click",()=>this.annotator?.deleteSelected());let C=e(z.clearAll);C.addEventListener("click",()=>{this.annotator?.clear(),U(null)}),Q.append(q,C);let F=new Image;return F.onload=()=>{Z.width=F.naturalWidth,Z.height=F.naturalHeight,this.annotator=I6(Z,F,()=>{U(null),q.disabled=!this.annotator?.hasSelection()})},F.src=$,[j,Q,I("p","status",z.annotateHelp),V]}}}function C2(){try{return _3()}catch{return[]}}function I(J,z="",$=""){let j=document.createElement(J);if(z)j.className=z;if($)j.textContent=$;return j}function O3(J,z){return z>=24&&z%24===0?J.days.replace("{n}",String(z/24)):J.hours.replace("{n}",String(z))}var O6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],O2=7,L3=[["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"}]],L6=[["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"}]],S3=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],R3=[["path",{d:"M20 6 9 17l-5-5"}]],S6="http://www.w3.org/2000/svg";function R6(J,z,$,j){let Q=e("","kind");Q.dataset.kind=J;let Z=I("span","kind-top");return Z.append(v1(z),I("b","",$)),Q.append(Z,I("span","kind-hint",j),v1(R3,"tick")),Q}function v1(J,z="icon"){let $=document.createElementNS(S6,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:z}))$.setAttribute(j,Q);for(let[j,Q]of J){let Z=document.createElementNS(S6,j);for(let[V,W]of Object.entries(Q))Z.setAttribute(V,W);$.append(Z)}return $}function e(J,z=""){let $=document.createElement("button");if($.type="button",$.textContent=J,z)$.className=z;return $}function y1(J,z="",$=!1){return g1(document.createElement("label"),J,z,$)}function g1(J,z,$="",j=!1){if(J.replaceChildren(document.createTextNode(z)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",J.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,J.append(Q)}return J}function T6(){if(typeof window>"u"||customElements.get(W1))return;customElements.define(W1,C3())}var T3="lw-portal-handoff",A6=138.23,A3=`
184
+ `;var W1="lw-debug-reporter",_0=null;function C5(J,z){if(J instanceof H0){if(J.kind==="offline")return z.failedOffline;if(J.kind==="unavailable")return z.failedUnavailable;if(J.kind==="rateLimited")return z.failedTooMany.replace("{seconds}",J.retryAfter??"60");return J.message||z.failed}return z.failed}var O5=()=>[];var L5=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function S5(){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"}),u0(this.root),this.root.addEventListener("keydown",(z)=>{let $=z;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=w4((z)=>void this.open(z))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(z){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=l(M().locale),Q=C2();if(Q===null)b0();if(z.type==="manual"&&Q?.length){this.renderChooser(j,z);return}await this.report(z,j)}renderChooser(z,$){let j=this.shell(z);j.classList.add("narrow"),j.setAttribute("aria-label",z.chooseTitle);let Q=I("div","head"),Z=J0("✕","icon");Z.setAttribute("aria-label",z.close),Z.addEventListener("click",()=>this.close()),Q.append(I("h2","",z.chooseTitle),Z);let V=A6("problem",T5,z.kindProblem,z.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,z)});let W=A6("request",R6,z.kindRequest,z.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=k1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:S2()}),this.renderForm(z,$,"request")});let q=I("div","kinds choose");q.append(V,W),q.addEventListener("keydown",(U)=>{if(!S6.includes(U.key))return;U.preventDefault(),(this.root.activeElement===V?W:V).focus()}),j.append(Q,q),V.focus()}async switchToReport(z,$,j){this.root.replaceChildren();let Q=await F2();if(Q.method==="cancelled"){this.renderForm(z,$,"request",{...j,asking:!0});return}this.bundle=k1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:S2()}),this.renderForm(z,$,"problem",j)}async report(z,$){let j=await F2();if(j.method==="cancelled"){this.close();return}this.bundle=k1({reason:z,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:S2()}),this.renderForm($,z,"problem")}close(z=!1){if(z)_0=null;else if(this.keep)_0=this.keep()??_0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(z){let $=document.createElement("style");$.textContent=L6;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",z.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(z,$){let j=this.shell(z),Q=I("div","head");Q.append(I("h2","",z.title)),j.append(Q,I("p","status",$))}renderForm(z,$,j,Q){let Z=this.bundle;if(!Z)return;let V=this.shell(z),W=j,q=j==="problem"||!!Z.screenshotDataUrl,U=null,C=I("div","head"),B=I("h2","",z.title),_=J0("✕","icon");_.setAttribute("aria-label",z.close),_.addEventListener("click",()=>this.close()),C.append(B,_);let E=I("p","door");E.hidden=!0;let A=I("span"),m=J0("","link");m.dataset.switchKind="",m.addEventListener("click",()=>Y(W==="problem"?"request":"problem")),E.append(A,m);let o=I("div","ask");o.hidden=!0;let f=document.createElement("input");f.type="search",f.className="type-search",f.placeholder=z.requestTypeSearch,f.setAttribute("aria-label",z.requestTypeSearch),f.dataset.requestTypeSearch="",f.hidden=!0;let N=I("div","types");N.setAttribute("role","radiogroup"),N.setAttribute("aria-label",z.requestTypeLabel);let t=I("p","status",z.requestTypeNone);t.hidden=!0;let Q0=I("p","status type-count","");Q0.hidden=!0,o.append(g1(z.requestTypeLabel,"",!0),f,N,t,Q0);let y=[],u=()=>{for(let L of y){let F=L.dataset.requestType===U?.id;L.setAttribute("aria-checked",String(F)),L.tabIndex=F?0:-1}let D=y.find((L)=>L.dataset.requestType===U?.id);if(D&&N.scrollHeight>N.clientHeight){let L=D.offsetTop-N.offsetTop;if(L<N.scrollTop)N.scrollTop=L;else if(L+D.offsetHeight>N.scrollTop+N.clientHeight)N.scrollTop=L+D.offsetHeight-N.clientHeight}},k=document.createElement("input");k.type="text";let k0=g1(""),x=document.createElement("textarea"),Z0=g1(""),T=I("div","meta"),{context:p}=Z,I1=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${z.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,f0=(D,L)=>{let F=document.createElement("div"),R=document.createElement("b");R.textContent=`${D}: `;let v=document.createTextNode(L);return F.append(R,v),T.append(F),{b:R,v}};f0(z.reporter,`${p.user.fullName??"—"} (${p.user.email??"—"})`),f0(z.page,p.route.href);let P0=f0(z.captured,I1),q0=document.createElement("label");q0.className="shot-choice",q0.hidden=!0;let X0=document.createElement("input");X0.type="checkbox",X0.checked=!0,X0.dataset.requestShot="",q0.append(X0,document.createTextNode(` ${z.requestWithShot}`));let w0=Z.screenshotDataUrl?this.screenshotSection(z,Z.screenshotDataUrl):[I("p","status",z.noScreenshot)],R0=Z.screenshotDataUrl?w0[0]:null;if(!Z.screenshotDataUrl)q0.replaceChildren();let M0=I("p","status",""),B0=J0(z.submit,"primary"),V0=()=>{B0.disabled=k.value.trim().length===0||W==="request"&&!U};k.addEventListener("input",V0);let X=()=>{let D=W==="request";if(B.textContent=D?z.requestTitle:z.title,V.setAttribute("aria-label",D?z.requestTitle:z.title),A.textContent=`${D?z.problemInstead:z.askInstead} `,m.textContent=D?q?z.problemInsteadAction:z.problemInsteadShare:z.askInsteadAction,o.hidden=!D,m1(k0,D?z.requestSummaryLabel:z.summaryLabel,D?"":z.summaryRequired,!0),k.placeholder=D?z.requestSummaryPlaceholder:z.summaryPlaceholder,m1(Z0,D?z.requestDetailLabel:z.detailLabel),x.placeholder=D?z.requestDetailPlaceholder:z.detailPlaceholder,P0.b.textContent=`${D?z.requestLeaves:z.captured}: `,P0.v.textContent=D?z.requestLeavesWhat:I1,q0.hidden=!D||!Z.screenshotDataUrl,R0)m1(R0,D?z.requestAnnotateHint:z.annotateHint);for(let L of w0)L.classList.toggle("dropped",D&&!X0.checked),L.hidden=D&&!Z.screenshotDataUrl;B0.textContent=D?z.requestSubmit:z.submit,V0()};X0.addEventListener("change",X);let Y=(D)=>{if(D===W)return;if(D==="problem"&&!q){this.switchToReport(z,$,{title:k.value,detail:x.value,asking:!1,typeId:U?.id??null});return}W=D,X()},G=(D)=>{if(this.bundle!==Z||$.type!=="manual"||!D.length)return;U=D[0],y.length=0;for(let F of D){let R=J0("","type");R.setAttribute("role","radio"),R.dataset.requestType=F.id;let v=I("span","type-body");if(v.append(I("b","",F.name)),F.description)v.append(I("span","type-hint",F.description));if(F.targetHours){let y0=I("span","type-due");y0.append(h1(A5),document.createTextNode(z.requestTarget.replace("{time}",R5(z,F.targetHours)))),v.append(y0)}R.append(h1(R6),v),R.addEventListener("click",()=>{U=F,u(),V0()}),y.push(R)}N.replaceChildren(...y),N.onkeydown=(F)=>{if(!S6.includes(F.key)||!U)return;F.preventDefault();let R=D.filter((T0,S8)=>!y[S8].hidden);if(!R.length)return;let v=R.findIndex((T0)=>T0.id===U.id),y0=F.key==="ArrowUp"||F.key==="ArrowLeft"?-1:1;U=R[v<0?0:(v+y0+R.length)%R.length],u(),y.find((T0)=>T0.dataset.requestType===U.id)?.focus()},N.classList.toggle("long",D.length>=R2),f.hidden=D.length<R2;let L=(F)=>{Q0.hidden=D.length<R2||F===0,Q0.textContent=z.requestTypeCount.replace("{n}",String(F))};L(D.length),f.oninput=()=>{let F=f.value.trim().toLowerCase(),R=null;if(D.forEach((v,y0)=>{let T0=!F||`${v.name} ${v.description}`.toLowerCase().includes(F);if(y[y0].hidden=!T0,T0&&!R)R=v}),t.hidden=!!R,L(y.filter((v)=>!v.hidden).length),R&&U&&y[D.indexOf(U)].hidden)U=R;u(),V0()},f.onkeydown=(F)=>{if(F.key==="ArrowDown"||F.key==="Enter")F.preventDefault(),y.find((R)=>R.dataset.requestType===U?.id&&!R.hidden)?.focus()},u(),E.hidden=!1,X()},K=Q??(_0&&(_0.title||_0.detail)?_0:null),H=I("p","draft");if(H.hidden=!K||!!Q,K){k.value=K.title,x.value=K.detail;let D=J0(z.draftClear,"link");D.dataset.draftClear="",D.addEventListener("click",()=>{k.value="",x.value="",_0=null,H.hidden=!0,V0(),k.focus()}),H.append(document.createTextNode(`${z.draftRestored} · `),D)}let P=C2(),O=(D)=>{if(G(D),W!=="request"||E.hidden||!K?.typeId)return;let L=D.find((F)=>F.id===K.typeId);if(L)U=L,u()};if(P)O(P);else if($.type==="manual")b0().then(O);this.keep=()=>({title:k.value,detail:x.value,asking:W==="request",typeId:U?.id??null}),V.append(C,E,H,o,k0,k,Z0,x,T,q0,...w0);let i=I("div","foot"),W0=J0(z.close);W0.addEventListener("click",()=>this.close()),i.append(W0,M0,I("span","grow"),B0),V.append(i),X(),B0.addEventListener("click",async()=>{B0.disabled=!0,M0.dataset.tone="",M0.textContent=z.submitting;let D=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&U){let R=await M6({ticketTypeId:U.id,title:k.value.trim(),description:x.value,screenshotDataUrl:X0.checked?D():null}),v=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:R,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),v)h0(`${z.requestSubmitted} — #${R.number}`,"success");return}let L=await D6(k.value.trim(),{...Z,note:x.value,screenshotDataUrl:D()}),F=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:L,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),F)h0(`${z.submitted} — #${L.number}`,"success")}catch(L){let F=C5(L,z);M0.dataset.tone="error",M0.textContent=F,h0(F,"error"),V0()}}),k.focus()}screenshotSection(z,$){let j=g1(z.annotateHint),Q=I("div","tools"),Z=document.createElement("canvas"),V=I("div","shot");V.append(Z);let W=[],q=(_)=>{for(let E of W)E.setAttribute("aria-pressed",String(E===_))};for(let{tool:_,key:E}of L5){let A=J0(z[E]);A.setAttribute("aria-pressed","false"),A.addEventListener("click",()=>{let m=A.getAttribute("aria-pressed")==="true";q(m?null:A),this.annotator?.setTool(m?null:_)}),W.push(A),Q.append(A)}Q.append(I("span","sep"));let U=J0(z.deleteSelected);U.addEventListener("click",()=>this.annotator?.deleteSelected());let C=J0(z.clearAll);C.addEventListener("click",()=>{this.annotator?.clear(),q(null)}),Q.append(U,C);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=O6(Z,B,()=>{q(null),U.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,I("p","status",z.annotateHelp),V]}}}function S2(){try{return O5()}catch{return[]}}function I(J,z="",$=""){let j=document.createElement(J);if(z)j.className=z;if($)j.textContent=$;return j}function R5(J,z){return z>=24&&z%24===0?J.days.replace("{n}",String(z/24)):J.hours.replace("{n}",String(z))}var S6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],R2=7,T5=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],R6=[["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"}]],A5=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],x5=[["path",{d:"M20 6 9 17l-5-5"}]],T6="http://www.w3.org/2000/svg";function A6(J,z,$,j){let Q=J0("","kind");Q.dataset.kind=J;let Z=I("span","kind-top");return Z.append(h1(z),I("b","",$)),Q.append(Z,I("span","kind-hint",j),h1(x5,"tick")),Q}function h1(J,z="icon"){let $=document.createElementNS(T6,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:z}))$.setAttribute(j,Q);for(let[j,Q]of J){let Z=document.createElementNS(T6,j);for(let[V,W]of Object.entries(Q))Z.setAttribute(V,W);$.append(Z)}return $}function J0(J,z=""){let $=document.createElement("button");if($.type="button",$.textContent=J,z)$.className=z;return $}function g1(J,z="",$=!1){return m1(document.createElement("label"),J,z,$)}function m1(J,z,$="",j=!1){if(J.replaceChildren(document.createTextNode(z)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",J.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,J.append(Q)}return J}function x6(){if(typeof window>"u"||customElements.get(W1))return;customElements.define(W1,S5())}var E5="lw-portal-handoff",E6=138.23,k5=`
185
185
  :host { all: initial; }
186
186
  .backdrop {
187
187
  position: fixed; inset: 0; z-index: 2147483002;
@@ -211,10 +211,10 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
211
211
  .ring .track { stroke: #e2e8f0; }
212
212
  .ring .bar {
213
213
  stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
214
- stroke-dasharray: ${A6}; stroke-dashoffset: 0;
214
+ stroke-dasharray: ${E6}; stroke-dashoffset: 0;
215
215
  animation: deplete var(--secs, 3s) linear forwards;
216
216
  }
217
- @keyframes deplete { to { stroke-dashoffset: ${A6}; } }
217
+ @keyframes deplete { to { stroke-dashoffset: ${E6}; } }
218
218
  .count {
219
219
  position: absolute; inset: 0; display: grid; place-items: center;
220
220
  font-size: 18px; font-weight: 600; color: #0f172a;
@@ -258,7 +258,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
258
258
  .ring .bar { animation: none; stroke-dashoffset: 0; }
259
259
  .spinner { animation-duration: 2s; }
260
260
  }
261
- `;function k6(J){if(typeof document>"u")return J.prepare().then((f)=>void J.go(f),()=>{return});let z=c(M().locale),$=Math.max(1,Math.floor(J.seconds??3)),j=document.createElement(T3),Q=j.attachShadow({mode:"open"});u0(Q);let Z=document.createElement("style");Z.textContent=A3,Q.append(Z);let V=document.createElement("div");V.className="backdrop",V.innerHTML=`
261
+ `;function k6(J){if(typeof document>"u")return J.prepare().then((f)=>void J.go(f),()=>{return});let z=l(M().locale),$=Math.max(1,Math.floor(J.seconds??3)),j=document.createElement(E5),Q=j.attachShadow({mode:"open"});u0(Q);let Z=document.createElement("style");Z.textContent=k5,Q.append(Z);let V=document.createElement("div");V.className="backdrop",V.innerHTML=`
262
262
  <div class="card" role="dialog" aria-modal="true" aria-labelledby="lw-ho-title">
263
263
  <div class="dial">
264
264
  <svg class="ring" viewBox="0 0 52 52" aria-hidden="true">
@@ -274,14 +274,14 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
274
274
  <button type="button" class="cancel"></button>
275
275
  <button type="button" class="go"></button>
276
276
  </div>
277
- </div>`,Q.append(V);let W=(f)=>V.querySelector(f),U=W(".card"),q=W(".bar"),C=W(".count"),F=W("h2"),_=W(".body"),x=W(".host"),A=W(".go"),h=W(".cancel");F.textContent=z.handoffTitle,_.textContent=z.handoffBody;try{x.textContent=new URL(M().host).host}catch{x.textContent=""}A.textContent=z.handoffGo,h.textContent=z.cancel,U.style.setProperty("--secs",`${$}s`),C.textContent=String($),document.body.append(j),requestAnimationFrame(()=>V.setAttribute("data-open","1"));let r=document.activeElement;return A.focus({preventScroll:!0}),new Promise((f)=>{let N=!1,a=null,j0=!1,y=Date.now()+$*1000,u=window.setInterval(()=>{let R=Math.ceil((y-Date.now())/1000);if(C.textContent=String(Math.max(0,R)),Date.now()>=y)k()},100);function E(R){if(N)return;if(N=!0,window.clearInterval(u),document.removeEventListener("keydown",Q0,!0),V.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!R)r?.focus?.({preventScroll:!0});f()}function E0(R){window.clearInterval(u),q.classList.remove("spinner"),q.style.animation="none",C.textContent="",F.textContent=z.handoffBlocked,_.textContent=z.handoffBody;let p=document.createElement("a");p.className="go",p.href=R,p.target="_blank",p.rel="noopener noreferrer",p.textContent=z.handoffOpen,p.addEventListener("click",()=>E(!0)),A.replaceWith(p),p.focus({preventScroll:!0})}function k(){if(N||j0)return;if(a)return J.go(a)?E(!0):E0(a);window.clearInterval(u),C.textContent="",q.classList.add("spinner"),F.textContent=z.handoffPreparing}function Q0(R){if(R.key==="Escape")R.stopPropagation(),E(!1)}document.addEventListener("keydown",Q0,!0),A.addEventListener("click",k),h.addEventListener("click",()=>E(!1)),V.addEventListener("click",(R)=>{if(R.target===V)E(!1)}),J.prepare().then((R)=>{if(a=R,!N&&Date.now()>=y)k()},()=>{j0=!0,window.clearInterval(u),U.classList.add("error"),q.classList.remove("spinner"),q.style.animation="none",C.textContent="",F.textContent=z.handoffFailed,_.textContent=z.handoffBody,A.remove(),h.textContent=z.close})})}var k3="/sso";function x3(J,z,$,j){let Q=new URL(k3,J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",z),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class L2 extends Error{constructor(J="No identity provider is configured, or nobody is signed in"){super(J);this.name="NoIdentityError"}}async function S2(J){let z=M();if(!z.identity)throw new L2;let $=await z.identity();if(!$)throw new L2;return x3(z.host,z.realmKey,$,J)}var E6=S2;function x6(J,z){if(z==="_self")return window.location.assign(J),!0;let $=window.open(J,"_blank");if(!$)return!1;try{$.opener=null}catch{}return!0}async function f6(J={}){if(J.announce===!1){x6(await S2(J.returnTo),J.target);return}await k6({seconds:J.seconds,prepare:()=>S2(J.returnTo),go:(z)=>x6(z,J.target)})}var h1='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function E3(J){let z=(J??"").trim();return!z||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test(z)?"":z}function m1(J){if(!J||typeof document>"u"||!document.body)return;let z="";try{z=E3(getComputedStyle(document.body).fontFamily)}catch{}if(z)J.style.setProperty("--lw-host-font",z);else J.style.removeProperty("--lw-host-font")}var f3="lw-call-ring",w3=`
277
+ </div>`,Q.append(V);let W=(f)=>V.querySelector(f),q=W(".card"),U=W(".bar"),C=W(".count"),B=W("h2"),_=W(".body"),E=W(".host"),A=W(".go"),m=W(".cancel");B.textContent=z.handoffTitle,_.textContent=z.handoffBody;try{E.textContent=new URL(M().host).host}catch{E.textContent=""}A.textContent=z.handoffGo,m.textContent=z.cancel,q.style.setProperty("--secs",`${$}s`),C.textContent=String($),document.body.append(j),requestAnimationFrame(()=>V.setAttribute("data-open","1"));let o=document.activeElement;return A.focus({preventScroll:!0}),new Promise((f)=>{let N=!1,t=null,Q0=!1,y=Date.now()+$*1000,u=window.setInterval(()=>{let T=Math.ceil((y-Date.now())/1000);if(C.textContent=String(Math.max(0,T)),Date.now()>=y)x()},100);function k(T){if(N)return;if(N=!0,window.clearInterval(u),document.removeEventListener("keydown",Z0,!0),V.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!T)o?.focus?.({preventScroll:!0});f()}function k0(T){window.clearInterval(u),U.classList.remove("spinner"),U.style.animation="none",C.textContent="",B.textContent=z.handoffBlocked,_.textContent=z.handoffBody;let p=document.createElement("a");p.className="go",p.href=T,p.target="_blank",p.rel="noopener noreferrer",p.textContent=z.handoffOpen,p.addEventListener("click",()=>k(!0)),A.replaceWith(p),p.focus({preventScroll:!0})}function x(){if(N||Q0)return;if(t)return J.go(t)?k(!0):k0(t);window.clearInterval(u),C.textContent="",U.classList.add("spinner"),B.textContent=z.handoffPreparing}function Z0(T){if(T.key==="Escape")T.stopPropagation(),k(!1)}document.addEventListener("keydown",Z0,!0),A.addEventListener("click",x),m.addEventListener("click",()=>k(!1)),V.addEventListener("click",(T)=>{if(T.target===V)k(!1)}),J.prepare().then((T)=>{if(t=T,!N&&Date.now()>=y)x()},()=>{Q0=!0,window.clearInterval(u),q.classList.add("error"),U.classList.remove("spinner"),U.style.animation="none",C.textContent="",B.textContent=z.handoffFailed,_.textContent=z.handoffBody,A.remove(),m.textContent=z.close})})}var f5="/sso";function w5(J,z,$,j){let Q=new URL(f5,J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",z),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class T2 extends Error{constructor(J="No identity provider is configured, or nobody is signed in"){super(J);this.name="NoIdentityError"}}async function A2(J){let z=M();if(!z.identity)throw new T2;let $=await z.identity();if(!$)throw new T2;return w5(z.host,z.realmKey,$,J)}var w6=A2;function f6(J,z){if(z==="_self")return window.location.assign(J),!0;let $=window.open(J,"_blank");if(!$)return!1;try{$.opener=null}catch{}return!0}async function y6(J={}){if(J.announce===!1){f6(await A2(J.returnTo),J.target);return}await k6({seconds:J.seconds,prepare:()=>A2(J.returnTo),go:(z)=>f6(z,J.target)})}var b1='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function y5(J){let z=(J??"").trim();return!z||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test(z)?"":z}function u1(J){if(!J||typeof document>"u"||!document.body)return;let z="";try{z=y5(getComputedStyle(document.body).fontFamily)}catch{}if(z)J.style.setProperty("--lw-host-font",z);else J.style.removeProperty("--lw-host-font")}var v5="lw-call-ring",g5=`
278
278
  :host { all: initial; }
279
279
  .card {
280
280
  position: fixed; right: 16px; bottom: calc(16px + var(--lw-chat-lift, 0px)); z-index: 2147483002;
281
281
  width: min(352px, calc(100vw - 32px)); box-sizing: border-box;
282
282
  padding: 16px; border-radius: 16px; background: #fff; color: #1a1a1e;
283
283
  border: 1px solid #e8e8ec; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
284
- font-family: var(--lw-host-font, ${h1});
284
+ font-family: var(--lw-host-font, ${b1});
285
285
  animation: in 200ms cubic-bezier(0.16, 1, 0.3, 1);
286
286
  }
287
287
  @media (max-width: 639px) { .card { right: 8px; left: 8px; bottom: calc(8px + var(--lw-chat-lift, 0px)); width: auto; } }
@@ -325,19 +325,19 @@ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #1a1
325
325
  @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
326
326
  @keyframes spin { to { transform: rotate(360deg); } }
327
327
  @media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } .spin { animation: none; } }
328
- `,u1=(J)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${J}</svg>`,w6=u1('<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"/>'),y3=u1('<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"/>'),g3=u1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),v3=u1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),v=null,D0=null,p0=null;function h3(J,z,$){if(z.chatId)return $??z.ticketTitle;return J.replace("{key}",z.ticketKey).replace("{title}",z.ticketTitle)}var i0=()=>c(M().locale);function m3(){if(typeof document>"u")return null;if(v?.isConnected)return v.shadowRoot;v=document.createElement(f3),v.dataset.debugReporter="true",m1(v);let J=v.attachShadow({mode:"open"});return u0(J),document.body.append(v),J}function b1(J,z,$,j){let Q=document.createElement("button");return Q.type="button",Q.className=J,Q.innerHTML=z,Q.dataset.lwRing=$,Q.onclick=j,Q}var Y1=(J)=>{let z=document.createElement("span");return z.textContent=J,z.outerHTML};function g6(J,z,$,j,Q){let Z=i0();J.innerHTML="";let V=document.createElement("style");V.textContent=w3;let W=document.createElement("div");W.className="card",W.setAttribute("role","alertdialog"),W.setAttribute("aria-label",Z.ringTitle),W.dataset.lwCallRing=z.id,W.dataset.lwRingMode=j;let U=document.createElement("div");U.className="head";let q=document.createElement("span");q.className="icon",q.innerHTML=w6;let C=document.createElement("div");C.className="words";let F=document.createElement("h2");F.textContent=Z.ringTitle;let _=document.createElement("p");_.className="about",_.textContent=h3(Z.ringAbout,z,Z.ringChat),_.title=_.textContent,C.append(F,_),U.append(q,C);let x=document.createElement("p");x.className="how",x.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let A=document.createElement("div");A.className="actions";let h=b1("decline",y3+Y1(Z.ringDecline),"decline",()=>$.decline());if(W.append(U,x),j==="frame"&&$.answer){if($.voice)W.append(b1("test",g3+Y1(Z.ringTest),"test",()=>$.voice?.()));let r=b1("answer",w6+Y1(Z.ringAnswer),"answer",()=>$.answer?.());A.append(h,r)}else A.append(h,b1("open",Y1(Z.ringOpen),"open",()=>$.open()));W.append(A),J.append(V,W)}function p1(J,z,$="portal"){if(D0===J.id&&v?.isConnected)return;let j=m3();if(!j)return;if(D0=J.id,g6(j,J,z,$),b3(),p0===null)p0=document.title,document.title=`${i0().ringTab} — ${p0}`}function v6(J){let z=v?.shadowRoot;if(!z||D0!==J)return;let $=z.querySelector(".answer");if($)$.innerHTML=v3+Y1(i0().ringAnswering),$.disabled=!0;let j=z.querySelector(".decline");if(j)j.disabled=!0}function h6(J,z){let $=v?.isConnected?v.shadowRoot:null;if(!$||D0!==J.id)return p1(J,z,"portal");v.style.display="",g6($,J,z,"portal",i0().ringFallback)}function i1(J){let z=v?.shadowRoot;if(!z)return;T2(),u6();let $=i0(),j=z.querySelector(".how"),Q=z.querySelector(".actions");if(j)if(j.textContent="",J){let Z=document.createElement("a");Z.href=J,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>i1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>d0(),Q.append(Z)}}function m6(J,z=!0){if(!v?.isConnected||D0!==J)return;let $=v;if(clearTimeout(y6),!z){$.style.display="",$.style.opacity="";return}$.style.transition="opacity 150ms ease-out",$.style.opacity="0",y6=setTimeout(()=>{if($.style.opacity==="0")$.style.display="none"},160)}var y6;function d0(J){if(J&&D0&&J!==D0)return;T2(),u6(),v?.remove(),v=null,D0=null}function b6(){return v?.isConnected?D0:null}function u6(){if(p0===null||typeof document>"u")return;if(document.title.startsWith(i0().ringTab))document.title=p0;p0=null}var I0=null,R2;function b3(){T2();let J=window,z=J.AudioContext??J.webkitAudioContext;if(!z)return;try{let j=I0??new z;I0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!I0||I0.state!=="running")return;let j=I0.currentTime;for(let[Q,Z]of[660,880].entries()){let V=I0.createOscillator(),W=I0.createGain();V.frequency.value=Z,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),V.connect(W).connect(I0.destination),V.start(j+Q*0.22),V.stop(j+Q*0.22+0.21)}};$(),R2=setInterval($,2200)}function T2(){clearInterval(R2),R2=void 0}var u3=/^[A-Za-z0-9_-]{1,32}$/,p3=/^#[0-9a-fA-F]{6}$/,i3=["pen","rect","laser"],p6=(J)=>J<0?0:J>1?1:J;function i6(J,z){if(!Array.isArray(J)||J.length<z||J.length>64)return null;let $=[];for(let j of J){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([p6(Q),p6(Z)])}return $}function d1(J){if(!J||typeof J!=="object")return null;let z=J;if(z.op==="clear")return{op:"clear"};if(typeof z.id!=="string"||!u3.test(z.id))return null;if(z.op==="end")return{op:"end",id:z.id};if(z.op==="add"){let $=i6(z.pts,1);return $?{op:"add",id:z.id,pts:$}:null}if(z.op==="begin"){if(!i3.includes(z.kind)||typeof z.color!=="string"||!p3.test(z.color))return null;let $=i6(z.pts,1);return $?{op:"begin",id:z.id,kind:z.kind,color:z.color,pts:$}:null}return null}function A2(J,z){if(J.endedAt!==null)return J.endedAt;return z-J.lastAt>20000?J.lastAt:null}function d6(J,z,$){if(z===null)return 1;let j=$-z;if(J==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class k2{marks=new Map;apply(J,z=Date.now()){if(J.op==="clear"){this.marks.clear();return}if(J.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(J.id),this.marks.set(J.id,{kind:J.kind,color:J.color,pts:J.pts.map(([j,Q])=>({x:j,y:Q,t:z})),endedAt:null,lastAt:z});return}let $=this.marks.get(J.id);if(!$||A2($,z)!==null)return;if(J.op==="end"){$.endedAt=z;return}if($.lastAt=z,$.kind==="rect"){let[j,Q]=J.pts[J.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:z}];return}for(let[j,Q]of J.pts)$.pts.push({x:j,y:Q,t:z});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(J=Date.now()){for(let[z,$]of this.marks)if(d6($.kind,A2($,J),J)<=0)this.marks.delete(z);return this.marks.size>0}get size(){return this.marks.size}draw(J,z,$,j=Date.now()){J.clearRect(0,0,z,$);let Q=Math.max(1,Math.min(z,$));for(let Z of this.marks.values()){let V=d6(Z.kind,A2(Z,j),j);if(V<=0||!Z.pts.length)continue;if(J.save(),J.lineCap="round",J.lineJoin="round",Z.kind==="pen")c3(J,Z,z,$,Math.max(3,Q*0.0045),V);else if(Z.kind==="rect")l3(J,Z,z,$,Math.max(2.5,Q*0.003),V);else o3(J,Z,z,$,Math.max(6,Q*0.008),V,j);J.restore()}}}function d3(J,z,$,j){if(J.beginPath(),J.moveTo(z[0].x*$,z[0].y*j),z.length===1){J.lineTo(z[0].x*$+0.01,z[0].y*j);return}for(let Z=1;Z<z.length-1;Z++){let V=z[Z],W=z[Z+1];J.quadraticCurveTo(V.x*$,V.y*j,(V.x+W.x)/2*$,(V.y+W.y)/2*j)}let Q=z[z.length-1];J.lineTo(Q.x*$,Q.y*j)}function c3(J,z,$,j,Q,Z){J.globalAlpha=Z,d3(J,z.pts,$,j),J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.stroke(),J.strokeStyle=z.color,J.lineWidth=Q,J.stroke()}function l3(J,z,$,j,Q,Z){let V=z.pts[0],W=z.pts[z.pts.length-1],U=Math.min(V.x,W.x)*$,q=Math.min(V.y,W.y)*j,C=Math.abs(W.x-V.x)*$,F=Math.abs(W.y-V.y)*j;J.globalAlpha=Z,J.fillStyle=z.color,J.globalAlpha=Z*0.14,J.fillRect(U,q,C,F),J.globalAlpha=Z,J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.strokeRect(U,q,C,F),J.strokeStyle=z.color,J.lineWidth=Q,J.strokeRect(U,q,C,F)}function o3(J,z,$,j,Q,Z,V){let W=z.pts.filter((q)=>V-q.t<=450);for(let q=1;q<W.length;q++){let C=W[q-1],F=W[q];J.globalAlpha=Z*Math.max(0,1-(V-F.t)/450)*0.7,J.strokeStyle=z.color,J.lineWidth=Q*0.9,J.beginPath(),J.moveTo(C.x*$,C.y*j),J.lineTo(F.x*$,F.y*j),J.stroke()}let U=z.pts[z.pts.length-1];J.globalAlpha=Z,J.shadowColor=z.color,J.shadowBlur=Q*2,J.fillStyle=z.color,J.beginPath(),J.arc(U.x*$,U.y*j,Q,0,Math.PI*2),J.fill(),J.shadowBlur=0,J.strokeStyle="rgba(255,255,255,0.95)",J.lineWidth=2,J.stroke()}function r3(J,z,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(z*j)),Z=Math.max(1,Math.round($*j));if(J.width!==Q)J.width=Q;if(J.height!==Z)J.height=Z;let V=J.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class x2{canvas;scene;box;frame=0;constructor(J,z,$){this.canvas=J;this.scene=z;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let J=()=>{this.frame=0;let{w:z,h:$}=this.box(),j=r3(this.canvas,z,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,z,$,Q);if(Z)this.frame=requestAnimationFrame(J)};this.frame=requestAnimationFrame(J)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var n3="lw-call-ink",C0=null,c1=null,K1=null;function s3(){if(C0?.isConnected&&K1)return;C0=document.createElement(n3),C0.dataset.debugReporter="true";let J=C0.attachShadow({mode:"open"}),z=document.createElement("style");z.textContent=`:host { all: initial; }
329
- canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",J.append(z,$),document.body.append(C0),c1=new k2,K1=new x2($,c1,()=>({w:window.innerWidth,h:window.innerHeight}))}function l1(J){if(typeof document>"u")return;if(J.op==="clear"&&!C0)return;s3(),c1.apply(J),K1.kick()}function o1(){K1?.stop(),C0?.remove(),C0=null,c1=null,K1=null}var a3="lw-call-frame",t3="lw-call",s=16,g2=368,W0=null,w=null,A0=null,s1="",U1=null,q1="card",v2={width:g2,height:0},h2,H1=!1,m2=null,l0={answer:!1,voice:!1},O0=null,l=null,E2="lw-call-frame-place";function c6(J,z,$,j){let Q=new URL("embed/call",J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",z),$)Q.searchParams.set("token",$);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function c0(J){w?.contentWindow?.postMessage({source:"lw-call-host",...J},s1)}function l6(J){if(A0!==J)return;if(l0.answer=!0,H1)c0({type:"answer"})}function o6(J){if(A0!==J)return;if(l0.voice=!0,H1)c0({type:"voice"})}function r6(J,z,$){return{x:Math.min(Math.max(J.x,s/2),Math.max(s/2,$.w-z.w-s/2)),y:Math.min(Math.max(J.y,s/2),Math.max(s/2,$.h-z.h-s/2))}}function e3(J,z){if(J.origin!==z.origin||J.source!==z.window)return null;let $=J.data;return $&&typeof $==="object"&&$.source===t3&&typeof $.type==="string"?$:null}function r0(){return W0?.isConnected?A0:null}function n6(J,z,$,j=15000,Q=null){if(typeof document>"u")return;if(A0===z&&W0?.isConnected)return;D1(),A0=z,U1=$,H1=!1,m2=Q,l0={answer:!1,voice:!1},q1="card",v2={width:g2,height:0},s1=new URL(J).origin;try{O0=JSON.parse(sessionStorage.getItem(E2)??"null")}catch{O0=null}W0=document.createElement(a3),W0.dataset.debugReporter="true";let Z=W0.attachShadow({mode:"open"}),V=document.createElement("style");V.textContent=`:host { all: initial; }
328
+ `,i1=(J)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${J}</svg>`,v6=i1('<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"/>'),m5=i1('<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"/>'),h5=i1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),b5=i1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),g=null,D0=null,p0=null;function u5(J,z,$){if(z.chatId)return $??z.ticketTitle;return J.replace("{key}",z.ticketKey).replace("{title}",z.ticketTitle)}var i0=()=>l(M().locale);function p5(){if(typeof document>"u")return null;if(g?.isConnected)return g.shadowRoot;g=document.createElement(v5),g.dataset.debugReporter="true",u1(g);let J=g.attachShadow({mode:"open"});return u0(J),document.body.append(g),J}function p1(J,z,$,j){let Q=document.createElement("button");return Q.type="button",Q.className=J,Q.innerHTML=z,Q.dataset.lwRing=$,Q.onclick=j,Q}var Y1=(J)=>{let z=document.createElement("span");return z.textContent=J,z.outerHTML};function m6(J,z,$,j,Q){let Z=i0();J.innerHTML="";let V=document.createElement("style");V.textContent=g5;let W=document.createElement("div");W.className="card",W.setAttribute("role","alertdialog"),W.setAttribute("aria-label",Z.ringTitle),W.dataset.lwCallRing=z.id,W.dataset.lwRingMode=j;let q=document.createElement("div");q.className="head";let U=document.createElement("span");U.className="icon",U.innerHTML=v6;let C=document.createElement("div");C.className="words";let B=document.createElement("h2");B.textContent=Z.ringTitle;let _=document.createElement("p");_.className="about",_.textContent=u5(Z.ringAbout,z,Z.ringChat),_.title=_.textContent,C.append(B,_),q.append(U,C);let E=document.createElement("p");E.className="how",E.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let A=document.createElement("div");A.className="actions";let m=p1("decline",m5+Y1(Z.ringDecline),"decline",()=>$.decline());if(W.append(q,E),j==="frame"&&$.answer){if($.voice)W.append(p1("test",h5+Y1(Z.ringTest),"test",()=>$.voice?.()));let o=p1("answer",v6+Y1(Z.ringAnswer),"answer",()=>$.answer?.());A.append(m,o)}else A.append(m,p1("open",Y1(Z.ringOpen),"open",()=>$.open()));W.append(A),J.append(V,W)}function d1(J,z,$="portal"){if(D0===J.id&&g?.isConnected)return;let j=p5();if(!j)return;if(D0=J.id,m6(j,J,z,$),i5(),p0===null)p0=document.title,document.title=`${i0().ringTab} — ${p0}`}function h6(J){let z=g?.shadowRoot;if(!z||D0!==J)return;let $=z.querySelector(".answer");if($)$.innerHTML=b5+Y1(i0().ringAnswering),$.disabled=!0;let j=z.querySelector(".decline");if(j)j.disabled=!0}function b6(J,z){let $=g?.isConnected?g.shadowRoot:null;if(!$||D0!==J.id)return d1(J,z,"portal");g.style.display="",m6($,J,z,"portal",i0().ringFallback)}function c1(J){let z=g?.shadowRoot;if(!z)return;E2(),i6();let $=i0(),j=z.querySelector(".how"),Q=z.querySelector(".actions");if(j)if(j.textContent="",J){let Z=document.createElement("a");Z.href=J,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>c1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>d0(),Q.append(Z)}}function u6(J,z=!0){if(!g?.isConnected||D0!==J)return;let $=g;if(clearTimeout(g6),!z){$.style.display="",$.style.opacity="";return}$.style.transition="opacity 150ms ease-out",$.style.opacity="0",g6=setTimeout(()=>{if($.style.opacity==="0")$.style.display="none"},160)}var g6;function d0(J){if(J&&D0&&J!==D0)return;E2(),i6(),g?.remove(),g=null,D0=null}function p6(){return g?.isConnected?D0:null}function i6(){if(p0===null||typeof document>"u")return;if(document.title.startsWith(i0().ringTab))document.title=p0;p0=null}var I0=null,x2;function i5(){E2();let J=window,z=J.AudioContext??J.webkitAudioContext;if(!z)return;try{let j=I0??new z;I0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!I0||I0.state!=="running")return;let j=I0.currentTime;for(let[Q,Z]of[660,880].entries()){let V=I0.createOscillator(),W=I0.createGain();V.frequency.value=Z,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),V.connect(W).connect(I0.destination),V.start(j+Q*0.22),V.stop(j+Q*0.22+0.21)}};$(),x2=setInterval($,2200)}function E2(){clearInterval(x2),x2=void 0}var d5=/^[A-Za-z0-9_-]{1,32}$/,c5=/^#[0-9a-fA-F]{6}$/,l5=["pen","rect","laser"],d6=(J)=>J<0?0:J>1?1:J;function c6(J,z){if(!Array.isArray(J)||J.length<z||J.length>64)return null;let $=[];for(let j of J){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([d6(Q),d6(Z)])}return $}function l1(J){if(!J||typeof J!=="object")return null;let z=J;if(z.op==="clear")return{op:"clear"};if(typeof z.id!=="string"||!d5.test(z.id))return null;if(z.op==="end")return{op:"end",id:z.id};if(z.op==="add"){let $=c6(z.pts,1);return $?{op:"add",id:z.id,pts:$}:null}if(z.op==="begin"){if(!l5.includes(z.kind)||typeof z.color!=="string"||!c5.test(z.color))return null;let $=c6(z.pts,1);return $?{op:"begin",id:z.id,kind:z.kind,color:z.color,pts:$}:null}return null}function k2(J,z){if(J.endedAt!==null)return J.endedAt;return z-J.lastAt>20000?J.lastAt:null}function l6(J,z,$){if(z===null)return 1;let j=$-z;if(J==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class f2{marks=new Map;apply(J,z=Date.now()){if(J.op==="clear"){this.marks.clear();return}if(J.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(J.id),this.marks.set(J.id,{kind:J.kind,color:J.color,pts:J.pts.map(([j,Q])=>({x:j,y:Q,t:z})),endedAt:null,lastAt:z});return}let $=this.marks.get(J.id);if(!$||k2($,z)!==null)return;if(J.op==="end"){$.endedAt=z;return}if($.lastAt=z,$.kind==="rect"){let[j,Q]=J.pts[J.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:z}];return}for(let[j,Q]of J.pts)$.pts.push({x:j,y:Q,t:z});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(J=Date.now()){for(let[z,$]of this.marks)if(l6($.kind,k2($,J),J)<=0)this.marks.delete(z);return this.marks.size>0}get size(){return this.marks.size}draw(J,z,$,j=Date.now()){J.clearRect(0,0,z,$);let Q=Math.max(1,Math.min(z,$));for(let Z of this.marks.values()){let V=l6(Z.kind,k2(Z,j),j);if(V<=0||!Z.pts.length)continue;if(J.save(),J.lineCap="round",J.lineJoin="round",Z.kind==="pen")n5(J,Z,z,$,Math.max(3,Q*0.0045),V);else if(Z.kind==="rect")o5(J,Z,z,$,Math.max(2.5,Q*0.003),V);else s5(J,Z,z,$,Math.max(6,Q*0.008),V,j);J.restore()}}}function r5(J,z,$,j){if(J.beginPath(),J.moveTo(z[0].x*$,z[0].y*j),z.length===1){J.lineTo(z[0].x*$+0.01,z[0].y*j);return}for(let Z=1;Z<z.length-1;Z++){let V=z[Z],W=z[Z+1];J.quadraticCurveTo(V.x*$,V.y*j,(V.x+W.x)/2*$,(V.y+W.y)/2*j)}let Q=z[z.length-1];J.lineTo(Q.x*$,Q.y*j)}function n5(J,z,$,j,Q,Z){J.globalAlpha=Z,r5(J,z.pts,$,j),J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.stroke(),J.strokeStyle=z.color,J.lineWidth=Q,J.stroke()}function o5(J,z,$,j,Q,Z){let V=z.pts[0],W=z.pts[z.pts.length-1],q=Math.min(V.x,W.x)*$,U=Math.min(V.y,W.y)*j,C=Math.abs(W.x-V.x)*$,B=Math.abs(W.y-V.y)*j;J.globalAlpha=Z,J.fillStyle=z.color,J.globalAlpha=Z*0.14,J.fillRect(q,U,C,B),J.globalAlpha=Z,J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.strokeRect(q,U,C,B),J.strokeStyle=z.color,J.lineWidth=Q,J.strokeRect(q,U,C,B)}function s5(J,z,$,j,Q,Z,V){let W=z.pts.filter((U)=>V-U.t<=450);for(let U=1;U<W.length;U++){let C=W[U-1],B=W[U];J.globalAlpha=Z*Math.max(0,1-(V-B.t)/450)*0.7,J.strokeStyle=z.color,J.lineWidth=Q*0.9,J.beginPath(),J.moveTo(C.x*$,C.y*j),J.lineTo(B.x*$,B.y*j),J.stroke()}let q=z.pts[z.pts.length-1];J.globalAlpha=Z,J.shadowColor=z.color,J.shadowBlur=Q*2,J.fillStyle=z.color,J.beginPath(),J.arc(q.x*$,q.y*j,Q,0,Math.PI*2),J.fill(),J.shadowBlur=0,J.strokeStyle="rgba(255,255,255,0.95)",J.lineWidth=2,J.stroke()}function a5(J,z,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(z*j)),Z=Math.max(1,Math.round($*j));if(J.width!==Q)J.width=Q;if(J.height!==Z)J.height=Z;let V=J.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class w2{canvas;scene;box;frame=0;constructor(J,z,$){this.canvas=J;this.scene=z;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let J=()=>{this.frame=0;let{w:z,h:$}=this.box(),j=a5(this.canvas,z,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,z,$,Q);if(Z)this.frame=requestAnimationFrame(J)};this.frame=requestAnimationFrame(J)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var t5="lw-call-ink",C0=null,r1=null,K1=null;function e5(){if(C0?.isConnected&&K1)return;C0=document.createElement(t5),C0.dataset.debugReporter="true";let J=C0.attachShadow({mode:"open"}),z=document.createElement("style");z.textContent=`:host { all: initial; }
329
+ canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",J.append(z,$),document.body.append(C0),r1=new f2,K1=new w2($,r1,()=>({w:window.innerWidth,h:window.innerHeight}))}function n1(J){if(typeof document>"u")return;if(J.op==="clear"&&!C0)return;e5(),r1.apply(J),K1.kick()}function o1(){K1?.stop(),C0?.remove(),C0=null,r1=null,K1=null}var J9="lw-call-frame",z9="lw-call",a=16,h2=368,Y0=null,w=null,A0=null,t1="",q1=null,U1="card",b2={width:h2,height:0},u2,H1=!1,p2=null,l0={answer:!1,voice:!1},O0=null,r=null,y2="lw-call-frame-place";function r6(J,z,$,j){let Q=new URL("embed/call",J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",z),$)Q.searchParams.set("token",$);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function c0(J){w?.contentWindow?.postMessage({source:"lw-call-host",...J},t1)}function n6(J){if(A0!==J)return;if(l0.answer=!0,H1)c0({type:"answer"})}function o6(J){if(A0!==J)return;if(l0.voice=!0,H1)c0({type:"voice"})}function s6(J,z,$){return{x:Math.min(Math.max(J.x,a/2),Math.max(a/2,$.w-z.w-a/2)),y:Math.min(Math.max(J.y,a/2),Math.max(a/2,$.h-z.h-a/2))}}function $9(J,z){if(J.origin!==z.origin||J.source!==z.window)return null;let $=J.data;return $&&typeof $==="object"&&$.source===z9&&typeof $.type==="string"?$:null}function n0(){return Y0?.isConnected?A0:null}function a6(J,z,$,j=15000,Q=null){if(typeof document>"u")return;if(A0===z&&Y0?.isConnected)return;D1(),A0=z,q1=$,H1=!1,p2=Q,l0={answer:!1,voice:!1},U1="card",b2={width:h2,height:0},t1=new URL(J).origin;try{O0=JSON.parse(sessionStorage.getItem(y2)??"null")}catch{O0=null}Y0=document.createElement(J9),Y0.dataset.debugReporter="true";let Z=Y0.attachShadow({mode:"open"}),V=document.createElement("style");V.textContent=`:host { all: initial; }
330
330
  iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
331
- iframe.on { visibility: visible; }`,w=document.createElement("iframe"),w.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",w.title="สายจากทีมงาน",w.dataset.lwCallFrame=z,w.setAttribute("allowtransparency","true"),w.src=J,Z.append(V,w),document.body.append(W0),o0(),window.addEventListener("message",s6),window.addEventListener("resize",o0),b2(`lw-call:${z}`),h2=setTimeout(()=>{if(!H1)f2("timeout")},j)}function D1(){if(W0)b2(w2?.handle??null,w2?.readableBy);o1(),clearTimeout(h2),window.removeEventListener("message",s6),window.removeEventListener("resize",o0),r1(!1),W0?.remove(),W0=null,w=null,A0=null,U1=null,l=null,m2=null,l0={answer:!1,voice:!1}}function f2(J){let z=U1;D1(),z?.failed(J)}function s6(J){if(!w)return;let z=e3(J,{origin:s1,window:w.contentWindow});if(!z)return;switch(z.type){case"hello":m2?.then(($)=>{if(!w||A0===null)return;if($)c0({type:"token",token:$});else f2("no_token")});return;case"ready":if(H1=!0,clearTimeout(h2),w.classList.add("on"),U1?.ready(),l0.answer)c0({type:"answer"});if(l0.voice)c0({type:"voice"});return;case"size":if(typeof z.width==="number"&&typeof z.height==="number")v2={width:z.width,height:z.height};if(z.layout==="card"||z.layout==="full"){if(z.layout==="full"&&q1==="card")J9();q1=z.layout}return o0();case"drag":return y2(z);case"home":return O0=null,t6(),o0();case"done":{let $=U1;D1(),$?.done();return}case"failed":return f2(z.reason??"failed");case"ink":{let $=d1(z.op);if($)l1($);return}}}function b2(J,z=s1){let $=typeof navigator>"u"?void 0:navigator.mediaDevices;try{$?.setCaptureHandleConfig?.(J&&z?{handle:J,exposeOrigin:!1,permittedOrigins:[z]}:{})}catch{}}var w2=null;function a6(J,z){if(w2={handle:J,readableBy:z},!W0?.isConnected)b2(J,z)}function y2(J){if(!w||q1!=="card"||typeof J.x!=="number"||typeof J.y!=="number")return;if(J.phase==="start"){let z=w.getBoundingClientRect();l={sx:J.x,sy:J.y,x:z.left,y:z.top,lx:J.x,ly:J.y},r1(!0);return}if(!l)return;if(l.lx=J.x,l.ly=J.y,O0=r6({x:l.x+(J.x-l.sx),y:l.y+(J.y-l.sy)},e6(),n1()),o0(),J.phase==="end")l=null,r1(!1),t6()}var G1=null;function r1(J){if(G1){for(let z of["pointermove","pointerup","pointercancel"])window.removeEventListener(z,G1,!0);G1=null}if(!J)return;G1=(z)=>{if(!l)return r1(!1);if(z.type==="pointermove"&&z.buttons!==0)return y2({type:"drag",phase:"move",x:z.screenX,y:z.screenY});let $=z.type==="pointerup";y2({type:"drag",phase:"end",x:$?z.screenX:l.lx,y:$?z.screenY:l.ly})};for(let z of["pointermove","pointerup","pointercancel"])window.addEventListener(z,G1,!0)}function J9(){if(!w?.contentWindow)return;let J=w.getBoundingClientRect();c0({type:"corner",x:Math.round(J.left),y:Math.round(J.top),width:Math.round(J.width)})}function t6(){try{if(O0)sessionStorage.setItem(E2,JSON.stringify(O0));else sessionStorage.removeItem(E2)}catch{}}var n1=()=>({w:window.innerWidth,h:window.innerHeight});function e6(){let J=n1();return{w:Math.min(g2,J.w-s),h:Math.min(v2.height||0,J.h-s)}}function o0(){if(!w)return;let J=w.style;if(q1==="full"){Object.assign(J,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let z=e6(),$=n1().w<480;if(J.width=$?`calc(100vw - ${s}px)`:`${z.w}px`,J.height=`${z.h}px`,O0&&!$){let j=r6(O0,z,n1());Object.assign(J,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(J,{left:$?`${s/2}px`:"",top:"",right:$?"":`${s/2}px`,bottom:`calc(${s/2}px + var(--lw-chat-lift, 0px))`})}var a1=[2000,5000,15000,30000,60000],J8=new Set(["ringing","active"]),z9=20000,z8=!1,n0=!1,$8=0,$9=5,u2=null,K8=0,p2,j8,Q8,G8=(J)=>J.endsWith("/")?J:`${J}/`;function j9(J,z){let $=new URL("api/presence/ws",G8(J));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",z),$.toString()}function Q9(J){if(J.chatId||!J.ticketId)return`/me/chat?call=${J.id}`;return`/me/tickets/${J.ticketId}?call=${J.id}`}function Z9(J){return J.status==="ringing"&&(J.side==="reporter"||J.side===void 0||J.side===null)}var i2=new Set;function U8(J){return i2.add(J),()=>i2.delete(J)}var Z8=()=>M().ring!==!1;async function k0(){let J=M().identity;if(!J)return null;try{return await J()??null}catch{return null}}async function o2(J,z){let $=M();return fetch(new URL(J,G8($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${z}`},body:"{}"})}function r2(){if(z8||typeof window>"u"||typeof WebSocket>"u")return;let J=M();if(!J.identity||J.ring===!1&&!J.chat)return;z8=!0,n0=!1,V9(J.host);try{a6(`lw-tab:${H8()}`,new URL(J.host).origin)}catch{}q8()}function P1(J=!1){if(n0)return;let z=J?a1[a1.length-1]:a1[Math.min(K8++,a1.length-1)];clearTimeout(j8),j8=setTimeout(()=>void q8(),z)}async function q8(){if(n0)return;let J=await k0();if(!J){if(++$8>=$9){n0=!0;return}return P1(!0)}$8=0;let z;try{z=await o2(M().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",J)}catch{return P1()}if(z.status===401||z.status===404||z.status===403){n0=!0;return}if(!z.ok)return P1(z.status===429);let $;try{$=await z.json()}catch{return P1()}if(!$.ticket){n0=!0;return}if($.calls&&$.call&&Z8())Y8($.call);let j=new WebSocket(j9(M().host,$.ticket));u2=j,j.onopen=()=>{K8=0,j.send(JSON.stringify({type:"tab",id:H8()})),clearInterval(p2),p2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},z9)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="chat-changed"||Z.type==="ticket-changed"||Z.type==="chat-seen"){for(let V of i2)V(Z);return}if(Z.type==="call-state"&&Z.call&&typeof Z.call==="object"){if(Z8())Y8(Z.call)}else if(Z.type==="call-ink"&&typeof Z.call==="string"){let V=d1(Z.op);if(V)l2=Z.call,l1(V)}}catch{}},j.onclose=()=>{if(clearInterval(p2),u2===j)u2=null;P1()}}var d2="lw-call-framed";function X9(){try{return sessionStorage.getItem(d2)}catch{return null}}function t1(J){try{if(J)sessionStorage.setItem(d2,J);else sessionStorage.removeItem(d2)}catch{}}var X8=!1;function V9(J){if(X8||typeof document>"u")return;X8=!0;try{let z=new URL(J).origin;for(let $ of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=$,j.href=z,$==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function V8(J){let z=M();if(z.callFrame===!1||r0()===J.id)return;t1(J.id),n6(c6(z.host,z.realmKey,null,J.id),J.id,{ready:()=>m6(J.id),done:()=>{t1(null),d0(J.id)},failed:()=>{t1(null),h6(J,c2(J))}},15000,k0())}var c2=(J)=>({open:()=>W9(J),decline:()=>void Y9(J)}),L0=null;function H8(){if(L0)return L0;try{L0=sessionStorage.getItem(W8)}catch{}if(!L0||!/^[A-Za-z0-9_-]{8,40}$/.test(L0)){let J=new Uint8Array(12);crypto.getRandomValues(J),L0=Array.from(J,(z)=>z.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(W8,L0)}catch{}}return L0}var W8="lw-tab-id",l2=null;function Y8(J){if(!J8.has(J.status)&&l2===J.id&&r0()!==J.id)l2=null,o1();if(!Z9(J)){if(d0(J.id),J.status==="active"&&X9()===J.id&&!r0())V8(J);if(!J8.has(J.status)&&r0()===J.id)setTimeout(()=>{if(r0()===J.id)D1(),t1(null)},12000);return}if(M().callFrame===!1)p1(J,c2(J),"portal");else p1(J,{...c2(J),answer:()=>{v6(J.id),l6(J.id)},voice:()=>o6(J.id)},"frame"),V8(J);clearTimeout(Q8);let z=new Date(J.ringUntil).getTime()-Date.now();Q8=setTimeout(()=>{if(b6()===J.id)d0(J.id)},Math.max(5000,z+5000))}function W9(J){let z=window.open("about:blank","_blank");(async()=>{let $=await k0();if($)o2(`ingest/calls/${J.id}/coming`,$).catch(()=>{return});let j;try{j=await E6(Q9(J))}catch{z?.close();return}if(z&&!z.closed){z.location.href=j;try{z.opener=null}catch{}i1()}else i1(j)})()}async function Y9(J){d0(J.id);let z=await k0();if(z)await o2(`ingest/calls/${J.id}/decline`,z).catch(()=>{return})}var K9="lw-support-chat",G9="lw-support-frame",U9="lw-support-host",$0=56,a0=12,q9='<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>',H9=`
331
+ iframe.on { visibility: visible; }`,w=document.createElement("iframe"),w.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",w.title="สายจากทีมงาน",w.dataset.lwCallFrame=z,w.setAttribute("allowtransparency","true"),w.src=J,Z.append(V,w),document.body.append(Y0),r0(),window.addEventListener("message",t6),window.addEventListener("resize",r0),i2(`lw-call:${z}`),u2=setTimeout(()=>{if(!H1)v2("timeout")},j)}function D1(){if(Y0)i2(g2?.handle??null,g2?.readableBy);o1(),clearTimeout(u2),window.removeEventListener("message",t6),window.removeEventListener("resize",r0),s1(!1),Y0?.remove(),Y0=null,w=null,A0=null,q1=null,r=null,p2=null,l0={answer:!1,voice:!1}}function v2(J){let z=q1;D1(),z?.failed(J)}function t6(J){if(!w)return;let z=$9(J,{origin:t1,window:w.contentWindow});if(!z)return;switch(z.type){case"hello":p2?.then(($)=>{if(!w||A0===null)return;if($)c0({type:"token",token:$});else v2("no_token")});return;case"ready":if(H1=!0,clearTimeout(u2),w.classList.add("on"),q1?.ready(),l0.answer)c0({type:"answer"});if(l0.voice)c0({type:"voice"});return;case"size":if(typeof z.width==="number"&&typeof z.height==="number")b2={width:z.width,height:z.height};if(z.layout==="card"||z.layout==="full"){if(z.layout==="full"&&U1==="card")j9();U1=z.layout}return r0();case"drag":return m2(z);case"home":return O0=null,J8(),r0();case"done":{let $=q1;D1(),$?.done();return}case"failed":return v2(z.reason??"failed");case"ink":{let $=l1(z.op);if($)n1($);return}}}function i2(J,z=t1){let $=typeof navigator>"u"?void 0:navigator.mediaDevices;try{$?.setCaptureHandleConfig?.(J&&z?{handle:J,exposeOrigin:!1,permittedOrigins:[z]}:{})}catch{}}var g2=null;function e6(J,z){if(g2={handle:J,readableBy:z},!Y0?.isConnected)i2(J,z)}function m2(J){if(!w||U1!=="card"||typeof J.x!=="number"||typeof J.y!=="number")return;if(J.phase==="start"){let z=w.getBoundingClientRect();r={sx:J.x,sy:J.y,x:z.left,y:z.top,lx:J.x,ly:J.y},s1(!0);return}if(!r)return;if(r.lx=J.x,r.ly=J.y,O0=s6({x:r.x+(J.x-r.sx),y:r.y+(J.y-r.sy)},z8(),a1()),r0(),J.phase==="end")r=null,s1(!1),J8()}var G1=null;function s1(J){if(G1){for(let z of["pointermove","pointerup","pointercancel"])window.removeEventListener(z,G1,!0);G1=null}if(!J)return;G1=(z)=>{if(!r)return s1(!1);if(z.type==="pointermove"&&z.buttons!==0)return m2({type:"drag",phase:"move",x:z.screenX,y:z.screenY});let $=z.type==="pointerup";m2({type:"drag",phase:"end",x:$?z.screenX:r.lx,y:$?z.screenY:r.ly})};for(let z of["pointermove","pointerup","pointercancel"])window.addEventListener(z,G1,!0)}function j9(){if(!w?.contentWindow)return;let J=w.getBoundingClientRect();c0({type:"corner",x:Math.round(J.left),y:Math.round(J.top),width:Math.round(J.width)})}function J8(){try{if(O0)sessionStorage.setItem(y2,JSON.stringify(O0));else sessionStorage.removeItem(y2)}catch{}}var a1=()=>({w:window.innerWidth,h:window.innerHeight});function z8(){let J=a1();return{w:Math.min(h2,J.w-a),h:Math.min(b2.height||0,J.h-a)}}function r0(){if(!w)return;let J=w.style;if(U1==="full"){Object.assign(J,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let z=z8(),$=a1().w<480;if(J.width=$?`calc(100vw - ${a}px)`:`${z.w}px`,J.height=`${z.h}px`,O0&&!$){let j=s6(O0,z,a1());Object.assign(J,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(J,{left:$?`${a/2}px`:"",top:"",right:$?"":`${a/2}px`,bottom:`calc(${a/2}px + var(--lw-chat-lift, 0px))`})}var e1=[2000,5000,15000,30000,60000],$8=new Set(["ringing","active"]),Q9=20000,j8=!1,o0=!1,Q8=0,Z9=5,d2=null,q8=0,c2,Z8,X8,U8=(J)=>J.endsWith("/")?J:`${J}/`;function X9(J,z){let $=new URL("api/presence/ws",U8(J));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",z),$.toString()}function V9(J){if(J.chatId||!J.ticketId)return`/me/chat?call=${J.id}`;return`/me/tickets/${J.ticketId}?call=${J.id}`}function W9(J){return J.status==="ringing"&&(J.side==="reporter"||J.side===void 0||J.side===null)}var l2=new Set;function H8(J){return l2.add(J),()=>l2.delete(J)}var V8=()=>M().ring!==!1;async function x0(){let J=M().identity;if(!J)return null;try{return await J()??null}catch{return null}}async function s2(J,z){let $=M();return fetch(new URL(J,U8($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${z}`},body:"{}"})}function a2(){if(j8||typeof window>"u"||typeof WebSocket>"u")return;let J=M();if(!J.identity||J.ring===!1&&!J.chat)return;j8=!0,o0=!1,K9(J.host);try{e6(`lw-tab:${P8()}`,new URL(J.host).origin)}catch{}D8()}function P1(J=!1){if(o0)return;let z=J?e1[e1.length-1]:e1[Math.min(q8++,e1.length-1)];clearTimeout(Z8),Z8=setTimeout(()=>void D8(),z)}async function D8(){if(o0)return;let J=await x0();if(!J){if(++Q8>=Z9){o0=!0;return}return P1(!0)}Q8=0;let z;try{z=await s2(M().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",J)}catch{return P1()}if(z.status===401||z.status===404||z.status===403){o0=!0;return}if(!z.ok)return P1(z.status===429);let $;try{$=await z.json()}catch{return P1()}if(!$.ticket){o0=!0;return}if($.calls&&$.call&&V8())G8($.call);let j=new WebSocket(X9(M().host,$.ticket));d2=j,j.onopen=()=>{q8=0,j.send(JSON.stringify({type:"tab",id:P8()})),clearInterval(c2),c2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},Q9)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="chat-changed"||Z.type==="ticket-changed"||Z.type==="chat-seen"){for(let V of l2)V(Z);return}if(Z.type==="call-state"&&Z.call&&typeof Z.call==="object"){if(V8())G8(Z.call)}else if(Z.type==="call-ink"&&typeof Z.call==="string"){let V=l1(Z.op);if(V)o2=Z.call,n1(V)}}catch{}},j.onclose=()=>{if(clearInterval(c2),d2===j)d2=null;P1()}}var r2="lw-call-framed";function Y9(){try{return sessionStorage.getItem(r2)}catch{return null}}function J2(J){try{if(J)sessionStorage.setItem(r2,J);else sessionStorage.removeItem(r2)}catch{}}var W8=!1;function K9(J){if(W8||typeof document>"u")return;W8=!0;try{let z=new URL(J).origin;for(let $ of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=$,j.href=z,$==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function Y8(J){let z=M();if(z.callFrame===!1||n0()===J.id)return;J2(J.id),a6(r6(z.host,z.realmKey,null,J.id),J.id,{ready:()=>u6(J.id),done:()=>{J2(null),d0(J.id)},failed:()=>{J2(null),b6(J,n2(J))}},15000,x0())}var n2=(J)=>({open:()=>G9(J),decline:()=>void q9(J)}),L0=null;function P8(){if(L0)return L0;try{L0=sessionStorage.getItem(K8)}catch{}if(!L0||!/^[A-Za-z0-9_-]{8,40}$/.test(L0)){let J=new Uint8Array(12);crypto.getRandomValues(J),L0=Array.from(J,(z)=>z.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(K8,L0)}catch{}}return L0}var K8="lw-tab-id",o2=null;function G8(J){if(!$8.has(J.status)&&o2===J.id&&n0()!==J.id)o2=null,o1();if(!W9(J)){if(d0(J.id),J.status==="active"&&Y9()===J.id&&!n0())Y8(J);if(!$8.has(J.status)&&n0()===J.id)setTimeout(()=>{if(n0()===J.id)D1(),J2(null)},12000);return}if(M().callFrame===!1)d1(J,n2(J),"portal");else d1(J,{...n2(J),answer:()=>{h6(J.id),n6(J.id)},voice:()=>o6(J.id)},"frame"),Y8(J);clearTimeout(X8);let z=new Date(J.ringUntil).getTime()-Date.now();X8=setTimeout(()=>{if(p6()===J.id)d0(J.id)},Math.max(5000,z+5000))}function G9(J){let z=window.open("about:blank","_blank");(async()=>{let $=await x0();if($)s2(`ingest/calls/${J.id}/coming`,$).catch(()=>{return});let j;try{j=await w6(V9(J))}catch{z?.close();return}if(z&&!z.closed){z.location.href=j;try{z.opener=null}catch{}c1()}else c1(j)})()}async function q9(J){d0(J.id);let z=await x0();if(z)await s2(`ingest/calls/${J.id}/decline`,z).catch(()=>{return})}var U9="lw-support-chat",H9="lw-support-frame",D9="lw-support-host",j0=56,a0=12,P9='<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>',M9=`
332
332
  :host { all: initial; }
333
333
  .bubble {
334
- position: fixed; z-index: 2147483000; width: ${$0}px; height: ${$0}px; border-radius: 50%;
334
+ position: fixed; z-index: 2147483000; width: ${j0}px; height: ${j0}px; border-radius: 50%;
335
335
  display: grid; place-items: center; border: 0; cursor: pointer; padding: 0;
336
- background: #00468f; color: #fff; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 4px 10px -4px rgba(0, 0, 0, 0.2);
336
+ background: var(--lw-chat-color, #00468f); color: #fff; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 4px 10px -4px rgba(0, 0, 0, 0.2);
337
337
  transition: transform 150ms ease, background 150ms ease;
338
- font-family: var(--lw-host-font, ${h1});
338
+ font-family: var(--lw-host-font, ${b1});
339
339
  }
340
- .bubble:hover { background: #003a78; transform: translateY(-1px); }
340
+ .bubble:hover { filter: brightness(0.92); transform: translateY(-1px); }
341
341
  .bubble { touch-action: none; }
342
342
  .bubble.dragging { cursor: grabbing; transform: scale(1.06); transition: none; box-shadow: 0 18px 35px -8px rgba(0, 0, 0, 0.4); }
343
343
  .bubble:focus-visible { outline: 3px solid rgba(0, 70, 143, 0.35); outline-offset: 3px; }
@@ -362,15 +362,15 @@ iframe.on { visibility: visible; }`,w=document.createElement("iframe"),w.allow="
362
362
  content: ""; position: absolute; top: 50%; right: -4px; width: 10px; height: 10px; background: #fff; border-radius: 2px;
363
363
  transform: translateY(-50%) rotate(45deg); box-shadow: 1px -1px 0 rgba(0, 0, 0, 0.04);
364
364
  }
365
- .label .text { display: block; max-width: min(240px, calc(100vw - ${$0+64}px)); overflow: hidden; text-overflow: ellipsis; }
365
+ .label .text { display: block; max-width: min(240px, calc(100vw - ${j0+64}px)); overflow: hidden; text-overflow: ellipsis; }
366
366
  .at-left .label { right: auto; left: calc(100% + 12px); transform: translate(-4px, -50%); }
367
367
  .at-left .label::after { right: auto; left: -4px; }
368
- .new .label { color: #00468f; }
368
+ .new .label { color: var(--lw-chat-color, #00468f); }
369
369
  .labelled .label { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(0, -50%); }
370
370
  @media (hover: hover) { .bubble:hover .label { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(0, -50%); } }
371
371
  .unlabelled .label, .bubble.dragging .label, .open .label { display: none; }
372
372
  .panel {
373
- position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${$0+a0+32}px));
373
+ position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${j0+a0+32}px));
374
374
  border-radius: 20px; overflow: hidden; background: #fff; border: 1px solid rgba(15, 23, 42, 0.08);
375
375
  box-shadow: 0 28px 64px -16px rgba(15, 23, 42, 0.3), 0 10px 24px -10px rgba(15, 23, 42, 0.14);
376
376
  animation: in 180ms cubic-bezier(0.16, 1, 0.3, 1);
@@ -383,4 +383,4 @@ iframe.on { visibility: visible; }`,w=document.createElement("iframe"),w.allow="
383
383
  .open .bubble { display: none; }
384
384
  }
385
385
  @media (prefers-reduced-motion: reduce) { .panel { animation: none; } .bubble, .label { transition: none; } }
386
- `,z0=null,Y0=null,o=null,K0=null,T=null,e1=null,a2=null,S0=!1,s0=0,z4=(J)=>J.endsWith("/")?J:`${J}/`,D9=()=>{try{return new URL(M().host).origin}catch{return"*"}};function P9(J,z){let $=new URL("embed/support",z4(J));return $.searchParams.set("realm",z),$.searchParams.set("hand","1"),$.toString()}function M9(J){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test(J)?J:"/me/chat"}function F9(J){return new URL("support-face.webp",z4(J)).toString()}function B9(J){return J+$0+a0-16}var G0=8,N9=200;function _9(J,z,$,j){return{side:J<$.w/2?"left":"right",x:j,y:M8($.h-z-$0/2,$.h)}}function M8(J,z){return Math.round(Math.min(Math.max(J,G0),Math.max(G0,z-$0-G0)))}function I9(J){return J.side==="right"&&J.y<N9?B9(J.y):0}function C9(J,z){let $=z-(J.y+$0+a0)-16,j=J.y-a0-16;if($>=420||$>=j)return{bottom:J.y+$0+a0,height:Math.max(240,Math.min(640,$))};return{top:z-J.y+a0,height:Math.max(240,Math.min(640,j))}}function F8(J,z,$){return{x:Math.round(Math.min(Math.max(J.x,G0),Math.max(G0,$.w-z.w-G0))),y:Math.round(Math.min(Math.max(J.y,G0),Math.max(G0,$.h-z.h-G0)))}}function O9(J){return J<=0?"":J>99?"99+":String(J)}function B8(J){if(s0=Math.max(0,Math.floor(J)||0),!e1||!T)return;let z=c(M().locale);e1.textContent=O9(s0),e1.hidden=s0===0,T.setAttribute("aria-label",s0?`${z.chatOpen} · ${z.chatUnread.replace("{n}",String(s0))}`:z.chatOpen),Z2()}function L9(J,z){if(J.own===!1)return null;let $=J.unread>0,j=typeof J.own==="string"?J.own.trim().slice(0,60):"";return{text:$?z.chatLabelNew:j||z.chatLabel,shown:!J.open&&($||!J.opened),isNew:$}}var F1=!1;function Z2(){if(!a2||!T)return;let J=M(),z=J.chat&&J.chat!==!0?J.chat.label:void 0,$=L9({own:z,unread:s0,opened:F1,open:S0},c(J.locale));T.classList.toggle("unlabelled",!$),T.classList.toggle("labelled",!!$?.shown),T.classList.toggle("new",!!$?.isNew),T.classList.toggle("at-left",b.side==="left"),a2.querySelector(".text").textContent=$?.text??""}var n2=null;async function J2(){return n2??=(async()=>{try{let J=await k0();if(!J)return void s2(!1);let z=M(),$=await fetch(new URL("ingest/support-unread",z4(z.host)).toString(),{headers:{"x-realm-key":z.realmKey,authorization:`Bearer ${J}`}});if($.status===404||$.status===401||$.status===403)return void s2(!1);if(!$.ok)return;s2(!0);let j=await $.json();if(!S0)B8(typeof j.total==="number"?j.total:0)}catch{}finally{n2=null}})(),n2}function s2(J){if(!z0)return;if(z0.style.display=J?"":"none",J)m1(z0);B1()}var b={side:"right",x:16,y:16},x0=null,S9=380,N8=()=>`lw-support-chat-place:${M().realmKey}`,z2=()=>({w:window.innerWidth,h:window.innerHeight}),$2=!1;function R9(){let J=_1(M().chat);if(J)b={side:J.side,x:J.x,y:J.y};try{let z=JSON.parse(localStorage.getItem(N8())??"null"),$=z?.bubble;if($2=!!$&&($.side==="left"||$.side==="right")&&typeof $.y==="number"&&Number.isFinite($.y),$2)b={...b,side:$.side,y:$.y};let j=z?.panel;x0=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,F1=z?.opened===!0}catch{}}function $4(){try{localStorage.setItem(N8(),JSON.stringify({...$2?{bubble:{side:b.side,y:b.y}}:{},panel:x0,...F1?{opened:!0}:{}}))}catch{}}function B1(){if(!T||!o)return;let J=z2(),z=M8(b.y,J.h),$=b.side==="right"?"left":"right";if(Object.assign(T.style,{[b.side]:`${b.x}px`,[$]:"",bottom:`${z}px`,top:""}),x0){let Q={w:Math.min(S9,J.w-32),h:Math.min(x0.h,J.h-2*G0)},Z=F8(x0,Q,J);Object.assign(o.style,{left:`${Z.x}px`,top:`${Z.y}px`,right:"",bottom:"",height:`${Q.h}px`})}else{let Q=C9({...b,y:z},J.h);Object.assign(o.style,{[b.side]:`${b.x}px`,[$]:"",bottom:Q.bottom!==void 0?`${Q.bottom}px`:"",top:Q.top!==void 0?`${Q.top}px`:"",height:`${Q.height}px`})}let j=z0&&z0.style.display!=="none"?I9({...b,y:z}):0;if(j)document.documentElement.style.setProperty("--lw-chat-lift",`${j}px`);else document.documentElement.style.removeProperty("--lw-chat-lift");Z2()}var J0=null,t2=!1;function T9(J){if(J.button!==0)return;J0={id:J.pointerId,sx:J.clientX,sy:J.clientY,moved:!1};try{T?.setPointerCapture(J.pointerId)}catch{}}function A9(J){if(!J0||J.pointerId!==J0.id||!T)return;if(!J0.moved&&Math.hypot(J.clientX-J0.sx,J.clientY-J0.sy)<6)return;J0.moved=!0,T.classList.add("dragging"),Object.assign(T.style,{left:`${J.clientX-$0/2}px`,top:`${J.clientY-$0/2}px`,right:"",bottom:""})}function D8(J){if(!J0||J.pointerId!==J0.id)return;let z=J0;if(J0=null,T?.classList.remove("dragging"),!z.moved)return;if(t2=!0,setTimeout(()=>t2=!1,0),J.type==="pointerup")b=_9(J.clientX,J.clientY,z2(),_1(M().chat)?.x??16),$2=!0,x0=null,$4();B1()}var d=null;function e2(J){if(!o||typeof J.x!=="number"||typeof J.y!=="number"||z2().w<640)return;if(J.phase==="start"){let z=o.getBoundingClientRect();d={sx:J.x,sy:J.y,x:z.left,y:z.top,lx:J.x,ly:J.y,h:Math.round(z.height)||640},J4(!0);return}if(!d)return;if(d.lx=J.x,d.ly=J.y,x0={...F8({x:d.x+(J.x-d.sx),y:d.y+(J.y-d.sy)},{w:o.offsetWidth,h:d.h},z2()),h:d.h},B1(),J.phase==="end")d=null,J4(!1),$4()}var M1=null;function J4(J){if(M1){for(let z of["pointermove","pointerup","pointercancel"])window.removeEventListener(z,M1,!0);M1=null}if(!J)return;M1=(z)=>{if(!d)return J4(!1);if(z.type==="pointermove"&&z.buttons!==0)return e2({phase:"move",x:z.screenX,y:z.screenY});let $=z.type==="pointerup";e2({phase:"end",x:$?z.screenX:d.lx,y:$?z.screenY:d.ly})};for(let z of["pointermove","pointerup","pointercancel"])window.addEventListener(z,M1,!0)}var k9=()=>B1();function j2(J){K0?.contentWindow?.postMessage({source:U9,...J},D9())}async function x9(J){if(!K0||J.source!==K0.contentWindow)return;let z=J.data;if(!z||z.source!==G9)return;if(z.type==="hello"){let $=await k0();if($)j2({type:"token",token:$,can:["portal"]});return}if(z.type==="portal"){f6({returnTo:M9(typeof z.path==="string"?z.path:"")});return}if(z.type==="ready")return j2({type:S0?"shown":"hidden"});if(z.type==="close")return Q2();if(z.type==="drag")return e2(z);if(z.type==="unread"&&typeof z.total==="number")return B8(z.total);if(z.type==="report")Q2(!1),h0({type:"manual",fromChat:!0})}var E9=(J)=>void x9(J);function f9(J){if(S0&&J.key==="Escape")Q2()}function j4(){if(!z0||!o||!Y0)X2();if(!o)return;let J=M();if(!K0)K0=document.createElement("iframe"),K0.src=P9(J.host,J.realmKey),K0.title=c(J.locale).chatTitle,K0.setAttribute("allow","clipboard-write"),o.append(K0);if(S0=!0,!F1)F1=!0,$4();o.hidden=!1,Y0?.querySelector(".wrap")?.classList.add("open"),T?.setAttribute("aria-expanded","true"),Z2(),j2({type:"shown"}),K0.focus()}function Q2(J=!0){if(!o)return;if(S0=!1,o.hidden=!0,Y0?.querySelector(".wrap")?.classList.remove("open"),T?.setAttribute("aria-expanded","false"),Z2(),j2({type:"hidden"}),J)T?.focus();J2()}var w9=null,P8=0;function y9(){if(Date.now()-P8<30000)return;P8=Date.now(),J2()}function X2(){if(z0||typeof document>"u")return;let J=M();if(!_1(J.chat)||!J.identity)return;let $=c(J.locale);z0=document.createElement(K9),z0.style.display="none",Y0=z0.attachShadow({mode:"open"}),Y0.innerHTML=`<style>${H9}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${$.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${$.chatOpen}" title="${$.chatMove}">${q9}<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>`,o=Y0.querySelector(".panel"),T=Y0.querySelector(".bubble"),e1=Y0.querySelector(".badge"),a2=Y0.querySelector(".label");let j=Y0.querySelector(".face");j.addEventListener("load",()=>T?.classList.add("has-face"),{once:!0}),j.src=F9(J.host),R9(),B1(),T.addEventListener("click",()=>{if(t2)return;if(S0)Q2();else j4()}),T.addEventListener("pointerdown",T9),T.addEventListener("pointermove",A9),T.addEventListener("pointerup",D8),T.addEventListener("pointercancel",D8),document.body.append(z0),window.addEventListener("message",E9),document.addEventListener("keydown",f9),window.addEventListener("focus",y9),window.addEventListener("resize",k9);let Q;w9=U8(()=>{if(S0)return;clearTimeout(Q),Q=setTimeout(()=>void J2(),500)}),J2()}var _8=!1;function Q4(J={}){if(_8||typeof window>"u")return;if(!I1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(_8=!0,o4(),S4(),N4(),h4(),t4(),J.ui===!1)return;let z=c(M().locale);if(f4((j)=>{m0(j.message??z.crashed,"error",{label:z.crashAction,onClick:()=>h0(j)})}),T6(),!document.querySelector(W1))document.body.append(document.createElement(W1));let $=window.requestIdleCallback;if($)$(()=>void b0(),{timeout:5000});else setTimeout(()=>void b0(),2000);if($)$(()=>r2(),{timeout:8000});else setTimeout(()=>r2(),3000);if(M().chat)if(!M().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if($)$(()=>X2(),{timeout:4000});else setTimeout(()=>X2(),1500)}var I8=document.currentScript,m=I8?.dataset??{},g9="rrweb-record.mjs";a4(()=>import(new URL(g9,I8?.src??location.href).href));function v9(J){if(!J)return{};try{let z=JSON.parse(J);if(!z||typeof z!=="object"||Array.isArray(z))return{};return Object.fromEntries(Object.entries(z).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(m.host&&m.realmKey)if(X4({host:m.host,realmKey:m.realmKey,app:{name:m.appName??document.title??"app",version:m.appVersion??"0.0.0",environment:m.environment??"production"},module:Y4(v9(m.modules)),locale:m.locale==="en"?"en":"th",...m.replay!==void 0?{replay:{seconds:Number(m.replay)||void 0}}:{},...m.identityUrl?{identity:()=>fetch(m.identityUrl,{credentials:"include"}).then((J)=>J.ok?J.text():null).catch(()=>null)}:{},...m.chat!==void 0&&m.chat!=="false"?{chat:m.chat==="left"?{position:"left"}:!0}:{}}),document.body)Q4();else document.addEventListener("DOMContentLoaded",()=>Q4(),{once:!0});window.lwReportProblem=h0;window.lwOpenSupportChat=j4;})();
386
+ `,c=null,z0=null,n=null,K0=null,S=null,$2=null,t2=null,S0=!1,s0=0,W2=(J)=>J.endsWith("/")?J:`${J}/`,B9=()=>{try{return new URL(M().host).origin}catch{return"*"}};function F9(J,z){let $=new URL("embed/support",W2(J));return $.searchParams.set("realm",z),$.searchParams.set("hand","1"),$.toString()}function N9(J){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test(J)?J:"/me/chat"}function e2(J){return new URL("support-face.webp",W2(J)).toString()}function _9(J){return J+j0+a0-16}var G0=8,I9=200;function C9(J,z,$,j){return{side:J<$.w/2?"left":"right",x:j,y:F8($.h-z-j0/2,$.h)}}function F8(J,z){return Math.round(Math.min(Math.max(J,G0),Math.max(G0,z-j0-G0)))}function O9(J){return J.side==="right"&&J.y<I9?_9(J.y):0}function L9(J,z){let $=z-(J.y+j0+a0)-16,j=J.y-a0-16;if($>=420||$>=j)return{bottom:J.y+j0+a0,height:Math.max(240,Math.min(640,$))};return{top:z-J.y+a0,height:Math.max(240,Math.min(640,j))}}function N8(J,z,$){return{x:Math.round(Math.min(Math.max(J.x,G0),Math.max(G0,$.w-z.w-G0))),y:Math.round(Math.min(Math.max(J.y,G0),Math.max(G0,$.h-z.h-G0)))}}function S9(J){return J<=0?"":J>99?"99+":String(J)}function _8(J){if(s0=Math.max(0,Math.floor(J)||0),!$2||!S)return;let z=l(M().locale);$2.textContent=S9(s0),$2.hidden=s0===0,S.setAttribute("aria-label",s0?`${z.chatOpen} · ${z.chatUnread.replace("{n}",String(s0))}`:z.chatOpen),N1()}function R9(J,z){if(J.own===!1)return null;let $=J.unread>0,j=typeof J.own==="string"?J.own.trim().slice(0,60):"";return{text:$?z.chatLabelNew:j||z.chatLabel,shown:!J.open&&($||!J.opened),isNew:$}}var F1=!1;function N1(){if(!t2||!S)return;let J=M(),z=J.chat&&J.chat!==!0?J.chat.label:void 0,$=z!==void 0?z:j4?.label,j=R9({own:$,unread:s0,opened:F1,open:S0},l(J.locale));S.classList.toggle("unlabelled",!j),S.classList.toggle("labelled",!!j?.shown),S.classList.toggle("new",!!j?.isNew),S.classList.toggle("at-left",b.side==="left"),t2.querySelector(".text").textContent=j?.text??""}var j4=null;function I8(J,z){if(!z||z.faceUrl===void 0)return e2(J);if(z.faceUrl===null)return null;try{return new URL(z.faceUrl.replace(/^\//,""),W2(J)).toString()}catch{return e2(J)}}function T9(J){if(j4=J,!c||!S)return;let z=J?.color&&/^#[0-9a-f]{6}$/i.test(J.color)?J.color:null;if(z)c.style.setProperty("--lw-chat-color",z);else c.style.removeProperty("--lw-chat-color");let $=z0?.querySelector(".face"),j=I8(M().host,J);if($){if(!j)S.classList.remove("has-face"),$.removeAttribute("src");else if($.getAttribute("src")!==j)S.classList.remove("has-face"),$.src=j}N1()}var M1=null;async function j2(){if(M1)return M1;let J=A9();M1=J;try{await J}finally{if(M1===J)M1=null}}async function A9(){try{let J=M(),z=J.chat&&J.chat!==!0?J.chat:null;if(z?.show&&!z.show())return void z2(!1);let $=await x0();if(!$)return void z2(!1);let j=await fetch(new URL("ingest/support-unread",W2(J.host)).toString(),{headers:{"x-realm-key":J.realmKey,authorization:`Bearer ${$}`}});if(j.status===404||j.status===401||j.status===403)return void z2(!1);if(!j.ok)return;let Q=await j.json();if(Q.look&&typeof Q.look==="object")T9(Q.look);if(z2(!0),!S0)_8(typeof Q.total==="number"?Q.total:0)}catch{}}function z2(J){if(!c)return;if(c.style.display=J?"":"none",J)u1(c);_1()}var b={side:"right",x:16,y:16},E0=null,x9=380,C8=()=>`lw-support-chat-place:${M().realmKey}`,Q2=()=>({w:window.innerWidth,h:window.innerHeight}),Z2=!1;function E9(){let J=C1(M().chat);if(J)b={side:J.side,x:J.x,y:J.y};try{let z=JSON.parse(localStorage.getItem(C8())??"null"),$=z?.bubble;if(Z2=!!$&&($.side==="left"||$.side==="right")&&typeof $.y==="number"&&Number.isFinite($.y),Z2)b={...b,side:$.side,y:$.y};let j=z?.panel;E0=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,F1=z?.opened===!0}catch{}}function Q4(){try{localStorage.setItem(C8(),JSON.stringify({...Z2?{bubble:{side:b.side,y:b.y}}:{},panel:E0,...F1?{opened:!0}:{}}))}catch{}}function _1(){if(!S||!n)return;let J=Q2(),z=F8(b.y,J.h),$=b.side==="right"?"left":"right";if(Object.assign(S.style,{[b.side]:`${b.x}px`,[$]:"",bottom:`${z}px`,top:""}),E0){let Q={w:Math.min(x9,J.w-32),h:Math.min(E0.h,J.h-2*G0)},Z=N8(E0,Q,J);Object.assign(n.style,{left:`${Z.x}px`,top:`${Z.y}px`,right:"",bottom:"",height:`${Q.h}px`})}else{let Q=L9({...b,y:z},J.h);Object.assign(n.style,{[b.side]:`${b.x}px`,[$]:"",bottom:Q.bottom!==void 0?`${Q.bottom}px`:"",top:Q.top!==void 0?`${Q.top}px`:"",height:`${Q.height}px`})}let j=c&&c.style.display!=="none"?O9({...b,y:z}):0;if(j)document.documentElement.style.setProperty("--lw-chat-lift",`${j}px`);else document.documentElement.style.removeProperty("--lw-chat-lift");N1()}var $0=null,J4=!1;function k9(J){if(J.button!==0)return;$0={id:J.pointerId,sx:J.clientX,sy:J.clientY,moved:!1};try{S?.setPointerCapture(J.pointerId)}catch{}}function f9(J){if(!$0||J.pointerId!==$0.id||!S)return;if(!$0.moved&&Math.hypot(J.clientX-$0.sx,J.clientY-$0.sy)<6)return;$0.moved=!0,S.classList.add("dragging"),Object.assign(S.style,{left:`${J.clientX-j0/2}px`,top:`${J.clientY-j0/2}px`,right:"",bottom:""})}function M8(J){if(!$0||J.pointerId!==$0.id)return;let z=$0;if($0=null,S?.classList.remove("dragging"),!z.moved)return;if(J4=!0,setTimeout(()=>J4=!1,0),J.type==="pointerup")b=C9(J.clientX,J.clientY,Q2(),C1(M().chat)?.x??16),Z2=!0,E0=null,Q4();_1()}var d=null;function z4(J){if(!n||typeof J.x!=="number"||typeof J.y!=="number"||Q2().w<640)return;if(J.phase==="start"){let z=n.getBoundingClientRect();d={sx:J.x,sy:J.y,x:z.left,y:z.top,lx:J.x,ly:J.y,h:Math.round(z.height)||640},$4(!0);return}if(!d)return;if(d.lx=J.x,d.ly=J.y,E0={...N8({x:d.x+(J.x-d.sx),y:d.y+(J.y-d.sy)},{w:n.offsetWidth,h:d.h},Q2()),h:d.h},_1(),J.phase==="end")d=null,$4(!1),Q4()}var B1=null;function $4(J){if(B1){for(let z of["pointermove","pointerup","pointercancel"])window.removeEventListener(z,B1,!0);B1=null}if(!J)return;B1=(z)=>{if(!d)return $4(!1);if(z.type==="pointermove"&&z.buttons!==0)return z4({phase:"move",x:z.screenX,y:z.screenY});let $=z.type==="pointerup";z4({phase:"end",x:$?z.screenX:d.lx,y:$?z.screenY:d.ly})};for(let z of["pointermove","pointerup","pointercancel"])window.addEventListener(z,B1,!0)}var w9=()=>_1();function X2(J){K0?.contentWindow?.postMessage({source:D9,...J},B9())}async function y9(J){if(!K0||J.source!==K0.contentWindow)return;let z=J.data;if(!z||z.source!==H9)return;if(z.type==="hello"){let $=await x0();if($)X2({type:"token",token:$,can:["portal"]});return}if(z.type==="portal"){y6({returnTo:N9(typeof z.path==="string"?z.path:"")});return}if(z.type==="ready")return X2({type:S0?"shown":"hidden"});if(z.type==="close")return V2();if(z.type==="drag")return z4(z);if(z.type==="unread"&&typeof z.total==="number")return _8(z.total);if(z.type==="report")V2(!1),m0({type:"manual",fromChat:!0})}var v9=(J)=>void y9(J);function g9(J){if(S0&&J.key==="Escape")V2()}function Z4(){if(!c||!n||!z0)Y2();if(!n)return;let J=M();if(!K0)K0=document.createElement("iframe"),K0.src=F9(J.host,J.realmKey),K0.title=l(J.locale).chatTitle,K0.setAttribute("allow","clipboard-write"),n.append(K0);if(S0=!0,!F1)F1=!0,Q4();n.hidden=!1,z0?.querySelector(".wrap")?.classList.add("open"),S?.setAttribute("aria-expanded","true"),N1(),X2({type:"shown"}),K0.focus()}function V2(J=!0){if(!n)return;if(S0=!1,n.hidden=!0,z0?.querySelector(".wrap")?.classList.remove("open"),S?.setAttribute("aria-expanded","false"),N1(),X2({type:"hidden"}),J)S?.focus();j2()}var m9=null,B8=0;function h9(){if(Date.now()-B8<30000)return;B8=Date.now(),j2()}function Y2(){if(c||typeof document>"u")return;let J=M();if(!C1(J.chat)||!J.identity)return;let $=l(J.locale);c=document.createElement(U9),c.style.display="none",z0=c.attachShadow({mode:"open"}),z0.innerHTML=`<style>${M9}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${$.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${$.chatOpen}" title="${$.chatMove}">${P9}<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>`,n=z0.querySelector(".panel"),S=z0.querySelector(".bubble"),$2=z0.querySelector(".badge"),t2=z0.querySelector(".label");let j=z0.querySelector(".face");j.addEventListener("load",()=>{if(j.getAttribute("src"))S?.classList.add("has-face")}),j.addEventListener("error",()=>S?.classList.remove("has-face")),j.src=I8(J.host,j4)??e2(J.host),E9(),_1(),S.addEventListener("click",()=>{if(J4)return;if(S0)V2();else Z4()}),S.addEventListener("pointerdown",k9),S.addEventListener("pointermove",f9),S.addEventListener("pointerup",M8),S.addEventListener("pointercancel",M8),document.body.append(c),window.addEventListener("message",v9),document.addEventListener("keydown",g9),window.addEventListener("focus",h9),window.addEventListener("resize",w9);let Q;m9=H8(()=>{if(S0)return;clearTimeout(Q),Q=setTimeout(()=>void j2(),500)}),j2()}var O8=!1;function X4(J={}){if(O8||typeof window>"u")return;if(!O1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(O8=!0,o4(),T4(),I4(),b4(),J6(),J.ui===!1)return;let z=l(M().locale);if(y4((j)=>{h0(j.message??z.crashed,"error",{label:z.crashAction,onClick:()=>m0(j)})}),x6(),!document.querySelector(W1))document.body.append(document.createElement(W1));let $=window.requestIdleCallback;if($)$(()=>void b0(),{timeout:5000});else setTimeout(()=>void b0(),2000);if($)$(()=>a2(),{timeout:8000});else setTimeout(()=>a2(),3000);if(M().chat)if(!M().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if($)$(()=>Y2(),{timeout:4000});else setTimeout(()=>Y2(),1500)}var L8=document.currentScript,h=L8?.dataset??{},b9="rrweb-record.mjs";e4(()=>import(new URL(b9,L8?.src??location.href).href));function u9(J){if(!J)return{};try{let z=JSON.parse(J);if(!z||typeof z!=="object"||Array.isArray(z))return{};return Object.fromEntries(Object.entries(z).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(h.host&&h.realmKey)if(W4({host:h.host,realmKey:h.realmKey,app:{name:h.appName??document.title??"app",version:h.appVersion??"0.0.0",environment:h.environment??"production"},module:G4(u9(h.modules)),locale:h.locale==="en"?"en":"th",...h.replay!==void 0?{replay:{seconds:Number(h.replay)||void 0}}:{},...h.identityUrl?{identity:()=>fetch(h.identityUrl,{credentials:"include"}).then((J)=>J.ok?J.text():null).catch(()=>null)}:{},...h.chat!==void 0&&h.chat!=="false"?{chat:h.chat==="left"?{position:"left"}:!0}:{}}),document.body)X4();else document.addEventListener("DOMContentLoaded",()=>X4(),{once:!0});window.lwReportProblem=m0;window.lwOpenSupportChat=Z4;})();