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