@lightworkai.official/debug-capture 0.17.2 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/debug-capture.js +9 -9
- package/dist/index.mjs +15 -15
- package/dist/rrweb-record.mjs +3 -3
- package/dist/ui/callFrame.d.ts +1 -0
- package/package.json +2 -2
- package/src/live.ts +49 -3
- package/src/ui/callFrame.ts +14 -3
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var x6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var f6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},d=null;function w6(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");d=z}function N(){if(!d)throw Error("[debug-capture] configureDebugCapture() has not been called");return d}function m0(){return d!==null}function e(){let z=N().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??b6()}}function b6(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function K0(z){let J=d?.capture?.[z];return typeof J==="number"?J:f6[z]}function Q1(z){let J=d?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function Z1(){let z=d?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function g2(){return d?.capture?.overlaySelectors??[]}var g6='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',v6="[data-lw-mask]",b2={fps:1,quality:0.5};function u0(){let z=d?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,Y)=>typeof Z==="number"&&Z>0?Z:Y,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,b2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,b2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?g6:v6),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function v2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(y6(J))return!1;if(J.origin===window.location.origin)return!0;return(d?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function y6(z){if(!d?.host)return!1;try{if(new URL(d.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function h6(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var S0="‹redacted›",m6=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,u6=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),p6=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,d6=/[\w.+-]+@[\w-]+\.[\w.-]+/g,i6=/\d(?:[\d\s-]{7,})\d/g;function L0(z){return z.replace(d6,S0).replace(i6,S0)}function c6(z){if(m6.test(z))return!0;return Z1().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function R0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=c6($)?S0:j;return J}function J0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(u6.has(Z.toLowerCase())||Z1().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,S0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function g1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>g1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=p6.test(j)||Z1().bodyKeys.some((Y)=>j.toLowerCase().includes(Y));$[j]=Z?S0:g1(Q,J+1)}return $}function A0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(g1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var v1=120,y1=40,k0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,h1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},T0=[],y2=0,h2=!1;function p0(z,J,$,j){let Q=k0(J,v1),Z=T0[T0.length-1];if(z==="navigate"&&Z?.kind==="click"){let V=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${V}`))return Z.at=new Date().toISOString(),Z;let G=V.split(/[?#]/)[0]??V,H=Z.source?h1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(H&&(G===H||G.startsWith(H)))return Z.detail=k0(`${Z.detail} → ${V}`,v1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}y2+=1;let Y={id:`act_${y2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:Y1(j)};T0.push(Y);while(T0.length>K0("maxActions"))o6(T0.shift());return Y}var l6=200000,d0=0;function Y1(z){if(!z)return;if(d0+z.length>l6)return;return d0+=z.length,z}function o6(z){if(!z)return;if(d0-=(z.html?.length??0)+(z.afterHtml?.length??0),d0<0)d0=0}function m1(z){return z&&z>1?` (×${z})`:""}function X1(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var r6='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',n6={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},m2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function s6(z){let J=z.getAttribute("role");if(J&&m2[J])return m2[J];return n6[z.tagName.toLowerCase()]??"ปุ่ม"}function a6(z,J){try{let $=z,j=0;while($&&j<=J){let Q=l2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function t6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return h1(Q)}return""}function e6(z){if(!(z instanceof Element))return null;let J=z.closest(r6)??a6(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function z8(z){let J=L0(t6(z));if(!J)return null;return`${s6(z)} “${k0(J,y1)}”`}var c2=6000,J8=4000,$8=/(?:^|\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 j8(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let Y of Array.from(Q.attributes)){let V=Y.name.toLowerCase();if(V.startsWith("on")||V==="srcdoc"||V==="value"||V.startsWith("data-"))Q.removeAttribute(Y.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let Y=Z.replace($8," ").replace(/\s+/g," ").trim();if(Y)Q.setAttribute("class",Y);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=L0(j.nodeValue);j=$.nextNode()}}function u1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);j8(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var Q8=(z)=>u1(z,c2,J8),Z8=150000,X8=40000,u2=(z)=>u1(z,Z8,X8);function Y8(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${L0(J)}”`}var p2=80;function l2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function V8(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function d2(z){if(!z)return;return`→ ${z.length>p2?`${z.slice(0,p2)}…`:z}`}function K8(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return d2(J);let $=l2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return d2(V8($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var W8='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function G8(){let z=g2();return z.length?z.join(", "):W8}function U8(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function H8(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((Y)=>document.getElementById(Y)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function o2(z){let J=L0(H8(z)),$=U8(z);return J?`เปิด ${$} “${k0(J,y1)}”`:`เปิด ${$}`}var P8='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',D8=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function F8(z){if(z.querySelector(P8))return!0;return D8.test(z.textContent??"")}var q8=400,B8=250,M8=8000;function N8(z,J){if(typeof MutationObserver>"u"){J.html=Y1(u2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,Y.disconnect(),window.clearInterval(V),window.clearTimeout(G)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=k0(o2(z),v1),J.html=Y1(u2(z))},Y=new MutationObserver(()=>{$=Date.now()});Y.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let V=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=q8&&!F8(z))Z()},B8),G=window.setTimeout(Z,M8)}function I8(z){if(X1(z))return;let J=p0("ui",o2(z));if(J)N8(z,J)}function C8(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=G8(),Y=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let V of Y){if(z.has(V))continue;z.add(V),I8(V)}}}).observe(document.body,{childList:!0,subtree:!0})}var _8=1600,O8=2500;function i2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:k0((z.textContent??"").replace(/\s+/g," ").trim(),y1)}}function S8(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function L8(z,J){if(typeof MutationObserver>"u")return;let $=i2(z),j=!1,Q=(V,G)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(Y),J.afterNote=V,G)J.afterHtml=Y1(u1(z,c2,O8))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let V=S8($,i2(z));if(V)Q(V,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Y=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},_8)}function r2(){if(h2||typeof window>"u")return;h2=!0,document.addEventListener("click",(j)=>{if(X1(j.target))return;let Q=e6(j.target);if(!Q)return;let Z=z8(Q);if(!Z)return;let Y=p0("click",`คลิก ${Z}`,K8(Q),Q8(Q));if(Y)L8(Q,Y)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(X1(j.target))return;let Q=Y8(j.target);if(Q)p0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(X1(j.target))return;p0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>p0("navigate",`ไปที่ ${h1(J0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),C8()}function p1(){return T0.map((z)=>({...z}))}var n2=2000,V1=[],s2=0,a2=!1;function d1(z,J){s2+=1,V1.push({id:`log_${s2}`,at:new Date().toISOString(),level:z,message:J.length>n2?`${J.slice(0,n2)}…`:J});while(V1.length>K0("maxConsoleEntries"))V1.shift()}function R8(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function t2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,R8());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function e2(){if(a2||typeof window>"u")return;a2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{d1(J,j.map(t2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";d1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:t2(J.reason);d1("unhandledrejection",$)})}function i1(){return V1.map((z)=>({...z}))}var z4=new Set,J4=new Set;function $4(z,J){return z.add(J),()=>z.delete(J)}function j4(z,J){for(let $ of[...z])$(J)}function c1(z){return $4(z4,z)}function l1(z={type:"manual"}){j4(z4,z)}function o1(z){return $4(J4,z)}function r1(z){j4(J4,z)}var A8=15000,T8=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],Q4=!1,Z4=0;function k8(z){return T8.some((J)=>z.includes(J))}function X4(z){let J=z.message??"";if(!J||k8(J))return;let $=Date.now();if($-Z4<A8)return;Z4=$,r1({...z,message:J})}function Y4(){if(Q4||typeof window>"u")return;Q4=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;X4({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;X4({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var G4=4000,E8=1e6,x8=1e7,K1=[],V4=0,K4=!1;function U4(z){K1.push(z);while(K1.length>K0("maxRequests"))K1.shift()}function H4(){return V4+=1,`req_${V4}`}function W4(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function f8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function w8(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function b8(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=W4(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...W4(J.headers)};if(J.body!==void 0)Z=w8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function P4(z){return!v2(z)}function g8(z,J){if(P4(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>E8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=A0(Z,K0("maxBodyChars"))}).catch(()=>{})}catch{}}function D4(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function v8(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=b8(J,$);if(D4(j.url,j.headers))return z(J,$);let Q={id:H4(),startedAt:new Date().toISOString(),method:j.method,url:J0(j.url),requestHeaders:R0(j.headers),requestBody:A0(j.body,G4),status:null,statusText:null,durationMs:null,via:"fetch"};U4(Q);let Z=performance.now();try{let Y=await z(J,$);return Q.status=Y.status,Q.statusText=Y.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=R0(f8(Y.headers)),g8(Y,Q),Y}catch(Y){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=Y instanceof Error?`${Y.name}: ${Y.message}`:String(Y),Y}},z)}function y8(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,Y){let V=typeof Y==="string"?Y:Y.toString();return this.__lwEntry=D4(V,{})?void 0:{id:H4(),startedAt:"",method:(Z||"GET").toUpperCase(),url:J0(V),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let Y=this.__lwEntry;if(Y){Y.startedAt=new Date().toISOString(),Y.requestBody=typeof Z==="string"?A0(Z,G4):Z==null?null:"[non-string body]";let V=performance.now();U4(Y),this.addEventListener("loadend",()=>{if(Y.status=this.status||null,Y.statusText=this.statusText||null,Y.durationMs=Math.round(performance.now()-V),P4(Y.url))Y.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Y.responseSnippet=A0(this.responseText||"",K0("maxBodyChars"))}catch{}else{let G=this.getResponseHeader("content-type")??this.responseType;Y.responseSnippet=`[binary ${G}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function F4(){if(K4)return;K4=!0,v8(),y8()}function n1(){let z=K1.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>x8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var h8=4,q4=3,m8=4000,u8="[data-debug-reporter]",p8=()=>import("@rrweb/record");var i=[],E0=null,W1=!1;function B4(){if(typeof window>"u"||E0||W1)return;let z=u0();if(!z)return;W1=!0;let J=()=>void d8(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function d8(z){let J;try{J=(await p8()).record}catch($){W1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(E0)return;try{E0=J({emit:($)=>i8($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:m8,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${u8}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{W1=!1}}function i8(z){if(z.type===h8||i.length===0){if(i.push([]),i.length>q4)i=i.slice(-q4)}i[i.length-1].push(z)}function s1(z=Date.now()){let J=u0();if(!J||!i.length)return null;let $=z-J.seconds*1000,j=i.length-1;while(j>0&&(i[j][0]?.timestamp??z)>$)j-=1;let Q=i.slice(j).flat(),Z=Q[0]?.timestamp,Y=Q[Q.length-1]?.timestamp;if(Z===void 0||Y===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(Y).toISOString(),durationMs:Math.max(0,Y-Z)}}function c8(){return E0!==null}function l8(){E0?.(),E0=null,i=[]}var o8={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก"},r8={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call",ringHint:"When you answer, your browser asks for the microphone · during the call the team may ask to see your screen — you always choose",ringTest:"Test the microphone and speaker first",ringAnswer:"Answer",ringAnswering:"Answering…",ringFallback:"The call can't open on this page — answer in a new tab instead, already signed in"};function $0(z){return z==="en"?r8:o8}var n8="lw-debug-toasts",s8=6000,a8=`
|
|
1
|
+
var h6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var m6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},d=null;function u6(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");d=z}function N(){if(!d)throw Error("[debug-capture] configureDebugCapture() has not been called");return d}function p0(){return d!==null}function e(){let z=N().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??p6()}}function p6(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function K0(z){let J=d?.capture?.[z];return typeof J==="number"?J:m6[z]}function X1(z){let J=d?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function V1(){let z=d?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function p2(){return d?.capture?.overlaySelectors??[]}var d6='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',i6="[data-lw-mask]",u2={fps:1,quality:0.5};function d0(){let z=d?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,V)=>typeof Z==="number"&&Z>0?Z:V,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,u2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,u2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?d6:i6),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function d2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(c6(J))return!1;if(J.origin===window.location.origin)return!0;return(d?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function c6(z){if(!d?.host)return!1;try{if(new URL(d.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function l6(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var L0="‹redacted›",o6=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,r6=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),n6=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,s6=/[\w.+-]+@[\w-]+\.[\w.-]+/g,a6=/\d(?:[\d\s-]{7,})\d/g;function R0(z){return z.replace(s6,L0).replace(a6,L0)}function t6(z){if(o6.test(z))return!0;return V1().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function A0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=t6($)?L0:j;return J}function $0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(r6.has(Z.toLowerCase())||V1().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,L0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function m1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>m1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=n6.test(j)||V1().bodyKeys.some((V)=>j.toLowerCase().includes(V));$[j]=Z?L0:m1(Q,J+1)}return $}function T0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(m1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var u1=120,p1=40,E0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,d1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},k0=[],i2=0,c2=!1;function i0(z,J,$,j){let Q=E0(J,u1),Z=k0[k0.length-1];if(z==="navigate"&&Z?.kind==="click"){let Y=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${Y}`))return Z.at=new Date().toISOString(),Z;let G=Y.split(/[?#]/)[0]??Y,H=Z.source?d1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(H&&(G===H||G.startsWith(H)))return Z.detail=E0(`${Z.detail} → ${Y}`,u1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}i2+=1;let V={id:`act_${i2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:K1(j)};k0.push(V);while(k0.length>K0("maxActions"))z8(k0.shift());return V}var e6=200000,c0=0;function K1(z){if(!z)return;if(c0+z.length>e6)return;return c0+=z.length,z}function z8(z){if(!z)return;if(c0-=(z.html?.length??0)+(z.afterHtml?.length??0),c0<0)c0=0}function i1(z){return z&&z>1?` (×${z})`:""}function Y1(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var J8='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',$8={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},l2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function j8(z){let J=z.getAttribute("role");if(J&&l2[J])return l2[J];return $8[z.tagName.toLowerCase()]??"ปุ่ม"}function Q8(z,J){try{let $=z,j=0;while($&&j<=J){let Q=t2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function Z8(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return d1(Q)}return""}function X8(z){if(!(z instanceof Element))return null;let J=z.closest(J8)??Q8(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function V8(z){let J=R0(Z8(z));if(!J)return null;return`${j8(z)} “${E0(J,p1)}”`}var a2=6000,Y8=4000,K8=/(?:^|\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 W8(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let V of Array.from(Q.attributes)){let Y=V.name.toLowerCase();if(Y.startsWith("on")||Y==="srcdoc"||Y==="value"||Y.startsWith("data-"))Q.removeAttribute(V.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let V=Z.replace(K8," ").replace(/\s+/g," ").trim();if(V)Q.setAttribute("class",V);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=R0(j.nodeValue);j=$.nextNode()}}function c1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);W8(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var G8=(z)=>c1(z,a2,Y8),U8=150000,H8=40000,o2=(z)=>c1(z,U8,H8);function P8(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${R0(J)}”`}var r2=80;function t2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function D8(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function n2(z){if(!z)return;return`→ ${z.length>r2?`${z.slice(0,r2)}…`:z}`}function F8(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return n2(J);let $=t2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return n2(D8($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var q8='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function M8(){let z=p2();return z.length?z.join(", "):q8}function B8(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function N8(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function e2(z){let J=R0(N8(z)),$=B8(z);return J?`เปิด ${$} “${E0(J,p1)}”`:`เปิด ${$}`}var C8='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',I8=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function _8(z){if(z.querySelector(C8))return!0;return I8.test(z.textContent??"")}var O8=400,S8=250,L8=8000;function R8(z,J){if(typeof MutationObserver>"u"){J.html=K1(o2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,V.disconnect(),window.clearInterval(Y),window.clearTimeout(G)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=E0(e2(z),u1),J.html=K1(o2(z))},V=new MutationObserver(()=>{$=Date.now()});V.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let Y=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=O8&&!_8(z))Z()},S8),G=window.setTimeout(Z,L8)}function A8(z){if(Y1(z))return;let J=i0("ui",e2(z));if(J)R8(z,J)}function T8(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=M8(),V=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let Y of V){if(z.has(Y))continue;z.add(Y),A8(Y)}}}).observe(document.body,{childList:!0,subtree:!0})}var k8=1600,E8=2500;function s2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:E0((z.textContent??"").replace(/\s+/g," ").trim(),p1)}}function x8(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function f8(z,J){if(typeof MutationObserver>"u")return;let $=s2(z),j=!1,Q=(Y,G)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(V),J.afterNote=Y,G)J.afterHtml=K1(c1(z,a2,E8))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let Y=x8($,s2(z));if(Y)Q(Y,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},k8)}function z4(){if(c2||typeof window>"u")return;c2=!0,document.addEventListener("click",(j)=>{if(Y1(j.target))return;let Q=X8(j.target);if(!Q)return;let Z=V8(Q);if(!Z)return;let V=i0("click",`คลิก ${Z}`,F8(Q),G8(Q));if(V)f8(Q,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(Y1(j.target))return;let Q=P8(j.target);if(Q)i0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(Y1(j.target))return;i0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>i0("navigate",`ไปที่ ${d1($0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),T8()}function l1(){return k0.map((z)=>({...z}))}var J4=2000,W1=[],$4=0,j4=!1;function o1(z,J){$4+=1,W1.push({id:`log_${$4}`,at:new Date().toISOString(),level:z,message:J.length>J4?`${J.slice(0,J4)}…`:J});while(W1.length>K0("maxConsoleEntries"))W1.shift()}function w8(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function Q4(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,w8());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function Z4(){if(j4||typeof window>"u")return;j4=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{o1(J,j.map(Q4).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";o1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:Q4(J.reason);o1("unhandledrejection",$)})}function r1(){return W1.map((z)=>({...z}))}var X4=new Set,V4=new Set;function Y4(z,J){return z.add(J),()=>z.delete(J)}function K4(z,J){for(let $ of[...z])$(J)}function n1(z){return Y4(X4,z)}function s1(z={type:"manual"}){K4(X4,z)}function a1(z){return Y4(V4,z)}function t1(z){K4(V4,z)}var b8=15000,g8=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],W4=!1,G4=0;function v8(z){return g8.some((J)=>z.includes(J))}function U4(z){let J=z.message??"";if(!J||v8(J))return;let $=Date.now();if($-G4<b8)return;G4=$,t1({...z,message:J})}function H4(){if(W4||typeof window>"u")return;W4=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;U4({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;U4({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var q4=4000,y8=1e6,h8=1e7,G1=[],P4=0,D4=!1;function M4(z){G1.push(z);while(G1.length>K0("maxRequests"))G1.shift()}function B4(){return P4+=1,`req_${P4}`}function F4(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function m8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function u8(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function p8(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=F4(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...F4(J.headers)};if(J.body!==void 0)Z=u8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function N4(z){return!d2(z)}function d8(z,J){if(N4(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>y8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=T0(Z,K0("maxBodyChars"))}).catch(()=>{})}catch{}}function C4(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function i8(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=p8(J,$);if(C4(j.url,j.headers))return z(J,$);let Q={id:B4(),startedAt:new Date().toISOString(),method:j.method,url:$0(j.url),requestHeaders:A0(j.headers),requestBody:T0(j.body,q4),status:null,statusText:null,durationMs:null,via:"fetch"};M4(Q);let Z=performance.now();try{let V=await z(J,$);return Q.status=V.status,Q.statusText=V.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=A0(m8(V.headers)),d8(V,Q),V}catch(V){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},z)}function c8(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,V){let Y=typeof V==="string"?V:V.toString();return this.__lwEntry=C4(Y,{})?void 0:{id:B4(),startedAt:"",method:(Z||"GET").toUpperCase(),url:$0(Y),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof Z==="string"?T0(Z,q4):Z==null?null:"[non-string body]";let Y=performance.now();M4(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-Y),N4(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=T0(this.responseText||"",K0("maxBodyChars"))}catch{}else{let G=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${G}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function I4(){if(D4)return;D4=!0,i8(),c8()}function e1(){let z=G1.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>h8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var l8=4,_4=3,o8=4000,r8="[data-debug-reporter]",n8=()=>import("@rrweb/record");var i=[],x0=null,U1=!1;function O4(){if(typeof window>"u"||x0||U1)return;let z=d0();if(!z)return;U1=!0;let J=()=>void s8(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function s8(z){let J;try{J=(await n8()).record}catch($){U1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(x0)return;try{x0=J({emit:($)=>a8($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:o8,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${r8}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{U1=!1}}function a8(z){if(z.type===l8||i.length===0){if(i.push([]),i.length>_4)i=i.slice(-_4)}i[i.length-1].push(z)}function z2(z=Date.now()){let J=d0();if(!J||!i.length)return null;let $=z-J.seconds*1000,j=i.length-1;while(j>0&&(i[j][0]?.timestamp??z)>$)j-=1;let Q=i.slice(j).flat(),Z=Q[0]?.timestamp,V=Q[Q.length-1]?.timestamp;if(Z===void 0||V===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-Z)}}function t8(){return x0!==null}function e8(){x0?.(),x0=null,i=[]}var z3={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก"},J3={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call",ringHint:"When you answer, your browser asks for the microphone · during the call the team may ask to see your screen — you always choose",ringTest:"Test the microphone and speaker first",ringAnswer:"Answer",ringAnswering:"Answering…",ringFallback:"The call can't open on this page — answer in a new tab instead, already signed in"};function j0(z){return z==="en"?J3:z3}var $3="lw-debug-toasts",j3=6000,Q3=`
|
|
2
2
|
:host { all: initial; }
|
|
3
3
|
.stack {
|
|
4
4
|
position: fixed; top: 16px; right: 16px; z-index: 2147483001;
|
|
@@ -30,15 +30,15 @@ var x6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=
|
|
|
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
|
-
`,
|
|
33
|
+
`,J2=null;function Z3(){if(typeof document>"u")return null;if(J2?.isConnected)return J2;let z=document.createElement($3);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=Q3;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),J2=j,j}function q0(z,J="success",$){let j=p0()?N().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=Z3();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let V=document.createElement("span");V.className="dot";let Y=document.createElement("span");Y.textContent=z;let G=document.createElement("button");G.type="button",G.className="close",G.textContent="✕",G.setAttribute("aria-label","ปิด");let H=()=>{window.clearTimeout(C),Z.remove()};G.addEventListener("click",H);let C=J==="error"||$?0:window.setTimeout(H,j3);if(Z.append(V,Y),$){let q=document.createElement("button");q.type="button",q.className="action",q.textContent=$.label,q.addEventListener("click",()=>{H(),$.onClick()}),Z.append(q)}Z.append(G),Q.append(Z)}function S4(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function L4(z){return z.failedRequests.length+z.errors.length+z.erroredQueries.length}function X3(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function $2(z,J){if(!z)return J;try{return z()}catch{return J}}function R4(){let z=N(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:X1(J),user:$2(z.user,{}),apiHeaders:A0($2(z.headers,{})),app:{name:e().name,version:e().version,environment:e().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:X3(),extra:$2(z.extra,{})}}var V3=2,Y3={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function l0(z){let J=e1(),$=r1();return{context:R4(),reason:z.reason,note:z.note,cause:S4(J,$,z.erroredQueries),actionTrail:l1(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:z2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:V3}}}function A4(z){return z.replace(/'/g,"'\\''")}function T4(z){let J=[`curl -X ${z.method} '${z.url}'`];for(let[$,j]of Object.entries(z.requestHeaders))J.push(` -H '${$}: ${A4(j)}'`);if(z.requestBody)J.push(` --data '${A4(z.requestBody)}'`);return J.join(" \\\n")}function K3(z){if(z.error)return`ERR ${z.error}`;return`${z.status??"—"} ${z.statusText??""}`.trim()}function W3(z){if(z.length===0)return"No network activity captured.";return z.map((J)=>{let $=J.durationMs!=null?`${J.durationMs}ms`:"—",j=`# [${K3(J)}] ${J.method} ${J.url} (${$}, ${J.startedAt})`,Q=J.responseSnippet?`
|
|
34
34
|
# response: ${J.responseSnippet}`:"";return`${j}
|
|
35
|
-
${
|
|
35
|
+
${T4(J)}${Q}`}).join(`
|
|
36
36
|
|
|
37
|
-
`)}function
|
|
38
|
-
`)}function
|
|
37
|
+
`)}function G3(z){if(z.length===0)return"No console output captured.";return z.map((J)=>`[${J.at}] ${J.level.toUpperCase()}: ${J.message}`).join(`
|
|
38
|
+
`)}function U3(z){if(z.length===0)return"No user actions captured.";let J=0;return z.map(($)=>{let j=$.source?` (${$.source})`:"",Q=`${$.detail}${i1($.count)}${j}`;if($.kind==="ui")return` ↳ [${$.at}] ${Q}`;J+=1;let Z=`${J}. [${$.at}] ${Q}`;return $.afterNote?`${Z}
|
|
39
39
|
↳ ${$.afterNote}`:Z}).join(`
|
|
40
|
-
`)}function
|
|
41
|
-
`)}function K3(z){return z.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function W3(z,J){return`debug-report_${K3(z.context.capturedAt)}.${J}`}function G3(z){return N4(z.cause)>0}async function G1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await U3();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await D3();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function U3(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await H3(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function H3(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((Y)=>{let V=!1,G=()=>{if(V)return;V=!0,Y()};J.onloadedmetadata=()=>{J.play().then(G).catch(G)},window.setTimeout(G,1500)}),await P3(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function P3(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function D3(){let z=N().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var F3=2000,q3=0.82,B3=3000000;function M3(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function U1(z){try{let J=await M3(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,F3/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let Y=q3,V=Q.toDataURL("image/jpeg",Y);while(V.length>B3&&Y>0.4)Y-=0.15,V=Q.toDataURL("image/jpeg",Y);return V}catch{return z}}var N3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,I3=/^\d+$/,C3=/^[0-9a-f]{16,}$/i;function e1(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>N3.test(Z)||I3.test(Z)||C3.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var z2=2000000;function H1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function J2(z,J=2000000){if(H1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(H1(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&H1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&H1(j)>J)j.console=j.console.slice(1);return j}function c0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var _3=4,O3=2,S3=3,L3=0,R3=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),A3=/^\s*javascript:/i;function T3(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&A3.test(J)}function O4(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(T3($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!R3.has($)||!j.includes("?"))continue;z[$]=J0(j)}}function $2(z){if(!z)return;O4(z.attributes);for(let J of z.childNodes??[])$2(J)}function S4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===_3&&typeof j.href==="string")j.href=J0(j.href);else if($.type===O3)$2(j.node);else if($.type===S3&&j.source===L3){for(let Q of j.adds??[])$2(Q.node);for(let Q of j.attributes??[])O4(Q.attributes,!0)}}return J}var R4="session-replay.json.gz",k3="session-replay.json";function E3(z){return Boolean(z&&z.events.length>0)}async function x3(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function j2(z,J){if(!E3(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=S4(z.events),Z=await L4(Q),Y=!1;if(Z.bytes.byteLength>J&&b3(Q))Q=g3(Q),Z=await L4(Q),Y=!0;let{bytes:V,compressed:G}=Z;if(V.byteLength>J)return{summary:{...j,bytes:V.byteLength,omitted:"too-large"}};return{dataUri:`data:${G?"application/gzip":"application/json"};base64,${c0(V)}`,filename:G?R4:k3,summary:{...j,events:Q.length,bytes:V.byteLength,compressed:G,...Y?{canvasDropped:Y}:{}}}}async function L4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await x3(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var f3=3,A4=2,w3=9;function T4(z){return z.type===f3&&z.data?.source===w3}function b3(z){return z.some(T4)||z.some((J)=>J.type===A4&&k4(J.data.node))}function k4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(k4)}function E4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])E4(J)}function g3(z){let J=[];for(let $ of z){if(T4($))continue;if($.type===A4)E4($.data.node);J.push($)}return J}var v3=new Set([502,503,504]);class j0 extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function y3(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${c0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function Q2(){let z=N().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function Z2(z,J){let $=N(),j=J2(J,z2),{context:Q,note:Z}=j,Y=[];if(j.screenshotDataUrl){let M=await U1(j.screenshotDataUrl);Y.push({dataUri:M,filename:"screenshot.jpg"})}Y.push(y3(j));let V,G=u0();if(G){let M=await j2(j.replay,G.maxBytes);if(V=M.summary,"dataUri"in M)Y.push({dataUri:M.dataUri,filename:M.filename})}let H=e1(j),I={title:z,description:Z.trim()||void 0,appName:e().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:e().name,module:Q.module?.label??""},context:{...H?{signature:H}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...V?{replay:V}:{}},attachments:Y},q=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await Q2()},body:JSON.stringify(I)}).catch(()=>{throw new j0("report never left the browser","offline")});if(!q.ok)throw await X2(q);return await q.json()}async function X2(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new j0("rate limited","rateLimited",J??void 0);if(v3.has(z.status))return new j0("desk unavailable","unavailable");return new j0($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var P1=null,l0=null,x4=()=>N().host.replace(/\/$/,"");function D1(){return P1}function q0(){if(l0)return l0;return l0=(async()=>{try{let z=await fetch(`${x4()}/ingest/request-types`,{headers:{"x-realm-key":N().realmKey}}),J=z.ok?await z.json():null;P1=Array.isArray(J?.types)?J.types.filter(h3):[]}catch{P1=[],l0=null}return P1??[]})(),l0}function h3(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function Y2(z){let J=N(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:e().name,category:j?Q1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await U1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${x4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await Q2()},body:JSON.stringify(Q)}).catch(()=>{throw new j0("request never left the browser","offline")});if(!Z.ok)throw await X2(Z);return await Z.json()}var o0=Math.PI/6;function f4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),Y=Math.atan2(Q,j),V=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(Y-o0),y:J.y-$*Math.sin(Y-o0)},{x:J.x-$*Math.cos(Y+o0),y:J.y-$*Math.sin(Y+o0)}],G=$*Math.cos(o0)*0.92;if(Z<=G)return{shaft:null,head:V};return{shaft:{from:z,to:{x:J.x-G*Math.cos(Y),y:J.y-G*Math.sin(Y)}},head:V}}var V2="#f44336",m3="rgba(250, 204, 21, 0.4)",K2=22,w4="#2563eb",b4=9,g4=11,v4=18,y4=4,F1=8,u3=[{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 W2(z,J,$){let j=[],Q=null,Z=-1,Y=null,V=null,G=z.getContext("2d");function H(){let X=z.getBoundingClientRect().width;return X>0?z.width/X:1}function I(X){let K=z.getBoundingClientRect();return{x:(X.clientX-K.left)/K.width*z.width,y:(X.clientY-K.top)/K.height*z.height}}function q(X){let K=X.size??K2;if(!G)return(X.text?.length??0)*K*0.6;G.save(),G.font=`600 ${K}px system-ui, sans-serif`;let U=G.measureText(X.text??"").width;return G.restore(),U}function M(X){if(X.tool==="text"){let K=X.size??K2;return{left:X.x1,top:X.y1,right:X.x1+q(X),bottom:X.y1+K*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function k(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let K=M(X);if(X.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return u3.map((U)=>({id:U.id,x:K.left+(K.right-K.left)*U.fx,y:K.top+(K.bottom-K.top)*U.fy,cursor:U.cursor}))}function R(X){let K=M(X);return{x:K.right+v4*H(),y:K.top-v4*H()}}function w(X,K,U){let{shaft:W,head:P}=f4({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*U));if(W)X.lineCap="butt",X.beginPath(),X.moveTo(W.from.x,W.from.y),X.lineTo(W.to.x,W.to.y),X.stroke();X.beginPath(),X.moveTo(P[0].x,P[0].y),X.lineTo(P[1].x,P[1].y),X.lineTo(P[2].x,P[2].y),X.closePath(),X.fill()}function y(X,K,U){X.save(),X.lineWidth=Math.max(2,3*U),X.strokeStyle=V2,X.fillStyle=V2;let W=M(K);if(K.tool==="rect")X.strokeRect(W.left,W.top,W.right-W.left,W.bottom-W.top);else if(K.tool==="arrow")w(X,K,U);else if(K.tool==="highlight")X.fillStyle=m3,X.fillRect(W.left,W.top,W.right-W.left,W.bottom-W.top);else if(K.tool==="text"&&K.text){let P=K.size??K2;X.font=`600 ${P}px system-ui, sans-serif`,X.textBaseline="top";let F=P*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(W.left-F,W.top-F,W.right-W.left+F*2,W.bottom-W.top+F*2),X.fillStyle=V2,X.fillText(K.text,W.left,W.top)}X.restore()}function C(X,K,U){let W=M(K);X.save(),X.strokeStyle=w4,X.lineWidth=Math.max(1,1.5*U),X.setLineDash([6*U,4*U]),X.strokeRect(W.left,W.top,W.right-W.left,W.bottom-W.top),X.setLineDash([]);let P=b4*U;for(let u of k(K))X.fillStyle="#fff",X.strokeStyle=w4,X.lineWidth=Math.max(1,1.5*U),X.beginPath(),X.rect(u.x-P/2,u.y-P/2,P,P),X.fill(),X.stroke();let F=R(K),S=g4*U;X.beginPath(),X.arc(F.x,F.y,S,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*U),X.beginPath(),X.moveTo(F.x-S*0.4,F.y-S*0.4),X.lineTo(F.x+S*0.4,F.y+S*0.4),X.moveTo(F.x+S*0.4,F.y-S*0.4),X.lineTo(F.x-S*0.4,F.y+S*0.4),X.stroke(),X.restore()}function _(){if(!G)return;let X=H();if(G.clearRect(0,0,z.width,z.height),G.drawImage(J,0,0,z.width,z.height),j.forEach((U,W)=>{if(W!==n)y(G,U,X)}),Y)y(G,Y,X);let K=j[Z];if(K&&!Y)C(G,K,X)}function l(X,K,U,W,P){return Math.abs(X-U)<=P&&Math.abs(K-W)<=P}function r(X,K){let U=j[Z];if(!U)return null;let W=b4*H()/2+3*H();for(let P of k(U))if(l(X,K,P.x,P.y,W))return P.id;return null}function b(X,K){let U=j[Z];if(!U)return!1;let W=R(U);return l(X,K,W.x,W.y,g4*H())}function h(X,K){let U=6*H();for(let W=j.length-1;W>=0;W-=1){let P=j[W];if(P.tool==="arrow"){let S=P.x2-P.x1,u=P.y2-P.y1,t=Math.hypot(S,u)||1,D=Math.max(0,Math.min(1,((X-P.x1)*S+(K-P.y1)*u)/(t*t)));if(Math.hypot(X-(P.x1+D*S),K-(P.y1+D*u))<=U+4*H())return W;continue}let F=M(P);if(X>=F.left-U&&X<=F.right+U&&K>=F.top-U&&K<=F.bottom+U)return W}return-1}function x(X,K,U,W,P){if(K==="tail"){X.x1=U.x1+W,X.y1=U.y1+P;return}if(K==="head"){X.x2=U.x2+W,X.y2=U.y2+P;return}if(K==="size"){let L=(U.size??24)+P;X.size=Math.max(10,L);return}let F=M(U),{left:S,top:u,right:t,bottom:D}=F;if(K.includes("w"))S=Math.min(t-F1,S+W);if(K.includes("e"))t=Math.max(S+F1,t+W);if(K.includes("n"))u=Math.min(D-F1,u+P);if(K.includes("s"))D=Math.max(u+F1,D+P);X.x1=S,X.y1=u,X.x2=t,X.y2=D}function I0(X,K,U,W){X.x1=K.x1+U,X.y1=K.y1+W,X.x2=K.x2+U,X.y2=K.y2+W}let E=null,n=-1,T={x:0,y:0,size:24};function m(){let X=z.getBoundingClientRect().width;return X>0?X/z.width:1}function j1(X,K){if(!G)return X.length*K*0.6;G.save(),G.font=`600 ${K}px system-ui, sans-serif`;let U=G.measureText(X||" ").width;return G.restore(),U}function C0(){if(!E)return;let X=z.parentElement;if(!X)return;let K=z.getBoundingClientRect(),U=X.getBoundingClientRect(),W=m(),P=T.size*W;E.style.left=`${K.left-U.left+T.x*W}px`,E.style.top=`${K.top-U.top+T.y*W}px`,E.style.fontSize=`${P}px`,E.style.width=`${Math.max(40,j1(E.value,P)+P)}px`}function X0(X){let K=E;if(!K)return;E=null;let U=K.value.trim(),W=n;if(n=-1,K.remove(),X&&U){if(W>=0&&j[W])j[W].text=U,Z=W;else j.push({tool:"text",x1:T.x,y1:T.y,x2:T.x,y2:T.y,text:U,size:T.size}),Z=j.length-1;$()}else if(W>=0)Z=W;z.focus(),_()}function z0(X,K,U=-1){X0(!0);let W=z.parentElement;if(!W)return;if(getComputedStyle(W).position==="static")W.style.position="relative";let P=U>=0?j[U]:void 0;n=U,T={x:P?.x1??X,y:P?.y1??K,size:P?.size??Math.round(24*H())};let F=document.createElement("input");F.type="text",F.className="text-edit",F.value=P?.text??"",F.setAttribute("aria-label","ข้อความบนภาพ"),F.placeholder="ข้อความ",E=F,W.append(F),C0(),F.addEventListener("input",C0),F.addEventListener("keydown",(S)=>{if(S.stopPropagation(),S.key==="Enter")X0(!0);else if(S.key==="Escape")X0(!1)}),requestAnimationFrame(()=>{if(E!==F)return;F.focus(),F.select(),F.addEventListener("blur",()=>X0(!0))}),_()}function s(X){let{x:K,y:U}=I(X);if(z.setPointerCapture(X.pointerId),b(K,U)){a();return}let W=r(K,U);if(W&&j[Z]){V={grip:W,x:K,y:U,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),z.hasPointerCapture(X.pointerId))z.releasePointerCapture(X.pointerId);Q=null,$(),z0(K,U);return}if(Q){Y={tool:Q,x1:K,y1:U,x2:K,y2:U},Z=-1;return}let P=h(K,U);Z=P,V=P>=0?{grip:"body",x:K,y:U,start:{...j[P]}}:null,_()}function _0(X){let{x:K,y:U}=I(X);if(Y){Y.x2=K,Y.y2=U,_();return}if(V){let P=j[Z];if(!P)return;let F=K-V.x,S=U-V.y;if(V.grip==="body")I0(P,V.start,F,S);else x(P,V.grip,V.start,F,S);_();return}if(Q){z.style.cursor="crosshair";return}if(b(K,U)){z.style.cursor="pointer";return}let W=r(K,U);if(W){let P=j[Z]?k(j[Z]).find((F)=>F.id===W):null;z.style.cursor=P?.cursor??"pointer";return}z.style.cursor=h(K,U)>=0?"move":"default"}function P0(){if(Y){if(!(Math.abs(Y.x2-Y.x1)<y4&&Math.abs(Y.y2-Y.y1)<y4))j.push(Y),Z=j.length-1,Q=null,$();Y=null}if(V)V=null,$();_()}function Y0(X){let K=z.getBoundingClientRect(),U=(X.clientX-K.left)/K.width*z.width,W=(X.clientY-K.top)/K.height*z.height,P=h(U,W),F=j[P];if(!F||F.tool!=="text")return;X.preventDefault(),z0(F.x1,F.y1,P)}function V0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),a();else if(X.key==="Escape")X.preventDefault(),Z=-1,_()}function a(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),_()}return z.addEventListener("pointerdown",s),z.addEventListener("pointermove",_0),z.addEventListener("pointerup",P0),z.addEventListener("pointercancel",P0),z.addEventListener("dblclick",Y0),z.tabIndex=0,z.addEventListener("keydown",V0),_(),{setTool(X){Q=X,Z=-1,z.style.cursor=X?"crosshair":"default",_()},deleteSelected:a,clear(){j.length=0,Z=-1,$(),_()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=J.naturalWidth,X.height=J.naturalHeight;let K=X.getContext("2d");if(!K)return z.toDataURL("image/png");K.drawImage(J,0,0);let U=H();for(let W of j)y(K,W,U);return X.toDataURL("image/png")},destroy(){X0(!1),z.removeEventListener("pointerdown",s),z.removeEventListener("pointermove",_0),z.removeEventListener("pointerup",P0),z.removeEventListener("pointercancel",P0),z.removeEventListener("dblclick",Y0),z.removeEventListener("keydown",V0)}}}var p3=["keydown","keyup","keypress"];function x0(z){for(let J of p3)z.addEventListener(J,($)=>$.stopPropagation())}var h4=`
|
|
40
|
+
`)}function H3(z){let J=[];for(let $ of z.failedRequests)J.push(`✗ ${$.status??$.error??"ERR"} ${$.method} ${$.url}`);for(let $ of z.errors)J.push(`⚠ ${$}`);for(let $ of z.erroredQueries)J.push(`⚠ React Query error: ${$.key} — ${$.error}`);return J}function P3(z){let{context:J}=z;return[`User : ${J.user.fullName??"—"} (${J.user.email??"—"})`,`Unit : ${J.user.unit??"—"}`,`Roles : ${J.user.roles?.join(", ")||"—"}`,`Route : ${J.route.href}`,`Module : ${J.module?`${J.module.label} (${J.module.key})`:"—"}`,`App : ${J.app.name} v${J.app.version} · ${J.app.environment}`,`Memory : ${J.performance.memoryUsedMb??"—"}/${J.performance.memoryLimitMb??"—"} MB`,`Client : ${J.client.userAgent}`,`Viewport : ${J.client.viewport.width}×${J.client.viewport.height} @${J.client.viewport.dpr}x`,`Reason : ${Y3[z.reason.type]}${z.reason.message?` — ${z.reason.message}`:""}`,`Captured : ${z.network.length} requests · ${z.console.length} console · ${z.actionTrail.length} actions · screenshot=${z.screenshotMethod}${z.replay?` · replay=${Math.round(z.replay.durationMs/1000)}s`:""}`]}function D3(z){let J=H3(z.cause),$=[`## \uD83D\uDC1E ${z.context.app.name} — Debug Report`,`**Generated:** ${z.context.capturedAt}`,"",...P3(z).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${z.note.trim()||"(ไม่มี)"}`];if(J.length>0)$.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...J,"```");return $.push("",`<details><summary>ขั้นตอน (${z.actionTrail.length})</summary>`,"","```",U3(z.actionTrail),"```","</details>","",`<details><summary>Network (${z.network.length})</summary>`,"","```",W3(z.network),"```","</details>","",`<details><summary>Console (${z.console.length})</summary>`,"","```",G3(z.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),$.join(`
|
|
41
|
+
`)}function F3(z){return z.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function q3(z,J){return`debug-report_${F3(z.context.capturedAt)}.${J}`}function M3(z){return L4(z.cause)>0}async function H1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await B3();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await I3();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function B3(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await N3(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function N3(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((V)=>{let Y=!1,G=()=>{if(Y)return;Y=!0,V()};J.onloadedmetadata=()=>{J.play().then(G).catch(G)},window.setTimeout(G,1500)}),await C3(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function C3(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function I3(){let z=N().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var _3=2000,O3=0.82,S3=3000000;function L3(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function P1(z){try{let J=await L3(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,_3/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let V=O3,Y=Q.toDataURL("image/jpeg",V);while(Y.length>S3&&V>0.4)V-=0.15,Y=Q.toDataURL("image/jpeg",V);return Y}catch{return z}}var R3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,A3=/^\d+$/,T3=/^[0-9a-f]{16,}$/i;function j2(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>R3.test(Z)||A3.test(Z)||T3.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var Q2=2000000;function D1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function Z2(z,J=2000000){if(D1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(D1(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&D1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&D1(j)>J)j.console=j.console.slice(1);return j}function o0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var k3=4,E3=2,x3=3,f3=0,w3=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),b3=/^\s*javascript:/i;function g3(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&b3.test(J)}function k4(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(g3($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!w3.has($)||!j.includes("?"))continue;z[$]=$0(j)}}function X2(z){if(!z)return;k4(z.attributes);for(let J of z.childNodes??[])X2(J)}function E4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===k3&&typeof j.href==="string")j.href=$0(j.href);else if($.type===E3)X2(j.node);else if($.type===x3&&j.source===f3){for(let Q of j.adds??[])X2(Q.node);for(let Q of j.attributes??[])k4(Q.attributes,!0)}}return J}var f4="session-replay.json.gz",v3="session-replay.json";function y3(z){return Boolean(z&&z.events.length>0)}async function h3(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function V2(z,J){if(!y3(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=E4(z.events),Z=await x4(Q),V=!1;if(Z.bytes.byteLength>J&&p3(Q))Q=d3(Q),Z=await x4(Q),V=!0;let{bytes:Y,compressed:G}=Z;if(Y.byteLength>J)return{summary:{...j,bytes:Y.byteLength,omitted:"too-large"}};return{dataUri:`data:${G?"application/gzip":"application/json"};base64,${o0(Y)}`,filename:G?f4:v3,summary:{...j,events:Q.length,bytes:Y.byteLength,compressed:G,...V?{canvasDropped:V}:{}}}}async function x4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await h3(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var m3=3,w4=2,u3=9;function b4(z){return z.type===m3&&z.data?.source===u3}function p3(z){return z.some(b4)||z.some((J)=>J.type===w4&&g4(J.data.node))}function g4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(g4)}function v4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])v4(J)}function d3(z){let J=[];for(let $ of z){if(b4($))continue;if($.type===w4)v4($.data.node);J.push($)}return J}var i3=new Set([502,503,504]);class Q0 extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function c3(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${o0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function Y2(){let z=N().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function K2(z,J){let $=N(),j=Z2(J,Q2),{context:Q,note:Z}=j,V=[];if(j.screenshotDataUrl){let B=await P1(j.screenshotDataUrl);V.push({dataUri:B,filename:"screenshot.jpg"})}V.push(c3(j));let Y,G=d0();if(G){let B=await V2(j.replay,G.maxBytes);if(Y=B.summary,"dataUri"in B)V.push({dataUri:B.dataUri,filename:B.filename})}let H=j2(j),C={title:z,description:Z.trim()||void 0,appName:e().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:e().name,module:Q.module?.label??""},context:{...H?{signature:H}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...Y?{replay:Y}:{}},attachments:V},q=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await Y2()},body:JSON.stringify(C)}).catch(()=>{throw new Q0("report never left the browser","offline")});if(!q.ok)throw await W2(q);return await q.json()}async function W2(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new Q0("rate limited","rateLimited",J??void 0);if(i3.has(z.status))return new Q0("desk unavailable","unavailable");return new Q0($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var F1=null,r0=null,y4=()=>N().host.replace(/\/$/,"");function q1(){return F1}function M0(){if(r0)return r0;return r0=(async()=>{try{let z=await fetch(`${y4()}/ingest/request-types`,{headers:{"x-realm-key":N().realmKey}}),J=z.ok?await z.json():null;F1=Array.isArray(J?.types)?J.types.filter(l3):[]}catch{F1=[],r0=null}return F1??[]})(),r0}function l3(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function G2(z){let J=N(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:e().name,category:j?X1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await P1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${y4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await Y2()},body:JSON.stringify(Q)}).catch(()=>{throw new Q0("request never left the browser","offline")});if(!Z.ok)throw await W2(Z);return await Z.json()}var n0=Math.PI/6;function h4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),V=Math.atan2(Q,j),Y=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(V-n0),y:J.y-$*Math.sin(V-n0)},{x:J.x-$*Math.cos(V+n0),y:J.y-$*Math.sin(V+n0)}],G=$*Math.cos(n0)*0.92;if(Z<=G)return{shaft:null,head:Y};return{shaft:{from:z,to:{x:J.x-G*Math.cos(V),y:J.y-G*Math.sin(V)}},head:Y}}var U2="#f44336",o3="rgba(250, 204, 21, 0.4)",H2=22,m4="#2563eb",u4=9,p4=11,d4=18,i4=4,M1=8,r3=[{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 P2(z,J,$){let j=[],Q=null,Z=-1,V=null,Y=null,G=z.getContext("2d");function H(){let X=z.getBoundingClientRect().width;return X>0?z.width/X:1}function C(X){let K=z.getBoundingClientRect();return{x:(X.clientX-K.left)/K.width*z.width,y:(X.clientY-K.top)/K.height*z.height}}function q(X){let K=X.size??H2;if(!G)return(X.text?.length??0)*K*0.6;G.save(),G.font=`600 ${K}px system-ui, sans-serif`;let U=G.measureText(X.text??"").width;return G.restore(),U}function B(X){if(X.tool==="text"){let K=X.size??H2;return{left:X.x1,top:X.y1,right:X.x1+q(X),bottom:X.y1+K*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function k(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let K=B(X);if(X.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return r3.map((U)=>({id:U.id,x:K.left+(K.right-K.left)*U.fx,y:K.top+(K.bottom-K.top)*U.fy,cursor:U.cursor}))}function R(X){let K=B(X);return{x:K.right+d4*H(),y:K.top-d4*H()}}function w(X,K,U){let{shaft:W,head:P}=h4({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*U));if(W)X.lineCap="butt",X.beginPath(),X.moveTo(W.from.x,W.from.y),X.lineTo(W.to.x,W.to.y),X.stroke();X.beginPath(),X.moveTo(P[0].x,P[0].y),X.lineTo(P[1].x,P[1].y),X.lineTo(P[2].x,P[2].y),X.closePath(),X.fill()}function y(X,K,U){X.save(),X.lineWidth=Math.max(2,3*U),X.strokeStyle=U2,X.fillStyle=U2;let W=B(K);if(K.tool==="rect")X.strokeRect(W.left,W.top,W.right-W.left,W.bottom-W.top);else if(K.tool==="arrow")w(X,K,U);else if(K.tool==="highlight")X.fillStyle=o3,X.fillRect(W.left,W.top,W.right-W.left,W.bottom-W.top);else if(K.tool==="text"&&K.text){let P=K.size??H2;X.font=`600 ${P}px system-ui, sans-serif`,X.textBaseline="top";let F=P*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(W.left-F,W.top-F,W.right-W.left+F*2,W.bottom-W.top+F*2),X.fillStyle=U2,X.fillText(K.text,W.left,W.top)}X.restore()}function I(X,K,U){let W=B(K);X.save(),X.strokeStyle=m4,X.lineWidth=Math.max(1,1.5*U),X.setLineDash([6*U,4*U]),X.strokeRect(W.left,W.top,W.right-W.left,W.bottom-W.top),X.setLineDash([]);let P=u4*U;for(let u of k(K))X.fillStyle="#fff",X.strokeStyle=m4,X.lineWidth=Math.max(1,1.5*U),X.beginPath(),X.rect(u.x-P/2,u.y-P/2,P,P),X.fill(),X.stroke();let F=R(K),S=p4*U;X.beginPath(),X.arc(F.x,F.y,S,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*U),X.beginPath(),X.moveTo(F.x-S*0.4,F.y-S*0.4),X.lineTo(F.x+S*0.4,F.y+S*0.4),X.moveTo(F.x+S*0.4,F.y-S*0.4),X.lineTo(F.x-S*0.4,F.y+S*0.4),X.stroke(),X.restore()}function _(){if(!G)return;let X=H();if(G.clearRect(0,0,z.width,z.height),G.drawImage(J,0,0,z.width,z.height),j.forEach((U,W)=>{if(W!==n)y(G,U,X)}),V)y(G,V,X);let K=j[Z];if(K&&!V)I(G,K,X)}function l(X,K,U,W,P){return Math.abs(X-U)<=P&&Math.abs(K-W)<=P}function r(X,K){let U=j[Z];if(!U)return null;let W=u4*H()/2+3*H();for(let P of k(U))if(l(X,K,P.x,P.y,W))return P.id;return null}function b(X,K){let U=j[Z];if(!U)return!1;let W=R(U);return l(X,K,W.x,W.y,p4*H())}function h(X,K){let U=6*H();for(let W=j.length-1;W>=0;W-=1){let P=j[W];if(P.tool==="arrow"){let S=P.x2-P.x1,u=P.y2-P.y1,t=Math.hypot(S,u)||1,D=Math.max(0,Math.min(1,((X-P.x1)*S+(K-P.y1)*u)/(t*t)));if(Math.hypot(X-(P.x1+D*S),K-(P.y1+D*u))<=U+4*H())return W;continue}let F=B(P);if(X>=F.left-U&&X<=F.right+U&&K>=F.top-U&&K<=F.bottom+U)return W}return-1}function x(X,K,U,W,P){if(K==="tail"){X.x1=U.x1+W,X.y1=U.y1+P;return}if(K==="head"){X.x2=U.x2+W,X.y2=U.y2+P;return}if(K==="size"){let L=(U.size??24)+P;X.size=Math.max(10,L);return}let F=B(U),{left:S,top:u,right:t,bottom:D}=F;if(K.includes("w"))S=Math.min(t-M1,S+W);if(K.includes("e"))t=Math.max(S+M1,t+W);if(K.includes("n"))u=Math.min(D-M1,u+P);if(K.includes("s"))D=Math.max(u+M1,D+P);X.x1=S,X.y1=u,X.x2=t,X.y2=D}function I0(X,K,U,W){X.x1=K.x1+U,X.y1=K.y1+W,X.x2=K.x2+U,X.y2=K.y2+W}let E=null,n=-1,T={x:0,y:0,size:24};function m(){let X=z.getBoundingClientRect().width;return X>0?X/z.width:1}function Z1(X,K){if(!G)return X.length*K*0.6;G.save(),G.font=`600 ${K}px system-ui, sans-serif`;let U=G.measureText(X||" ").width;return G.restore(),U}function _0(){if(!E)return;let X=z.parentElement;if(!X)return;let K=z.getBoundingClientRect(),U=X.getBoundingClientRect(),W=m(),P=T.size*W;E.style.left=`${K.left-U.left+T.x*W}px`,E.style.top=`${K.top-U.top+T.y*W}px`,E.style.fontSize=`${P}px`,E.style.width=`${Math.max(40,Z1(E.value,P)+P)}px`}function X0(X){let K=E;if(!K)return;E=null;let U=K.value.trim(),W=n;if(n=-1,K.remove(),X&&U){if(W>=0&&j[W])j[W].text=U,Z=W;else j.push({tool:"text",x1:T.x,y1:T.y,x2:T.x,y2:T.y,text:U,size:T.size}),Z=j.length-1;$()}else if(W>=0)Z=W;z.focus(),_()}function J0(X,K,U=-1){X0(!0);let W=z.parentElement;if(!W)return;if(getComputedStyle(W).position==="static")W.style.position="relative";let P=U>=0?j[U]:void 0;n=U,T={x:P?.x1??X,y:P?.y1??K,size:P?.size??Math.round(24*H())};let F=document.createElement("input");F.type="text",F.className="text-edit",F.value=P?.text??"",F.setAttribute("aria-label","ข้อความบนภาพ"),F.placeholder="ข้อความ",E=F,W.append(F),_0(),F.addEventListener("input",_0),F.addEventListener("keydown",(S)=>{if(S.stopPropagation(),S.key==="Enter")X0(!0);else if(S.key==="Escape")X0(!1)}),requestAnimationFrame(()=>{if(E!==F)return;F.focus(),F.select(),F.addEventListener("blur",()=>X0(!0))}),_()}function s(X){let{x:K,y:U}=C(X);if(z.setPointerCapture(X.pointerId),b(K,U)){a();return}let W=r(K,U);if(W&&j[Z]){Y={grip:W,x:K,y:U,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),z.hasPointerCapture(X.pointerId))z.releasePointerCapture(X.pointerId);Q=null,$(),J0(K,U);return}if(Q){V={tool:Q,x1:K,y1:U,x2:K,y2:U},Z=-1;return}let P=h(K,U);Z=P,Y=P>=0?{grip:"body",x:K,y:U,start:{...j[P]}}:null,_()}function O0(X){let{x:K,y:U}=C(X);if(V){V.x2=K,V.y2=U,_();return}if(Y){let P=j[Z];if(!P)return;let F=K-Y.x,S=U-Y.y;if(Y.grip==="body")I0(P,Y.start,F,S);else x(P,Y.grip,Y.start,F,S);_();return}if(Q){z.style.cursor="crosshair";return}if(b(K,U)){z.style.cursor="pointer";return}let W=r(K,U);if(W){let P=j[Z]?k(j[Z]).find((F)=>F.id===W):null;z.style.cursor=P?.cursor??"pointer";return}z.style.cursor=h(K,U)>=0?"move":"default"}function D0(){if(V){if(!(Math.abs(V.x2-V.x1)<i4&&Math.abs(V.y2-V.y1)<i4))j.push(V),Z=j.length-1,Q=null,$();V=null}if(Y)Y=null,$();_()}function V0(X){let K=z.getBoundingClientRect(),U=(X.clientX-K.left)/K.width*z.width,W=(X.clientY-K.top)/K.height*z.height,P=h(U,W),F=j[P];if(!F||F.tool!=="text")return;X.preventDefault(),J0(F.x1,F.y1,P)}function Y0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),a();else if(X.key==="Escape")X.preventDefault(),Z=-1,_()}function a(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),_()}return z.addEventListener("pointerdown",s),z.addEventListener("pointermove",O0),z.addEventListener("pointerup",D0),z.addEventListener("pointercancel",D0),z.addEventListener("dblclick",V0),z.tabIndex=0,z.addEventListener("keydown",Y0),_(),{setTool(X){Q=X,Z=-1,z.style.cursor=X?"crosshair":"default",_()},deleteSelected:a,clear(){j.length=0,Z=-1,$(),_()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=J.naturalWidth,X.height=J.naturalHeight;let K=X.getContext("2d");if(!K)return z.toDataURL("image/png");K.drawImage(J,0,0);let U=H();for(let W of j)y(K,W,U);return X.toDataURL("image/png")},destroy(){X0(!1),z.removeEventListener("pointerdown",s),z.removeEventListener("pointermove",O0),z.removeEventListener("pointerup",D0),z.removeEventListener("pointercancel",D0),z.removeEventListener("dblclick",V0),z.removeEventListener("keydown",Y0)}}}var n3=["keydown","keyup","keypress"];function f0(z){for(let J of n3)z.addEventListener(J,($)=>$.stopPropagation())}var c4=`
|
|
42
42
|
:host { all: initial; }
|
|
43
43
|
* { box-sizing: border-box; }
|
|
44
44
|
|
|
@@ -189,7 +189,7 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
|
|
|
189
189
|
.shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
|
|
190
190
|
.dropped { opacity: 0.35; pointer-events: none; }
|
|
191
191
|
.draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
|
|
192
|
-
`;var f0="lw-debug-reporter",W0=null;function d3(z,J){if(z instanceof j0){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var i4=()=>[];function i3(z){i4=z}var c3=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function l3(){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"}),x0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=c1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=$0(N().locale),Q=D1();if(Q===null)q0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=O("div","head"),Z=o("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(O("h2","",J.chooseTitle),Z);let Y=d4("problem",r3,J.kindProblem,J.chooseProblemHint);Y.dataset.choose="problem",Y.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let V=d4("request",u4,J.kindRequest,J.chooseRequestHint);V.dataset.choose="request",V.addEventListener("click",()=>{this.bundle=i0({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:G2()}),this.renderForm(J,$,"request")});let G=O("div","kinds choose");G.append(Y,V),G.addEventListener("keydown",(H)=>{if(!m4.includes(H.key))return;H.preventDefault(),(this.root.activeElement===Y?V:Y).focus()}),j.append(Q,G),Y.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await G1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=i0({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:G2()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await G1();if(j.method==="cancelled"){this.close();return}this.bundle=i0({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:G2()}),this.renderForm($,J,"problem")}close(J=!1){if(J)W0=null;else if(this.keep)W0=this.keep()??W0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=h4;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=O("div","head");Q.append(O("h2","",J.title)),j.append(Q,O("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let Y=this.shell(J),V=j,G=j==="problem"||!!Z.screenshotDataUrl,H=null,I=O("div","head"),q=O("h2","",J.title),M=o("✕","icon");M.setAttribute("aria-label",J.close),M.addEventListener("click",()=>this.close()),I.append(q,M);let k=O("p","door");k.hidden=!0;let R=O("span"),w=o("","link");w.dataset.switchKind="",w.addEventListener("click",()=>K(V==="problem"?"request":"problem")),k.append(R,w);let y=O("div","ask");y.hidden=!0;let C=document.createElement("input");C.type="search",C.className="type-search",C.placeholder=J.requestTypeSearch,C.setAttribute("aria-label",J.requestTypeSearch),C.dataset.requestTypeSearch="",C.hidden=!0;let _=O("div","types");_.setAttribute("role","radiogroup"),_.setAttribute("aria-label",J.requestTypeLabel);let l=O("p","status",J.requestTypeNone);l.hidden=!0;let r=O("p","status type-count","");r.hidden=!0,y.append(q1(J.requestTypeLabel,"",!0),C,_,l,r);let b=[],h=()=>{for(let L of b){let B=L.dataset.requestType===H?.id;L.setAttribute("aria-checked",String(B)),L.tabIndex=B?0:-1}let D=b.find((L)=>L.dataset.requestType===H?.id);if(D&&_.scrollHeight>_.clientHeight){let L=D.offsetTop-_.offsetTop;if(L<_.scrollTop)_.scrollTop=L;else if(L+D.offsetHeight>_.scrollTop+_.clientHeight)_.scrollTop=L+D.offsetHeight-_.clientHeight}},x=document.createElement("input");x.type="text";let I0=q1(""),E=document.createElement("textarea"),n=q1(""),T=O("div","meta"),{context:m}=Z,j1=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,C0=(D,L)=>{let B=document.createElement("div"),A=document.createElement("b");A.textContent=`${D}: `;let g=document.createTextNode(L);return B.append(A,g),T.append(B),{b:A,v:g}};C0(J.reporter,`${m.user.fullName??"—"} (${m.user.email??"—"})`),C0(J.page,m.route.href);let X0=C0(J.captured,j1),z0=document.createElement("label");z0.className="shot-choice",z0.hidden=!0;let s=document.createElement("input");s.type="checkbox",s.checked=!0,s.dataset.requestShot="",z0.append(s,document.createTextNode(` ${J.requestWithShot}`));let _0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[O("p","status",J.noScreenshot)],P0=Z.screenshotDataUrl?_0[0]:null;if(!Z.screenshotDataUrl)z0.replaceChildren();let Y0=O("p","status",""),V0=o(J.submit,"primary"),a=()=>{V0.disabled=x.value.trim().length===0||V==="request"&&!H};x.addEventListener("input",a);let X=()=>{let D=V==="request";if(q.textContent=D?J.requestTitle:J.title,Y.setAttribute("aria-label",D?J.requestTitle:J.title),R.textContent=`${D?J.problemInstead:J.askInstead} `,w.textContent=D?G?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,y.hidden=!D,B1(I0,D?J.requestSummaryLabel:J.summaryLabel,D?"":J.summaryRequired,!0),x.placeholder=D?J.requestSummaryPlaceholder:J.summaryPlaceholder,B1(n,D?J.requestDetailLabel:J.detailLabel),E.placeholder=D?J.requestDetailPlaceholder:J.detailPlaceholder,X0.b.textContent=`${D?J.requestLeaves:J.captured}: `,X0.v.textContent=D?J.requestLeavesWhat:j1,z0.hidden=!D||!Z.screenshotDataUrl,P0)B1(P0,D?J.requestAnnotateHint:J.annotateHint);for(let L of _0)L.classList.toggle("dropped",D&&!s.checked),L.hidden=D&&!Z.screenshotDataUrl;V0.textContent=D?J.requestSubmit:J.submit,a()};s.addEventListener("change",X);let K=(D)=>{if(D===V)return;if(D==="problem"&&!G){this.switchToReport(J,$,{title:x.value,detail:E.value,asking:!1,typeId:H?.id??null});return}V=D,X()},U=(D)=>{if(this.bundle!==Z||$.type!=="manual"||!D.length)return;H=D[0],b.length=0;for(let B of D){let A=o("","type");A.setAttribute("role","radio"),A.dataset.requestType=B.id;let g=O("span","type-body");if(g.append(O("b","",B.name)),B.description)g.append(O("span","type-hint",B.description));if(B.targetHours){let O0=O("span","type-due");O0.append(M1(n3),document.createTextNode(J.requestTarget.replace("{time}",o3(J,B.targetHours)))),g.append(O0)}A.append(M1(u4),g),A.addEventListener("click",()=>{H=B,h(),a()}),b.push(A)}_.replaceChildren(...b),_.onkeydown=(B)=>{if(!m4.includes(B.key)||!H)return;B.preventDefault();let A=D.filter((D0,E6)=>!b[E6].hidden);if(!A.length)return;let g=A.findIndex((D0)=>D0.id===H.id),O0=B.key==="ArrowUp"||B.key==="ArrowLeft"?-1:1;H=A[g<0?0:(g+O0+A.length)%A.length],h(),b.find((D0)=>D0.dataset.requestType===H.id)?.focus()},_.classList.toggle("long",D.length>=U2),C.hidden=D.length<U2;let L=(B)=>{r.hidden=D.length<U2||B===0,r.textContent=J.requestTypeCount.replace("{n}",String(B))};L(D.length),C.oninput=()=>{let B=C.value.trim().toLowerCase(),A=null;if(D.forEach((g,O0)=>{let D0=!B||`${g.name} ${g.description}`.toLowerCase().includes(B);if(b[O0].hidden=!D0,D0&&!A)A=g}),l.hidden=!!A,L(b.filter((g)=>!g.hidden).length),A&&H&&b[D.indexOf(H)].hidden)H=A;h(),a()},C.onkeydown=(B)=>{if(B.key==="ArrowDown"||B.key==="Enter")B.preventDefault(),b.find((A)=>A.dataset.requestType===H?.id&&!A.hidden)?.focus()},h(),k.hidden=!1,X()},W=Q??(W0&&(W0.title||W0.detail)?W0:null),P=O("p","draft");if(P.hidden=!W||!!Q,W){x.value=W.title,E.value=W.detail;let D=o(J.draftClear,"link");D.dataset.draftClear="",D.addEventListener("click",()=>{x.value="",E.value="",W0=null,P.hidden=!0,a(),x.focus()}),P.append(document.createTextNode(`${J.draftRestored} · `),D)}let F=D1(),S=(D)=>{if(U(D),V!=="request"||k.hidden||!W?.typeId)return;let L=D.find((B)=>B.id===W.typeId);if(L)H=L,h()};if(F)S(F);else if($.type==="manual")q0().then(S);this.keep=()=>({title:x.value,detail:E.value,asking:V==="request",typeId:H?.id??null}),Y.append(I,k,P,y,I0,x,n,E,T,z0,..._0);let u=O("div","foot"),t=o(J.close);t.addEventListener("click",()=>this.close()),u.append(t,Y0,O("span","grow"),V0),Y.append(u),X(),V0.addEventListener("click",async()=>{V0.disabled=!0,Y0.dataset.tone="",Y0.textContent=J.submitting;let D=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(V==="request"&&H){let A=await Y2({ticketTypeId:H.id,title:x.value.trim(),description:E.value,screenshotDataUrl:s.checked?D():null}),g=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:A,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),g)F0(`${J.requestSubmitted} — #${A.number}`,"success");return}let L=await Z2(x.value.trim(),{...Z,note:E.value,screenshotDataUrl:D()}),B=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:L,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),B)F0(`${J.submitted} — #${L.number}`,"success")}catch(L){let B=d3(L,J);Y0.dataset.tone="error",Y0.textContent=B,F0(B,"error"),a()}}),x.focus()}screenshotSection(J,$){let j=q1(J.annotateHint),Q=O("div","tools"),Z=document.createElement("canvas"),Y=O("div","shot");Y.append(Z);let V=[],G=(M)=>{for(let k of V)k.setAttribute("aria-pressed",String(k===M))};for(let{tool:M,key:k}of c3){let R=o(J[k]);R.setAttribute("aria-pressed","false"),R.addEventListener("click",()=>{let w=R.getAttribute("aria-pressed")==="true";G(w?null:R),this.annotator?.setTool(w?null:M)}),V.push(R),Q.append(R)}Q.append(O("span","sep"));let H=o(J.deleteSelected);H.addEventListener("click",()=>this.annotator?.deleteSelected());let I=o(J.clearAll);I.addEventListener("click",()=>{this.annotator?.clear(),G(null)}),Q.append(H,I);let q=new Image;return q.onload=()=>{Z.width=q.naturalWidth,Z.height=q.naturalHeight,this.annotator=W2(Z,q,()=>{G(null),H.disabled=!this.annotator?.hasSelection()})},q.src=$,[j,Q,O("p","status",J.annotateHelp),Y]}}}function G2(){try{return i4()}catch{return[]}}function O(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function o3(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var m4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],U2=7,r3=[["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"}]],u4=[["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"}]],n3=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],s3=[["path",{d:"M20 6 9 17l-5-5"}]],p4="http://www.w3.org/2000/svg";function d4(z,J,$,j){let Q=o("","kind");Q.dataset.kind=z;let Z=O("span","kind-top");return Z.append(M1(J),O("b","",$)),Q.append(Z,O("span","kind-hint",j),M1(s3,"tick")),Q}function M1(z,J="icon"){let $=document.createElementNS(p4,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(p4,j);for(let[Y,V]of Object.entries(Q))Z.setAttribute(Y,V);$.append(Z)}return $}function o(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function q1(z,J="",$=!1){return B1(document.createElement("label"),z,J,$)}function B1(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function H2(){if(typeof window>"u"||customElements.get(f0))return;customElements.define(f0,l3())}var a3="lw-portal-handoff",c4=138.23,t3=`
|
|
192
|
+
`;var w0="lw-debug-reporter",W0=null;function s3(z,J){if(z instanceof Q0){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var s4=()=>[];function a3(z){s4=z}var t3=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function e3(){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"}),f0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=n1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=j0(N().locale),Q=q1();if(Q===null)M0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=O("div","head"),Z=o("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(O("h2","",J.chooseTitle),Z);let V=n4("problem",J5,J.kindProblem,J.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let Y=n4("request",o4,J.kindRequest,J.chooseRequestHint);Y.dataset.choose="request",Y.addEventListener("click",()=>{this.bundle=l0({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:D2()}),this.renderForm(J,$,"request")});let G=O("div","kinds choose");G.append(V,Y),G.addEventListener("keydown",(H)=>{if(!l4.includes(H.key))return;H.preventDefault(),(this.root.activeElement===V?Y:V).focus()}),j.append(Q,G),V.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await H1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=l0({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:D2()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await H1();if(j.method==="cancelled"){this.close();return}this.bundle=l0({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:D2()}),this.renderForm($,J,"problem")}close(J=!1){if(J)W0=null;else if(this.keep)W0=this.keep()??W0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=c4;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=O("div","head");Q.append(O("h2","",J.title)),j.append(Q,O("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let V=this.shell(J),Y=j,G=j==="problem"||!!Z.screenshotDataUrl,H=null,C=O("div","head"),q=O("h2","",J.title),B=o("✕","icon");B.setAttribute("aria-label",J.close),B.addEventListener("click",()=>this.close()),C.append(q,B);let k=O("p","door");k.hidden=!0;let R=O("span"),w=o("","link");w.dataset.switchKind="",w.addEventListener("click",()=>K(Y==="problem"?"request":"problem")),k.append(R,w);let y=O("div","ask");y.hidden=!0;let I=document.createElement("input");I.type="search",I.className="type-search",I.placeholder=J.requestTypeSearch,I.setAttribute("aria-label",J.requestTypeSearch),I.dataset.requestTypeSearch="",I.hidden=!0;let _=O("div","types");_.setAttribute("role","radiogroup"),_.setAttribute("aria-label",J.requestTypeLabel);let l=O("p","status",J.requestTypeNone);l.hidden=!0;let r=O("p","status type-count","");r.hidden=!0,y.append(B1(J.requestTypeLabel,"",!0),I,_,l,r);let b=[],h=()=>{for(let L of b){let M=L.dataset.requestType===H?.id;L.setAttribute("aria-checked",String(M)),L.tabIndex=M?0:-1}let D=b.find((L)=>L.dataset.requestType===H?.id);if(D&&_.scrollHeight>_.clientHeight){let L=D.offsetTop-_.offsetTop;if(L<_.scrollTop)_.scrollTop=L;else if(L+D.offsetHeight>_.scrollTop+_.clientHeight)_.scrollTop=L+D.offsetHeight-_.clientHeight}},x=document.createElement("input");x.type="text";let I0=B1(""),E=document.createElement("textarea"),n=B1(""),T=O("div","meta"),{context:m}=Z,Z1=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,_0=(D,L)=>{let M=document.createElement("div"),A=document.createElement("b");A.textContent=`${D}: `;let g=document.createTextNode(L);return M.append(A,g),T.append(M),{b:A,v:g}};_0(J.reporter,`${m.user.fullName??"—"} (${m.user.email??"—"})`),_0(J.page,m.route.href);let X0=_0(J.captured,Z1),J0=document.createElement("label");J0.className="shot-choice",J0.hidden=!0;let s=document.createElement("input");s.type="checkbox",s.checked=!0,s.dataset.requestShot="",J0.append(s,document.createTextNode(` ${J.requestWithShot}`));let O0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[O("p","status",J.noScreenshot)],D0=Z.screenshotDataUrl?O0[0]:null;if(!Z.screenshotDataUrl)J0.replaceChildren();let V0=O("p","status",""),Y0=o(J.submit,"primary"),a=()=>{Y0.disabled=x.value.trim().length===0||Y==="request"&&!H};x.addEventListener("input",a);let X=()=>{let D=Y==="request";if(q.textContent=D?J.requestTitle:J.title,V.setAttribute("aria-label",D?J.requestTitle:J.title),R.textContent=`${D?J.problemInstead:J.askInstead} `,w.textContent=D?G?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,y.hidden=!D,N1(I0,D?J.requestSummaryLabel:J.summaryLabel,D?"":J.summaryRequired,!0),x.placeholder=D?J.requestSummaryPlaceholder:J.summaryPlaceholder,N1(n,D?J.requestDetailLabel:J.detailLabel),E.placeholder=D?J.requestDetailPlaceholder:J.detailPlaceholder,X0.b.textContent=`${D?J.requestLeaves:J.captured}: `,X0.v.textContent=D?J.requestLeavesWhat:Z1,J0.hidden=!D||!Z.screenshotDataUrl,D0)N1(D0,D?J.requestAnnotateHint:J.annotateHint);for(let L of O0)L.classList.toggle("dropped",D&&!s.checked),L.hidden=D&&!Z.screenshotDataUrl;Y0.textContent=D?J.requestSubmit:J.submit,a()};s.addEventListener("change",X);let K=(D)=>{if(D===Y)return;if(D==="problem"&&!G){this.switchToReport(J,$,{title:x.value,detail:E.value,asking:!1,typeId:H?.id??null});return}Y=D,X()},U=(D)=>{if(this.bundle!==Z||$.type!=="manual"||!D.length)return;H=D[0],b.length=0;for(let M of D){let A=o("","type");A.setAttribute("role","radio"),A.dataset.requestType=M.id;let g=O("span","type-body");if(g.append(O("b","",M.name)),M.description)g.append(O("span","type-hint",M.description));if(M.targetHours){let S0=O("span","type-due");S0.append(C1($5),document.createTextNode(J.requestTarget.replace("{time}",z5(J,M.targetHours)))),g.append(S0)}A.append(C1(o4),g),A.addEventListener("click",()=>{H=M,h(),a()}),b.push(A)}_.replaceChildren(...b),_.onkeydown=(M)=>{if(!l4.includes(M.key)||!H)return;M.preventDefault();let A=D.filter((F0,y6)=>!b[y6].hidden);if(!A.length)return;let g=A.findIndex((F0)=>F0.id===H.id),S0=M.key==="ArrowUp"||M.key==="ArrowLeft"?-1:1;H=A[g<0?0:(g+S0+A.length)%A.length],h(),b.find((F0)=>F0.dataset.requestType===H.id)?.focus()},_.classList.toggle("long",D.length>=F2),I.hidden=D.length<F2;let L=(M)=>{r.hidden=D.length<F2||M===0,r.textContent=J.requestTypeCount.replace("{n}",String(M))};L(D.length),I.oninput=()=>{let M=I.value.trim().toLowerCase(),A=null;if(D.forEach((g,S0)=>{let F0=!M||`${g.name} ${g.description}`.toLowerCase().includes(M);if(b[S0].hidden=!F0,F0&&!A)A=g}),l.hidden=!!A,L(b.filter((g)=>!g.hidden).length),A&&H&&b[D.indexOf(H)].hidden)H=A;h(),a()},I.onkeydown=(M)=>{if(M.key==="ArrowDown"||M.key==="Enter")M.preventDefault(),b.find((A)=>A.dataset.requestType===H?.id&&!A.hidden)?.focus()},h(),k.hidden=!1,X()},W=Q??(W0&&(W0.title||W0.detail)?W0:null),P=O("p","draft");if(P.hidden=!W||!!Q,W){x.value=W.title,E.value=W.detail;let D=o(J.draftClear,"link");D.dataset.draftClear="",D.addEventListener("click",()=>{x.value="",E.value="",W0=null,P.hidden=!0,a(),x.focus()}),P.append(document.createTextNode(`${J.draftRestored} · `),D)}let F=q1(),S=(D)=>{if(U(D),Y!=="request"||k.hidden||!W?.typeId)return;let L=D.find((M)=>M.id===W.typeId);if(L)H=L,h()};if(F)S(F);else if($.type==="manual")M0().then(S);this.keep=()=>({title:x.value,detail:E.value,asking:Y==="request",typeId:H?.id??null}),V.append(C,k,P,y,I0,x,n,E,T,J0,...O0);let u=O("div","foot"),t=o(J.close);t.addEventListener("click",()=>this.close()),u.append(t,V0,O("span","grow"),Y0),V.append(u),X(),Y0.addEventListener("click",async()=>{Y0.disabled=!0,V0.dataset.tone="",V0.textContent=J.submitting;let D=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(Y==="request"&&H){let A=await G2({ticketTypeId:H.id,title:x.value.trim(),description:E.value,screenshotDataUrl:s.checked?D():null}),g=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:A,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),g)q0(`${J.requestSubmitted} — #${A.number}`,"success");return}let L=await K2(x.value.trim(),{...Z,note:E.value,screenshotDataUrl:D()}),M=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:L,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),M)q0(`${J.submitted} — #${L.number}`,"success")}catch(L){let M=s3(L,J);V0.dataset.tone="error",V0.textContent=M,q0(M,"error"),a()}}),x.focus()}screenshotSection(J,$){let j=B1(J.annotateHint),Q=O("div","tools"),Z=document.createElement("canvas"),V=O("div","shot");V.append(Z);let Y=[],G=(B)=>{for(let k of Y)k.setAttribute("aria-pressed",String(k===B))};for(let{tool:B,key:k}of t3){let R=o(J[k]);R.setAttribute("aria-pressed","false"),R.addEventListener("click",()=>{let w=R.getAttribute("aria-pressed")==="true";G(w?null:R),this.annotator?.setTool(w?null:B)}),Y.push(R),Q.append(R)}Q.append(O("span","sep"));let H=o(J.deleteSelected);H.addEventListener("click",()=>this.annotator?.deleteSelected());let C=o(J.clearAll);C.addEventListener("click",()=>{this.annotator?.clear(),G(null)}),Q.append(H,C);let q=new Image;return q.onload=()=>{Z.width=q.naturalWidth,Z.height=q.naturalHeight,this.annotator=P2(Z,q,()=>{G(null),H.disabled=!this.annotator?.hasSelection()})},q.src=$,[j,Q,O("p","status",J.annotateHelp),V]}}}function D2(){try{return s4()}catch{return[]}}function O(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function z5(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var l4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],F2=7,J5=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],o4=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],$5=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],j5=[["path",{d:"M20 6 9 17l-5-5"}]],r4="http://www.w3.org/2000/svg";function n4(z,J,$,j){let Q=o("","kind");Q.dataset.kind=z;let Z=O("span","kind-top");return Z.append(C1(J),O("b","",$)),Q.append(Z,O("span","kind-hint",j),C1(j5,"tick")),Q}function C1(z,J="icon"){let $=document.createElementNS(r4,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(r4,j);for(let[V,Y]of Object.entries(Q))Z.setAttribute(V,Y);$.append(Z)}return $}function o(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function B1(z,J="",$=!1){return N1(document.createElement("label"),z,J,$)}function N1(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function q2(){if(typeof window>"u"||customElements.get(w0))return;customElements.define(w0,e3())}var Q5="lw-portal-handoff",a4=138.23,Z5=`
|
|
193
193
|
:host { all: initial; }
|
|
194
194
|
.backdrop {
|
|
195
195
|
position: fixed; inset: 0; z-index: 2147483002;
|
|
@@ -219,10 +219,10 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
|
|
|
219
219
|
.ring .track { stroke: #e2e8f0; }
|
|
220
220
|
.ring .bar {
|
|
221
221
|
stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
|
|
222
|
-
stroke-dasharray: ${
|
|
222
|
+
stroke-dasharray: ${a4}; stroke-dashoffset: 0;
|
|
223
223
|
animation: deplete var(--secs, 3s) linear forwards;
|
|
224
224
|
}
|
|
225
|
-
@keyframes deplete { to { stroke-dashoffset: ${
|
|
225
|
+
@keyframes deplete { to { stroke-dashoffset: ${a4}; } }
|
|
226
226
|
.count {
|
|
227
227
|
position: absolute; inset: 0; display: grid; place-items: center;
|
|
228
228
|
font-size: 18px; font-weight: 600; color: #0f172a;
|
|
@@ -266,7 +266,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
|
|
|
266
266
|
.ring .bar { animation: none; stroke-dashoffset: 0; }
|
|
267
267
|
.spinner { animation-duration: 2s; }
|
|
268
268
|
}
|
|
269
|
-
`;function
|
|
269
|
+
`;function t4(z){if(typeof document>"u")return z.prepare().then((I)=>void z.go(I),()=>{return});let J=j0(N().locale),$=Math.max(1,Math.floor(z.seconds??3)),j=document.createElement(Q5),Q=j.attachShadow({mode:"open"});f0(Q);let Z=document.createElement("style");Z.textContent=Z5,Q.append(Z);let V=document.createElement("div");V.className="backdrop",V.innerHTML=`
|
|
270
270
|
<div class="card" role="dialog" aria-modal="true" aria-labelledby="lw-ho-title">
|
|
271
271
|
<div class="dial">
|
|
272
272
|
<svg class="ring" viewBox="0 0 52 52" aria-hidden="true">
|
|
@@ -282,7 +282,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
|
|
|
282
282
|
<button type="button" class="cancel"></button>
|
|
283
283
|
<button type="button" class="go"></button>
|
|
284
284
|
</div>
|
|
285
|
-
</div>`,Q.append(
|
|
285
|
+
</div>`,Q.append(V);let Y=(I)=>V.querySelector(I),G=Y(".card"),H=Y(".bar"),C=Y(".count"),q=Y("h2"),B=Y(".body"),k=Y(".host"),R=Y(".go"),w=Y(".cancel");q.textContent=J.handoffTitle,B.textContent=J.handoffBody;try{k.textContent=new URL(N().host).host}catch{k.textContent=""}R.textContent=J.handoffGo,w.textContent=J.cancel,G.style.setProperty("--secs",`${$}s`),C.textContent=String($),document.body.append(j),requestAnimationFrame(()=>V.setAttribute("data-open","1"));let y=document.activeElement;return R.focus({preventScroll:!0}),new Promise((I)=>{let _=!1,l=null,r=!1,b=Date.now()+$*1000,h=window.setInterval(()=>{let T=Math.ceil((b-Date.now())/1000);if(C.textContent=String(Math.max(0,T)),Date.now()>=b)E()},100);function x(T){if(_)return;if(_=!0,window.clearInterval(h),document.removeEventListener("keydown",n,!0),V.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!T)y?.focus?.({preventScroll:!0});I()}function I0(T){window.clearInterval(h),H.classList.remove("spinner"),H.style.animation="none",C.textContent="",q.textContent=J.handoffBlocked,B.textContent=J.handoffBody;let m=document.createElement("a");m.className="go",m.href=T,m.target="_blank",m.rel="noopener noreferrer",m.textContent=J.handoffOpen,m.addEventListener("click",()=>x(!0)),R.replaceWith(m),m.focus({preventScroll:!0})}function E(){if(_||r)return;if(l)return z.go(l)?x(!0):I0(l);window.clearInterval(h),C.textContent="",H.classList.add("spinner"),q.textContent=J.handoffPreparing}function n(T){if(T.key==="Escape")T.stopPropagation(),x(!1)}document.addEventListener("keydown",n,!0),R.addEventListener("click",E),w.addEventListener("click",()=>x(!1)),V.addEventListener("click",(T)=>{if(T.target===V)x(!1)}),z.prepare().then((T)=>{if(l=T,!_&&Date.now()>=b)E()},()=>{r=!0,window.clearInterval(h),G.classList.add("error"),H.classList.remove("spinner"),H.style.animation="none",C.textContent="",q.textContent=J.handoffFailed,B.textContent=J.handoffBody,R.remove(),w.textContent=J.close})})}var X5="/sso";function z6(z,J,$,j){let Q=new URL(X5,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class I1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function M2(z){let J=N();if(!J.identity)throw new I1;let $=await J.identity();if(!$)throw new I1;return z6(J.host,J.realmKey,$,z)}var J6=M2;function e4(z,J){if(J==="_self")return window.location.assign(z),!0;let $=window.open(z,"_blank");if(!$)return!1;try{$.opener=null}catch{}return!0}async function V5(z={}){if(z.announce===!1){e4(await M2(z.returnTo),z.target);return}await t4({seconds:z.seconds,prepare:()=>M2(z.returnTo),go:(J)=>e4(J,z.target)})}var Y5="lw-call-ring",K5=`
|
|
286
286
|
:host { all: initial; }
|
|
287
287
|
.card {
|
|
288
288
|
position: fixed; right: 16px; bottom: 16px; z-index: 2147483002;
|
|
@@ -333,7 +333,7 @@ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #1a1
|
|
|
333
333
|
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
|
|
334
334
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
335
335
|
@media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } .spin { animation: none; } }
|
|
336
|
-
`,C1=(z)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${z}</svg>`,s4=C1('<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"/>'),j5=C1('<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"/>'),Q5=C1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),Z5=C1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),v=null,Q0=null,w0=null;function X5(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var b0=()=>$0(N().locale);function Y5(){if(typeof document>"u")return null;if(v?.isConnected)return v.shadowRoot;v=document.createElement(J5),v.dataset.debugReporter="true";let z=v.attachShadow({mode:"open"});return x0(z),document.body.append(v),z}function I1(z,J,$,j){let Q=document.createElement("button");return Q.type="button",Q.className=z,Q.innerHTML=J,Q.dataset.lwRing=$,Q.onclick=j,Q}var r0=(z)=>{let J=document.createElement("span");return J.textContent=z,J.outerHTML};function t4(z,J,$,j,Q){let Z=b0();z.innerHTML="";let Y=document.createElement("style");Y.textContent=$5;let V=document.createElement("div");V.className="card",V.setAttribute("role","alertdialog"),V.setAttribute("aria-label",Z.ringTitle),V.dataset.lwCallRing=J.id,V.dataset.lwRingMode=j;let G=document.createElement("div");G.className="head";let H=document.createElement("span");H.className="icon",H.innerHTML=s4;let I=document.createElement("div");I.className="words";let q=document.createElement("h2");q.textContent=Z.ringTitle;let M=document.createElement("p");M.className="about",M.textContent=X5(Z.ringAbout,J),M.title=M.textContent,I.append(q,M),G.append(H,I);let k=document.createElement("p");k.className="how",k.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let R=document.createElement("div");R.className="actions";let w=I1("decline",j5+r0(Z.ringDecline),"decline",()=>$.decline());if(V.append(G,k),j==="frame"&&$.answer){if($.voice)V.append(I1("test",Q5+r0(Z.ringTest),"test",()=>$.voice?.()));let y=I1("answer",s4+r0(Z.ringAnswer),"answer",()=>$.answer?.());R.append(w,y)}else R.append(w,I1("open",r0(Z.ringOpen),"open",()=>$.open()));V.append(R),z.append(Y,V)}function _1(z,J,$="portal"){if(Q0===z.id&&v?.isConnected)return;let j=Y5();if(!j)return;if(Q0=z.id,t4(j,z,J,$),V5(),w0===null)w0=document.title,document.title=`${b0().ringTab} — ${w0}`}function e4(z){let J=v?.shadowRoot;if(!J||Q0!==z)return;let $=J.querySelector(".answer");if($)$.innerHTML=Z5+r0(b0().ringAnswering),$.disabled=!0;let j=J.querySelector(".decline");if(j)j.disabled=!0}function z6(z,J){let $=v?.isConnected?v.shadowRoot:null;if(!$||Q0!==z.id)return _1(z,J,"portal");v.style.display="",t4($,z,J,"portal",b0().ringFallback)}function O1(z){let J=v?.shadowRoot;if(!J)return;F2(),j6();let $=b0(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>O1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>B0(),Q.append(Z)}}function J6(z,J=!0){if(!v?.isConnected||Q0!==z)return;let $=v;if(clearTimeout(a4),!J){$.style.display="",$.style.opacity="";return}$.style.transition="opacity 150ms ease-out",$.style.opacity="0",a4=setTimeout(()=>{if($.style.opacity==="0")$.style.display="none"},160)}var a4;function B0(z){if(z&&Q0&&z!==Q0)return;F2(),j6(),v?.remove(),v=null,Q0=null}function $6(){return v?.isConnected?Q0:null}function j6(){if(w0===null||typeof document>"u")return;if(document.title.startsWith(b0().ringTab))document.title=w0;w0=null}var G0=null,D2;function V5(){F2();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=G0??new J;G0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!G0||G0.state!=="running")return;let j=G0.currentTime;for(let[Q,Z]of[660,880].entries()){let Y=G0.createOscillator(),V=G0.createGain();Y.frequency.value=Z,V.gain.setValueAtTime(0.0001,j+Q*0.22),V.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),V.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),Y.connect(V).connect(G0.destination),Y.start(j+Q*0.22),Y.stop(j+Q*0.22+0.21)}};$(),D2=setInterval($,2200)}function F2(){clearInterval(D2),D2=void 0}var K5=64,W5=3500,G5=700,U5=450,H5=900,P5=20000,Y6={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var D5=/^[A-Za-z0-9_-]{1,32}$/,F5=/^#[0-9a-fA-F]{6}$/,q5=["pen","rect","laser"],Q6=(z)=>z<0?0:z>1?1:z;function Z6(z,J){if(!Array.isArray(z)||z.length<J||z.length>64)return null;let $=[];for(let j of z){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([Q6(Q),Q6(Z)])}return $}function N2(z){if(!z||typeof z!=="object")return null;let J=z;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!D5.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let $=Z6(J.pts,1);return $?{op:"add",id:J.id,pts:$}:null}if(J.op==="begin"){if(!q5.includes(J.kind)||typeof J.color!=="string"||!F5.test(J.color))return null;let $=Z6(J.pts,1);return $?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:$}:null}return null}function q2(z,J){if(z.endedAt!==null)return z.endedAt;return J-z.lastAt>20000?z.lastAt:null}function B2(z,J,$){if(J===null)return 1;let j=$-J;if(z==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class S1{marks=new Map;apply(z,J=Date.now()){if(z.op==="clear"){this.marks.clear();return}if(z.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(z.id),this.marks.set(z.id,{kind:z.kind,color:z.color,pts:z.pts.map(([j,Q])=>({x:j,y:Q,t:J})),endedAt:null,lastAt:J});return}let $=this.marks.get(z.id);if(!$||q2($,J)!==null)return;if(z.op==="end"){$.endedAt=J;return}if($.lastAt=J,$.kind==="rect"){let[j,Q]=z.pts[z.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:J}];return}for(let[j,Q]of z.pts)$.pts.push({x:j,y:Q,t:J});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(z=Date.now()){for(let[J,$]of this.marks)if(B2($.kind,q2($,z),z)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw(z,J,$,j=Date.now()){z.clearRect(0,0,J,$);let Q=Math.max(1,Math.min(J,$));for(let Z of this.marks.values()){let Y=B2(Z.kind,q2(Z,j),j);if(Y<=0||!Z.pts.length)continue;if(z.save(),z.lineCap="round",z.lineJoin="round",Z.kind==="pen")M5(z,Z,J,$,Math.max(3,Q*0.0045),Y);else if(Z.kind==="rect")N5(z,Z,J,$,Math.max(2.5,Q*0.003),Y);else I5(z,Z,J,$,Math.max(6,Q*0.008),Y,j);z.restore()}}}function B5(z,J,$,j){if(z.beginPath(),z.moveTo(J[0].x*$,J[0].y*j),J.length===1){z.lineTo(J[0].x*$+0.01,J[0].y*j);return}for(let Z=1;Z<J.length-1;Z++){let Y=J[Z],V=J[Z+1];z.quadraticCurveTo(Y.x*$,Y.y*j,(Y.x+V.x)/2*$,(Y.y+V.y)/2*j)}let Q=J[J.length-1];z.lineTo(Q.x*$,Q.y*j)}function M5(z,J,$,j,Q,Z){z.globalAlpha=Z,B5(z,J.pts,$,j),z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.stroke(),z.strokeStyle=J.color,z.lineWidth=Q,z.stroke()}function N5(z,J,$,j,Q,Z){let Y=J.pts[0],V=J.pts[J.pts.length-1],G=Math.min(Y.x,V.x)*$,H=Math.min(Y.y,V.y)*j,I=Math.abs(V.x-Y.x)*$,q=Math.abs(V.y-Y.y)*j;z.globalAlpha=Z,z.fillStyle=J.color,z.globalAlpha=Z*0.14,z.fillRect(G,H,I,q),z.globalAlpha=Z,z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.strokeRect(G,H,I,q),z.strokeStyle=J.color,z.lineWidth=Q,z.strokeRect(G,H,I,q)}function I5(z,J,$,j,Q,Z,Y){let V=J.pts.filter((H)=>Y-H.t<=450);for(let H=1;H<V.length;H++){let I=V[H-1],q=V[H];z.globalAlpha=Z*Math.max(0,1-(Y-q.t)/450)*0.7,z.strokeStyle=J.color,z.lineWidth=Q*0.9,z.beginPath(),z.moveTo(I.x*$,I.y*j),z.lineTo(q.x*$,q.y*j),z.stroke()}let G=J.pts[J.pts.length-1];z.globalAlpha=Z,z.shadowColor=J.color,z.shadowBlur=Q*2,z.fillStyle=J.color,z.beginPath(),z.arc(G.x*$,G.y*j,Q,0,Math.PI*2),z.fill(),z.shadowBlur=0,z.strokeStyle="rgba(255,255,255,0.95)",z.lineWidth=2,z.stroke()}function V6(z,J,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(J*j)),Z=Math.max(1,Math.round($*j));if(z.width!==Q)z.width=Q;if(z.height!==Z)z.height=Z;let Y=z.getContext("2d");return Y?.setTransform(j,0,0,j,0,0),Y}class L1{canvas;scene;box;frame=0;constructor(z,J,$){this.canvas=z;this.scene=J;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let z=()=>{this.frame=0;let{w:J,h:$}=this.box(),j=V6(this.canvas,J,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,J,$,Q);if(Z)this.frame=requestAnimationFrame(z)};this.frame=requestAnimationFrame(z)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var K6=33,M2=5000,X6=0.0012,C5=0,_5=()=>`${Date.now().toString(36)}${(C5++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class W6{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor(z,J,$=()=>{return}){this.send=z;this.scene=J;this.onChange=$}get drawing(){return this.id?this.kind:null}begin(z,J){this.end(),this.id=_5(),this.kind=z,this.last=J,this.lastSent=Date.now();let $={op:"begin",id:this.id,kind:z,color:Y6[z],pts:[J]};this.scene.apply($),this.send($),this.keep=setInterval(()=>this.stillHere(),M2),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<M2)return;this.flush();let z={op:"add",id:this.id,pts:[this.last]};this.scene.apply(z),this.send(z),this.lastSent=Date.now()}move(z){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,z);if(this.last&&Math.abs(z[0]-this.last[0])<X6&&Math.abs(z[1]-this.last[1])<X6)return;if(this.last=z,this.scene.apply({op:"add",id:this.id,pts:[z]}),this.onChange(),this.kind==="rect")this.pending=[z];else this.pending.push(z);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,K6-(Date.now()-this.lastSent)))}flush(){if(clearTimeout(this.timer),this.timer=void 0,!this.id||!this.pending.length)return;this.send({op:"add",id:this.id,pts:this.pending}),this.pending=[],this.lastSent=Date.now()}end(){if(!this.id)return;clearInterval(this.keep),this.keep=void 0,this.flush();let z={op:"end",id:this.id};this.scene.apply(z),this.send(z),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let z={op:"clear"};this.scene.apply(z),this.send(z),this.onChange()}}var O5="lw-call-ink",U0=null,R1=null,n0=null;function S5(){if(U0?.isConnected&&n0)return;U0=document.createElement(O5),U0.dataset.debugReporter="true";let z=U0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
|
|
337
|
-
canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",z.append(J,$),document.body.append(U0),
|
|
336
|
+
`,O1=(z)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${z}</svg>`,$6=O1('<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"/>'),W5=O1('<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"/>'),G5=O1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),U5=O1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),v=null,Z0=null,b0=null;function H5(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var g0=()=>j0(N().locale);function P5(){if(typeof document>"u")return null;if(v?.isConnected)return v.shadowRoot;v=document.createElement(Y5),v.dataset.debugReporter="true";let z=v.attachShadow({mode:"open"});return f0(z),document.body.append(v),z}function _1(z,J,$,j){let Q=document.createElement("button");return Q.type="button",Q.className=z,Q.innerHTML=J,Q.dataset.lwRing=$,Q.onclick=j,Q}var s0=(z)=>{let J=document.createElement("span");return J.textContent=z,J.outerHTML};function Q6(z,J,$,j,Q){let Z=g0();z.innerHTML="";let V=document.createElement("style");V.textContent=K5;let Y=document.createElement("div");Y.className="card",Y.setAttribute("role","alertdialog"),Y.setAttribute("aria-label",Z.ringTitle),Y.dataset.lwCallRing=J.id,Y.dataset.lwRingMode=j;let G=document.createElement("div");G.className="head";let H=document.createElement("span");H.className="icon",H.innerHTML=$6;let C=document.createElement("div");C.className="words";let q=document.createElement("h2");q.textContent=Z.ringTitle;let B=document.createElement("p");B.className="about",B.textContent=H5(Z.ringAbout,J),B.title=B.textContent,C.append(q,B),G.append(H,C);let k=document.createElement("p");k.className="how",k.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let R=document.createElement("div");R.className="actions";let w=_1("decline",W5+s0(Z.ringDecline),"decline",()=>$.decline());if(Y.append(G,k),j==="frame"&&$.answer){if($.voice)Y.append(_1("test",G5+s0(Z.ringTest),"test",()=>$.voice?.()));let y=_1("answer",$6+s0(Z.ringAnswer),"answer",()=>$.answer?.());R.append(w,y)}else R.append(w,_1("open",s0(Z.ringOpen),"open",()=>$.open()));Y.append(R),z.append(V,Y)}function S1(z,J,$="portal"){if(Z0===z.id&&v?.isConnected)return;let j=P5();if(!j)return;if(Z0=z.id,Q6(j,z,J,$),D5(),b0===null)b0=document.title,document.title=`${g0().ringTab} — ${b0}`}function Z6(z){let J=v?.shadowRoot;if(!J||Z0!==z)return;let $=J.querySelector(".answer");if($)$.innerHTML=U5+s0(g0().ringAnswering),$.disabled=!0;let j=J.querySelector(".decline");if(j)j.disabled=!0}function X6(z,J){let $=v?.isConnected?v.shadowRoot:null;if(!$||Z0!==z.id)return S1(z,J,"portal");v.style.display="",Q6($,z,J,"portal",g0().ringFallback)}function L1(z){let J=v?.shadowRoot;if(!J)return;N2(),K6();let $=g0(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>L1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>B0(),Q.append(Z)}}function V6(z,J=!0){if(!v?.isConnected||Z0!==z)return;let $=v;if(clearTimeout(j6),!J){$.style.display="",$.style.opacity="";return}$.style.transition="opacity 150ms ease-out",$.style.opacity="0",j6=setTimeout(()=>{if($.style.opacity==="0")$.style.display="none"},160)}var j6;function B0(z){if(z&&Z0&&z!==Z0)return;N2(),K6(),v?.remove(),v=null,Z0=null}function Y6(){return v?.isConnected?Z0:null}function K6(){if(b0===null||typeof document>"u")return;if(document.title.startsWith(g0().ringTab))document.title=b0;b0=null}var G0=null,B2;function D5(){N2();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=G0??new J;G0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!G0||G0.state!=="running")return;let j=G0.currentTime;for(let[Q,Z]of[660,880].entries()){let V=G0.createOscillator(),Y=G0.createGain();V.frequency.value=Z,Y.gain.setValueAtTime(0.0001,j+Q*0.22),Y.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),Y.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),V.connect(Y).connect(G0.destination),V.start(j+Q*0.22),V.stop(j+Q*0.22+0.21)}};$(),B2=setInterval($,2200)}function N2(){clearInterval(B2),B2=void 0}var F5=64,q5=3500,M5=700,B5=450,N5=900,C5=20000,H6={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var I5=/^[A-Za-z0-9_-]{1,32}$/,_5=/^#[0-9a-fA-F]{6}$/,O5=["pen","rect","laser"],W6=(z)=>z<0?0:z>1?1:z;function G6(z,J){if(!Array.isArray(z)||z.length<J||z.length>64)return null;let $=[];for(let j of z){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([W6(Q),W6(Z)])}return $}function a0(z){if(!z||typeof z!=="object")return null;let J=z;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!I5.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let $=G6(J.pts,1);return $?{op:"add",id:J.id,pts:$}:null}if(J.op==="begin"){if(!O5.includes(J.kind)||typeof J.color!=="string"||!_5.test(J.color))return null;let $=G6(J.pts,1);return $?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:$}:null}return null}function C2(z,J){if(z.endedAt!==null)return z.endedAt;return J-z.lastAt>20000?z.lastAt:null}function I2(z,J,$){if(J===null)return 1;let j=$-J;if(z==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class R1{marks=new Map;apply(z,J=Date.now()){if(z.op==="clear"){this.marks.clear();return}if(z.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(z.id),this.marks.set(z.id,{kind:z.kind,color:z.color,pts:z.pts.map(([j,Q])=>({x:j,y:Q,t:J})),endedAt:null,lastAt:J});return}let $=this.marks.get(z.id);if(!$||C2($,J)!==null)return;if(z.op==="end"){$.endedAt=J;return}if($.lastAt=J,$.kind==="rect"){let[j,Q]=z.pts[z.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:J}];return}for(let[j,Q]of z.pts)$.pts.push({x:j,y:Q,t:J});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(z=Date.now()){for(let[J,$]of this.marks)if(I2($.kind,C2($,z),z)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw(z,J,$,j=Date.now()){z.clearRect(0,0,J,$);let Q=Math.max(1,Math.min(J,$));for(let Z of this.marks.values()){let V=I2(Z.kind,C2(Z,j),j);if(V<=0||!Z.pts.length)continue;if(z.save(),z.lineCap="round",z.lineJoin="round",Z.kind==="pen")L5(z,Z,J,$,Math.max(3,Q*0.0045),V);else if(Z.kind==="rect")R5(z,Z,J,$,Math.max(2.5,Q*0.003),V);else A5(z,Z,J,$,Math.max(6,Q*0.008),V,j);z.restore()}}}function S5(z,J,$,j){if(z.beginPath(),z.moveTo(J[0].x*$,J[0].y*j),J.length===1){z.lineTo(J[0].x*$+0.01,J[0].y*j);return}for(let Z=1;Z<J.length-1;Z++){let V=J[Z],Y=J[Z+1];z.quadraticCurveTo(V.x*$,V.y*j,(V.x+Y.x)/2*$,(V.y+Y.y)/2*j)}let Q=J[J.length-1];z.lineTo(Q.x*$,Q.y*j)}function L5(z,J,$,j,Q,Z){z.globalAlpha=Z,S5(z,J.pts,$,j),z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.stroke(),z.strokeStyle=J.color,z.lineWidth=Q,z.stroke()}function R5(z,J,$,j,Q,Z){let V=J.pts[0],Y=J.pts[J.pts.length-1],G=Math.min(V.x,Y.x)*$,H=Math.min(V.y,Y.y)*j,C=Math.abs(Y.x-V.x)*$,q=Math.abs(Y.y-V.y)*j;z.globalAlpha=Z,z.fillStyle=J.color,z.globalAlpha=Z*0.14,z.fillRect(G,H,C,q),z.globalAlpha=Z,z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.strokeRect(G,H,C,q),z.strokeStyle=J.color,z.lineWidth=Q,z.strokeRect(G,H,C,q)}function A5(z,J,$,j,Q,Z,V){let Y=J.pts.filter((H)=>V-H.t<=450);for(let H=1;H<Y.length;H++){let C=Y[H-1],q=Y[H];z.globalAlpha=Z*Math.max(0,1-(V-q.t)/450)*0.7,z.strokeStyle=J.color,z.lineWidth=Q*0.9,z.beginPath(),z.moveTo(C.x*$,C.y*j),z.lineTo(q.x*$,q.y*j),z.stroke()}let G=J.pts[J.pts.length-1];z.globalAlpha=Z,z.shadowColor=J.color,z.shadowBlur=Q*2,z.fillStyle=J.color,z.beginPath(),z.arc(G.x*$,G.y*j,Q,0,Math.PI*2),z.fill(),z.shadowBlur=0,z.strokeStyle="rgba(255,255,255,0.95)",z.lineWidth=2,z.stroke()}function P6(z,J,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(J*j)),Z=Math.max(1,Math.round($*j));if(z.width!==Q)z.width=Q;if(z.height!==Z)z.height=Z;let V=z.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class A1{canvas;scene;box;frame=0;constructor(z,J,$){this.canvas=z;this.scene=J;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let z=()=>{this.frame=0;let{w:J,h:$}=this.box(),j=P6(this.canvas,J,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,J,$,Q);if(Z)this.frame=requestAnimationFrame(z)};this.frame=requestAnimationFrame(z)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var D6=33,_2=5000,U6=0.0012,T5=0,k5=()=>`${Date.now().toString(36)}${(T5++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class F6{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor(z,J,$=()=>{return}){this.send=z;this.scene=J;this.onChange=$}get drawing(){return this.id?this.kind:null}begin(z,J){this.end(),this.id=k5(),this.kind=z,this.last=J,this.lastSent=Date.now();let $={op:"begin",id:this.id,kind:z,color:H6[z],pts:[J]};this.scene.apply($),this.send($),this.keep=setInterval(()=>this.stillHere(),_2),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<_2)return;this.flush();let z={op:"add",id:this.id,pts:[this.last]};this.scene.apply(z),this.send(z),this.lastSent=Date.now()}move(z){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,z);if(this.last&&Math.abs(z[0]-this.last[0])<U6&&Math.abs(z[1]-this.last[1])<U6)return;if(this.last=z,this.scene.apply({op:"add",id:this.id,pts:[z]}),this.onChange(),this.kind==="rect")this.pending=[z];else this.pending.push(z);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,D6-(Date.now()-this.lastSent)))}flush(){if(clearTimeout(this.timer),this.timer=void 0,!this.id||!this.pending.length)return;this.send({op:"add",id:this.id,pts:this.pending}),this.pending=[],this.lastSent=Date.now()}end(){if(!this.id)return;clearInterval(this.keep),this.keep=void 0,this.flush();let z={op:"end",id:this.id};this.scene.apply(z),this.send(z),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let z={op:"clear"};this.scene.apply(z),this.send(z),this.onChange()}}var E5="lw-call-ink",U0=null,T1=null,t0=null;function x5(){if(U0?.isConnected&&t0)return;U0=document.createElement(E5),U0.dataset.debugReporter="true";let z=U0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
|
|
337
|
+
canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",z.append(J,$),document.body.append(U0),T1=new R1,t0=new A1($,T1,()=>({w:window.innerWidth,h:window.innerHeight}))}function k1(z){if(typeof document>"u")return;if(z.op==="clear"&&!U0)return;x5(),T1.apply(z),t0.kick()}function E1(){t0?.stop(),U0?.remove(),U0=null,T1=null,t0=null}var f5="lw-call-frame",w5="lw-call",c=16,A2=368,z0=null,f=null,N0=null,w1="",z1=null,J1="card",T2={width:A2,height:0},k2,$1=!1,E2=null,y0={answer:!1,voice:!1},H0=null,p=null,O2="lw-call-frame-place";function q6(z,J,$,j){let Q=new URL("embed/call",z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),$)Q.searchParams.set("token",$);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function v0(z){f?.contentWindow?.postMessage({source:"lw-call-host",...z},w1)}function M6(z){if(N0!==z)return;if(y0.answer=!0,$1)v0({type:"answer"})}function B6(z){if(N0!==z)return;if(y0.voice=!0,$1)v0({type:"voice"})}function N6(z,J,$){return{x:Math.min(Math.max(z.x,c/2),Math.max(c/2,$.w-J.w-c/2)),y:Math.min(Math.max(z.y,c/2),Math.max(c/2,$.h-J.h-c/2))}}function b5(z,J){if(z.origin!==J.origin||z.source!==J.window)return null;let $=z.data;return $&&typeof $==="object"&&$.source===w5&&typeof $.type==="string"?$:null}function m0(){return z0?.isConnected?N0:null}function C6(z,J,$,j=15000,Q=null){if(typeof document>"u")return;if(N0===J&&z0?.isConnected)return;u0(),N0=J,z1=$,$1=!1,E2=Q,y0={answer:!1,voice:!1},J1="card",T2={width:A2,height:0},w1=new URL(z).origin;try{H0=JSON.parse(sessionStorage.getItem(O2)??"null")}catch{H0=null}z0=document.createElement(f5),z0.dataset.debugReporter="true";let Z=z0.attachShadow({mode:"open"}),V=document.createElement("style");V.textContent=`:host { all: initial; }
|
|
338
338
|
iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
|
|
339
|
-
iframe.on { visibility: visible; }`,f=document.createElement("iframe"),f.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",f.title="สายจากทีมงาน",f.dataset.lwCallFrame=J,f.setAttribute("allowtransparency","true"),f.src=z,Z.append(Y,f),document.body.append(Z0),y0(),window.addEventListener("message",B6),window.addEventListener("resize",y0),M6(`lw-call:${J}`),L2=setTimeout(()=>{if(!e0)C2("timeout")},j)}function h0(){if(Z0)M6(null);U6(),clearTimeout(L2),window.removeEventListener("message",B6),window.removeEventListener("resize",y0),A1(!1),Z0?.remove(),Z0=null,f=null,M0=null,a0=null,p=null,R2=null,v0={answer:!1,voice:!1}}function C2(z){let J=a0;h0(),J?.failed(z)}function B6(z){if(!f)return;let J=A5(z,{origin:k1,window:f.contentWindow});if(!J)return;switch(J.type){case"hello":R2?.then(($)=>{if(!f||M0===null)return;if($)g0({type:"token",token:$});else C2("no_token")});return;case"ready":if(e0=!0,clearTimeout(L2),f.classList.add("on"),a0?.ready(),v0.answer)g0({type:"answer"});if(v0.voice)g0({type:"voice"});return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")S2={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&t0==="card")T5();t0=J.layout}return y0();case"drag":return _2(J);case"home":return H0=null,N6(),y0();case"done":{let $=a0;h0(),$?.done();return}case"failed":return C2(J.reason??"failed");case"ink":{let $=N2(J.op);if($)G6($);return}}}function M6(z){let J=typeof navigator>"u"?void 0:navigator.mediaDevices;try{J?.setCaptureHandleConfig?.(z?{handle:z,exposeOrigin:!1,permittedOrigins:[k1]}:{})}catch{}}function _2(z){if(!f||t0!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=f.getBoundingClientRect();p={sx:z.x,sy:z.y,x:J.left,y:J.top,lx:z.x,ly:z.y},A1(!0);return}if(!p)return;if(p.lx=z.x,p.ly=z.y,H0=F6({x:p.x+(z.x-p.sx),y:p.y+(z.y-p.sy)},I6(),T1()),y0(),z.phase==="end")p=null,A1(!1),N6()}var s0=null;function A1(z){if(s0){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,s0,!0);s0=null}if(!z)return;s0=(J)=>{if(!p)return A1(!1);if(J.type==="pointermove"&&J.buttons!==0)return _2({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let $=J.type==="pointerup";_2({type:"drag",phase:"end",x:$?J.screenX:p.lx,y:$?J.screenY:p.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,s0,!0)}function T5(){if(!f?.contentWindow)return;let z=f.getBoundingClientRect();g0({type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)})}function N6(){try{if(H0)sessionStorage.setItem(I2,JSON.stringify(H0));else sessionStorage.removeItem(I2)}catch{}}var T1=()=>({w:window.innerWidth,h:window.innerHeight});function I6(){let z=T1();return{w:Math.min(O2,z.w-c),h:Math.min(S2.height||0,z.h-c)}}function y0(){if(!f)return;let z=f.style;if(t0==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=I6(),$=T1().w<480;if(z.width=$?`calc(100vw - ${c}px)`:`${J.w}px`,z.height=`${J.h}px`,H0&&!$){let j=F6(H0,J,T1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?`${c/2}px`:"",top:"",right:$?"":`${c/2}px`,bottom:`${c/2}px`})}var E1=[2000,5000,15000,30000,60000],k5=new Set(["ringing","active"]),E5=20000,A2=!1,N0=!1,C6=0,x5=5,$1=null,L6=0,x1,T2,k2,R6=(z)=>z.endsWith("/")?z:`${z}/`;function f5(z,J){let $=new URL("api/presence/ws",R6(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function w5(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function b5(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function w1(){let z=N().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function f2(z,J){let $=N();return fetch(new URL(z,R6($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function b1(){if(A2||typeof window>"u"||typeof WebSocket>"u")return;let z=N();if(!z.identity||z.ring===!1)return;A2=!0,N0=!1,y5(z.host),A6()}function g5(){N0=!0,A2=!1,clearTimeout(T2),clearInterval(x1),clearTimeout(k2);try{$1?.close(1000,"bye")}catch{}$1=null,B0(),h0()}function J1(z=!1){if(N0)return;let J=z?E1[E1.length-1]:E1[Math.min(L6++,E1.length-1)];clearTimeout(T2),T2=setTimeout(()=>void A6(),J)}async function A6(){if(N0)return;let z=await w1();if(!z){if(++C6>=x5){N0=!0;return}return J1(!0)}C6=0;let J;try{J=await f2("ingest/live-ticket",z)}catch{return J1()}if(J.status===401||J.status===404||J.status===403){N0=!0;return}if(!J.ok)return J1(J.status===429);let $;try{$=await J.json()}catch{return J1()}if(!$.calls||!$.ticket){N0=!0;return}if($.call)S6($.call);let j=new WebSocket(f5(N().host,$.ticket));$1=j,j.onopen=()=>{L6=0,clearInterval(x1),x1=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},E5)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)S6(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(x1),$1===j)$1=null;J1()}}var E2="lw-call-framed";function v5(){try{return sessionStorage.getItem(E2)}catch{return null}}function f1(z){try{if(z)sessionStorage.setItem(E2,z);else sessionStorage.removeItem(E2)}catch{}}var _6=!1;function y5(z){if(_6||typeof document>"u")return;_6=!0;try{let J=new URL(z).origin;for(let $ of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=$,j.href=J,$==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function O6(z){let J=N();if(J.callFrame===!1||z1()===z.id)return;f1(z.id),q6(H6(J.host,J.realmKey,null,z.id),z.id,{ready:()=>J6(z.id),done:()=>{f1(null),B0(z.id)},failed:()=>{f1(null),z6(z,x2(z))}},15000,w1())}var x2=(z)=>({open:()=>h5(z),decline:()=>void m5(z)});function S6(z){if(!b5(z)){if(B0(z.id),z.status==="active"&&v5()===z.id&&!z1())O6(z);if(!k5.has(z.status)&&z1()===z.id)setTimeout(()=>{if(z1()===z.id)h0(),f1(null)},12000);return}if(N().callFrame===!1)_1(z,x2(z),"portal");else _1(z,{...x2(z),answer:()=>{e4(z.id),P6(z.id)},voice:()=>D6(z.id)},"frame"),O6(z);clearTimeout(k2);let J=new Date(z.ringUntil).getTime()-Date.now();k2=setTimeout(()=>{if($6()===z.id)B0(z.id)},Math.max(5000,J+5000))}function h5(z){let J=window.open("about:blank","_blank");(async()=>{let $=await w1();if($)f2(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await n4(w5(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}O1()}else O1(j)})()}async function m5(z){B0(z.id);let J=await w1();if(J)await f2(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var T6=!1;function u5(z={}){if(T6||typeof window>"u")return;if(!m0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(T6=!0,F4(),e2(),r2(),Y4(),B4(),z.ui===!1)return;let J=$0(N().locale);if(o1((j)=>{F0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>l1(j)})}),H2(),!document.querySelector(f0))document.body.append(document.createElement(f0));let $=window.requestIdleCallback;if($)$(()=>void q0(),{timeout:5000});else setTimeout(()=>void q0(),2000);if($)$(()=>b1(),{timeout:8000});else setTimeout(()=>b1(),3000)}var p5=new Set(["error","exception","unhandledrejection"]);function k6(z){if(z.error)return!0;return z.status!==null&&z.status>=400}function w2(z){if(!z)return null;let J=Date.parse(z);return Number.isNaN(J)?null:J}function d5(z){try{let{pathname:J}=new URL(z,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return z.split(/[?#]/)[0]??z}}function i5(z,J,$){let j=(Y)=>({elapsedMs:Y,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(z.length===0)return[];let Q=z.map((Y)=>w2(Y.at)),Z=(Y)=>{for(let V=Y+1;V<Q.length;V+=1){let G=Q[V];if(G!=null)return G}return Number.POSITIVE_INFINITY};return z.map((Y,V)=>{let G=Q[V]??null,H=(V>0?Q[V-1]:null)??null,I=G!==null&&H!==null?Math.max(0,G-H):null;if(G===null)return j(I);let q=G,M=Math.max(q,Z(V)),k=(C)=>C!==null&&C>=q&&(C<M||M===Number.POSITIVE_INFINITY),R=J.filter((C)=>k(w2(C.startedAt))),w=$.filter((C)=>p5.has(C.level)&&k(w2(C.at))),y=R.map((C)=>C.durationMs).filter((C)=>typeof C==="number");return{elapsedMs:I,requests:R,failedRequests:R.filter(k6),consoleErrors:w,slowestMs:y.length>0?Math.max(...y):null}})}function c5(z,J){return z.requests.length===0&&z.consoleErrors.length===0&&(z.elapsedMs===null||z.elapsedMs<J)}function l5(z){if(z<1000)return`${Math.round(z)} มิลลิวินาที`;let J=z/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let $=Math.floor(J/60),j=Math.round(J%60);return j===0?`${$} นาที`:`${$} นาที ${j} วิ`}export{J2 as trimToBudget,_4 as toCurl,s1 as takeReplay,r4 as supportPortalUrl,Y2 as submitRequest,Z2 as submitBundle,l8 as stopReplay,g5 as stopLiveRing,b1 as startLiveRing,V6 as sizeInkCanvas,F0 as showToast,i3 as setErroredQueriesSource,D1 as requestTypesNow,d5 as requestPath,$0 as reporterStrings,J0 as redactUrl,L0 as redactLabel,R0 as redactHeaders,A0 as redactBody,N2 as readInkOp,j2 as packReplay,z5 as openSupportPortal,c1 as onLaunch,o1 as onCrash,h6 as moduleResolver,q0 as loadRequestTypes,l1 as launch,c8 as isReplayRecording,c5 as isQuietStep,k6 as isFailedRequest,m0 as isConfigured,u5 as installDebugCapture,B2 as inkAlpha,G3 as hasCause,n1 as getNetworkLog,i1 as getConsoleLog,N as getConfig,p1 as getActionTrail,l5 as formatDuration,e1 as errorSignature,r1 as emitCrash,H2 as defineReporterElement,W2 as createAnnotator,i5 as correlateActionTrail,w6 as configureDebugCapture,G1 as captureScreen,V3 as bundleToMarkdown,W3 as bundleFileName,i0 as buildBundle,e as appInfo,m1 as actionCountSuffix,f0 as REPORTER_TAG,R4 as REPLAY_FILENAME,S0 as REDACTED,N1 as NoIdentityError,U5 as LASER_TRAIL_MS,H5 as LASER_LINGER_MS,W6 as InkSender,S1 as InkScene,L1 as InkPainter,P5 as INK_STALE_MS,K6 as INK_SEND_EVERY_MS,K5 as INK_MAX_POINTS_PER_OP,M2 as INK_KEEP_MS,W5 as INK_HOLD_MS,G5 as INK_FADE_MS,Y6 as INK_COLORS,z2 as BUNDLE_BUDGET_BYTES};
|
|
339
|
+
iframe.on { visibility: visible; }`,f=document.createElement("iframe"),f.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",f.title="สายจากทีมงาน",f.dataset.lwCallFrame=J,f.setAttribute("allowtransparency","true"),f.src=z,Z.append(V,f),document.body.append(z0),h0(),window.addEventListener("message",I6),window.addEventListener("resize",h0),x2(`lw-call:${J}`),k2=setTimeout(()=>{if(!$1)S2("timeout")},j)}function u0(){if(z0)x2(L2?.handle??null,L2?.readableBy);E1(),clearTimeout(k2),window.removeEventListener("message",I6),window.removeEventListener("resize",h0),x1(!1),z0?.remove(),z0=null,f=null,N0=null,z1=null,p=null,E2=null,y0={answer:!1,voice:!1}}function S2(z){let J=z1;u0(),J?.failed(z)}function I6(z){if(!f)return;let J=b5(z,{origin:w1,window:f.contentWindow});if(!J)return;switch(J.type){case"hello":E2?.then(($)=>{if(!f||N0===null)return;if($)v0({type:"token",token:$});else S2("no_token")});return;case"ready":if($1=!0,clearTimeout(k2),f.classList.add("on"),z1?.ready(),y0.answer)v0({type:"answer"});if(y0.voice)v0({type:"voice"});return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")T2={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&J1==="card")g5();J1=J.layout}return h0();case"drag":return R2(J);case"home":return H0=null,O6(),h0();case"done":{let $=z1;u0(),$?.done();return}case"failed":return S2(J.reason??"failed");case"ink":{let $=a0(J.op);if($)k1($);return}}}function x2(z,J=w1){let $=typeof navigator>"u"?void 0:navigator.mediaDevices;try{$?.setCaptureHandleConfig?.(z&&J?{handle:z,exposeOrigin:!1,permittedOrigins:[J]}:{})}catch{}}var L2=null;function _6(z,J){if(L2={handle:z,readableBy:J},!z0?.isConnected)x2(z,J)}function R2(z){if(!f||J1!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=f.getBoundingClientRect();p={sx:z.x,sy:z.y,x:J.left,y:J.top,lx:z.x,ly:z.y},x1(!0);return}if(!p)return;if(p.lx=z.x,p.ly=z.y,H0=N6({x:p.x+(z.x-p.sx),y:p.y+(z.y-p.sy)},S6(),f1()),h0(),z.phase==="end")p=null,x1(!1),O6()}var e0=null;function x1(z){if(e0){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,e0,!0);e0=null}if(!z)return;e0=(J)=>{if(!p)return x1(!1);if(J.type==="pointermove"&&J.buttons!==0)return R2({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let $=J.type==="pointerup";R2({type:"drag",phase:"end",x:$?J.screenX:p.lx,y:$?J.screenY:p.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,e0,!0)}function g5(){if(!f?.contentWindow)return;let z=f.getBoundingClientRect();v0({type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)})}function O6(){try{if(H0)sessionStorage.setItem(O2,JSON.stringify(H0));else sessionStorage.removeItem(O2)}catch{}}var f1=()=>({w:window.innerWidth,h:window.innerHeight});function S6(){let z=f1();return{w:Math.min(A2,z.w-c),h:Math.min(T2.height||0,z.h-c)}}function h0(){if(!f)return;let z=f.style;if(J1==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=S6(),$=f1().w<480;if(z.width=$?`calc(100vw - ${c}px)`:`${J.w}px`,z.height=`${J.h}px`,H0&&!$){let j=N6(H0,J,f1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?`${c/2}px`:"",top:"",right:$?"":`${c/2}px`,bottom:`${c/2}px`})}var b1=[2000,5000,15000,30000,60000],L6=new Set(["ringing","active"]),v5=20000,f2=!1,C0=!1,R6=0,y5=5,Q1=null,x6=0,g1,w2,b2,f6=(z)=>z.endsWith("/")?z:`${z}/`;function h5(z,J){let $=new URL("api/presence/ws",f6(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function m5(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function u5(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function y1(){let z=N().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function h2(z,J){let $=N();return fetch(new URL(z,f6($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function h1(){if(f2||typeof window>"u"||typeof WebSocket>"u")return;let z=N();if(!z.identity||z.ring===!1)return;f2=!0,C0=!1,i5(z.host);try{_6(`lw-tab:${b6()}`,new URL(z.host).origin)}catch{}w6()}function p5(){C0=!0,f2=!1,clearTimeout(w2),clearInterval(g1),clearTimeout(b2);try{Q1?.close(1000,"bye")}catch{}Q1=null,B0(),u0()}function j1(z=!1){if(C0)return;let J=z?b1[b1.length-1]:b1[Math.min(x6++,b1.length-1)];clearTimeout(w2),w2=setTimeout(()=>void w6(),J)}async function w6(){if(C0)return;let z=await y1();if(!z){if(++R6>=y5){C0=!0;return}return j1(!0)}R6=0;let J;try{J=await h2("ingest/live-ticket",z)}catch{return j1()}if(J.status===401||J.status===404||J.status===403){C0=!0;return}if(!J.ok)return j1(J.status===429);let $;try{$=await J.json()}catch{return j1()}if(!$.calls||!$.ticket){C0=!0;return}if($.call)E6($.call);let j=new WebSocket(h5(N().host,$.ticket));Q1=j,j.onopen=()=>{x6=0,j.send(JSON.stringify({type:"tab",id:b6()})),clearInterval(g1),g1=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},v5)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call&&typeof Z.call==="object")E6(Z.call);else if(Z.type==="call-ink"&&typeof Z.call==="string"){let V=a0(Z.op);if(V)y2=Z.call,k1(V)}}catch{}},j.onclose=()=>{if(clearInterval(g1),Q1===j)Q1=null;j1()}}var g2="lw-call-framed";function d5(){try{return sessionStorage.getItem(g2)}catch{return null}}function v1(z){try{if(z)sessionStorage.setItem(g2,z);else sessionStorage.removeItem(g2)}catch{}}var A6=!1;function i5(z){if(A6||typeof document>"u")return;A6=!0;try{let J=new URL(z).origin;for(let $ of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=$,j.href=J,$==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function T6(z){let J=N();if(J.callFrame===!1||m0()===z.id)return;v1(z.id),C6(q6(J.host,J.realmKey,null,z.id),z.id,{ready:()=>V6(z.id),done:()=>{v1(null),B0(z.id)},failed:()=>{v1(null),X6(z,v2(z))}},15000,y1())}var v2=(z)=>({open:()=>c5(z),decline:()=>void l5(z)}),P0=null;function b6(){if(P0)return P0;try{P0=sessionStorage.getItem(k6)}catch{}if(!P0||!/^[A-Za-z0-9_-]{8,40}$/.test(P0)){let z=new Uint8Array(12);crypto.getRandomValues(z),P0=Array.from(z,(J)=>J.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(k6,P0)}catch{}}return P0}var k6="lw-tab-id",y2=null;function E6(z){if(!L6.has(z.status)&&y2===z.id&&m0()!==z.id)y2=null,E1();if(!u5(z)){if(B0(z.id),z.status==="active"&&d5()===z.id&&!m0())T6(z);if(!L6.has(z.status)&&m0()===z.id)setTimeout(()=>{if(m0()===z.id)u0(),v1(null)},12000);return}if(N().callFrame===!1)S1(z,v2(z),"portal");else S1(z,{...v2(z),answer:()=>{Z6(z.id),M6(z.id)},voice:()=>B6(z.id)},"frame"),T6(z);clearTimeout(b2);let J=new Date(z.ringUntil).getTime()-Date.now();b2=setTimeout(()=>{if(Y6()===z.id)B0(z.id)},Math.max(5000,J+5000))}function c5(z){let J=window.open("about:blank","_blank");(async()=>{let $=await y1();if($)h2(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await J6(m5(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}L1()}else L1(j)})()}async function l5(z){B0(z.id);let J=await y1();if(J)await h2(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var g6=!1;function o5(z={}){if(g6||typeof window>"u")return;if(!p0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(g6=!0,I4(),Z4(),z4(),H4(),O4(),z.ui===!1)return;let J=j0(N().locale);if(a1((j)=>{q0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>s1(j)})}),q2(),!document.querySelector(w0))document.body.append(document.createElement(w0));let $=window.requestIdleCallback;if($)$(()=>void M0(),{timeout:5000});else setTimeout(()=>void M0(),2000);if($)$(()=>h1(),{timeout:8000});else setTimeout(()=>h1(),3000)}var r5=new Set(["error","exception","unhandledrejection"]);function v6(z){if(z.error)return!0;return z.status!==null&&z.status>=400}function m2(z){if(!z)return null;let J=Date.parse(z);return Number.isNaN(J)?null:J}function n5(z){try{let{pathname:J}=new URL(z,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return z.split(/[?#]/)[0]??z}}function s5(z,J,$){let j=(V)=>({elapsedMs:V,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(z.length===0)return[];let Q=z.map((V)=>m2(V.at)),Z=(V)=>{for(let Y=V+1;Y<Q.length;Y+=1){let G=Q[Y];if(G!=null)return G}return Number.POSITIVE_INFINITY};return z.map((V,Y)=>{let G=Q[Y]??null,H=(Y>0?Q[Y-1]:null)??null,C=G!==null&&H!==null?Math.max(0,G-H):null;if(G===null)return j(C);let q=G,B=Math.max(q,Z(Y)),k=(I)=>I!==null&&I>=q&&(I<B||B===Number.POSITIVE_INFINITY),R=J.filter((I)=>k(m2(I.startedAt))),w=$.filter((I)=>r5.has(I.level)&&k(m2(I.at))),y=R.map((I)=>I.durationMs).filter((I)=>typeof I==="number");return{elapsedMs:C,requests:R,failedRequests:R.filter(v6),consoleErrors:w,slowestMs:y.length>0?Math.max(...y):null}})}function a5(z,J){return z.requests.length===0&&z.consoleErrors.length===0&&(z.elapsedMs===null||z.elapsedMs<J)}function t5(z){if(z<1000)return`${Math.round(z)} มิลลิวินาที`;let J=z/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let $=Math.floor(J/60),j=Math.round(J%60);return j===0?`${$} นาที`:`${$} นาที ${j} วิ`}export{Z2 as trimToBudget,T4 as toCurl,z2 as takeReplay,z6 as supportPortalUrl,G2 as submitRequest,K2 as submitBundle,e8 as stopReplay,p5 as stopLiveRing,h1 as startLiveRing,P6 as sizeInkCanvas,q0 as showToast,a3 as setErroredQueriesSource,q1 as requestTypesNow,n5 as requestPath,j0 as reporterStrings,$0 as redactUrl,R0 as redactLabel,A0 as redactHeaders,T0 as redactBody,a0 as readInkOp,V2 as packReplay,V5 as openSupportPortal,n1 as onLaunch,a1 as onCrash,l6 as moduleResolver,M0 as loadRequestTypes,s1 as launch,t8 as isReplayRecording,a5 as isQuietStep,v6 as isFailedRequest,p0 as isConfigured,o5 as installDebugCapture,I2 as inkAlpha,M3 as hasCause,e1 as getNetworkLog,r1 as getConsoleLog,N as getConfig,l1 as getActionTrail,t5 as formatDuration,j2 as errorSignature,t1 as emitCrash,q2 as defineReporterElement,P2 as createAnnotator,s5 as correlateActionTrail,u6 as configureDebugCapture,H1 as captureScreen,D3 as bundleToMarkdown,q3 as bundleFileName,l0 as buildBundle,e as appInfo,i1 as actionCountSuffix,w0 as REPORTER_TAG,f4 as REPLAY_FILENAME,L0 as REDACTED,I1 as NoIdentityError,B5 as LASER_TRAIL_MS,N5 as LASER_LINGER_MS,F6 as InkSender,R1 as InkScene,A1 as InkPainter,C5 as INK_STALE_MS,D6 as INK_SEND_EVERY_MS,F5 as INK_MAX_POINTS_PER_OP,_2 as INK_KEEP_MS,q5 as INK_HOLD_MS,M5 as INK_FADE_MS,H6 as INK_COLORS,Q2 as BUNDLE_BUDGET_BYTES};
|