@mushi-mushi/web 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){'use strict';var dn=4194304,tr=1.5*1024*1024;function pn(t){try{return JSON.stringify(t)}catch{return null}}function hn(t,e=dn){let r=pn(t);if(r===null)return {ok:false,bytes:0,maxBytes:e,serializeFailed:true,reason:"Report could not be serialized (circular reference in metadata?)"};let n=new TextEncoder().encode(r).length;return n<=e?{ok:true,bytes:n,maxBytes:e}:{ok:false,bytes:n,maxBytes:e,reason:`Report payload ${qt(n)} exceeds limit ${qt(e)}`}}function qt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}var mn="X-Mushi-User-Token",jt="X-Mushi-SDK-Package",zt="X-Mushi-SDK-Version",et="https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api",Re="X-Mushi-Internal",ve="__mushiInternal",gn=1e4,fn=2;function rr(t){let{projectId:e,apiKey:r,apiEndpoint:n=et,timeout:s=gn,maxRetries:i=fn,getUserToken:a,sdkPackage:o,sdkVersion:l}=t,f=n.replace(/\/$/,"");async function d(p,m,c,g=i,x,T){let R=`${f}${m}`,S=new AbortController,y=setTimeout(()=>S.abort(),s),k=a?.()??null;try{let b=await fetch(R,{method:p,headers:{"Content-Type":"application/json","X-Mushi-Api-Key":r,"X-Mushi-Project":e,...o?{[jt]:o}:{},...l?{[zt]:l}:{},...k?{[mn]:k}:{},...x?{[Re]:x}:{},...T},body:c?JSON.stringify(c):void 0,signal:S.signal,...x?{[ve]:x}:{}});if(clearTimeout(y),b.status===307||b.status===308){let N=b.headers.get("Location");if(N&&g>0){let _=N.replace(/\/v1\/.*$/,"").replace(/\/$/,"");if(_!==f)return f=_,d(p,m,c,g-1,x,T)}}if(!b.ok){let N=await b.json().catch(()=>({}));return b.status>=500&&g>0?(await Wt(Vt(i-g)),d(p,m,c,g-1,x,T)):{ok:!1,error:{code:N.error?.code||`HTTP_${b.status}`,message:N.error?.message||N.message||`HTTP ${b.status} error`}}}let I=await b.json();return {ok:!0,data:I&&typeof I=="object"&&"ok"in I&&"data"in I?I.data:I}}catch(b){return clearTimeout(y),g>0&&vn(b)?(await Wt(Vt(i-g)),d(p,m,c,g-1,x)):{ok:false,error:{code:"NETWORK_ERROR",message:b instanceof Error?b.message:"Unknown network error"}}}}async function v(p,m,c,g){let x=await bn(c),T=String(Date.now()),R=await yn(r,`${e}.${T}.${x}`),S=`${f}${m}`,y=await fetch(S,{method:p,headers:{"Content-Type":"application/json","X-Mushi-Api-Key":r,"X-Mushi-Project":e,...o?{[jt]:o}:{},...l?{[zt]:l}:{},[Re]:"reporter-poll","X-Reporter-Token-Hash":x,"X-Reporter-Ts":T,"X-Reporter-Hmac":R},body:g?JSON.stringify(g):void 0,[ve]:"reporter-poll"});if(!y.ok){let b=await y.json().catch(()=>({}));return {ok:false,error:{code:`HTTP_${y.status}`,message:b.error?.message??b.message??`HTTP ${y.status} error`}}}let k=await y.json();return {ok:true,data:k.data??k}}return {async submitReport(p){let m=hn(p);return m.ok?d("POST","/v1/reports",p,i,"report-submit"):{ok:false,error:{code:m.serializeFailed?"SERIALIZE_FAILED":"PAYLOAD_TOO_LARGE",message:m.reason??"Report payload exceeds size limit"}}},async getReportStatus(p){return d("GET",`/v1/reports/${p}/status`,void 0,i,"report-status")},async getSdkConfig(){return d("GET","/v1/sdk/config",void 0,i,"sdk-config")},async askAssistant(p){return d("POST","/v1/sdk/assistant",{message:p.message,threadId:p.threadId??null,context:p.context??null},1,"community")},async getLatestSdkVersion(p){let m=new URLSearchParams({package:p}).toString();return d("GET",`/v1/sdk/latest-version?${m}`,void 0,i,"sdk-config")},async postDiscoveryEvent(p){return d("POST","/v1/sdk/discovery",p,1,"discovery")},async listReporterReports(p){return v("GET","/v1/reporter/reports",p)},async listReporterComments(p,m){return v("GET",`/v1/reporter/reports/${p}/comments`,m)},async replyToReporterReport(p,m,c,g){return v("POST",`/v1/reporter/reports/${p}/reply`,m,{body:c,...g?{feedback_signal:g}:{}})},async reopenReporterReport(p,m,c){return v("POST",`/v1/reporter/reports/${p}/reopen`,m,{note:c??""})},async listNotifications(p,m){let c=new URLSearchParams;m?.since&&c.set("since",m.since),m?.limit&&c.set("limit",String(m.limit));let g=c.size?`?${c.toString()}`:"";return v("GET",`/v1/notifications${g}`,p)},async markNotificationRead(p,m){return v("POST",`/v1/notifications/${p}/read`,m,{})},async listReporterFeatureBoard(p){return v("GET","/v1/reporter/feature-board",p)},async voteReporterFeatureBoard(p,m){return v("POST",`/v1/reporter/feature-board/${p}/vote`,m,{})},async submitActivity(p,m,c){return d("POST","/v1/sdk/activity",{user_id:p,user_traits:c?.userTraits,opted_in:c?.optedIn,reporter_token_hash:c?.reporterTokenHash,...c?.hostJwt?{host_jwt:c.hostJwt}:{},events:m},1,"discovery")},async getMyPoints(p){return d("GET",`/v1/sdk/me/points?userId=${encodeURIComponent(p)}`,void 0,1,"reporter-poll")},async getMyTier(p){return d("GET",`/v1/sdk/me/tier?userId=${encodeURIComponent(p)}`,void 0,1,"reporter-poll")},async getMyHistory(p,m){let c=new URLSearchParams({userId:p,...m?.limit?{limit:String(m.limit)}:{}});return d("GET",`/v1/sdk/me/history?${c}`,void 0,1,"reporter-poll")},async getHallOfFame(p=10){return d("GET",`/v1/sdk/hall-of-fame?limit=${p}`,void 0,1,"reporter-poll")},async sendMagicLink(p){return d("POST","/v1/tester/magic-link",{email:p},1,"community")},async linkReporterToken(p,m){return d("POST","/v1/tester/link-reporter",{reporter_token_hash:p},1,"community",{Authorization:`Bearer ${m}`})},async getCrossAppReports(p,m){let c=new URLSearchParams;m?.limit&&c.set("limit",String(m.limit)),m?.offset&&c.set("offset",String(m.offset));let g=c.size?`?${c.toString()}`:"";return d("GET",`/v1/tester/cross-app-reports${g}`,void 0,1,"community",{Authorization:`Bearer ${p}`})},async getMyReputation(p){return d("GET","/v1/tester/reputation",void 0,1,"community",{Authorization:`Bearer ${p}`})},async getPublicLeaderboard(p=20){return d("GET",`/v1/public/tester-leaderboard?limit=${p}`,void 0,1,"reporter-poll")},async getTesterStatus(p){return d("GET","/v1/me/tester-status",void 0,1,"community",{Authorization:`Bearer ${p}`})}}}async function bn(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function yn(t,e){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},false,["sign"]),n=await crypto.subtle.sign("HMAC",r,new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}function Wt(t){return new Promise(e=>setTimeout(e,t))}function Vt(t){return Math.min(1e3*2**t+Math.random()*500,1e4)}function vn(t){return t instanceof DOMException&&t.name==="AbortError"||t instanceof TypeError}function Ze(...t){return t.find(e=>e!==void 0&&e!=="")}function re(t){try{let e=undefined;return typeof e=="object"&&e!==null?e[t]:void 0}catch{return}}function pe(t){try{return t()}catch{return}}function nr(){let t=Ze(re("VITE_MUSHI_PROJECT_ID"),re("NEXT_PUBLIC_MUSHI_PROJECT_ID"),re("NUXT_PUBLIC_MUSHI_PROJECT_ID"),re("EXPO_PUBLIC_MUSHI_PROJECT_ID"),pe(()=>process.env.NEXT_PUBLIC_MUSHI_PROJECT_ID),pe(()=>process.env.EXPO_PUBLIC_MUSHI_PROJECT_ID),pe(()=>process.env.MUSHI_PROJECT_ID)),e=Ze(re("VITE_MUSHI_API_KEY"),re("NEXT_PUBLIC_MUSHI_API_KEY"),re("NUXT_PUBLIC_MUSHI_API_KEY"),re("EXPO_PUBLIC_MUSHI_API_KEY"),pe(()=>process.env.NEXT_PUBLIC_MUSHI_API_KEY),pe(()=>process.env.EXPO_PUBLIC_MUSHI_API_KEY),pe(()=>process.env.MUSHI_API_KEY)),r=Ze(re("VITE_MUSHI_API_ENDPOINT"),re("NEXT_PUBLIC_MUSHI_API_ENDPOINT"),re("NUXT_PUBLIC_MUSHI_API_ENDPOINT"),re("EXPO_PUBLIC_MUSHI_API_ENDPOINT"),pe(()=>process.env.NEXT_PUBLIC_MUSHI_API_ENDPOINT),pe(()=>process.env.EXPO_PUBLIC_MUSHI_API_ENDPOINT),pe(()=>process.env.MUSHI_API_ENDPOINT)),n={};return t&&(n.projectId=t),e&&(n.apiKey=e),r&&(n.apiEndpoint=r),n}var wn=10,xn=2e3,Sn=[/^(.)\1{10,}$/,/^[A-Z\s!?]{20,}$/,/^[\d\s]+$/,/^[^a-zA-Z\u00C0-\u024F\u4E00-\u9FFF\u3040-\u309F\u30A0-\u30FF]{10,}$/,/^(asdf|qwerty|lorem ipsum)[.,!?\s]*$/i],En=/^[bcdfghjklmnpqrstvwxz]{6,}/i;function sr(t={}){let{enabled:e=true,blockObviousSpam:r=true,minDescriptionLength:n=wn,maxDescriptionLength:s=xn}=t;function i(o){if(!e)return {passed:true};let l=o.trim();if(l.length<n)return {passed:false,reason:`Too short (min ${n} characters)`};if(l.length>s)return {passed:false,reason:`Too long (max ${s} characters)`};if(r){for(let d of Sn)if(d.test(l))return {passed:false,reason:"Detected as spam"};if(En.test(l))return {passed:false,reason:"Detected as gibberish"};if(l.split(/\s+/).filter(d=>d.length>1).length<2)return {passed:false,reason:"Description needs at least 2 words"}}return {passed:true}}function a(o){let l=o.trim();return l.length<=s?l:l.slice(0,s)+"..."}return {check:i,truncate:a}}var Kt={debug:10,info:20,warn:30,error:40,fatal:50,silent:99},kn={debug:"DBG",info:"INF",warn:"WRN",error:"ERR",fatal:"FTL"},J={reset:"\x1B[0m",dim:"\x1B[2m",bold:"\x1B[1m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",red:"\x1B[31m",white:"\x1B[37m",bgRed:"\x1B[41m"},Rn={debug:J.dim,info:J.green,warn:J.yellow,error:J.red,fatal:`${J.bgRed}${J.white}${J.bold}`};function Cn(){try{if(typeof globalThis.Deno<"u")return "json"}catch{}let t=typeof globalThis.process<"u"?globalThis.process:void 0;if(t?.env){if(t.env.NODE_ENV==="production"||t.env.LOG_FORMAT==="json")return "json";if(t.env.LOG_FORMAT==="pretty"||t.stdout?.isTTY)return "pretty"}return typeof globalThis.window<"u"?"pretty":"json"}function Tn(t){let e=[];for(let[r,n]of Object.entries(t))n!=null&&(typeof n=="object"?e.push(`${r}=${JSON.stringify(n)}`):e.push(`${r}=${String(n)}`));return e.join(" ")}function Mn(t){let{ts:e,level:r,scope:n,msg:s,...i}=t,a=e.slice(11,23),o=Rn[r]??"",l=kn[r]??r.toUpperCase(),f=Object.keys(i).length>0?` ${J.dim}${Tn(i)}${J.reset}`:"";return `${J.dim}${a}${J.reset} ${o}${l}${J.reset} ${J.cyan}[${n}]${J.reset} ${s}${f}`}function Ln(t){return JSON.stringify(t)}function $n(t){return t==="stderr"?(e,r)=>{console.error(r);}:(e,r)=>{switch(e){case "error":case "fatal":console.error(r);break;case "warn":console.warn(r);break;default:console.log(r);}}}function or(t,e,r,n,s){let i=e;function a(o,l,f){if(Kt[o]<Kt[i])return;let d={ts:new Date().toISOString(),level:o,scope:t,msg:l,...r,...f};s(o,n(d));}return {debug:(o,l)=>a("debug",o,l),info:(o,l)=>a("info",o,l),warn:(o,l)=>a("warn",o,l),error:(o,l)=>a("error",o,l),fatal:(o,l)=>a("fatal",o,l),child(o,l){return or(`${t}:${o}`,i,{...r,...l},n,s)},setLevel(o){i=o;}}}function De(t){let{scope:e,level:r="info",meta:n={},format:s="auto",destination:i="stdout"}=t,o=(s==="auto"?Cn():s)==="json"?Ln:Mn,l=$n(i);return or(e,r,n,o,l)}var tt={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},fatal:()=>{},child:()=>tt,setLevel:()=>{}},In="mushi-mushi-keyring",we="keys",ir="offline-queue/v1",Ie=null,Ae=null;function An(){return typeof globalThis<"u"&&typeof globalThis.crypto<"u"&&typeof globalThis.crypto.subtle<"u"&&typeof indexedDB<"u"}function ar(){return new Promise((t,e)=>{let r=indexedDB.open(In,1);r.onupgradeneeded=()=>{let n=r.result;n.objectStoreNames.contains(we)||n.createObjectStore(we);},r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error);})}async function _n(){let t=await ar();return new Promise((e,r)=>{let s=t.transaction(we,"readonly").objectStore(we).get(ir);s.onsuccess=()=>e(s.result??null),s.onerror=()=>r(s.error);})}async function Pn(t){let e=await ar();return new Promise((r,n)=>{let s=e.transaction(we,"readwrite");s.objectStore(we).put(t,ir),s.oncomplete=()=>r(),s.onerror=()=>n(s.error);})}async function lr(){if(Ie)return Ie;if(Ae)return Ae;if(!An())throw new Error("Web Crypto + IndexedDB required for offline queue encryption");return Ae=(async()=>{let t=await _n();if(t)return Ie=t,t;let e=await crypto.subtle.generateKey({name:"AES-GCM",length:256},false,["encrypt","decrypt"]);return await Pn(e),Ie=e,e})(),Ae}function Gt(t){let e="";for(let r of t)e+=String.fromCharCode(r);return btoa(e)}function Yt(t){let e=atob(t),r=new Uint8Array(new ArrayBuffer(e.length));for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}async function Dn(t){let e=await lr(),r=crypto.getRandomValues(new Uint8Array(12)),n=new TextEncoder().encode(JSON.stringify(t)),s=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:r},e,n));return {_mme:1,iv:Gt(r),ct:Gt(s)}}function On(t){return !!t&&typeof t=="object"&&t._mme===1&&typeof t.iv=="string"&&typeof t.ct=="string"}async function Hn(t){let e=await lr(),r=Yt(t.iv),n=Yt(t.ct),s=await crypto.subtle.decrypt({name:"AES-GCM",iv:r},e,n);return JSON.parse(new TextDecoder().decode(s))}var _e=De({scope:"mushi:queue",level:"warn"}),Bn="mushi-mushi",ne="offline-reports",Nn=1,Qe="mushi_offline_queue",Fn=10,Un=6e4,qn=3e4;function cr(t={}){let{enabled:e=true,maxQueueSize:r=50,syncOnReconnect:n=true,encryptAtRest:s=true}=t,i=null,a=null,o=null;async function l(C){let M=new Date().toISOString();if(!s)return {...C,queuedAt:M};try{let A=await Dn(C);return {id:C.id,queuedAt:M,payload:A}}catch(A){return _e.warn("Offline queue: encryption failed, storing plaintext",{err:String(A)}),{...C,queuedAt:M}}}async function f(C){if(d(C))try{return await Hn(C.payload)}catch(M){return _e.warn("Offline queue: decrypt failed, dropping row",{err:String(M),id:C.id}),null}return C}function d(C){return !!C.payload&&On(C.payload)}function v(){return o||(typeof indexedDB<"u"?o="indexeddb":typeof localStorage<"u"?o="localstorage":o="none",o)}function p(){return new Promise((C,M)=>{let A=indexedDB.open(Bn,Nn);A.onupgradeneeded=()=>{let O=A.result;O.objectStoreNames.contains(ne)||O.createObjectStore(ne,{keyPath:"id"});},A.onsuccess=()=>C(A.result),A.onerror=()=>{o="localstorage",M(A.error);};})}async function m(C){let M=await p(),A=await l(C);return new Promise((O,j)=>{let z=M.transaction(ne,"readwrite");z.objectStore(ne).put(A),z.oncomplete=()=>O(),z.onerror=()=>j(z.error);})}async function c(){let C=await p();return new Promise((M,A)=>{let j=C.transaction(ne,"readonly").objectStore(ne).getAll();j.onsuccess=()=>M(j.result),j.onerror=()=>A(j.error);})}async function g(C){let M=await p();return new Promise((A,O)=>{let j=M.transaction(ne,"readwrite");j.objectStore(ne).delete(C),j.oncomplete=()=>A(),j.onerror=()=>O(j.error);})}async function x(){let C=await p();return new Promise((M,A)=>{let j=C.transaction(ne,"readonly").objectStore(ne).count();j.onsuccess=()=>M(j.result),j.onerror=()=>A(j.error);})}async function T(){let C=await p();return new Promise((M,A)=>{let O=C.transaction(ne,"readwrite");O.objectStore(ne).clear(),O.oncomplete=()=>M(),O.onerror=()=>A(O.error);})}function R(){try{let C=localStorage.getItem(Qe);return C?JSON.parse(C):[]}catch{return []}}function S(C){try{localStorage.setItem(Qe,JSON.stringify(C));}catch{}}async function y(C){let M=R();M.push(await l(C)),S(M);}function k(C){let M=R().filter(A=>A.id!==C);S(M);}async function b(C){if(!e)return;if(await _()>=r){_e.warn("Offline queue full \u2014 dropping report",{maxQueueSize:r});return}let A=v();if(A==="indexeddb")try{await m(C);return}catch{o="localstorage";}if(A==="localstorage"||o==="localstorage"){await y(C);return}}function I(C){return Math.min(1e3*2**C+Math.random()*500,Un)}function W(C){return new Promise(M=>setTimeout(M,C))}async function N(C){if(!e)return {sent:0,failed:0};let M,A=v();if(A==="indexeddb")try{M=await c();}catch{M=R();}else M=R();let O=M.slice(0,Fn),j=0,z=0;for(let de=0;de<O.length;de++){let ee=O[de],D=ee.id,ye=await f(ee);if(!ye){try{A==="indexeddb"?await g(D):k(D);}catch{k(D);}z++;continue}let F=await C.submitReport(ye);if(F.ok){try{A==="indexeddb"?await g(D):k(D);}catch{k(D);}j++;}else {let Ee=F.error?.code==="HTTP_400"||F.error?.code==="HTTP_413"||F.error?.code==="HTTP_422"||F.error?.code==="INGEST_ERROR"||F.error?.code==="VALIDATION_ERROR"||F.error?.code==="PAYLOAD_TOO_LARGE"||F.error?.code==="SERIALIZE_FAILED"||typeof F.error?.message=="string"&&/invalid payload|description must be at least|validation/i.test(F.error.message),$e=!Ee&&(F.error?.code==="NETWORK_ERROR"||F.error?.code==="HTTP_403"||F.error?.code==="HTTP_429"||F.error?.code==="HTTP_502"||F.error?.code==="HTTP_503"||F.error?.code==="HTTP_504"||typeof F.error?.code=="string"&&F.error.code.startsWith("HTTP_5"));if(Ee)try{A==="indexeddb"?await g(D):k(D);}catch{k(D);}else $e&&_e.debug("Offline queue: transient failure, will retry",{id:D,code:F.error?.code});z++,de<O.length-1&&await W(I(de));}}return {sent:j,failed:z}}async function _(){if(v()==="indexeddb")try{return await x()}catch{return R().length}return R().length}async function K(){if(v()==="indexeddb")try{await T();}catch{}try{localStorage.removeItem(Qe);}catch{}}function be(C){if(!e||!n||typeof window>"u")return;let M=()=>{navigator.onLine&&N(C).catch(()=>{});};window.addEventListener("online",M),a=setInterval(()=>{_().then(A=>{A>0&&M();});},qn),i=()=>{window.removeEventListener("online",M),a&&(clearInterval(a),a=null);};}function G(){i?.(),i=null;}return {enqueue:b,flush:N,size:_,clear:K,startAutoSync:be,stopAutoSync:G}}function rt(){let t=typeof navigator<"u"?navigator:void 0,e=typeof window<"u"?window:void 0,r=typeof document<"u"?document:void 0,n=typeof screen<"u"?screen:void 0;zn(t);let s=t&&"connection"in t?t.connection:void 0;return {userAgent:t?.userAgent??"unknown",platform:t?.platform??"unknown",language:t?.language??"en",viewport:{width:e?.innerWidth??0,height:e?.innerHeight??0},url:e?.location?.href??"",referrer:r?.referrer??"",timestamp:new Date().toISOString(),timezone:Intl?.DateTimeFormat?.()?.resolvedOptions?.()?.timeZone??"UTC",connection:s?{effectiveType:s.effectiveType,downlink:s.downlink,rtt:s.rtt}:void 0,deviceMemory:t?.deviceMemory,hardwareConcurrency:t?.hardwareConcurrency,route:e?.location?.pathname,nearestTestid:jn(r),userAgentData:Vn(t),screen:Kn(n,e),prefersColorScheme:Gn(e),prefersReducedMotion:se(e,"(prefers-reduced-motion: reduce)"),prefersReducedData:se(e,"(prefers-reduced-data: reduce)"),prefersContrast:Yn(e),forcedColors:se(e,"(forced-colors: active)"),online:typeof t?.onLine=="boolean"?t.onLine:void 0,displayMode:Xn(e),documentTitle:r?.title?.slice(0,200),buildId:Jn(r),pageLoadTiming:Zn(e)}}function jn(t){if(!t)return;let e=t.activeElement??null,r=0;for(;e&&r<20;){let n=e.getAttribute?.("data-testid");if(n)return n;e=e.parentElement,r++;}}var ae=null,Xt=false;function zn(t){if(Xt)return;let e=t?.userAgentData;e?.getHighEntropyValues&&(Xt=true,e.getHighEntropyValues(["architecture","bitness","model","platformVersion","uaFullVersion","fullVersionList"]).then(r=>{ae=r;}).catch(()=>{}));}function Wn(t){if(!t?.length)return;let e=t.filter(n=>!/not.?a.?brand/i.test(n.brand));return e.length===0?void 0:e.find(n=>!/chromium|google chrome/i.test(n.brand))??e[0]}function Vn(t){let e=t?.userAgentData;if(!e&&!ae)return;let r=ae?.fullVersionList,n=Wn(r??e?.brands),s={};return n&&(s.browser=n.brand,s.browserVersion=n.version),e?.platform&&(s.os=e.platform),ae?.platformVersion&&(s.osVersion=ae.platformVersion),typeof e?.mobile=="boolean"&&(s.mobile=e.mobile),ae?.model&&(s.model=ae.model),ae?.architecture&&(s.architecture=ae.architecture),ae?.bitness&&(s.bitness=ae.bitness),Object.keys(s).length===0?void 0:s}function Kn(t,e){if(!t&&!e)return;let r={};typeof t?.width=="number"&&(r.width=t.width),typeof t?.height=="number"&&(r.height=t.height),typeof e?.devicePixelRatio=="number"&&(r.devicePixelRatio=e.devicePixelRatio),typeof t?.colorDepth=="number"&&(r.colorDepth=t.colorDepth);let n=t?.orientation?.type;return n&&(r.orientation=n),Object.keys(r).length===0?void 0:r}function se(t,e){if(t?.matchMedia)try{return t.matchMedia(e).matches}catch{return}}function Gn(t){if(t?.matchMedia)return se(t,"(prefers-color-scheme: dark)")?"dark":se(t,"(prefers-color-scheme: light)")?"light":"no-preference"}function Yn(t){if(t?.matchMedia)return se(t,"(prefers-contrast: more)")?"more":se(t,"(prefers-contrast: less)")?"less":se(t,"(prefers-contrast: custom)")?"custom":"no-preference"}function Xn(t){if(t?.matchMedia){if(se(t,"(display-mode: fullscreen)"))return "fullscreen";if(se(t,"(display-mode: standalone)"))return "standalone";if(se(t,"(display-mode: minimal-ui)"))return "minimal-ui";if(se(t,"(display-mode: browser)"))return "browser"}}function Jn(t){if(!t)return;let r=t.querySelector?.('meta[name="mushi:build"]')?.content?.trim();if(r)return r.slice(0,64)}function Zn(t){let e=t?.performance;if(!e?.getEntriesByType)return;let r;try{r=e.getEntriesByType("navigation")[0];}catch{return}if(!r)return;let n=r.startTime??0,s={};return r.domContentLoadedEventEnd>0&&(s.domContentLoadedMs=Math.round(r.domContentLoadedEventEnd-n)),r.loadEventEnd>0&&(s.loadCompleteMs=Math.round(r.loadEventEnd-n)),r.responseStart>0&&(s.timeToFirstByteMs=Math.round(r.responseStart-n)),typeof r.type=="string"&&(s.navigationType=r.type),Object.keys(s).length===0?void 0:s}var Jt="mushi_reporter_token";function Y(){if(typeof localStorage<"u"){let e=localStorage.getItem(Jt);if(e)return e}let t=Qn();if(typeof localStorage<"u")try{localStorage.setItem(Jt,t);}catch{}return t}function Qn(){if(typeof crypto<"u"&&crypto.randomUUID)return `mushi_${crypto.randomUUID()}`;let t=new Uint8Array(16);if(typeof crypto<"u")crypto.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);return `mushi_${Array.from(t).map(r=>r.toString(16).padStart(2,"0")).join("")}`}function nt(){let t=typeof crypto<"u"?crypto:void 0;if(t?.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t?.getRandomValues)t.getRandomValues(e);else for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return `${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}var Zt="mushi_fingerprint_hash";function es(){let t=typeof navigator<"u"?navigator:void 0,e=typeof screen<"u"?screen:void 0,r=typeof window<"u"?window:void 0;return {userAgent:t?.userAgent??"unknown",platform:t?.platform??"unknown",language:t?.language??"en",timezone:Intl?.DateTimeFormat?.()?.resolvedOptions?.()?.timeZone??"UTC",screenWidth:e?.width??0,screenHeight:e?.height??0,pixelRatio:r?.devicePixelRatio??1,deviceMemory:t?.deviceMemory,hardwareConcurrency:t?.hardwareConcurrency}}async function ts(t){if(typeof crypto<"u"&&crypto.subtle){let r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return `fbk_${(e>>>0).toString(16).padStart(8,"0")}`}async function ur(){if(typeof localStorage<"u"){let n=localStorage.getItem(Zt);if(n)return n}let t=es(),e=JSON.stringify(t),r=await ts(e);if(typeof localStorage<"u")try{localStorage.setItem(Zt,r);}catch{}return r}var Qt="mushi_session_id",Pe=null;function Ce(){if(Pe)return Pe;if(typeof sessionStorage<"u"){let e=sessionStorage.getItem(Qt);if(e)return Pe=e,e}let t=rs();if(Pe=t,typeof sessionStorage<"u")try{sessionStorage.setItem(Qt,t);}catch{}return t}function rs(){let t=Date.now().toString(36),e=Math.random().toString(36).slice(2,8);return `ms_${t}_${e}`}var ns=10,ss=1,os=5e3;function dr(t={}){let{maxBurst:e=ns,refillRate:r=ss,refillIntervalMs:n=os}=t,s=e,i=Date.now();function a(){let d=Date.now(),v=d-i,p=Math.floor(v/n);p>0&&(s=Math.min(e,s+p*r),i=d);}function o(){return a(),s>0?(s--,true):false}function l(){s=e,i=Date.now();}function f(){return a(),s}return {tryConsume:o,reset:l,availableTokens:f}}var is=[{key:"ssns",regex:/\b\d{3}-\d{2}-\d{4}\b/g,replacement:"[REDACTED_SSN]"},{key:"creditCards",regex:/\b(?:\d[ -]*){12,18}\d\b/g,replacement:"[REDACTED_CC]"},{key:"secretTokens",regex:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,replacement:"[REDACTED_AWS_KEY]"},{key:"secretTokens",regex:/(?:aws_secret_access_key|secret_access_key)["'\s:=]+[A-Za-z0-9/+=]{40}\b/gi,replacement:"aws_secret_access_key=[REDACTED_AWS_SECRET]"},{key:"secretTokens",regex:/\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{24,}\b/g,replacement:"[REDACTED_STRIPE_KEY]"},{key:"secretTokens",regex:/\bpk_(?:live|test)_[A-Za-z0-9]{24,}\b/g,replacement:"[REDACTED_STRIPE_PK]"},{key:"secretTokens",regex:/\bxox[abpor]-[A-Za-z0-9-]{10,}\b/g,replacement:"[REDACTED_SLACK_TOKEN]"},{key:"secretTokens",regex:/\bghp_[A-Za-z0-9]{36}\b/g,replacement:"[REDACTED_GITHUB_PAT]"},{key:"secretTokens",regex:/\bgithub_pat_[A-Za-z0-9_]{80,}\b/g,replacement:"[REDACTED_GITHUB_PAT]"},{key:"secretTokens",regex:/\bsk-(?:proj-)?[A-Za-z0-9_-]{20,}\b/g,replacement:"[REDACTED_OPENAI_KEY]"},{key:"secretTokens",regex:/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g,replacement:"[REDACTED_ANTHROPIC_KEY]"},{key:"secretTokens",regex:/\bAIza[0-9A-Za-z_-]{35}\b/g,replacement:"[REDACTED_GOOGLE_KEY]"},{key:"secretTokens",regex:/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,replacement:"[REDACTED_JWT]"},{key:"emails",regex:/\b[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}\b/g,replacement:"[REDACTED_EMAIL]"},{key:"phones",regex:/(?:\+\d{1,3}[\s.-])?\(?\d{2,4}\)?[\s.-]\d{3,4}[\s.-]\d{3,4}\b/g,replacement:"[REDACTED_PHONE]"},{key:"ipAddresses",regex:/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,replacement:"[REDACTED_IP]"},{key:"ipv6",regex:/\b(?:[A-Fa-f0-9]{1,4}:){2,7}[A-Fa-f0-9]{0,4}\b/g,replacement:"[REDACTED_IPV6]"}],as={emails:true,phones:true,creditCards:true,ssns:true,ipAddresses:false,secretTokens:true,ipv6:false};function pr(t={}){let e={...as,...t},r=is.filter(i=>e[i.key]);function n(i){if(!i)return i;let a=i;for(let{regex:o,replacement:l}of r)a=a.replace(new RegExp(o.source,o.flags),l);return a}function s(i,a){let o={...i};for(let l of a)typeof o[l]=="string"&&(o[l]=n(o[l]));return o}return {scrub:n,scrubObject:s}}var ls=50,cs=500;function hr(t={}){let e=Math.max(1,t.max??ls),r=Math.max(50,t.maxMessageLength??cs),n=[];return {add(s){let i=typeof s.timestamp=="number"?s.timestamp:Date.now(),a=typeof s.message=="string"&&s.message.length>r?`${s.message.slice(0,r)}\u2026`:s.message,o={timestamp:i,category:s.category,level:s.level??"info",message:a??"",...s.data?{data:s.data}:{}};for(n.push(o);n.length>e;)n.shift();},getAll(){return n.slice()},clear(){n=[];},size(){return n.length}}}var er=8*1024,us=1e3;function mr(t){if(t instanceof Error){let e=t.name||"Error",r=t.message||String(t),n=typeof t.stack=="string"&&t.stack.length>0?t.stack.slice(0,er):void 0,s=t.cause;return {name:e,message:r,...n?{stack:n}:{},...s!==void 0?{cause:s instanceof Error?s.message:s}:{}}}if(typeof t=="string")return {name:"Error",message:t};if(t&&typeof t=="object"){let e=t,r=typeof e.name=="string"?e.name:"Error",n=typeof e.message=="string"?e.message:(()=>{try{return JSON.stringify(e).slice(0,us)}catch{return String(e)}})(),s=typeof e.stack=="string"?e.stack.slice(0,er):void 0;return {name:r,message:n,...s?{stack:s}:{}}}return t===void 0?{name:"Error",message:"unknown"}:{name:"Error",message:String(t)}}function ds(t){let e=t.length%4===0?"":"=".repeat(4-t.length%4),r=t.replace(/-/g,"+").replace(/_/g,"/")+e;if(typeof atob=="function")return atob(r);let n=globalThis.Buffer;return n?n.from(r,"base64").toString("binary"):""}function gr(t){if(typeof t!="string")return null;let e=t.split(".");if(e.length!==3)return null;try{let r=ds(e[1]),n=JSON.parse(r),s=typeof n.projectId=="string"?n.projectId:void 0,i=typeof n.sub=="string"?n.sub:void 0;return !s||!i?null:{projectId:s,sub:i,...typeof n.email=="string"?{email:n.email}:{},...typeof n.name=="string"?{name:n.name}:{},...typeof n.iat=="number"?{iat:n.iat}:{},...typeof n.exp=="number"?{exp:n.exp}:{}}}catch{return null}}async function br(t,e=tr){if(!t.startsWith("data:image/")||fr(t)<=e)return t;if(typeof document>"u")return null;let r=new Image;await new Promise((i,a)=>{r.onload=()=>i(),r.onerror=()=>a(new Error("screenshot_decode_failed")),r.src=t;});let n=[.65,.5,.35,.25],s=[1,.85,.7,.55,.4];for(let i of s){let a=document.createElement("canvas"),o=Math.max(1,Math.round(r.naturalWidth*i)),l=Math.max(1,Math.round(r.naturalHeight*i));a.width=o,a.height=l;let f=a.getContext("2d");if(f){f.drawImage(r,0,0,o,l);for(let d of n){let v=a.toDataURL("image/jpeg",d);if(fr(v)<=e)return v}}}return null}function fr(t){let e=t.indexOf(",");if(e<0)return t.length;let r=t.slice(e+1);return Math.ceil(r.length*3/4)}var Oe={widget:{trigger:"Report Issue",title:"Report an Issue",close:"Close",back:"Back",submit:"Submit",submitting:"Submitting\u2026",submitted:"Thank you! Your report has been submitted.",error:"Something went wrong. Please try again."},step1:{heading:"What kind of issue?",categories:{bug:"Bug",slow:"Slow / Laggy",visual:"Visual Glitch",confusing:"Confusing",other:"Other"},categoryDescriptions:{bug:"Something is broken or not working",slow:"Performance issue or slow loading",visual:"Layout, styling, or display problem",confusing:"Hard to understand or navigate",other:"Something else"}},step2:{heading:"What happened?",intents:{bug:["Crash","Unresponsive","Data loss","Wrong result","Other"],slow:["Page load","Interaction","API call","Animation","Other"],visual:["Layout broken","Overlapping","Missing element","Wrong color/font","Other"],confusing:["Unclear label","Missing help","Unexpected flow","Lost navigation","Other"],other:["Feature request","Accessibility","Typo","Other"]}},step3:{heading:"Tell us more",descriptionPlaceholder:"Describe what happened\u2026",screenshotButton:"Attach Screenshot",screenshotAttached:"Screenshot attached \u2713",screenshotCapturing:"Taking screenshot\u2026",screenshotFailed:"Couldn't capture \u2014 describe it instead",elementButton:"Select Element",elementSelected:"Element selected \u2713",elementCapturing:"Click anything on the page\u2026",elementSelectorHint:"Click any element \xB7 Esc to cancel",optional:"(optional)",tooShort:"A bit more detail helps us fix it faster",examplePrompts:["The save button does nothing","Page froze for 10 seconds","Layout looks broken here"]}};var yr={widget:{trigger:"\u554F\u984C\u3092\u5831\u544A",title:"\u554F\u984C\u3092\u5831\u544A\u3059\u308B",close:"\u9589\u3058\u308B",back:"\u623B\u308B",submit:"\u9001\u4FE1",submitting:"\u9001\u4FE1\u4E2D\u2026",submitted:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\uFF01\u30EC\u30DD\u30FC\u30C8\u304C\u9001\u4FE1\u3055\u308C\u307E\u3057\u305F\u3002",error:"\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002"},step1:{heading:"\u3069\u306E\u3088\u3046\u306A\u554F\u984C\u3067\u3059\u304B\uFF1F",categories:{bug:"\u30D0\u30B0",slow:"\u9045\u3044\u30FB\u91CD\u3044",visual:"\u8868\u793A\u306E\u554F\u984C",confusing:"\u308F\u304B\u308A\u306B\u304F\u3044",other:"\u305D\u306E\u4ED6"},categoryDescriptions:{bug:"\u52D5\u4F5C\u3057\u306A\u3044\u3001\u58CA\u308C\u3066\u3044\u308B",slow:"\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u304C\u60AA\u3044\u3001\u8AAD\u307F\u8FBC\u307F\u304C\u9045\u3044",visual:"\u30EC\u30A4\u30A2\u30A6\u30C8\u3001\u30C7\u30B6\u30A4\u30F3\u3001\u8868\u793A\u306E\u554F\u984C",confusing:"\u7406\u89E3\u3057\u306B\u304F\u3044\u3001\u64CD\u4F5C\u304C\u308F\u304B\u308A\u306B\u304F\u3044",other:"\u305D\u306E\u4ED6\u306E\u554F\u984C"}},step2:{heading:"\u4F55\u304C\u8D77\u304D\u307E\u3057\u305F\u304B\uFF1F",intents:{bug:["\u30AF\u30E9\u30C3\u30B7\u30E5","\u7121\u53CD\u5FDC","\u30C7\u30FC\u30BF\u6D88\u5931","\u8AA4\u3063\u305F\u7D50\u679C","\u305D\u306E\u4ED6"],slow:["\u30DA\u30FC\u30B8\u8AAD\u8FBC","\u64CD\u4F5C\u53CD\u5FDC","API\u901A\u4FE1","\u30A2\u30CB\u30E1\u30FC\u30B7\u30E7\u30F3","\u305D\u306E\u4ED6"],visual:["\u30EC\u30A4\u30A2\u30A6\u30C8\u5D29\u308C","\u8981\u7D20\u306E\u91CD\u306A\u308A","\u8981\u7D20\u304C\u8868\u793A\u3055\u308C\u306A\u3044","\u8272/\u30D5\u30A9\u30F3\u30C8\u304C\u9055\u3046","\u305D\u306E\u4ED6"],confusing:["\u30E9\u30D9\u30EB\u304C\u4E0D\u660E\u77AD","\u30D8\u30EB\u30D7\u304C\u306A\u3044","\u4E88\u60F3\u5916\u306E\u30D5\u30ED\u30FC","\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u8FF7\u5B50","\u305D\u306E\u4ED6"],other:["\u6A5F\u80FD\u8981\u671B","\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3","\u8AA4\u5B57\u8131\u5B57","\u305D\u306E\u4ED6"]}},step3:{heading:"\u8A73\u7D30\u3092\u6559\u3048\u3066\u304F\u3060\u3055\u3044",descriptionPlaceholder:"\u4F55\u304C\u8D77\u304D\u305F\u304B\u8AAC\u660E\u3057\u3066\u304F\u3060\u3055\u3044\u2026",screenshotButton:"\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u6DFB\u4ED8",screenshotAttached:"\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u6DFB\u4ED8\u6E08\u307F \u2713",screenshotCapturing:"\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u64AE\u5F71\u4E2D\u2026",screenshotFailed:"\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F \u2014 \u6587\u5B57\u3067\u6559\u3048\u3066\u304F\u3060\u3055\u3044",elementButton:"\u8981\u7D20\u3092\u9078\u629E",elementSelected:"\u8981\u7D20\u9078\u629E\u6E08\u307F \u2713",elementCapturing:"\u30DA\u30FC\u30B8\u4E0A\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u2026",elementSelectorHint:"\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF \xB7 Esc \u3067\u30AD\u30E3\u30F3\u30BB\u30EB",optional:"\uFF08\u4EFB\u610F\uFF09",tooShort:"\u3082\u3046\u5C11\u3057\u8A73\u3057\u304F\u6559\u3048\u3066\u304F\u3060\u3055\u3044",examplePrompts:["\u4FDD\u5B58\u30DC\u30BF\u30F3\u304C\u53CD\u5FDC\u3057\u306A\u3044","\u30DA\u30FC\u30B8\u304C10\u79D2\u56FA\u307E\u3063\u305F","\u30EC\u30A4\u30A2\u30A6\u30C8\u304C\u5D29\u308C\u3066\u3044\u308B"]}};var vr={widget:{trigger:"\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E1B\u0E31\u0E0D\u0E2B\u0E32",title:"\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E1B\u0E31\u0E0D\u0E2B\u0E32",close:"\u0E1B\u0E34\u0E14",back:"\u0E01\u0E25\u0E31\u0E1A",submit:"\u0E2A\u0E48\u0E07",submitting:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2A\u0E48\u0E07\u2026",submitted:"\u0E02\u0E2D\u0E1A\u0E04\u0E38\u0E13\u0E04\u0E23\u0E31\u0E1A/\u0E04\u0E48\u0E30! \u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07\u0E41\u0E25\u0E49\u0E27",error:"\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14 \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07"},step1:{heading:"\u0E1B\u0E31\u0E0D\u0E2B\u0E32\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E44\u0E2B\u0E19?",categories:{bug:"\u0E1A\u0E31\u0E01",slow:"\u0E0A\u0E49\u0E32 / \u0E41\u0E25\u0E04",visual:"\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25\u0E1C\u0E34\u0E14\u0E1B\u0E01\u0E15\u0E34",confusing:"\u0E2A\u0E31\u0E1A\u0E2A\u0E19",other:"\u0E2D\u0E37\u0E48\u0E19\u0E46"},categoryDescriptions:{bug:"\u0E21\u0E35\u0E1A\u0E32\u0E07\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E40\u0E2A\u0E35\u0E22\u0E2B\u0E23\u0E37\u0E2D\u0E17\u0E33\u0E07\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07",slow:"\u0E1B\u0E31\u0E0D\u0E2B\u0E32\u0E1B\u0E23\u0E30\u0E2A\u0E34\u0E17\u0E18\u0E34\u0E20\u0E32\u0E1E\u0E2B\u0E23\u0E37\u0E2D\u0E42\u0E2B\u0E25\u0E14\u0E0A\u0E49\u0E32",visual:"\u0E1B\u0E31\u0E0D\u0E2B\u0E32\u0E40\u0E25\u0E22\u0E4C\u0E40\u0E2D\u0E32\u0E15\u0E4C \u0E2A\u0E44\u0E15\u0E25\u0E4C \u0E2B\u0E23\u0E37\u0E2D\u0E01\u0E32\u0E23\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25",confusing:"\u0E40\u0E02\u0E49\u0E32\u0E43\u0E08\u0E22\u0E32\u0E01\u0E2B\u0E23\u0E37\u0E2D\u0E19\u0E33\u0E17\u0E32\u0E07\u0E22\u0E32\u0E01",other:"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E2D\u0E37\u0E48\u0E19"}},step2:{heading:"\u0E40\u0E01\u0E34\u0E14\u0E2D\u0E30\u0E44\u0E23\u0E02\u0E36\u0E49\u0E19?",intents:{bug:["\u0E41\u0E04\u0E23\u0E0A","\u0E44\u0E21\u0E48\u0E15\u0E2D\u0E1A\u0E2A\u0E19\u0E2D\u0E07","\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2B\u0E32\u0E22","\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E1C\u0E34\u0E14","\u0E2D\u0E37\u0E48\u0E19\u0E46"],slow:["\u0E42\u0E2B\u0E25\u0E14\u0E2B\u0E19\u0E49\u0E32","\u0E01\u0E32\u0E23\u0E42\u0E15\u0E49\u0E15\u0E2D\u0E1A","API","\u0E41\u0E2D\u0E19\u0E34\u0E40\u0E21\u0E0A\u0E31\u0E19","\u0E2D\u0E37\u0E48\u0E19\u0E46"],visual:["\u0E40\u0E25\u0E22\u0E4C\u0E40\u0E2D\u0E32\u0E15\u0E4C\u0E40\u0E2A\u0E35\u0E22","\u0E0B\u0E49\u0E2D\u0E19\u0E17\u0E31\u0E1A","\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E2B\u0E32\u0E22","\u0E2A\u0E35/\u0E1F\u0E2D\u0E19\u0E15\u0E4C\u0E1C\u0E34\u0E14","\u0E2D\u0E37\u0E48\u0E19\u0E46"],confusing:["\u0E1B\u0E49\u0E32\u0E22\u0E44\u0E21\u0E48\u0E0A\u0E31\u0E14","\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E33\u0E41\u0E19\u0E30\u0E19\u0E33","\u0E02\u0E31\u0E49\u0E19\u0E15\u0E2D\u0E19\u0E44\u0E21\u0E48\u0E04\u0E32\u0E14\u0E04\u0E34\u0E14","\u0E2B\u0E25\u0E07\u0E17\u0E32\u0E07","\u0E2D\u0E37\u0E48\u0E19\u0E46"],other:["\u0E02\u0E2D\u0E1F\u0E35\u0E40\u0E08\u0E2D\u0E23\u0E4C","\u0E01\u0E32\u0E23\u0E40\u0E02\u0E49\u0E32\u0E16\u0E36\u0E07","\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E1C\u0E34\u0E14","\u0E2D\u0E37\u0E48\u0E19\u0E46"]}},step3:{heading:"\u0E1A\u0E2D\u0E01\u0E40\u0E23\u0E32\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21",descriptionPlaceholder:"\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E2A\u0E34\u0E48\u0E07\u0E17\u0E35\u0E48\u0E40\u0E01\u0E34\u0E14\u0E02\u0E36\u0E49\u0E19\u2026",screenshotButton:"\u0E41\u0E19\u0E1A\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15",screenshotAttached:"\u0E41\u0E19\u0E1A\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u0E41\u0E25\u0E49\u0E27 \u2713",screenshotCapturing:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E16\u0E48\u0E32\u0E22\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u2026",screenshotFailed:"\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E16\u0E48\u0E32\u0E22\u0E20\u0E32\u0E1E\u0E44\u0E14\u0E49 \u2014 \u0E42\u0E1B\u0E23\u0E14\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E41\u0E17\u0E19",elementButton:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A",elementSelected:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E41\u0E25\u0E49\u0E27 \u2713",elementCapturing:"\u0E04\u0E25\u0E34\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u2026",elementSelectorHint:"\u0E04\u0E25\u0E34\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E43\u0E14\u0E01\u0E47\u0E44\u0E14\u0E49 \xB7 Esc \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",optional:"(\u0E44\u0E21\u0E48\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A)",tooShort:"\u0E01\u0E23\u0E38\u0E13\u0E32\u0E43\u0E2B\u0E49\u0E23\u0E32\u0E22\u0E25\u0E30\u0E40\u0E2D\u0E35\u0E22\u0E14\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21",examplePrompts:["\u0E1B\u0E38\u0E48\u0E21\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E44\u0E21\u0E48\u0E17\u0E33\u0E07\u0E32\u0E19","\u0E2B\u0E19\u0E49\u0E32\u0E04\u0E49\u0E32\u0E07\u0E19\u0E32\u0E19 10 \u0E27\u0E34\u0E19\u0E32\u0E17\u0E35","\u0E40\u0E25\u0E22\u0E4C\u0E40\u0E2D\u0E32\u0E15\u0E4C\u0E1E\u0E31\u0E07"]}};var wr={widget:{trigger:"Reportar problema",title:"Reportar un problema",close:"Cerrar",back:"Volver",submit:"Enviar",submitting:"Enviando\u2026",submitted:"\xA1Gracias! Tu reporte ha sido enviado.",error:"Algo sali\xF3 mal. Por favor, int\xE9ntalo de nuevo."},step1:{heading:"\xBFQu\xE9 tipo de problema?",categories:{bug:"Error",slow:"Lento",visual:"Problema visual",confusing:"Confuso",other:"Otro"},categoryDescriptions:{bug:"Algo est\xE1 roto o no funciona",slow:"Problema de rendimiento o carga lenta",visual:"Problema de dise\xF1o, estilo o visualizaci\xF3n",confusing:"Dif\xEDcil de entender o navegar",other:"Otro problema"}},step2:{heading:"\xBFQu\xE9 pas\xF3?",intents:{bug:["Crash","Sin respuesta","P\xE9rdida de datos","Resultado incorrecto","Otro"],slow:["Carga de p\xE1gina","Interacci\xF3n","Llamada API","Animaci\xF3n","Otro"],visual:["Layout roto","Superposici\xF3n","Elemento faltante","Color/fuente incorrecta","Otro"],confusing:["Etiqueta confusa","Sin ayuda","Flujo inesperado","Navegaci\xF3n perdida","Otro"],other:["Solicitud de funci\xF3n","Accesibilidad","Error tipogr\xE1fico","Otro"]}},step3:{heading:"Cu\xE9ntanos m\xE1s",descriptionPlaceholder:"Describe lo que pas\xF3\u2026",screenshotButton:"Adjuntar captura",screenshotAttached:"Captura adjunta \u2713",screenshotCapturing:"Tomando captura\u2026",screenshotFailed:"No se pudo capturar \u2014 descr\xEDbelo en su lugar",elementButton:"Seleccionar elemento",elementSelected:"Elemento seleccionado \u2713",elementCapturing:"Haz clic en cualquier elemento\u2026",elementSelectorHint:"Clic en cualquier elemento \xB7 Esc para cancelar",optional:"(opcional)",tooShort:"Un poco m\xE1s de detalle nos ayuda a resolverlo",examplePrompts:["El bot\xF3n guardar no responde","La p\xE1gina se congel\xF3 10 segundos","El dise\xF1o se ve roto aqu\xED"]}};var ps={en:Oe,ja:yr,th:vr,es:wr};function st(t){let e=t&&t!=="auto"?t:typeof navigator<"u"?navigator.language??navigator.languages?.[0]:void 0;if(!e)return Oe;let r=e.split("-")[0].toLowerCase();return ps[r]??Oe}function xr(t,e="",r=""){let n=t==="dark",s=k=>/^#[0-9a-fA-F]{3,8}$/.test(k)?k:"",i=s(e),a=s(r),o=n?"#0F0E0C":"#F8F4ED",l=n?"#F2EBDD":"#0E0D0B",f=n?"#928B7E":"#5C5852",d=n?"#5A5650":"#9A9489",v=n?"#7A7268":"#6E6760",p=n?"rgba(242,235,221,0.10)":"rgba(14,13,11,0.10)",m=n?"rgba(242,235,221,0.18)":"rgba(14,13,11,0.16)",c=i||(n?"#FF5A47":"#E03C2C"),g=n?`${c}1F`:`${c}14`,x=a||(n?"#FFE5E0":"#7A1F15"),T="'Iowan Old Style', 'Palatino Linotype', 'Palatino', 'Book Antiqua', 'Cambria', Georgia, 'Times New Roman', serif",R="system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Display', 'Segoe UI', sans-serif",S="ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, 'Liberation Mono', monospace",y="cubic-bezier(0.22, 1, 0.36, 1)";return `
1
+ (function(){'use strict';var pn=4194304,nr=1.5*1024*1024;function hn(t){try{return JSON.stringify(t)}catch{return null}}function mn(t,e=pn){let r=hn(t);if(r===null)return {ok:false,bytes:0,maxBytes:e,serializeFailed:true,reason:"Report could not be serialized (circular reference in metadata?)"};let n=new TextEncoder().encode(r).length;return n<=e?{ok:true,bytes:n,maxBytes:e}:{ok:false,bytes:n,maxBytes:e,reason:`Report payload ${zt(n)} exceeds limit ${zt(e)}`}}function zt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}var gn="X-Mushi-User-Token",Wt="X-Mushi-SDK-Package",Vt="X-Mushi-SDK-Version",st="https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api",Ie="X-Mushi-Internal",Ce="__mushiInternal",fn=1e4,bn=2;function sr(t){let{projectId:e,apiKey:r,apiEndpoint:n=st,timeout:s=fn,maxRetries:i=bn,getUserToken:a,sdkPackage:o,sdkVersion:l}=t,f=n.replace(/\/$/,"");async function p(d,m,c,g=i,x,C){let R=`${f}${m}`,S=new AbortController,y=setTimeout(()=>S.abort(),s),k=a?.()??null;try{let b=await fetch(R,{method:d,headers:{"Content-Type":"application/json","X-Mushi-Api-Key":r,"X-Mushi-Project":e,...o?{[Wt]:o}:{},...l?{[Vt]:l}:{},...k?{[gn]:k}:{},...x?{[Ie]:x}:{},...C},body:c?JSON.stringify(c):void 0,signal:S.signal,...x?{[Ce]:x}:{}});if(clearTimeout(y),b.status===307||b.status===308){let U=b.headers.get("Location");if(U&&g>0){let D=U.replace(/\/v1\/.*$/,"").replace(/\/$/,"");if(D!==f)return f=D,p(d,m,c,g-1,x,C)}}if(!b.ok){let U=await b.json().catch(()=>({}));return b.status>=500&&g>0?(await Kt(Gt(i-g)),p(d,m,c,g-1,x,C)):{ok:!1,error:{code:U.error?.code||`HTTP_${b.status}`,message:U.error?.message||U.message||`HTTP ${b.status} error`}}}let P=await b.json();return {ok:!0,data:P&&typeof P=="object"&&"ok"in P&&"data"in P?P.data:P}}catch(b){return clearTimeout(y),g>0&&wn(b)?(await Kt(Gt(i-g)),p(d,m,c,g-1,x)):{ok:false,error:{code:"NETWORK_ERROR",message:b instanceof Error?b.message:"Unknown network error"}}}}async function v(d,m,c,g){let x=await yn(c),C=String(Date.now()),R=await vn(r,`${e}.${C}.${x}`),S=`${f}${m}`,y=await fetch(S,{method:d,headers:{"Content-Type":"application/json","X-Mushi-Api-Key":r,"X-Mushi-Project":e,...o?{[Wt]:o}:{},...l?{[Vt]:l}:{},[Ie]:"reporter-poll","X-Reporter-Token-Hash":x,"X-Reporter-Ts":C,"X-Reporter-Hmac":R},body:g?JSON.stringify(g):void 0,[Ce]:"reporter-poll"});if(!y.ok){let b=await y.json().catch(()=>({}));return {ok:false,error:{code:`HTTP_${y.status}`,message:b.error?.message??b.message??`HTTP ${y.status} error`}}}let k=await y.json();return {ok:true,data:k.data??k}}return {async submitReport(d){let m=mn(d);return m.ok?p("POST","/v1/reports",d,i,"report-submit"):{ok:false,error:{code:m.serializeFailed?"SERIALIZE_FAILED":"PAYLOAD_TOO_LARGE",message:m.reason??"Report payload exceeds size limit"}}},async getReportStatus(d){return p("GET",`/v1/reports/${d}/status`,void 0,i,"report-status")},async getSdkConfig(){return p("GET","/v1/sdk/config",void 0,i,"sdk-config")},async askAssistant(d){return p("POST","/v1/sdk/assistant",{message:d.message,threadId:d.threadId??null,context:d.context??null},1,"community")},async getLatestSdkVersion(d){let m=new URLSearchParams({package:d}).toString();return p("GET",`/v1/sdk/latest-version?${m}`,void 0,i,"sdk-config")},async postDiscoveryEvent(d){return p("POST","/v1/sdk/discovery",d,1,"discovery")},async listReporterReports(d){return v("GET","/v1/reporter/reports",d)},async listReporterComments(d,m){return v("GET",`/v1/reporter/reports/${d}/comments`,m)},async replyToReporterReport(d,m,c,g){return v("POST",`/v1/reporter/reports/${d}/reply`,m,{body:c,...g?{feedback_signal:g}:{}})},async reopenReporterReport(d,m,c){return v("POST",`/v1/reporter/reports/${d}/reopen`,m,{note:c??""})},async listNotifications(d,m){let c=new URLSearchParams;m?.since&&c.set("since",m.since),m?.limit&&c.set("limit",String(m.limit));let g=c.size?`?${c.toString()}`:"";return v("GET",`/v1/notifications${g}`,d)},async markNotificationRead(d,m){return v("POST",`/v1/notifications/${d}/read`,m,{})},async listReporterFeatureBoard(d){return v("GET","/v1/reporter/feature-board",d)},async voteReporterFeatureBoard(d,m){return v("POST",`/v1/reporter/feature-board/${d}/vote`,m,{})},async submitActivity(d,m,c){return p("POST","/v1/sdk/activity",{user_id:d,user_traits:c?.userTraits,opted_in:c?.optedIn,reporter_token_hash:c?.reporterTokenHash,...c?.hostJwt?{host_jwt:c.hostJwt}:{},events:m},1,"discovery")},async getMyPoints(d){return p("GET",`/v1/sdk/me/points?userId=${encodeURIComponent(d)}`,void 0,1,"reporter-poll")},async getMyTier(d){return p("GET",`/v1/sdk/me/tier?userId=${encodeURIComponent(d)}`,void 0,1,"reporter-poll")},async getMyHistory(d,m){let c=new URLSearchParams({userId:d,...m?.limit?{limit:String(m.limit)}:{}});return p("GET",`/v1/sdk/me/history?${c}`,void 0,1,"reporter-poll")},async getHallOfFame(d=10){return p("GET",`/v1/sdk/hall-of-fame?limit=${d}`,void 0,1,"reporter-poll")},async sendMagicLink(d){return p("POST","/v1/tester/magic-link",{email:d},1,"community")},async linkReporterToken(d,m){return p("POST","/v1/tester/link-reporter",{reporter_token_hash:d},1,"community",{Authorization:`Bearer ${m}`})},async getCrossAppReports(d,m){let c=new URLSearchParams;m?.limit&&c.set("limit",String(m.limit)),m?.offset&&c.set("offset",String(m.offset));let g=c.size?`?${c.toString()}`:"";return p("GET",`/v1/tester/cross-app-reports${g}`,void 0,1,"community",{Authorization:`Bearer ${d}`})},async getMyReputation(d){return p("GET","/v1/tester/reputation",void 0,1,"community",{Authorization:`Bearer ${d}`})},async getPublicLeaderboard(d=20){return p("GET",`/v1/public/tester-leaderboard?limit=${d}`,void 0,1,"reporter-poll")},async getTesterStatus(d){return p("GET","/v1/me/tester-status",void 0,1,"community",{Authorization:`Bearer ${d}`})}}}async function yn(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function vn(t,e){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},false,["sign"]),n=await crypto.subtle.sign("HMAC",r,new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}function Kt(t){return new Promise(e=>setTimeout(e,t))}function Gt(t){return Math.min(1e3*2**t+Math.random()*500,1e4)}function wn(t){return t instanceof DOMException&&t.name==="AbortError"||t instanceof TypeError}function rt(...t){return t.find(e=>e!==void 0&&e!=="")}function oe(t){try{let e=undefined;return typeof e=="object"&&e!==null?e[t]:void 0}catch{return}}function me(t){try{return t()}catch{return}}function or(){let t=rt(oe("VITE_MUSHI_PROJECT_ID"),oe("NEXT_PUBLIC_MUSHI_PROJECT_ID"),oe("NUXT_PUBLIC_MUSHI_PROJECT_ID"),oe("EXPO_PUBLIC_MUSHI_PROJECT_ID"),me(()=>process.env.NEXT_PUBLIC_MUSHI_PROJECT_ID),me(()=>process.env.EXPO_PUBLIC_MUSHI_PROJECT_ID),me(()=>process.env.MUSHI_PROJECT_ID)),e=rt(oe("VITE_MUSHI_API_KEY"),oe("NEXT_PUBLIC_MUSHI_API_KEY"),oe("NUXT_PUBLIC_MUSHI_API_KEY"),oe("EXPO_PUBLIC_MUSHI_API_KEY"),me(()=>process.env.NEXT_PUBLIC_MUSHI_API_KEY),me(()=>process.env.EXPO_PUBLIC_MUSHI_API_KEY),me(()=>process.env.MUSHI_API_KEY)),r=rt(oe("VITE_MUSHI_API_ENDPOINT"),oe("NEXT_PUBLIC_MUSHI_API_ENDPOINT"),oe("NUXT_PUBLIC_MUSHI_API_ENDPOINT"),oe("EXPO_PUBLIC_MUSHI_API_ENDPOINT"),me(()=>process.env.NEXT_PUBLIC_MUSHI_API_ENDPOINT),me(()=>process.env.EXPO_PUBLIC_MUSHI_API_ENDPOINT),me(()=>process.env.MUSHI_API_ENDPOINT)),n={};return t&&(n.projectId=t),e&&(n.apiKey=e),r&&(n.apiEndpoint=r),n}var xn=10,Sn=2e3,En=[/^(.)\1{10,}$/,/^[A-Z\s!?]{20,}$/,/^[\d\s]+$/,/^[^a-zA-Z\u00C0-\u024F\u4E00-\u9FFF\u3040-\u309F\u30A0-\u30FF]{10,}$/,/^(asdf|qwerty|lorem ipsum)[.,!?\s]*$/i],kn=/^[bcdfghjklmnpqrstvwxz]{6,}/i;function ir(t={}){let{enabled:e=true,blockObviousSpam:r=true,minDescriptionLength:n=xn,maxDescriptionLength:s=Sn}=t;function i(o){if(!e)return {passed:true};let l=o.trim();if(l.length<n)return {passed:false,reason:`Too short (min ${n} characters)`};if(l.length>s)return {passed:false,reason:`Too long (max ${s} characters)`};if(r){for(let p of En)if(p.test(l))return {passed:false,reason:"Detected as spam"};if(kn.test(l))return {passed:false,reason:"Detected as gibberish"};if(l.split(/\s+/).filter(p=>p.length>1).length<2)return {passed:false,reason:"Description needs at least 2 words"}}return {passed:true}}function a(o){let l=o.trim();return l.length<=s?l:l.slice(0,s)+"..."}return {check:i,truncate:a}}var Yt={debug:10,info:20,warn:30,error:40,fatal:50,silent:99},Rn={debug:"DBG",info:"INF",warn:"WRN",error:"ERR",fatal:"FTL"},Q={reset:"\x1B[0m",dim:"\x1B[2m",bold:"\x1B[1m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",red:"\x1B[31m",white:"\x1B[37m",bgRed:"\x1B[41m"},Cn={debug:Q.dim,info:Q.green,warn:Q.yellow,error:Q.red,fatal:`${Q.bgRed}${Q.white}${Q.bold}`};function Tn(){try{if(typeof globalThis.Deno<"u")return "json"}catch{}let t=typeof globalThis.process<"u"?globalThis.process:void 0;if(t?.env){if(t.env.NODE_ENV==="production"||t.env.LOG_FORMAT==="json")return "json";if(t.env.LOG_FORMAT==="pretty"||t.stdout?.isTTY)return "pretty"}return typeof globalThis.window<"u"?"pretty":"json"}function Mn(t){let e=[];for(let[r,n]of Object.entries(t))n!=null&&(typeof n=="object"?e.push(`${r}=${JSON.stringify(n)}`):e.push(`${r}=${String(n)}`));return e.join(" ")}function $n(t){let{ts:e,level:r,scope:n,msg:s,...i}=t,a=e.slice(11,23),o=Cn[r]??"",l=Rn[r]??r.toUpperCase(),f=Object.keys(i).length>0?` ${Q.dim}${Mn(i)}${Q.reset}`:"";return `${Q.dim}${a}${Q.reset} ${o}${l}${Q.reset} ${Q.cyan}[${n}]${Q.reset} ${s}${f}`}function Ln(t){return JSON.stringify(t)}function In(t){return t==="stderr"?(e,r)=>{console.error(r);}:(e,r)=>{switch(e){case "error":case "fatal":console.error(r);break;case "warn":console.warn(r);break;default:console.log(r);}}}function ar(t,e,r,n,s){let i=e;function a(o,l,f){if(Yt[o]<Yt[i])return;let p={ts:new Date().toISOString(),level:o,scope:t,msg:l,...r,...f};s(o,n(p));}return {debug:(o,l)=>a("debug",o,l),info:(o,l)=>a("info",o,l),warn:(o,l)=>a("warn",o,l),error:(o,l)=>a("error",o,l),fatal:(o,l)=>a("fatal",o,l),child(o,l){return ar(`${t}:${o}`,i,{...r,...l},n,s)},setLevel(o){i=o;}}}function Ne(t){let{scope:e,level:r="info",meta:n={},format:s="auto",destination:i="stdout"}=t,o=(s==="auto"?Tn():s)==="json"?Ln:$n,l=In(i);return ar(e,r,n,o,l)}var ot={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},fatal:()=>{},child:()=>ot,setLevel:()=>{}},An="mushi-mushi-keyring",Te="keys",lr="offline-queue/v1",Oe=null,He=null;function _n(){return typeof globalThis<"u"&&typeof globalThis.crypto<"u"&&typeof globalThis.crypto.subtle<"u"&&typeof indexedDB<"u"}function cr(){return new Promise((t,e)=>{let r=indexedDB.open(An,1);r.onupgradeneeded=()=>{let n=r.result;n.objectStoreNames.contains(Te)||n.createObjectStore(Te);},r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error);})}async function Pn(){let t=await cr();return new Promise((e,r)=>{let s=t.transaction(Te,"readonly").objectStore(Te).get(lr);s.onsuccess=()=>e(s.result??null),s.onerror=()=>r(s.error);})}async function Dn(t){let e=await cr();return new Promise((r,n)=>{let s=e.transaction(Te,"readwrite");s.objectStore(Te).put(t,lr),s.oncomplete=()=>r(),s.onerror=()=>n(s.error);})}async function ur(){if(Oe)return Oe;if(He)return He;if(!_n())throw new Error("Web Crypto + IndexedDB required for offline queue encryption");return He=(async()=>{let t=await Pn();if(t)return Oe=t,t;let e=await crypto.subtle.generateKey({name:"AES-GCM",length:256},false,["encrypt","decrypt"]);return await Dn(e),Oe=e,e})(),He}function Xt(t){let e="";for(let r of t)e+=String.fromCharCode(r);return btoa(e)}function Jt(t){let e=atob(t),r=new Uint8Array(new ArrayBuffer(e.length));for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}async function On(t){let e=await ur(),r=crypto.getRandomValues(new Uint8Array(12)),n=new TextEncoder().encode(JSON.stringify(t)),s=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:r},e,n));return {_mme:1,iv:Xt(r),ct:Xt(s)}}function Hn(t){return !!t&&typeof t=="object"&&t._mme===1&&typeof t.iv=="string"&&typeof t.ct=="string"}async function Bn(t){let e=await ur(),r=Jt(t.iv),n=Jt(t.ct),s=await crypto.subtle.decrypt({name:"AES-GCM",iv:r},e,n);return JSON.parse(new TextDecoder().decode(s))}var Re=Ne({scope:"mushi:queue",level:"warn"}),Nn="mushi-mushi",Z="offline-reports",Fn=1,nt="mushi_offline_queue",Un=10,qn=6e4,jn=3e4,zn=8,Wn=1440*60*1e3;function dr(t={}){let{enabled:e=true,maxQueueSize:r=50,syncOnReconnect:n=true,encryptAtRest:s=true}=t,i=null,a=null,o=null;async function l(M){let T=new Date().toISOString();if(!s)return {...M,queuedAt:T};try{let I=await On(M);return {id:M.id,queuedAt:T,payload:I}}catch(I){return Re.warn("Offline queue: encryption failed, storing plaintext",{err:String(I)}),{...M,queuedAt:T}}}async function f(M){if(p(M))try{return await Bn(M.payload)}catch(T){return Re.warn("Offline queue: decrypt failed, dropping row",{err:String(T),id:M.id}),null}return M}function p(M){return !!M.payload&&Hn(M.payload)}function v(M){let T=M.attempts;return typeof T=="number"&&Number.isFinite(T)?T:0}function d(M,T){let I=M.queuedAt;if(!I)return false;let O=Date.parse(I);return Number.isNaN(O)?false:T-O>Wn}function m(){return o||(typeof indexedDB<"u"?o="indexeddb":typeof localStorage<"u"?o="localstorage":o="none",o)}function c(){return new Promise((M,T)=>{let I=indexedDB.open(Nn,Fn);I.onupgradeneeded=()=>{let O=I.result;O.objectStoreNames.contains(Z)||O.createObjectStore(Z,{keyPath:"id"});},I.onsuccess=()=>M(I.result),I.onerror=()=>{o="localstorage",T(I.error);};})}async function g(M){let T=await c(),I=await l(M);return new Promise((O,_)=>{let re=T.transaction(Z,"readwrite");re.objectStore(Z).put(I),re.oncomplete=()=>O(),re.onerror=()=>_(re.error);})}async function x(){let M=await c();return new Promise((T,I)=>{let _=M.transaction(Z,"readonly").objectStore(Z).getAll();_.onsuccess=()=>T(_.result),_.onerror=()=>I(_.error);})}async function C(M){let T=await c();return new Promise((I,O)=>{let _=T.transaction(Z,"readwrite");_.objectStore(Z).delete(M),_.oncomplete=()=>I(),_.onerror=()=>O(_.error);})}async function R(M){let T=await c();return new Promise((I,O)=>{let _=T.transaction(Z,"readwrite");_.objectStore(Z).put(M),_.oncomplete=()=>I(),_.onerror=()=>O(_.error);})}async function S(){let M=await c();return new Promise((T,I)=>{let _=M.transaction(Z,"readonly").objectStore(Z).count();_.onsuccess=()=>T(_.result),_.onerror=()=>I(_.error);})}async function y(){let M=await c();return new Promise((T,I)=>{let O=M.transaction(Z,"readwrite");O.objectStore(Z).clear(),O.oncomplete=()=>T(),O.onerror=()=>I(O.error);})}function k(){try{let M=localStorage.getItem(nt);return M?JSON.parse(M):[]}catch{return []}}function b(M){try{localStorage.setItem(nt,JSON.stringify(M));}catch{}}async function P(M){let T=k();T.push(await l(M)),b(T);}function H(M){let T=k().filter(I=>I.id!==M);b(T);}function U(M){let T=k(),I=T.findIndex(O=>O.id===M.id);I>=0&&(T[I]=M,b(T));}async function D(M){if(!e)return;if(await z()>=r){Re.warn("Offline queue full \u2014 dropping report",{maxQueueSize:r});return}let I=m();if(I==="indexeddb")try{await g(M);return}catch{o="localstorage";}if(I==="localstorage"||o==="localstorage"){await P(M);return}}function G(M){return Math.min(1e3*2**M+Math.random()*500,qn)}function xe(M){return new Promise(T=>setTimeout(T,M))}async function V(M){if(!e)return {sent:0,failed:0};let T,I=m();if(I==="indexeddb")try{T=await x();}catch{T=k();}else T=k();let O=Date.now(),_=[];for(let ne of T)if(d(ne,O)){let Y=ne.id;try{I==="indexeddb"?await C(Y):H(Y);}catch{H(Y);}Re.debug("Offline queue: evicting stale report",{id:Y});}else _.push(ne);T=_;let re=T.slice(0,Un),Se=0,Ee=0;for(let ne=0;ne<re.length;ne++){let Y=re[ne],K=Y.id,be=await f(Y);if(!be){try{I==="indexeddb"?await C(K):H(K);}catch{H(K);}Ee++;continue}let A=await M.submitReport(be);if(A.ok){try{I==="indexeddb"?await C(K):H(K);}catch{H(K);}Se++;}else {let tt=A.error?.code==="HTTP_400"||A.error?.code==="HTTP_413"||A.error?.code==="HTTP_422"||A.error?.code==="INGEST_ERROR"||A.error?.code==="VALIDATION_ERROR"||A.error?.code==="PAYLOAD_TOO_LARGE"||A.error?.code==="SERIALIZE_FAILED"||typeof A.error?.message=="string"&&/invalid payload|description must be at least|validation/i.test(A.error.message),Le=!tt&&(A.error?.code==="NETWORK_ERROR"||A.error?.code==="HTTP_403"||A.error?.code==="HTTP_429"||A.error?.code==="HTTP_502"||A.error?.code==="HTTP_503"||A.error?.code==="HTTP_504"||typeof A.error?.code=="string"&&A.error.code.startsWith("HTTP_5"));if(tt)try{I==="indexeddb"?await C(K):H(K);}catch{H(K);}else if(Le){let ke=v(Y)+1;if(ke>=zn){try{I==="indexeddb"?await C(K):H(K);}catch{H(K);}Re.warn("Offline queue: giving up on report after repeated failures",{id:K,attempts:ke,code:A.error?.code});}else {Y.attempts=ke;try{I==="indexeddb"?await R(Y):U(Y);}catch{U(Y);}Re.debug("Offline queue: transient failure, will retry",{id:K,attempts:ke,code:A.error?.code});}}Ee++,ne<re.length-1&&await xe(G(ne));}}return {sent:Se,failed:Ee}}async function z(){if(m()==="indexeddb")try{return await S()}catch{return k().length}return k().length}async function W(){if(m()==="indexeddb")try{await y();}catch{}try{localStorage.removeItem(nt);}catch{}}function fe(M){if(!e||!n||typeof window>"u")return;let T=()=>{navigator.onLine&&V(M).catch(()=>{});};window.addEventListener("online",T),a=setInterval(()=>{z().then(I=>{I>0&&T();});},jn),i=()=>{window.removeEventListener("online",T),a&&(clearInterval(a),a=null);};}function he(){i?.(),i=null;}return {enqueue:D,flush:V,size:z,clear:W,startAutoSync:fe,stopAutoSync:he}}function it(){let t=typeof navigator<"u"?navigator:void 0,e=typeof window<"u"?window:void 0,r=typeof document<"u"?document:void 0,n=typeof screen<"u"?screen:void 0;Kn(t);let s=t&&"connection"in t?t.connection:void 0;return {userAgent:t?.userAgent??"unknown",platform:t?.platform??"unknown",language:t?.language??"en",viewport:{width:e?.innerWidth??0,height:e?.innerHeight??0},url:e?.location?.href??"",referrer:r?.referrer??"",timestamp:new Date().toISOString(),timezone:Intl?.DateTimeFormat?.()?.resolvedOptions?.()?.timeZone??"UTC",connection:s?{effectiveType:s.effectiveType,downlink:s.downlink,rtt:s.rtt}:void 0,deviceMemory:t?.deviceMemory,hardwareConcurrency:t?.hardwareConcurrency,route:e?.location?.pathname,nearestTestid:Vn(r),userAgentData:Yn(t),screen:Xn(n,e),prefersColorScheme:Jn(e),prefersReducedMotion:ie(e,"(prefers-reduced-motion: reduce)"),prefersReducedData:ie(e,"(prefers-reduced-data: reduce)"),prefersContrast:Zn(e),forcedColors:ie(e,"(forced-colors: active)"),online:typeof t?.onLine=="boolean"?t.onLine:void 0,displayMode:Qn(e),documentTitle:r?.title?.slice(0,200),buildId:es(r),pageLoadTiming:ts(e)}}function Vn(t){if(!t)return;let e=t.activeElement??null,r=0;for(;e&&r<20;){let n=e.getAttribute?.("data-testid");if(n)return n;e=e.parentElement,r++;}}var ce=null,Zt=false;function Kn(t){if(Zt)return;let e=t?.userAgentData;e?.getHighEntropyValues&&(Zt=true,e.getHighEntropyValues(["architecture","bitness","model","platformVersion","uaFullVersion","fullVersionList"]).then(r=>{ce=r;}).catch(()=>{}));}function Gn(t){if(!t?.length)return;let e=t.filter(n=>!/not.?a.?brand/i.test(n.brand));return e.length===0?void 0:e.find(n=>!/chromium|google chrome/i.test(n.brand))??e[0]}function Yn(t){let e=t?.userAgentData;if(!e&&!ce)return;let r=ce?.fullVersionList,n=Gn(r??e?.brands),s={};return n&&(s.browser=n.brand,s.browserVersion=n.version),e?.platform&&(s.os=e.platform),ce?.platformVersion&&(s.osVersion=ce.platformVersion),typeof e?.mobile=="boolean"&&(s.mobile=e.mobile),ce?.model&&(s.model=ce.model),ce?.architecture&&(s.architecture=ce.architecture),ce?.bitness&&(s.bitness=ce.bitness),Object.keys(s).length===0?void 0:s}function Xn(t,e){if(!t&&!e)return;let r={};typeof t?.width=="number"&&(r.width=t.width),typeof t?.height=="number"&&(r.height=t.height),typeof e?.devicePixelRatio=="number"&&(r.devicePixelRatio=e.devicePixelRatio),typeof t?.colorDepth=="number"&&(r.colorDepth=t.colorDepth);let n=t?.orientation?.type;return n&&(r.orientation=n),Object.keys(r).length===0?void 0:r}function ie(t,e){if(t?.matchMedia)try{return t.matchMedia(e).matches}catch{return}}function Jn(t){if(t?.matchMedia)return ie(t,"(prefers-color-scheme: dark)")?"dark":ie(t,"(prefers-color-scheme: light)")?"light":"no-preference"}function Zn(t){if(t?.matchMedia)return ie(t,"(prefers-contrast: more)")?"more":ie(t,"(prefers-contrast: less)")?"less":ie(t,"(prefers-contrast: custom)")?"custom":"no-preference"}function Qn(t){if(t?.matchMedia){if(ie(t,"(display-mode: fullscreen)"))return "fullscreen";if(ie(t,"(display-mode: standalone)"))return "standalone";if(ie(t,"(display-mode: minimal-ui)"))return "minimal-ui";if(ie(t,"(display-mode: browser)"))return "browser"}}function es(t){if(!t)return;let r=t.querySelector?.('meta[name="mushi:build"]')?.content?.trim();if(r)return r.slice(0,64)}function ts(t){let e=t?.performance;if(!e?.getEntriesByType)return;let r;try{r=e.getEntriesByType("navigation")[0];}catch{return}if(!r)return;let n=r.startTime??0,s={};return r.domContentLoadedEventEnd>0&&(s.domContentLoadedMs=Math.round(r.domContentLoadedEventEnd-n)),r.loadEventEnd>0&&(s.loadCompleteMs=Math.round(r.loadEventEnd-n)),r.responseStart>0&&(s.timeToFirstByteMs=Math.round(r.responseStart-n)),typeof r.type=="string"&&(s.navigationType=r.type),Object.keys(s).length===0?void 0:s}var Qt="mushi_reporter_token";function X(){if(typeof localStorage<"u"){let e=localStorage.getItem(Qt);if(e)return e}let t=rs();if(typeof localStorage<"u")try{localStorage.setItem(Qt,t);}catch{}return t}function rs(){if(typeof crypto<"u"&&crypto.randomUUID)return `mushi_${crypto.randomUUID()}`;let t=new Uint8Array(16);if(typeof crypto<"u")crypto.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);return `mushi_${Array.from(t).map(r=>r.toString(16).padStart(2,"0")).join("")}`}function at(){let t=typeof crypto<"u"?crypto:void 0;if(t?.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t?.getRandomValues)t.getRandomValues(e);else for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return `${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}var er="mushi_fingerprint_hash";function ns(){let t=typeof navigator<"u"?navigator:void 0,e=typeof screen<"u"?screen:void 0,r=typeof window<"u"?window:void 0;return {userAgent:t?.userAgent??"unknown",platform:t?.platform??"unknown",language:t?.language??"en",timezone:Intl?.DateTimeFormat?.()?.resolvedOptions?.()?.timeZone??"UTC",screenWidth:e?.width??0,screenHeight:e?.height??0,pixelRatio:r?.devicePixelRatio??1,deviceMemory:t?.deviceMemory,hardwareConcurrency:t?.hardwareConcurrency}}async function ss(t){if(typeof crypto<"u"&&crypto.subtle){let r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return `fbk_${(e>>>0).toString(16).padStart(8,"0")}`}async function pr(){if(typeof localStorage<"u"){let n=localStorage.getItem(er);if(n)return n}let t=ns(),e=JSON.stringify(t),r=await ss(e);if(typeof localStorage<"u")try{localStorage.setItem(er,r);}catch{}return r}var tr="mushi_session_id",Be=null;function Ae(){if(Be)return Be;if(typeof sessionStorage<"u"){let e=sessionStorage.getItem(tr);if(e)return Be=e,e}let t=os();if(Be=t,typeof sessionStorage<"u")try{sessionStorage.setItem(tr,t);}catch{}return t}function os(){let t=Date.now().toString(36),e=Math.random().toString(36).slice(2,8);return `ms_${t}_${e}`}var is=10,as=1,ls=5e3;function hr(t={}){let{maxBurst:e=is,refillRate:r=as,refillIntervalMs:n=ls}=t,s=e,i=Date.now();function a(){let p=Date.now(),v=p-i,d=Math.floor(v/n);d>0&&(s=Math.min(e,s+d*r),i=p);}function o(){return a(),s>0?(s--,true):false}function l(){s=e,i=Date.now();}function f(){return a(),s}return {tryConsume:o,reset:l,availableTokens:f}}var cs=[{key:"ssns",regex:/\b\d{3}-\d{2}-\d{4}\b/g,replacement:"[REDACTED_SSN]"},{key:"creditCards",regex:/\b(?:\d[ -]*){12,18}\d\b/g,replacement:"[REDACTED_CC]"},{key:"secretTokens",regex:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,replacement:"[REDACTED_AWS_KEY]"},{key:"secretTokens",regex:/(?:aws_secret_access_key|secret_access_key)["'\s:=]+[A-Za-z0-9/+=]{40}\b/gi,replacement:"aws_secret_access_key=[REDACTED_AWS_SECRET]"},{key:"secretTokens",regex:/\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{24,}\b/g,replacement:"[REDACTED_STRIPE_KEY]"},{key:"secretTokens",regex:/\bpk_(?:live|test)_[A-Za-z0-9]{24,}\b/g,replacement:"[REDACTED_STRIPE_PK]"},{key:"secretTokens",regex:/\bxox[abpor]-[A-Za-z0-9-]{10,}\b/g,replacement:"[REDACTED_SLACK_TOKEN]"},{key:"secretTokens",regex:/\bghp_[A-Za-z0-9]{36}\b/g,replacement:"[REDACTED_GITHUB_PAT]"},{key:"secretTokens",regex:/\bgithub_pat_[A-Za-z0-9_]{80,}\b/g,replacement:"[REDACTED_GITHUB_PAT]"},{key:"secretTokens",regex:/\bsk-(?:proj-)?[A-Za-z0-9_-]{20,}\b/g,replacement:"[REDACTED_OPENAI_KEY]"},{key:"secretTokens",regex:/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g,replacement:"[REDACTED_ANTHROPIC_KEY]"},{key:"secretTokens",regex:/\bAIza[0-9A-Za-z_-]{35}\b/g,replacement:"[REDACTED_GOOGLE_KEY]"},{key:"secretTokens",regex:/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,replacement:"[REDACTED_JWT]"},{key:"emails",regex:/\b[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}\b/g,replacement:"[REDACTED_EMAIL]"},{key:"phones",regex:/(?:\+\d{1,3}[\s.-])?\(?\d{2,4}\)?[\s.-]\d{3,4}[\s.-]\d{3,4}\b/g,replacement:"[REDACTED_PHONE]"},{key:"ipAddresses",regex:/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,replacement:"[REDACTED_IP]"},{key:"ipv6",regex:/\b(?:[A-Fa-f0-9]{1,4}:){2,7}[A-Fa-f0-9]{0,4}\b/g,replacement:"[REDACTED_IPV6]"}],us={emails:true,phones:true,creditCards:true,ssns:true,ipAddresses:false,secretTokens:true,ipv6:false};function mr(t={}){let e={...us,...t},r=cs.filter(i=>e[i.key]);function n(i){if(!i)return i;let a=i;for(let{regex:o,replacement:l}of r)a=a.replace(new RegExp(o.source,o.flags),l);return a}function s(i,a){let o={...i};for(let l of a)typeof o[l]=="string"&&(o[l]=n(o[l]));return o}return {scrub:n,scrubObject:s}}var ds=50,ps=500;function gr(t={}){let e=Math.max(1,t.max??ds),r=Math.max(50,t.maxMessageLength??ps),n=[];return {add(s){let i=typeof s.timestamp=="number"?s.timestamp:Date.now(),a=typeof s.message=="string"&&s.message.length>r?`${s.message.slice(0,r)}\u2026`:s.message,o={timestamp:i,category:s.category,level:s.level??"info",message:a??"",...s.data?{data:s.data}:{}};for(n.push(o);n.length>e;)n.shift();},getAll(){return n.slice()},clear(){n=[];},size(){return n.length}}}var rr=8*1024,hs=1e3;function fr(t){if(t instanceof Error){let e=t.name||"Error",r=t.message||String(t),n=typeof t.stack=="string"&&t.stack.length>0?t.stack.slice(0,rr):void 0,s=t.cause;return {name:e,message:r,...n?{stack:n}:{},...s!==void 0?{cause:s instanceof Error?s.message:s}:{}}}if(typeof t=="string")return {name:"Error",message:t};if(t&&typeof t=="object"){let e=t,r=typeof e.name=="string"?e.name:"Error",n=typeof e.message=="string"?e.message:(()=>{try{return JSON.stringify(e).slice(0,hs)}catch{return String(e)}})(),s=typeof e.stack=="string"?e.stack.slice(0,rr):void 0;return {name:r,message:n,...s?{stack:s}:{}}}return t===void 0?{name:"Error",message:"unknown"}:{name:"Error",message:String(t)}}function ms(t){let e=t.length%4===0?"":"=".repeat(4-t.length%4),r=t.replace(/-/g,"+").replace(/_/g,"/")+e;if(typeof atob=="function")return atob(r);let n=globalThis.Buffer;return n?n.from(r,"base64").toString("binary"):""}function br(t){if(typeof t!="string")return null;let e=t.split(".");if(e.length!==3)return null;try{let r=ms(e[1]),n=JSON.parse(r),s=typeof n.projectId=="string"?n.projectId:void 0,i=typeof n.sub=="string"?n.sub:void 0;return !s||!i?null:{projectId:s,sub:i,...typeof n.email=="string"?{email:n.email}:{},...typeof n.name=="string"?{name:n.name}:{},...typeof n.iat=="number"?{iat:n.iat}:{},...typeof n.exp=="number"?{exp:n.exp}:{}}}catch{return null}}async function vr(t,e=nr){if(!t.startsWith("data:image/")||yr(t)<=e)return t;if(typeof document>"u")return null;let r=new Image;await new Promise((i,a)=>{r.onload=()=>i(),r.onerror=()=>a(new Error("screenshot_decode_failed")),r.src=t;});let n=[.65,.5,.35,.25],s=[1,.85,.7,.55,.4];for(let i of s){let a=document.createElement("canvas"),o=Math.max(1,Math.round(r.naturalWidth*i)),l=Math.max(1,Math.round(r.naturalHeight*i));a.width=o,a.height=l;let f=a.getContext("2d");if(f){f.drawImage(r,0,0,o,l);for(let p of n){let v=a.toDataURL("image/jpeg",p);if(yr(v)<=e)return v}}}return null}function yr(t){let e=t.indexOf(",");if(e<0)return t.length;let r=t.slice(e+1);return Math.ceil(r.length*3/4)}var Fe={widget:{trigger:"Report Issue",title:"Report an Issue",close:"Close",back:"Back",submit:"Submit",submitting:"Submitting\u2026",submitted:"Thank you! Your report has been submitted.",error:"Something went wrong. Please try again."},step1:{heading:"What kind of issue?",categories:{bug:"Bug",slow:"Slow / Laggy",visual:"Visual Glitch",confusing:"Confusing",other:"Other"},categoryDescriptions:{bug:"Something is broken or not working",slow:"Performance issue or slow loading",visual:"Layout, styling, or display problem",confusing:"Hard to understand or navigate",other:"Something else"}},step2:{heading:"What happened?",intents:{bug:["Crash","Unresponsive","Data loss","Wrong result","Other"],slow:["Page load","Interaction","API call","Animation","Other"],visual:["Layout broken","Overlapping","Missing element","Wrong color/font","Other"],confusing:["Unclear label","Missing help","Unexpected flow","Lost navigation","Other"],other:["Feature request","Accessibility","Typo","Other"]}},step3:{heading:"Tell us more",descriptionPlaceholder:"Describe what happened\u2026",screenshotButton:"Attach Screenshot",screenshotAttached:"Screenshot attached \u2713",screenshotCapturing:"Taking screenshot\u2026",screenshotFailed:"Couldn't capture \u2014 describe it instead",elementButton:"Select Element",elementSelected:"Element selected \u2713",elementCapturing:"Click anything on the page\u2026",elementSelectorHint:"Click any element \xB7 Esc to cancel",optional:"(optional)",tooShort:"A bit more detail helps us fix it faster",examplePrompts:["The save button does nothing","Page froze for 10 seconds","Layout looks broken here"]}};var wr={widget:{trigger:"\u554F\u984C\u3092\u5831\u544A",title:"\u554F\u984C\u3092\u5831\u544A\u3059\u308B",close:"\u9589\u3058\u308B",back:"\u623B\u308B",submit:"\u9001\u4FE1",submitting:"\u9001\u4FE1\u4E2D\u2026",submitted:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\uFF01\u30EC\u30DD\u30FC\u30C8\u304C\u9001\u4FE1\u3055\u308C\u307E\u3057\u305F\u3002",error:"\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002"},step1:{heading:"\u3069\u306E\u3088\u3046\u306A\u554F\u984C\u3067\u3059\u304B\uFF1F",categories:{bug:"\u30D0\u30B0",slow:"\u9045\u3044\u30FB\u91CD\u3044",visual:"\u8868\u793A\u306E\u554F\u984C",confusing:"\u308F\u304B\u308A\u306B\u304F\u3044",other:"\u305D\u306E\u4ED6"},categoryDescriptions:{bug:"\u52D5\u4F5C\u3057\u306A\u3044\u3001\u58CA\u308C\u3066\u3044\u308B",slow:"\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u304C\u60AA\u3044\u3001\u8AAD\u307F\u8FBC\u307F\u304C\u9045\u3044",visual:"\u30EC\u30A4\u30A2\u30A6\u30C8\u3001\u30C7\u30B6\u30A4\u30F3\u3001\u8868\u793A\u306E\u554F\u984C",confusing:"\u7406\u89E3\u3057\u306B\u304F\u3044\u3001\u64CD\u4F5C\u304C\u308F\u304B\u308A\u306B\u304F\u3044",other:"\u305D\u306E\u4ED6\u306E\u554F\u984C"}},step2:{heading:"\u4F55\u304C\u8D77\u304D\u307E\u3057\u305F\u304B\uFF1F",intents:{bug:["\u30AF\u30E9\u30C3\u30B7\u30E5","\u7121\u53CD\u5FDC","\u30C7\u30FC\u30BF\u6D88\u5931","\u8AA4\u3063\u305F\u7D50\u679C","\u305D\u306E\u4ED6"],slow:["\u30DA\u30FC\u30B8\u8AAD\u8FBC","\u64CD\u4F5C\u53CD\u5FDC","API\u901A\u4FE1","\u30A2\u30CB\u30E1\u30FC\u30B7\u30E7\u30F3","\u305D\u306E\u4ED6"],visual:["\u30EC\u30A4\u30A2\u30A6\u30C8\u5D29\u308C","\u8981\u7D20\u306E\u91CD\u306A\u308A","\u8981\u7D20\u304C\u8868\u793A\u3055\u308C\u306A\u3044","\u8272/\u30D5\u30A9\u30F3\u30C8\u304C\u9055\u3046","\u305D\u306E\u4ED6"],confusing:["\u30E9\u30D9\u30EB\u304C\u4E0D\u660E\u77AD","\u30D8\u30EB\u30D7\u304C\u306A\u3044","\u4E88\u60F3\u5916\u306E\u30D5\u30ED\u30FC","\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u8FF7\u5B50","\u305D\u306E\u4ED6"],other:["\u6A5F\u80FD\u8981\u671B","\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3","\u8AA4\u5B57\u8131\u5B57","\u305D\u306E\u4ED6"]}},step3:{heading:"\u8A73\u7D30\u3092\u6559\u3048\u3066\u304F\u3060\u3055\u3044",descriptionPlaceholder:"\u4F55\u304C\u8D77\u304D\u305F\u304B\u8AAC\u660E\u3057\u3066\u304F\u3060\u3055\u3044\u2026",screenshotButton:"\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u6DFB\u4ED8",screenshotAttached:"\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u6DFB\u4ED8\u6E08\u307F \u2713",screenshotCapturing:"\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u64AE\u5F71\u4E2D\u2026",screenshotFailed:"\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F \u2014 \u6587\u5B57\u3067\u6559\u3048\u3066\u304F\u3060\u3055\u3044",elementButton:"\u8981\u7D20\u3092\u9078\u629E",elementSelected:"\u8981\u7D20\u9078\u629E\u6E08\u307F \u2713",elementCapturing:"\u30DA\u30FC\u30B8\u4E0A\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u2026",elementSelectorHint:"\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF \xB7 Esc \u3067\u30AD\u30E3\u30F3\u30BB\u30EB",optional:"\uFF08\u4EFB\u610F\uFF09",tooShort:"\u3082\u3046\u5C11\u3057\u8A73\u3057\u304F\u6559\u3048\u3066\u304F\u3060\u3055\u3044",examplePrompts:["\u4FDD\u5B58\u30DC\u30BF\u30F3\u304C\u53CD\u5FDC\u3057\u306A\u3044","\u30DA\u30FC\u30B8\u304C10\u79D2\u56FA\u307E\u3063\u305F","\u30EC\u30A4\u30A2\u30A6\u30C8\u304C\u5D29\u308C\u3066\u3044\u308B"]}};var xr={widget:{trigger:"\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E1B\u0E31\u0E0D\u0E2B\u0E32",title:"\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E1B\u0E31\u0E0D\u0E2B\u0E32",close:"\u0E1B\u0E34\u0E14",back:"\u0E01\u0E25\u0E31\u0E1A",submit:"\u0E2A\u0E48\u0E07",submitting:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2A\u0E48\u0E07\u2026",submitted:"\u0E02\u0E2D\u0E1A\u0E04\u0E38\u0E13\u0E04\u0E23\u0E31\u0E1A/\u0E04\u0E48\u0E30! \u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07\u0E41\u0E25\u0E49\u0E27",error:"\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14 \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07"},step1:{heading:"\u0E1B\u0E31\u0E0D\u0E2B\u0E32\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E44\u0E2B\u0E19?",categories:{bug:"\u0E1A\u0E31\u0E01",slow:"\u0E0A\u0E49\u0E32 / \u0E41\u0E25\u0E04",visual:"\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25\u0E1C\u0E34\u0E14\u0E1B\u0E01\u0E15\u0E34",confusing:"\u0E2A\u0E31\u0E1A\u0E2A\u0E19",other:"\u0E2D\u0E37\u0E48\u0E19\u0E46"},categoryDescriptions:{bug:"\u0E21\u0E35\u0E1A\u0E32\u0E07\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E40\u0E2A\u0E35\u0E22\u0E2B\u0E23\u0E37\u0E2D\u0E17\u0E33\u0E07\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07",slow:"\u0E1B\u0E31\u0E0D\u0E2B\u0E32\u0E1B\u0E23\u0E30\u0E2A\u0E34\u0E17\u0E18\u0E34\u0E20\u0E32\u0E1E\u0E2B\u0E23\u0E37\u0E2D\u0E42\u0E2B\u0E25\u0E14\u0E0A\u0E49\u0E32",visual:"\u0E1B\u0E31\u0E0D\u0E2B\u0E32\u0E40\u0E25\u0E22\u0E4C\u0E40\u0E2D\u0E32\u0E15\u0E4C \u0E2A\u0E44\u0E15\u0E25\u0E4C \u0E2B\u0E23\u0E37\u0E2D\u0E01\u0E32\u0E23\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25",confusing:"\u0E40\u0E02\u0E49\u0E32\u0E43\u0E08\u0E22\u0E32\u0E01\u0E2B\u0E23\u0E37\u0E2D\u0E19\u0E33\u0E17\u0E32\u0E07\u0E22\u0E32\u0E01",other:"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E2D\u0E37\u0E48\u0E19"}},step2:{heading:"\u0E40\u0E01\u0E34\u0E14\u0E2D\u0E30\u0E44\u0E23\u0E02\u0E36\u0E49\u0E19?",intents:{bug:["\u0E41\u0E04\u0E23\u0E0A","\u0E44\u0E21\u0E48\u0E15\u0E2D\u0E1A\u0E2A\u0E19\u0E2D\u0E07","\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2B\u0E32\u0E22","\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E1C\u0E34\u0E14","\u0E2D\u0E37\u0E48\u0E19\u0E46"],slow:["\u0E42\u0E2B\u0E25\u0E14\u0E2B\u0E19\u0E49\u0E32","\u0E01\u0E32\u0E23\u0E42\u0E15\u0E49\u0E15\u0E2D\u0E1A","API","\u0E41\u0E2D\u0E19\u0E34\u0E40\u0E21\u0E0A\u0E31\u0E19","\u0E2D\u0E37\u0E48\u0E19\u0E46"],visual:["\u0E40\u0E25\u0E22\u0E4C\u0E40\u0E2D\u0E32\u0E15\u0E4C\u0E40\u0E2A\u0E35\u0E22","\u0E0B\u0E49\u0E2D\u0E19\u0E17\u0E31\u0E1A","\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E2B\u0E32\u0E22","\u0E2A\u0E35/\u0E1F\u0E2D\u0E19\u0E15\u0E4C\u0E1C\u0E34\u0E14","\u0E2D\u0E37\u0E48\u0E19\u0E46"],confusing:["\u0E1B\u0E49\u0E32\u0E22\u0E44\u0E21\u0E48\u0E0A\u0E31\u0E14","\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E33\u0E41\u0E19\u0E30\u0E19\u0E33","\u0E02\u0E31\u0E49\u0E19\u0E15\u0E2D\u0E19\u0E44\u0E21\u0E48\u0E04\u0E32\u0E14\u0E04\u0E34\u0E14","\u0E2B\u0E25\u0E07\u0E17\u0E32\u0E07","\u0E2D\u0E37\u0E48\u0E19\u0E46"],other:["\u0E02\u0E2D\u0E1F\u0E35\u0E40\u0E08\u0E2D\u0E23\u0E4C","\u0E01\u0E32\u0E23\u0E40\u0E02\u0E49\u0E32\u0E16\u0E36\u0E07","\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E1C\u0E34\u0E14","\u0E2D\u0E37\u0E48\u0E19\u0E46"]}},step3:{heading:"\u0E1A\u0E2D\u0E01\u0E40\u0E23\u0E32\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21",descriptionPlaceholder:"\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E2A\u0E34\u0E48\u0E07\u0E17\u0E35\u0E48\u0E40\u0E01\u0E34\u0E14\u0E02\u0E36\u0E49\u0E19\u2026",screenshotButton:"\u0E41\u0E19\u0E1A\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15",screenshotAttached:"\u0E41\u0E19\u0E1A\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u0E41\u0E25\u0E49\u0E27 \u2713",screenshotCapturing:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E16\u0E48\u0E32\u0E22\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u2026",screenshotFailed:"\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E16\u0E48\u0E32\u0E22\u0E20\u0E32\u0E1E\u0E44\u0E14\u0E49 \u2014 \u0E42\u0E1B\u0E23\u0E14\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E41\u0E17\u0E19",elementButton:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A",elementSelected:"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E41\u0E25\u0E49\u0E27 \u2713",elementCapturing:"\u0E04\u0E25\u0E34\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u2026",elementSelectorHint:"\u0E04\u0E25\u0E34\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E43\u0E14\u0E01\u0E47\u0E44\u0E14\u0E49 \xB7 Esc \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",optional:"(\u0E44\u0E21\u0E48\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A)",tooShort:"\u0E01\u0E23\u0E38\u0E13\u0E32\u0E43\u0E2B\u0E49\u0E23\u0E32\u0E22\u0E25\u0E30\u0E40\u0E2D\u0E35\u0E22\u0E14\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21",examplePrompts:["\u0E1B\u0E38\u0E48\u0E21\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E44\u0E21\u0E48\u0E17\u0E33\u0E07\u0E32\u0E19","\u0E2B\u0E19\u0E49\u0E32\u0E04\u0E49\u0E32\u0E07\u0E19\u0E32\u0E19 10 \u0E27\u0E34\u0E19\u0E32\u0E17\u0E35","\u0E40\u0E25\u0E22\u0E4C\u0E40\u0E2D\u0E32\u0E15\u0E4C\u0E1E\u0E31\u0E07"]}};var Sr={widget:{trigger:"Reportar problema",title:"Reportar un problema",close:"Cerrar",back:"Volver",submit:"Enviar",submitting:"Enviando\u2026",submitted:"\xA1Gracias! Tu reporte ha sido enviado.",error:"Algo sali\xF3 mal. Por favor, int\xE9ntalo de nuevo."},step1:{heading:"\xBFQu\xE9 tipo de problema?",categories:{bug:"Error",slow:"Lento",visual:"Problema visual",confusing:"Confuso",other:"Otro"},categoryDescriptions:{bug:"Algo est\xE1 roto o no funciona",slow:"Problema de rendimiento o carga lenta",visual:"Problema de dise\xF1o, estilo o visualizaci\xF3n",confusing:"Dif\xEDcil de entender o navegar",other:"Otro problema"}},step2:{heading:"\xBFQu\xE9 pas\xF3?",intents:{bug:["Crash","Sin respuesta","P\xE9rdida de datos","Resultado incorrecto","Otro"],slow:["Carga de p\xE1gina","Interacci\xF3n","Llamada API","Animaci\xF3n","Otro"],visual:["Layout roto","Superposici\xF3n","Elemento faltante","Color/fuente incorrecta","Otro"],confusing:["Etiqueta confusa","Sin ayuda","Flujo inesperado","Navegaci\xF3n perdida","Otro"],other:["Solicitud de funci\xF3n","Accesibilidad","Error tipogr\xE1fico","Otro"]}},step3:{heading:"Cu\xE9ntanos m\xE1s",descriptionPlaceholder:"Describe lo que pas\xF3\u2026",screenshotButton:"Adjuntar captura",screenshotAttached:"Captura adjunta \u2713",screenshotCapturing:"Tomando captura\u2026",screenshotFailed:"No se pudo capturar \u2014 descr\xEDbelo en su lugar",elementButton:"Seleccionar elemento",elementSelected:"Elemento seleccionado \u2713",elementCapturing:"Haz clic en cualquier elemento\u2026",elementSelectorHint:"Clic en cualquier elemento \xB7 Esc para cancelar",optional:"(opcional)",tooShort:"Un poco m\xE1s de detalle nos ayuda a resolverlo",examplePrompts:["El bot\xF3n guardar no responde","La p\xE1gina se congel\xF3 10 segundos","El dise\xF1o se ve roto aqu\xED"]}};var gs={en:Fe,ja:wr,th:xr,es:Sr};function lt(t){let e=t&&t!=="auto"?t:typeof navigator<"u"?navigator.language??navigator.languages?.[0]:void 0;if(!e)return Fe;let r=e.split("-")[0].toLowerCase();return gs[r]??Fe}function Er(t,e="",r=""){let n=t==="dark",s=k=>/^#[0-9a-fA-F]{3,8}$/.test(k)?k:"",i=s(e),a=s(r),o=n?"#0F0E0C":"#F8F4ED",l=n?"#F2EBDD":"#0E0D0B",f=n?"#928B7E":"#5C5852",p=n?"#5A5650":"#9A9489",v=n?"#7A7268":"#6E6760",d=n?"rgba(242,235,221,0.10)":"rgba(14,13,11,0.10)",m=n?"rgba(242,235,221,0.18)":"rgba(14,13,11,0.16)",c=i||(n?"#FF5A47":"#E03C2C"),g=n?`${c}1F`:`${c}14`,x=a||(n?"#FFE5E0":"#7A1F15"),C="'Iowan Old Style', 'Palatino Linotype', 'Palatino', 'Book Antiqua', 'Cambria', Georgia, 'Times New Roman', serif",R="system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Display', 'Segoe UI', sans-serif",S="ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, 'Liberation Mono', monospace",y="cubic-bezier(0.22, 1, 0.36, 1)";return `
2
2
  :host {
3
3
  all: initial;
4
4
  font-family: ${R};
@@ -36,11 +36,11 @@
36
36
  display: flex;
37
37
  align-items: center;
38
38
  justify-content: center;
39
- font-family: ${T};
39
+ font-family: ${C};
40
40
  font-size: 22px;
41
41
  line-height: 1;
42
42
  box-shadow:
43
- 0 1px 0 ${p},
43
+ 0 1px 0 ${d},
44
44
  0 6px 14px -8px rgba(14,13,11,0.35),
45
45
  inset 0 -3px 0 ${c};
46
46
  transition: transform 200ms ${y}, box-shadow 200ms ${y};
@@ -62,14 +62,14 @@
62
62
  .mushi-trigger:hover {
63
63
  transform: translateY(-2px) rotate(-1.5deg);
64
64
  box-shadow:
65
- 0 1px 0 ${p},
65
+ 0 1px 0 ${d},
66
66
  0 14px 24px -10px rgba(14,13,11,0.45),
67
67
  inset 0 -3px 0 ${c};
68
68
  }
69
69
  .mushi-trigger:active {
70
70
  transform: translateY(0) rotate(0);
71
71
  box-shadow:
72
- 0 1px 0 ${p},
72
+ 0 1px 0 ${d},
73
73
  0 2px 4px -2px rgba(14,13,11,0.35),
74
74
  inset 0 -2px 0 ${c};
75
75
  }
@@ -82,9 +82,9 @@
82
82
  can compose with the hover transform without fighting it. Respects
83
83
  prefers-reduced-motion. */
84
84
  @keyframes mushi-trigger-pulse {
85
- 0% { box-shadow: 0 0 0 0 rgba(212, 67, 50, 0.55), 0 1px 0 ${p}, 0 10px 24px -14px rgba(14,13,11,0.45); }
86
- 70% { box-shadow: 0 0 0 16px rgba(212, 67, 50, 0), 0 1px 0 ${p}, 0 10px 24px -14px rgba(14,13,11,0.45); }
87
- 100% { box-shadow: 0 0 0 0 rgba(212, 67, 50, 0), 0 1px 0 ${p}, 0 10px 24px -14px rgba(14,13,11,0.45); }
85
+ 0% { box-shadow: 0 0 0 0 rgba(212, 67, 50, 0.55), 0 1px 0 ${d}, 0 10px 24px -14px rgba(14,13,11,0.45); }
86
+ 70% { box-shadow: 0 0 0 16px rgba(212, 67, 50, 0), 0 1px 0 ${d}, 0 10px 24px -14px rgba(14,13,11,0.45); }
87
+ 100% { box-shadow: 0 0 0 0 rgba(212, 67, 50, 0), 0 1px 0 ${d}, 0 10px 24px -14px rgba(14,13,11,0.45); }
88
88
  }
89
89
  .mushi-trigger-pulse {
90
90
  animation: mushi-trigger-pulse 800ms ${y} 3;
@@ -116,7 +116,7 @@
116
116
  text-orientation: upright;
117
117
  font-size: 16px;
118
118
  box-shadow:
119
- 0 1px 0 ${p},
119
+ 0 1px 0 ${d},
120
120
  0 10px 24px -14px rgba(14,13,11,0.45),
121
121
  inset -3px 0 0 ${c};
122
122
  }
@@ -129,7 +129,7 @@
129
129
  left: var(--mushi-left, 0);
130
130
  border-radius: 0 4px 4px 0;
131
131
  box-shadow:
132
- 0 1px 0 ${p},
132
+ 0 1px 0 ${d},
133
133
  0 10px 24px -14px rgba(14,13,11,0.45),
134
134
  inset 3px 0 0 ${c};
135
135
  }
@@ -158,7 +158,7 @@
158
158
  z-index: calc(var(--z, 99999) + 2);
159
159
  transition: none !important;
160
160
  box-shadow:
161
- 0 1px 0 ${p},
161
+ 0 1px 0 ${d},
162
162
  0 20px 40px -12px rgba(14,13,11,0.55),
163
163
  inset 0 -3px 0 ${c};
164
164
  opacity: 0.92;
@@ -175,14 +175,14 @@
175
175
 
176
176
  .mushi-panel {
177
177
  position: fixed;
178
- width: 384px;
178
+ width: 360px;
179
179
  max-width: calc(100vw - 32px);
180
- max-height: min(640px, calc(100dvh - 120px - var(--mushi-keyboard-inset, 0px)));
180
+ max-height: min(480px, calc(100dvh - 120px - var(--mushi-keyboard-inset, 0px)));
181
181
  background: ${o};
182
182
  border: 1px solid ${m};
183
183
  border-radius: 6px;
184
184
  box-shadow:
185
- 0 1px 0 ${p},
185
+ 0 1px 0 ${d},
186
186
  0 24px 56px -20px rgba(14,13,11,0.30),
187
187
  0 8px 16px -8px rgba(14,13,11,0.20);
188
188
  overflow: hidden;
@@ -263,12 +263,12 @@
263
263
  }
264
264
 
265
265
  .mushi-header {
266
- padding: 18px 20px 14px;
267
- border-bottom: 1px solid ${p};
266
+ padding: 13px 18px 10px;
267
+ border-bottom: 1px solid ${d};
268
268
  display: grid;
269
269
  grid-template-columns: auto 1fr auto;
270
270
  align-items: end;
271
- gap: 12px;
271
+ gap: 10px;
272
272
  }
273
273
  .mushi-header-mark {
274
274
  display: inline-flex;
@@ -279,7 +279,7 @@
279
279
  border-radius: 3px;
280
280
  background: ${c};
281
281
  color: #FAF7F0;
282
- font-family: ${T};
282
+ font-family: ${C};
283
283
  font-size: 14px;
284
284
  font-weight: 600;
285
285
  line-height: 1;
@@ -301,7 +301,7 @@
301
301
  color: ${f};
302
302
  }
303
303
  .mushi-header h3 {
304
- font-family: ${T};
304
+ font-family: ${C};
305
305
  font-size: 19px;
306
306
  font-weight: 500;
307
307
  line-height: 1.15;
@@ -343,17 +343,22 @@
343
343
  background: none;
344
344
  border: none;
345
345
  cursor: pointer;
346
- padding: 0;
346
+ padding: 3px 0;
347
347
  margin: 0 0 2px;
348
+ min-height: 22px;
348
349
  color: ${f};
349
350
  font-family: ${S};
350
- font-size: 10px;
351
+ font-size: 11px;
351
352
  font-weight: 500;
352
- letter-spacing: 0.12em;
353
+ letter-spacing: 0.06em;
353
354
  text-transform: uppercase;
354
355
  line-height: 1.2;
355
356
  border-radius: 0;
357
+ display: inline-flex;
358
+ align-items: center;
359
+ gap: 4px;
356
360
  transition: color 150ms ${y};
361
+ white-space: nowrap;
357
362
  }
358
363
  .mushi-close:hover { color: ${c}; }
359
364
  .mushi-back:hover { color: ${l}; }
@@ -377,20 +382,20 @@
377
382
  overflow-y: auto;
378
383
  flex: 1;
379
384
  scrollbar-width: thin;
380
- scrollbar-color: ${d} transparent;
385
+ scrollbar-color: ${p} transparent;
381
386
  }
382
387
  .mushi-body::-webkit-scrollbar { width: 6px; }
383
- .mushi-body::-webkit-scrollbar-thumb { background: ${d}; border-radius: 3px; }
388
+ .mushi-body::-webkit-scrollbar-thumb { background: ${p}; border-radius: 3px; }
384
389
 
385
390
  .mushi-option-btn {
386
391
  display: grid;
387
392
  grid-template-columns: auto 1fr auto;
388
393
  align-items: center;
389
- gap: 14px;
394
+ gap: 12px;
390
395
  width: 100%;
391
- padding: 14px 0;
396
+ padding: 11px 0;
392
397
  border: none;
393
- border-bottom: 1px solid ${p};
398
+ border-bottom: 1px solid ${d};
394
399
  background: transparent;
395
400
  cursor: pointer;
396
401
  color: inherit;
@@ -414,7 +419,7 @@
414
419
  }
415
420
  .mushi-option-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
416
421
  .mushi-option-label {
417
- font-family: ${T};
422
+ font-family: ${C};
418
423
  font-size: 16px;
419
424
  font-weight: 500;
420
425
  letter-spacing: -0.005em;
@@ -428,7 +433,7 @@
428
433
  .mushi-option-arrow {
429
434
  font-family: ${S};
430
435
  font-size: 14px;
431
- color: ${d};
436
+ color: ${p};
432
437
  opacity: 0;
433
438
  transform: translateX(-4px);
434
439
  transition: opacity 220ms ${y}, transform 220ms ${y}, color 220ms ${y};
@@ -441,7 +446,7 @@
441
446
  .mushi-feature-entry,
442
447
  .mushi-reports-entry {
443
448
  padding-left: 10px;
444
- border-left: 2px solid ${d};
449
+ border-left: 2px solid ${p};
445
450
  transition: padding 220ms ${y}, color 220ms ${y}, border-color 220ms ${y};
446
451
  }
447
452
  .mushi-feature-entry:hover,
@@ -460,7 +465,7 @@
460
465
  align-items: center;
461
466
  padding: 12px 4px 12px 0;
462
467
  border: 0;
463
- border-bottom: 1px solid ${p};
468
+ border-bottom: 1px solid ${d};
464
469
  background: transparent;
465
470
  color: ${l};
466
471
  cursor: pointer;
@@ -532,7 +537,7 @@
532
537
  .mushi-report-when {
533
538
  font-family: ${S};
534
539
  font-size: 10px;
535
- color: ${d};
540
+ color: ${p};
536
541
  }
537
542
  .mushi-unread-badge {
538
543
  display: inline-flex;
@@ -551,7 +556,7 @@
551
556
  .mushi-report-chevron {
552
557
  font-size: 18px;
553
558
  line-height: 1;
554
- color: ${d};
559
+ color: ${p};
555
560
  transition: color 180ms ${y}, transform 180ms ${y};
556
561
  }
557
562
  .mushi-report-row:hover .mushi-report-chevron,
@@ -560,7 +565,7 @@
560
565
  transform: translateX(2px);
561
566
  }
562
567
  .mushi-thread-summary {
563
- border-bottom: 1px solid ${p};
568
+ border-bottom: 1px solid ${d};
564
569
  padding-bottom: 10px;
565
570
  margin-bottom: 10px;
566
571
  }
@@ -580,7 +585,7 @@
580
585
  }
581
586
  .mushi-thread-comment {
582
587
  padding: 8px 10px;
583
- border: 1px solid ${p};
588
+ border: 1px solid ${d};
584
589
  background: ${n?"rgba(242,235,221,0.04)":"rgba(14,13,11,0.03)"};
585
590
  }
586
591
  .mushi-thread-comment.reporter {
@@ -632,12 +637,12 @@
632
637
  gap: 12px;
633
638
  padding: 12px 0;
634
639
  border: none;
635
- border-bottom: 1px solid ${p};
640
+ border-bottom: 1px solid ${d};
636
641
  background: transparent;
637
642
  cursor: pointer;
638
643
  color: inherit;
639
644
  text-align: left;
640
- font-family: ${T};
645
+ font-family: ${C};
641
646
  font-size: 15px;
642
647
  transition: padding 220ms ${y}, color 220ms ${y};
643
648
  }
@@ -645,7 +650,7 @@
645
650
  content: '\u2192';
646
651
  font-family: ${S};
647
652
  font-size: 13px;
648
- color: ${d};
653
+ color: ${p};
649
654
  opacity: 0;
650
655
  transform: translateX(-4px);
651
656
  transition: opacity 220ms ${y}, transform 220ms ${y};
@@ -668,7 +673,7 @@
668
673
  }
669
674
  .mushi-example-chip {
670
675
  padding: 4px 10px;
671
- border: 1px solid ${p};
676
+ border: 1px solid ${d};
672
677
  border-radius: 12px;
673
678
  background: transparent;
674
679
  color: ${f};
@@ -699,7 +704,7 @@
699
704
  font-family: ${S};
700
705
  font-size: 10px;
701
706
  letter-spacing: 0.04em;
702
- color: ${d};
707
+ color: ${p};
703
708
  pointer-events: none;
704
709
  transition: color 200ms ${y};
705
710
  }
@@ -720,7 +725,7 @@
720
725
  transition: border-color 200ms ${y};
721
726
  }
722
727
  .mushi-textarea::placeholder {
723
- color: ${d};
728
+ color: ${p};
724
729
  font-style: italic;
725
730
  }
726
731
  .mushi-textarea:focus { border-bottom-color: ${c}; }
@@ -810,7 +815,7 @@
810
815
 
811
816
  .mushi-footer {
812
817
  padding: 14px 22px 16px;
813
- border-top: 1px solid ${p};
818
+ border-top: 1px solid ${d};
814
819
  display: flex;
815
820
  align-items: center;
816
821
  justify-content: space-between;
@@ -821,7 +826,7 @@
821
826
  font-size: 10px;
822
827
  letter-spacing: 0.10em;
823
828
  text-transform: uppercase;
824
- color: ${d};
829
+ color: ${p};
825
830
  }
826
831
  .mushi-submit {
827
832
  position: relative;
@@ -874,8 +879,8 @@
874
879
 
875
880
  .mushi-brand-footer {
876
881
  padding: 9px 14px 11px;
877
- border-top: 1px solid ${p};
878
- color: ${d};
882
+ border-top: 1px solid ${d};
883
+ color: ${p};
879
884
  font-family: ${S};
880
885
  font-size: 9px;
881
886
  letter-spacing: 0.16em;
@@ -889,7 +894,7 @@
889
894
  justify-content: center;
890
895
  gap: 8px;
891
896
  padding: 10px 22px 14px;
892
- color: ${d};
897
+ color: ${p};
893
898
  font-family: ${S};
894
899
  font-size: 11px;
895
900
  letter-spacing: 0.10em;
@@ -900,15 +905,15 @@
900
905
  gap: 4px;
901
906
  transition: color 200ms ${y};
902
907
  }
903
- .mushi-step-num.done { color: ${f}; text-decoration: line-through; text-decoration-color: ${d}; }
908
+ .mushi-step-num.done { color: ${f}; text-decoration: line-through; text-decoration-color: ${p}; }
904
909
  .mushi-step-num.active {
905
910
  color: ${c};
906
- font-family: ${T};
911
+ font-family: ${C};
907
912
  font-size: 14px;
908
913
  font-weight: 600;
909
914
  letter-spacing: 0;
910
915
  }
911
- .mushi-step-sep { width: 14px; height: 1px; background: ${p}; }
916
+ .mushi-step-sep { width: 14px; height: 1px; background: ${d}; }
912
917
 
913
918
  .mushi-success {
914
919
  text-align: center;
@@ -940,7 +945,7 @@
940
945
  animation: mushi-stamp-ring 700ms ${y} 80ms forwards;
941
946
  }
942
947
  .mushi-success-stamp-label {
943
- font-family: ${T};
948
+ font-family: ${C};
944
949
  font-size: 18px;
945
950
  font-weight: 600;
946
951
  color: ${c};
@@ -950,7 +955,7 @@
950
955
  animation: mushi-stamp-press 360ms ${y} 600ms forwards;
951
956
  }
952
957
  .mushi-success-headline {
953
- font-family: ${T};
958
+ font-family: ${C};
954
959
  font-size: 18px;
955
960
  font-weight: 500;
956
961
  color: ${l};
@@ -1000,7 +1005,7 @@
1000
1005
  padding: 3px 8px;
1001
1006
  border-radius: 4px;
1002
1007
  background: transparent;
1003
- border: 1px dashed ${p};
1008
+ border: 1px dashed ${d};
1004
1009
  color: inherit;
1005
1010
  font-family: ${S};
1006
1011
  font-size: 12px;
@@ -1044,7 +1049,7 @@
1044
1049
  width: 11px;
1045
1050
  height: 11px;
1046
1051
  border-radius: 50%;
1047
- border: 1.5px solid ${p};
1052
+ border: 1.5px solid ${d};
1048
1053
  border-top-color: ${c};
1049
1054
  animation: mushi-receipt-spin 0.8s linear infinite;
1050
1055
  }
@@ -1074,7 +1079,7 @@
1074
1079
  .mushi-success-my-reports:hover { opacity: 0.75; }
1075
1080
  .mushi-success-sla {
1076
1081
  margin-top: 2px;
1077
- font-family: ${T};
1082
+ font-family: ${C};
1078
1083
  font-size: 12px;
1079
1084
  line-height: 1.45;
1080
1085
  text-align: center;
@@ -1106,7 +1111,7 @@
1106
1111
 
1107
1112
  /* \u2500\u2500 Rewards nudge (category step) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
1108
1113
  .mushi-rewards-nudge {
1109
- border-top: 1px solid ${p};
1114
+ border-top: 1px solid ${d};
1110
1115
  padding: 10px 0 4px;
1111
1116
  margin-top: 6px;
1112
1117
  }
@@ -1167,7 +1172,7 @@
1167
1172
  .mushi-success-rewards {
1168
1173
  margin-top: 14px;
1169
1174
  padding-top: 12px;
1170
- border-top: 1px solid ${p};
1175
+ border-top: 1px solid ${d};
1171
1176
  width: 100%;
1172
1177
  }
1173
1178
  .mushi-success-pts-award {
@@ -1236,7 +1241,7 @@
1236
1241
 
1237
1242
  .mushi-beta-contact-hint {
1238
1243
  font-size: 10px;
1239
- color: ${d};
1244
+ color: ${p};
1240
1245
  font-family: ${S};
1241
1246
  letter-spacing: 0.06em;
1242
1247
  }
@@ -1612,6 +1617,56 @@
1612
1617
 
1613
1618
  .mushi-community-footer{display:flex;align-items:center;gap:8px;padding:10px 0 2px;border-top:1px solid ${n?"rgba(255,255,255,0.07)":"rgba(0,0,0,0.07)"};margin-top:8px;flex-wrap:wrap}
1614
1619
  .mushi-community-btn{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1620
+ /* \u2500\u2500 "More issue types \u2192" toggle (progressive disclosure) \u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
1621
+ .mushi-more-toggle {
1622
+ display: flex;
1623
+ align-items: center;
1624
+ gap: 8px;
1625
+ width: 100%;
1626
+ padding: 11px 0;
1627
+ border: none;
1628
+ border-top: 1px dashed ${d};
1629
+ background: transparent;
1630
+ cursor: pointer;
1631
+ color: ${f};
1632
+ font-family: ${R};
1633
+ font-size: 13px;
1634
+ text-align: left;
1635
+ transition: color 180ms ${y};
1636
+ }
1637
+ .mushi-more-toggle:hover { color: ${c}; }
1638
+ .mushi-more-toggle:hover .mushi-more-toggle-arrow { transform: translateX(3px); }
1639
+ .mushi-more-toggle-text { flex: 1; }
1640
+ .mushi-more-toggle-count {
1641
+ font-family: ${S};
1642
+ font-size: 10px;
1643
+ letter-spacing: 0.08em;
1644
+ text-transform: uppercase;
1645
+ color: ${p};
1646
+ background: ${n?"rgba(255,255,255,0.07)":"rgba(0,0,0,0.06)"};
1647
+ padding: 2px 6px;
1648
+ border-radius: 10px;
1649
+ }
1650
+ .mushi-more-toggle-arrow {
1651
+ font-size: 14px;
1652
+ opacity: 0.5;
1653
+ transition: transform 180ms ${y};
1654
+ }
1655
+ /* \u2500\u2500 Step slide-in \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
1656
+ @keyframes mushi-step-in {
1657
+ 0% { opacity: 0; transform: translateX(8px); }
1658
+ 100% { opacity: 1; transform: translateX(0); }
1659
+ }
1660
+ .mushi-body {
1661
+ animation: mushi-step-in 160ms ease both;
1662
+ }
1663
+ @media (prefers-reduced-motion: reduce) {
1664
+ .mushi-body { animation: none; }
1665
+ }
1666
+ /* Expanded secondary categories animate in */
1667
+ .mushi-categories-expanded {
1668
+ animation: mushi-step-in 180ms ease both;
1669
+ }
1615
1670
  .mushi-link-btn{background:none;border:none;padding:4px 2px;cursor:pointer;color:${c};font-size:12px;font-family:${S};text-decoration:underline;text-underline-offset:2px}
1616
1671
  .mushi-link-btn:hover{opacity:0.8}
1617
1672
  .mushi-link-btn:focus-visible,.mushi-nav-item:focus-visible{outline:2px solid ${c};outline-offset:2px;border-radius:2px}
@@ -1640,16 +1695,16 @@
1640
1695
  .mushi-assistant-msg-bot{align-self:flex-start;background:${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)"};color:${l};border-bottom-left-radius:4px}
1641
1696
  .mushi-assistant-thinking{opacity:0.6;font-size:18px;letter-spacing:2px}
1642
1697
  .mushi-assistant-error{align-self:flex-start;color:${n?"#F87171":"#DC2626"};font-size:12px;padding:4px 2px}
1643
- .mushi-assistant-form{display:flex;align-items:flex-end;gap:8px;border-top:1px solid ${p};padding-top:8px}
1698
+ .mushi-assistant-form{display:flex;align-items:flex-end;gap:8px;border-top:1px solid ${d};padding-top:8px}
1644
1699
  .mushi-assistant-input{flex:1;resize:none;max-height:120px;border:1px solid ${m};border-radius:10px;padding:8px 12px;font:400 14px/1.4 ${R};background:${o};color:${l}}
1645
1700
  .mushi-assistant-input:focus-visible{outline:2px solid ${c};outline-offset:1px}
1646
1701
  .mushi-assistant-submit{flex-shrink:0;width:36px;height:36px;border:none;border-radius:50%;background:${c};color:#fff;font-size:18px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:transform .15s,opacity .15s}
1647
1702
  .mushi-assistant-submit:hover{transform:translateY(-1px)}
1648
1703
  .mushi-assistant-submit:disabled{opacity:0.5;cursor:default;transform:none}
1649
1704
  .mushi-assistant-submit:focus-visible{outline:2px solid ${c};outline-offset:2px}
1650
- `}var he="@mushi-mushi/web",Z="1.17.0";var He={bug:"\u26A0\uFE0F",slow:"\u{1F40C}",visual:"\u{1F3A8}",confusing:"\u{1F615}",other:"\u{1F4DD}"},ot="Feature request";function it(t){switch(t){case "new":case "queued":case "pending":case "submitted":return "Sent";case "classified":case "triaged":case "grouped":case "dispatched":return "Review";case "fixing":return "Fixing";case "fixed":case "resolved":case "completed":return "Fixed";case "dismissed":return "Closed";default:return t.replace(/_/g," ").slice(0,12)}}function Sr(t){switch(t){case "new":case "queued":case "pending":case "submitted":return "Submitted";case "classified":case "triaged":case "grouped":case "dispatched":return "In review";case "fixing":return "Fix in progress";case "fixed":case "resolved":case "completed":return "Fixed \u2014 confirm?";case "verified":return "Verified";case "reopened":return "Reopened";case "dismissed":return "Closed";default:return t.replace(/_/g," ")}}function Be(t){switch(t){case "new":case "queued":case "pending":case "submitted":return "sent";case "classified":case "triaged":case "grouped":case "dispatched":return "review";case "fixing":return "fixing";case "fixed":case "resolved":case "completed":return "fixed";case "verified":return "fixed";case "reopened":return "fixing";case "dismissed":return "closed";default:return "unknown"}}function Ne(t){let e=Date.parse(t);if(Number.isNaN(e))return "";let r=Date.now()-e;if(r<0)return "just now";let n=Math.floor(r/1e3);if(n<60)return "just now";let s=Math.floor(n/60);if(s<60)return `${s}m ago`;let i=Math.floor(s/60);if(i<24)return `${i}h ago`;let a=Math.floor(i/24);if(a<7)return `${a}d ago`;let o=Math.floor(a/7);return o<5?`${o}w ago`:new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Fe(t){return t<10?`0${t}`:String(t)}var Te=3,me={category:1,intent:2,details:3};function Er(t){return (t.metaKey||t.ctrlKey)&&t.key==="Enter"}function E(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Rr(t){switch(t.step){case "category":return ms(t);case "intent":return ks(t);case "details":return Rs(t);case "success":return Cs(t);case "reports":return ys(t);case "report-detail":return Es(t);case "leaderboard":return ws(t);case "roadmap":return vs(t);case "account":return xs(t);case "cross-app-reports":return Ss(t);case "assistant":return hs(t)}}function hs(t){let e=t.callbacks.assistantLabel||"Ask",r=t.callbacks.assistantGreeting||"Ask me anything about this app.",n=t.callbacks.assistantSuggestions??[],i=t.assistantTurns.length===0?`<div class="mushi-assistant-greeting">${E(r)}</div>
1651
- ${n.length?`<div class="mushi-assistant-suggestions">${n.map(l=>`<button type="button" class="mushi-assistant-chip" data-action="assistant-suggest" data-value="${E(l)}">${E(l)}</button>`).join("")}</div>`:""}`:t.assistantTurns.map(l=>{let f=l.role==="user"?"mushi-assistant-msg-user":"mushi-assistant-msg-bot",d=l.options&&l.options.length?`<div class="mushi-assistant-suggestions">${l.options.map(v=>`<button type="button" class="mushi-assistant-chip" data-action="assistant-suggest" data-value="${E(v)}">${E(v)}</button>`).join("")}</div>`:"";return `<div class="mushi-assistant-msg ${f}">${E(l.text)}</div>${d}`}).join(""),a=t.assistantSending?'<div class="mushi-assistant-msg mushi-assistant-msg-bot mushi-assistant-thinking">\u2026</div>':"",o=t.assistantError?`<div class="mushi-assistant-error" role="alert">${E(t.assistantError)}</div>`:"";return `
1652
- ${Q(t,{title:e,showBack:true})}
1705
+ `}var ge="@mushi-mushi/web",ee="1.18.0";var Ue={bug:"\u26A0\uFE0F",slow:"\u{1F40C}",visual:"\u{1F3A8}",confusing:"\u{1F615}",other:"\u{1F4DD}"},ct="Feature request";function ut(t){switch(t){case "new":case "queued":case "pending":case "submitted":return "Sent";case "classified":case "triaged":case "grouped":case "dispatched":return "Review";case "fixing":return "Fixing";case "fixed":case "resolved":case "completed":return "Fixed";case "dismissed":return "Closed";default:return t.replace(/_/g," ").slice(0,12)}}function kr(t){switch(t){case "new":case "queued":case "pending":case "submitted":return "Submitted";case "classified":case "triaged":case "grouped":case "dispatched":return "In review";case "fixing":return "Fix in progress";case "fixed":case "resolved":case "completed":return "Fixed \u2014 confirm?";case "verified":return "Verified";case "reopened":return "Reopened";case "dismissed":return "Closed";default:return t.replace(/_/g," ")}}function qe(t){switch(t){case "new":case "queued":case "pending":case "submitted":return "sent";case "classified":case "triaged":case "grouped":case "dispatched":return "review";case "fixing":return "fixing";case "fixed":case "resolved":case "completed":return "fixed";case "verified":return "fixed";case "reopened":return "fixing";case "dismissed":return "closed";default:return "unknown"}}function je(t){let e=Date.parse(t);if(Number.isNaN(e))return "";let r=Date.now()-e;if(r<0)return "just now";let n=Math.floor(r/1e3);if(n<60)return "just now";let s=Math.floor(n/60);if(s<60)return `${s}m ago`;let i=Math.floor(s/60);if(i<24)return `${i}h ago`;let a=Math.floor(i/24);if(a<7)return `${a}d ago`;let o=Math.floor(a/7);return o<5?`${o}w ago`:new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ze(t){return t<10?`0${t}`:String(t)}var _e=3,ye={category:1,intent:2,details:3};function Rr(t){return (t.metaKey||t.ctrlKey)&&t.key==="Enter"}function E(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Tr(t){switch(t.step){case "category":return bs(t);case "intent":return Ts(t);case "details":return Ms(t);case "success":return $s(t);case "reports":return xs(t);case "report-detail":return Cs(t);case "leaderboard":return Es(t);case "roadmap":return Ss(t);case "account":return ks(t);case "cross-app-reports":return Rs(t);case "assistant":return fs(t)}}function fs(t){let e=t.callbacks.assistantLabel||"Ask",r=t.callbacks.assistantGreeting||"Ask me anything about this app.",n=t.callbacks.assistantSuggestions??[],i=t.assistantTurns.length===0?`<div class="mushi-assistant-greeting">${E(r)}</div>
1706
+ ${n.length?`<div class="mushi-assistant-suggestions">${n.map(l=>`<button type="button" class="mushi-assistant-chip" data-action="assistant-suggest" data-value="${E(l)}">${E(l)}</button>`).join("")}</div>`:""}`:t.assistantTurns.map(l=>{let f=l.role==="user"?"mushi-assistant-msg-user":"mushi-assistant-msg-bot",p=l.options&&l.options.length?`<div class="mushi-assistant-suggestions">${l.options.map(v=>`<button type="button" class="mushi-assistant-chip" data-action="assistant-suggest" data-value="${E(v)}">${E(v)}</button>`).join("")}</div>`:"";return `<div class="mushi-assistant-msg ${f}">${E(l.text)}</div>${p}`}).join(""),a=t.assistantSending?'<div class="mushi-assistant-msg mushi-assistant-msg-bot mushi-assistant-thinking">\u2026</div>':"",o=t.assistantError?`<div class="mushi-assistant-error" role="alert">${E(t.assistantError)}</div>`:"";return `
1707
+ ${te(t,{title:e,showBack:true})}
1653
1708
  <div class="mushi-assistant">
1654
1709
  <div class="mushi-assistant-log">
1655
1710
  ${i}
@@ -1666,13 +1721,13 @@
1666
1721
  <button type="submit" class="mushi-assistant-submit" ${t.assistantSending?"disabled":""} aria-label="Send">\u2191</button>
1667
1722
  </form>
1668
1723
  </div>
1669
- `}function Cr(t){if(!t.sdkFreshness||t.config.outdatedBanner==="off"||t.config.outdatedBanner==="console-only")return "";let{latest:e,current:r,deprecated:n,message:s}=t.sdkFreshness;return !e&&!n?"":`
1724
+ `}function Mr(t){if(!t.sdkFreshness||t.config.outdatedBanner==="off"||t.config.outdatedBanner==="console-only")return "";let{latest:e,current:r,deprecated:n,message:s}=t.sdkFreshness;return !e&&!n?"":`
1670
1725
  <div class="mushi-outdated" role="status">
1671
1726
  <strong>Mushi SDK ${E(r)}</strong>
1672
1727
  ${e?`latest is ${E(e)}.`:"needs attention."}
1673
1728
  ${s?`<span>${E(s)}</span>`:""}
1674
1729
  </div>
1675
- `}function Tr(t){return t.config.brandFooter===false?"":`<div class="mushi-brand-footer">Powered by Mushi v${E(t.sdkVersion)}</div>`}function Q(t,e){let r=t.locale,{title:n,showBack:s=false,step:i,eyebrow:a}=e,o=s?`<button type="button" class="mushi-back" data-action="back" aria-label="${r.widget.back}">\u2190</button>`:`<span class="mushi-header-eyebrow">${a??"Mushi \xB7 Report"}</span>`,l=i?`<span class="mushi-step-counter" aria-label="Step ${i} of ${Te}"><b>${Fe(i)}</b> / ${Fe(Te)}</span>`:"";return `
1730
+ `}function $r(t){return t.config.brandFooter===false?"":`<div class="mushi-brand-footer">Powered by Mushi v${E(t.sdkVersion)}</div>`}function te(t,e){let r=t.locale,{title:n,showBack:s=false,step:i,eyebrow:a}=e,o=s?`<button type="button" class="mushi-back" data-action="back" aria-label="${r.widget.back}">\u2190 ${E(r.widget.back)}</button>`:`<span class="mushi-header-eyebrow">${a??"Mushi \xB7 Report"}</span>`,l=i?`<span class="mushi-step-counter" aria-label="Step ${i} of ${_e}"><b>${ze(i)}</b> / ${ze(_e)}</span>`:"";return `
1676
1731
  <div class="mushi-header">
1677
1732
  <div class="mushi-header-mark" aria-hidden="true">\u866B</div>
1678
1733
  <div class="mushi-header-titles">
@@ -1684,18 +1739,22 @@
1684
1739
  <button type="button" class="mushi-close" data-action="close" aria-label="${r.widget.close}">\u2715</button>
1685
1740
  </div>
1686
1741
  </div>
1687
- `}function at(t,e){let r=[];for(let n=1;n<=Te;n++){let s=n<e?"mushi-step-num done":n===e?"mushi-step-num active":"mushi-step-num";r.push(`<span class="${s}">${Fe(n)}</span>`),n<Te&&r.push('<span class="mushi-step-sep" aria-hidden="true"></span>');}return `<div class="mushi-step-indicator" aria-hidden="true">${r.join("")}</div>`}function ms(t){let e=t.locale,n=(t.config.categories&&t.config.categories.length>0?t.config.categories.map(s=>({id:s.id,icon:s.icon??"\u{1F4AC}",label:s.label,desc:s.description??""})):["bug","slow","visual","confusing","other"].map(s=>({id:s,icon:He[s],label:e.step1.categories[s],desc:e.step1.categoryDescriptions[s]}))).map(({id:s,icon:i,label:a,desc:o})=>`
1688
- <button type="button" class="mushi-option-btn" data-category="${E(s)}" role="radio" aria-checked="false">
1689
- <span class="mushi-option-icon" aria-hidden="true">${E(i)}</span>
1690
- <div class="mushi-option-text">
1691
- <span class="mushi-option-label">${E(a)}</span>
1692
- ${o?`<span class="mushi-option-desc">${E(o)}</span>`:""}
1693
- </div>
1694
- <span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
1695
- </button>
1696
- `).join("");return `
1697
- ${Q(t,{title:e.step1.heading,step:me.category})}
1698
- ${t.config.betaMode?.enabled?bs(t):""}
1742
+ `}function dt(t,e){let r=[];for(let n=1;n<=_e;n++){let s=n<e?"mushi-step-num done":n===e?"mushi-step-num active":"mushi-step-num";r.push(`<span class="${s}">${ze(n)}</span>`),n<_e&&r.push('<span class="mushi-step-sep" aria-hidden="true"></span>');}return `<div class="mushi-step-indicator" aria-hidden="true">${r.join("")}</div>`}function bs(t){let e=t.locale,r=t.config.categories&&t.config.categories.length>0?t.config.categories.map(d=>({id:d.id,icon:d.icon??"\u{1F4AC}",label:d.label,desc:d.description??""})):["bug","slow","visual","confusing","other"].map(d=>({id:d,icon:Ue[d],label:e.step1.categories[d],desc:e.step1.categoryDescriptions[d]})),n=({id:d,icon:m,label:c,desc:g})=>`
1743
+ <button type="button" class="mushi-option-btn" data-category="${E(d)}" role="radio" aria-checked="false">
1744
+ <span class="mushi-option-icon" aria-hidden="true">${E(m)}</span>
1745
+ <div class="mushi-option-text">
1746
+ <span class="mushi-option-label">${E(c)}</span>
1747
+ ${g?`<span class="mushi-option-desc">${E(g)}</span>`:""}
1748
+ </div>
1749
+ <span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
1750
+ </button>
1751
+ `,s=t.config.categories&&t.config.categories.length>0,i=1,a=s?r:r.slice(0,i),o=s?[]:r.slice(i),l=o.length>0,f=a.map(n).join(""),p=o.map(n).join(""),v=l?t.showAllCategories?`<div class="mushi-categories-expanded">${p}</div>`:`<button type="button" class="mushi-more-toggle" data-action="show-all-categories">
1752
+ <span class="mushi-more-toggle-text">More issue types</span>
1753
+ <span class="mushi-more-toggle-count">${o.length} more</span>
1754
+ <span class="mushi-more-toggle-arrow" aria-hidden="true">\u2192</span>
1755
+ </button>`:"";return `
1756
+ ${te(t,{title:e.step1.heading,step:ye.category})}
1757
+ ${t.config.betaMode?.enabled?ws(t):""}
1699
1758
  <div class="mushi-body" role="radiogroup" aria-label="${e.step1.heading}">
1700
1759
  <button type="button" class="mushi-option-btn mushi-reports-entry" data-action="reports">
1701
1760
  <span class="mushi-option-icon" aria-hidden="true">\u{1F4EC}</span>
@@ -1705,7 +1764,7 @@
1705
1764
  </div>
1706
1765
  <span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
1707
1766
  </button>
1708
- ${gs(t)}
1767
+ ${ys(t)}
1709
1768
  ${t.callbacks.onFeatureBoardRequest?`
1710
1769
  <button type="button" class="mushi-option-btn" data-action="roadmap">
1711
1770
  <span class="mushi-option-icon" aria-hidden="true">\u{1F5F3}\uFE0F</span>
@@ -1715,8 +1774,9 @@
1715
1774
  </div>
1716
1775
  <span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
1717
1776
  </button>`:""}
1718
- ${n}
1719
- ${t.rewardsState?Ls(t):""}
1777
+ ${f}
1778
+ ${v}
1779
+ ${t.rewardsState?As(t):""}
1720
1780
  <div class="mushi-community-footer">
1721
1781
  <button type="button" class="mushi-link-btn mushi-community-btn" data-action="open-account">
1722
1782
  ${t.testerInfo?`\u{1F464} ${E(t.testerInfo.public_handle??t.testerInfo.display_name??"My account")}`:"\u{1F310} Join community \xB7 Track reports across apps"}
@@ -1724,8 +1784,8 @@
1724
1784
  ${t.rewardsState?'<button type="button" class="mushi-link-btn" data-action="open-leaderboard">\u{1F3C6} Leaderboard</button>':""}
1725
1785
  </div>
1726
1786
  </div>
1727
- ${at(t,me.category)}
1728
- `}function gs(t){if(!(t.config.featureRequestCard!==false))return "";let r=t.config.featureRequestLabel||"Feature request",n=t.config.featureRequestDescription||"Suggest something new \u2014 even rough ideas help us prioritise";return `
1787
+ ${dt(t,ye.category)}
1788
+ `}function ys(t){if(!(t.config.featureRequestCard!==false))return "";let r=t.config.featureRequestLabel||"Feature request",n=t.config.featureRequestDescription||"Suggest something new \u2014 even rough ideas help us prioritise";return `
1729
1789
  <button
1730
1790
  type="button"
1731
1791
  class="mushi-option-btn mushi-feature-entry"
@@ -1739,12 +1799,12 @@
1739
1799
  </div>
1740
1800
  <span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
1741
1801
  </button>
1742
- `}function fs(t){let e=t.config.betaMode?.changelogItems;if(!e?.length)return "";let r=e[0],n=r.items.map(i=>`<li>\u2022 ${E(i)}</li>`).join("");return `
1802
+ `}function vs(t){let e=t.config.betaMode?.changelogItems;if(!e?.length)return "";let r=e[0],n=r.items.map(i=>`<li>\u2022 ${E(i)}</li>`).join("");return `
1743
1803
  <details class="mushi-changelog">
1744
1804
  <summary class="mushi-changelog-summary">${r.date?`What\u2019s new in ${E(r.version)} \xB7 ${E(r.date)}`:`What\u2019s new in ${E(r.version)}`}</summary>
1745
1805
  <ul class="mushi-changelog-list">${n}</ul>
1746
1806
  </details>
1747
- `}function bs(t){let e=t.config.betaMode,r=E(e.appName??"This app"),n=e.message?E(e.message):`${r} is in early development \u2014 updates ship weekly`,s=e.contactEmail?E(e.contactEmail):null,i=e.perks??[];return `
1807
+ `}function ws(t){let e=t.config.betaMode,r=E(e.appName??"This app"),n=e.message?E(e.message):`${r} is in early development \u2014 updates ship weekly`,s=e.contactEmail?E(e.contactEmail):null,i=e.perks??[];return `
1748
1808
  <div class="mushi-beta-strip" role="note" aria-label="Beta status">
1749
1809
  <div class="mushi-beta-strip-row">
1750
1810
  <span class="mushi-beta-tag" aria-hidden="true">BETA</span>
@@ -1756,28 +1816,28 @@
1756
1816
  ${i.map(a=>`<li>\u2713 ${E(a)}</li>`).join("")}
1757
1817
  </ul>
1758
1818
  `:""}
1759
- ${fs(t)}
1819
+ ${vs(t)}
1760
1820
  </div>
1761
- `}function ys(t){let e=t.reporterReports.map(n=>{let s=n.summary??n.description??`Report ${n.id.slice(0,8)}`,i=Be(n.status),a=Ne(n.created_at),o=n.unread_count&&n.unread_count>0?`<span class="mushi-unread-badge" aria-label="${n.unread_count} unread">${n.unread_count}</span>`:"";return `
1821
+ `}function xs(t){let e=t.reporterReports.map(n=>{let s=n.summary??n.description??`Report ${n.id.slice(0,8)}`,i=qe(n.status),a=je(n.created_at),o=n.unread_count&&n.unread_count>0?`<span class="mushi-unread-badge" aria-label="${n.unread_count} unread">${n.unread_count}</span>`:"";return `
1762
1822
  <button type="button" class="mushi-report-row" data-report-id="${E(n.id)}" aria-label="View report: ${E(s)}">
1763
1823
  <div class="mushi-report-main">
1764
1824
  <span class="mushi-report-title">${E(s)}</span>
1765
1825
  <span class="mushi-report-meta">
1766
- <span class="mushi-report-status mushi-status-${i}">${E(it(n.status))}</span>
1826
+ <span class="mushi-report-status mushi-status-${i}">${E(ut(n.status))}</span>
1767
1827
  ${a?`<span class="mushi-report-when">${E(a)}</span>`:""}
1768
1828
  ${o}
1769
1829
  </span>
1770
1830
  </div>
1771
1831
  <span class="mushi-report-chevron" aria-hidden="true">\u203A</span>
1772
1832
  </button>`}).join(""),r=t.rewardsState?'<button type="button" class="mushi-leaderboard-link" data-action="open-leaderboard">\u{1F3C6} Leaderboard</button>':"";return `
1773
- ${Q(t,{title:"Your reports",showBack:true,eyebrow:"Mushi \xB7 Inbox"})}
1833
+ ${te(t,{title:"Your reports",showBack:true,eyebrow:"Mushi \xB7 Inbox"})}
1774
1834
  <div class="mushi-body">
1775
1835
  ${t.reporterLoading?'<p class="mushi-muted">Loading reports\u2026</p>':""}
1776
1836
  ${t.reporterError?`<p class="mushi-error-inline">${E(t.reporterError)}</p>`:""}
1777
1837
  ${e||(t.reporterLoading?"":'<p class="mushi-muted">No reports from this browser yet.</p>')}
1778
1838
  ${r}
1779
1839
  </div>
1780
- `}function vs(t){let e=t.featureBoard.map(r=>{let n=String(r.id??""),s=E(String(r.subject??"Untitled idea")),i=Number(r.vote_count??0),a=!!r.shipped_at,o=!!r.my_vote,l=a?"Shipped":String(r.status_label??r.status??"open");return `
1840
+ `}function Ss(t){let e=t.featureBoard.map(r=>{let n=String(r.id??""),s=E(String(r.subject??"Untitled idea")),i=Number(r.vote_count??0),a=!!r.shipped_at,o=!!r.my_vote,l=a?"Shipped":String(r.status_label??r.status??"open");return `
1781
1841
  <div class="mushi-report-row mushi-roadmap-row">
1782
1842
  <div class="mushi-report-main">
1783
1843
  <span class="mushi-report-title">${s}</span>
@@ -1791,20 +1851,20 @@
1791
1851
  ${o?"Voted":"Vote"}
1792
1852
  </button>`:""}
1793
1853
  </div>`}).join("");return `
1794
- ${Q(t,{title:"Community ideas",showBack:true,eyebrow:"Mushi \xB7 Roadmap"})}
1854
+ ${te(t,{title:"Community ideas",showBack:true,eyebrow:"Mushi \xB7 Roadmap"})}
1795
1855
  <div class="mushi-body">
1796
1856
  ${t.reporterLoading?'<p class="mushi-muted">Loading ideas\u2026</p>':""}
1797
1857
  ${t.reporterError?`<p class="mushi-error-inline">${E(t.reporterError)}</p>`:""}
1798
1858
  ${e||(t.reporterLoading?"":'<p class="mushi-muted">No community ideas yet. Be the first to suggest one.</p>')}
1799
1859
  </div>
1800
- `}function ws(t){let e=t.globalLeaderboard!==null||t.globalLeaderboardLoading,r=e?t.globalLeaderboard??[]:(t.leaderboardEntries??[]).map(o=>({tester_id:"",public_handle:null,display_name:o.display_name,rank:0,points_30d:o.points_30d,total_points:o.total_points})),n=e?t.globalLeaderboardLoading:t.leaderboardLoading,s=t.testerReputation?.rank??null,i=r.map((o,l)=>{let f=o.rank||l+1,d=t.testerReputation&&o.tester_id===t.testerReputation.tester_id;return `
1801
- <div class="mushi-lb-row ${f===1?"mushi-lb-top":""}${d?" mushi-lb-me":""}">
1860
+ `}function Es(t){let e=t.globalLeaderboard!==null||t.globalLeaderboardLoading,r=e?t.globalLeaderboard??[]:(t.leaderboardEntries??[]).map(o=>({tester_id:"",public_handle:null,display_name:o.display_name,rank:0,points_30d:o.points_30d,total_points:o.total_points})),n=e?t.globalLeaderboardLoading:t.leaderboardLoading,s=t.testerReputation?.rank??null,i=r.map((o,l)=>{let f=o.rank||l+1,p=t.testerReputation&&o.tester_id===t.testerReputation.tester_id;return `
1861
+ <div class="mushi-lb-row ${f===1?"mushi-lb-top":""}${p?" mushi-lb-me":""}">
1802
1862
  <span class="mushi-lb-rank">#${f}</span>
1803
1863
  <span class="mushi-lb-name">${E(o.public_handle??o.display_name??"Anon")}</span>
1804
1864
  <span class="mushi-lb-pts">${(o.points_30d??o.total_points).toLocaleString()} pts</span>
1805
1865
  </div>
1806
1866
  `}).join(""),a=s?`<div class="mushi-lb-myrank">You are ranked <strong>#${s}</strong> this month</div>`:t.testerJwt?"":'<button type="button" class="mushi-link-btn" data-action="open-account">Sign in to see your rank \u2192</button>';return `
1807
- ${Q(t,{title:"\u{1F3C6} Global Leaderboard",showBack:true,eyebrow:"Mushi \xB7 Community"})}
1867
+ ${te(t,{title:"\u{1F3C6} Global Leaderboard",showBack:true,eyebrow:"Mushi \xB7 Community"})}
1808
1868
  <div class="mushi-body">
1809
1869
  ${n?'<p class="mushi-muted">Loading leaderboard\u2026</p>':""}
1810
1870
  ${!n&&!r.length?'<p class="mushi-muted">No contributors yet \u2014 be the first!</p>':""}
@@ -1812,8 +1872,8 @@
1812
1872
  ${a}
1813
1873
  <p class="mushi-lb-note">Global contributors this month \xB7 Points refresh monthly</p>
1814
1874
  </div>
1815
- `}function xs(t){let e=t.testerInfo;if(e){let r=e.public_handle??e.display_name??"Tester",n=t.testerReputation;return `
1816
- ${Q(t,{title:"\u866B Mushi Account",showBack:true,eyebrow:"Mushi \xB7 Identity"})}
1875
+ `}function ks(t){let e=t.testerInfo;if(e){let r=e.public_handle??e.display_name??"Tester",n=t.testerReputation;return `
1876
+ ${te(t,{title:"\u866B Mushi Account",showBack:true,eyebrow:"Mushi \xB7 Identity"})}
1817
1877
  <div class="mushi-body">
1818
1878
  <div class="mushi-account-card">
1819
1879
  <div class="mushi-account-avatar">${E(r.charAt(0).toUpperCase())}</div>
@@ -1831,14 +1891,14 @@
1831
1891
  <button type="button" class="mushi-link-btn" data-action="sign-out-tester">Sign out</button>
1832
1892
  </div>
1833
1893
  `}return t.magicLinkSent?`
1834
- ${Q(t,{title:"\u866B Check your email",showBack:true,eyebrow:"Mushi \xB7 Sign in"})}
1894
+ ${te(t,{title:"\u866B Check your email",showBack:true,eyebrow:"Mushi \xB7 Sign in"})}
1835
1895
  <div class="mushi-body">
1836
1896
  <p class="mushi-muted">We sent a sign-in link to <strong>${E(t.magicLinkEmail)}</strong>. Click it to connect your reports across apps and join the community.</p>
1837
1897
  <button type="button" class="mushi-link-btn" data-action="resend-magic-link">Resend email</button>
1838
1898
  ${t.magicLinkError?`<p class="mushi-error">${E(t.magicLinkError)}</p>`:""}
1839
1899
  </div>
1840
1900
  `:`
1841
- ${Q(t,{title:"\u866B Join the community",showBack:true,eyebrow:"Mushi \xB7 Sign in"})}
1901
+ ${te(t,{title:"\u866B Join the community",showBack:true,eyebrow:"Mushi \xB7 Sign in"})}
1842
1902
  <div class="mushi-body">
1843
1903
  <p class="mushi-muted">Sign in to see your reports across all apps and climb the global leaderboard. No password needed.</p>
1844
1904
  <label class="mushi-label" for="mushi-email-input">Email address</label>
@@ -1857,35 +1917,35 @@
1857
1917
  <span>${t.magicLinkSending?"Sending\u2026":"Send sign-in link"}</span><span class="mushi-submit-arrow" aria-hidden="true">\u2192</span>
1858
1918
  </button>
1859
1919
  </div>
1860
- `}function Ss(t){let e=t.crossAppReports??[],r=new Map;for(let s of e){let i=s.project_id??"unknown";r.has(i)||r.set(i,{name:s.app_name??"Unknown App",reports:[]}),r.get(i).reports.push(s);}let n=[...r.entries()].map(([,s])=>`
1920
+ `}function Rs(t){let e=t.crossAppReports??[],r=new Map;for(let s of e){let i=s.project_id??"unknown";r.has(i)||r.set(i,{name:s.app_name??"Unknown App",reports:[]}),r.get(i).reports.push(s);}let n=[...r.entries()].map(([,s])=>`
1861
1921
  <div class="mushi-xapp-group">
1862
1922
  <h4 class="mushi-xapp-app-name">${E(s.name)}</h4>
1863
- ${s.reports.map(i=>{let a=Be(i.status);return `
1923
+ ${s.reports.map(i=>{let a=qe(i.status);return `
1864
1924
  <div class="mushi-report-row" data-report-id="${E(i.id)}" tabindex="0" role="button">
1865
- <span class="mushi-report-status mushi-status-${a}">${E(it(i.status))}</span>
1925
+ <span class="mushi-report-status mushi-status-${a}">${E(ut(i.status))}</span>
1866
1926
  <span class="mushi-report-title">${E(i.title??i.category)}</span>
1867
- <span class="mushi-report-when">${E(Ne(i.created_at))}</span>
1927
+ <span class="mushi-report-when">${E(je(i.created_at))}</span>
1868
1928
  </div>
1869
1929
  `}).join("")}
1870
1930
  </div>
1871
1931
  `).join("");return `
1872
- ${Q(t,{title:"My reports",showBack:true,eyebrow:"Mushi \xB7 All apps"})}
1932
+ ${te(t,{title:"My reports",showBack:true,eyebrow:"Mushi \xB7 All apps"})}
1873
1933
  <div class="mushi-body">
1874
1934
  ${t.crossAppLoading?'<p class="mushi-muted">Loading your reports\u2026</p>':""}
1875
1935
  ${!t.crossAppLoading&&!e.length?'<p class="mushi-muted">No reports filed yet.</p>':""}
1876
1936
  ${n}
1877
1937
  </div>
1878
- `}function Es(t){let e=t.reporterReports.find(a=>a.id===t.selectedReportId),r=e?.status??"unknown",n=Be(r),s=e?.created_at?Ne(e.created_at):"",i=t.reporterComments.map(a=>`
1938
+ `}function Cs(t){let e=t.reporterReports.find(a=>a.id===t.selectedReportId),r=e?.status??"unknown",n=qe(r),s=e?.created_at?je(e.created_at):"",i=t.reporterComments.map(a=>`
1879
1939
  <div class="mushi-thread-comment ${a.author_kind}">
1880
1940
  <strong>${E(a.author_kind==="reporter"?"You":a.author_name??"Developer")}</strong>
1881
1941
  <p>${E(a.body)}</p>
1882
1942
  </div>
1883
1943
  `).join("");return `
1884
- ${Q(t,{title:"Report thread",showBack:true,eyebrow:"Mushi \xB7 Inbox"})}
1944
+ ${te(t,{title:"Report thread",showBack:true,eyebrow:"Mushi \xB7 Inbox"})}
1885
1945
  <div class="mushi-body">
1886
1946
  <div class="mushi-thread-summary">
1887
1947
  <div class="mushi-thread-summary-meta">
1888
- <span class="mushi-report-status mushi-status-${n}">${E(Sr(r))}</span>
1948
+ <span class="mushi-report-status mushi-status-${n}">${E(kr(r))}</span>
1889
1949
  ${s?`<span class="mushi-report-when">Reported ${E(s)}</span>`:""}
1890
1950
  </div>
1891
1951
  <p>${E(e?.summary??e?.description??"Report details")}</p>
@@ -1904,12 +1964,12 @@
1904
1964
  <span>Reply</span><span class="mushi-submit-arrow" aria-hidden="true">\u2192</span>
1905
1965
  </button>
1906
1966
  </div>
1907
- `}function ks(t){let e=t.locale,r=t.selectedCategory,i=(t.resolveCustomCategory(r)?.intents??(e.step2.intents[r]||[])).map(l=>`
1967
+ `}function Ts(t){let e=t.locale,r=t.selectedCategory,i=(t.resolveCustomCategory(r)?.intents??(e.step2.intents[r]||[])).map(l=>`
1908
1968
  <button type="button" class="mushi-intent-btn" data-intent="${E(l)}">
1909
1969
  ${E(l)}
1910
1970
  </button>
1911
1971
  `).join(""),a=t.categoryIcon(r),o=t.categoryLabel(r);return `
1912
- ${Q(t,{title:e.step2.heading,showBack:true,step:me.intent})}
1972
+ ${te(t,{title:e.step2.heading,showBack:true,step:ye.intent})}
1913
1973
  <div class="mushi-body">
1914
1974
  <div class="mushi-selected-category">
1915
1975
  <span aria-hidden="true">${E(a)}</span>
@@ -1919,9 +1979,9 @@
1919
1979
  ${i}
1920
1980
  </div>
1921
1981
  </div>
1922
- ${at(t,me.intent)}
1923
- `}function Rs(t){let e=t.locale,r=t.effectiveMinLength(),n=t.screenshotCapturing?e.step3.screenshotCapturing:t.screenshotError?e.step3.screenshotFailed:t.screenshotAttached?e.step3.screenshotAttached:e.step3.screenshotButton,s=["mushi-attach-btn",t.screenshotAttached?"active":"",t.screenshotError?"error":"",t.screenshotCapturing?"loading":""].filter(Boolean).join(" "),i=t.elementCapturing?e.step3.elementCapturing:t.elementSelected?e.step3.elementSelected:e.step3.elementButton,a=["mushi-attach-btn",t.elementSelected?"active":"",t.elementCapturing?"loading":""].filter(Boolean).join(" "),o=e.step3.examplePrompts.map(l=>`<button type="button" class="mushi-example-chip" data-example="${E(l)}">${E(l)}</button>`).join("");return `
1924
- ${Q(t,{title:e.step3.heading,showBack:true,step:me.details})}
1982
+ ${dt(t,ye.intent)}
1983
+ `}function Ms(t){let e=t.locale,r=t.effectiveMinLength(),n=t.screenshotCapturing?e.step3.screenshotCapturing:t.screenshotError?e.step3.screenshotFailed:t.screenshotAttached?e.step3.screenshotAttached:e.step3.screenshotButton,s=["mushi-attach-btn",t.screenshotAttached?"active":"",t.screenshotError?"error":"",t.screenshotCapturing?"loading":""].filter(Boolean).join(" "),i=t.elementCapturing?e.step3.elementCapturing:t.elementSelected?e.step3.elementSelected:e.step3.elementButton,a=["mushi-attach-btn",t.elementSelected?"active":"",t.elementCapturing?"loading":""].filter(Boolean).join(" "),o=e.step3.examplePrompts.map(l=>`<button type="button" class="mushi-example-chip" data-example="${E(l)}">${E(l)}</button>`).join("");return `
1984
+ ${te(t,{title:e.step3.heading,showBack:true,step:ye.details})}
1925
1985
  <div class="mushi-body">
1926
1986
  <div class="mushi-example-chips" aria-label="Example prompts">${o}</div>
1927
1987
  <div class="mushi-textarea-wrap">
@@ -1965,9 +2025,9 @@
1965
2025
  <span class="mushi-submit-arrow" aria-hidden="true">\u2192</span>
1966
2026
  </button>
1967
2027
  </div>
1968
- ${at(t,me.details)}
1969
- `}function Cs(t){let e=t.locale,n=(t.submittedAt??new Date).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:false});return `
1970
- ${Q(t,{title:e.widget.title,eyebrow:"Mushi \xB7 Receipt"})}
2028
+ ${dt(t,ye.details)}
2029
+ `}function $s(t){let e=t.locale,n=(t.submittedAt??new Date).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:false});return `
2030
+ ${te(t,{title:e.widget.title,showBack:true,eyebrow:"Mushi \xB7 Receipt"})}
1971
2031
  <div class="mushi-body">
1972
2032
  <div class="mushi-success">
1973
2033
  <div class="mushi-success-stamp" aria-hidden="true">
@@ -1976,15 +2036,15 @@
1976
2036
  </div>
1977
2037
  <div class="mushi-success-headline">${e.widget.submitted}</div>
1978
2038
  <div class="mushi-success-meta">REPORT \xB7 ${n}</div>
1979
- ${Ts(t)}
1980
- ${t.rewardsState?$s(t):""}
1981
- ${t.config.betaMode?.enabled?Ms(t):""}
2039
+ ${Ls(t)}
2040
+ ${t.rewardsState?_s(t):""}
2041
+ ${t.config.betaMode?.enabled?Is(t):""}
1982
2042
  <button type="button" class="mushi-link-btn mushi-success-my-reports" data-action="view-my-reports">
1983
2043
  \u{1F4EC} Track this report &rsaquo;
1984
2044
  </button>
1985
2045
  </div>
1986
2046
  </div>
1987
- `}function Ts(t){if(t.lastSubmitQueuedOffline)return `
2047
+ `}function Ls(t){if(t.lastSubmitQueuedOffline)return `
1988
2048
  <div class="mushi-success-receipt" role="status">
1989
2049
  <div class="mushi-success-receipt-row mushi-success-receipt-warn">
1990
2050
  <span class="mushi-success-receipt-label">Queued offline</span>
@@ -1997,7 +2057,7 @@
1997
2057
  <span class="mushi-success-receipt-spinner" aria-hidden="true"></span>
1998
2058
  <span class="mushi-success-receipt-hint">Delivering to the team\u2026</span>
1999
2059
  </div>
2000
- ${kr(t)}
2060
+ ${Cr(t)}
2001
2061
  </div>
2002
2062
  `;let e=`#${t.lastReportId.slice(0,8)}`,r=(t.config.dashboardUrl??"").replace(/\/$/,""),n=r?`${r}/reports/${encodeURIComponent(t.lastReportId)}`:"";return `
2003
2063
  <div class="mushi-success-receipt" role="status">
@@ -2020,14 +2080,14 @@
2020
2080
  rel="noopener noreferrer"
2021
2081
  >Track on Mushi <span aria-hidden="true">\u2197</span></a>
2022
2082
  `:""}
2023
- ${kr(t)}
2083
+ ${Cr(t)}
2024
2084
  </div>
2025
- `}function kr(t){let e=(t.config.responseSlaLabel??"").trim();return e?`<div class="mushi-success-sla">${E(e)}</div>`:'<div class="mushi-success-sla mushi-success-sla-default">A human will look at this within a working day.</div>'}function Ms(t){let e=t.config.betaMode,r=e.contactEmail?E(e.contactEmail):null,n=E(e.appName??"the team");return `
2085
+ `}function Cr(t){let e=(t.config.responseSlaLabel??"").trim();return e?`<div class="mushi-success-sla">${E(e)}</div>`:'<div class="mushi-success-sla mushi-success-sla-default">A human will look at this within a working day.</div>'}function Is(t){let e=t.config.betaMode,r=e.contactEmail?E(e.contactEmail):null,n=E(e.appName??"the team");return `
2026
2086
  <div class="mushi-beta-success-footer" role="note" aria-label="Beta feedback acknowledgement">
2027
2087
  ${r?`<div class="mushi-beta-success-line">\u{1F4EC} Sent to ${r}</div>`:`<div class="mushi-beta-success-line">\u{1F4EC} Sent to ${n}</div>`}
2028
2088
  <div class="mushi-beta-success-line mushi-beta-success-dim">We aim to review within 48h \xB7 thank you for helping build this</div>
2029
2089
  </div>
2030
- `}function Ls(t){let{tier:e,nextTier:r,totalPoints:n,pointsForReport:s}=t.rewardsState,i=e?.displayName??"Free",a=e?.slug??"free",o=t.tierColor(a),l=100,f="";if(r){let d=e?.pointsThreshold??0,v=r.pointsThreshold;l=v>d?Math.round(Math.min(1,(n-d)/(v-d))*100):100,f=`${Math.max(0,v-n).toLocaleString()} pts to ${E(r.displayName)}`;}return `
2090
+ `}function As(t){let{tier:e,nextTier:r,totalPoints:n,pointsForReport:s}=t.rewardsState,i=e?.displayName??"Free",a=e?.slug??"free",o=t.tierColor(a),l=100,f="";if(r){let p=e?.pointsThreshold??0,v=r.pointsThreshold;l=v>p?Math.round(Math.min(1,(n-p)/(v-p))*100):100,f=`${Math.max(0,v-n).toLocaleString()} pts to ${E(r.displayName)}`;}return `
2031
2091
  <div class="mushi-rewards-nudge" aria-label="Rewards progress">
2032
2092
  <div class="mushi-rewards-row">
2033
2093
  <span class="mushi-tier-pip" style="background:${o}" aria-hidden="true"></span>
@@ -2042,7 +2102,7 @@
2042
2102
  <div class="mushi-rewards-next-label">${f}</div>
2043
2103
  `:""}
2044
2104
  </div>
2045
- `}function $s(t){let{tier:e,nextTier:r,totalPoints:n,pointsForReport:s}=t.rewardsState,i=n+s,a=100,o="";if(r){let l=e?.pointsThreshold??0,f=r.pointsThreshold;a=f>l?Math.round(Math.min(1,(i-l)/(f-l))*100):100;let d=Math.max(0,f-i);o=d>0?`${d.toLocaleString()} pts to ${E(r.displayName)}`:`\u{1F389} ${E(r.displayName)} reached!`;}return `
2105
+ `}function _s(t){let{tier:e,nextTier:r,totalPoints:n,pointsForReport:s}=t.rewardsState,i=n+s,a=100,o="";if(r){let l=e?.pointsThreshold??0,f=r.pointsThreshold;a=f>l?Math.round(Math.min(1,(i-l)/(f-l))*100):100;let p=Math.max(0,f-i);o=p>0?`${p.toLocaleString()} pts to ${E(r.displayName)}`:`\u{1F389} ${E(r.displayName)} reached!`;}return `
2046
2106
  <div class="mushi-success-rewards">
2047
2107
  <div class="mushi-success-pts-award">+${s} pts</div>
2048
2108
  ${r?`
@@ -2052,7 +2112,7 @@
2052
2112
  <div class="mushi-rewards-next-label">${o}</div>
2053
2113
  `:""}
2054
2114
  </div>
2055
- `}var Ue=class t{constructor(e={},r,n=Z){this.sdkVersion=n;this.config={position:e.position??"bottom-right",anchor:e.anchor??{},theme:e.theme??"auto",triggerText:e.triggerText||"\u{1F41B}",expandedTitle:e.expandedTitle??"",mode:e.mode??"conversational",locale:e.locale??"auto",zIndex:e.zIndex??99999,trigger:e.trigger??"auto",bannerConfig:e.bannerConfig??{},attachToSelector:e.attachToSelector??"",inset:e.inset??{},respectSafeArea:e.respectSafeArea??true,hideOnSelector:e.hideOnSelector??"",hideOnRoutes:e.hideOnRoutes??[],environments:e.environments??{},smartHide:e.smartHide??false,draggable:e.draggable??false,brandFooter:e.brandFooter??true,outdatedBanner:e.outdatedBanner??"auto",betaMode:e.betaMode??{},minDescriptionLength:e.minDescriptionLength??20,dashboardUrl:e.dashboardUrl??"",responseSlaLabel:e.responseSlaLabel??"",featureRequestCard:e.featureRequestCard??true,featureRequestLabel:e.featureRequestLabel||"Feature request",featureRequestDescription:e.featureRequestDescription||"Suggest something new \u2014 even rough ideas help us prioritise",avoidSelectors:e.avoidSelectors??[],categories:e.categories??[],accent:e.accent??"",accentText:e.accentText??""},this.callbacks=r,this.locale=st(this.config.locale==="auto"?void 0:this.config.locale),this.host=document.createElement("div"),this.host.id="mushi-mushi-widget",this.shadow=this.host.attachShadow({mode:"closed"});}sdkVersion;host;shadow;config;callbacks;locale;isOpen=false;step="category";selectedCategory=null;selectedIntent=null;viaFeatureRequest=false;screenshotAttached=false;screenshotCapturing=false;screenshotError=false;allowScreenshotRemove=true;elementSelected=false;elementCapturing=false;submitting=false;selectorHint=null;triggerVisible=true;triggerShrunk=false;triggerHiddenByScroll=false;mountedAt=null;nudgeShown=false;nudgeEl=null;nudgeTimer=null;sdkFreshness=null;reporterReports=[];featureBoard=[];reporterComments=[];selectedReportId=null;reporterLoading=false;reporterError=null;attachedLaunchers=[];smartHideCleanup=null;smartHideTimer=null;submittedAt=null;successTimer=null;autoCloseTimer=null;rewardsState=null;leaderboardEntries=null;leaderboardLoading=false;lastReportId=null;lastSubmitQueuedOffline=false;bannerDismissed=false;bannerResizeObserver=null;fabPos=null;vvCleanup=null;testerJwt=null;testerInfo=null;crossAppReports=null;crossAppLoading=false;globalLeaderboard=null;globalLeaderboardLoading=false;testerReputation=null;magicLinkSent=false;magicLinkEmail="";magicLinkError="";magicLinkSending=false;assistantTurns=[];assistantThreadId=null;assistantSending=false;assistantError=null;mount(){this.host.isConnected||(this.syncHostChromeState(),document.body.appendChild(this.host),this.syncAttachedLaunchers(),this.syncSmartHide(),this.render(),this.mountedAt=Date.now());}getIsMounted(){return this.host.isConnected}updateConfig(e={}){this.config={...this.config,...e.position?{position:e.position}:{},...e.anchor!==void 0?{anchor:e.anchor}:{},...e.theme?{theme:e.theme}:{},...e.triggerText!==void 0?{triggerText:e.triggerText||"\u{1F41B}"}:{},...e.expandedTitle!==void 0?{expandedTitle:e.expandedTitle}:{},...e.mode?{mode:e.mode}:{},...e.locale?{locale:e.locale}:{},...e.zIndex!==void 0?{zIndex:e.zIndex}:{},...e.trigger?{trigger:e.trigger}:{},...e.attachToSelector!==void 0?{attachToSelector:e.attachToSelector}:{},...e.inset!==void 0?{inset:e.inset}:{},...e.respectSafeArea!==void 0?{respectSafeArea:e.respectSafeArea}:{},...e.hideOnSelector!==void 0?{hideOnSelector:e.hideOnSelector}:{},...e.hideOnRoutes!==void 0?{hideOnRoutes:e.hideOnRoutes}:{},...e.environments!==void 0?{environments:e.environments}:{},...e.smartHide!==void 0?{smartHide:e.smartHide}:{},...e.draggable!==void 0?{draggable:e.draggable}:{},...e.brandFooter!==void 0?{brandFooter:e.brandFooter}:{},...e.outdatedBanner!==void 0?{outdatedBanner:e.outdatedBanner}:{},...e.betaMode!==void 0?{betaMode:e.betaMode}:{},...e.minDescriptionLength!==void 0?{minDescriptionLength:e.minDescriptionLength}:{},...e.dashboardUrl!==void 0?{dashboardUrl:e.dashboardUrl}:{},...e.responseSlaLabel!==void 0?{responseSlaLabel:e.responseSlaLabel}:{},...e.featureRequestCard!==void 0?{featureRequestCard:e.featureRequestCard}:{},...e.featureRequestLabel!==void 0?{featureRequestLabel:e.featureRequestLabel||"Feature request"}:{},...e.featureRequestDescription!==void 0?{featureRequestDescription:e.featureRequestDescription||"Suggest something new \u2014 even rough ideas help us prioritise"}:{},...e.bannerConfig!==void 0?{bannerConfig:e.bannerConfig}:{},...e.categories!==void 0?{categories:e.categories}:{}},this.locale=st(this.config.locale==="auto"?void 0:this.config.locale),this.host.isConnected&&this.syncHostChromeState(),this.syncAttachedLaunchers(),this.syncSmartHide(),this.render();}resolveCustomCategory(e){return this.config.categories?.find(r=>r.id===e)}resolveBaseCategory(e){return ["bug","slow","visual","confusing","other"].includes(e)?e:this.resolveCustomCategory(e)?.baseCategory??"other"}categoryIcon(e){let r=this.resolveCustomCategory(e);return r?.icon?r.icon:He[e]??"\u{1F4AC}"}categoryLabel(e){let r=this.resolveCustomCategory(e);return r?r.label:this.locale.step1.categories[e]??e}open(e){if(!this.isOpen){if(this.isOpen=true,this.screenshotAttached=false,this.screenshotCapturing=false,this.screenshotError=false,this.elementSelected=false,this.elementCapturing=false,this.submitting=false,this.submittedAt=null,this.removeSelectorHint(),this.lastReportId=null,this.lastSubmitQueuedOffline=false,this.viaFeatureRequest=false,e?.featureRequest)this.selectedCategory="other",this.selectedIntent=ot,this.viaFeatureRequest=true,this.step="details";else if(e?.category){let r=this.resolveCustomCategory(e.category);["bug","slow","visual","confusing","other"].includes(e.category)||r!==void 0?(this.selectedCategory=e.category,this.selectedIntent=null,this.step=r&&(!r.intents||r.intents.length===0)?"details":"intent"):(this.selectedCategory=null,this.selectedIntent=null,this.step="category");}else this.selectedCategory=null,this.selectedIntent=null,this.step="category";this.render(),this.callbacks.onOpen();}}close(){this.isOpen&&(this.isOpen=false,this.render(),this.callbacks.onClose());}openAssistantTab(){if(!this.callbacks.assistantEnabled){this.open();return}this.isOpen||(this.isOpen=true,this.callbacks.onOpen()),this.step="assistant",this.assistantError=null,this.render(),setTimeout(()=>{this.shadow.querySelector(".mushi-assistant-input")?.focus();},0);}async sendAssistantMessage(e){let r=e.trim();if(!(!r||this.assistantSending||!this.callbacks.onAssistantAsk)){this.assistantSending=true,this.assistantError=null,this.assistantTurns.push({role:"user",text:r}),this.render();try{let n=await this.callbacks.onAssistantAsk(r,this.assistantThreadId);n?(n.threadId&&(this.assistantThreadId=n.threadId),n.kind==="clarify"?this.assistantTurns.push({role:"assistant",text:n.question??"Could you tell me a bit more?",...n.options&&n.options.length?{options:n.options}:{}}):this.assistantTurns.push({role:"assistant",text:n.text??"\u2026"})):this.assistantError="No response \u2014 please try again.";}catch{this.assistantError="Something went wrong. Please try again.";}finally{this.assistantSending=false,this.render(),setTimeout(()=>{let n=this.shadow.querySelector(".mushi-assistant-log");n&&(n.scrollTop=n.scrollHeight);},0);}}}pulseTrigger(){if(this.isOpen)return;let e=this.shadow.querySelector(".mushi-trigger");e&&(e.classList.add("mushi-trigger-pulse"),window.setTimeout(()=>{e.classList.remove("mushi-trigger-pulse");},2400));}getIsOpen(){return this.isOpen}showTrigger(){this.triggerVisible=true,this.render();}hideTrigger(){this.triggerVisible=false,this.render();}setTrigger(e){this.updateConfig({trigger:e});}attachTo(e,r={}){let s=(typeof e=="string"?Array.from(document.querySelectorAll(e)):[e]).map(i=>{let a=o=>{o.preventDefault(),this.updateConfig(r),this.open();};return i.addEventListener("click",a),()=>i.removeEventListener("click",a)});return ()=>s.forEach(i=>i())}setScreenshotAttached(e){this.screenshotAttached=e,this.isOpen&&this.render();}setAllowScreenshotRemove(e){this.allowScreenshotRemove=e,this.isOpen&&this.render();}setElementSelected(e){this.elementSelected=e,this.elementCapturing=false,this.removeSelectorHint(),this.isOpen&&this.render();}setScreenshotCapturing(e){this.screenshotCapturing=e,this.screenshotError=false,this.isOpen&&this.render();}setScreenshotError(e){this.screenshotError=e,this.screenshotCapturing=false,this.isOpen&&this.render();}setElementCapturing(e){this.elementCapturing=e,e?this.showSelectorHint():this.removeSelectorHint(),this.isOpen&&this.render();}hidePanel(){let e=this.shadow.querySelector(".mushi-panel");e&&(e.style.display="none");}showPanel(){let e=this.shadow.querySelector(".mushi-panel");e&&(e.style.display="");}showSelectorHint(){this.removeSelectorHint();let e=document.createElement("div");e.id="mushi-selector-hint",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.style.cssText=`
2115
+ `}var We=class t{constructor(e={},r,n=ee){this.sdkVersion=n;this.config={position:e.position??"bottom-right",anchor:e.anchor??{},theme:e.theme??"auto",triggerText:e.triggerText||"\u{1F41B}",expandedTitle:e.expandedTitle??"",mode:e.mode??"conversational",locale:e.locale??"auto",zIndex:e.zIndex??99999,trigger:e.trigger??"auto",bannerConfig:e.bannerConfig??{},attachToSelector:e.attachToSelector??"",inset:e.inset??{},respectSafeArea:e.respectSafeArea??true,hideOnSelector:e.hideOnSelector??"",hideOnRoutes:e.hideOnRoutes??[],environments:e.environments??{},smartHide:e.smartHide??false,draggable:e.draggable??false,brandFooter:e.brandFooter??true,outdatedBanner:e.outdatedBanner??"auto",betaMode:e.betaMode??{},minDescriptionLength:e.minDescriptionLength??20,dashboardUrl:e.dashboardUrl??"",responseSlaLabel:e.responseSlaLabel??"",featureRequestCard:e.featureRequestCard??true,featureRequestLabel:e.featureRequestLabel||"Feature request",featureRequestDescription:e.featureRequestDescription||"Suggest something new \u2014 even rough ideas help us prioritise",avoidSelectors:e.avoidSelectors??[],categories:e.categories??[],accent:e.accent??"",accentText:e.accentText??""},this.callbacks=r,this.locale=lt(this.config.locale==="auto"?void 0:this.config.locale),this.host=document.createElement("div"),this.host.id="mushi-mushi-widget",this.shadow=this.host.attachShadow({mode:"closed"});}sdkVersion;host;shadow;config;callbacks;locale;isOpen=false;step="category";selectedCategory=null;selectedIntent=null;viaFeatureRequest=false;showAllCategories=false;screenshotAttached=false;screenshotCapturing=false;screenshotError=false;allowScreenshotRemove=true;elementSelected=false;elementCapturing=false;submitting=false;selectorHint=null;triggerVisible=true;triggerShrunk=false;triggerHiddenByScroll=false;mountedAt=null;nudgeShown=false;nudgeEl=null;nudgeTimer=null;sdkFreshness=null;reporterReports=[];featureBoard=[];reporterComments=[];selectedReportId=null;reporterLoading=false;reporterError=null;attachedLaunchers=[];smartHideCleanup=null;smartHideTimer=null;submittedAt=null;successTimer=null;autoCloseTimer=null;rewardsState=null;leaderboardEntries=null;leaderboardLoading=false;lastReportId=null;lastSubmitQueuedOffline=false;bannerDismissed=false;bannerResizeObserver=null;fabPos=null;vvCleanup=null;testerJwt=null;testerInfo=null;crossAppReports=null;crossAppLoading=false;globalLeaderboard=null;globalLeaderboardLoading=false;testerReputation=null;magicLinkSent=false;magicLinkEmail="";magicLinkError="";magicLinkSending=false;assistantTurns=[];assistantThreadId=null;assistantSending=false;assistantError=null;mount(){this.host.isConnected||(this.syncHostChromeState(),document.body.appendChild(this.host),this.syncAttachedLaunchers(),this.syncSmartHide(),this.render(),this.mountedAt=Date.now());}getIsMounted(){return this.host.isConnected}updateConfig(e={}){this.config={...this.config,...e.position?{position:e.position}:{},...e.anchor!==void 0?{anchor:e.anchor}:{},...e.theme?{theme:e.theme}:{},...e.triggerText!==void 0?{triggerText:e.triggerText||"\u{1F41B}"}:{},...e.expandedTitle!==void 0?{expandedTitle:e.expandedTitle}:{},...e.mode?{mode:e.mode}:{},...e.locale?{locale:e.locale}:{},...e.zIndex!==void 0?{zIndex:e.zIndex}:{},...e.trigger?{trigger:e.trigger}:{},...e.attachToSelector!==void 0?{attachToSelector:e.attachToSelector}:{},...e.inset!==void 0?{inset:e.inset}:{},...e.respectSafeArea!==void 0?{respectSafeArea:e.respectSafeArea}:{},...e.hideOnSelector!==void 0?{hideOnSelector:e.hideOnSelector}:{},...e.hideOnRoutes!==void 0?{hideOnRoutes:e.hideOnRoutes}:{},...e.environments!==void 0?{environments:e.environments}:{},...e.smartHide!==void 0?{smartHide:e.smartHide}:{},...e.draggable!==void 0?{draggable:e.draggable}:{},...e.brandFooter!==void 0?{brandFooter:e.brandFooter}:{},...e.outdatedBanner!==void 0?{outdatedBanner:e.outdatedBanner}:{},...e.betaMode!==void 0?{betaMode:e.betaMode}:{},...e.minDescriptionLength!==void 0?{minDescriptionLength:e.minDescriptionLength}:{},...e.dashboardUrl!==void 0?{dashboardUrl:e.dashboardUrl}:{},...e.responseSlaLabel!==void 0?{responseSlaLabel:e.responseSlaLabel}:{},...e.featureRequestCard!==void 0?{featureRequestCard:e.featureRequestCard}:{},...e.featureRequestLabel!==void 0?{featureRequestLabel:e.featureRequestLabel||"Feature request"}:{},...e.featureRequestDescription!==void 0?{featureRequestDescription:e.featureRequestDescription||"Suggest something new \u2014 even rough ideas help us prioritise"}:{},...e.bannerConfig!==void 0?{bannerConfig:e.bannerConfig}:{},...e.categories!==void 0?{categories:e.categories}:{}},this.locale=lt(this.config.locale==="auto"?void 0:this.config.locale),this.host.isConnected&&this.syncHostChromeState(),this.syncAttachedLaunchers(),this.syncSmartHide(),this.render();}resolveCustomCategory(e){return this.config.categories?.find(r=>r.id===e)}resolveBaseCategory(e){return ["bug","slow","visual","confusing","other"].includes(e)?e:this.resolveCustomCategory(e)?.baseCategory??"other"}categoryIcon(e){let r=this.resolveCustomCategory(e);return r?.icon?r.icon:Ue[e]??"\u{1F4AC}"}categoryLabel(e){let r=this.resolveCustomCategory(e);return r?r.label:this.locale.step1.categories[e]??e}open(e){if(!this.isOpen){if(this.isOpen=true,this.screenshotAttached=false,this.screenshotCapturing=false,this.screenshotError=false,this.elementSelected=false,this.elementCapturing=false,this.submitting=false,this.submittedAt=null,this.removeSelectorHint(),this.lastReportId=null,this.lastSubmitQueuedOffline=false,this.viaFeatureRequest=false,e?.featureRequest)this.selectedCategory="other",this.selectedIntent=ct,this.viaFeatureRequest=true,this.step="details";else if(e?.category){let r=this.resolveCustomCategory(e.category);["bug","slow","visual","confusing","other"].includes(e.category)||r!==void 0?(this.selectedCategory=e.category,this.selectedIntent=null,this.step=r&&(!r.intents||r.intents.length===0)?"details":"intent"):(this.selectedCategory=null,this.selectedIntent=null,this.step="category");}else this.selectedCategory=null,this.selectedIntent=null,this.step="category";this.render(),this.callbacks.onOpen();}}close(){this.isOpen&&(this.isOpen=false,this.showAllCategories=false,this.render(),this.callbacks.onClose());}openAssistantTab(){if(!this.callbacks.assistantEnabled){this.open();return}this.isOpen||(this.isOpen=true,this.callbacks.onOpen()),this.step="assistant",this.assistantError=null,this.render(),setTimeout(()=>{this.shadow.querySelector(".mushi-assistant-input")?.focus();},0);}async sendAssistantMessage(e){let r=e.trim();if(!(!r||this.assistantSending||!this.callbacks.onAssistantAsk)){this.assistantSending=true,this.assistantError=null,this.assistantTurns.push({role:"user",text:r}),this.render();try{let n=await this.callbacks.onAssistantAsk(r,this.assistantThreadId);n?(n.threadId&&(this.assistantThreadId=n.threadId),n.kind==="clarify"?this.assistantTurns.push({role:"assistant",text:n.question??"Could you tell me a bit more?",...n.options&&n.options.length?{options:n.options}:{}}):this.assistantTurns.push({role:"assistant",text:n.text??"\u2026"})):this.assistantError="No response \u2014 please try again.";}catch{this.assistantError="Something went wrong. Please try again.";}finally{this.assistantSending=false,this.render(),setTimeout(()=>{let n=this.shadow.querySelector(".mushi-assistant-log");n&&(n.scrollTop=n.scrollHeight);},0);}}}pulseTrigger(){if(this.isOpen)return;let e=this.shadow.querySelector(".mushi-trigger");e&&(e.classList.add("mushi-trigger-pulse"),window.setTimeout(()=>{e.classList.remove("mushi-trigger-pulse");},2400));}getIsOpen(){return this.isOpen}showTrigger(){this.triggerVisible=true,this.render();}hideTrigger(){this.triggerVisible=false,this.render();}setTrigger(e){this.updateConfig({trigger:e});}attachTo(e,r={}){let s=(typeof e=="string"?Array.from(document.querySelectorAll(e)):[e]).map(i=>{let a=o=>{o.preventDefault(),this.updateConfig(r),this.open();};return i.addEventListener("click",a),()=>i.removeEventListener("click",a)});return ()=>s.forEach(i=>i())}setScreenshotAttached(e){this.screenshotAttached=e,this.isOpen&&this.render();}setAllowScreenshotRemove(e){this.allowScreenshotRemove=e,this.isOpen&&this.render();}setElementSelected(e){this.elementSelected=e,this.elementCapturing=false,this.removeSelectorHint(),this.isOpen&&this.render();}setScreenshotCapturing(e){this.screenshotCapturing=e,this.screenshotError=false,this.isOpen&&this.render();}setScreenshotError(e){this.screenshotError=e,this.screenshotCapturing=false,this.isOpen&&this.render();}setElementCapturing(e){this.elementCapturing=e,e?this.showSelectorHint():this.removeSelectorHint(),this.isOpen&&this.render();}hidePanel(){let e=this.shadow.querySelector(".mushi-panel");e&&(e.style.display="none");}showPanel(){let e=this.shadow.querySelector(".mushi-panel");e&&(e.style.display="");}showSelectorHint(){this.removeSelectorHint();let e=document.createElement("div");e.id="mushi-selector-hint",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.style.cssText=`
2056
2116
  position: fixed;
2057
2117
  bottom: 24px;
2058
2118
  left: 50%;
@@ -2085,7 +2145,7 @@
2085
2145
  backdrop-filter: blur(4px);
2086
2146
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
2087
2147
  animation: mushi-fade-in 0.15s ease forwards;
2088
- `,n.textContent=this.locale.step3.tooShort.startsWith("A bit")?"Found a bug? One sentence is enough \u{1F41B}":"\u30D0\u30B0\u3092\u898B\u3064\u3051\u305F\uFF1F\u4E00\u884C\u3067\u5927\u4E08\u592B\u3067\u3059 \u{1F41B}",document.body.appendChild(n),this.nudgeEl=n,this.nudgeTimer!==null&&clearTimeout(this.nudgeTimer),this.nudgeTimer=setTimeout(()=>this.removeNudge(),5e3);}removeNudge(){this.nudgeTimer!==null&&(clearTimeout(this.nudgeTimer),this.nudgeTimer=null),this.nudgeEl?.remove(),this.nudgeEl=null,document.getElementById("mushi-nudge-bubble")?.remove();}setSdkFreshness(e){this.sdkFreshness=e,this.isOpen&&this.render();}setRewardsState(e){this.rewardsState=e,this.isOpen&&this.render();}setLeaderboard(e,r=false){this.leaderboardEntries=e,this.leaderboardLoading=r,this.isOpen&&this.step==="leaderboard"&&this.render();}setTesterSession(e,r){this.testerJwt=e,this.testerInfo=r,this.isOpen&&this.render();}setGlobalLeaderboard(e,r=false){this.globalLeaderboard=e,this.globalLeaderboardLoading=r,this.isOpen&&(this.step==="leaderboard"||this.step==="account")&&this.render();}setCrossAppReports(e,r=false){this.crossAppReports=e,this.crossAppLoading=r,this.isOpen&&this.step==="cross-app-reports"&&this.render();}setTesterReputation(e){this.testerReputation=e,this.isOpen&&(this.step==="account"||this.step==="leaderboard")&&this.render();}destroy(){this.successTimer!==null&&(clearTimeout(this.successTimer),this.successTimer=null),this.autoCloseTimer!==null&&(clearTimeout(this.autoCloseTimer),this.autoCloseTimer=null),this.smartHideTimer!==null&&(clearTimeout(this.smartHideTimer),this.smartHideTimer=null),this.smartHideCleanup?.(),this.smartHideCleanup=null,this.teardownViewportHandlers(),this.attachedLaunchers.forEach(e=>e()),this.attachedLaunchers=[],this.removeSelectorHint(),this.removeNudge(),this.removeBodyNudge(),this.host.remove();}syncHostChromeState(){let e=this.host.style;e.setProperty("position","fixed"),e.setProperty("top","0"),e.setProperty("left","0"),e.setProperty("width","0"),e.setProperty("height","0"),e.setProperty("overflow","visible"),e.setProperty("pointer-events","none"),e.setProperty("z-index",String(this.config.zIndex)),e.setProperty("margin","0"),e.setProperty("padding","0"),e.setProperty("border","none"),e.setProperty("background","none");}isSuppressedByHost(){if(!this.config.hideOnSelector||typeof document>"u")return false;try{return !!document.querySelector(this.config.hideOnSelector)}catch{return false}}getWidgetDiagnostics(){let e=this.host.style,r=e.pointerEvents==="none"&&(e.width==="0"||e.width==="0px")&&(e.height==="0"||e.height==="0px"),n=this.host.isConnected?{width:this.host.offsetWidth,height:this.host.offsetHeight}:null,s=this.isSuppressedByHost()||this.isRouteHidden()||!this.triggerVisible,i=this.config.trigger==="banner"&&!this.bannerDismissed&&!this.isSuppressedByHost()&&!this.isRouteHidden()&&this.triggerVisible;return {widgetHostPointerSafe:r,widgetHostBounds:n,widgetSuppressed:s,bannerRendered:i}}syncAttachedLaunchers(){this.attachedLaunchers.forEach(e=>e()),this.attachedLaunchers=[],!(this.config.trigger!=="attach"||!this.config.attachToSelector)&&(typeof document>"u"||this.attachedLaunchers.push(this.attachTo(this.config.attachToSelector)));}syncSmartHide(){if(this.smartHideCleanup?.(),this.smartHideCleanup=null,this.triggerShrunk=false,this.triggerHiddenByScroll=false,!this.config.smartHide||typeof window>"u")return;let e=this.config.smartHide===true?{onScroll:"shrink",onIdleMs:900}:this.config.smartHide;if(!e.onScroll)return;let r=()=>{e.onScroll==="hide"?this.triggerHiddenByScroll=true:this.triggerShrunk=true,this.render(),this.smartHideTimer!==null&&clearTimeout(this.smartHideTimer),this.smartHideTimer=setTimeout(()=>{this.triggerHiddenByScroll=false,this.triggerShrunk=false,this.render();},e.onIdleMs??900);};window.addEventListener("scroll",r,{passive:true}),this.smartHideCleanup=()=>window.removeEventListener("scroll",r);}shouldRenderTrigger(){if(!this.triggerVisible||this.triggerHiddenByScroll||this.config.trigger==="manual"||this.config.trigger==="hidden"||this.config.trigger==="attach"||this.config.trigger==="banner"||this.isMobileSmartHidden()||this.isRouteHidden()||this.isSuppressedByHost())return false;let e=this.config.environments[this.detectEnvironment()];return e!=="never"&&e!=="manual"}static BANNER_HEIGHT=36;static BODY_NUDGE_PROP="--mushi-banner-offset";applyBodyNudge(e,r=t.BANNER_HEIGHT){let n=`${r}px`;document.documentElement.style.setProperty(t.BODY_NUDGE_PROP,n),e==="top"?document.body.dataset.mushiBannerNudged==="top"?document.body.style.paddingTop=n:document.body.style.paddingTop||(document.body.style.paddingTop=n,document.body.dataset.mushiBannerNudged="top"):document.body.dataset.mushiBannerNudged==="bottom"?document.body.style.paddingBottom=n:document.body.style.paddingBottom||(document.body.style.paddingBottom=n,document.body.dataset.mushiBannerNudged="bottom");}trackBannerHeight(e,r){let n=()=>{let s=e.getBoundingClientRect().height;s>0&&this.applyBodyNudge(r,s);};requestAnimationFrame(n),typeof ResizeObserver<"u"&&(this.bannerResizeObserver=new ResizeObserver(n),this.bannerResizeObserver.observe(e));}removeBodyNudge(){this.bannerResizeObserver?.disconnect(),this.bannerResizeObserver=null,document.documentElement.style.removeProperty(t.BODY_NUDGE_PROP);let e=document.body.dataset.mushiBannerNudged;e==="top"?(document.body.style.paddingTop="",delete document.body.dataset.mushiBannerNudged):e==="bottom"&&(document.body.style.paddingBottom="",delete document.body.dataset.mushiBannerNudged);}renderBanner(){if(this.config.trigger!=="banner")return;if(this.bannerDismissed){this.removeBodyNudge();return}if(!this.triggerVisible){this.removeBodyNudge();return}if(this.isRouteHidden()){this.removeBodyNudge();return}if(this.isSuppressedByHost()){this.removeBodyNudge();return}let e=this.config.bannerConfig??{},r=e.variant??"brand",n=e.position??"top",s=e.message?.trim()??"",i=s.length>0,a=e.bugCta??"\u{1F41B} Report a bug",o=e.featureCta!==false,l=e.featureCtaLabel??"Request feature",f=e.zIndex??(this.config.zIndex??99999)-1,d=document.createElement("div");d.className=`mushi-banner ${r} ${n}${i?" mushi-banner--rich":""}`,d.style.setProperty("--mushi-banner-z",String(f)),d.setAttribute("role","banner");let v=document.createElement("button");if(v.className="mushi-banner-dismiss",v.textContent="\u2715",v.setAttribute("aria-label","Dismiss feedback banner"),v.addEventListener("click",()=>{this.bannerDismissed=true,this.removeBodyNudge(),this.render();}),i){let p=document.createElement("div");p.className="mushi-banner-body";let m=e.label===false?null:e.label??"Beta";if(m){let R=document.createElement("span");R.className="mushi-banner-pill",R.textContent=m,p.appendChild(R);}let c=document.createElement("span");c.className="mushi-banner-message",c.textContent=s,p.appendChild(c),d.appendChild(p);let g=document.createElement("nav");g.className="mushi-banner-actions",g.setAttribute("aria-label","Feedback banner actions");let x=(R=false)=>{let S=document.createElement("span");S.className=`mushi-banner-divider${R?" mushi-banner-extra":""}`,S.setAttribute("aria-hidden","true"),S.textContent="|",g.appendChild(S);},T=(R,S,y=false)=>{let k=document.createElement("button");k.type="button",k.className=`mushi-banner-link${y?" mushi-banner-extra":""}`,k.textContent=R,k.addEventListener("click",S),g.appendChild(k);};T(a,()=>this.open()),o&&(x(true),T(l,()=>this.open({featureRequest:true}),true));for(let R of e.links??[]){let S=R.label?.trim();if(!S)continue;let y=R.href&&(/^https?:\/\//i.test(R.href)||R.href.startsWith("/"))?R.href:void 0;if(x(true),y){let k=document.createElement("a");k.className="mushi-banner-link mushi-banner-extra",k.href=y,k.textContent=S,k.target="_blank",k.rel="noopener noreferrer",g.appendChild(k);}else T(S,()=>{R.featureRequest?this.open({featureRequest:true}):this.open();},true);}x(true),T("\u{1F4EC} My reports",()=>this.openReporter(),true),d.appendChild(g),d.appendChild(v);}else {let p=document.createElement("button");if(p.className="mushi-banner-btn",p.textContent=a,p.addEventListener("click",()=>this.open()),d.appendChild(p),o){let c=document.createElement("button");c.className="mushi-banner-btn",c.textContent=l,c.addEventListener("click",()=>this.open({featureRequest:true})),d.appendChild(c);}let m=document.createElement("button");m.className="mushi-banner-my-reports",m.textContent="\u{1F4EC} My reports",m.setAttribute("aria-label","View my submitted reports"),m.addEventListener("click",()=>this.openReporter()),d.appendChild(m),d.appendChild(v);}this.shadow.appendChild(d),this.applyBodyNudge(n),this.trackBannerHeight(d,n);}effectiveTrigger(){if(!this.config.smartHide||typeof window>"u")return this.config.trigger;let e=this.config.smartHide===true?{onMobile:"edge-tab"}:this.config.smartHide;return window.matchMedia("(max-width: 768px)").matches&&e.onMobile==="edge-tab"?"edge-tab":this.config.trigger}isMobileSmartHidden(){if(!this.config.smartHide||typeof window>"u")return false;let e=this.config.smartHide===true?{onMobile:"edge-tab"}:this.config.smartHide;return window.matchMedia("(max-width: 768px)").matches&&e.onMobile==="hide"}detectEnvironment(){let e=typeof location<"u"?location.hostname:"";return e==="localhost"||e==="127.0.0.1"||e.endsWith(".local")?"development":/\b(staging|stage|preview|dev)\b/i.test(e)?"staging":"production"}isRouteHidden(){return !this.config.hideOnRoutes.length||typeof location>"u"?false:this.config.hideOnRoutes.some(e=>location.pathname.includes(e))}getTheme(){let e=this.config.theme;if(e==="light"||e==="dark")return e;if(e==="inherit"){let r=document.documentElement,n=r.getAttribute("data-color-scheme")||r.getAttribute("data-theme")||r.getAttribute("color-scheme")||"";if(/dark/i.test(n))return "dark";if(/light/i.test(n))return "light";if(r.classList.contains("dark"))return "dark";if(r.classList.contains("light"))return "light";try{let i=getComputedStyle(r).backgroundColor.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(i)return .299*+i[1]+.587*+i[2]+.114*+i[3]<128?"dark":"light"}catch{}}return typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}render(){let e=this.getTheme(),r=this.config.position,n=this.locale;this.bannerResizeObserver?.disconnect(),this.bannerResizeObserver=null,this.shadow.innerHTML="";let s=document.createElement("style");if(s.textContent=xr(e,this.config.accent??"",this.config.accentText??""),this.shadow.appendChild(s),this.renderBanner(),this.shouldRenderTrigger()){let a=this.effectiveTrigger(),o=document.createElement("button");if(o.className=`mushi-trigger ${r}${a==="edge-tab"?" edge-tab":""}${this.triggerShrunk?" shrunk":""}`,o.textContent=this.config.triggerText,o.setAttribute("aria-label",n.widget.trigger),o.setAttribute("aria-haspopup","dialog"),o.setAttribute("aria-expanded",String(this.isOpen)),o.style.zIndex=String(this.config.zIndex),this.applyInsetVars(o),o.addEventListener("click",()=>{this.removeNudge(),this.isOpen?this.close():this.open();}),o.addEventListener("mouseenter",()=>{let l=this.mountedAt?Date.now()-this.mountedAt:0;!this.nudgeShown&&!this.isOpen&&l>=3e4&&this.showNudge();}),o.addEventListener("mouseleave",()=>{this.nudgeEl&&(this.nudgeTimer!==null&&clearTimeout(this.nudgeTimer),this.nudgeTimer=setTimeout(()=>this.removeNudge(),2e3));}),o.addEventListener("keydown",l=>{let f=this.config.draggable;if(!f)return;let d=8,v=typeof f=="object"?f.axis??"both":"both",p=0,m=0;if(v!=="y"&&(l.key==="ArrowLeft"?p=-d:l.key==="ArrowRight"&&(p=d)),v!=="x"&&(l.key==="ArrowUp"?m=-d:l.key==="ArrowDown"&&(m=d)),p!==0||m!==0){l.preventDefault();let c=this.fabPos??{x:0,y:0};this.moveFab(o,c.x+p,c.y+m,false);}}),this.config.draggable&&this.attachDragHandlers(o),this.shadow.appendChild(o),this.fabPos&&this.config.draggable){let l=this.fabPos;this.fabPos={x:0,y:0},this.moveFab(o,l.x,l.y,false);}}let i=document.createElement("div");if(i.className=`mushi-panel ${r}${this.isOpen?" open":" closed"}`,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-label",n.widget.title),i.style.zIndex=String(this.config.zIndex+1),this.applyInsetVars(i),this.isOpen){let a=this.renderCtx();i.innerHTML=`${Cr(a)}${Rr(a)}${Tr(a)}`,this.shadow.appendChild(i),this.attachHandlers(i),this.trapFocus(i),this.attachViewportHandlers(i);}else this.teardownViewportHandlers();}computeAvoidTopPx(e=8){let r=this.config.avoidSelectors;if(!r?.length)return null;let n=0;for(let s of r)try{let i=document.querySelector(s);if(!i)continue;let a=i.getBoundingClientRect();a.bottom>n&&a.width>0&&a.height>0&&(n=a.bottom);}catch{}return n>0?Math.ceil(n)+e:null}computeAvoidBottomPx(e=8){let r=this.config.avoidSelectors;if(!r?.length)return null;let n=0;for(let s of r)try{let i=document.querySelector(s);if(!i)continue;let a=i.getBoundingClientRect();if(a.width>0&&a.height>0){let o=window.innerHeight-a.top+e;o>n&&(n=o);}}catch{}return n>0?Math.ceil(n):null}applyInsetVars(e){let{anchor:r}=this.config;if(r&&Object.keys(r).length>0)["top","right","bottom","left"].forEach(i=>{let a=r[i];a!==void 0&&e.style.setProperty(`--mushi-${i}`,a);}),e.style.setProperty("--mushi-safe-area",this.config.respectSafeArea?"1":"0");else {let{inset:i}=this.config;this.config.respectSafeArea||["top","right","bottom","left"].forEach(a=>{i[a]===void 0&&e.style.setProperty(`--mushi-${a}`,"24px");}),["top","right","bottom","left"].forEach(a=>{let o=i[a];o!==void 0&&e.style.setProperty(`--mushi-${a}`,o==="auto"?"auto":`${o}px`);}),e.style.setProperty("--mushi-safe-area",this.config.respectSafeArea?"1":"0");}let n=r?.top!==void 0||this.config.position?.startsWith("top"),s=r?.bottom!==void 0||this.config.position?.startsWith("bottom")||!this.config.position;if(n){let i=this.computeAvoidTopPx();i!==null&&e.style.setProperty("--mushi-top",`${i}px`);}if(s){let i=this.computeAvoidBottomPx();i!==null&&e.style.setProperty("--mushi-bottom",`${i}px`);}}fabStorageKey(){let e=this.config.projectId??"";return `mushi_fab_pos${e?`_${e}`:""}`}moveFab(e,r,n,s){let i=(()=>{let G=this.config.draggable;return G&&typeof G=="object"?G.axis??"both":"both"})(),a=window.innerWidth,o=window.innerHeight,l=e.offsetWidth||52,f=e.offsetHeight||52,d=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-left")||"0")||0,v=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-right")||"0")||0,p=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-top")||"0")||0,m=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-bottom")||"0")||0,c=8,g=e.getBoundingClientRect(),x=this.fabPos?.x??0,T=this.fabPos?.y??0,R=g.left-x,S=g.top-T,y=d+c-R,k=a-v-c-l-R,b=p+c-S,I=o-m-c-f-S,W=i==="y"?0:Math.max(y,Math.min(k,r)),N=i==="x"?0:Math.max(b,Math.min(I,n)),_=W;if(s){let G=this.config.draggable;(G===true||typeof G=="object"&&(G.snapToEdge??true))&&i!=="y"&&(_=g.left+l/2<a/2?d+c-R:a-v-c-l-R);}this.fabPos={x:_,y:N},e.style.setProperty("--mushi-drag-x",`${_}px`),e.style.setProperty("--mushi-drag-y",`${N}px`),e.style.setProperty("--mushi-drag-active","1");let K=this.config.draggable;if(K===true||typeof K=="object"&&(K.persist??true))try{localStorage.setItem(this.fabStorageKey(),JSON.stringify(this.fabPos));}catch{}}loadFabPos(){let e=this.config.draggable;if(!(!e||!(e===true||typeof e=="object"&&(e.persist??true))))try{let n=localStorage.getItem(this.fabStorageKey());if(n){let s=JSON.parse(n);typeof s?.x=="number"&&typeof s?.y=="number"&&(this.fabPos=s);}}catch{}}attachDragHandlers(e){this.fabPos===null&&this.loadFabPos();let r=0,n=0,s=0,i=0,a=false,o=false,l=p=>{if(p.button!==0&&p.pointerType!=="touch")return;e.setPointerCapture(p.pointerId),r=p.clientX,n=p.clientY;let m=this.fabPos??{x:0,y:0};s=m.x,i=m.y,a=true,o=false;},f=6,d=p=>{if(!a)return;let m=p.clientX-r,c=p.clientY-n;!o&&Math.hypot(m,c)>f&&(o=true,e.classList.add("dragging"),e.setAttribute("aria-grabbed","true")),o&&(p.preventDefault(),this.moveFab(e,s+m,i+c,false));},v=p=>{if(a){if(a=false,e.classList.remove("dragging"),e.removeAttribute("aria-grabbed"),o){let m=p.clientX-r,c=p.clientY-n;this.moveFab(e,s+m,i+c,true);let g=x=>{x.stopImmediatePropagation(),e.removeEventListener("click",g,{capture:true});};e.addEventListener("click",g,{capture:true});}o=false;}};e.addEventListener("pointerdown",l),e.addEventListener("pointermove",d),e.addEventListener("pointerup",v),e.addEventListener("pointercancel",v);}attachViewportHandlers(e){this.teardownViewportHandlers();let r=window.visualViewport;if(!r)return;let n=()=>{let i=window.innerHeight-r.height-r.offsetTop;i>50?(e.style.setProperty("--mushi-keyboard-inset",`${Math.round(i)}px`),e.classList.add("keyboard-open"),e.querySelector('textarea, input[type="text"]')?.scrollIntoView({block:"nearest",behavior:"smooth"})):(e.style.setProperty("--mushi-keyboard-inset","0px"),e.classList.remove("keyboard-open"));};r.addEventListener("resize",n,{passive:true}),r.addEventListener("scroll",n,{passive:true});let s=()=>requestAnimationFrame(n);e.addEventListener("focusin",s),this.vvCleanup=()=>{r.removeEventListener("resize",n),r.removeEventListener("scroll",n),e.removeEventListener("focusin",s);};}teardownViewportHandlers(){this.vvCleanup?.(),this.vvCleanup=null;}effectiveMinLength(){let e=this.config.minDescriptionLength??20,r=this.config.locale==="auto"?typeof navigator<"u"?navigator.language??"":"":this.config.locale??"";return /^(ja|zh|ko)/i.test(r)?Math.max(4,Math.floor(e/2)):e}tierColor(e){return {free:"#6b7280",explorer:"#3b82f6",contributor:"#8b5cf6",champion:"#f59e0b"}[e]??"#6c47ff"}renderCtx(){return {config:this.config,rewardsState:this.rewardsState,lastReportId:this.lastReportId,reporterLoading:this.reporterLoading,locale:this.locale,testerReputation:this.testerReputation,testerInfo:this.testerInfo,screenshotCapturing:this.screenshotCapturing,screenshotAttached:this.screenshotAttached,reporterError:this.reporterError,magicLinkError:this.magicLinkError,elementCapturing:this.elementCapturing,submitting:this.submitting,sdkFreshness:this.sdkFreshness,screenshotError:this.screenshotError,reporterReports:this.reporterReports,magicLinkSending:this.magicLinkSending,magicLinkEmail:this.magicLinkEmail,globalLeaderboardLoading:this.globalLeaderboardLoading,globalLeaderboard:this.globalLeaderboard,elementSelected:this.elementSelected,crossAppLoading:this.crossAppLoading,callbacks:this.callbacks,testerJwt:this.testerJwt,submittedAt:this.submittedAt,step:this.step,selectedReportId:this.selectedReportId,selectedCategory:this.selectedCategory,sdkVersion:this.sdkVersion,reporterComments:this.reporterComments,magicLinkSent:this.magicLinkSent,leaderboardLoading:this.leaderboardLoading,leaderboardEntries:this.leaderboardEntries,lastSubmitQueuedOffline:this.lastSubmitQueuedOffline,featureBoard:this.featureBoard,crossAppReports:this.crossAppReports,allowScreenshotRemove:this.allowScreenshotRemove,unreadCount:()=>this.unreadCount(),tierColor:e=>this.tierColor(e),resolveCustomCategory:e=>this.resolveCustomCategory(e),effectiveMinLength:()=>this.effectiveMinLength(),categoryLabel:e=>this.categoryLabel(e),categoryIcon:e=>this.categoryIcon(e),assistantTurns:this.assistantTurns,assistantSending:this.assistantSending,assistantError:this.assistantError}}attachHandlers(e){let r=this.locale;e.querySelector('[data-action="close"]')?.addEventListener("click",()=>this.close()),e.querySelector('[data-action="back"]')?.addEventListener("click",()=>{this.step==="intent"?(this.step="category",this.selectedCategory=null):this.step==="details"?this.viaFeatureRequest?(this.step="category",this.selectedCategory=null,this.selectedIntent=null,this.viaFeatureRequest=false):(this.step="intent",this.selectedIntent=null):this.step==="reports"?this.step="category":this.step==="report-detail"?(this.step="reports",this.selectedReportId=null):this.step==="leaderboard"?this.step="reports":this.step==="roadmap"?this.step="category":this.step==="assistant"&&(this.step="category"),this.render();}),e.querySelector('[data-action="assistant"]')?.addEventListener("click",()=>{this.openAssistantTab();}),e.querySelectorAll('[data-action="assistant-suggest"]').forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.value;o&&this.sendAssistantMessage(o);});});{let a=e.querySelector('[data-action="assistant-send"]');if(a){let o=a.querySelector(".mushi-assistant-input");a.addEventListener("submit",l=>{l.preventDefault();let f=o?.value??"";o&&(o.value=""),this.sendAssistantMessage(f);}),o?.addEventListener("keydown",l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),a.requestSubmit());});}}e.querySelector('[data-action="reports"]')?.addEventListener("click",()=>{this.loadReporterReports();}),e.querySelector('[data-action="roadmap"]')?.addEventListener("click",()=>{this.loadFeatureBoard();}),e.querySelectorAll("[data-vote-id]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.voteId;o&&this.voteFeatureBoard(o);});}),e.querySelector('[data-action="feature-request"]')?.addEventListener("click",()=>{this.selectedCategory="other",this.selectedIntent=ot,this.viaFeatureRequest=true,this.step="details",this.render();}),e.querySelectorAll("[data-report-id]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.reportId;o&&this.loadReporterComments(o);});}),e.querySelector('[data-action="open-leaderboard"]')?.addEventListener("click",()=>{this.step="leaderboard",this.callbacks.onLeaderboardOpen?.(),this.callbacks.onGlobalLeaderboardOpen?.(),this.render();}),e.querySelector('[data-action="open-account"]')?.addEventListener("click",()=>{this.step="account",this.render();}),e.querySelector('[data-action="open-cross-app-reports"]')?.addEventListener("click",()=>{this.step="cross-app-reports",this.crossAppLoading=true,this.crossAppReports=null,this.render(),this.callbacks.onCrossAppReportsOpen?this.callbacks.onCrossAppReportsOpen():(this.crossAppLoading=false,this.crossAppReports=[],this.render());}),e.querySelector('[data-action="open-global-leaderboard"]')?.addEventListener("click",()=>{this.step="leaderboard",this.globalLeaderboard=null,this.globalLeaderboardLoading=true,this.render(),this.callbacks.onGlobalLeaderboardOpen?this.callbacks.onGlobalLeaderboardOpen():(this.globalLeaderboardLoading=false,this.globalLeaderboard=[],this.render());}),e.querySelector('[data-action="send-magic-link"]')?.addEventListener("click",()=>{this.handleMagicLinkSend(e);}),e.querySelector('[data-action="resend-magic-link"]')?.addEventListener("click",()=>{this.magicLinkSent=false,this.magicLinkError="",this.render();}),e.querySelector('[data-action="sign-out-tester"]')?.addEventListener("click",()=>{this.testerJwt=null,this.testerInfo=null,this.testerReputation=null,this.crossAppReports=null,this.magicLinkSent=false,this.magicLinkEmail="",this.step="category",this.callbacks.onTesterSignOut?.(),this.render();}),e.querySelector('[data-action="reporter-reply"]')?.addEventListener("click",()=>{this.submitReporterReply(e);}),e.querySelector('[data-action="reporter-confirms"]')?.addEventListener("click",()=>{this.submitReporterFeedback("confirms");}),e.querySelector('[data-action="reporter-not-fixed"]')?.addEventListener("click",()=>{this.submitReporterReopen();}),e.querySelector('[data-action="view-my-reports"]')?.addEventListener("click",()=>{this.loadReporterReports();}),e.querySelector('[data-action="copy-report-id"]')?.addEventListener("click",a=>{let o=a.currentTarget,l=o.dataset.copyId;if(!l)return;let f=o.innerHTML,d=()=>{o.innerHTML="Copied \u2713",window.setTimeout(()=>{o.isConnected&&(o.innerHTML=f);},1600);};try{navigator.clipboard?.writeText?navigator.clipboard.writeText(l).then(d).catch(()=>d()):d();}catch{d();}}),e.querySelectorAll("[data-category]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.category??"other";this.selectedCategory=o;let l=this.resolveCustomCategory(o);this.step=l&&(!l.intents||l.intents.length===0)?"details":"intent",this.render();});}),e.querySelectorAll("[data-intent]").forEach(a=>{a.addEventListener("click",()=>{this.selectedIntent=a.dataset.intent??null,this.step="details",this.render();});});let n=e.querySelector(".mushi-textarea"),s=e.querySelector('[data-role="char-current"]');if(n&&s){let a=this.effectiveMinLength(),o=()=>{let l=n.value.trim().length;s.textContent=String(l);let f=e.querySelector('[data-role="char-counter"]');f&&(f.style.color=l>=a?"var(--mushi-ok, #22c55e)":"");};n.addEventListener("input",o);}e.querySelectorAll("[data-example]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.example??"";n&&(n.value=o,n.focus(),n.dispatchEvent(new Event("input")));});}),e.querySelector('[data-action="screenshot"]')?.addEventListener("click",()=>{this.callbacks.onScreenshotRequest();}),e.querySelector('[data-action="remove-screenshot"]')?.addEventListener("click",()=>{this.callbacks.onScreenshotRemove?.();}),e.querySelector('[data-action="annotate-screenshot"]')?.addEventListener("click",()=>{let a=e.querySelector('[data-role="annotate-host"]');a&&this.callbacks.onScreenshotAnnotateRequest&&this.callbacks.onScreenshotAnnotateRequest(a);}),e.querySelector('[data-action="element"]')?.addEventListener("click",()=>{this.callbacks.onElementSelectorRequest?.();});let i=()=>{let a=e.querySelector(".mushi-textarea"),o=a?.value?.trim()??"",l=e.querySelector(".mushi-error"),f=this.effectiveMinLength();if(o.length<f){if(l){let v=`${r.step3.tooShort} (${o.length}/${f})`;l.textContent=v,l.style.display="block",a?.focus();}return}this.submitting=true,this.submittedAt=new Date,this.lastReportId=null,this.lastSubmitQueuedOffline=false,this.render();let d=(async()=>{try{let v=this.selectedCategory,p=this.resolveBaseCategory(v),m=this.config.categories&&this.config.categories.length>0,c=this.callbacks.onSubmit({category:p,...m?{userCategory:v}:{},description:o,intent:this.selectedIntent??void 0});return c&&typeof c.then=="function"?await c??null:null}catch{return {reportId:null,queuedOffline:true}}})();this.successTimer=setTimeout(()=>{this.successTimer=null,this.submitting=false,this.step="success",this.render(),d.then(v=>{if(this.step!=="success")return;v&&(this.lastReportId=v.reportId??null,this.lastSubmitQueuedOffline=!!v.queuedOffline,this.render()),this.autoCloseTimer!==null&&clearTimeout(this.autoCloseTimer);let p=this.lastReportId&&this.config.dashboardUrl?6e3:2800;this.autoCloseTimer=setTimeout(()=>{this.autoCloseTimer=null,this.step==="success"&&this.close();},p);});},500);};e.querySelector('[data-action="submit"]')?.addEventListener("click",i),e.addEventListener("keydown",a=>{if(a.key==="Escape"){this.close();return}this.step==="details"&&Er(a)&&(a.preventDefault(),i());});}trapFocus(e){requestAnimationFrame(()=>{let r=e.querySelector("textarea");if(r){r.focus();return}let n=e.querySelectorAll("button, textarea, [tabindex]");n.length>0&&n[0].focus();});}unreadCount(){return this.reporterReports.reduce((e,r)=>e+(r.unread_count??0),0)}async loadFeatureBoard(){this.step="roadmap",this.reporterLoading=true,this.reporterError=null,this.render();try{this.featureBoard=await this.callbacks.onFeatureBoardRequest?.()??[];}catch(e){this.reporterError=e instanceof Error?e.message:"Could not load community ideas.";}finally{this.reporterLoading=false,this.render();}}async voteFeatureBoard(e){if(!(!this.callbacks.onFeatureBoardVote||this.reporterLoading)){this.reporterLoading=true,this.render();try{await this.callbacks.onFeatureBoardVote(e),this.featureBoard=await this.callbacks.onFeatureBoardRequest?.()??this.featureBoard;}catch(r){this.reporterError=r instanceof Error?r.message:"Could not update vote.";}finally{this.reporterLoading=false,this.render();}}}async submitReporterReopen(){let e=this.selectedReportId;if(!(!e||this.reporterLoading)){this.reporterLoading=true,this.render();try{this.callbacks.onReporterReopen?await this.callbacks.onReporterReopen(e,"Not fixed for me"):await this.callbacks.onReporterFeedback?.(e,"not_fixed","Not fixed for me"),await this.loadReporterReports();}catch(r){this.reporterError=r instanceof Error?r.message:"Could not reopen report.";}finally{this.reporterLoading=false,this.render();}}}async loadReporterReports(){this.step="reports",this.reporterLoading=true,this.reporterError=null,this.render();try{this.reporterReports=await this.callbacks.onReporterReportsRequest?.()??[];}catch(e){this.reporterError=e instanceof Error?e.message:"Could not load reports.";}finally{this.reporterLoading=false,this.render();}}async loadReporterComments(e){this.selectedReportId=e,this.step="report-detail",this.reporterLoading=true,this.reporterError=null,this.render();try{this.reporterComments=await this.callbacks.onReporterCommentsRequest?.(e)??[];}catch(r){this.reporterError=r instanceof Error?r.message:"Could not load thread.";}finally{this.reporterLoading=false,this.render();}}async submitReporterFeedback(e){let r=this.selectedReportId;if(!(!r||this.reporterLoading)){this.reporterLoading=true,this.render();try{await this.callbacks.onReporterFeedback?.(r,e),await this.loadReporterReports(),r&&await this.loadReporterComments(r);}catch(n){this.reporterError=n instanceof Error?n.message:"Could not send feedback.",this.reporterLoading=false,this.render();}}}async submitReporterReply(e){let r=this.selectedReportId,n=e.querySelector('[data-role="reporter-reply"]'),s=e.querySelector('[data-action="reporter-reply"]'),i=n?.value.trim()??"";if(!(!r||!i||this.reporterLoading)){this.reporterLoading=true,s&&(s.disabled=true),this.render();try{await this.callbacks.onReporterReply?.(r,i),n&&(n.value=""),await this.loadReporterComments(r);}catch(a){this.reporterError=a instanceof Error?a.message:"Could not send reply.",this.reporterLoading=false,this.render();}}}async handleMagicLinkSend(e){if(this.magicLinkSending)return;let n=(e.querySelector('[data-role="magic-link-email"]')?.value??this.magicLinkEmail).trim();if(!n||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)){this.magicLinkError="Please enter a valid email address.",this.render();return}this.magicLinkEmail=n,this.magicLinkError="",this.magicLinkSending=true,this.render();try{await this.callbacks.onMushiSignIn?.(n),this.magicLinkSent=!0;}catch(s){this.magicLinkError=s instanceof Error?s.message:"Could not send sign-in link. Try again.";}finally{this.magicLinkSending=false,this.render();}}getRecorderStep(){return this.step}getRecorderTrigger(){return this.shadow.querySelector(".mushi-trigger")}getRecorderCategoryButton(e){return this.shadow.querySelector(`[data-category="${e}"]`)}getRecorderIntentButton(e){return Array.from(this.shadow.querySelectorAll("[data-intent]")).find(r=>r.dataset.intent===e)??null}getRecorderSubmitButton(){return this.shadow.querySelector('[data-action="submit"]')}recorderClickTrigger(){this.isOpen&&this.close(),this.open();}openReporter(){this.isOpen||(this.isOpen=true,this.render()),this.loadReporterReports();}recorderSelectCategory(e){this.isOpen||this.open(),this.step!=="category"&&(this.selectedCategory=null,this.selectedIntent=null,this.step="category",this.render()),this.selectedCategory=e,this.step="intent",this.render();}recorderSelectIntent(e){!this.isOpen||this.step!=="intent"||(this.selectedIntent=e,this.step="details",this.render());}recorderFocusDescription(){this.shadow.querySelector(".mushi-textarea")?.focus();}recorderSubmit(){this.shadow.querySelector('[data-action="submit"]')?.click();}recorderOpenMyReports(){this.isOpen||this.open(),this.loadReporterReports();}};function qe(t){if(!t)return null;let e=t.getBoundingClientRect();return e.width===0&&e.height===0?null:{x:e.left+e.width/2,y:e.top+e.height/2}}function Mr(t){if(typeof globalThis>"u")return;let e={ready:()=>t.getIsMounted(),getStep:()=>t.getRecorderStep(),getTriggerCenter:()=>qe(t.getRecorderTrigger()),getCategoryCenter:r=>qe(t.getRecorderCategoryButton(r)),getIntentCenter:r=>qe(t.getRecorderIntentButton(r)),getSubmitCenter:()=>qe(t.getRecorderSubmitButton()),clickTrigger:()=>t.recorderClickTrigger(),selectCategory:r=>t.recorderSelectCategory(r),selectIntent:r=>t.recorderSelectIntent(r),focusDescription:()=>t.recorderFocusDescription(),submit:()=>t.recorderSubmit(),openMyReports:()=>t.recorderOpenMyReports()};globalThis.__mushiRecorder=e;}var Pr="mushi_session_min_day_",Me=[],lt=null,ct=null,ce=null,pt=null,Dr=null,xe=null,fe=false,Le=null,ht=0,Is=300*1e3,Or=0,As=900*1e3;function mt(){return Date.now()<Or}function gt(t){t?.startsWith("HTTP_4")&&(Or=Date.now()+As);}var Lr=new Set;function ut(t){return `mushi_rewards_consent_${t}`}function _s(t){try{return localStorage.getItem(ut(t))==="1"}catch{return false}}function dt(t,e){try{e?localStorage.setItem(ut(t),"1"):localStorage.removeItem(ut(t)),fe=e,xe?.submitActivity(ce??"",[],{optedIn:e}).catch(()=>{});}catch{}}function Hr(){return new Date().toISOString().slice(0,10)}function Br(t){try{let e=sessionStorage.getItem(`${Pr}${t}_${Hr()}`);return e?parseInt(e,10):0}catch{return 0}}function Ps(t){let e=Hr(),r=`${Pr}${t}_${e}`;try{let n=Br(t)+1;return sessionStorage.setItem(r,String(n)),n}catch{return 99}}function Nr(t){xe=t.client,ce=t.userId,pt=t.traits??null,Dr=t.reporterToken??null;let{projectId:e}=t,r=Math.max(3e4,t.config.flushIntervalMs??3e5);t.config.consentMode==="auto"?(fe=true,dt(e,true)):fe=_s(e),t.config.trackActivity&&Hs(e),lt&&clearInterval(lt),lt=setInterval(()=>Ds(t),r),ct&&clearInterval(ct),ct=setInterval(()=>{if(!fe||!ce)return;let n=Br(e);n<60&&(Ps(e),Se({action:"session_minute",metadata:{minutes_today:n+1}}));},6e4),t.config.showInWidget&&ft(ce).then(n=>{n&&jr(n,t.config);}),t.config.consentMode!=="auto"&&!fe&&Bs(e,t.config);}function Fr(t,e){ce=t,pt=e??null,Le=null,ht=0;}function Se(t){!fe||!ce||Me.push({...t,queuedAt:Date.now()});}async function Ds(t){if(!fe||!ce||Me.length===0)return;let e=null;if(t.config.verifyUserToken)try{e=await t.config.verifyUserToken();}catch{}if(mt())return;let r=Me.splice(0,100);try{let n=await t.client.submitActivity(ce,r,{userTraits:pt??void 0,reporterTokenHash:Dr??void 0,optedIn:!0,hostJwt:e??void 0});n.ok||(gt(n.error?.code),n.error?.code?.startsWith("HTTP_4")||Me.unshift(...r.slice(0,50)));}catch{Me.unshift(...r.slice(0,50));}}async function Ur(t){let e=Date.now();return Le&&e-ht<Is?Le:ft(t)}async function ft(t){if(!xe||mt())return null;let e=await xe.getMyTier(t);return e.ok&&e.data?(Le=e.data,ht=Date.now(),Le):(gt(e.error?.code),null)}async function qr(t=10){if(!xe||mt())return null;try{let e=await xe.getHallOfFame(t);return e.ok&&e.data?(e.data.data??[]).map(r=>({display_name:r.display_name,tier_name:r.tier_name,total_points:r.total_points,points_30d:r.points_30d})):(gt(e.error?.code),null)}catch{return null}}var $r=null,Ir=null,Ar=null,_r="";function Hs(t){let e=()=>{let n=location.pathname;if(n===_r)return;_r=n,!Lr.has(`${t}:${n}`)&&(Lr.add(`${t}:${n}`),Se({action:"screen_view_unique_per_day",metadata:{route:n}}));};Ar=history.pushState.bind(history),history.pushState=function(...n){Ar(...n),e();},window.addEventListener("popstate",e),e(),$r=new MutationObserver(()=>e());let r=document.querySelector("main")??document.body;$r.observe(r,{childList:true,subtree:false}),Ir=n=>{let s=n.target.closest("[data-testid]");if(!s)return;let i=s.dataset.testid;i&&Se({action:"element_selected",metadata:{testid:i,route:location.pathname}});},document.addEventListener("click",Ir,{capture:true,passive:true});}var ge=null;function jr(t,e){if(!e.showInWidget)return;ge&&ge.remove(),ge=document.createElement("div"),ge.id="mushi-tier-badge",Object.assign(ge.style,{position:"fixed",bottom:"56px",right:"16px",zIndex:"2147483645",fontFamily:"system-ui, sans-serif"});let r=ge.attachShadow({mode:"closed"});r.innerHTML=`
2148
+ `,n.textContent=this.locale.step3.tooShort.startsWith("A bit")?"Found a bug? One sentence is enough \u{1F41B}":"\u30D0\u30B0\u3092\u898B\u3064\u3051\u305F\uFF1F\u4E00\u884C\u3067\u5927\u4E08\u592B\u3067\u3059 \u{1F41B}",document.body.appendChild(n),this.nudgeEl=n,this.nudgeTimer!==null&&clearTimeout(this.nudgeTimer),this.nudgeTimer=setTimeout(()=>this.removeNudge(),5e3);}removeNudge(){this.nudgeTimer!==null&&(clearTimeout(this.nudgeTimer),this.nudgeTimer=null),this.nudgeEl?.remove(),this.nudgeEl=null,document.getElementById("mushi-nudge-bubble")?.remove();}setSdkFreshness(e){this.sdkFreshness=e,this.isOpen&&this.render();}setRewardsState(e){this.rewardsState=e,this.isOpen&&this.render();}setLeaderboard(e,r=false){this.leaderboardEntries=e,this.leaderboardLoading=r,this.isOpen&&this.step==="leaderboard"&&this.render();}setTesterSession(e,r){this.testerJwt=e,this.testerInfo=r,this.isOpen&&this.render();}setGlobalLeaderboard(e,r=false){this.globalLeaderboard=e,this.globalLeaderboardLoading=r,this.isOpen&&(this.step==="leaderboard"||this.step==="account")&&this.render();}setCrossAppReports(e,r=false){this.crossAppReports=e,this.crossAppLoading=r,this.isOpen&&this.step==="cross-app-reports"&&this.render();}setTesterReputation(e){this.testerReputation=e,this.isOpen&&(this.step==="account"||this.step==="leaderboard")&&this.render();}destroy(){this.successTimer!==null&&(clearTimeout(this.successTimer),this.successTimer=null),this.autoCloseTimer!==null&&(clearTimeout(this.autoCloseTimer),this.autoCloseTimer=null),this.smartHideTimer!==null&&(clearTimeout(this.smartHideTimer),this.smartHideTimer=null),this.smartHideCleanup?.(),this.smartHideCleanup=null,this.teardownViewportHandlers(),this.attachedLaunchers.forEach(e=>e()),this.attachedLaunchers=[],this.removeSelectorHint(),this.removeNudge(),this.removeBodyNudge(),this.host.remove();}syncHostChromeState(){let e=this.host.style;e.setProperty("position","fixed"),e.setProperty("top","0"),e.setProperty("left","0"),e.setProperty("width","0"),e.setProperty("height","0"),e.setProperty("overflow","visible"),e.setProperty("pointer-events","none"),e.setProperty("z-index",String(this.config.zIndex)),e.setProperty("margin","0"),e.setProperty("padding","0"),e.setProperty("border","none"),e.setProperty("background","none");}isSuppressedByHost(){if(!this.config.hideOnSelector||typeof document>"u")return false;try{return !!document.querySelector(this.config.hideOnSelector)}catch{return false}}getWidgetDiagnostics(){let e=this.host.style,r=e.pointerEvents==="none"&&(e.width==="0"||e.width==="0px")&&(e.height==="0"||e.height==="0px"),n=this.host.isConnected?{width:this.host.offsetWidth,height:this.host.offsetHeight}:null,s=this.isSuppressedByHost()||this.isRouteHidden()||!this.triggerVisible,i=this.config.trigger==="banner"&&!this.bannerDismissed&&!this.isSuppressedByHost()&&!this.isRouteHidden()&&this.triggerVisible;return {widgetHostPointerSafe:r,widgetHostBounds:n,widgetSuppressed:s,bannerRendered:i}}syncAttachedLaunchers(){this.attachedLaunchers.forEach(e=>e()),this.attachedLaunchers=[],!(this.config.trigger!=="attach"||!this.config.attachToSelector)&&(typeof document>"u"||this.attachedLaunchers.push(this.attachTo(this.config.attachToSelector)));}syncSmartHide(){if(this.smartHideCleanup?.(),this.smartHideCleanup=null,this.triggerShrunk=false,this.triggerHiddenByScroll=false,!this.config.smartHide||typeof window>"u")return;let e=this.config.smartHide===true?{onScroll:"shrink",onIdleMs:900}:this.config.smartHide;if(!e.onScroll)return;let r=()=>{e.onScroll==="hide"?this.triggerHiddenByScroll=true:this.triggerShrunk=true,this.render(),this.smartHideTimer!==null&&clearTimeout(this.smartHideTimer),this.smartHideTimer=setTimeout(()=>{this.triggerHiddenByScroll=false,this.triggerShrunk=false,this.render();},e.onIdleMs??900);};window.addEventListener("scroll",r,{passive:true}),this.smartHideCleanup=()=>window.removeEventListener("scroll",r);}shouldRenderTrigger(){if(!this.triggerVisible||this.triggerHiddenByScroll||this.config.trigger==="manual"||this.config.trigger==="hidden"||this.config.trigger==="attach"||this.config.trigger==="banner"||this.isMobileSmartHidden()||this.isRouteHidden()||this.isSuppressedByHost())return false;let e=this.config.environments[this.detectEnvironment()];return e!=="never"&&e!=="manual"}static BANNER_HEIGHT=36;static BODY_NUDGE_PROP="--mushi-banner-offset";applyBodyNudge(e,r=t.BANNER_HEIGHT){let n=`${r}px`;document.documentElement.style.setProperty(t.BODY_NUDGE_PROP,n),e==="top"?document.body.dataset.mushiBannerNudged==="top"?document.body.style.paddingTop=n:document.body.style.paddingTop||(document.body.style.paddingTop=n,document.body.dataset.mushiBannerNudged="top"):document.body.dataset.mushiBannerNudged==="bottom"?document.body.style.paddingBottom=n:document.body.style.paddingBottom||(document.body.style.paddingBottom=n,document.body.dataset.mushiBannerNudged="bottom");}trackBannerHeight(e,r){let n=()=>{let s=e.getBoundingClientRect().height;s>0&&this.applyBodyNudge(r,s);};requestAnimationFrame(n),typeof ResizeObserver<"u"&&(this.bannerResizeObserver=new ResizeObserver(n),this.bannerResizeObserver.observe(e));}removeBodyNudge(){this.bannerResizeObserver?.disconnect(),this.bannerResizeObserver=null,document.documentElement.style.removeProperty(t.BODY_NUDGE_PROP);let e=document.body.dataset.mushiBannerNudged;e==="top"?(document.body.style.paddingTop="",delete document.body.dataset.mushiBannerNudged):e==="bottom"&&(document.body.style.paddingBottom="",delete document.body.dataset.mushiBannerNudged);}renderBanner(){if(this.config.trigger!=="banner")return;if(this.bannerDismissed){this.removeBodyNudge();return}if(!this.triggerVisible){this.removeBodyNudge();return}if(this.isRouteHidden()){this.removeBodyNudge();return}if(this.isSuppressedByHost()){this.removeBodyNudge();return}let e=this.config.bannerConfig??{},r=e.variant??"brand",n=e.position??"top",s=e.message?.trim()??"",i=s.length>0,a=e.bugCta??"\u{1F41B} Report a bug",o=e.featureCta!==false,l=e.featureCtaLabel??"Request feature",f=e.zIndex??(this.config.zIndex??99999)-1,p=document.createElement("div");p.className=`mushi-banner ${r} ${n}${i?" mushi-banner--rich":""}`,p.style.setProperty("--mushi-banner-z",String(f)),p.setAttribute("role","banner");let v=document.createElement("button");if(v.className="mushi-banner-dismiss",v.textContent="\u2715",v.setAttribute("aria-label","Dismiss feedback banner"),v.addEventListener("click",()=>{this.bannerDismissed=true,this.removeBodyNudge(),this.render();}),i){let d=document.createElement("div");d.className="mushi-banner-body";let m=e.label===false?null:e.label??"Beta";if(m){let R=document.createElement("span");R.className="mushi-banner-pill",R.textContent=m,d.appendChild(R);}let c=document.createElement("span");c.className="mushi-banner-message",c.textContent=s,d.appendChild(c),p.appendChild(d);let g=document.createElement("nav");g.className="mushi-banner-actions",g.setAttribute("aria-label","Feedback banner actions");let x=(R=false)=>{let S=document.createElement("span");S.className=`mushi-banner-divider${R?" mushi-banner-extra":""}`,S.setAttribute("aria-hidden","true"),S.textContent="|",g.appendChild(S);},C=(R,S,y=false)=>{let k=document.createElement("button");k.type="button",k.className=`mushi-banner-link${y?" mushi-banner-extra":""}`,k.textContent=R,k.addEventListener("click",S),g.appendChild(k);};C(a,()=>this.open()),o&&(x(true),C(l,()=>this.open({featureRequest:true}),true));for(let R of e.links??[]){let S=R.label?.trim();if(!S)continue;let y=R.href&&(/^https?:\/\//i.test(R.href)||R.href.startsWith("/"))?R.href:void 0;if(x(true),y){let k=document.createElement("a");k.className="mushi-banner-link mushi-banner-extra",k.href=y,k.textContent=S,k.target="_blank",k.rel="noopener noreferrer",g.appendChild(k);}else C(S,()=>{R.featureRequest?this.open({featureRequest:true}):this.open();},true);}x(true),C("\u{1F4EC} My reports",()=>this.openReporter(),true),p.appendChild(g),p.appendChild(v);}else {let d=document.createElement("button");if(d.className="mushi-banner-btn",d.textContent=a,d.addEventListener("click",()=>this.open()),p.appendChild(d),o){let c=document.createElement("button");c.className="mushi-banner-btn",c.textContent=l,c.addEventListener("click",()=>this.open({featureRequest:true})),p.appendChild(c);}let m=document.createElement("button");m.className="mushi-banner-my-reports",m.textContent="\u{1F4EC} My reports",m.setAttribute("aria-label","View my submitted reports"),m.addEventListener("click",()=>this.openReporter()),p.appendChild(m),p.appendChild(v);}this.shadow.appendChild(p),this.applyBodyNudge(n),this.trackBannerHeight(p,n);}effectiveTrigger(){if(!this.config.smartHide||typeof window>"u")return this.config.trigger;let e=this.config.smartHide===true?{onMobile:"edge-tab"}:this.config.smartHide;return window.matchMedia("(max-width: 768px)").matches&&e.onMobile==="edge-tab"?"edge-tab":this.config.trigger}isMobileSmartHidden(){if(!this.config.smartHide||typeof window>"u")return false;let e=this.config.smartHide===true?{onMobile:"edge-tab"}:this.config.smartHide;return window.matchMedia("(max-width: 768px)").matches&&e.onMobile==="hide"}detectEnvironment(){let e=typeof location<"u"?location.hostname:"";return e==="localhost"||e==="127.0.0.1"||e.endsWith(".local")?"development":/\b(staging|stage|preview|dev)\b/i.test(e)?"staging":"production"}isRouteHidden(){return !this.config.hideOnRoutes.length||typeof location>"u"?false:this.config.hideOnRoutes.some(e=>location.pathname.includes(e))}getTheme(){let e=this.config.theme;if(e==="light"||e==="dark")return e;if(e==="inherit"){let r=document.documentElement,n=r.getAttribute("data-color-scheme")||r.getAttribute("data-theme")||r.getAttribute("color-scheme")||"";if(/dark/i.test(n))return "dark";if(/light/i.test(n))return "light";if(r.classList.contains("dark"))return "dark";if(r.classList.contains("light"))return "light";try{let i=getComputedStyle(r).backgroundColor.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(i)return .299*+i[1]+.587*+i[2]+.114*+i[3]<128?"dark":"light"}catch{}}return typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}render(){let e=this.getTheme(),r=this.config.position,n=this.locale;this.bannerResizeObserver?.disconnect(),this.bannerResizeObserver=null,this.shadow.innerHTML="";let s=document.createElement("style");if(s.textContent=Er(e,this.config.accent??"",this.config.accentText??""),this.shadow.appendChild(s),this.renderBanner(),this.shouldRenderTrigger()){let a=this.effectiveTrigger(),o=document.createElement("button");if(o.className=`mushi-trigger ${r}${a==="edge-tab"?" edge-tab":""}${this.triggerShrunk?" shrunk":""}`,o.textContent=this.config.triggerText,o.setAttribute("aria-label",n.widget.trigger),o.setAttribute("aria-haspopup","dialog"),o.setAttribute("aria-expanded",String(this.isOpen)),o.style.zIndex=String(this.config.zIndex),this.applyInsetVars(o),o.addEventListener("click",()=>{this.removeNudge(),this.isOpen?this.close():this.open();}),o.addEventListener("mouseenter",()=>{let l=this.mountedAt?Date.now()-this.mountedAt:0;!this.nudgeShown&&!this.isOpen&&l>=3e4&&this.showNudge();}),o.addEventListener("mouseleave",()=>{this.nudgeEl&&(this.nudgeTimer!==null&&clearTimeout(this.nudgeTimer),this.nudgeTimer=setTimeout(()=>this.removeNudge(),2e3));}),o.addEventListener("keydown",l=>{let f=this.config.draggable;if(!f)return;let p=8,v=typeof f=="object"?f.axis??"both":"both",d=0,m=0;if(v!=="y"&&(l.key==="ArrowLeft"?d=-p:l.key==="ArrowRight"&&(d=p)),v!=="x"&&(l.key==="ArrowUp"?m=-p:l.key==="ArrowDown"&&(m=p)),d!==0||m!==0){l.preventDefault();let c=this.fabPos??{x:0,y:0};this.moveFab(o,c.x+d,c.y+m,false);}}),this.config.draggable&&this.attachDragHandlers(o),this.shadow.appendChild(o),this.fabPos&&this.config.draggable){let l=this.fabPos;this.fabPos={x:0,y:0},this.moveFab(o,l.x,l.y,false);}}let i=document.createElement("div");if(i.className=`mushi-panel ${r}${this.isOpen?" open":" closed"}`,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-label",n.widget.title),i.style.zIndex=String(this.config.zIndex+1),this.applyInsetVars(i),this.isOpen){let a=this.renderCtx();i.innerHTML=`${Mr(a)}${Tr(a)}${$r(a)}`,this.shadow.appendChild(i),this.attachHandlers(i),this.trapFocus(i),this.attachViewportHandlers(i);}else this.teardownViewportHandlers();}computeAvoidTopPx(e=8){let r=this.config.avoidSelectors;if(!r?.length)return null;let n=0;for(let s of r)try{let i=document.querySelector(s);if(!i)continue;let a=i.getBoundingClientRect();a.bottom>n&&a.width>0&&a.height>0&&(n=a.bottom);}catch{}return n>0?Math.ceil(n)+e:null}computeAvoidBottomPx(e=8){let r=this.config.avoidSelectors;if(!r?.length)return null;let n=0;for(let s of r)try{let i=document.querySelector(s);if(!i)continue;let a=i.getBoundingClientRect();if(a.width>0&&a.height>0){let o=window.innerHeight-a.top+e;o>n&&(n=o);}}catch{}return n>0?Math.ceil(n):null}applyInsetVars(e){let{anchor:r}=this.config;if(r&&Object.keys(r).length>0)["top","right","bottom","left"].forEach(i=>{let a=r[i];a!==void 0&&e.style.setProperty(`--mushi-${i}`,a);}),e.style.setProperty("--mushi-safe-area",this.config.respectSafeArea?"1":"0");else {let{inset:i}=this.config;this.config.respectSafeArea||["top","right","bottom","left"].forEach(a=>{i[a]===void 0&&e.style.setProperty(`--mushi-${a}`,"24px");}),["top","right","bottom","left"].forEach(a=>{let o=i[a];o!==void 0&&e.style.setProperty(`--mushi-${a}`,o==="auto"?"auto":`${o}px`);}),e.style.setProperty("--mushi-safe-area",this.config.respectSafeArea?"1":"0");}let n=r?.top!==void 0||this.config.position?.startsWith("top"),s=r?.bottom!==void 0||this.config.position?.startsWith("bottom")||!this.config.position;if(n){let i=this.computeAvoidTopPx();i!==null&&e.style.setProperty("--mushi-top",`${i}px`);}if(s){let i=this.computeAvoidBottomPx();i!==null&&e.style.setProperty("--mushi-bottom",`${i}px`);}}fabStorageKey(){let e=this.config.projectId??"";return `mushi_fab_pos${e?`_${e}`:""}`}moveFab(e,r,n,s){let i=(()=>{let V=this.config.draggable;return V&&typeof V=="object"?V.axis??"both":"both"})(),a=window.innerWidth,o=window.innerHeight,l=e.offsetWidth||52,f=e.offsetHeight||52,p=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-left")||"0")||0,v=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-right")||"0")||0,d=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-top")||"0")||0,m=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-bottom")||"0")||0,c=8,g=e.getBoundingClientRect(),x=this.fabPos?.x??0,C=this.fabPos?.y??0,R=g.left-x,S=g.top-C,y=p+c-R,k=a-v-c-l-R,b=d+c-S,P=o-m-c-f-S,H=i==="y"?0:Math.max(y,Math.min(k,r)),U=i==="x"?0:Math.max(b,Math.min(P,n)),D=H;if(s){let V=this.config.draggable;(V===true||typeof V=="object"&&(V.snapToEdge??true))&&i!=="y"&&(D=g.left+l/2<a/2?p+c-R:a-v-c-l-R);}this.fabPos={x:D,y:U},e.style.setProperty("--mushi-drag-x",`${D}px`),e.style.setProperty("--mushi-drag-y",`${U}px`),e.style.setProperty("--mushi-drag-active","1");let G=this.config.draggable;if(G===true||typeof G=="object"&&(G.persist??true))try{localStorage.setItem(this.fabStorageKey(),JSON.stringify(this.fabPos));}catch{}}loadFabPos(){let e=this.config.draggable;if(!(!e||!(e===true||typeof e=="object"&&(e.persist??true))))try{let n=localStorage.getItem(this.fabStorageKey());if(n){let s=JSON.parse(n);typeof s?.x=="number"&&typeof s?.y=="number"&&(this.fabPos=s);}}catch{}}attachDragHandlers(e){this.fabPos===null&&this.loadFabPos();let r=0,n=0,s=0,i=0,a=false,o=false,l=d=>{if(d.button!==0&&d.pointerType!=="touch")return;e.setPointerCapture(d.pointerId),r=d.clientX,n=d.clientY;let m=this.fabPos??{x:0,y:0};s=m.x,i=m.y,a=true,o=false;},f=6,p=d=>{if(!a)return;let m=d.clientX-r,c=d.clientY-n;!o&&Math.hypot(m,c)>f&&(o=true,e.classList.add("dragging"),e.setAttribute("aria-grabbed","true")),o&&(d.preventDefault(),this.moveFab(e,s+m,i+c,false));},v=d=>{if(a){if(a=false,e.classList.remove("dragging"),e.removeAttribute("aria-grabbed"),o){let m=d.clientX-r,c=d.clientY-n;this.moveFab(e,s+m,i+c,true);let g=x=>{x.stopImmediatePropagation(),e.removeEventListener("click",g,{capture:true});};e.addEventListener("click",g,{capture:true});}o=false;}};e.addEventListener("pointerdown",l),e.addEventListener("pointermove",p),e.addEventListener("pointerup",v),e.addEventListener("pointercancel",v);}attachViewportHandlers(e){this.teardownViewportHandlers();let r=window.visualViewport;if(!r)return;let n=()=>{let i=window.innerHeight-r.height-r.offsetTop;i>50?(e.style.setProperty("--mushi-keyboard-inset",`${Math.round(i)}px`),e.classList.add("keyboard-open"),e.querySelector('textarea, input[type="text"]')?.scrollIntoView({block:"nearest",behavior:"smooth"})):(e.style.setProperty("--mushi-keyboard-inset","0px"),e.classList.remove("keyboard-open"));};r.addEventListener("resize",n,{passive:true}),r.addEventListener("scroll",n,{passive:true});let s=()=>requestAnimationFrame(n);e.addEventListener("focusin",s),this.vvCleanup=()=>{r.removeEventListener("resize",n),r.removeEventListener("scroll",n),e.removeEventListener("focusin",s);};}teardownViewportHandlers(){this.vvCleanup?.(),this.vvCleanup=null;}effectiveMinLength(){let e=this.config.minDescriptionLength??20,r=this.config.locale==="auto"?typeof navigator<"u"?navigator.language??"":"":this.config.locale??"";return /^(ja|zh|ko)/i.test(r)?Math.max(4,Math.floor(e/2)):e}tierColor(e){return {free:"#6b7280",explorer:"#3b82f6",contributor:"#8b5cf6",champion:"#f59e0b"}[e]??"#6c47ff"}renderCtx(){return {config:this.config,rewardsState:this.rewardsState,lastReportId:this.lastReportId,reporterLoading:this.reporterLoading,locale:this.locale,testerReputation:this.testerReputation,testerInfo:this.testerInfo,screenshotCapturing:this.screenshotCapturing,screenshotAttached:this.screenshotAttached,reporterError:this.reporterError,magicLinkError:this.magicLinkError,elementCapturing:this.elementCapturing,submitting:this.submitting,sdkFreshness:this.sdkFreshness,screenshotError:this.screenshotError,reporterReports:this.reporterReports,magicLinkSending:this.magicLinkSending,magicLinkEmail:this.magicLinkEmail,globalLeaderboardLoading:this.globalLeaderboardLoading,globalLeaderboard:this.globalLeaderboard,elementSelected:this.elementSelected,crossAppLoading:this.crossAppLoading,callbacks:this.callbacks,testerJwt:this.testerJwt,submittedAt:this.submittedAt,step:this.step,selectedReportId:this.selectedReportId,selectedCategory:this.selectedCategory,sdkVersion:this.sdkVersion,reporterComments:this.reporterComments,magicLinkSent:this.magicLinkSent,leaderboardLoading:this.leaderboardLoading,leaderboardEntries:this.leaderboardEntries,lastSubmitQueuedOffline:this.lastSubmitQueuedOffline,featureBoard:this.featureBoard,crossAppReports:this.crossAppReports,allowScreenshotRemove:this.allowScreenshotRemove,unreadCount:()=>this.unreadCount(),tierColor:e=>this.tierColor(e),resolveCustomCategory:e=>this.resolveCustomCategory(e),effectiveMinLength:()=>this.effectiveMinLength(),categoryLabel:e=>this.categoryLabel(e),categoryIcon:e=>this.categoryIcon(e),assistantTurns:this.assistantTurns,assistantSending:this.assistantSending,assistantError:this.assistantError,showAllCategories:this.showAllCategories}}attachHandlers(e){let r=this.locale;e.querySelector('[data-action="close"]')?.addEventListener("click",()=>this.close()),e.querySelector('[data-action="back"]')?.addEventListener("click",()=>{this.step==="intent"?(this.step="category",this.selectedCategory=null):this.step==="details"?this.viaFeatureRequest?(this.step="category",this.selectedCategory=null,this.selectedIntent=null,this.viaFeatureRequest=false):(this.step="intent",this.selectedIntent=null):this.step==="reports"?this.step="category":this.step==="report-detail"?(this.step="reports",this.selectedReportId=null):this.step==="leaderboard"?this.step="reports":this.step==="roadmap"?this.step="category":this.step==="assistant"?this.step="category":this.step==="account"?this.step="category":this.step==="cross-app-reports"?this.step="account":this.step==="success"&&(this.step="category",this.selectedCategory=null,this.selectedIntent=null,this.viaFeatureRequest=false),this.render();}),e.querySelector('[data-action="show-all-categories"]')?.addEventListener("click",()=>{this.showAllCategories=true,this.render();}),e.querySelector('[data-action="assistant"]')?.addEventListener("click",()=>{this.openAssistantTab();}),e.querySelectorAll('[data-action="assistant-suggest"]').forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.value;o&&this.sendAssistantMessage(o);});});{let a=e.querySelector('[data-action="assistant-send"]');if(a){let o=a.querySelector(".mushi-assistant-input");a.addEventListener("submit",l=>{l.preventDefault();let f=o?.value??"";o&&(o.value=""),this.sendAssistantMessage(f);}),o?.addEventListener("keydown",l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),a.requestSubmit());});}}e.querySelector('[data-action="reports"]')?.addEventListener("click",()=>{this.loadReporterReports();}),e.querySelector('[data-action="roadmap"]')?.addEventListener("click",()=>{this.loadFeatureBoard();}),e.querySelectorAll("[data-vote-id]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.voteId;o&&this.voteFeatureBoard(o);});}),e.querySelector('[data-action="feature-request"]')?.addEventListener("click",()=>{this.selectedCategory="other",this.selectedIntent=ct,this.viaFeatureRequest=true,this.step="details",this.render();}),e.querySelectorAll("[data-report-id]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.reportId;o&&this.loadReporterComments(o);});}),e.querySelector('[data-action="open-leaderboard"]')?.addEventListener("click",()=>{this.step="leaderboard",this.callbacks.onLeaderboardOpen?.(),this.callbacks.onGlobalLeaderboardOpen?.(),this.render();}),e.querySelector('[data-action="open-account"]')?.addEventListener("click",()=>{this.step="account",this.render();}),e.querySelector('[data-action="open-cross-app-reports"]')?.addEventListener("click",()=>{this.step="cross-app-reports",this.crossAppLoading=true,this.crossAppReports=null,this.render(),this.callbacks.onCrossAppReportsOpen?this.callbacks.onCrossAppReportsOpen():(this.crossAppLoading=false,this.crossAppReports=[],this.render());}),e.querySelector('[data-action="open-global-leaderboard"]')?.addEventListener("click",()=>{this.step="leaderboard",this.globalLeaderboard=null,this.globalLeaderboardLoading=true,this.render(),this.callbacks.onGlobalLeaderboardOpen?this.callbacks.onGlobalLeaderboardOpen():(this.globalLeaderboardLoading=false,this.globalLeaderboard=[],this.render());}),e.querySelector('[data-action="send-magic-link"]')?.addEventListener("click",()=>{this.handleMagicLinkSend(e);}),e.querySelector('[data-action="resend-magic-link"]')?.addEventListener("click",()=>{this.magicLinkSent=false,this.magicLinkError="",this.render();}),e.querySelector('[data-action="sign-out-tester"]')?.addEventListener("click",()=>{this.testerJwt=null,this.testerInfo=null,this.testerReputation=null,this.crossAppReports=null,this.magicLinkSent=false,this.magicLinkEmail="",this.step="category",this.callbacks.onTesterSignOut?.(),this.render();}),e.querySelector('[data-action="reporter-reply"]')?.addEventListener("click",()=>{this.submitReporterReply(e);}),e.querySelector('[data-action="reporter-confirms"]')?.addEventListener("click",()=>{this.submitReporterFeedback("confirms");}),e.querySelector('[data-action="reporter-not-fixed"]')?.addEventListener("click",()=>{this.submitReporterReopen();}),e.querySelector('[data-action="view-my-reports"]')?.addEventListener("click",()=>{this.loadReporterReports();}),e.querySelector('[data-action="copy-report-id"]')?.addEventListener("click",a=>{let o=a.currentTarget,l=o.dataset.copyId;if(!l)return;let f=o.innerHTML,p=()=>{o.innerHTML="Copied \u2713",window.setTimeout(()=>{o.isConnected&&(o.innerHTML=f);},1600);};try{navigator.clipboard?.writeText?navigator.clipboard.writeText(l).then(p).catch(()=>p()):p();}catch{p();}}),e.querySelectorAll("[data-category]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.category??"other";this.selectedCategory=o;let l=this.resolveCustomCategory(o);this.step=l&&(!l.intents||l.intents.length===0)?"details":"intent",this.render();});}),e.querySelectorAll("[data-intent]").forEach(a=>{a.addEventListener("click",()=>{this.selectedIntent=a.dataset.intent??null,this.step="details",this.render();});});let n=e.querySelector(".mushi-textarea"),s=e.querySelector('[data-role="char-current"]');if(n&&s){let a=this.effectiveMinLength(),o=()=>{let l=n.value.trim().length;s.textContent=String(l);let f=e.querySelector('[data-role="char-counter"]');f&&(f.style.color=l>=a?"var(--mushi-ok, #22c55e)":"");};n.addEventListener("input",o);}e.querySelectorAll("[data-example]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.example??"";n&&(n.value=o,n.focus(),n.dispatchEvent(new Event("input")));});}),e.querySelector('[data-action="screenshot"]')?.addEventListener("click",()=>{this.callbacks.onScreenshotRequest();}),e.querySelector('[data-action="remove-screenshot"]')?.addEventListener("click",()=>{this.callbacks.onScreenshotRemove?.();}),e.querySelector('[data-action="annotate-screenshot"]')?.addEventListener("click",()=>{let a=e.querySelector('[data-role="annotate-host"]');a&&this.callbacks.onScreenshotAnnotateRequest&&this.callbacks.onScreenshotAnnotateRequest(a);}),e.querySelector('[data-action="element"]')?.addEventListener("click",()=>{this.callbacks.onElementSelectorRequest?.();});let i=()=>{let a=e.querySelector(".mushi-textarea"),o=a?.value?.trim()??"",l=e.querySelector(".mushi-error"),f=this.effectiveMinLength();if(o.length<f){if(l){let v=`${r.step3.tooShort} (${o.length}/${f})`;l.textContent=v,l.style.display="block",a?.focus();}return}this.submitting=true,this.submittedAt=new Date,this.lastReportId=null,this.lastSubmitQueuedOffline=false,this.render();let p=(async()=>{try{let v=this.selectedCategory,d=this.resolveBaseCategory(v),m=this.config.categories&&this.config.categories.length>0,c=this.callbacks.onSubmit({category:d,...m?{userCategory:v}:{},description:o,intent:this.selectedIntent??void 0});return c&&typeof c.then=="function"?await c??null:null}catch{return {reportId:null,queuedOffline:true}}})();this.successTimer=setTimeout(()=>{this.successTimer=null,this.submitting=false,this.step="success",this.render(),p.then(v=>{if(this.step!=="success")return;v&&(this.lastReportId=v.reportId??null,this.lastSubmitQueuedOffline=!!v.queuedOffline,this.render()),this.autoCloseTimer!==null&&clearTimeout(this.autoCloseTimer);let d=this.lastReportId&&this.config.dashboardUrl?6e3:2800;this.autoCloseTimer=setTimeout(()=>{this.autoCloseTimer=null,this.step==="success"&&this.close();},d);});},500);};e.querySelector('[data-action="submit"]')?.addEventListener("click",i),e.addEventListener("keydown",a=>{if(a.key==="Escape"){this.close();return}this.step==="details"&&Rr(a)&&(a.preventDefault(),i());});}trapFocus(e){requestAnimationFrame(()=>{let r=e.querySelector("textarea");if(r){r.focus();return}let n=e.querySelectorAll("button, textarea, [tabindex]");n.length>0&&n[0].focus();});}unreadCount(){return this.reporterReports.reduce((e,r)=>e+(r.unread_count??0),0)}async loadFeatureBoard(){this.step="roadmap",this.reporterLoading=true,this.reporterError=null,this.render();try{this.featureBoard=await this.callbacks.onFeatureBoardRequest?.()??[];}catch(e){this.reporterError=e instanceof Error?e.message:"Could not load community ideas.";}finally{this.reporterLoading=false,this.render();}}async voteFeatureBoard(e){if(!(!this.callbacks.onFeatureBoardVote||this.reporterLoading)){this.reporterLoading=true,this.render();try{await this.callbacks.onFeatureBoardVote(e),this.featureBoard=await this.callbacks.onFeatureBoardRequest?.()??this.featureBoard;}catch(r){this.reporterError=r instanceof Error?r.message:"Could not update vote.";}finally{this.reporterLoading=false,this.render();}}}async submitReporterReopen(){let e=this.selectedReportId;if(!(!e||this.reporterLoading)){this.reporterLoading=true,this.render();try{this.callbacks.onReporterReopen?await this.callbacks.onReporterReopen(e,"Not fixed for me"):await this.callbacks.onReporterFeedback?.(e,"not_fixed","Not fixed for me"),await this.loadReporterReports();}catch(r){this.reporterError=r instanceof Error?r.message:"Could not reopen report.";}finally{this.reporterLoading=false,this.render();}}}async loadReporterReports(){this.step="reports",this.reporterLoading=true,this.reporterError=null,this.render();try{this.reporterReports=await this.callbacks.onReporterReportsRequest?.()??[];}catch(e){this.reporterError=e instanceof Error?e.message:"Could not load reports.";}finally{this.reporterLoading=false,this.render();}}async loadReporterComments(e){this.selectedReportId=e,this.step="report-detail",this.reporterLoading=true,this.reporterError=null,this.render();try{this.reporterComments=await this.callbacks.onReporterCommentsRequest?.(e)??[];}catch(r){this.reporterError=r instanceof Error?r.message:"Could not load thread.";}finally{this.reporterLoading=false,this.render();}}async submitReporterFeedback(e){let r=this.selectedReportId;if(!(!r||this.reporterLoading)){this.reporterLoading=true,this.render();try{await this.callbacks.onReporterFeedback?.(r,e),await this.loadReporterReports(),r&&await this.loadReporterComments(r);}catch(n){this.reporterError=n instanceof Error?n.message:"Could not send feedback.",this.reporterLoading=false,this.render();}}}async submitReporterReply(e){let r=this.selectedReportId,n=e.querySelector('[data-role="reporter-reply"]'),s=e.querySelector('[data-action="reporter-reply"]'),i=n?.value.trim()??"";if(!(!r||!i||this.reporterLoading)){this.reporterLoading=true,s&&(s.disabled=true),this.render();try{await this.callbacks.onReporterReply?.(r,i),n&&(n.value=""),await this.loadReporterComments(r);}catch(a){this.reporterError=a instanceof Error?a.message:"Could not send reply.",this.reporterLoading=false,this.render();}}}async handleMagicLinkSend(e){if(this.magicLinkSending)return;let n=(e.querySelector('[data-role="magic-link-email"]')?.value??this.magicLinkEmail).trim();if(!n||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)){this.magicLinkError="Please enter a valid email address.",this.render();return}this.magicLinkEmail=n,this.magicLinkError="",this.magicLinkSending=true,this.render();try{await this.callbacks.onMushiSignIn?.(n),this.magicLinkSent=!0;}catch(s){this.magicLinkError=s instanceof Error?s.message:"Could not send sign-in link. Try again.";}finally{this.magicLinkSending=false,this.render();}}getRecorderStep(){return this.step}getRecorderTrigger(){return this.shadow.querySelector(".mushi-trigger")}getRecorderCategoryButton(e){return this.shadow.querySelector(`[data-category="${e}"]`)}getRecorderIntentButton(e){return Array.from(this.shadow.querySelectorAll("[data-intent]")).find(r=>r.dataset.intent===e)??null}getRecorderSubmitButton(){return this.shadow.querySelector('[data-action="submit"]')}recorderClickTrigger(){this.isOpen&&this.close(),this.open();}openReporter(){this.isOpen||(this.isOpen=true,this.render()),this.loadReporterReports();}recorderSelectCategory(e){this.isOpen||this.open(),this.step!=="category"&&(this.selectedCategory=null,this.selectedIntent=null,this.step="category",this.render()),this.selectedCategory=e,this.step="intent",this.render();}recorderSelectIntent(e){!this.isOpen||this.step!=="intent"||(this.selectedIntent=e,this.step="details",this.render());}recorderFocusDescription(){this.shadow.querySelector(".mushi-textarea")?.focus();}recorderSubmit(){this.shadow.querySelector('[data-action="submit"]')?.click();}recorderOpenMyReports(){this.isOpen||this.open(),this.loadReporterReports();}};function Ve(t){if(!t)return null;let e=t.getBoundingClientRect();return e.width===0&&e.height===0?null:{x:e.left+e.width/2,y:e.top+e.height/2}}function Lr(t){if(typeof globalThis>"u")return;let e={ready:()=>t.getIsMounted(),getStep:()=>t.getRecorderStep(),getTriggerCenter:()=>Ve(t.getRecorderTrigger()),getCategoryCenter:r=>Ve(t.getRecorderCategoryButton(r)),getIntentCenter:r=>Ve(t.getRecorderIntentButton(r)),getSubmitCenter:()=>Ve(t.getRecorderSubmitButton()),clickTrigger:()=>t.recorderClickTrigger(),selectCategory:r=>t.recorderSelectCategory(r),selectIntent:r=>t.recorderSelectIntent(r),focusDescription:()=>t.recorderFocusDescription(),submit:()=>t.recorderSubmit(),openMyReports:()=>t.recorderOpenMyReports()};globalThis.__mushiRecorder=e;}var Or="mushi_session_min_day_",Pe=[],pt=null,ht=null,de=null,ft=null,Hr=null,Me=null,we=false,De=null,bt=0,Ps=300*1e3,Br=0,Ds=900*1e3;function yt(){return Date.now()<Br}function vt(t){t?.startsWith("HTTP_4")&&(Br=Date.now()+Ds);}var Ir=new Set;function mt(t){return `mushi_rewards_consent_${t}`}function Os(t){try{return localStorage.getItem(mt(t))==="1"}catch{return false}}function gt(t,e){try{e?localStorage.setItem(mt(t),"1"):localStorage.removeItem(mt(t)),we=e,Me?.submitActivity(de??"",[],{optedIn:e}).catch(()=>{});}catch{}}function Nr(){return new Date().toISOString().slice(0,10)}function Fr(t){try{let e=sessionStorage.getItem(`${Or}${t}_${Nr()}`);return e?parseInt(e,10):0}catch{return 0}}function Hs(t){let e=Nr(),r=`${Or}${t}_${e}`;try{let n=Fr(t)+1;return sessionStorage.setItem(r,String(n)),n}catch{return 99}}function Ur(t){Me=t.client,de=t.userId,ft=t.traits??null,Hr=t.reporterToken??null;let{projectId:e}=t,r=Math.max(3e4,t.config.flushIntervalMs??3e5);t.config.consentMode==="auto"?(we=true,gt(e,true)):we=Os(e),t.config.trackActivity&&Fs(e),pt&&clearInterval(pt),pt=setInterval(()=>Bs(t),r),ht&&clearInterval(ht),ht=setInterval(()=>{if(!we||!de)return;let n=Fr(e);n<60&&(Hs(e),$e({action:"session_minute",metadata:{minutes_today:n+1}}));},6e4),t.config.showInWidget&&wt(de).then(n=>{n&&Wr(n,t.config);}),t.config.consentMode!=="auto"&&!we&&Us(e,t.config);}function qr(t,e){de=t,ft=e??null,De=null,bt=0;}function $e(t){!we||!de||Pe.push({...t,queuedAt:Date.now()});}async function Bs(t){if(!we||!de||Pe.length===0)return;let e=null;if(t.config.verifyUserToken)try{e=await t.config.verifyUserToken();}catch{}if(yt())return;let r=Pe.splice(0,100);try{let n=await t.client.submitActivity(de,r,{userTraits:ft??void 0,reporterTokenHash:Hr??void 0,optedIn:!0,hostJwt:e??void 0});n.ok||(vt(n.error?.code),n.error?.code?.startsWith("HTTP_4")||Pe.unshift(...r.slice(0,50)));}catch{Pe.unshift(...r.slice(0,50));}}async function jr(t){let e=Date.now();return De&&e-bt<Ps?De:wt(t)}async function wt(t){if(!Me||yt())return null;let e=await Me.getMyTier(t);return e.ok&&e.data?(De=e.data,bt=Date.now(),De):(vt(e.error?.code),null)}async function zr(t=10){if(!Me||yt())return null;try{let e=await Me.getHallOfFame(t);return e.ok&&e.data?(e.data.data??[]).map(r=>({display_name:r.display_name,tier_name:r.tier_name,total_points:r.total_points,points_30d:r.points_30d})):(vt(e.error?.code),null)}catch{return null}}var Ar=null,_r=null,Pr=null,Dr="";function Fs(t){let e=()=>{let n=location.pathname;if(n===Dr)return;Dr=n,!Ir.has(`${t}:${n}`)&&(Ir.add(`${t}:${n}`),$e({action:"screen_view_unique_per_day",metadata:{route:n}}));};Pr=history.pushState.bind(history),history.pushState=function(...n){Pr(...n),e();},window.addEventListener("popstate",e),e(),Ar=new MutationObserver(()=>e());let r=document.querySelector("main")??document.body;Ar.observe(r,{childList:true,subtree:false}),_r=n=>{let s=n.target.closest("[data-testid]");if(!s)return;let i=s.dataset.testid;i&&$e({action:"element_selected",metadata:{testid:i,route:location.pathname}});},document.addEventListener("click",_r,{capture:true,passive:true});}var ve=null;function Wr(t,e){if(!e.showInWidget)return;ve&&ve.remove(),ve=document.createElement("div"),ve.id="mushi-tier-badge",Object.assign(ve.style,{position:"fixed",bottom:"56px",right:"16px",zIndex:"2147483645",fontFamily:"system-ui, sans-serif"});let r=ve.attachShadow({mode:"closed"});r.innerHTML=`
2089
2149
  <style>
2090
2150
  :host { display: block; }
2091
2151
  .badge {
@@ -2115,7 +2175,7 @@
2115
2175
  <span class="dot"></span>
2116
2176
  <span>${t.displayName}</span>
2117
2177
  </div>
2118
- `,document.body.appendChild(ge);}var le=null;function Bs(t,e){if(le)return;le=document.createElement("div"),le.id="mushi-consent-banner",Object.assign(le.style,{position:"fixed",bottom:"80px",right:"16px",zIndex:"2147483646",maxWidth:"280px",fontFamily:"system-ui, sans-serif"});let r=le.attachShadow({mode:"closed"});r.innerHTML=`
2178
+ `,document.body.appendChild(ve);}var ue=null;function Us(t,e){if(ue)return;ue=document.createElement("div"),ue.id="mushi-consent-banner",Object.assign(ue.style,{position:"fixed",bottom:"80px",right:"16px",zIndex:"2147483646",maxWidth:"280px",fontFamily:"system-ui, sans-serif"});let r=ue.attachShadow({mode:"closed"});r.innerHTML=`
2119
2179
  <style>
2120
2180
  :host { display: block; }
2121
2181
  .banner {
@@ -2150,7 +2210,7 @@
2150
2210
  <button class="decline" id="decline">No thanks</button>
2151
2211
  </div>
2152
2212
  </div>
2153
- `,r.getElementById("accept")?.addEventListener("click",()=>{dt(t,true),le?.remove(),le=null,e.showInWidget&&ce&&ft(ce).then(n=>{n&&jr(n,e);});}),r.getElementById("decline")?.addEventListener("click",()=>{dt(t,false),le?.remove(),le=null;}),document.body.appendChild(le);}function bt(){let t=[],e={},r=["log","warn","error","info","debug"];for(let n of r){let s=console[n];e[n]=s,console[n]=(...i)=>{let a=i.map(l=>{try{return typeof l=="string"?l:JSON.stringify(l)}catch{return String(l)}}).join(" ").slice(0,500),o={level:n,message:a,timestamp:Date.now()};n==="error"&&i[0]instanceof Error&&(o.stack=i[0].stack?.slice(0,1e3)),t.push(o),t.length>50&&t.shift(),s.call(console,...i);};}return {getEntries(){return [...t]},clear(){t.length=0;},destroy(){for(let n of r)e[n]&&(console[n]=e[n]);}}}var Ns=[/\/v1\/sdk(?:\/|$)/,/\/v1\/reports(?:\/|$)/,/\/v1\/notifications(?:\/|$)/,/\/v1\/reputation(?:\/|$)/];function je(t){return typeof t=="string"?t:t instanceof URL?t.href:t.url}function ze(t,e){let r=e?.[ve];if(r)return r;let n=qs(e?.headers,Re);if(n)return n;if(typeof Request<"u"&&t instanceof Request){let s=t.headers.get(Re);if(s)return s}return null}function We(t,e={}){if([...Ns,...e.ignoreUrls??[]].some(s=>Fs(t,s)))return true;let n=Us(e.apiEndpoint);return n?yt(t).startsWith(n):false}function Fs(t,e){return typeof e=="string"?yt(t).includes(e):(e.lastIndex=0,e.test(t))}function Us(t){if(!t)return null;let e=yt(t),r=e.length;for(;r>0&&e.charCodeAt(r-1)===47;)r--;return e.slice(0,r)}function yt(t){try{return new URL(t,typeof location<"u"?location.href:"http://localhost").href}catch{return t}}function qs(t,e){if(!t)return null;if(typeof Headers<"u"&&t instanceof Headers)return t.get(e);if(Array.isArray(t))return t.find(([s])=>s.toLowerCase()===e.toLowerCase())?.[1]??null;let r=t;return r[e]??r[e.toLowerCase()]??null}var js=30,zs="00";function Ws(){let t=crypto.getRandomValues(new Uint8Array(16)),e=crypto.getRandomValues(new Uint8Array(8)),r=i=>Array.from(i).map(a=>a.toString(16).padStart(2,"0")).join(""),n=r(t),s=r(e);return {traceparent:`${zs}-${n}-${s}-01`,traceId:n,spanId:s}}function Vs(t,e){for(let r of e)if(typeof r=="string"){if(t.includes(r))return true}else if(r.test(t))return true;return false}function vt(t={}){let e=[],r=globalThis.fetch,n=t;globalThis.fetch=async function(a,o){let l=Date.now(),f=o?.method?.toUpperCase()??"GET",d=je(a),p=!ze(a,o)&&!We(d,n),m,c=o,g=n.tracePropagation;if(p&&g?.enabled&&g.corsUrls?.length&&Vs(d,g.corsUrls)){let{traceparent:x,traceId:T}=Ws();m=T;let R=o?.headers?new Headers(o.headers):new Headers;R.set("traceparent",x),n.sessionId&&R.set("x-mushi-session",n.sessionId),c={...o,headers:R};}try{let x=await r.call(globalThis,a,c);return p&&s({method:f,url:zr(d),status:x.status,duration:Date.now()-l,timestamp:l,...m?{traceId:m}:{}}),x}catch(x){throw p&&s({method:f,url:zr(d),status:0,duration:Date.now()-l,timestamp:l,error:x instanceof Error?x.message:"Network error",...m?{traceId:m}:{}}),x}};function s(i){e.push(i),e.length>js&&e.shift();}return {getEntries(){return [...e]},clear(){e.length=0;},updateOptions(i){n=i;},destroy(){globalThis.fetch=r;}}}function zr(t){try{let e=new URL(t),r=e.pathname+e.search;return r.length>200?e.origin+r.slice(0,200)+"...":e.origin+r}catch{return t.slice(0,200)}}function St(t={}){let e=t;async function r(){try{if(typeof document>"u")return null;let n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return null;let i=window.innerWidth,a=window.innerHeight,o=Math.min(window.devicePixelRatio||1,2);n.width=i*o,n.height=a*o,s.scale(o,o);let l=Gs(e.privacy),f=`
2213
+ `,r.getElementById("accept")?.addEventListener("click",()=>{gt(t,true),ue?.remove(),ue=null,e.showInWidget&&de&&wt(de).then(n=>{n&&Wr(n,e);});}),r.getElementById("decline")?.addEventListener("click",()=>{gt(t,false),ue?.remove(),ue=null;}),document.body.appendChild(ue);}function xt(){let t=[],e={},r=["log","warn","error","info","debug"];for(let n of r){let s=console[n];e[n]=s,console[n]=(...i)=>{let a=i.map(l=>{try{return typeof l=="string"?l:JSON.stringify(l)}catch{return String(l)}}).join(" ").slice(0,500),o={level:n,message:a,timestamp:Date.now()};n==="error"&&i[0]instanceof Error&&(o.stack=i[0].stack?.slice(0,1e3)),t.push(o),t.length>50&&t.shift(),s.call(console,...i);};}return {getEntries(){return [...t]},clear(){t.length=0;},destroy(){for(let n of r)e[n]&&(console[n]=e[n]);}}}var qs=[/\/v1\/sdk(?:\/|$)/,/\/v1\/reports(?:\/|$)/,/\/v1\/notifications(?:\/|$)/,/\/v1\/reputation(?:\/|$)/];function Ke(t){return typeof t=="string"?t:t instanceof URL?t.href:t.url}function Ge(t,e){let r=e?.[Ce];if(r)return r;let n=Ws(e?.headers,Ie);if(n)return n;if(typeof Request<"u"&&t instanceof Request){let s=t.headers.get(Ie);if(s)return s}return null}function Ye(t,e={}){if([...qs,...e.ignoreUrls??[]].some(s=>js(t,s)))return true;let n=zs(e.apiEndpoint);return n?St(t).startsWith(n):false}function js(t,e){return typeof e=="string"?St(t).includes(e):(e.lastIndex=0,e.test(t))}function zs(t){if(!t)return null;let e=St(t),r=e.length;for(;r>0&&e.charCodeAt(r-1)===47;)r--;return e.slice(0,r)}function St(t){try{return new URL(t,typeof location<"u"?location.href:"http://localhost").href}catch{return t}}function Ws(t,e){if(!t)return null;if(typeof Headers<"u"&&t instanceof Headers)return t.get(e);if(Array.isArray(t))return t.find(([s])=>s.toLowerCase()===e.toLowerCase())?.[1]??null;let r=t;return r[e]??r[e.toLowerCase()]??null}var Vs=30,Ks="00";function Gs(){let t=crypto.getRandomValues(new Uint8Array(16)),e=crypto.getRandomValues(new Uint8Array(8)),r=i=>Array.from(i).map(a=>a.toString(16).padStart(2,"0")).join(""),n=r(t),s=r(e);return {traceparent:`${Ks}-${n}-${s}-01`,traceId:n,spanId:s}}function Ys(t,e){for(let r of e)if(typeof r=="string"){if(t.includes(r))return true}else if(r.test(t))return true;return false}function Et(t={}){let e=[],r=globalThis.fetch,n=t;globalThis.fetch=async function(a,o){let l=Date.now(),f=o?.method?.toUpperCase()??"GET",p=Ke(a),d=!Ge(a,o)&&!Ye(p,n),m,c=o,g=n.tracePropagation;if(d&&g?.enabled&&g.corsUrls?.length&&Ys(p,g.corsUrls)){let{traceparent:x,traceId:C}=Gs();m=C;let R=o?.headers?new Headers(o.headers):new Headers;R.set("traceparent",x),n.sessionId&&R.set("x-mushi-session",n.sessionId),c={...o,headers:R};}try{let x=await r.call(globalThis,a,c);return d&&s({method:f,url:Vr(p),status:x.status,duration:Date.now()-l,timestamp:l,...m?{traceId:m}:{}}),x}catch(x){throw d&&s({method:f,url:Vr(p),status:0,duration:Date.now()-l,timestamp:l,error:x instanceof Error?x.message:"Network error",...m?{traceId:m}:{}}),x}};function s(i){e.push(i),e.length>Vs&&e.shift();}return {getEntries(){return [...e]},clear(){e.length=0;},updateOptions(i){n=i;},destroy(){globalThis.fetch=r;}}}function Vr(t){try{let e=new URL(t),r=e.pathname+e.search;return r.length>200?e.origin+r.slice(0,200)+"...":e.origin+r}catch{return t.slice(0,200)}}function Ct(t={}){let e=t;async function r(){try{if(typeof document>"u")return null;let n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return null;let i=window.innerWidth,a=window.innerHeight,o=Math.min(window.devicePixelRatio||1,2);n.width=i*o,n.height=a*o,s.scale(o,o);let l=Js(e.privacy),f=`
2154
2214
  <svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${a}">
2155
2215
  <foreignObject width="100%" height="100%">
2156
2216
  <div xmlns="http://www.w3.org/1999/xhtml">
@@ -2158,7 +2218,7 @@
2158
2218
  </div>
2159
2219
  </foreignObject>
2160
2220
  </svg>
2161
- `,d=new Image,v=new Blob([f],{type:"image/svg+xml;charset=utf-8"}),p=URL.createObjectURL(v);return new Promise(m=>{d.onload=()=>{try{s.drawImage(d,0,0,i,a),URL.revokeObjectURL(p);let c=n.toDataURL("image/jpeg",.7);m(c);}catch{URL.revokeObjectURL(p),e.onFailed?.("taint"),wt("taint"),m(null);}},d.onerror=()=>{URL.revokeObjectURL(p),e.onFailed?.("error"),wt("error"),m(null);},d.src=p;})}catch{return e.onFailed?.("error"),wt("error"),null}}return {take:r,updateOptions(n){e=n;}}}function wt(t){try{document.dispatchEvent(new CustomEvent("mushi:screenshot_failed",{detail:{reason:t},bubbles:!1}));}catch{}}var Ks=['input[type="password"]',"[data-mushi-redact]"];function Gs(t){let e=document.documentElement.cloneNode(true);e.querySelector("#mushi-mushi-widget")?.remove(),Xs(e);let r=t?.redactSelectors!==void 0?t.redactSelectors:Ks;for(let n of r)for(let s of xt(e,n))Ys(s);for(let n of t?.blockSelectors??[])for(let s of xt(e,n))s.remove();for(let n of t?.maskSelectors??[])for(let s of xt(e,n))Js(s);return e}function xt(t,e){try{return Array.from(t.querySelectorAll(e))}catch{return []}}function Ys(t){for((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setAttribute("value","")),t.textContent="",t.setAttribute("style",`${t.getAttribute("style")??""};background:#000!important;color:#000!important;text-shadow:none!important;border-color:#000!important;`),t.setAttribute("data-mushi-redacted","true");t.firstChild;)t.removeChild(t.firstChild);}function Xs(t){let e=typeof location<"u"?location.origin:"";for(let r of t.querySelectorAll("img, video, iframe, object, embed, picture"))r.remove();for(let r of t.querySelectorAll('link[rel="stylesheet"], link[as="style"]')){let n=r.getAttribute("href");(!n||Vr(n,e))&&r.remove();}for(let r of t.querySelectorAll("style")){let n=Wr(r.textContent??"",e);n!==r.textContent&&(r.textContent=n);}for(let r of t.querySelectorAll("[style]")){let n=r.getAttribute("style");if(!n)continue;let s=Wr(n,e);s!==n&&r.setAttribute("style",s);}for(let r of t.querySelectorAll("script"))r.remove();}function Wr(t,e){return t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi,(r,n,s)=>{let i=s.trim();return !i||i.startsWith("data:")||i.startsWith("#")?r:Vr(i,e)?"none":r})}function Vr(t,e){if(!t||t.startsWith("data:")||t.startsWith("blob:"))return false;try{let r=new URL(t,typeof location<"u"?location.href:"http://localhost/");return !!e&&r.origin!==e}catch{return true}}function Js(t){(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setAttribute("value",""),t.setAttribute("placeholder","\u2022\u2022\u2022\u2022")),t.textContent=t.children.length===0?"\u2022\u2022\u2022\u2022":t.textContent,t.setAttribute("style",`${t.getAttribute("style")??""};background:#8f8f8f!important;color:transparent!important;text-shadow:none!important;`),t.setAttribute("data-mushi-masked","true");}function Zs(t){if(!t||!t.tagName)return;let e=t,r=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",s=e.classList&&e.classList.length>0?`.${e.classList[0]}`:"";return `${r}${n}${s}`}function Et(){let t={},e=[];if(typeof PerformanceObserver<"u"){try{let r=new PerformanceObserver(n=>{for(let s of n.getEntries())s.name==="first-contentful-paint"&&(t.fcp=s.startTime);});r.observe({type:"paint",buffered:!0}),e.push(r);}catch{}try{let r=new PerformanceObserver(n=>{let s=n.getEntries();s.length>0&&(t.lcp=s[s.length-1].startTime);});r.observe({type:"largest-contentful-paint",buffered:!0}),e.push(r);}catch{}try{let r=0,n=new PerformanceObserver(s=>{for(let i of s.getEntries())i.hadRecentInput||(r+=i.value??0,t.cls=r);});n.observe({type:"layout-shift",buffered:!0}),e.push(n);}catch{}try{let r=0,n=new PerformanceObserver(s=>{r+=s.getEntries().length,t.longTasks=r;});n.observe({type:"longtask",buffered:!0}),e.push(n);}catch{}try{let r=new Map,n=new PerformanceObserver(s=>{for(let i of s.getEntries()){let a=i.interactionId;if(!a)continue;let o=r.get(a)??0;if(i.duration>o&&r.set(a,i.duration),i.duration>(t.inp??0)){t.inp=i.duration;let l=i.processingStart-i.startTime,f=i.processingEnd-i.processingStart,d=i.startTime+i.duration-i.processingEnd;t.inpAttribution={eventType:i.name,targetSelector:Zs(i.target),inputDelay:Math.max(0,l),processingDuration:Math.max(0,f),presentationDelay:Math.max(0,d)};}}});n.observe({type:"event",durationThreshold:40,buffered:!0}),e.push(n);}catch{}try{let r=new PerformanceObserver(n=>{for(let s of n.getEntries())t.fid===void 0&&(t.fid=s.processingStart-s.startTime);});r.observe({type:"first-input",buffered:!0}),e.push(r);}catch{}}if(typeof performance<"u"&&performance.getEntriesByType)try{let r=performance.getEntriesByType("navigation");r.length>0&&r[0]&&(t.ttfb=r[0].responseStart-r[0].requestStart);}catch{}return {getMetrics(){return {...t}},destroy(){for(let r of e)r.disconnect();e.length=0;}}}function kt(){let t=false,e=null,r=null;function n(c){let g=c,x=0;for(;g&&x<20;){let T=g.getAttribute?.("data-testid");if(T)return T;g=g.parentElement,x++;}return null}function s(c){let g=[],x=c;for(;x&&x!==document.body;){let T=1,R=x.previousElementSibling;for(;R;)R.tagName===x.tagName&&T++,R=R.previousElementSibling;let S=x.tagName.toLowerCase();g.unshift(T>1?`${S}[${T}]`:S),x=x.parentElement;}return "//"+g.join("/")}function i(c){let g=c.getBoundingClientRect();return {tagName:c.tagName.toLowerCase(),id:c.id||void 0,className:c.className||void 0,textContent:c.textContent?.trim().slice(0,200)||void 0,xpath:s(c),rect:{x:Math.round(g.x),y:Math.round(g.y),width:Math.round(g.width),height:Math.round(g.height)},nearestTestid:n(c)||void 0,route:typeof window<"u"?window.location.pathname:void 0}}function a(){let c=document.createElement("div");return c.style.cssText=`
2221
+ `,p=new Image,v=new Blob([f],{type:"image/svg+xml;charset=utf-8"}),d=URL.createObjectURL(v);return new Promise(m=>{p.onload=()=>{try{s.drawImage(p,0,0,i,a),URL.revokeObjectURL(d);let c=n.toDataURL("image/jpeg",.7);m(c);}catch{URL.revokeObjectURL(d),e.onFailed?.("taint"),kt("taint"),m(null);}},p.onerror=()=>{URL.revokeObjectURL(d),e.onFailed?.("error"),kt("error"),m(null);},p.src=d;})}catch{return e.onFailed?.("error"),kt("error"),null}}return {take:r,updateOptions(n){e=n;}}}function kt(t){try{document.dispatchEvent(new CustomEvent("mushi:screenshot_failed",{detail:{reason:t},bubbles:!1}));}catch{}}var Xs=['input[type="password"]',"[data-mushi-redact]"];function Js(t){let e=document.documentElement.cloneNode(true);e.querySelector("#mushi-mushi-widget")?.remove(),Qs(e);let r=t?.redactSelectors!==void 0?t.redactSelectors:Xs;for(let n of r)for(let s of Rt(e,n))Zs(s);for(let n of t?.blockSelectors??[])for(let s of Rt(e,n))s.remove();for(let n of t?.maskSelectors??[])for(let s of Rt(e,n))eo(s);return e}function Rt(t,e){try{return Array.from(t.querySelectorAll(e))}catch{return []}}function Zs(t){for((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setAttribute("value","")),t.textContent="",t.setAttribute("style",`${t.getAttribute("style")??""};background:#000!important;color:#000!important;text-shadow:none!important;border-color:#000!important;`),t.setAttribute("data-mushi-redacted","true");t.firstChild;)t.removeChild(t.firstChild);}function Qs(t){let e=typeof location<"u"?location.origin:"";for(let r of t.querySelectorAll("img, video, iframe, object, embed, picture"))r.remove();for(let r of t.querySelectorAll('link[rel="stylesheet"], link[as="style"]')){let n=r.getAttribute("href");(!n||Gr(n,e))&&r.remove();}for(let r of t.querySelectorAll("style")){let n=Kr(r.textContent??"",e);n!==r.textContent&&(r.textContent=n);}for(let r of t.querySelectorAll("[style]")){let n=r.getAttribute("style");if(!n)continue;let s=Kr(n,e);s!==n&&r.setAttribute("style",s);}for(let r of t.querySelectorAll("script"))r.remove();}function Kr(t,e){return t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi,(r,n,s)=>{let i=s.trim();return !i||i.startsWith("data:")||i.startsWith("#")?r:Gr(i,e)?"none":r})}function Gr(t,e){if(!t||t.startsWith("data:")||t.startsWith("blob:"))return false;try{let r=new URL(t,typeof location<"u"?location.href:"http://localhost/");return !!e&&r.origin!==e}catch{return true}}function eo(t){(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setAttribute("value",""),t.setAttribute("placeholder","\u2022\u2022\u2022\u2022")),t.textContent=t.children.length===0?"\u2022\u2022\u2022\u2022":t.textContent,t.setAttribute("style",`${t.getAttribute("style")??""};background:#8f8f8f!important;color:transparent!important;text-shadow:none!important;`),t.setAttribute("data-mushi-masked","true");}function to(t){if(!t||!t.tagName)return;let e=t,r=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",s=e.classList&&e.classList.length>0?`.${e.classList[0]}`:"";return `${r}${n}${s}`}function Tt(){let t={},e=[];if(typeof PerformanceObserver<"u"){try{let r=new PerformanceObserver(n=>{for(let s of n.getEntries())s.name==="first-contentful-paint"&&(t.fcp=s.startTime);});r.observe({type:"paint",buffered:!0}),e.push(r);}catch{}try{let r=new PerformanceObserver(n=>{let s=n.getEntries();s.length>0&&(t.lcp=s[s.length-1].startTime);});r.observe({type:"largest-contentful-paint",buffered:!0}),e.push(r);}catch{}try{let r=0,n=new PerformanceObserver(s=>{for(let i of s.getEntries())i.hadRecentInput||(r+=i.value??0,t.cls=r);});n.observe({type:"layout-shift",buffered:!0}),e.push(n);}catch{}try{let r=0,n=new PerformanceObserver(s=>{r+=s.getEntries().length,t.longTasks=r;});n.observe({type:"longtask",buffered:!0}),e.push(n);}catch{}try{let r=new Map,n=new PerformanceObserver(s=>{for(let i of s.getEntries()){let a=i.interactionId;if(!a)continue;let o=r.get(a)??0;if(i.duration>o&&r.set(a,i.duration),i.duration>(t.inp??0)){t.inp=i.duration;let l=i.processingStart-i.startTime,f=i.processingEnd-i.processingStart,p=i.startTime+i.duration-i.processingEnd;t.inpAttribution={eventType:i.name,targetSelector:to(i.target),inputDelay:Math.max(0,l),processingDuration:Math.max(0,f),presentationDelay:Math.max(0,p)};}}});n.observe({type:"event",durationThreshold:40,buffered:!0}),e.push(n);}catch{}try{let r=new PerformanceObserver(n=>{for(let s of n.getEntries())t.fid===void 0&&(t.fid=s.processingStart-s.startTime);});r.observe({type:"first-input",buffered:!0}),e.push(r);}catch{}}if(typeof performance<"u"&&performance.getEntriesByType)try{let r=performance.getEntriesByType("navigation");r.length>0&&r[0]&&(t.ttfb=r[0].responseStart-r[0].requestStart);}catch{}return {getMetrics(){return {...t}},destroy(){for(let r of e)r.disconnect();e.length=0;}}}function Mt(){let t=false,e=null,r=null;function n(c){let g=c,x=0;for(;g&&x<20;){let C=g.getAttribute?.("data-testid");if(C)return C;g=g.parentElement,x++;}return null}function s(c){let g=[],x=c;for(;x&&x!==document.body;){let C=1,R=x.previousElementSibling;for(;R;)R.tagName===x.tagName&&C++,R=R.previousElementSibling;let S=x.tagName.toLowerCase();g.unshift(C>1?`${S}[${C}]`:S),x=x.parentElement;}return "//"+g.join("/")}function i(c){let g=c.getBoundingClientRect();return {tagName:c.tagName.toLowerCase(),id:c.id||void 0,className:c.className||void 0,textContent:c.textContent?.trim().slice(0,200)||void 0,xpath:s(c),rect:{x:Math.round(g.x),y:Math.round(g.y),width:Math.round(g.width),height:Math.round(g.height)},nearestTestid:n(c)||void 0,route:typeof window<"u"?window.location.pathname:void 0}}function a(){let c=document.createElement("div");return c.style.cssText=`
2162
2222
  position: fixed;
2163
2223
  pointer-events: none;
2164
2224
  z-index: 2147483647;
@@ -2167,6 +2227,6 @@
2167
2227
  border-radius: 4px;
2168
2228
  transition: all 0.1s ease;
2169
2229
  display: none;
2170
- `,document.body.appendChild(c),c}function o(c){if(!e)return;let g=c.getBoundingClientRect();e.style.left=`${g.left}px`,e.style.top=`${g.top}px`,e.style.width=`${g.width}px`,e.style.height=`${g.height}px`,e.style.display="block";}function l(c){let g=c.target;g!==e&&o(g);}function f(c){c.preventDefault(),c.stopPropagation();let g=c.target;if(g===e||(c.composedPath?c.composedPath():[]).some(S=>S instanceof Element&&S.id==="mushi-mushi-widget"))return;let R=i(g);v(R);}function d(c){c.key==="Escape"&&v(null);}function v(c){m(),r?.(c),r=null;}function p(){return t&&m(),new Promise(c=>{r=c,t=true,e=a(),document.body.style.cursor="crosshair",document.addEventListener("mousemove",l,true),document.addEventListener("click",f,true),document.addEventListener("keydown",d,true);})}function m(){t&&(t=false,document.body.style.cursor="",document.removeEventListener("mousemove",l,true),document.removeEventListener("click",f,true),document.removeEventListener("keydown",d,true),e&&(e.remove(),e=null));}return {activate:p,deactivate:m,isActive:()=>t}}function Rt(){let t=[],e=history.pushState,r=history.replaceState,n=()=>a("popstate"),s=()=>a("hashchange");a("initial");function i(l){t.push(l),t.length>120&&t.shift();}function a(l){typeof location>"u"||i({ts:Date.now(),kind:"route",payload:{source:l,route:`${location.pathname}${location.search}${location.hash}`,href:location.href}});}function o(l){let f=l.target instanceof Element?l.target:null;if(!f)return;let d=f.closest('button,a,[role="button"],input,textarea,select,[data-mushi-track]')??f;i({ts:Date.now(),kind:"click",payload:{tag:d.tagName.toLowerCase(),id:d.id||void 0,text:Qs(d)}});}return history.pushState=function(...f){let d=e.apply(this,f);return a("pushState"),d},history.replaceState=function(...f){let d=r.apply(this,f);return a("replaceState"),d},window.addEventListener("popstate",n),window.addEventListener("hashchange",s),document.addEventListener("click",o,true),{setScreen(l){i({ts:Date.now(),kind:"screen",payload:l});},getEntries(l={}){return [...t,...(l.consoleLogs??[]).map(d=>({ts:d.timestamp,kind:"log",payload:{level:d.level,message:d.message}})),...(l.networkLogs??[]).map(d=>({ts:d.timestamp,kind:"request",payload:{method:d.method,url:d.url,status:d.status,duration:d.duration,error:d.error}}))].sort((d,v)=>d.ts-v.ts).slice(-120)},clear(){t.length=0;},destroy(){history.pushState=e,history.replaceState=r,window.removeEventListener("popstate",n),window.removeEventListener("hashchange",s),document.removeEventListener("click",o,true);}}}function Qs(t){let e=(t.textContent??"").replace(/\s+/g," ").trim();return e?e.slice(0,80):void 0}var eo=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,to=/^[0-9a-f]{20,}$/i,ro=/^\d+$/,no=/^[a-z0-9]{16,}$/i;function Kr(t){return t.length===0?t:eo.test(t)||to.test(t)||ro.test(t)||no.test(t)&&/\d/.test(t)?"[id]":t}function Gr(t,e){let r=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;if(e?.length){let n=so(r,e);if(n)return n}return "/"+r.split("/").filter(n=>n.length>0).map(Kr).join("/")}function so(t,e){let r=t.split("/").filter(s=>s.length>0),n=[...e].sort((s,i)=>i.split("/").length-s.split("/").length);for(let s of n){let i=s.split("/").filter(o=>o.length>0);if(i.length!==r.length)continue;let a=true;for(let o=0;o<i.length;o++){let l=i[o],f=r[o];if(!(l.startsWith("[")&&l.endsWith("]"))&&!l.startsWith(":")&&l!==f){a=false;break}}if(a)return "/"+i.join("/")}return null}function oo(){if(typeof document>"u")return [];let t=new Set,e=document.querySelectorAll("[data-testid]");for(let r of Array.from(e)){let n=r.getAttribute("data-testid");n&&n.length>0&&n.length<120&&t.add(n);}return Array.from(t).sort()}function io(){if(typeof window>"u")return [];try{let t=new URLSearchParams(window.location.search),e=new Set;return t.forEach((r,n)=>e.add(n)),Array.from(e).sort()}catch{return []}}function ao(){if(typeof document>"u")return null;let t=s=>(s??"").replace(/\s+/g," ").trim().slice(0,200),e=t(document.querySelector("h1")?.textContent);if(e)return e;let r=t(document.title);return r||t(document.querySelector("main")?.textContent)||null}async function lo(t){if(!t||typeof crypto>"u"||!crypto.subtle)return null;try{let e=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",e),n=new Uint8Array(r),s="";for(let i=0;i<n.length;i++)s+=n[i].toString(16).padStart(2,"0");return s}catch{return null}}function Ct(t){let{config:e,getRecentNetworkPaths:r,getUserId:n,getSessionId:s,onEvent:i}=t,a=e.throttleMs??6e4,o=e.captureDomSummary!==false,l=e.userIdSource??"auto",f=new Map,d=null,v=null;async function p(){if(typeof window>"u")return;let y=Gr(window.location.pathname,e.routeTemplates),k=Date.now(),b=f.get(y)??0;if(k-b<a)return;f.set(y,k);let I=null;l==="auto"?I=n()??s():l==="session-only"&&(I=s());let W={route:y,page_title:typeof document<"u"&&(document.title||"").slice(0,300)||null,dom_summary:o?ao():null,testids:oo(),network_paths:r().slice(-50),query_param_keys:io(),user_id_hash:await lo(I),observed_at:new Date().toISOString()};i(W);}function m(){v||(v=setTimeout(()=>{v=null,p();},100));}function c(){if(typeof window>"u")return;let y=window.location.pathname+window.location.search;y!==d&&(d=y,m());}if(typeof window>"u")return {destroy:()=>{},flushNow:()=>{}};let g=window.history.pushState.bind(window.history),x=window.history.replaceState.bind(window.history),T=function(...k){let b=g(...k);return c(),b},R=function(...k){let b=x(...k);return c(),b};window.history.pushState=T,window.history.replaceState=R;let S=()=>c();return window.addEventListener("popstate",S),m(),{destroy(){window.removeEventListener("popstate",S),window.history.pushState===T&&(window.history.pushState=g),window.history.replaceState===R&&(window.history.replaceState=x),v&&(clearTimeout(v),v=null),f.clear();},flushNow(){f.clear(),p();}}}function Yr(t,e,r){let n=l=>l.timestamp,s=l=>l.type===2,i=l=>l.type===4,a=Date.now()-e,o=0;for(let l=0;l<t.length;l++){let f=n(t[l]);if(typeof f=="number"&&f>=a)break;s(t[l])&&(o=i(t[l-1])?l-1:l);}if(t.length-o>r){for(let l=o+1;l<t.length;l++)if(s(t[l])&&t.length-l<=r){o=i(t[l-1])?l-1:l;break}}o>0&&t.splice(0,o);}function co(t){let e=[],r=false,n=i=>{if(!r)return;let a=i.target instanceof Element?i.target:null,o=a?.tagName?.toLowerCase()??"unknown",l=a?.closest("[data-testid]")?.getAttribute("data-testid")??void 0;e.push({type:"lite_click",timestamp:Date.now(),data:{tag:o,testId:l}}),e.length>400&&e.shift();},s=()=>{r=false,document.removeEventListener("click",n,true);};return {start(){r||(r=true,document.addEventListener("click",n,true));},stop:s,flush(){let i=Date.now()-t;return e.filter(a=>a.timestamp>=i)},destroy(){s(),e.length=0;}}}var Ve=null;async function uo(){if(Ve)return Ve;try{return Ve=await import('rrweb'),Ve}catch{return null}}async function Xr(t){let e=t.maxDurationMs??3e4,r=await uo();if(!r?.record)return co(e);let n=r.record,s=[],i=null,a=false,o=['input[type="password"]',...t.redactSelectors??[]],l=()=>{i?.(),i=null,a=false;};return {start(){a||(a=true,i=n({emit(f){s.push(f),Yr(s,e,400);},maskAllInputs:true,maskAllText:true,maskTextSelector:o.join(","),checkoutEveryNms:e,sampling:{mousemove:false,mouseInteraction:true,scroll:150,media:800}})??null);},stop:l,flush(){return Yr(s,e,400),[...s]},destroy(){l(),s.length=0;}}}function Jr(t,e){return new Promise((r,n)=>{let s=new Image;s.onload=()=>{let i=document.createElement("div");i.style.position="relative",i.style.display="inline-block",i.style.maxWidth="100%";let a=document.createElement("canvas"),o=document.createElement("canvas"),l=Math.min(1,720/s.width),f=Math.round(s.width*l),d=Math.round(s.height*l);for(let k of [a,o])k.width=f,k.height=d,k.style.width="100%",k.style.height="auto",k.style.display="block";o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.cursor="crosshair";let v=a.getContext("2d"),p=o.getContext("2d");if(!v||!p){n(new Error("Canvas not supported"));return}v.drawImage(s,0,0,f,d),i.appendChild(a),i.appendChild(o),e.appendChild(i);let m="highlight",c=false,g=null,x=[],T=k=>{let b=o.getBoundingClientRect(),I="touches"in k?k.touches[0]??k.changedTouches[0]:null,W=I?I.clientX:k.clientX,N=I?I.clientY:k.clientY;return {x:(W-b.left)/b.width*f,y:(N-b.top)/b.height*d}},R=()=>{p.clearRect(0,0,f,d);for(let k of x)if(k.tool==="highlight"&&k.points.length>=2){let[b,I]=k.points;p.fillStyle="rgba(255, 230, 0, 0.35)",p.fillRect(Math.min(b.x,I.x),Math.min(b.y,I.y),Math.abs(I.x-b.x),Math.abs(I.y-b.y));}else if(k.tool==="arrow"&&k.points.length>=2){let[b,I]=k.points;p.strokeStyle="#ef4444",p.lineWidth=3,p.beginPath(),p.moveTo(b.x,b.y),p.lineTo(I.x,I.y),p.stroke();}},S=k=>{c=true,g=T(k);},y=k=>{if(!c||!g)return;c=false;let b=T(k);if(m==="blur"){let I=Math.min(g.x,b.x),W=Math.min(g.y,b.y),N=Math.abs(b.x-g.x),_=Math.abs(b.y-g.y);N>=1&&_>=1&&(v.filter="blur(8px)",v.drawImage(a,I,W,N,_,I,W,N,_),v.filter="none");}else x.push({tool:m,points:[g,b]});g=null,R();};o.addEventListener("mousedown",S),o.addEventListener("mouseup",y),o.addEventListener("touchstart",S,{passive:true}),o.addEventListener("touchend",y),r({canvas:a,setTool(k){m=k;},getDataUrl(){let k=document.createElement("canvas");k.width=f,k.height=d;let b=k.getContext("2d");return b?(b.drawImage(a,0,0),b.drawImage(o,0,0),k.toDataURL("image/jpeg",.85)):t},destroy(){o.removeEventListener("mousedown",S),o.removeEventListener("mouseup",y),o.removeEventListener("touchstart",S),o.removeEventListener("touchend",y),i.remove();}});},s.onerror=()=>n(new Error("Failed to load screenshot")),s.src=t;})}function Zr(){try{let t=globalThis;return t.Sentry?t.Sentry:void 0}catch{return}}function po(){try{return globalThis.__SENTRY_REPLAY__}catch{return}}function ho(){try{let t=globalThis,e=t.__SENTRY__,r=t.Sentry;return e?.version==="9"||r&&typeof r.lastEventId=="function"?e?.version==="9"?"v9":"v8":e?.version==="8"?"v8":r&&typeof r.getCurrentHub=="function"?"v7":"unknown"}catch{return "unknown"}}function Tt(t,e={}){let r=Math.max(0,e.breadcrumbsLimit??30),n={},s=Zr();if(!s)return n;n.sdk=ho();try{let o=s;if(typeof o.lastEventId=="function")n.eventId=o.lastEventId()??void 0;else {let f=s.getCurrentHub?.()?.getScope?.();n.eventId=f?.getLastEventId?.()??void 0;}}catch{}let i;try{let o=s;typeof o.getCurrentScope=="function"?i=o.getCurrentScope():i=s.getCurrentHub?.()?.getScope?.();}catch{}if(i){try{let o=i.getUser?.();o&&(n.user={id:typeof o.id=="string"?o.id:void 0,email:typeof o.email=="string"?o.email:void 0,username:typeof o.username=="string"?o.username:void 0,ip_address:typeof o.ip_address=="string"?o.ip_address:void 0});}catch{}try{let o=i.getTags?.();if(o&&typeof o=="object"){let l={};for(let[f,d]of Object.entries(o))(typeof d=="string"||typeof d=="number"||typeof d=="boolean")&&(l[f]=d);Object.keys(l).length>0&&(n.tags=l);}}catch{}try{n.transactionName=i.getTransactionName?.()??i.getTransaction?.()?.name??void 0;}catch{}try{n.sessionId=i.getSession?.()?.sid??void 0;}catch{}try{let o=i.getBreadcrumbs?.()??i._breadcrumbs??[];if(Array.isArray(o)&&o.length>0){let l=o.slice(-r);n.breadcrumbs=l.map(f=>{let d=f;return {timestamp:typeof d.timestamp=="number"?d.timestamp<1e12?Math.round(d.timestamp*1e3):d.timestamp:void 0,category:typeof d.category=="string"?d.category:void 0,level:typeof d.level=="string"?d.level:void 0,message:typeof d.message=="string"?d.message:void 0,type:typeof d.type=="string"?d.type:void 0,data:d.data&&typeof d.data=="object"?d.data:void 0}});}}catch{}}try{let o=s,l;if(typeof o.getActiveSpan=="function"?l=o.getActiveSpan():i?.getSpan&&(l=i.getSpan()),l){let f=l.spanContext?.();n.traceId=f?.traceId??l.traceId??void 0,n.spanId=f?.spanId??l.spanId??void 0;}}catch{}let a;try{let o=s;typeof o.getClient=="function"?a=o.getClient():a=s.getCurrentHub?.()?.getClient?.();}catch{}if(a){try{let o=a.getOptions?.();o?.release&&(n.release=o.release),o?.environment&&(n.environment=o.environment);}catch{}try{let o=a.getDsn?.();if(o?.host&&o?.projectId&&n.eventId){let l=o.host.replace(/^o\d+\./,"");n.issueUrl=`https://${l}/issues/?query=${encodeURIComponent(n.eventId)}`;}}catch{}}try{let l=s.getReplay?.()??po();n.replayId=l?.getReplayId?.()??void 0;}catch{}return n}function Mt(t,e={}){let r=Zr();if(r){try{let n=r;typeof n.setTag=="function"&&(n.setTag("mushi.report_id",t),e.reportUrl&&n.setTag("mushi.report_url",e.reportUrl)),typeof n.setContext=="function"&&n.setContext("mushi_report",{id:t,...e.reportUrl?{url:e.reportUrl}:{},captured_at:new Date().toISOString()}),typeof n.addBreadcrumb=="function"&&n.addBreadcrumb({category:"mushi",type:"info",level:"info",message:`Mushi report submitted (${t})`,data:{report_id:t,...e.reportUrl?{url:e.reportUrl}:{}}});}catch{}try{let s=r.getCurrentHub?.()?.getScope?.();s&&(s.setTag?.("mushi.report_id",t),e.reportUrl&&s.setTag?.("mushi.report_url",e.reportUrl),s.setContext?.("mushi_report",{id:t,...e.reportUrl?{url:e.reportUrl}:{}}));}catch{}}}var mo=["/login","/logout","/signup","/sso/*","/auth/*"];function en(t,e={}){let r=[];if(e.rageClick!==false){let g=function(x){let T=Date.now();if(x.target===c){if(m.push(T),m=m.filter(R=>T-R<500),m.length>=3){let R=x.target;t.onTrigger("rage_click",{element:R.tagName,id:R.id,text:R.textContent?.slice(0,50)}),m=[];}}else c=x.target,m=[T];};let m=[],c=null;document.addEventListener("click",g,true),r.push(()=>document.removeEventListener("click",g,true));}if(e.longTask!==false&&typeof PerformanceObserver<"u")try{let m=new PerformanceObserver(c=>{for(let g of c.getEntries())g.duration>5e3&&t.onTrigger("long_task",{duration:Math.round(g.duration),startTime:Math.round(g.startTime)});});m.observe({entryTypes:["longtask"]}),r.push(()=>m.disconnect());}catch{}let n=go(e.apiCascade);if(n.enabled){let m=[],c=globalThis.fetch;globalThis.fetch=async function(...g){let[x,T]=g,R=je(x),S=!!ze(x,T)||We(R,{apiEndpoint:e.apiEndpoint,ignoreUrls:n.ignoreUrls});try{let y=await c.apply(this,g);return !S&&!y.ok&&y.status>=400&&Qr(m,t),y}catch(y){throw S||Qr(m,t),y}},r.push(()=>{globalThis.fetch=c;});}if((e.pageDwell===true||typeof e.pageDwell=="object"&&e.pageDwell!==null)&&typeof window<"u"){let R=function(_){return g.some(K=>K.endsWith("/*")?_.startsWith(K.slice(0,-2)):_===K||_.startsWith(K+"/"))},S=function(){let _=window.location?.pathname??"";R(_)||t.onTrigger("page_dwell",{thresholdMs:c,path:_});},y=function(){x&&clearTimeout(x);let _=window.location?.pathname??"";R(_)||(x=setTimeout(S,c));},k=function(){let _=window.location?.pathname??"";_!==T&&(T=_,y());};let m=typeof e.pageDwell=="object"?e.pageDwell??{}:{},c=m.thresholdMs||300*1e3,g=m.excludeRoutes!==void 0?m.excludeRoutes:mo,x=null,T=window.location?.pathname??"";y();let b=window.history,I=b?.pushState,W=b?.replaceState;b&&I&&W&&(b.pushState=function(..._){let K=I.apply(this,_);return k(),K},b.replaceState=function(..._){let K=W.apply(this,_);return k(),K});let N=()=>k();window.addEventListener("popstate",N),r.push(()=>{x&&clearTimeout(x),window.removeEventListener("popstate",N),b&&I&&(b.pushState=I),b&&W&&(b.replaceState=W);});}if((e.firstSession===true||typeof e.firstSession=="object"&&e.firstSession!==null)&&typeof window<"u"){let m=typeof e.firstSession=="object"?e.firstSession??{}:{},c=m.delayMs??45*1e3,g=m.storageKey??(e.projectId?`mushi:${e.projectId}:firstSessionShown`:"mushi:firstSessionShown"),x=false;try{x=window.localStorage?.getItem(g)==="1";}catch{}if(!x){let T=setTimeout(()=>{try{window.localStorage?.setItem(g,"1");}catch{}t.onTrigger("first_session",{delayMs:c});},c);r.push(()=>clearTimeout(T));}}if(e.errorBoundary){let m=function(g){t.onTrigger("error_boundary",{message:g.message,filename:g.filename,lineno:g.lineno,colno:g.colno});},c=function(g){t.onTrigger("error_boundary",{message:g.reason instanceof Error?g.reason.message:String(g.reason),type:"unhandled_rejection"});};window.addEventListener("error",m),window.addEventListener("unhandledrejection",c),r.push(()=>{window.removeEventListener("error",m),window.removeEventListener("unhandledrejection",c);});}return {destroy(){r.forEach(m=>m());}}}function go(t){return t===false?{enabled:false,ignoreUrls:[]}:t&&typeof t=="object"?{enabled:t.enabled!==false,ignoreUrls:t.ignoreUrls??[]}:{enabled:true,ignoreUrls:[]}}function Qr(t,e){let r=Date.now();t.push(r);let n=t.filter(s=>r-s<1e4);n.length>=3&&(e.onTrigger("api_cascade",{failureCount:n.length,windowMs:1e4}),t.length=0);}var tn="mushi:lastDismiss",Ke="mushi:consecDismiss",Lt="mushi:lastShown";function Ge(t){try{return localStorage.getItem(t)}catch{return null}}function Ye(t,e){try{localStorage.setItem(t,e);}catch{}}function rn(t={}){let e=t.maxProactivePerSession??2,r=t.dismissCooldownHours??24,n=t.suppressAfterDismissals??3,s=(t.reshowCooldownMinutes??30)*60*1e3,i=0,a=new Set;function o(v){let p=Date.now();if(parseInt(Ge(Ke)??"0",10)>=n)return false;let c=Ge(tn);if(c&&p-parseInt(c,10)<r*60*60*1e3)return false;if(s>0&&i===0){let g=Ge(Lt);if(g&&p-parseInt(g,10)<s)return false}return i>=e||a.has(v)?false:(a.add(v),i++,Ye(Lt,String(p)),true)}function l(){Ye(tn,String(Date.now()));let v=parseInt(Ge(Ke)??"0",10);Ye(Ke,String(v+1));}function f(){Ye(Ke,"0");}function d(){i=0,a.clear();try{localStorage.removeItem(Lt);}catch{}}return {shouldShow:o,recordDismissal:l,recordSubmission:f,reset:d}}var ue=null,Xe=class{constructor(){}static init(e){if(ue)return De({scope:"mushi",level:"warn",format:"pretty"}).warn("Already initialized \u2014 call destroy() first to reinitialize"),ue;let r={...nr(),...e};if(!r.projectId)throw new Error("[mushi] projectId is required \u2014 set NEXT_PUBLIC_MUSHI_PROJECT_ID / VITE_MUSHI_PROJECT_ID / MUSHI_PROJECT_ID or pass it explicitly");if(!r.apiKey)throw new Error("[mushi] apiKey is required \u2014 set NEXT_PUBLIC_MUSHI_API_KEY / VITE_MUSHI_API_KEY / MUSHI_API_KEY or pass it explicitly");return r.enabled===false?Lo():(ue=fo(r),ue)}static getInstance(){return ue}static destroy(){ue?.destroy(),ue=null;}static diagnose(){return ue?.diagnose()??on()}};function fo(t){let e=yo(t),r=e,n=t.debug??false?De({scope:"mushi",level:"debug",format:"pretty"}):tt,s=null,i=null,a=rr({projectId:e.projectId,apiKey:e.apiKey,...e.apiEndpoint?{apiEndpoint:e.apiEndpoint}:{},getUserToken:()=>s,sdkPackage:he,sdkVersion:Z}),o=sr(e.preFilter),l=cr(e.offline),f=dr({maxBurst:10,refillRate:1,refillIntervalMs:5e3}),d=pr();function v(u){return u.map(h=>{let w={...h};if(typeof h.message=="string"&&(w.message=d.scrub(h.message)),h.data&&typeof h.data=="object"){let L={};for(let[$,P]of Object.entries(h.data))L[$]=typeof P=="string"?d.scrub(P):P;w.data=L;}return w})}function p(u){if(!u)return;let h={};for(let[w,L]of Object.entries(u))h[w]=typeof L=="string"?d.scrub(L):L;return h}let m=null,c=null,g=null,x=null,T=null,R=null,S=Rt(),y=null,k=0,b,I=`mushi:tester-jwt:${e.projectId}`;function W(){try{return typeof localStorage<"u"?localStorage.getItem(I):null}catch{return null}}function _(){try{typeof localStorage<"u"&&localStorage.removeItem(I);}catch{}}async function K(u){let h=await a.getTesterStatus(u);if(!h.ok||!h.data){_();return}let w=h.data;if(!w.is_tester||!w.tester_id){_();return}b.setTesterSession(u,{id:w.tester_id,public_handle:w.public_handle??null,display_name:w.display_name??null});let L=await a.getMyReputation(u);if(L.ok&&L.data){let $=L.data;$.reputation&&b.setTesterReputation($.reputation);}}function be(){if(r.capture?.console!==false?m??=bt():(m?.destroy(),m=null),r.capture?.network!==false){let $={apiEndpoint:$t(r),ignoreUrls:r.capture?.ignoreUrls,tracePropagation:r.capture?.tracePropagation,sessionId:Ce()};c?c.updateOptions($):c=vt($);}else c?.destroy(),c=null;if(r.capture?.performance!==false?g??=Et():(g?.destroy(),g=null),r.capture?.screenshot!=="off"){let $={privacy:r.privacy};x?x.updateOptions($):x=St($);}else x=null;x||(M=null),b.setAllowScreenshotRemove(r.privacy?.allowUserRemoveScreenshot!==false),r.capture?.elementSelector!==false?T??=kt():(T?.deactivate(),T=null,A=null);let u=r.capture?.discoverInventory,h=u===true?{}:u&&typeof u=="object"?u:null;h!=null&&h.enabled!==false?(R?.destroy(),R=Ct({config:h,getRecentNetworkPaths:()=>c?c.getEntries().map($=>{try{let P=new URL($.url,typeof window<"u"?window.location.href:"http://localhost");return P.host&&typeof window<"u"&&P.host!==window.location.host?null:P.pathname}catch{return null}}).filter($=>$!=null&&$.length>0&&$.length<200):[],getUserId:()=>z?.id??null,getSessionId:Ce,onEvent:$=>{a.postDiscoveryEvent({...$,sdk_version:Z}).catch(P=>{n.debug("discovery emit failed",{err:String(P)});});}})):(R?.destroy(),R=null);let L=r.capture?.replay??"off";if(L==="rrweb"||L==="lite"){let $=++k;Xr({redactSelectors:r.privacy?.redactSelectors}).then(P=>{if($!==k){P.destroy();return}y?.destroy(),y=P,y.start();});}else k++,y?.destroy(),y=null;}let G=new Map;function C(u,h){G.get(u)?.forEach(w=>w({type:u,data:h}));}let M=null,A=null,O=null,j=false,z=null,de={},ee={},D=hr({max:50});D.add({category:"lifecycle",level:"info",message:"Mushi SDK init",data:{projectId:e.projectId,sdkVersion:Z}});let ye=null;ye=$o(D);let F=false;async function Ee(){if(!x||F)return null;F=true;let u=b.getIsOpen();u&&b.hidePanel();let h=document.getElementById("mushi-mushi-widget"),w=h?.style.visibility??"";h&&(h.style.visibility="hidden"),await new Promise(L=>{requestAnimationFrame(()=>requestAnimationFrame(()=>L()));});try{return await x.take()}finally{F=false,h&&(h.style.visibility=w),u&&b.showPanel();}}async function $e(u){let h=r.capture?.screenshot;!x||h==="off"||M||u==="open"&&h!=="auto"||u==="submit"&&h!=="on-report"&&h!=="auto"||(n.debug("Auto-capturing screenshot",{when:u,mode:h}),M=await Ee(),b.setScreenshotAttached(M!==null));}b=new Ue(e.widget,{onSubmit:async({category:u,userCategory:h,description:w,intent:L})=>(n.info("Report submitted",{category:u,userCategory:h,intent:L}),ke?.recordSubmission(),await $e("submit"),await cn(u,w,L,h)??{reportId:null,queuedOffline:true}),onOpen:()=>{n.debug("Widget opened"),$e("open"),y?.start(),C("widget:opened");},onClose:()=>{n.debug("Widget closed"),O&&(ke?.recordDismissal(),C("proactive:dismissed",{type:O})),M=null,A=null,O=null,C("widget:closed");},onScreenshotRequest:async()=>{!x||r.capture?.screenshot==="off"||(n.debug("Taking screenshot"),M=await Ee(),b.setScreenshotAttached(M!==null));},onScreenshotRemove:()=>{n.debug("Screenshot attachment removed"),M=null,b.setScreenshotAttached(false);},onScreenshotAnnotateRequest:async u=>{if(!M||u.childElementCount>0)return;let h;try{h=await Jr(M,u);}catch(X){n.warn("Screenshot annotation failed",{error:X instanceof Error?X.message:String(X)});return}let w=document.createElement("div");w.className="mushi-annotate-toolbar";let L=X=>{(M=h.getDataUrl(),b.setScreenshotAttached(true)),h.destroy(),w.remove();},$=[{id:"highlight",label:"\u270F\uFE0F Highlight"},{id:"blur",label:"\u{1F512} Blur"},{id:"arrow",label:"\u2197\uFE0F Arrow"}];for(let X of $){let H=document.createElement("button");H.type="button",H.className="mushi-attach-btn",H.dataset.tool=X.id,H.textContent=X.label,H.addEventListener("click",()=>{h.setTool(X.id),w.querySelectorAll("button[data-tool]").forEach(oe=>oe.classList.remove("active")),H.classList.add("active");}),w.appendChild(H);}w.querySelector('button[data-tool="highlight"]')?.classList.add("active");let P=document.createElement("button");P.type="button",P.className="mushi-attach-btn",P.textContent="\u2713 Done",P.addEventListener("click",()=>L()),w.appendChild(P),u.insertBefore(w,u.firstChild);},onElementSelectorRequest:async()=>{if(!(!T||r.capture?.elementSelector===false)){n.debug("Element selector activated"),b.setElementCapturing(true),b.hidePanel();try{let u=await T.activate();u?(A=u,b.setElementSelected(!0),n.debug("Element selected",{tagName:u.tagName,xpath:u.xpath})):b.setElementCapturing(!1);}finally{b.showPanel();}}},async onReporterReportsRequest(){let u=await a.listReporterReports(Y());if(!u.ok)throw new Error(u.error?.message??"Could not load reports");return u.data?.reports??[]},async onReporterCommentsRequest(u){let h=await a.listReporterComments(u,Y());if(!h.ok)throw new Error(h.error?.message??"Could not load thread");return h.data?.comments??[]},async onReporterReply(u,h){let w=await a.replyToReporterReport(u,Y(),h);if(!w.ok)throw new Error(w.error?.message??"Could not send reply")},async onReporterFeedback(u,h,w){let L=await a.replyToReporterReport(u,Y(),w??"",h);if(!L.ok)throw new Error(L.error?.message??"Could not send feedback");return L.data?.feedback??null},async onReporterReopen(u,h){let w=await a.reopenReporterReport(u,Y(),h);if(!w.ok)throw new Error(w.error?.message??"Could not reopen report");return w.data?.outcome??null},async onFeatureBoardRequest(){let u=await a.listReporterFeatureBoard(Y());if(!u.ok)throw new Error(u.error?.message??"Could not load community ideas");return u.data?.tickets??[]},async onFeatureBoardVote(u){let h=await a.voteReporterFeatureBoard(u,Y());if(!h.ok)throw new Error(h.error?.message??"Could not vote");return h.data??{voted:true,action:"added"}},onLeaderboardOpen(){b.setLeaderboard(null,true),qr(10).then(u=>{b.setLeaderboard(u,false);});},async onMushiSignIn(u){let h=await a.sendMagicLink(u);if(!h.ok)throw new Error(h.error?.message??"Could not send sign-in link");return {ok:true}},async onGlobalLeaderboardOpen(){b.setGlobalLeaderboard(null,true);try{let u=W(),h=await a.getPublicLeaderboard(50),L=(h.ok?h.data?.leaderboard??[]:[]).map($=>({tester_id:$.tester_id,rank:$.rank,public_handle:$.public_handle,display_name:$.display_name,points_30d:$.points_30d,total_points:$.total_points??0,badge:$.badge_slug}));if(b.setGlobalLeaderboard(L,!1),u){let $=await a.getMyReputation(u);if($.ok&&$.data){let P=$.data;P.reputation&&b.setTesterReputation(P.reputation);}}}catch{b.setGlobalLeaderboard([],false);}},async onCrossAppReportsOpen(){let u=W();if(!u){b.setCrossAppReports([],false);return}try{let h=await a.getCrossAppReports(u),w=h.ok?h.data?.reports??[]:[];b.setCrossAppReports(w,!1);}catch{b.setCrossAppReports([],false);}},onTesterSignOut(){_();},assistantEnabled:e.assistant?.enabled===true,...e.assistant?.label?{assistantLabel:e.assistant.label}:{},...e.assistant?.greeting?{assistantGreeting:e.assistant.greeting}:{},...e.assistant?.suggestions?{assistantSuggestions:e.assistant.suggestions}:{},async onAssistantAsk(u,h){let w=await a.askAssistant({message:u,threadId:h,context:i});return w.ok?w.data??null:null}},Z),be(),typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>b.mount()):b.mount());let At=W();At&&K(At).catch(()=>_());let _t=null,ke=null,V=r.proactive;V&&(V.rageClick!==false||V.longTask!==false||V.apiCascade!==false||V.errorBoundary===true||V.pageDwell||V.firstSession)&&typeof document<"u"&&(ke=rn(V?.cooldown),_t=en({onTrigger:(u,h)=>{if(!ke.shouldShow(u)){n.debug("Proactive trigger suppressed by fatigue prevention",{type:u});return}n.info("Proactive trigger fired",{type:u,context:h}),O=u,C("proactive:triggered",{type:u,context:h}),u==="first_session"?b.pulseTrigger?.():b.open();}},{rageClick:V?.rageClick,longTask:V?.longTask,apiCascade:V?.apiCascade,apiEndpoint:$t(r),errorBoundary:V?.errorBoundary,pageDwell:V?.pageDwell,firstSession:V?.firstSession,projectId:e.projectId}),n.debug("Proactive triggers enabled",{rageClick:V?.rageClick!==false,longTask:V?.longTask!==false,apiCascade:V?.apiCascade!==false,errorBoundary:V?.errorBoundary===true,pageDwell:!!V?.pageDwell,firstSession:!!V?.firstSession})),l.startAutoSync(a),l.flush(a).then(u=>{u.sent>0&&n.info("Synced offline reports",{sent:u.sent});});function Je(u){if(j=true,u.enabled===false){r=e,Ro(t.projectId),be(),b.updateConfig(r.widget),n.debug("Runtime SDK config disabled; using bootstrap config",{version:u.version});return}r=bo(r,u),be(),u.widget&&b.updateConfig(r.widget),n.debug("Applied runtime SDK config",{version:u.version});}if(wo(t)){let u=Eo(t.projectId);u&&Je(u),a.getSdkConfig().then(h=>{h.ok&&h.data?(ko(t.projectId,h.data),Je(h.data)):h.error&&n.debug("Runtime SDK config unavailable",h.error);}).catch(h=>{n.debug("Runtime SDK config fetch failed",{error:h instanceof Error?h.message:String(h)});});}else n.debug("Runtime SDK config disabled via runtimeConfig:false; using static bootstrap config");ln(),n.info("Initialized",{projectId:t.projectId});async function ln(){if(r.widget?.outdatedBanner==="off")return;let u=Co(he);u&&Pt(u);let h=await a.getLatestSdkVersion(he);!h.ok||!h.data||(To(he,h.data),Pt(h.data));}function Pt(u){let h=u.latest,w=!!(h&&Mo(Z,h));if(!w&&!u.deprecated)return;let L=u.deprecationMessage??(w?`Update ${he} to ${h}.`:null);n.warn("Mushi SDK is outdated",{package:he,current:Z,latest:h,deprecated:u.deprecated,message:L}),r.widget?.outdatedBanner!=="console-only"&&b.setSdkFreshness({latest:h,current:Z,deprecated:u.deprecated,message:L});}async function cn(u,h,w,L){let $=o.check(h);if(!$.passed){n.info("Report blocked by pre-filter",{reason:$.reason});return}let P=t.preFilter?.wasmClassifier;if(P)try{let q=await P.classify({description:h,category:u,url:typeof location<"u"?location.href:void 0,hasScreenshot:M!==null,hasSelectedElement:A!==null,hasNetworkErrors:c?.getEntries()?.some(te=>te.status>=400||!!te.error)??!1,hasConsoleErrors:m?.getEntries()?.some(te=>te.level==="error")??!1,proactiveTrigger:O??void 0});if(q.verdict==="block"){n.info("Report blocked by on-device classifier",{modelId:q.modelId,confidence:q.confidence,reason:q.reason});return}n.debug("On-device classifier verdict",{...q});}catch(q){n.warn("On-device classifier threw \u2014 falling through to server",{error:q instanceof Error?q.message:String(q)});}if(!f.tryConsume()){n.warn("Report throttled \u2014 rate limit exceeded");return}let X=d.scrub(o.truncate(h)),H=t.sentry?Tt(t.sentry):void 0,oe=await ur().catch(()=>null),Ot=r.capture?.console===false?void 0:m?.getEntries(),Ht=r.capture?.network===false?void 0:c?.getEntries(),Bt=v(D.getAll()),Nt=p(Object.keys(ee).length>0?{...ee}:void 0),Ft=H?{...H,...H.breadcrumbs?{breadcrumbs:v(H.breadcrumbs)}:{},...H.tags?{tags:p(H.tags)}:{}}:void 0,Ut=M?await br(M).catch(()=>null):null;M&&!Ut&&n.warn("Screenshot dropped \u2014 could not compress under wire budget");let ie={id:nt(),projectId:t.projectId,category:u,...L?{userCategory:L}:{},description:X,userIntent:w,environment:rt(),consoleLogs:Ot,networkLogs:Ht,performanceMetrics:r.capture?.performance===false?void 0:g?.getMetrics(),timeline:S.getEntries({consoleLogs:Ot,networkLogs:Ht}),screenshotDataUrl:Ut??void 0,selectedElement:A??void 0,...y?{replayEvents:y.flush()}:{},metadata:{...de,...z?{user:z}:{},...H?.release?{sentryRelease:H.release}:{}},sessionId:Ce(),reporterToken:Y(),...oe?{fingerprintHash:oe}:{},appVersion:t.integrations?.vercel?.analyticsId,sdkPackage:he,sdkVersion:Z,proactiveTrigger:O??void 0,...Bt.length>0?{breadcrumbs:Bt}:{},...Nt?{tags:Nt}:{},...Ft?{sentryContext:Ft}:{},sentryEventId:H?.eventId,sentryReplayId:H?.replayId,createdAt:new Date().toISOString()};if(D.add({category:"lifecycle",level:"info",message:`Mushi report submitting (${u})`,data:{reportId:ie.id,category:u}}),t.integrations?.custom){let q={addMetadata(te,un){ie.metadata[te]=un;},setCategory(te){ie.category=te;},setDescription(te){ie.description=te;}};t.integrations.custom(q);}let B=ie;if(t.beforeSendFeedback)try{let q=await Promise.race([Promise.resolve(t.beforeSendFeedback(ie)),new Promise(te=>setTimeout(()=>te(ie),2e3))]);if(q===null){n.info("Report dropped by beforeSendFeedback hook",{reportId:ie.id});return}B=q;}catch(q){n.warn("beforeSendFeedback hook threw \u2014 sending unmodified report",{error:q instanceof Error?q.message:String(q)});}if(C("report:submitted",{reportId:B.id}),typeof navigator<"u"&&!navigator.onLine)return await l.enqueue(B),n.info("Offline \u2014 report queued",{reportId:B.id}),C("report:queued",{reportId:B.id}),{reportId:null,queuedOffline:true};let U=await a.submitReport(B);if(!U.ok&&U.error?.code==="PAYLOAD_TOO_LARGE"&&(Array.isArray(B.replayEvents)&&B.replayEvents.length>0&&(n.warn("Report too large \u2014 dropping replay buffer and retrying",{reportId:B.id}),B={...B,replayEvents:void 0},U=await a.submitReport(B)),!U.ok&&U.error?.code==="PAYLOAD_TOO_LARGE"&&B.screenshotDataUrl&&(n.warn("Report still too large \u2014 dropping screenshot and retrying",{reportId:B.id}),B={...B,screenshotDataUrl:void 0},U=await a.submitReport(B))),U.ok){if(n.info("Report sent",{reportId:U.data?.reportId}),C("report:sent",{reportId:U.data?.reportId}),U.data?.cursorAgentId){let q=U.data;C("report:dispatched",{reportId:q.reportId,agentId:q.cursorAgentId,fixId:q.fixId});}D.add({category:"lifecycle",level:"info",message:`Mushi report sent (${U.data?.reportId??ie.id})`}),Se({action:"report_submit",metadata:{category:u,reportId:U.data?.reportId??ie.id}});try{t.sentry&&U.data?.reportId&&Mt(U.data.reportId);}catch{}}else U.error?.code==="PAYLOAD_TOO_LARGE"||U.error?.code==="SERIALIZE_FAILED"?(n.warn("Report exceeds size limit after degradation \u2014 dropping",{reportId:B.id,error:U.error}),C("report:failed",{reportId:B.id,error:U.error}),D.add({category:"lifecycle",level:"error",message:`Mushi report dropped \u2014 payload too large (${B.id})`})):(n.warn("Report failed, queuing for retry",{reportId:B.id,error:U.error}),await l.enqueue(B),C("report:failed",{reportId:B.id,error:U.error}),D.add({category:"lifecycle",level:"warning",message:`Mushi report queued for retry (${B.id})`}));return M=null,A=null,O=null,U?.ok?{reportId:U.data?.reportId??ie.id,queuedOffline:false}:{reportId:null,queuedOffline:true}}let Dt={report(u){b.open(u);},on(u,h){return G.has(u)||G.set(u,new Set),G.get(u).add(h),()=>G.get(u)?.delete(h)},setUser(u){z=u;},setMetadata(u,h){de[u]=h;},setScreen(u){S.setScreen(u);},isOpen(){return b.getIsOpen()},open(){b.open();},openWith(u){b.open({category:u});},show(){b.showTrigger();},hide(){b.hideTrigger();},attachTo(u,h){return b.attachTo(u,h)},setTrigger(u){b.setTrigger(u);},openReporter(){b.openReporter();},close(){b.close();},updateConfig(u){Je(u);},diagnose(){return xo({apiEndpoint:$t(r),widgetMounted:b.getIsMounted(),runtimeConfigLoaded:j,captureScreenshotAvailable:x!==null,captureNetworkIntercepting:c!==null,widgetDiagnostics:b.getWidgetDiagnostics()})},destroy(){_t?.destroy(),ke?.reset(),b.destroy(),m?.destroy(),c?.destroy(),g?.destroy(),T?.deactivate(),S.destroy(),R?.destroy(),R=null,y?.destroy(),y=null,l.stopAutoSync(),ye?.(),ye=null,D.clear(),G.clear(),ue=null,n.debug("Destroyed");},async captureEvent(u){if(!f.tryConsume())return n.warn("captureEvent throttled \u2014 rate limit exceeded"),null;let h=d.scrub(o.truncate(u.description)),w=u.category??"bug",L=t.sentry?Tt(t.sentry):void 0,$=v(D.getAll()),P=p(Object.keys(ee).length===0&&!u.tags?void 0:{...ee,...u.tags??{}}),X=L?{...L,...L.breadcrumbs?{breadcrumbs:v(L.breadcrumbs)}:{},...L.tags?{tags:p(L.tags)}:{}}:void 0,H={id:nt(),projectId:t.projectId,category:w,description:h,environment:rt(),timeline:S.getEntries(),metadata:{...u.metadata??{},...z?{user:z}:{},...u.error?{error:u.error}:{},...u.severity?{severity:u.severity}:{},...u.component?{component:u.component}:{},...u.source?{source:u.source}:{source:"captureEvent"}},...$.length>0?{breadcrumbs:$}:{},...P&&Object.keys(P).length>0?{tags:P}:{},...X?{sentryContext:X}:{},sessionId:Ce(),reporterToken:Y(),sdkPackage:he,sdkVersion:Z,sentryEventId:L?.eventId,sentryReplayId:L?.replayId,createdAt:new Date().toISOString()};if(C("report:submitted",{reportId:H.id}),typeof navigator<"u"&&!navigator.onLine)return await l.enqueue(H),C("report:queued",{reportId:H.id}),null;let oe=await a.submitReport(H);if(oe.ok){C("report:sent",{reportId:oe.data?.reportId});try{t.sentry&&oe.data?.reportId&&Mt(oe.data.reportId);}catch{}return oe.data?.reportId??null}return await l.enqueue(H),C("report:failed",{reportId:H.id,error:oe.error}),null},async captureException(u,h){let w=mr(u);D.add({category:"lifecycle",level:"error",message:`Mushi.captureException(${w.name}): ${w.message}`,...w.stack?{data:{stack:w.stack.slice(0,500)}}:{}});let L=h?.description?.trim()||`${w.name}: ${w.message}`||"Uncaught exception";return Dt.captureEvent({description:L,category:h?.category??"bug",severity:h?.severity??"high",...h?.component?{component:h.component}:{},...h?.tags?{tags:h.tags}:{},source:h?.source??"captureException",error:{name:w.name,message:w.message,...w.stack?{stack:w.stack}:{}},metadata:{...h?.metadata??{},...w.cause?{cause:w.cause}:{}}})},identify(u,h){if(z={id:u,...h?.email?{email:h.email}:{},...h?.name?{name:h.name}:{}},h)for(let[w,L]of Object.entries(h))w!=="email"&&w!=="name"&&(de[`user.${w}`]=L);if(D.add({category:"lifecycle",level:"info",message:`Mushi.identify(${u})`}),r.rewards?.enabled){let w={client:a,config:r.rewards,projectId:e.projectId,userId:u,traits:h?{email:h.email,name:h.name,provider:h.provider}:void 0};z.id===u?Nr(w):Fr(u,w.traits),r.rewards.showInWidget!==false&&a.getMyPoints(u).then(L=>{if(!L.ok)return;let $=L.data;b.setRewardsState({tier:$.tier?{slug:$.tier.slug??"free",displayName:$.tier.display_name??"Free",pointsThreshold:$.tier.points_threshold??0}:null,nextTier:$.next_tier?{displayName:$.next_tier.display_name??"",pointsThreshold:$.next_tier.points_threshold??0}:null,totalPoints:$.total_points??0,pointsForReport:$.report_submit_pts??50});}).catch(()=>{});}},identifyWithToken(u){if(s=u&&typeof u=="string"?u:null,s){let h=gr(s);h?.sub&&(z={id:h.sub,...h.email?{email:h.email}:{},...h.name?{name:h.name}:{}}),D.add({category:"lifecycle",level:"info",message:"Mushi.identifyWithToken()"});}else D.add({category:"lifecycle",level:"info",message:"Mushi.identifyWithToken(null)"});},publishPageContext(u){i=u&&u.route?u:null;},openAssistant(){b.openAssistantTab();},addBreadcrumb(u){D.add(u);},getBreadcrumbs(){return D.getAll()},setTag(u,h){typeof u!="string"||u.length===0||(ee[u]=h);},setTags(u){if(!(!u||typeof u!="object"))for(let[h,w]of Object.entries(u))typeof h=="string"&&h.length>0&&(ee[h]=w);},clearTag(u){if(typeof u=="string"&&u.length>0){delete ee[u];return}for(let h of Object.keys(ee))delete ee[h];},async getReputation(){if(!z?.id)return null;let u=await a.getMyPoints(z.id);return u.ok?{totalPoints:u.data.total_points??0,points30d:u.data.points_30d??0,reputation:1,confirmedBugs:0,totalReports:0}:null},async getTier(){return z?.id?Ur(z.id):null},recordActivity(u,h){r.rewards?.enabled&&Se({action:u,metadata:h});},pulseTrigger(){b.pulseTrigger?.();},async listMyReports(){let u=await a.listReporterReports(Y());return u.ok?u.data?.reports??[]:[]},async listMyComments(u){let h=await a.listReporterComments(u,Y());return h.ok?h.data?.comments??[]:[]},async replyToReport(u,h){let w=await a.replyToReporterReport(u,Y(),h);return w.ok?w.data?.comment??null:null},async submitFeedbackSignal(u,h,w){let L=await a.replyToReporterReport(u,Y(),w??"",h);return L.ok?L.data?.feedback??null:null},async reopenReport(u,h){let w=await a.reopenReporterReport(u,Y(),h);return w.ok?w.data?.outcome??null:null},openMyReports(){b.recorderOpenMyReports();},async getHallOfFame(u=20){let h=await a.getHallOfFame(u);return h.ok?h.data?.data??[]:[]}};if(typeof globalThis<"u"&&(e.debug??false)&&Mr(b),typeof window<"u"&&typeof localStorage<"u"){let u="mushi:last-run",h=null;try{let w=localStorage.getItem(u);h=w===null?null:w==="unfinished",localStorage.setItem(u,"unfinished");}catch{h=null;}try{window.addEventListener("pagehide",()=>{try{localStorage.setItem(u,"clean");}catch{}});}catch{}if(typeof e.onCrashedLastRun=="function")try{e.onCrashedLastRun(h);}catch(w){n.warn("onCrashedLastRun hook threw",{error:w instanceof Error?w.message:String(w)});}}return Dt}function bo(t,e){let r=e.native?.triggerMode,n=e.widget?.launcher,s=n??e.widget?.trigger??(r==="none"||r==="shake"?"manual":void 0),i=n==="hidden"||e.widget?.trigger==="hidden",a=t.widget?.trigger,o=s==="hidden"&&!i&&a&&a!=="hidden"?a:s,l=e.widget,f=l?.bannerVariant,d=l?.bannerPosition,v=l?.bannerMessage,p=l?.bannerLabel,m=l?.bannerBugCta,c=l?.bannerFeatureCta,g=f||d||v!=null||p!=null||m!=null||c!=null?{...t.widget?.bannerConfig??{},...f?{variant:f}:{},...d?{position:d}:{},...v!=null?{message:v}:{},...p!=null?{label:p===""?false:p}:{},...m!=null?{bugCta:m??void 0}:{},...c!=null?{featureCta:c}:{}}:void 0;return {...t,widget:{...t.widget,...e.widget,...o?{trigger:o}:{},...g?{bannerConfig:g}:{},...t.widget?.betaMode?{betaMode:t.widget.betaMode}:{}},capture:{...t.capture,...e.capture},privacy:{...t.privacy}}}function yo(t){if(!t.preset)return t;let e=vo(t.preset);return {...t,widget:{...e.widget,...t.widget},capture:{...e.capture,...t.capture},proactive:{...e.proactive,...t.proactive,cooldown:{...e.proactive?.cooldown,...t.proactive?.cooldown}}}}function vo(t){switch(t){case "manual-only":return {widget:{trigger:"manual",outdatedBanner:"console-only"},capture:{console:true,network:true,performance:false,screenshot:"on-report",elementSelector:false},proactive:{rageClick:false,longTask:false,apiCascade:false,errorBoundary:false}};case "beta-loud":return {widget:{trigger:"auto",outdatedBanner:"banner"},capture:{console:true,network:true,performance:true,screenshot:"auto",elementSelector:true},proactive:{rageClick:true,longTask:true,apiCascade:true,errorBoundary:true}};case "internal-debug":return {widget:{trigger:"auto",outdatedBanner:"banner",brandFooter:true},capture:{console:true,network:true,performance:true,screenshot:"auto",elementSelector:true},proactive:{rageClick:true,longTask:true,apiCascade:true,errorBoundary:true,cooldown:{maxProactivePerSession:10,dismissCooldownHours:0,suppressAfterDismissals:99}}};case "production-calm":return {widget:{trigger:"auto",outdatedBanner:"console-only"},capture:{console:true,network:true,performance:false,screenshot:"on-report",elementSelector:false},proactive:{rageClick:false,longTask:false,apiCascade:false,errorBoundary:false}}}}function $t(t){return t.apiEndpoint??et}function wo(t){return t.runtimeConfig!==false}async function xo(t){let e=await So(t.apiEndpoint);return {apiEndpointReachable:e.reachable,cspAllowsEndpoint:e.cspAllowed,widgetMounted:t.widgetMounted,shadowDomAvailable:typeof HTMLElement<"u"&&typeof HTMLElement.prototype.attachShadow=="function",dialogSupported:typeof HTMLDialogElement<"u",runtimeConfigLoaded:t.runtimeConfigLoaded,captureScreenshotAvailable:t.captureScreenshotAvailable,captureNetworkIntercepting:t.captureNetworkIntercepting,sdkVersion:Z,widgetHostPointerSafe:t.widgetDiagnostics?.widgetHostPointerSafe??false,widgetHostBounds:t.widgetDiagnostics?.widgetHostBounds??null,widgetSuppressed:t.widgetDiagnostics?.widgetSuppressed??false,bannerRendered:t.widgetDiagnostics?.bannerRendered??false}}async function on(){return {apiEndpointReachable:false,cspAllowsEndpoint:false,widgetMounted:false,shadowDomAvailable:typeof HTMLElement<"u"&&typeof HTMLElement.prototype.attachShadow=="function",dialogSupported:typeof HTMLDialogElement<"u",runtimeConfigLoaded:false,captureScreenshotAvailable:false,captureNetworkIntercepting:false,sdkVersion:Z,widgetHostPointerSafe:false,widgetHostBounds:null,widgetSuppressed:false,bannerRendered:false}}async function So(t){if(typeof fetch>"u")return {reachable:false,cspAllowed:false};let e=typeof AbortController<"u"?new AbortController:null,r=e?setTimeout(()=>e.abort(),3e3):null;try{return {reachable:(await fetch(`${t.replace(/\/$/,"")}/health`,{method:"GET",cache:"no-store",...e?{signal:e.signal}:{},[ve]:"diagnose"})).ok,cspAllowed:!0}}catch{return {reachable:false,cspAllowed:false}}finally{r&&clearTimeout(r);}}function It(t){return `mushi:sdk-config:${t}`}function an(t){return `mushi:sdk-version:${t}`}function Eo(t){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(It(t));return e?JSON.parse(e).config??null:null}catch{return null}}function ko(t,e){if(!(typeof localStorage>"u"))try{localStorage.setItem(It(t),JSON.stringify({cachedAt:Date.now(),config:e}));}catch{}}function Ro(t){if(!(typeof localStorage>"u"))try{localStorage.removeItem(It(t));}catch{}}function Co(t){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(an(t));if(!e)return null;let r=JSON.parse(e);return !r.data||!r.cachedAt||Date.now()-r.cachedAt>864e5?null:r.data}catch{return null}}function To(t,e){if(!(typeof localStorage>"u"))try{localStorage.setItem(an(t),JSON.stringify({cachedAt:Date.now(),data:e}));}catch{}}function Mo(t,e){let r=nn(t),n=nn(e);for(let s=0;s<Math.max(r.length,n.length);s++){let i=r[s]??0,a=n[s]??0;if(i<a)return true;if(i>a)return false}return false}function nn(t){return t.split(/[.-]/).map(e=>Number.parseInt(e,10)).filter(e=>Number.isFinite(e))}function Lo(){return {report:()=>{},on:()=>()=>{},setUser:()=>{},setMetadata:()=>{},setScreen:()=>{},isOpen:()=>false,open:()=>{},close:()=>{},updateConfig:()=>{},diagnose:on,openWith:()=>{},show:()=>{},hide:()=>{},attachTo:()=>()=>{},setTrigger:()=>{},openReporter:()=>{},destroy:()=>{ue=null;},captureEvent:async()=>null,captureException:async()=>null,identify:()=>{},identifyWithToken:()=>{},publishPageContext:()=>{},openAssistant:()=>{},addBreadcrumb:()=>{},getBreadcrumbs:()=>[],setTag:()=>{},setTags:()=>{},clearTag:()=>{},getReputation:async()=>null,getTier:async()=>null,recordActivity:()=>{},pulseTrigger:()=>{},listMyReports:async()=>[],listMyComments:async()=>[],replyToReport:async()=>null,submitFeedbackSignal:async()=>null,reopenReport:async()=>null,openMyReports:()=>{},getHallOfFame:async()=>[]}}function $o(t){if(typeof window>"u")return ()=>{};let e=[];try{let r=a=>{t.add({category:"navigation",level:"info",message:`${a}: ${window.location.pathname}`,data:{url:window.location.href,kind:a}});},n=()=>r("popstate");window.addEventListener("popstate",n,{passive:!0}),e.push(()=>window.removeEventListener("popstate",n));let s=window.history.pushState,i=window.history.replaceState;window.history.pushState=function(...o){let l=s.apply(this,o);try{r("pushState");}catch{}return l},window.history.replaceState=function(...o){let l=i.apply(this,o);try{r("replaceState");}catch{}return l},e.push(()=>{window.history.pushState=s,window.history.replaceState=i;});}catch{}try{let r=console.error,n=console.warn;console.error=function(...s){try{t.add({category:"console",level:"error",message:s.map(sn).join(" ")});}catch{}return r.apply(this,s)},console.warn=function(...s){try{t.add({category:"console",level:"warning",message:s.map(sn).join(" ")});}catch{}return n.apply(this,s)},e.push(()=>{console.error=r,console.warn=n;});}catch{}try{let r=n=>{try{let s=n.target;if(!(s instanceof Element))return;let i=s,a=0;for(;i&&a<10;){let o=i.getAttribute("data-testid");if(o){let l=(i.textContent??"").trim().slice(0,80);t.add({category:"ui.click",level:"info",message:`clicked ${o}${l?` \u2014 ${l}`:""}`,data:{testid:o,tag:i.tagName.toLowerCase()}});return}i=i.parentElement,a++;}}catch{}};document.addEventListener("click",r,{passive:!0,capture:!0}),e.push(()=>document.removeEventListener("click",r,!0));}catch{}return ()=>{for(let r of e)try{r();}catch{}}}function sn(t){try{if(t instanceof Error)return `${t.name}: ${t.message}`;if(typeof t=="object"&&t!==null){let r=JSON.stringify(t);return r.length>200?`${r.slice(0,200)}\u2026`:r}let e=String(t);return e.length>200?`${e.slice(0,200)}\u2026`:e}catch{return `[${typeof t}]`}}function Io(){let t=document.currentScript;if(t&&t.dataset&&t.dataset.project)return t;let e=Array.from(document.querySelectorAll("script[data-project][data-key]"));return e.length>0?e[e.length-1]:null}function Ao(t){let e=t.project?.trim(),r=t.key?.trim();if(!e||!r)return null;let n={};t.trigger&&(n.trigger=t.trigger),t.theme&&(n.theme=t.theme),t.position&&(n.position=t.position),t.triggerText&&(n.triggerText=t.triggerText);let s=t.bannerVariant,i=t.bannerPosition;(s||i)&&(n.bannerConfig={...s?{variant:s}:{},...i?{position:i}:{}});let a={projectId:e,apiKey:r};return t.endpoint&&(a.apiEndpoint=t.endpoint),t.debug==="true"&&(a.debug=true),Object.keys(n).length>0&&(a.widget=n),a}function _o(){if(typeof document>"u"||typeof window>"u")return;let t=window;if(t.__mushiLoaderInit)return;let e=Io();if(!e)return;let r=Ao(e.dataset);if(r){t.__mushiLoaderInit=true;try{Xe.init(r);}catch{}}}_o();
2230
+ `,document.body.appendChild(c),c}function o(c){if(!e)return;let g=c.getBoundingClientRect();e.style.left=`${g.left}px`,e.style.top=`${g.top}px`,e.style.width=`${g.width}px`,e.style.height=`${g.height}px`,e.style.display="block";}function l(c){let g=c.target;g!==e&&o(g);}function f(c){c.preventDefault(),c.stopPropagation();let g=c.target;if(g===e||(c.composedPath?c.composedPath():[]).some(S=>S instanceof Element&&S.id==="mushi-mushi-widget"))return;let R=i(g);v(R);}function p(c){c.key==="Escape"&&v(null);}function v(c){m(),r?.(c),r=null;}function d(){return t&&m(),new Promise(c=>{r=c,t=true,e=a(),document.body.style.cursor="crosshair",document.addEventListener("mousemove",l,true),document.addEventListener("click",f,true),document.addEventListener("keydown",p,true);})}function m(){t&&(t=false,document.body.style.cursor="",document.removeEventListener("mousemove",l,true),document.removeEventListener("click",f,true),document.removeEventListener("keydown",p,true),e&&(e.remove(),e=null));}return {activate:d,deactivate:m,isActive:()=>t}}function $t(){let t=[],e=history.pushState,r=history.replaceState,n=()=>a("popstate"),s=()=>a("hashchange");a("initial");function i(l){t.push(l),t.length>120&&t.shift();}function a(l){typeof location>"u"||i({ts:Date.now(),kind:"route",payload:{source:l,route:`${location.pathname}${location.search}${location.hash}`,href:location.href}});}function o(l){let f=l.target instanceof Element?l.target:null;if(!f)return;let p=f.closest('button,a,[role="button"],input,textarea,select,[data-mushi-track]')??f;i({ts:Date.now(),kind:"click",payload:{tag:p.tagName.toLowerCase(),id:p.id||void 0,text:ro(p)}});}return history.pushState=function(...f){let p=e.apply(this,f);return a("pushState"),p},history.replaceState=function(...f){let p=r.apply(this,f);return a("replaceState"),p},window.addEventListener("popstate",n),window.addEventListener("hashchange",s),document.addEventListener("click",o,true),{setScreen(l){i({ts:Date.now(),kind:"screen",payload:l});},getEntries(l={}){return [...t,...(l.consoleLogs??[]).map(p=>({ts:p.timestamp,kind:"log",payload:{level:p.level,message:p.message}})),...(l.networkLogs??[]).map(p=>({ts:p.timestamp,kind:"request",payload:{method:p.method,url:p.url,status:p.status,duration:p.duration,error:p.error}}))].sort((p,v)=>p.ts-v.ts).slice(-120)},clear(){t.length=0;},destroy(){history.pushState=e,history.replaceState=r,window.removeEventListener("popstate",n),window.removeEventListener("hashchange",s),document.removeEventListener("click",o,true);}}}function ro(t){let e=(t.textContent??"").replace(/\s+/g," ").trim();return e?e.slice(0,80):void 0}var no=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,so=/^[0-9a-f]{20,}$/i,oo=/^\d+$/,io=/^[a-z0-9]{16,}$/i;function Yr(t){return t.length===0?t:no.test(t)||so.test(t)||oo.test(t)||io.test(t)&&/\d/.test(t)?"[id]":t}function Xr(t,e){let r=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;if(e?.length){let n=ao(r,e);if(n)return n}return "/"+r.split("/").filter(n=>n.length>0).map(Yr).join("/")}function ao(t,e){let r=t.split("/").filter(s=>s.length>0),n=[...e].sort((s,i)=>i.split("/").length-s.split("/").length);for(let s of n){let i=s.split("/").filter(o=>o.length>0);if(i.length!==r.length)continue;let a=true;for(let o=0;o<i.length;o++){let l=i[o],f=r[o];if(!(l.startsWith("[")&&l.endsWith("]"))&&!l.startsWith(":")&&l!==f){a=false;break}}if(a)return "/"+i.join("/")}return null}function lo(){if(typeof document>"u")return [];let t=new Set,e=document.querySelectorAll("[data-testid]");for(let r of Array.from(e)){let n=r.getAttribute("data-testid");n&&n.length>0&&n.length<120&&t.add(n);}return Array.from(t).sort()}function co(){if(typeof window>"u")return [];try{let t=new URLSearchParams(window.location.search),e=new Set;return t.forEach((r,n)=>e.add(n)),Array.from(e).sort()}catch{return []}}function uo(){if(typeof document>"u")return null;let t=s=>(s??"").replace(/\s+/g," ").trim().slice(0,200),e=t(document.querySelector("h1")?.textContent);if(e)return e;let r=t(document.title);return r||t(document.querySelector("main")?.textContent)||null}async function po(t){if(!t||typeof crypto>"u"||!crypto.subtle)return null;try{let e=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",e),n=new Uint8Array(r),s="";for(let i=0;i<n.length;i++)s+=n[i].toString(16).padStart(2,"0");return s}catch{return null}}function Lt(t){let{config:e,getRecentNetworkPaths:r,getUserId:n,getSessionId:s,onEvent:i}=t,a=e.throttleMs??6e4,o=e.captureDomSummary!==false,l=e.userIdSource??"auto",f=new Map,p=null,v=null;async function d(){if(typeof window>"u")return;let y=Xr(window.location.pathname,e.routeTemplates),k=Date.now(),b=f.get(y)??0;if(k-b<a)return;f.set(y,k);let P=null;l==="auto"?P=n()??s():l==="session-only"&&(P=s());let H={route:y,page_title:typeof document<"u"&&(document.title||"").slice(0,300)||null,dom_summary:o?uo():null,testids:lo(),network_paths:r().slice(-50),query_param_keys:co(),user_id_hash:await po(P),observed_at:new Date().toISOString()};i(H);}function m(){v||(v=setTimeout(()=>{v=null,d();},100));}function c(){if(typeof window>"u")return;let y=window.location.pathname+window.location.search;y!==p&&(p=y,m());}if(typeof window>"u")return {destroy:()=>{},flushNow:()=>{}};let g=window.history.pushState.bind(window.history),x=window.history.replaceState.bind(window.history),C=function(...k){let b=g(...k);return c(),b},R=function(...k){let b=x(...k);return c(),b};window.history.pushState=C,window.history.replaceState=R;let S=()=>c();return window.addEventListener("popstate",S),m(),{destroy(){window.removeEventListener("popstate",S),window.history.pushState===C&&(window.history.pushState=g),window.history.replaceState===R&&(window.history.replaceState=x),v&&(clearTimeout(v),v=null),f.clear();},flushNow(){f.clear(),d();}}}function Jr(t,e,r){let n=l=>l.timestamp,s=l=>l.type===2,i=l=>l.type===4,a=Date.now()-e,o=0;for(let l=0;l<t.length;l++){let f=n(t[l]);if(typeof f=="number"&&f>=a)break;s(t[l])&&(o=i(t[l-1])?l-1:l);}if(t.length-o>r){for(let l=o+1;l<t.length;l++)if(s(t[l])&&t.length-l<=r){o=i(t[l-1])?l-1:l;break}}o>0&&t.splice(0,o);}function ho(t){let e=[],r=false,n=i=>{if(!r)return;let a=i.target instanceof Element?i.target:null,o=a?.tagName?.toLowerCase()??"unknown",l=a?.closest("[data-testid]")?.getAttribute("data-testid")??void 0;e.push({type:"lite_click",timestamp:Date.now(),data:{tag:o,testId:l}}),e.length>400&&e.shift();},s=()=>{r=false,document.removeEventListener("click",n,true);};return {start(){r||(r=true,document.addEventListener("click",n,true));},stop:s,flush(){let i=Date.now()-t;return e.filter(a=>a.timestamp>=i)},destroy(){s(),e.length=0;}}}var Xe=null;async function mo(){if(Xe)return Xe;try{return Xe=await import('rrweb'),Xe}catch{return null}}async function Zr(t){let e=t.maxDurationMs??3e4,r=await mo();if(!r?.record)return ho(e);let n=r.record,s=[],i=null,a=false,o=['input[type="password"]',...t.redactSelectors??[]],l=()=>{i?.(),i=null,a=false;};return {start(){a||(a=true,i=n({emit(f){s.push(f),Jr(s,e,400);},maskAllInputs:true,maskAllText:true,maskTextSelector:o.join(","),checkoutEveryNms:e,sampling:{mousemove:false,mouseInteraction:true,scroll:150,media:800}})??null);},stop:l,flush(){return Jr(s,e,400),[...s]},destroy(){l(),s.length=0;}}}function Qr(t,e){return new Promise((r,n)=>{let s=new Image;s.onload=()=>{let i=document.createElement("div");i.style.position="relative",i.style.display="inline-block",i.style.maxWidth="100%";let a=document.createElement("canvas"),o=document.createElement("canvas"),l=Math.min(1,720/s.width),f=Math.round(s.width*l),p=Math.round(s.height*l);for(let k of [a,o])k.width=f,k.height=p,k.style.width="100%",k.style.height="auto",k.style.display="block";o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.cursor="crosshair";let v=a.getContext("2d"),d=o.getContext("2d");if(!v||!d){n(new Error("Canvas not supported"));return}v.drawImage(s,0,0,f,p),i.appendChild(a),i.appendChild(o),e.appendChild(i);let m="highlight",c=false,g=null,x=[],C=k=>{let b=o.getBoundingClientRect(),P="touches"in k?k.touches[0]??k.changedTouches[0]:null,H=P?P.clientX:k.clientX,U=P?P.clientY:k.clientY;return {x:(H-b.left)/b.width*f,y:(U-b.top)/b.height*p}},R=()=>{d.clearRect(0,0,f,p);for(let k of x)if(k.tool==="highlight"&&k.points.length>=2){let[b,P]=k.points;d.fillStyle="rgba(255, 230, 0, 0.35)",d.fillRect(Math.min(b.x,P.x),Math.min(b.y,P.y),Math.abs(P.x-b.x),Math.abs(P.y-b.y));}else if(k.tool==="arrow"&&k.points.length>=2){let[b,P]=k.points;d.strokeStyle="#ef4444",d.lineWidth=3,d.beginPath(),d.moveTo(b.x,b.y),d.lineTo(P.x,P.y),d.stroke();}},S=k=>{c=true,g=C(k);},y=k=>{if(!c||!g)return;c=false;let b=C(k);if(m==="blur"){let P=Math.min(g.x,b.x),H=Math.min(g.y,b.y),U=Math.abs(b.x-g.x),D=Math.abs(b.y-g.y);U>=1&&D>=1&&(v.filter="blur(8px)",v.drawImage(a,P,H,U,D,P,H,U,D),v.filter="none");}else x.push({tool:m,points:[g,b]});g=null,R();};o.addEventListener("mousedown",S),o.addEventListener("mouseup",y),o.addEventListener("touchstart",S,{passive:true}),o.addEventListener("touchend",y),r({canvas:a,setTool(k){m=k;},getDataUrl(){let k=document.createElement("canvas");k.width=f,k.height=p;let b=k.getContext("2d");return b?(b.drawImage(a,0,0),b.drawImage(o,0,0),k.toDataURL("image/jpeg",.85)):t},destroy(){o.removeEventListener("mousedown",S),o.removeEventListener("mouseup",y),o.removeEventListener("touchstart",S),o.removeEventListener("touchend",y),i.remove();}});},s.onerror=()=>n(new Error("Failed to load screenshot")),s.src=t;})}function en(){try{let t=globalThis;return t.Sentry?t.Sentry:void 0}catch{return}}function go(){try{return globalThis.__SENTRY_REPLAY__}catch{return}}function fo(){try{let t=globalThis,e=t.__SENTRY__,r=t.Sentry;return e?.version==="9"||r&&typeof r.lastEventId=="function"?e?.version==="9"?"v9":"v8":e?.version==="8"?"v8":r&&typeof r.getCurrentHub=="function"?"v7":"unknown"}catch{return "unknown"}}function It(t,e={}){let r=Math.max(0,e.breadcrumbsLimit??30),n={},s=en();if(!s)return n;n.sdk=fo();try{let o=s;if(typeof o.lastEventId=="function")n.eventId=o.lastEventId()??void 0;else {let f=s.getCurrentHub?.()?.getScope?.();n.eventId=f?.getLastEventId?.()??void 0;}}catch{}let i;try{let o=s;typeof o.getCurrentScope=="function"?i=o.getCurrentScope():i=s.getCurrentHub?.()?.getScope?.();}catch{}if(i){try{let o=i.getUser?.();o&&(n.user={id:typeof o.id=="string"?o.id:void 0,email:typeof o.email=="string"?o.email:void 0,username:typeof o.username=="string"?o.username:void 0,ip_address:typeof o.ip_address=="string"?o.ip_address:void 0});}catch{}try{let o=i.getTags?.();if(o&&typeof o=="object"){let l={};for(let[f,p]of Object.entries(o))(typeof p=="string"||typeof p=="number"||typeof p=="boolean")&&(l[f]=p);Object.keys(l).length>0&&(n.tags=l);}}catch{}try{n.transactionName=i.getTransactionName?.()??i.getTransaction?.()?.name??void 0;}catch{}try{n.sessionId=i.getSession?.()?.sid??void 0;}catch{}try{let o=i.getBreadcrumbs?.()??i._breadcrumbs??[];if(Array.isArray(o)&&o.length>0){let l=o.slice(-r);n.breadcrumbs=l.map(f=>{let p=f;return {timestamp:typeof p.timestamp=="number"?p.timestamp<1e12?Math.round(p.timestamp*1e3):p.timestamp:void 0,category:typeof p.category=="string"?p.category:void 0,level:typeof p.level=="string"?p.level:void 0,message:typeof p.message=="string"?p.message:void 0,type:typeof p.type=="string"?p.type:void 0,data:p.data&&typeof p.data=="object"?p.data:void 0}});}}catch{}}try{let o=s,l;if(typeof o.getActiveSpan=="function"?l=o.getActiveSpan():i?.getSpan&&(l=i.getSpan()),l){let f=l.spanContext?.();n.traceId=f?.traceId??l.traceId??void 0,n.spanId=f?.spanId??l.spanId??void 0;}}catch{}let a;try{let o=s;typeof o.getClient=="function"?a=o.getClient():a=s.getCurrentHub?.()?.getClient?.();}catch{}if(a){try{let o=a.getOptions?.();o?.release&&(n.release=o.release),o?.environment&&(n.environment=o.environment);}catch{}try{let o=a.getDsn?.();if(o?.host&&o?.projectId&&n.eventId){let l=o.host.replace(/^o\d+\./,"");n.issueUrl=`https://${l}/issues/?query=${encodeURIComponent(n.eventId)}`;}}catch{}}try{let l=s.getReplay?.()??go();n.replayId=l?.getReplayId?.()??void 0;}catch{}return n}function At(t,e={}){let r=en();if(r){try{let n=r;typeof n.setTag=="function"&&(n.setTag("mushi.report_id",t),e.reportUrl&&n.setTag("mushi.report_url",e.reportUrl)),typeof n.setContext=="function"&&n.setContext("mushi_report",{id:t,...e.reportUrl?{url:e.reportUrl}:{},captured_at:new Date().toISOString()}),typeof n.addBreadcrumb=="function"&&n.addBreadcrumb({category:"mushi",type:"info",level:"info",message:`Mushi report submitted (${t})`,data:{report_id:t,...e.reportUrl?{url:e.reportUrl}:{}}});}catch{}try{let s=r.getCurrentHub?.()?.getScope?.();s&&(s.setTag?.("mushi.report_id",t),e.reportUrl&&s.setTag?.("mushi.report_url",e.reportUrl),s.setContext?.("mushi_report",{id:t,...e.reportUrl?{url:e.reportUrl}:{}}));}catch{}}}var bo=["/login","/logout","/signup","/sso/*","/auth/*"];function rn(t,e={}){let r=[];if(e.rageClick!==false){let g=function(x){let C=Date.now();if(x.target===c){if(m.push(C),m=m.filter(R=>C-R<500),m.length>=3){let R=x.target;t.onTrigger("rage_click",{element:R.tagName,id:R.id,text:R.textContent?.slice(0,50)}),m=[];}}else c=x.target,m=[C];};let m=[],c=null;document.addEventListener("click",g,true),r.push(()=>document.removeEventListener("click",g,true));}if(e.longTask!==false&&typeof PerformanceObserver<"u")try{let m=new PerformanceObserver(c=>{for(let g of c.getEntries())g.duration>5e3&&t.onTrigger("long_task",{duration:Math.round(g.duration),startTime:Math.round(g.startTime)});});m.observe({entryTypes:["longtask"]}),r.push(()=>m.disconnect());}catch{}let n=yo(e.apiCascade);if(n.enabled){let m=[],c=globalThis.fetch;globalThis.fetch=async function(...g){let[x,C]=g,R=Ke(x),S=!!Ge(x,C)||Ye(R,{apiEndpoint:e.apiEndpoint,ignoreUrls:n.ignoreUrls});try{let y=await c.apply(this,g);return !S&&!y.ok&&y.status>=400&&tn(m,t),y}catch(y){throw S||tn(m,t),y}},r.push(()=>{globalThis.fetch=c;});}if((e.pageDwell===true||typeof e.pageDwell=="object"&&e.pageDwell!==null)&&typeof window<"u"){let R=function(D){return g.some(G=>G.endsWith("/*")?D.startsWith(G.slice(0,-2)):D===G||D.startsWith(G+"/"))},S=function(){let D=window.location?.pathname??"";R(D)||t.onTrigger("page_dwell",{thresholdMs:c,path:D});},y=function(){x&&clearTimeout(x);let D=window.location?.pathname??"";R(D)||(x=setTimeout(S,c));},k=function(){let D=window.location?.pathname??"";D!==C&&(C=D,y());};let m=typeof e.pageDwell=="object"?e.pageDwell??{}:{},c=m.thresholdMs||300*1e3,g=m.excludeRoutes!==void 0?m.excludeRoutes:bo,x=null,C=window.location?.pathname??"";y();let b=window.history,P=b?.pushState,H=b?.replaceState;b&&P&&H&&(b.pushState=function(...D){let G=P.apply(this,D);return k(),G},b.replaceState=function(...D){let G=H.apply(this,D);return k(),G});let U=()=>k();window.addEventListener("popstate",U),r.push(()=>{x&&clearTimeout(x),window.removeEventListener("popstate",U),b&&P&&(b.pushState=P),b&&H&&(b.replaceState=H);});}if((e.firstSession===true||typeof e.firstSession=="object"&&e.firstSession!==null)&&typeof window<"u"){let m=typeof e.firstSession=="object"?e.firstSession??{}:{},c=m.delayMs??45*1e3,g=m.storageKey??(e.projectId?`mushi:${e.projectId}:firstSessionShown`:"mushi:firstSessionShown"),x=false;try{x=window.localStorage?.getItem(g)==="1";}catch{}if(!x){let C=setTimeout(()=>{try{window.localStorage?.setItem(g,"1");}catch{}t.onTrigger("first_session",{delayMs:c});},c);r.push(()=>clearTimeout(C));}}if(e.errorBoundary){let m=function(g){t.onTrigger("error_boundary",{message:g.message,filename:g.filename,lineno:g.lineno,colno:g.colno});},c=function(g){t.onTrigger("error_boundary",{message:g.reason instanceof Error?g.reason.message:String(g.reason),type:"unhandled_rejection"});};window.addEventListener("error",m),window.addEventListener("unhandledrejection",c),r.push(()=>{window.removeEventListener("error",m),window.removeEventListener("unhandledrejection",c);});}return {destroy(){r.forEach(m=>m());}}}function yo(t){return t===false?{enabled:false,ignoreUrls:[]}:t&&typeof t=="object"?{enabled:t.enabled!==false,ignoreUrls:t.ignoreUrls??[]}:{enabled:true,ignoreUrls:[]}}function tn(t,e){let r=Date.now();t.push(r);let n=t.filter(s=>r-s<1e4);n.length>=3&&(e.onTrigger("api_cascade",{failureCount:n.length,windowMs:1e4}),t.length=0);}var nn="mushi:lastDismiss",Je="mushi:consecDismiss",_t="mushi:lastShown";function Ze(t){try{return localStorage.getItem(t)}catch{return null}}function Qe(t,e){try{localStorage.setItem(t,e);}catch{}}function sn(t={}){let e=t.maxProactivePerSession??2,r=t.dismissCooldownHours??24,n=t.suppressAfterDismissals??3,s=(t.reshowCooldownMinutes??30)*60*1e3,i=0,a=new Set;function o(v){let d=Date.now();if(parseInt(Ze(Je)??"0",10)>=n)return false;let c=Ze(nn);if(c&&d-parseInt(c,10)<r*60*60*1e3)return false;if(s>0&&i===0){let g=Ze(_t);if(g&&d-parseInt(g,10)<s)return false}return i>=e||a.has(v)?false:(a.add(v),i++,Qe(_t,String(d)),true)}function l(){Qe(nn,String(Date.now()));let v=parseInt(Ze(Je)??"0",10);Qe(Je,String(v+1));}function f(){Qe(Je,"0");}function p(){i=0,a.clear();try{localStorage.removeItem(_t);}catch{}}return {shouldShow:o,recordDismissal:l,recordSubmission:f,reset:p}}var pe=null,et=class{constructor(){}static init(e){if(pe)return Ne({scope:"mushi",level:"warn",format:"pretty"}).warn("Already initialized \u2014 call destroy() first to reinitialize"),pe;let r={...or(),...e};if(!r.projectId)throw new Error("[mushi] projectId is required \u2014 set NEXT_PUBLIC_MUSHI_PROJECT_ID / VITE_MUSHI_PROJECT_ID / MUSHI_PROJECT_ID or pass it explicitly");if(!r.apiKey)throw new Error("[mushi] apiKey is required \u2014 set NEXT_PUBLIC_MUSHI_API_KEY / VITE_MUSHI_API_KEY / MUSHI_API_KEY or pass it explicitly");return r.enabled===false?Ao():(pe=vo(r),pe)}static getInstance(){return pe}static destroy(){pe?.destroy(),pe=null;}static diagnose(){return pe?.diagnose()??ln()}};function vo(t){let e=xo(t),r=e,n=t.debug??false?Ne({scope:"mushi",level:"debug",format:"pretty"}):ot,s=null,i=null,a=sr({projectId:e.projectId,apiKey:e.apiKey,...e.apiEndpoint?{apiEndpoint:e.apiEndpoint}:{},getUserToken:()=>s,sdkPackage:ge,sdkVersion:ee}),o=ir(e.preFilter),l=dr(e.offline),f=hr({maxBurst:10,refillRate:1,refillIntervalMs:5e3}),p=mr();function v(u){return u.map(h=>{let w={...h};if(typeof h.message=="string"&&(w.message=p.scrub(h.message)),h.data&&typeof h.data=="object"){let $={};for(let[L,B]of Object.entries(h.data))$[L]=typeof B=="string"?p.scrub(B):B;w.data=$;}return w})}function d(u){if(!u)return;let h={};for(let[w,$]of Object.entries(u))h[w]=typeof $=="string"?p.scrub($):$;return h}let m=null,c=null,g=null,x=null,C=null,R=null,S=$t(),y=null,k=0,b,P=`mushi:tester-jwt:${e.projectId}`;function H(){try{return typeof localStorage<"u"?localStorage.getItem(P):null}catch{return null}}function D(){try{typeof localStorage<"u"&&localStorage.removeItem(P);}catch{}}async function G(u){let h=await a.getTesterStatus(u);if(!h.ok||!h.data){D();return}let w=h.data;if(!w.is_tester||!w.tester_id){D();return}b.setTesterSession(u,{id:w.tester_id,public_handle:w.public_handle??null,display_name:w.display_name??null});let $=await a.getMyReputation(u);if($.ok&&$.data){let L=$.data;L.reputation&&b.setTesterReputation(L.reputation);}}function xe(){if(r.capture?.console!==false?m??=xt():(m?.destroy(),m=null),r.capture?.network!==false){let L={apiEndpoint:Pt(r),ignoreUrls:r.capture?.ignoreUrls,tracePropagation:r.capture?.tracePropagation,sessionId:Ae()};c?c.updateOptions(L):c=Et(L);}else c?.destroy(),c=null;if(r.capture?.performance!==false?g??=Tt():(g?.destroy(),g=null),r.capture?.screenshot!=="off"){let L={privacy:r.privacy};x?x.updateOptions(L):x=Ct(L);}else x=null;x||(W=null),b.setAllowScreenshotRemove(r.privacy?.allowUserRemoveScreenshot!==false),r.capture?.elementSelector!==false?C??=Mt():(C?.deactivate(),C=null,fe=null);let u=r.capture?.discoverInventory,h=u===true?{}:u&&typeof u=="object"?u:null;h!=null&&h.enabled!==false?(R?.destroy(),R=Lt({config:h,getRecentNetworkPaths:()=>c?c.getEntries().map(L=>{try{let B=new URL(L.url,typeof window<"u"?window.location.href:"http://localhost");return B.host&&typeof window<"u"&&B.host!==window.location.host?null:B.pathname}catch{return null}}).filter(L=>L!=null&&L.length>0&&L.length<200):[],getUserId:()=>T?.id??null,getSessionId:Ae,onEvent:L=>{a.postDiscoveryEvent({...L,sdk_version:ee}).catch(B=>{n.debug("discovery emit failed",{err:String(B)});});}})):(R?.destroy(),R=null);let $=r.capture?.replay??"off";if($==="rrweb"||$==="lite"){let L=++k;Zr({redactSelectors:r.privacy?.redactSelectors}).then(B=>{if(L!==k){B.destroy();return}y?.destroy(),y=B,y.start();});}else k++,y?.destroy(),y=null;}let V=new Map;function z(u,h){V.get(u)?.forEach(w=>w({type:u,data:h}));}let W=null,fe=null,he=null,M=false,T=null,I={},O={},_=gr({max:50});_.add({category:"lifecycle",level:"info",message:"Mushi SDK init",data:{projectId:e.projectId,sdkVersion:ee}});let re=null;re=_o(_);let Se=false;async function Ee(){if(!x||Se)return null;Se=true;let u=b.getIsOpen();u&&b.hidePanel();let h=document.getElementById("mushi-mushi-widget"),w=h?.style.visibility??"";h&&(h.style.visibility="hidden"),await new Promise($=>{requestAnimationFrame(()=>requestAnimationFrame(()=>$()));});try{return await x.take()}finally{Se=false,h&&(h.style.visibility=w),u&&b.showPanel();}}async function ne(u){let h=r.capture?.screenshot;!x||h==="off"||W||u==="open"&&h!=="auto"||u==="submit"&&h!=="on-report"&&h!=="auto"||(n.debug("Auto-capturing screenshot",{when:u,mode:h}),W=await Ee(),b.setScreenshotAttached(W!==null));}b=new We(e.widget,{onSubmit:async({category:u,userCategory:h,description:w,intent:$})=>(n.info("Report submitted",{category:u,userCategory:h,intent:$}),be?.recordSubmission(),await ne("submit"),await un(u,w,$,h)??{reportId:null,queuedOffline:true}),onOpen:()=>{n.debug("Widget opened"),ne("open"),y?.start(),z("widget:opened");},onClose:()=>{n.debug("Widget closed"),he&&(be?.recordDismissal(),z("proactive:dismissed",{type:he})),W=null,fe=null,he=null,z("widget:closed");},onScreenshotRequest:async()=>{!x||r.capture?.screenshot==="off"||(n.debug("Taking screenshot"),W=await Ee(),b.setScreenshotAttached(W!==null));},onScreenshotRemove:()=>{n.debug("Screenshot attachment removed"),W=null,b.setScreenshotAttached(false);},onScreenshotAnnotateRequest:async u=>{if(!W||u.childElementCount>0)return;let h;try{h=await Qr(W,u);}catch(J){n.warn("Screenshot annotation failed",{error:J instanceof Error?J.message:String(J)});return}let w=document.createElement("div");w.className="mushi-annotate-toolbar";let $=J=>{(W=h.getDataUrl(),b.setScreenshotAttached(true)),h.destroy(),w.remove();},L=[{id:"highlight",label:"\u270F\uFE0F Highlight"},{id:"blur",label:"\u{1F512} Blur"},{id:"arrow",label:"\u2197\uFE0F Arrow"}];for(let J of L){let N=document.createElement("button");N.type="button",N.className="mushi-attach-btn",N.dataset.tool=J.id,N.textContent=J.label,N.addEventListener("click",()=>{h.setTool(J.id),w.querySelectorAll("button[data-tool]").forEach(ae=>ae.classList.remove("active")),N.classList.add("active");}),w.appendChild(N);}w.querySelector('button[data-tool="highlight"]')?.classList.add("active");let B=document.createElement("button");B.type="button",B.className="mushi-attach-btn",B.textContent="\u2713 Done",B.addEventListener("click",()=>$()),w.appendChild(B),u.insertBefore(w,u.firstChild);},onElementSelectorRequest:async()=>{if(!(!C||r.capture?.elementSelector===false)){n.debug("Element selector activated"),b.setElementCapturing(true),b.hidePanel();try{let u=await C.activate();u?(fe=u,b.setElementSelected(!0),n.debug("Element selected",{tagName:u.tagName,xpath:u.xpath})):b.setElementCapturing(!1);}finally{b.showPanel();}}},async onReporterReportsRequest(){let u=await a.listReporterReports(X());if(!u.ok)throw new Error(u.error?.message??"Could not load reports");return u.data?.reports??[]},async onReporterCommentsRequest(u){let h=await a.listReporterComments(u,X());if(!h.ok)throw new Error(h.error?.message??"Could not load thread");return h.data?.comments??[]},async onReporterReply(u,h){let w=await a.replyToReporterReport(u,X(),h);if(!w.ok)throw new Error(w.error?.message??"Could not send reply")},async onReporterFeedback(u,h,w){let $=await a.replyToReporterReport(u,X(),w??"",h);if(!$.ok)throw new Error($.error?.message??"Could not send feedback");return $.data?.feedback??null},async onReporterReopen(u,h){let w=await a.reopenReporterReport(u,X(),h);if(!w.ok)throw new Error(w.error?.message??"Could not reopen report");return w.data?.outcome??null},async onFeatureBoardRequest(){let u=await a.listReporterFeatureBoard(X());if(!u.ok)throw new Error(u.error?.message??"Could not load community ideas");return u.data?.tickets??[]},async onFeatureBoardVote(u){let h=await a.voteReporterFeatureBoard(u,X());if(!h.ok)throw new Error(h.error?.message??"Could not vote");return h.data??{voted:true,action:"added"}},onLeaderboardOpen(){b.setLeaderboard(null,true),zr(10).then(u=>{b.setLeaderboard(u,false);});},async onMushiSignIn(u){let h=await a.sendMagicLink(u);if(!h.ok)throw new Error(h.error?.message??"Could not send sign-in link");return {ok:true}},async onGlobalLeaderboardOpen(){b.setGlobalLeaderboard(null,true);try{let u=H(),h=await a.getPublicLeaderboard(50),$=(h.ok?h.data?.leaderboard??[]:[]).map(L=>({tester_id:L.tester_id,rank:L.rank,public_handle:L.public_handle,display_name:L.display_name,points_30d:L.points_30d,total_points:L.total_points??0,badge:L.badge_slug}));if(b.setGlobalLeaderboard($,!1),u){let L=await a.getMyReputation(u);if(L.ok&&L.data){let B=L.data;B.reputation&&b.setTesterReputation(B.reputation);}}}catch{b.setGlobalLeaderboard([],false);}},async onCrossAppReportsOpen(){let u=H();if(!u){b.setCrossAppReports([],false);return}try{let h=await a.getCrossAppReports(u),w=h.ok?h.data?.reports??[]:[];b.setCrossAppReports(w,!1);}catch{b.setCrossAppReports([],false);}},onTesterSignOut(){D();},assistantEnabled:e.assistant?.enabled===true,...e.assistant?.label?{assistantLabel:e.assistant.label}:{},...e.assistant?.greeting?{assistantGreeting:e.assistant.greeting}:{},...e.assistant?.suggestions?{assistantSuggestions:e.assistant.suggestions}:{},async onAssistantAsk(u,h){let w=await a.askAssistant({message:u,threadId:h,context:i});return w.ok?w.data??null:null}},ee),xe(),typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>b.mount()):b.mount());let Y=H();Y&&G(Y).catch(()=>D());let K=null,be=null,A=r.proactive;A&&(A.rageClick!==false||A.longTask!==false||A.apiCascade!==false||A.errorBoundary===true||A.pageDwell||A.firstSession)&&typeof document<"u"&&(be=sn(A?.cooldown),K=rn({onTrigger:(u,h)=>{if(!be.shouldShow(u)){n.debug("Proactive trigger suppressed by fatigue prevention",{type:u});return}n.info("Proactive trigger fired",{type:u,context:h}),he=u,z("proactive:triggered",{type:u,context:h}),u==="first_session"?b.pulseTrigger?.():b.open();}},{rageClick:A?.rageClick,longTask:A?.longTask,apiCascade:A?.apiCascade,apiEndpoint:Pt(r),errorBoundary:A?.errorBoundary,pageDwell:A?.pageDwell,firstSession:A?.firstSession,projectId:e.projectId}),n.debug("Proactive triggers enabled",{rageClick:A?.rageClick!==false,longTask:A?.longTask!==false,apiCascade:A?.apiCascade!==false,errorBoundary:A?.errorBoundary===true,pageDwell:!!A?.pageDwell,firstSession:!!A?.firstSession})),l.startAutoSync(a),l.flush(a).then(u=>{u.sent>0&&n.info("Synced offline reports",{sent:u.sent});});function Le(u){if(M=true,u.enabled===false){r=e,Mo(t.projectId),xe(),b.updateConfig(r.widget),n.debug("Runtime SDK config disabled; using bootstrap config",{version:u.version});return}r=wo(r,u),xe(),u.widget&&b.updateConfig(r.widget),n.debug("Applied runtime SDK config",{version:u.version});}if(Eo(t)){let u=Co(t.projectId);u&&Le(u),a.getSdkConfig().then(h=>{h.ok&&h.data?(To(t.projectId,h.data),Le(h.data)):h.error&&n.debug("Runtime SDK config unavailable",h.error);}).catch(h=>{n.debug("Runtime SDK config fetch failed",{error:h instanceof Error?h.message:String(h)});});}else n.debug("Runtime SDK config disabled via runtimeConfig:false; using static bootstrap config");ke(),n.info("Initialized",{projectId:t.projectId});async function ke(){if(r.widget?.outdatedBanner==="off")return;let u=$o(ge);u&&Ot(u);let h=await a.getLatestSdkVersion(ge);!h.ok||!h.data||(Lo(ge,h.data),Ot(h.data));}function Ot(u){let h=u.latest,w=!!(h&&Io(ee,h));if(!w&&!u.deprecated)return;let $=u.deprecationMessage??(w?`Update ${ge} to ${h}.`:null);n.warn("Mushi SDK is outdated",{package:ge,current:ee,latest:h,deprecated:u.deprecated,message:$}),r.widget?.outdatedBanner!=="console-only"&&b.setSdkFreshness({latest:h,current:ee,deprecated:u.deprecated,message:$});}async function un(u,h,w,$){let L=o.check(h);if(!L.passed){n.info("Report blocked by pre-filter",{reason:L.reason});return}let B=t.preFilter?.wasmClassifier;if(B)try{let j=await B.classify({description:h,category:u,url:typeof location<"u"?location.href:void 0,hasScreenshot:W!==null,hasSelectedElement:fe!==null,hasNetworkErrors:c?.getEntries()?.some(se=>se.status>=400||!!se.error)??!1,hasConsoleErrors:m?.getEntries()?.some(se=>se.level==="error")??!1,proactiveTrigger:he??void 0});if(j.verdict==="block"){n.info("Report blocked by on-device classifier",{modelId:j.modelId,confidence:j.confidence,reason:j.reason});return}n.debug("On-device classifier verdict",{...j});}catch(j){n.warn("On-device classifier threw \u2014 falling through to server",{error:j instanceof Error?j.message:String(j)});}if(!f.tryConsume()){n.warn("Report throttled \u2014 rate limit exceeded");return}let J=p.scrub(o.truncate(h)),N=t.sentry?It(t.sentry):void 0,ae=await pr().catch(()=>null),Bt=r.capture?.console===false?void 0:m?.getEntries(),Nt=r.capture?.network===false?void 0:c?.getEntries(),Ft=v(_.getAll()),Ut=d(Object.keys(O).length>0?{...O}:void 0),qt=N?{...N,...N.breadcrumbs?{breadcrumbs:v(N.breadcrumbs)}:{},...N.tags?{tags:d(N.tags)}:{}}:void 0,jt=W?await vr(W).catch(()=>null):null;W&&!jt&&n.warn("Screenshot dropped \u2014 could not compress under wire budget");let le={id:at(),projectId:t.projectId,category:u,...$?{userCategory:$}:{},description:J,userIntent:w,environment:it(),consoleLogs:Bt,networkLogs:Nt,performanceMetrics:r.capture?.performance===false?void 0:g?.getMetrics(),timeline:S.getEntries({consoleLogs:Bt,networkLogs:Nt}),screenshotDataUrl:jt??void 0,selectedElement:fe??void 0,...y?{replayEvents:y.flush()}:{},metadata:{...I,...T?{user:T}:{},...N?.release?{sentryRelease:N.release}:{}},sessionId:Ae(),reporterToken:X(),...ae?{fingerprintHash:ae}:{},appVersion:t.integrations?.vercel?.analyticsId,sdkPackage:ge,sdkVersion:ee,proactiveTrigger:he??void 0,...Ft.length>0?{breadcrumbs:Ft}:{},...Ut?{tags:Ut}:{},...qt?{sentryContext:qt}:{},sentryEventId:N?.eventId,sentryReplayId:N?.replayId,createdAt:new Date().toISOString()};if(_.add({category:"lifecycle",level:"info",message:`Mushi report submitting (${u})`,data:{reportId:le.id,category:u}}),t.integrations?.custom){let j={addMetadata(se,dn){le.metadata[se]=dn;},setCategory(se){le.category=se;},setDescription(se){le.description=se;}};t.integrations.custom(j);}let F=le;if(t.beforeSendFeedback)try{let j=await Promise.race([Promise.resolve(t.beforeSendFeedback(le)),new Promise(se=>setTimeout(()=>se(le),2e3))]);if(j===null){n.info("Report dropped by beforeSendFeedback hook",{reportId:le.id});return}F=j;}catch(j){n.warn("beforeSendFeedback hook threw \u2014 sending unmodified report",{error:j instanceof Error?j.message:String(j)});}if(z("report:submitted",{reportId:F.id}),typeof navigator<"u"&&!navigator.onLine)return await l.enqueue(F),n.info("Offline \u2014 report queued",{reportId:F.id}),z("report:queued",{reportId:F.id}),{reportId:null,queuedOffline:true};let q=await a.submitReport(F);if(!q.ok&&q.error?.code==="PAYLOAD_TOO_LARGE"&&(Array.isArray(F.replayEvents)&&F.replayEvents.length>0&&(n.warn("Report too large \u2014 dropping replay buffer and retrying",{reportId:F.id}),F={...F,replayEvents:void 0},q=await a.submitReport(F)),!q.ok&&q.error?.code==="PAYLOAD_TOO_LARGE"&&F.screenshotDataUrl&&(n.warn("Report still too large \u2014 dropping screenshot and retrying",{reportId:F.id}),F={...F,screenshotDataUrl:void 0},q=await a.submitReport(F))),q.ok){if(n.info("Report sent",{reportId:q.data?.reportId}),z("report:sent",{reportId:q.data?.reportId}),q.data?.cursorAgentId){let j=q.data;z("report:dispatched",{reportId:j.reportId,agentId:j.cursorAgentId,fixId:j.fixId});}_.add({category:"lifecycle",level:"info",message:`Mushi report sent (${q.data?.reportId??le.id})`}),$e({action:"report_submit",metadata:{category:u,reportId:q.data?.reportId??le.id}});try{t.sentry&&q.data?.reportId&&At(q.data.reportId);}catch{}}else q.error?.code==="PAYLOAD_TOO_LARGE"||q.error?.code==="SERIALIZE_FAILED"?(n.warn("Report exceeds size limit after degradation \u2014 dropping",{reportId:F.id,error:q.error}),z("report:failed",{reportId:F.id,error:q.error}),_.add({category:"lifecycle",level:"error",message:`Mushi report dropped \u2014 payload too large (${F.id})`})):(n.warn("Report failed, queuing for retry",{reportId:F.id,error:q.error}),await l.enqueue(F),z("report:failed",{reportId:F.id,error:q.error}),_.add({category:"lifecycle",level:"warning",message:`Mushi report queued for retry (${F.id})`}));return W=null,fe=null,he=null,q?.ok?{reportId:q.data?.reportId??le.id,queuedOffline:false}:{reportId:null,queuedOffline:true}}let Ht={report(u){b.open(u);},on(u,h){return V.has(u)||V.set(u,new Set),V.get(u).add(h),()=>V.get(u)?.delete(h)},setUser(u){T=u;},setMetadata(u,h){I[u]=h;},setScreen(u){S.setScreen(u);},isOpen(){return b.getIsOpen()},open(){b.open();},openWith(u){b.open({category:u});},show(){b.showTrigger();},hide(){b.hideTrigger();},attachTo(u,h){return b.attachTo(u,h)},setTrigger(u){b.setTrigger(u);},openReporter(){b.openReporter();},close(){b.close();},updateConfig(u){Le(u);},diagnose(){return ko({apiEndpoint:Pt(r),widgetMounted:b.getIsMounted(),runtimeConfigLoaded:M,captureScreenshotAvailable:x!==null,captureNetworkIntercepting:c!==null,widgetDiagnostics:b.getWidgetDiagnostics()})},destroy(){K?.destroy(),be?.reset(),b.destroy(),m?.destroy(),c?.destroy(),g?.destroy(),C?.deactivate(),S.destroy(),R?.destroy(),R=null,y?.destroy(),y=null,l.stopAutoSync(),re?.(),re=null,_.clear(),V.clear(),pe=null,n.debug("Destroyed");},async captureEvent(u){if(!f.tryConsume())return n.warn("captureEvent throttled \u2014 rate limit exceeded"),null;let h=p.scrub(o.truncate(u.description)),w=u.category??"bug",$=t.sentry?It(t.sentry):void 0,L=v(_.getAll()),B=d(Object.keys(O).length===0&&!u.tags?void 0:{...O,...u.tags??{}}),J=$?{...$,...$.breadcrumbs?{breadcrumbs:v($.breadcrumbs)}:{},...$.tags?{tags:d($.tags)}:{}}:void 0,N={id:at(),projectId:t.projectId,category:w,description:h,environment:it(),timeline:S.getEntries(),metadata:{...u.metadata??{},...T?{user:T}:{},...u.error?{error:u.error}:{},...u.severity?{severity:u.severity}:{},...u.component?{component:u.component}:{},...u.source?{source:u.source}:{source:"captureEvent"}},...L.length>0?{breadcrumbs:L}:{},...B&&Object.keys(B).length>0?{tags:B}:{},...J?{sentryContext:J}:{},sessionId:Ae(),reporterToken:X(),sdkPackage:ge,sdkVersion:ee,sentryEventId:$?.eventId,sentryReplayId:$?.replayId,createdAt:new Date().toISOString()};if(z("report:submitted",{reportId:N.id}),typeof navigator<"u"&&!navigator.onLine)return await l.enqueue(N),z("report:queued",{reportId:N.id}),null;let ae=await a.submitReport(N);if(ae.ok){z("report:sent",{reportId:ae.data?.reportId});try{t.sentry&&ae.data?.reportId&&At(ae.data.reportId);}catch{}return ae.data?.reportId??null}return await l.enqueue(N),z("report:failed",{reportId:N.id,error:ae.error}),null},async captureException(u,h){let w=fr(u);_.add({category:"lifecycle",level:"error",message:`Mushi.captureException(${w.name}): ${w.message}`,...w.stack?{data:{stack:w.stack.slice(0,500)}}:{}});let $=h?.description?.trim()||`${w.name}: ${w.message}`||"Uncaught exception";return Ht.captureEvent({description:$,category:h?.category??"bug",severity:h?.severity??"high",...h?.component?{component:h.component}:{},...h?.tags?{tags:h.tags}:{},source:h?.source??"captureException",error:{name:w.name,message:w.message,...w.stack?{stack:w.stack}:{}},metadata:{...h?.metadata??{},...w.cause?{cause:w.cause}:{}}})},identify(u,h){if(T={id:u,...h?.email?{email:h.email}:{},...h?.name?{name:h.name}:{}},h)for(let[w,$]of Object.entries(h))w!=="email"&&w!=="name"&&(I[`user.${w}`]=$);if(_.add({category:"lifecycle",level:"info",message:`Mushi.identify(${u})`}),r.rewards?.enabled){let w={client:a,config:r.rewards,projectId:e.projectId,userId:u,traits:h?{email:h.email,name:h.name,provider:h.provider}:void 0};T.id===u?Ur(w):qr(u,w.traits),r.rewards.showInWidget!==false&&a.getMyPoints(u).then($=>{if(!$.ok)return;let L=$.data;b.setRewardsState({tier:L.tier?{slug:L.tier.slug??"free",displayName:L.tier.display_name??"Free",pointsThreshold:L.tier.points_threshold??0}:null,nextTier:L.next_tier?{displayName:L.next_tier.display_name??"",pointsThreshold:L.next_tier.points_threshold??0}:null,totalPoints:L.total_points??0,pointsForReport:L.report_submit_pts??50});}).catch(()=>{});}},identifyWithToken(u){if(s=u&&typeof u=="string"?u:null,s){let h=br(s);h?.sub&&(T={id:h.sub,...h.email?{email:h.email}:{},...h.name?{name:h.name}:{}}),_.add({category:"lifecycle",level:"info",message:"Mushi.identifyWithToken()"});}else _.add({category:"lifecycle",level:"info",message:"Mushi.identifyWithToken(null)"});},publishPageContext(u){i=u&&u.route?u:null;},openAssistant(){b.openAssistantTab();},addBreadcrumb(u){_.add(u);},getBreadcrumbs(){return _.getAll()},setTag(u,h){typeof u!="string"||u.length===0||(O[u]=h);},setTags(u){if(!(!u||typeof u!="object"))for(let[h,w]of Object.entries(u))typeof h=="string"&&h.length>0&&(O[h]=w);},clearTag(u){if(typeof u=="string"&&u.length>0){delete O[u];return}for(let h of Object.keys(O))delete O[h];},async getReputation(){if(!T?.id)return null;let u=await a.getMyPoints(T.id);return u.ok?{totalPoints:u.data.total_points??0,points30d:u.data.points_30d??0,reputation:1,confirmedBugs:0,totalReports:0}:null},async getTier(){return T?.id?jr(T.id):null},recordActivity(u,h){r.rewards?.enabled&&$e({action:u,metadata:h});},pulseTrigger(){b.pulseTrigger?.();},async listMyReports(){let u=await a.listReporterReports(X());return u.ok?u.data?.reports??[]:[]},async listMyComments(u){let h=await a.listReporterComments(u,X());return h.ok?h.data?.comments??[]:[]},async replyToReport(u,h){let w=await a.replyToReporterReport(u,X(),h);return w.ok?w.data?.comment??null:null},async submitFeedbackSignal(u,h,w){let $=await a.replyToReporterReport(u,X(),w??"",h);return $.ok?$.data?.feedback??null:null},async reopenReport(u,h){let w=await a.reopenReporterReport(u,X(),h);return w.ok?w.data?.outcome??null:null},openMyReports(){b.recorderOpenMyReports();},async getHallOfFame(u=20){let h=await a.getHallOfFame(u);return h.ok?h.data?.data??[]:[]}};if(typeof globalThis<"u"&&(e.debug??false)&&Lr(b),typeof window<"u"&&typeof localStorage<"u"){let u="mushi:last-run",h=null;try{let w=localStorage.getItem(u);h=w===null?null:w==="unfinished",localStorage.setItem(u,"unfinished");}catch{h=null;}try{window.addEventListener("pagehide",()=>{try{localStorage.setItem(u,"clean");}catch{}});}catch{}if(typeof e.onCrashedLastRun=="function")try{e.onCrashedLastRun(h);}catch(w){n.warn("onCrashedLastRun hook threw",{error:w instanceof Error?w.message:String(w)});}}return Ht}function wo(t,e){let r=e.native?.triggerMode,n=e.widget?.launcher,s=n??e.widget?.trigger??(r==="none"||r==="shake"?"manual":void 0),i=n==="hidden"||e.widget?.trigger==="hidden",a=t.widget?.trigger,o=s==="hidden"&&!i&&a&&a!=="hidden"?a:s,l=e.widget,f=l?.bannerVariant,p=l?.bannerPosition,v=l?.bannerMessage,d=l?.bannerLabel,m=l?.bannerBugCta,c=l?.bannerFeatureCta,g=f||p||v!=null||d!=null||m!=null||c!=null?{...t.widget?.bannerConfig??{},...f?{variant:f}:{},...p?{position:p}:{},...v!=null?{message:v}:{},...d!=null?{label:d===""?false:d}:{},...m!=null?{bugCta:m??void 0}:{},...c!=null?{featureCta:c}:{}}:void 0;return {...t,widget:{...t.widget,...e.widget,...o?{trigger:o}:{},...g?{bannerConfig:g}:{},...t.widget?.betaMode?{betaMode:t.widget.betaMode}:{}},capture:{...t.capture,...e.capture},privacy:{...t.privacy}}}function xo(t){if(!t.preset)return t;let e=So(t.preset);return {...t,widget:{...e.widget,...t.widget},capture:{...e.capture,...t.capture},proactive:{...e.proactive,...t.proactive,cooldown:{...e.proactive?.cooldown,...t.proactive?.cooldown}}}}function So(t){switch(t){case "manual-only":return {widget:{trigger:"manual",outdatedBanner:"console-only"},capture:{console:true,network:true,performance:false,screenshot:"on-report",elementSelector:false},proactive:{rageClick:false,longTask:false,apiCascade:false,errorBoundary:false}};case "beta-loud":return {widget:{trigger:"auto",outdatedBanner:"banner"},capture:{console:true,network:true,performance:true,screenshot:"auto",elementSelector:true},proactive:{rageClick:true,longTask:true,apiCascade:true,errorBoundary:true}};case "internal-debug":return {widget:{trigger:"auto",outdatedBanner:"banner",brandFooter:true},capture:{console:true,network:true,performance:true,screenshot:"auto",elementSelector:true},proactive:{rageClick:true,longTask:true,apiCascade:true,errorBoundary:true,cooldown:{maxProactivePerSession:10,dismissCooldownHours:0,suppressAfterDismissals:99}}};case "production-calm":return {widget:{trigger:"auto",outdatedBanner:"console-only"},capture:{console:true,network:true,performance:false,screenshot:"on-report",elementSelector:false},proactive:{rageClick:false,longTask:false,apiCascade:false,errorBoundary:false}}}}function Pt(t){return t.apiEndpoint??st}function Eo(t){return t.runtimeConfig!==false}async function ko(t){let e=await Ro(t.apiEndpoint);return {apiEndpointReachable:e.reachable,cspAllowsEndpoint:e.cspAllowed,widgetMounted:t.widgetMounted,shadowDomAvailable:typeof HTMLElement<"u"&&typeof HTMLElement.prototype.attachShadow=="function",dialogSupported:typeof HTMLDialogElement<"u",runtimeConfigLoaded:t.runtimeConfigLoaded,captureScreenshotAvailable:t.captureScreenshotAvailable,captureNetworkIntercepting:t.captureNetworkIntercepting,sdkVersion:ee,widgetHostPointerSafe:t.widgetDiagnostics?.widgetHostPointerSafe??false,widgetHostBounds:t.widgetDiagnostics?.widgetHostBounds??null,widgetSuppressed:t.widgetDiagnostics?.widgetSuppressed??false,bannerRendered:t.widgetDiagnostics?.bannerRendered??false}}async function ln(){return {apiEndpointReachable:false,cspAllowsEndpoint:false,widgetMounted:false,shadowDomAvailable:typeof HTMLElement<"u"&&typeof HTMLElement.prototype.attachShadow=="function",dialogSupported:typeof HTMLDialogElement<"u",runtimeConfigLoaded:false,captureScreenshotAvailable:false,captureNetworkIntercepting:false,sdkVersion:ee,widgetHostPointerSafe:false,widgetHostBounds:null,widgetSuppressed:false,bannerRendered:false}}async function Ro(t){if(typeof fetch>"u")return {reachable:false,cspAllowed:false};let e=typeof AbortController<"u"?new AbortController:null,r=e?setTimeout(()=>e.abort(),3e3):null;try{return {reachable:(await fetch(`${t.replace(/\/$/,"")}/health`,{method:"GET",cache:"no-store",...e?{signal:e.signal}:{},[Ce]:"diagnose"})).ok,cspAllowed:!0}}catch{return {reachable:false,cspAllowed:false}}finally{r&&clearTimeout(r);}}function Dt(t){return `mushi:sdk-config:${t}`}function cn(t){return `mushi:sdk-version:${t}`}function Co(t){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(Dt(t));return e?JSON.parse(e).config??null:null}catch{return null}}function To(t,e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Dt(t),JSON.stringify({cachedAt:Date.now(),config:e}));}catch{}}function Mo(t){if(!(typeof localStorage>"u"))try{localStorage.removeItem(Dt(t));}catch{}}function $o(t){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(cn(t));if(!e)return null;let r=JSON.parse(e);return !r.data||!r.cachedAt||Date.now()-r.cachedAt>864e5?null:r.data}catch{return null}}function Lo(t,e){if(!(typeof localStorage>"u"))try{localStorage.setItem(cn(t),JSON.stringify({cachedAt:Date.now(),data:e}));}catch{}}function Io(t,e){let r=on(t),n=on(e);for(let s=0;s<Math.max(r.length,n.length);s++){let i=r[s]??0,a=n[s]??0;if(i<a)return true;if(i>a)return false}return false}function on(t){return t.split(/[.-]/).map(e=>Number.parseInt(e,10)).filter(e=>Number.isFinite(e))}function Ao(){return {report:()=>{},on:()=>()=>{},setUser:()=>{},setMetadata:()=>{},setScreen:()=>{},isOpen:()=>false,open:()=>{},close:()=>{},updateConfig:()=>{},diagnose:ln,openWith:()=>{},show:()=>{},hide:()=>{},attachTo:()=>()=>{},setTrigger:()=>{},openReporter:()=>{},destroy:()=>{pe=null;},captureEvent:async()=>null,captureException:async()=>null,identify:()=>{},identifyWithToken:()=>{},publishPageContext:()=>{},openAssistant:()=>{},addBreadcrumb:()=>{},getBreadcrumbs:()=>[],setTag:()=>{},setTags:()=>{},clearTag:()=>{},getReputation:async()=>null,getTier:async()=>null,recordActivity:()=>{},pulseTrigger:()=>{},listMyReports:async()=>[],listMyComments:async()=>[],replyToReport:async()=>null,submitFeedbackSignal:async()=>null,reopenReport:async()=>null,openMyReports:()=>{},getHallOfFame:async()=>[]}}function _o(t){if(typeof window>"u")return ()=>{};let e=[];try{let r=a=>{t.add({category:"navigation",level:"info",message:`${a}: ${window.location.pathname}`,data:{url:window.location.href,kind:a}});},n=()=>r("popstate");window.addEventListener("popstate",n,{passive:!0}),e.push(()=>window.removeEventListener("popstate",n));let s=window.history.pushState,i=window.history.replaceState;window.history.pushState=function(...o){let l=s.apply(this,o);try{r("pushState");}catch{}return l},window.history.replaceState=function(...o){let l=i.apply(this,o);try{r("replaceState");}catch{}return l},e.push(()=>{window.history.pushState=s,window.history.replaceState=i;});}catch{}try{let r=console.error,n=console.warn;console.error=function(...s){try{t.add({category:"console",level:"error",message:s.map(an).join(" ")});}catch{}return r.apply(this,s)},console.warn=function(...s){try{t.add({category:"console",level:"warning",message:s.map(an).join(" ")});}catch{}return n.apply(this,s)},e.push(()=>{console.error=r,console.warn=n;});}catch{}try{let r=n=>{try{let s=n.target;if(!(s instanceof Element))return;let i=s,a=0;for(;i&&a<10;){let o=i.getAttribute("data-testid");if(o){let l=(i.textContent??"").trim().slice(0,80);t.add({category:"ui.click",level:"info",message:`clicked ${o}${l?` \u2014 ${l}`:""}`,data:{testid:o,tag:i.tagName.toLowerCase()}});return}i=i.parentElement,a++;}}catch{}};document.addEventListener("click",r,{passive:!0,capture:!0}),e.push(()=>document.removeEventListener("click",r,!0));}catch{}return ()=>{for(let r of e)try{r();}catch{}}}function an(t){try{if(t instanceof Error)return `${t.name}: ${t.message}`;if(typeof t=="object"&&t!==null){let r=JSON.stringify(t);return r.length>200?`${r.slice(0,200)}\u2026`:r}let e=String(t);return e.length>200?`${e.slice(0,200)}\u2026`:e}catch{return `[${typeof t}]`}}function Po(){let t=document.currentScript;if(t&&t.dataset&&t.dataset.project)return t;let e=Array.from(document.querySelectorAll("script[data-project][data-key]"));return e.length>0?e[e.length-1]:null}function Do(t){let e=t.project?.trim(),r=t.key?.trim();if(!e||!r)return null;let n={};t.trigger&&(n.trigger=t.trigger),t.theme&&(n.theme=t.theme),t.position&&(n.position=t.position),t.triggerText&&(n.triggerText=t.triggerText);let s=t.bannerVariant,i=t.bannerPosition;(s||i)&&(n.bannerConfig={...s?{variant:s}:{},...i?{position:i}:{}});let a={projectId:e,apiKey:r};return t.endpoint&&(a.apiEndpoint=t.endpoint),t.debug==="true"&&(a.debug=true),Object.keys(n).length>0&&(a.widget=n),a}function Oo(){if(typeof document>"u"||typeof window>"u")return;let t=window;if(t.__mushiLoaderInit)return;let e=Po();if(!e)return;let r=Do(e.dataset);if(r){t.__mushiLoaderInit=true;try{et.init(r);}catch{}}}Oo();
2171
2231
  })();//# sourceMappingURL=mushi.loader.global.js.map
2172
2232
  //# sourceMappingURL=mushi.loader.global.js.map