@mushi-mushi/web 1.19.2 → 1.20.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 Sn=4194304,nr=1.5*1024*1024;function En(t){try{return JSON.stringify(t)}catch{return null}}function kn(t,e=Sn){let r=En(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 ${Wt(n)} exceeds limit ${Wt(e)}`}}function Wt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}var Vt=false,Rn="X-Mushi-User-Token",Cn="X-Mushi-Project",sr="X-Mushi-SDK-Package",ir="X-Mushi-SDK-Version";function Tn(t){let e={"Content-Type":"application/json","X-Mushi-Api-Key":t.apiKey,[Cn]:t.projectId};return t.sdkPackage&&(e[sr]=t.sdkPackage),t.sdkVersion&&(e[ir]=t.sdkVersion),t.userToken&&(e[Rn]=t.userToken),t.internalKind&&(e[$e]=t.internalKind),e}var Ue="https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api",$e="X-Mushi-Internal",Re="__mushiInternal",Mn=1e4,$n=2;function or(t){let{projectId:e,apiKey:r,apiEndpoint:n=Ue,timeout:s=Mn,maxRetries:i=$n,getUserToken:a,sdkPackage:o,sdkVersion:l}=t,g=n.replace(/\/$/,"");async function p(d,m,c,f=i,S,$){let R=`${g}${m}`,E=new AbortController,y=setTimeout(()=>E.abort(),s),k=a?.()??null;try{let b=await fetch(R,{method:d,headers:{...Tn({apiKey:r,projectId:e,sdkPackage:o,sdkVersion:l,userToken:k,internalKind:S}),...$},body:c?JSON.stringify(c):void 0,signal:E.signal,...S?{[Re]:S}:{}});if(clearTimeout(y),b.status===307||b.status===308){let z=b.headers.get("Location");if(z&&f>0){let A=z.replace(/\/v1\/.*$/,"").replace(/\/$/,"");if(A!==g)return g=A,p(d,m,c,f-1,S,$)}}if(!b.ok){let z=await b.json().catch(()=>({}));if((b.status===401||b.status===403)&&!Vt){Vt=!0;let A=g===Ue?"Get the correct values at: https://kensaur.us/mushi-mushi/admin/projects":"Get the correct values from your Mushi console's Projects page.";console.error(`[Mushi] Credentials rejected (HTTP ${b.status}). Check your Project ID and API key scope (must be "report:write"). `+A);}return b.status>=500&&f>0?(await Kt(Gt(i-f)),p(d,m,c,f-1,S,$)):{ok:!1,error:{code:z.error?.code||`HTTP_${b.status}`,message:z.error?.message||z.message||`HTTP ${b.status} error`}}}let _=await b.json();return {ok:!0,data:_&&typeof _=="object"&&"ok"in _&&"data"in _?_.data:_}}catch(b){return clearTimeout(y),f>0&&An(b)?(await Kt(Gt(i-f)),p(d,m,c,f-1,S)):{ok:false,error:{code:"NETWORK_ERROR",message:b instanceof Error?b.message:"Unknown network error"}}}}async function w(d,m,c,f){let S=await Ln(c),$=String(Date.now()),R=await In(r,`${e}.${$}.${S}`),E=`${g}${m}`,y=await fetch(E,{method:d,headers:{"Content-Type":"application/json","X-Mushi-Api-Key":r,"X-Mushi-Project":e,...o?{[sr]:o}:{},...l?{[ir]:l}:{},[$e]:"reporter-poll","X-Reporter-Token-Hash":S,"X-Reporter-Ts":$,"X-Reporter-Hmac":R},body:f?JSON.stringify(f):void 0,[Re]:"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=kn(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 w("GET","/v1/reporter/reports",d)},async listReporterComments(d,m){return w("GET",`/v1/reporter/reports/${d}/comments`,m)},async replyToReporterReport(d,m,c,f){return w("POST",`/v1/reporter/reports/${d}/reply`,m,{body:c,...f?{feedback_signal:f}:{}})},async reopenReporterReport(d,m,c){return w("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 f=c.size?`?${c.toString()}`:"";return w("GET",`/v1/notifications${f}`,d)},async markNotificationRead(d,m){return w("POST",`/v1/notifications/${d}/read`,m,{})},async listReporterFeatureBoard(d){return w("GET","/v1/reporter/feature-board",d)},async voteReporterFeatureBoard(d,m){return w("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 f=c.size?`?${c.toString()}`:"";return p("GET",`/v1/tester/cross-app-reports${f}`,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 Ln(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 In(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 An(t){return t instanceof DOMException&&t.name==="AbortError"||t instanceof TypeError}function ot(...t){return t.find(e=>e!==void 0&&e!=="")}function ie(t){try{let e=undefined;return typeof e=="object"&&e!==null?e[t]:void 0}catch{return}}function ge(t){try{return t()}catch{return}}function ar(){let t=ot(ie("VITE_MUSHI_PROJECT_ID"),ie("NEXT_PUBLIC_MUSHI_PROJECT_ID"),ie("NUXT_PUBLIC_MUSHI_PROJECT_ID"),ie("EXPO_PUBLIC_MUSHI_PROJECT_ID"),ge(()=>process.env.NEXT_PUBLIC_MUSHI_PROJECT_ID),ge(()=>process.env.EXPO_PUBLIC_MUSHI_PROJECT_ID),ge(()=>process.env.MUSHI_PROJECT_ID)),e=ot(ie("VITE_MUSHI_API_KEY"),ie("NEXT_PUBLIC_MUSHI_API_KEY"),ie("NUXT_PUBLIC_MUSHI_API_KEY"),ie("EXPO_PUBLIC_MUSHI_API_KEY"),ge(()=>process.env.NEXT_PUBLIC_MUSHI_API_KEY),ge(()=>process.env.EXPO_PUBLIC_MUSHI_API_KEY),ge(()=>process.env.MUSHI_API_KEY)),r=ot(ie("VITE_MUSHI_API_ENDPOINT"),ie("NEXT_PUBLIC_MUSHI_API_ENDPOINT"),ie("NUXT_PUBLIC_MUSHI_API_ENDPOINT"),ie("EXPO_PUBLIC_MUSHI_API_ENDPOINT"),ge(()=>process.env.NEXT_PUBLIC_MUSHI_API_ENDPOINT),ge(()=>process.env.EXPO_PUBLIC_MUSHI_API_ENDPOINT),ge(()=>process.env.MUSHI_API_ENDPOINT)),n={};return t&&(n.projectId=t),e&&(n.apiKey=e),r&&(n.apiEndpoint=r),n}var _n=10,Pn=2e3,Dn=[/^(.)\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],On=/^[bcdfghjklmnpqrstvwxz]{6,}/i;function lr(t={}){let{enabled:e=true,blockObviousSpam:r=true,minDescriptionLength:n=_n,maxDescriptionLength:s=Pn}=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 Dn)if(p.test(l))return {passed:false,reason:"Detected as spam"};if(On.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},Hn={debug:"DBG",info:"INF",warn:"WRN",error:"ERR",fatal:"FTL"},ee={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"},Bn={debug:ee.dim,info:ee.green,warn:ee.yellow,error:ee.red,fatal:`${ee.bgRed}${ee.white}${ee.bold}`};function Nn(){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 Fn(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 Un(t){let{ts:e,level:r,scope:n,msg:s,...i}=t,a=e.slice(11,23),o=Bn[r]??"",l=Hn[r]??r.toUpperCase(),g=Object.keys(i).length>0?` ${ee.dim}${Fn(i)}${ee.reset}`:"";return `${ee.dim}${a}${ee.reset} ${o}${l}${ee.reset} ${ee.cyan}[${n}]${ee.reset} ${s}${g}`}function qn(t){return JSON.stringify(t)}function jn(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 cr(t,e,r,n,s){let i=e;function a(o,l,g){if(Yt[o]<Yt[i])return;let p={ts:new Date().toISOString(),level:o,scope:t,msg:l,...r,...g};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 cr(`${t}:${o}`,i,{...r,...l},n,s)},setLevel(o){i=o;}}}function qe(t){let{scope:e,level:r="info",meta:n={},format:s="auto",destination:i="stdout"}=t,o=(s==="auto"?Nn():s)==="json"?qn:Un,l=jn(i);return cr(e,r,n,o,l)}var lt={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},fatal:()=>{},child:()=>lt,setLevel:()=>{}},zn="mushi-mushi-keyring",Ce="keys",ur="offline-queue/v1",Be=null,Ne=null;function Wn(){return typeof globalThis<"u"&&typeof globalThis.crypto<"u"&&typeof globalThis.crypto.subtle<"u"&&typeof indexedDB<"u"}function dr(){return new Promise((t,e)=>{let r=indexedDB.open(zn,1);r.onupgradeneeded=()=>{let n=r.result;n.objectStoreNames.contains(Ce)||n.createObjectStore(Ce);},r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error);})}async function Vn(){let t=await dr();return new Promise((e,r)=>{let s=t.transaction(Ce,"readonly").objectStore(Ce).get(ur);s.onsuccess=()=>e(s.result??null),s.onerror=()=>r(s.error);})}async function Kn(t){let e=await dr();return new Promise((r,n)=>{let s=e.transaction(Ce,"readwrite");s.objectStore(Ce).put(t,ur),s.oncomplete=()=>r(),s.onerror=()=>n(s.error);})}async function pr(){if(Be)return Be;if(Ne)return Ne;if(!Wn())throw new Error("Web Crypto + IndexedDB required for offline queue encryption");return Ne=(async()=>{let t=await Vn();if(t)return Be=t,t;let e=await crypto.subtle.generateKey({name:"AES-GCM",length:256},false,["encrypt","decrypt"]);return await Kn(e),Be=e,e})(),Ne}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 Gn(t){let e=await pr(),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 Yn(t){return !!t&&typeof t=="object"&&t._mme===1&&typeof t.iv=="string"&&typeof t.ct=="string"}async function Xn(t){let e=await pr(),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 fe=qe({scope:"mushi:queue",level:"warn"}),Jn="mushi-mushi",Q="offline-reports",Zn=1,at="mushi_offline_queue",Qn=10,es=6e4,ts=3e4,rs=8,ns=1440*60*1e3;function hr(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 C=new Date().toISOString();if(!s)return {...M,queuedAt:C};try{let T=await Gn(M);return {id:M.id,queuedAt:C,payload:T}}catch(T){return fe.warn("Offline queue: encryption failed, storing plaintext",{err:String(T)}),{...M,queuedAt:C}}}async function g(M){if(p(M))try{return await Xn(M.payload)}catch(C){return fe.warn("Offline queue: decrypt failed, dropping row",{err:String(C),id:M.id}),null}return M}function p(M){return !!M.payload&&Yn(M.payload)}function w(M){let C=M.attempts;return typeof C=="number"&&Number.isFinite(C)?C:0}function d(M,C){let T=M.queuedAt;if(!T)return false;let H=Date.parse(T);return Number.isNaN(H)?false:C-H>ns}function m(){return o||(typeof indexedDB<"u"?o="indexeddb":typeof localStorage<"u"?o="localstorage":o="none",o)}function c(){return new Promise((M,C)=>{let T=indexedDB.open(Jn,Zn);T.onupgradeneeded=()=>{let H=T.result;H.objectStoreNames.contains(Q)||H.createObjectStore(Q,{keyPath:"id"});},T.onsuccess=()=>M(T.result),T.onerror=()=>{o="localstorage",C(T.error);};})}async function f(M){let C=await c(),T=await l(M);return new Promise((H,D)=>{let ae=C.transaction(Q,"readwrite");ae.objectStore(Q).put(T),ae.oncomplete=()=>H(),ae.onerror=()=>D(ae.error);})}async function S(){let M=await c();return new Promise((C,T)=>{let D=M.transaction(Q,"readonly").objectStore(Q).getAll();D.onsuccess=()=>C(D.result),D.onerror=()=>T(D.error);})}async function $(M){let C=await c();return new Promise((T,H)=>{let D=C.transaction(Q,"readwrite");D.objectStore(Q).delete(M),D.oncomplete=()=>T(),D.onerror=()=>H(D.error);})}async function R(M){let C=await c();return new Promise((T,H)=>{let D=C.transaction(Q,"readwrite");D.objectStore(Q).put(M),D.oncomplete=()=>T(),D.onerror=()=>H(D.error);})}async function E(){let M=await c();return new Promise((C,T)=>{let D=M.transaction(Q,"readonly").objectStore(Q).count();D.onsuccess=()=>C(D.result),D.onerror=()=>T(D.error);})}async function y(){let M=await c();return new Promise((C,T)=>{let H=M.transaction(Q,"readwrite");H.objectStore(Q).clear(),H.oncomplete=()=>C(),H.onerror=()=>T(H.error);})}function k(){try{let M=localStorage.getItem(at);return M?JSON.parse(M):[]}catch{return []}}function b(M){try{localStorage.setItem(at,JSON.stringify(M));}catch{}}async function _(M){let C=k();C.push(await l(M)),b(C);}function W(M){let C=k().filter(T=>T.id!==M);b(C);}function z(M){let C=k(),T=C.findIndex(H=>H.id===M.id);T>=0&&(C[T]=M,b(C));}async function A(M,C){try{M==="indexeddb"?await $(C):W(C);}catch(T){fe.debug("Offline queue: row removal failed (will age out)",{id:C,err:String(T)});}}async function K(M,C){try{return M==="indexeddb"?await R(C):z(C),!0}catch(T){return fe.debug("Offline queue: row persist failed",{id:C.id,err:String(T)}),false}}async function Se(M){if(!e)return;if(await de()>=r){fe.warn("Offline queue full \u2014 dropping report",{maxQueueSize:r});return}let T=m();if(T==="indexeddb")try{await f(M);return}catch{o="localstorage";}if(T==="localstorage"||o==="localstorage"){await _(M);return}}function G(M){return Math.min(1e3*2**M+Math.random()*500,es)}function V(M){return new Promise(C=>setTimeout(C,M))}async function U(M){if(!e)return {sent:0,failed:0};let C,T=m();if(T==="indexeddb")try{C=await S();}catch{C=k();}else C=k();let H=Date.now(),D=[];for(let ne of C)if(d(ne,H)){let J=ne.id;await A(T,J),fe.debug("Offline queue: evicting stale report",{id:J});}else D.push(ne);C=D;let ae=C.slice(0,Qn),Me=0,Ee=0;for(let ne=0;ne<ae.length;ne++){let J=ae[ne],P=J.id,st=await g(J);if(!st){await A(T,P),Ee++;continue}let B=await M.submitReport(st);if(B.ok)await A(T,P),Me++;else {let Oe=B.error?.code==="HTTP_400"||B.error?.code==="HTTP_413"||B.error?.code==="HTTP_422"||B.error?.code==="INGEST_ERROR"||B.error?.code==="VALIDATION_ERROR"||B.error?.code==="PAYLOAD_TOO_LARGE"||B.error?.code==="SERIALIZE_FAILED"||typeof B.error?.message=="string"&&/invalid payload|description must be at least|validation/i.test(B.error.message),He=!Oe&&(B.error?.code==="NETWORK_ERROR"||B.error?.code==="HTTP_403"||B.error?.code==="HTTP_429"||B.error?.code==="HTTP_502"||B.error?.code==="HTTP_503"||B.error?.code==="HTTP_504"||typeof B.error?.code=="string"&&B.error.code.startsWith("HTTP_5"));if(Oe)await A(T,P);else if(He){let ke=w(J)+1;ke>=rs?(await A(T,P),fe.warn("Offline queue: giving up on report after repeated failures",{id:P,attempts:ke,code:B.error?.code})):(J.attempts=ke,await K(T,J)?fe.debug("Offline queue: transient failure, will retry",{id:P,attempts:ke,code:B.error?.code}):(await A(T,P),fe.warn("Offline queue: dropping report (attempt counter unpersistable)",{id:P,code:B.error?.code})));}Ee++,ne<ae.length-1&&await V(G(ne));}}return {sent:Me,failed:Ee}}async function de(){if(m()==="indexeddb")try{return await E()}catch{return k().length}return k().length}async function me(){if(m()==="indexeddb")try{await y();}catch{}try{localStorage.removeItem(at);}catch{}}function De(M){if(!e||!n||typeof window>"u")return;let C=()=>{navigator.onLine&&U(M).catch(()=>{});};window.addEventListener("online",C),a=setInterval(()=>{de().then(T=>{T>0&&C();});},ts),i=()=>{window.removeEventListener("online",C),a&&(clearInterval(a),a=null);};}function Y(){i?.(),i=null;}return {enqueue:Se,flush:U,size:de,clear:me,startAutoSync:De,stopAutoSync:Y}}function ct(){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;is(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:ss(r),userAgentData:as(t),screen:ls(n,e),prefersColorScheme:cs(e),prefersReducedMotion:oe(e,"(prefers-reduced-motion: reduce)"),prefersReducedData:oe(e,"(prefers-reduced-data: reduce)"),prefersContrast:us(e),forcedColors:oe(e,"(forced-colors: active)"),online:typeof t?.onLine=="boolean"?t.onLine:void 0,displayMode:ds(e),documentTitle:r?.title?.slice(0,200),buildId:ps(r),pageLoadTiming:hs(e)}}function ss(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 ue=null,Zt=false;function is(t){if(Zt)return;let e=t?.userAgentData;e?.getHighEntropyValues&&(Zt=true,e.getHighEntropyValues(["architecture","bitness","model","platformVersion","uaFullVersion","fullVersionList"]).then(r=>{ue=r;}).catch(()=>{}));}function os(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 as(t){let e=t?.userAgentData;if(!e&&!ue)return;let r=ue?.fullVersionList,n=os(r??e?.brands),s={};return n&&(s.browser=n.brand,s.browserVersion=n.version),e?.platform&&(s.os=e.platform),ue?.platformVersion&&(s.osVersion=ue.platformVersion),typeof e?.mobile=="boolean"&&(s.mobile=e.mobile),ue?.model&&(s.model=ue.model),ue?.architecture&&(s.architecture=ue.architecture),ue?.bitness&&(s.bitness=ue.bitness),Object.keys(s).length===0?void 0:s}function ls(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 oe(t,e){if(t?.matchMedia)try{return t.matchMedia(e).matches}catch{return}}function cs(t){if(t?.matchMedia)return oe(t,"(prefers-color-scheme: dark)")?"dark":oe(t,"(prefers-color-scheme: light)")?"light":"no-preference"}function us(t){if(t?.matchMedia)return oe(t,"(prefers-contrast: more)")?"more":oe(t,"(prefers-contrast: less)")?"less":oe(t,"(prefers-contrast: custom)")?"custom":"no-preference"}function ds(t){if(t?.matchMedia){if(oe(t,"(display-mode: fullscreen)"))return "fullscreen";if(oe(t,"(display-mode: standalone)"))return "standalone";if(oe(t,"(display-mode: minimal-ui)"))return "minimal-ui";if(oe(t,"(display-mode: browser)"))return "browser"}}function ps(t){if(!t)return;let r=t.querySelector?.('meta[name="mushi:build"]')?.content?.trim();if(r)return r.slice(0,64)}function hs(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=ms();if(typeof localStorage<"u")try{localStorage.setItem(Qt,t);}catch{}return t}function ms(){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 ut(){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 gs(){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 fs(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 mr(){if(typeof localStorage<"u"){let n=localStorage.getItem(er);if(n)return n}let t=gs(),e=JSON.stringify(t),r=await fs(e);if(typeof localStorage<"u")try{localStorage.setItem(er,r);}catch{}return r}var tr="mushi_session_id",Fe=null;function Le(){if(Fe)return Fe;if(typeof sessionStorage<"u"){let e=sessionStorage.getItem(tr);if(e)return Fe=e,e}let t=bs();if(Fe=t,typeof sessionStorage<"u")try{sessionStorage.setItem(tr,t);}catch{}return t}function bs(){let t=Date.now().toString(36),e=Math.random().toString(36).slice(2,8);return `ms_${t}_${e}`}var ys=10,vs=1,ws=5e3;function gr(t={}){let{maxBurst:e=ys,refillRate:r=vs,refillIntervalMs:n=ws}=t,s=e,i=Date.now();function a(){let p=Date.now(),w=p-i,d=Math.floor(w/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 g(){return a(),s}return {tryConsume:o,reset:l,availableTokens:g}}var xs=[{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]"}],Ss={emails:true,phones:true,creditCards:true,ssns:true,ipAddresses:false,secretTokens:true,ipv6:false};function fr(t={}){let e={...Ss,...t},r=xs.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 Es=50,ks=500;function br(t={}){let e=Math.max(1,t.max??Es),r=Math.max(50,t.maxMessageLength??ks),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,Rs=1e3;function yr(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,Rs)}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 Cs(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 vr(t){if(typeof t!="string")return null;let e=t.split(".");if(e.length!==3)return null;try{let r=Cs(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}}var Ts=new Set(["kensaur.us","www.kensaur.us"]),Ms={"glot-it":"glot.it",glotit:"glot.it","solo-boss-cloud":"sbc-front.vercel.app","mushi-mushi":"mushimushi.dev"},$s={"mushi-mushi":"https://kensaur.us/mushi-mushi/admin/favicon.svg","solo-boss-cloud":"https://sbc-front.vercel.app/favicon.svg","glot-it":"https://kensaur.us/glot-it/apple-touch-icon.png",glotit:"https://kensaur.us/glot-it/apple-touch-icon.png"},Ls=["www.google.com","icons.duckduckgo.com","icon.horse"];function wr(t){try{let e=new URL(t).hostname.toLowerCase();return Ls.some(r=>e===r||e.endsWith(`.${r}`))}catch{return false}}function Is(t,e=32){return [`https://${t}/favicon.svg`,`https://${t}/favicon.ico`,`https://${t}/favicon-32x32.png`,`https://${t}/apple-touch-icon.png`]}function xr(t){let e=[],r=s=>{let i=s?.trim().toLowerCase();!i||e.includes(i)||e.push(i);};r(_s(t.repo_url)),r(Ms[t.project_slug.toLowerCase()]);let n=t.sdk_origin?As(t.sdk_origin):null;return n&&!Ts.has(n)&&r(n),e}function Sr(t,e=32){if(t.icon_url?.trim())return [t.icon_url.trim()];let r=new Set,n=[],s=a=>{!a||r.has(a)||wr(a)||(r.add(a),n.push(a));},i=$s[t.project_slug.toLowerCase()];i&&s(i);for(let a of xr(t))for(let o of Is(a,e))s(o);return n}function As(t){let e=t.trim();if(!e||/^(capacitor|file|content|app):/i.test(e))return null;try{let n=new URL(e.includes("://")?e:`https://${e}`).hostname.toLowerCase();return n==="localhost"||n==="127.0.0.1"||n.endsWith(".local")?null:n}catch{return null}}function _s(t){if(!t?.trim())return null;try{let e=new URL(t.trim()),r=e.hostname.toLowerCase(),n=e.pathname.replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);if(n.length<2)return null;let s=n[1].replace(/\.git$/i,"").toLowerCase();return /^[a-z0-9][a-z0-9.-]*\.[a-z]{2,}$/i.test(s)||r==="github.com"&&s.endsWith(".github.io")?s:r!=="github.com"&&r!=="www.github.com"?r:null}catch{return null}}function Er(t){return xr(t)[0]??null}function kr(t){if(typeof document>"u"||!t.complete||t.naturalWidth===0||t.naturalHeight===0)return false;try{let e=document.createElement("canvas"),r=t.naturalWidth,n=t.naturalHeight;e.width=r,e.height=n;let s=e.getContext("2d");if(!s)return !1;s.drawImage(t,0,0);let{data:i}=s.getImageData(0,0,r,n),a=0,o=0,l=0;for(let p=0;p<i.length;p+=4){let w=i[p],d=i[p+1],m=i[p+2];if(i[p+3]<128)continue;a++;let f=Math.max(w,d,m),S=Math.min(w,d,m),$=f-S;l=Math.max(l,$),o+=$;}return a===0?!0:o/a<14&&l<24}catch{return wr(t.src)}}function Rr(t){let e=t.trim().split(/[\s._-]+/).filter(Boolean);return e.length>=2?`${e[0][0]??""}${e[1][0]??""}`.toUpperCase():(t.replace(/[^a-zA-Z0-9]/g,"").slice(0,2)||t.slice(0,2)||"?").toUpperCase()}function Cr(){if(typeof document>"u")return null;let t=['link[rel="icon"]','link[rel="shortcut icon"]','link[rel="apple-touch-icon"]'];for(let e of t){let n=document.querySelector(e)?.href;if(n&&Ps(n))return n}return null}function Ps(t){try{let e=typeof location<"u"?location.href:void 0,r=new URL(t,e).protocol;return r==="http:"||r==="https:"}catch{return false}}async function Mr(t,e=nr){if(!t.startsWith("data:image/")||Tr(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 g=a.getContext("2d");if(g){g.drawImage(r,0,0,o,l);for(let p of n){let w=a.toDataURL("image/jpeg",p);if(Tr(w)<=e)return w}}}return null}function Tr(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 je={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",screenshotPreviewAlt:"Preview of the screenshot that will be sent",screenshotSensitiveHint:"Check the preview \u2014 remove it if any private info (balances, personal details) is visible.",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 $r={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",screenshotPreviewAlt:"\u9001\u4FE1\u3055\u308C\u308B\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306E\u30D7\u30EC\u30D3\u30E5\u30FC",screenshotSensitiveHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u3092\u78BA\u8A8D\u3057\u3001\u6B8B\u9AD8\u3084\u500B\u4EBA\u60C5\u5831\u306A\u3069\u304C\u5199\u3063\u3066\u3044\u308C\u3070\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002",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 Lr={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",screenshotPreviewAlt:"\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u0E17\u0E35\u0E48\u0E08\u0E30\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07",screenshotSensitiveHint:"\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E20\u0E32\u0E1E \u2014 \u0E2B\u0E32\u0E01\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E15\u0E31\u0E27 (\u0E22\u0E2D\u0E14\u0E40\u0E07\u0E34\u0E19 \u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E1A\u0E38\u0E04\u0E04\u0E25) \u0E42\u0E1B\u0E23\u0E14\u0E25\u0E1A\u0E2D\u0E2D\u0E01",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 Ir={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",screenshotPreviewAlt:"Vista previa de la captura que se enviar\xE1",screenshotSensitiveHint:"Revisa la vista previa \u2014 qu\xEDtala si se ve informaci\xF3n privada (saldos, datos personales).",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 Ds={en:je,ja:$r,th:Lr,es:Ir};function dt(t){let e=t&&t!=="auto"?t:typeof navigator<"u"?navigator.language??navigator.languages?.[0]:void 0;if(!e)return je;let r=e.split("-")[0].toLowerCase();return Ds[r]??je}function Ar(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",g=n?"#928B7E":"#5C5852",p=n?"#5A5650":"#9A9489",w=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"),f=n?`${c}1F`:`${c}14`,S=a||(n?"#FFE5E0":"#7A1F15"),$="'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",E="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 Sn=4194304,nr=1.5*1024*1024;function En(t){try{return JSON.stringify(t)}catch{return null}}function kn(t,e=Sn){let r=En(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 ${Wt(n)} exceeds limit ${Wt(e)}`}}function Wt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}var Vt=false,Rn="X-Mushi-User-Token",Cn="X-Mushi-Project",sr="X-Mushi-SDK-Package",ir="X-Mushi-SDK-Version";function Tn(t){let e={"Content-Type":"application/json","X-Mushi-Api-Key":t.apiKey,[Cn]:t.projectId};return t.sdkPackage&&(e[sr]=t.sdkPackage),t.sdkVersion&&(e[ir]=t.sdkVersion),t.userToken&&(e[Rn]=t.userToken),t.internalKind&&(e[$e]=t.internalKind),e}var Ue="https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api",$e="X-Mushi-Internal",Re="__mushiInternal",Mn=1e4,$n=2;function or(t){let{projectId:e,apiKey:r,apiEndpoint:n=Ue,timeout:s=Mn,maxRetries:i=$n,getUserToken:a,sdkPackage:o,sdkVersion:l}=t,g=n.replace(/\/$/,"");async function p(d,m,c,f=i,S,$){let R=`${g}${m}`,E=new AbortController,y=setTimeout(()=>E.abort(),s),k=a?.()??null;try{let b=await fetch(R,{method:d,headers:{...Tn({apiKey:r,projectId:e,sdkPackage:o,sdkVersion:l,userToken:k,internalKind:S}),...$},body:c?JSON.stringify(c):void 0,signal:E.signal,...S?{[Re]:S}:{}});if(clearTimeout(y),b.status===307||b.status===308){let W=b.headers.get("Location");if(W&&f>0){let A=W.replace(/\/v1\/.*$/,"").replace(/\/$/,"");if(A!==g)return g=A,p(d,m,c,f-1,S,$)}}if(!b.ok){let W=await b.json().catch(()=>({}));if((b.status===401||b.status===403)&&!Vt){Vt=!0;let A=g===Ue?"Get the correct values at: https://kensaur.us/mushi-mushi/admin/projects":"Get the correct values from your Mushi console's Projects page.";console.error(`[Mushi] Credentials rejected (HTTP ${b.status}). Check your Project ID and API key scope (must be "report:write"). `+A);}return b.status>=500&&f>0?(await Kt(Gt(i-f)),p(d,m,c,f-1,S,$)):{ok:!1,error:{code:W.error?.code||`HTTP_${b.status}`,message:W.error?.message||W.message||`HTTP ${b.status} error`}}}let _=await b.json();return {ok:!0,data:_&&typeof _=="object"&&"ok"in _&&"data"in _?_.data:_}}catch(b){return clearTimeout(y),f>0&&An(b)?(await Kt(Gt(i-f)),p(d,m,c,f-1,S)):{ok:false,error:{code:"NETWORK_ERROR",message:b instanceof Error?b.message:"Unknown network error"}}}}async function w(d,m,c,f){let S=await Ln(c),$=String(Date.now()),R=await In(r,`${e}.${$}.${S}`),E=`${g}${m}`,y=await fetch(E,{method:d,headers:{"Content-Type":"application/json","X-Mushi-Api-Key":r,"X-Mushi-Project":e,...o?{[sr]:o}:{},...l?{[ir]:l}:{},[$e]:"reporter-poll","X-Reporter-Token-Hash":S,"X-Reporter-Ts":$,"X-Reporter-Hmac":R},body:f?JSON.stringify(f):void 0,[Re]:"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=kn(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 w("GET","/v1/reporter/reports",d)},async listReporterComments(d,m){return w("GET",`/v1/reporter/reports/${d}/comments`,m)},async replyToReporterReport(d,m,c,f){return w("POST",`/v1/reporter/reports/${d}/reply`,m,{body:c,...f?{feedback_signal:f}:{}})},async reopenReporterReport(d,m,c){return w("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 f=c.size?`?${c.toString()}`:"";return w("GET",`/v1/notifications${f}`,d)},async markNotificationRead(d,m){return w("POST",`/v1/notifications/${d}/read`,m,{})},async listReporterFeatureBoard(d){return w("GET","/v1/reporter/feature-board",d)},async voteReporterFeatureBoard(d,m){return w("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 f=c.size?`?${c.toString()}`:"";return p("GET",`/v1/tester/cross-app-reports${f}`,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 Ln(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 In(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 An(t){return t instanceof DOMException&&t.name==="AbortError"||t instanceof TypeError}function ot(...t){return t.find(e=>e!==void 0&&e!=="")}function ie(t){try{let e=undefined;return typeof e=="object"&&e!==null?e[t]:void 0}catch{return}}function ge(t){try{return t()}catch{return}}function ar(){let t=ot(ie("VITE_MUSHI_PROJECT_ID"),ie("NEXT_PUBLIC_MUSHI_PROJECT_ID"),ie("NUXT_PUBLIC_MUSHI_PROJECT_ID"),ie("EXPO_PUBLIC_MUSHI_PROJECT_ID"),ge(()=>process.env.NEXT_PUBLIC_MUSHI_PROJECT_ID),ge(()=>process.env.EXPO_PUBLIC_MUSHI_PROJECT_ID),ge(()=>process.env.MUSHI_PROJECT_ID)),e=ot(ie("VITE_MUSHI_API_KEY"),ie("NEXT_PUBLIC_MUSHI_API_KEY"),ie("NUXT_PUBLIC_MUSHI_API_KEY"),ie("EXPO_PUBLIC_MUSHI_API_KEY"),ge(()=>process.env.NEXT_PUBLIC_MUSHI_API_KEY),ge(()=>process.env.EXPO_PUBLIC_MUSHI_API_KEY),ge(()=>process.env.MUSHI_API_KEY)),r=ot(ie("VITE_MUSHI_API_ENDPOINT"),ie("NEXT_PUBLIC_MUSHI_API_ENDPOINT"),ie("NUXT_PUBLIC_MUSHI_API_ENDPOINT"),ie("EXPO_PUBLIC_MUSHI_API_ENDPOINT"),ge(()=>process.env.NEXT_PUBLIC_MUSHI_API_ENDPOINT),ge(()=>process.env.EXPO_PUBLIC_MUSHI_API_ENDPOINT),ge(()=>process.env.MUSHI_API_ENDPOINT)),n={};return t&&(n.projectId=t),e&&(n.apiKey=e),r&&(n.apiEndpoint=r),n}var _n=10,Pn=2e3,Dn=[/^(.)\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],On=/^[bcdfghjklmnpqrstvwxz]{6,}/i;function lr(t={}){let{enabled:e=true,blockObviousSpam:r=true,minDescriptionLength:n=_n,maxDescriptionLength:s=Pn}=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 Dn)if(p.test(l))return {passed:false,reason:"Detected as spam"};if(On.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},Hn={debug:"DBG",info:"INF",warn:"WRN",error:"ERR",fatal:"FTL"},ee={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"},Bn={debug:ee.dim,info:ee.green,warn:ee.yellow,error:ee.red,fatal:`${ee.bgRed}${ee.white}${ee.bold}`};function Nn(){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 Fn(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 Un(t){let{ts:e,level:r,scope:n,msg:s,...i}=t,a=e.slice(11,23),o=Bn[r]??"",l=Hn[r]??r.toUpperCase(),g=Object.keys(i).length>0?` ${ee.dim}${Fn(i)}${ee.reset}`:"";return `${ee.dim}${a}${ee.reset} ${o}${l}${ee.reset} ${ee.cyan}[${n}]${ee.reset} ${s}${g}`}function qn(t){return JSON.stringify(t)}function jn(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 cr(t,e,r,n,s){let i=e;function a(o,l,g){if(Yt[o]<Yt[i])return;let p={ts:new Date().toISOString(),level:o,scope:t,msg:l,...r,...g};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 cr(`${t}:${o}`,i,{...r,...l},n,s)},setLevel(o){i=o;}}}function qe(t){let{scope:e,level:r="info",meta:n={},format:s="auto",destination:i="stdout"}=t,o=(s==="auto"?Nn():s)==="json"?qn:Un,l=jn(i);return cr(e,r,n,o,l)}var lt={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},fatal:()=>{},child:()=>lt,setLevel:()=>{}},zn="mushi-mushi-keyring",Ce="keys",ur="offline-queue/v1",Be=null,Ne=null;function Wn(){return typeof globalThis<"u"&&typeof globalThis.crypto<"u"&&typeof globalThis.crypto.subtle<"u"&&typeof indexedDB<"u"}function dr(){return new Promise((t,e)=>{let r=indexedDB.open(zn,1);r.onupgradeneeded=()=>{let n=r.result;n.objectStoreNames.contains(Ce)||n.createObjectStore(Ce);},r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error);})}async function Vn(){let t=await dr();return new Promise((e,r)=>{let s=t.transaction(Ce,"readonly").objectStore(Ce).get(ur);s.onsuccess=()=>e(s.result??null),s.onerror=()=>r(s.error);})}async function Kn(t){let e=await dr();return new Promise((r,n)=>{let s=e.transaction(Ce,"readwrite");s.objectStore(Ce).put(t,ur),s.oncomplete=()=>r(),s.onerror=()=>n(s.error);})}async function pr(){if(Be)return Be;if(Ne)return Ne;if(!Wn())throw new Error("Web Crypto + IndexedDB required for offline queue encryption");return Ne=(async()=>{let t=await Vn();if(t)return Be=t,t;let e=await crypto.subtle.generateKey({name:"AES-GCM",length:256},false,["encrypt","decrypt"]);return await Kn(e),Be=e,e})(),Ne}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 Gn(t){let e=await pr(),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 Yn(t){return !!t&&typeof t=="object"&&t._mme===1&&typeof t.iv=="string"&&typeof t.ct=="string"}async function Xn(t){let e=await pr(),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 fe=qe({scope:"mushi:queue",level:"warn"}),Jn="mushi-mushi",Q="offline-reports",Zn=1,at="mushi_offline_queue",Qn=10,es=6e4,ts=3e4,rs=8,ns=1440*60*1e3;function hr(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 C=new Date().toISOString();if(!s)return {...M,queuedAt:C};try{let T=await Gn(M);return {id:M.id,queuedAt:C,payload:T}}catch(T){return fe.warn("Offline queue: encryption failed, storing plaintext",{err:String(T)}),{...M,queuedAt:C}}}async function g(M){if(p(M))try{return await Xn(M.payload)}catch(C){return fe.warn("Offline queue: decrypt failed, dropping row",{err:String(C),id:M.id}),null}return M}function p(M){return !!M.payload&&Yn(M.payload)}function w(M){let C=M.attempts;return typeof C=="number"&&Number.isFinite(C)?C:0}function d(M,C){let T=M.queuedAt;if(!T)return false;let H=Date.parse(T);return Number.isNaN(H)?false:C-H>ns}function m(){return o||(typeof indexedDB<"u"?o="indexeddb":typeof localStorage<"u"?o="localstorage":o="none",o)}function c(){return new Promise((M,C)=>{let T=indexedDB.open(Jn,Zn);T.onupgradeneeded=()=>{let H=T.result;H.objectStoreNames.contains(Q)||H.createObjectStore(Q,{keyPath:"id"});},T.onsuccess=()=>M(T.result),T.onerror=()=>{o="localstorage",C(T.error);};})}async function f(M){let C=await c(),T=await l(M);return new Promise((H,P)=>{let ae=C.transaction(Q,"readwrite");ae.objectStore(Q).put(T),ae.oncomplete=()=>H(),ae.onerror=()=>P(ae.error);})}async function S(){let M=await c();return new Promise((C,T)=>{let P=M.transaction(Q,"readonly").objectStore(Q).getAll();P.onsuccess=()=>C(P.result),P.onerror=()=>T(P.error);})}async function $(M){let C=await c();return new Promise((T,H)=>{let P=C.transaction(Q,"readwrite");P.objectStore(Q).delete(M),P.oncomplete=()=>T(),P.onerror=()=>H(P.error);})}async function R(M){let C=await c();return new Promise((T,H)=>{let P=C.transaction(Q,"readwrite");P.objectStore(Q).put(M),P.oncomplete=()=>T(),P.onerror=()=>H(P.error);})}async function E(){let M=await c();return new Promise((C,T)=>{let P=M.transaction(Q,"readonly").objectStore(Q).count();P.onsuccess=()=>C(P.result),P.onerror=()=>T(P.error);})}async function y(){let M=await c();return new Promise((C,T)=>{let H=M.transaction(Q,"readwrite");H.objectStore(Q).clear(),H.oncomplete=()=>C(),H.onerror=()=>T(H.error);})}function k(){try{let M=localStorage.getItem(at);return M?JSON.parse(M):[]}catch{return []}}function b(M){try{localStorage.setItem(at,JSON.stringify(M));}catch{}}async function _(M){let C=k();C.push(await l(M)),b(C);}function V(M){let C=k().filter(T=>T.id!==M);b(C);}function W(M){let C=k(),T=C.findIndex(H=>H.id===M.id);T>=0&&(C[T]=M,b(C));}async function A(M,C){try{M==="indexeddb"?await $(C):V(C);}catch(T){fe.debug("Offline queue: row removal failed (will age out)",{id:C,err:String(T)});}}async function G(M,C){try{return M==="indexeddb"?await R(C):W(C),!0}catch(T){return fe.debug("Offline queue: row persist failed",{id:C.id,err:String(T)}),false}}async function Se(M){if(!e)return;if(await de()>=r){fe.warn("Offline queue full \u2014 dropping report",{maxQueueSize:r});return}let T=m();if(T==="indexeddb")try{await f(M);return}catch{o="localstorage";}if(T==="localstorage"||o==="localstorage"){await _(M);return}}function Y(M){return Math.min(1e3*2**M+Math.random()*500,es)}function K(M){return new Promise(C=>setTimeout(C,M))}async function q(M){if(!e)return {sent:0,failed:0};let C,T=m();if(T==="indexeddb")try{C=await S();}catch{C=k();}else C=k();let H=Date.now(),P=[];for(let ne of C)if(d(ne,H)){let J=ne.id;await A(T,J),fe.debug("Offline queue: evicting stale report",{id:J});}else P.push(ne);C=P;let ae=C.slice(0,Qn),Me=0,Ee=0;for(let ne=0;ne<ae.length;ne++){let J=ae[ne],D=J.id,st=await g(J);if(!st){await A(T,D),Ee++;continue}let B=await M.submitReport(st);if(B.ok)await A(T,D),Me++;else {let Oe=B.error?.code==="HTTP_400"||B.error?.code==="HTTP_413"||B.error?.code==="HTTP_422"||B.error?.code==="INGEST_ERROR"||B.error?.code==="VALIDATION_ERROR"||B.error?.code==="PAYLOAD_TOO_LARGE"||B.error?.code==="SERIALIZE_FAILED"||typeof B.error?.message=="string"&&/invalid payload|description must be at least|validation/i.test(B.error.message),He=!Oe&&(B.error?.code==="NETWORK_ERROR"||B.error?.code==="HTTP_403"||B.error?.code==="HTTP_429"||B.error?.code==="HTTP_502"||B.error?.code==="HTTP_503"||B.error?.code==="HTTP_504"||typeof B.error?.code=="string"&&B.error.code.startsWith("HTTP_5"));if(Oe)await A(T,D);else if(He){let ke=w(J)+1;ke>=rs?(await A(T,D),fe.warn("Offline queue: giving up on report after repeated failures",{id:D,attempts:ke,code:B.error?.code})):(J.attempts=ke,await G(T,J)?fe.debug("Offline queue: transient failure, will retry",{id:D,attempts:ke,code:B.error?.code}):(await A(T,D),fe.warn("Offline queue: dropping report (attempt counter unpersistable)",{id:D,code:B.error?.code})));}Ee++,ne<ae.length-1&&await K(Y(ne));}}return {sent:Me,failed:Ee}}async function de(){if(m()==="indexeddb")try{return await E()}catch{return k().length}return k().length}async function me(){if(m()==="indexeddb")try{await y();}catch{}try{localStorage.removeItem(at);}catch{}}function De(M){if(!e||!n||typeof window>"u")return;let C=()=>{navigator.onLine&&q(M).catch(()=>{});};window.addEventListener("online",C),a=setInterval(()=>{de().then(T=>{T>0&&C();});},ts),i=()=>{window.removeEventListener("online",C),a&&(clearInterval(a),a=null);};}function F(){i?.(),i=null;}return {enqueue:Se,flush:q,size:de,clear:me,startAutoSync:De,stopAutoSync:F}}function ct(){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;is(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:ss(r),userAgentData:as(t),screen:ls(n,e),prefersColorScheme:cs(e),prefersReducedMotion:oe(e,"(prefers-reduced-motion: reduce)"),prefersReducedData:oe(e,"(prefers-reduced-data: reduce)"),prefersContrast:us(e),forcedColors:oe(e,"(forced-colors: active)"),online:typeof t?.onLine=="boolean"?t.onLine:void 0,displayMode:ds(e),documentTitle:r?.title?.slice(0,200),buildId:ps(r),pageLoadTiming:hs(e)}}function ss(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 ue=null,Zt=false;function is(t){if(Zt)return;let e=t?.userAgentData;e?.getHighEntropyValues&&(Zt=true,e.getHighEntropyValues(["architecture","bitness","model","platformVersion","uaFullVersion","fullVersionList"]).then(r=>{ue=r;}).catch(()=>{}));}function os(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 as(t){let e=t?.userAgentData;if(!e&&!ue)return;let r=ue?.fullVersionList,n=os(r??e?.brands),s={};return n&&(s.browser=n.brand,s.browserVersion=n.version),e?.platform&&(s.os=e.platform),ue?.platformVersion&&(s.osVersion=ue.platformVersion),typeof e?.mobile=="boolean"&&(s.mobile=e.mobile),ue?.model&&(s.model=ue.model),ue?.architecture&&(s.architecture=ue.architecture),ue?.bitness&&(s.bitness=ue.bitness),Object.keys(s).length===0?void 0:s}function ls(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 oe(t,e){if(t?.matchMedia)try{return t.matchMedia(e).matches}catch{return}}function cs(t){if(t?.matchMedia)return oe(t,"(prefers-color-scheme: dark)")?"dark":oe(t,"(prefers-color-scheme: light)")?"light":"no-preference"}function us(t){if(t?.matchMedia)return oe(t,"(prefers-contrast: more)")?"more":oe(t,"(prefers-contrast: less)")?"less":oe(t,"(prefers-contrast: custom)")?"custom":"no-preference"}function ds(t){if(t?.matchMedia){if(oe(t,"(display-mode: fullscreen)"))return "fullscreen";if(oe(t,"(display-mode: standalone)"))return "standalone";if(oe(t,"(display-mode: minimal-ui)"))return "minimal-ui";if(oe(t,"(display-mode: browser)"))return "browser"}}function ps(t){if(!t)return;let r=t.querySelector?.('meta[name="mushi:build"]')?.content?.trim();if(r)return r.slice(0,64)}function hs(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=ms();if(typeof localStorage<"u")try{localStorage.setItem(Qt,t);}catch{}return t}function ms(){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 ut(){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 gs(){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 fs(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 mr(){if(typeof localStorage<"u"){let n=localStorage.getItem(er);if(n)return n}let t=gs(),e=JSON.stringify(t),r=await fs(e);if(typeof localStorage<"u")try{localStorage.setItem(er,r);}catch{}return r}var tr="mushi_session_id",Fe=null;function Le(){if(Fe)return Fe;if(typeof sessionStorage<"u"){let e=sessionStorage.getItem(tr);if(e)return Fe=e,e}let t=bs();if(Fe=t,typeof sessionStorage<"u")try{sessionStorage.setItem(tr,t);}catch{}return t}function bs(){let t=Date.now().toString(36),e=Math.random().toString(36).slice(2,8);return `ms_${t}_${e}`}var ys=10,vs=1,ws=5e3;function gr(t={}){let{maxBurst:e=ys,refillRate:r=vs,refillIntervalMs:n=ws}=t,s=e,i=Date.now();function a(){let p=Date.now(),w=p-i,d=Math.floor(w/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 g(){return a(),s}return {tryConsume:o,reset:l,availableTokens:g}}var xs=[{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]"}],Ss={emails:true,phones:true,creditCards:true,ssns:true,ipAddresses:false,secretTokens:true,ipv6:false};function fr(t={}){let e={...Ss,...t},r=xs.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 Es=50,ks=500;function br(t={}){let e=Math.max(1,t.max??Es),r=Math.max(50,t.maxMessageLength??ks),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,Rs=1e3;function yr(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,Rs)}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 Cs(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 vr(t){if(typeof t!="string")return null;let e=t.split(".");if(e.length!==3)return null;try{let r=Cs(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}}var Ts=new Set(["kensaur.us","www.kensaur.us"]),Ms={"glot-it":"glot.it",glotit:"glot.it","solo-boss-cloud":"sbc-front.vercel.app","mushi-mushi":"mushimushi.dev"},$s={"mushi-mushi":"https://kensaur.us/mushi-mushi/admin/favicon.svg","solo-boss-cloud":"https://sbc-front.vercel.app/favicon.svg","glot-it":"https://kensaur.us/glot-it/apple-touch-icon.png",glotit:"https://kensaur.us/glot-it/apple-touch-icon.png"},Ls=["www.google.com","icons.duckduckgo.com","icon.horse"];function wr(t){try{let e=new URL(t).hostname.toLowerCase();return Ls.some(r=>e===r||e.endsWith(`.${r}`))}catch{return false}}function Is(t,e=32){return [`https://${t}/favicon.svg`,`https://${t}/favicon.ico`,`https://${t}/favicon-32x32.png`,`https://${t}/apple-touch-icon.png`]}function xr(t){let e=[],r=s=>{let i=s?.trim().toLowerCase();!i||e.includes(i)||e.push(i);};r(_s(t.repo_url)),r(Ms[t.project_slug.toLowerCase()]);let n=t.sdk_origin?As(t.sdk_origin):null;return n&&!Ts.has(n)&&r(n),e}function Sr(t,e=32){if(t.icon_url?.trim())return [t.icon_url.trim()];let r=new Set,n=[],s=a=>{!a||r.has(a)||wr(a)||(r.add(a),n.push(a));},i=$s[t.project_slug.toLowerCase()];i&&s(i);for(let a of xr(t))for(let o of Is(a,e))s(o);return n}function As(t){let e=t.trim();if(!e||/^(capacitor|file|content|app):/i.test(e))return null;try{let n=new URL(e.includes("://")?e:`https://${e}`).hostname.toLowerCase();return n==="localhost"||n==="127.0.0.1"||n.endsWith(".local")?null:n}catch{return null}}function _s(t){if(!t?.trim())return null;try{let e=new URL(t.trim()),r=e.hostname.toLowerCase(),n=e.pathname.replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);if(n.length<2)return null;let s=n[1].replace(/\.git$/i,"").toLowerCase();return /^[a-z0-9][a-z0-9.-]*\.[a-z]{2,}$/i.test(s)||r==="github.com"&&s.endsWith(".github.io")?s:r!=="github.com"&&r!=="www.github.com"?r:null}catch{return null}}function Er(t){return xr(t)[0]??null}function kr(t){if(typeof document>"u"||!t.complete||t.naturalWidth===0||t.naturalHeight===0)return false;try{let e=document.createElement("canvas"),r=t.naturalWidth,n=t.naturalHeight;e.width=r,e.height=n;let s=e.getContext("2d");if(!s)return !1;s.drawImage(t,0,0);let{data:i}=s.getImageData(0,0,r,n),a=0,o=0,l=0;for(let p=0;p<i.length;p+=4){let w=i[p],d=i[p+1],m=i[p+2];if(i[p+3]<128)continue;a++;let f=Math.max(w,d,m),S=Math.min(w,d,m),$=f-S;l=Math.max(l,$),o+=$;}return a===0?!0:o/a<14&&l<24}catch{return wr(t.src)}}function Rr(t){let e=t.trim().split(/[\s._-]+/).filter(Boolean);return e.length>=2?`${e[0][0]??""}${e[1][0]??""}`.toUpperCase():(t.replace(/[^a-zA-Z0-9]/g,"").slice(0,2)||t.slice(0,2)||"?").toUpperCase()}function Cr(){if(typeof document>"u")return null;let t=['link[rel="icon"]','link[rel="shortcut icon"]','link[rel="apple-touch-icon"]'];for(let e of t){let n=document.querySelector(e)?.href;if(n&&Ps(n))return n}return null}function Ps(t){try{let e=typeof location<"u"?location.href:void 0,r=new URL(t,e).protocol;return r==="http:"||r==="https:"}catch{return false}}async function Mr(t,e=nr){if(!t.startsWith("data:image/")||Tr(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 g=a.getContext("2d");if(g){g.drawImage(r,0,0,o,l);for(let p of n){let w=a.toDataURL("image/jpeg",p);if(Tr(w)<=e)return w}}}return null}function Tr(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 je={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",screenshotPreviewAlt:"Preview of the screenshot that will be sent",screenshotSensitiveHint:"Check the preview \u2014 remove it if any private info (balances, personal details) is visible.",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 $r={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",screenshotPreviewAlt:"\u9001\u4FE1\u3055\u308C\u308B\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306E\u30D7\u30EC\u30D3\u30E5\u30FC",screenshotSensitiveHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u3092\u78BA\u8A8D\u3057\u3001\u6B8B\u9AD8\u3084\u500B\u4EBA\u60C5\u5831\u306A\u3069\u304C\u5199\u3063\u3066\u3044\u308C\u3070\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002",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 Lr={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",screenshotPreviewAlt:"\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u0E17\u0E35\u0E48\u0E08\u0E30\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07",screenshotSensitiveHint:"\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E20\u0E32\u0E1E \u2014 \u0E2B\u0E32\u0E01\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E15\u0E31\u0E27 (\u0E22\u0E2D\u0E14\u0E40\u0E07\u0E34\u0E19 \u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E1A\u0E38\u0E04\u0E04\u0E25) \u0E42\u0E1B\u0E23\u0E14\u0E25\u0E1A\u0E2D\u0E2D\u0E01",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 Ir={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",screenshotPreviewAlt:"Vista previa de la captura que se enviar\xE1",screenshotSensitiveHint:"Revisa la vista previa \u2014 qu\xEDtala si se ve informaci\xF3n privada (saldos, datos personales).",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 Ds={en:je,ja:$r,th:Lr,es:Ir};function dt(t){let e=t&&t!=="auto"?t:typeof navigator<"u"?navigator.language??navigator.languages?.[0]:void 0;if(!e)return je;let r=e.split("-")[0].toLowerCase();return Ds[r]??je}function Ar(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",g=n?"#928B7E":"#5C5852",p=n?"#5A5650":"#9A9489",w=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"),f=n?`${c}1F`:`${c}14`,S=a||(n?"#FFE5E0":"#7A1F15"),$="'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",E="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};
@@ -814,6 +814,16 @@
814
814
  line-height: 1.4;
815
815
  letter-spacing: 0.02em;
816
816
  }
817
+ .mushi-identified-user {
818
+ margin: 8px 0 0;
819
+ font-size: 11.5px;
820
+ color: ${g};
821
+ line-height: 1.4;
822
+ }
823
+ .mushi-identified-user strong {
824
+ color: ${l};
825
+ font-weight: 600;
826
+ }
817
827
  .mushi-annotate-toolbar {
818
828
  display: flex;
819
829
  flex-wrap: wrap;
@@ -1732,7 +1742,7 @@
1732
1742
  .mushi-assistant-submit:hover{transform:translateY(-1px)}
1733
1743
  .mushi-assistant-submit:disabled{opacity:0.5;cursor:default;transform:none}
1734
1744
  .mushi-assistant-submit:focus-visible{outline:2px solid ${c};outline-offset:2px}
1735
- `}var be="@mushi-mushi/web",te="1.19.2";var ze={bug:"\u26A0\uFE0F",slow:"\u{1F40C}",visual:"\u{1F3A8}",confusing:"\u{1F615}",other:"\u{1F4DD}"},pt="Feature request";function ht(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 _r(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 We(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 Ve(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 Ke(t){return t<10?`0${t}`:String(t)}var Ie=3,ve={category:1,intent:2,details:3};function Pr(t){return (t.metaKey||t.ctrlKey)&&t.key==="Enter"}function v(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Dr(t){let e=t.appDomain??Er({project_slug:t.appSlug??""}),r=v(Rr(t.appName)),n=Sr({project_slug:t.appSlug??"",sdk_origin:t.appDomain?`https://${t.appDomain}`:null});return n.length?`<span class="mushi-app-icon" data-mushi-favicon data-candidates="${v(JSON.stringify(n))}" data-initials="${r}" aria-hidden="true" title="${v(e??t.appName)}">
1745
+ `}var be="@mushi-mushi/web",te="1.20.0";var ze={bug:"\u26A0\uFE0F",slow:"\u{1F40C}",visual:"\u{1F3A8}",confusing:"\u{1F615}",other:"\u{1F4DD}"},pt="Feature request";function ht(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 _r(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 We(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 Ve(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 Ke(t){return t<10?`0${t}`:String(t)}var Ie=3,ve={category:1,intent:2,details:3};function Pr(t){return (t.metaKey||t.ctrlKey)&&t.key==="Enter"}function v(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Dr(t){let e=t.appDomain??Er({project_slug:t.appSlug??""}),r=v(Rr(t.appName)),n=Sr({project_slug:t.appSlug??"",sdk_origin:t.appDomain?`https://${t.appDomain}`:null});return n.length?`<span class="mushi-app-icon" data-mushi-favicon data-candidates="${v(JSON.stringify(n))}" data-initials="${r}" aria-hidden="true" title="${v(e??t.appName)}">
1736
1746
  <img class="mushi-app-icon-img" src="${v(n[0])}" alt="" referrerpolicy="no-referrer" width="16" height="16" />
1737
1747
  <span class="mushi-app-icon-initials" hidden>${r}</span>
1738
1748
  </span>`:`<span class="mushi-app-icon mushi-app-icon-initials-only" aria-hidden="true">${r}</span>`}function Or(t){t.querySelectorAll("[data-mushi-favicon]").forEach(e=>{let r=e.querySelector(".mushi-app-icon-img"),n=e.querySelector(".mushi-app-icon-initials");if(!r||!n)return;let s=[];try{s=JSON.parse(e.dataset.candidates??"[]");}catch{s=[];}let i=0,a=()=>{i+=1,i<s.length?r.src=s[i]:(r.remove(),n.hidden=false,e.classList.add("mushi-app-icon-initials-only"));};r.onerror=a,r.onload=()=>{kr(r)&&a();};});}function Br(t){switch(t.step){case "category":return Hs(t);case "intent":return Ks(t);case "details":return Gs(t);case "success":return Ys(t);case "reports":return Us(t);case "report-detail":return Vs(t);case "leaderboard":return js(t);case "roadmap":return qs(t);case "account":return zs(t);case "cross-app-reports":return Ws(t);case "assistant":return Os(t)}}function Os(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">${v(r)}</div>
@@ -2057,6 +2067,7 @@
2057
2067
  ${t.screenshotHint?`<figcaption class="mushi-screenshot-hint">\u26A0 ${v(t.screenshotHint)}</figcaption>`:""}
2058
2068
  </figure>`:""}
2059
2069
  <div class="mushi-error" style="display:none" role="alert"></div>
2070
+ ${t.identifiedUser?`<p class="mushi-identified-user" aria-label="Reporting as ${v(t.identifiedUser.name??t.identifiedUser.email??"")}">\u{1F464} Reporting as <strong>${v(t.identifiedUser.name??t.identifiedUser.email??"you")}</strong></p>`:""}
2060
2071
  </div>
2061
2072
  <div class="mushi-footer">
2062
2073
  <span class="mushi-footer-hint" aria-hidden="true">\u2318 + ENTER \u2192 send</span>
@@ -2152,7 +2163,7 @@
2152
2163
  <div class="mushi-rewards-next-label">${o}</div>
2153
2164
  `:""}
2154
2165
  </div>
2155
- `}var Ge=class t{constructor(e={},r,n=te){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",screenshotSensitiveHint:e.screenshotSensitiveHint??true,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=dt(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;screenshotPreview=null;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.screenshotSensitiveHint!==void 0?{screenshotSensitiveHint:e.screenshotSensitiveHint}:{},...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=dt(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:ze[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.screenshotPreview=null,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=pt,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,e||(this.screenshotPreview=null),this.isOpen&&this.render();}setScreenshotPreview(e){this.screenshotPreview=e,this.isOpen&&this.render();}resolveScreenshotHint(){let e=this.config.screenshotSensitiveHint;return e===false?null:typeof e=="string"?e.trim()?e:null:this.locale.step3.screenshotSensitiveHint}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=`
2166
+ `}var Ge=class t{constructor(e={},r,n=te){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",screenshotSensitiveHint:e.screenshotSensitiveHint??true,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=dt(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;screenshotPreview=null;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;identifiedUser=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.screenshotSensitiveHint!==void 0?{screenshotSensitiveHint:e.screenshotSensitiveHint}:{},...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=dt(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:ze[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.screenshotPreview=null,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=pt,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,e||(this.screenshotPreview=null),this.isOpen&&this.render();}setScreenshotPreview(e){this.screenshotPreview=e,this.isOpen&&this.render();}resolveScreenshotHint(){let e=this.config.screenshotSensitiveHint;return e===false?null:typeof e=="string"?e.trim()?e:null:this.locale.step3.screenshotSensitiveHint}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=`
2156
2167
  position: fixed;
2157
2168
  bottom: 24px;
2158
2169
  left: 50%;
@@ -2185,7 +2196,7 @@
2185
2196
  backdrop-filter: blur(4px);
2186
2197
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
2187
2198
  animation: mushi-fade-in 0.15s ease forwards;
2188
- `,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",g=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(g)),p.setAttribute("role","banner");let w=document.createElement("button");if(w.className="mushi-banner-dismiss",w.textContent="\u2715",w.setAttribute("aria-label","Dismiss feedback banner"),w.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 f=document.createElement("nav");f.className="mushi-banner-actions",f.setAttribute("aria-label","Feedback banner actions");let S=(R=false)=>{let E=document.createElement("span");E.className=`mushi-banner-divider${R?" mushi-banner-extra":""}`,E.setAttribute("aria-hidden","true"),E.textContent="|",f.appendChild(E);},$=(R,E,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",E),f.appendChild(k);};$(a,()=>this.open()),o&&(S(true),$(l,()=>this.open({featureRequest:true}),true));for(let R of e.links??[]){let E=R.label?.trim();if(!E)continue;let y=R.href&&(/^https?:\/\//i.test(R.href)||R.href.startsWith("/"))?R.href:void 0;if(S(true),y){let k=document.createElement("a");k.className="mushi-banner-link mushi-banner-extra",k.href=y,k.textContent=E,k.target="_blank",k.rel="noopener noreferrer",f.appendChild(k);}else $(E,()=>{R.featureRequest?this.open({featureRequest:true}):this.open();},true);}S(true),$("\u{1F4EC} My reports",()=>this.openReporter(),true),p.appendChild(f),p.appendChild(w);}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(w);}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=Ar(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 g=this.config.draggable;if(!g)return;let p=8,w=typeof g=="object"?g.axis??"both":"both",d=0,m=0;if(w!=="y"&&(l.key==="ArrowLeft"?d=-p:l.key==="ArrowRight"&&(d=p)),w!=="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=`${Nr(a)}${Br(a)}${Fr(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,g=e.offsetHeight||52,p=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-left")||"0")||0,w=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,f=e.getBoundingClientRect(),S=this.fabPos?.x??0,$=this.fabPos?.y??0,R=f.left-S,E=f.top-$,y=p+c-R,k=a-w-c-l-R,b=d+c-E,_=o-m-c-g-E,W=i==="y"?0:Math.max(y,Math.min(k,r)),z=i==="x"?0:Math.max(b,Math.min(_,n)),A=W;if(s){let G=this.config.draggable;(G===true||typeof G=="object"&&(G.snapToEdge??true))&&i!=="y"&&(A=f.left+l/2<a/2?p+c-R:a-w-c-l-R);}this.fabPos={x:A,y:z},e.style.setProperty("--mushi-drag-x",`${A}px`),e.style.setProperty("--mushi-drag-y",`${z}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=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;},g=6,p=d=>{if(!a)return;let m=d.clientX-r,c=d.clientY-n;!o&&Math.hypot(m,c)>g&&(o=true,e.classList.add("dragging"),e.setAttribute("aria-grabbed","true")),o&&(d.preventDefault(),this.moveFab(e,s+m,i+c,false));},w=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 f=S=>{S.stopImmediatePropagation(),e.removeEventListener("click",f,{capture:true});};e.addEventListener("click",f,{capture:true});}o=false;}};e.addEventListener("pointerdown",l),e.addEventListener("pointermove",p),e.addEventListener("pointerup",w),e.addEventListener("pointercancel",w);}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,screenshotPreview:this.screenshotPreview,screenshotHint:this.resolveScreenshotHint(),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,pageFaviconHref:Cr()}}attachHandlers(e){let r=this.locale;Or(e),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.step==="category"&&(this.showAllCategories=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 g=o?.value??"";o&&(o.value=""),this.sendAssistantMessage(g);}),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=pt,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 g=o.innerHTML,p=()=>{o.innerHTML="Copied \u2713",window.setTimeout(()=>{o.isConnected&&(o.innerHTML=g);},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 g=e.querySelector('[data-role="char-counter"]');g&&(g.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"),g=this.effectiveMinLength();if(o.length<g){if(l){let w=`${r.step3.tooShort} (${o.length}/${g})`;l.textContent=w,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 w=this.selectedCategory,d=this.resolveBaseCategory(w),m=this.config.categories&&this.config.categories.length>0,c=this.callbacks.onSubmit({category:d,...m?{userCategory:w}:{},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(w=>{if(this.step!=="success")return;w&&(this.lastReportId=w.reportId??null,this.lastSubmitQueuedOffline=!!w.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"&&Pr(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 Ye(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 Ur(t){if(typeof globalThis>"u")return;let e={ready:()=>t.getIsMounted(),getStep:()=>t.getRecorderStep(),getTriggerCenter:()=>Ye(t.getRecorderTrigger()),getCategoryCenter:r=>Ye(t.getRecorderCategoryButton(r)),getIntentCenter:r=>Ye(t.getRecorderIntentButton(r)),getSubmitCenter:()=>Ye(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 Kr="mushi_session_min_day_",Ae=[],gt=null,ft=null,ye=null,vt=null,Gr=null,_e=null,xe=false,Pe=null,wt=0,ei=300*1e3,Yr=0,ti=900*1e3;function xt(){return Date.now()<Yr}function St(t){t?.startsWith("HTTP_4")&&(Yr=Date.now()+ti);}var qr=new Set;function bt(t){return `mushi_rewards_consent_${t}`}function ri(t){try{return localStorage.getItem(bt(t))==="1"}catch{return false}}function yt(t,e){try{e?localStorage.setItem(bt(t),"1"):localStorage.removeItem(bt(t)),xe=e;}catch{}}function Xr(){return new Date().toISOString().slice(0,10)}function Jr(t){try{let e=sessionStorage.getItem(`${Kr}${t}_${Xr()}`);return e?parseInt(e,10):0}catch{return 0}}function ni(t){let e=Xr(),r=`${Kr}${t}_${e}`;try{let n=Jr(t)+1;return sessionStorage.setItem(r,String(n)),n}catch{return 99}}function Zr(t){_e=t.client,ye=t.userId,vt=t.traits??null,Gr=t.reporterToken??null;let{projectId:e}=t,r=Math.max(3e4,t.config.flushIntervalMs??3e5);t.config.consentMode==="auto"?(xe=true,yt(e,true)):xe=ri(e),t.config.trackActivity&&oi(e),gt&&clearInterval(gt),gt=setInterval(()=>si(t),r),ft&&clearInterval(ft),ft=setInterval(()=>{if(!xe||!ye)return;let n=Jr(e);n<60&&(ni(e),Te({action:"session_minute",metadata:{minutes_today:n+1}}));},6e4),t.config.showInWidget&&Et(ye).then(n=>{n&&rn(n,t.config);}),t.config.consentMode!=="auto"&&!xe&&ai(e,t.config);}function Qr(t,e){ye=t,vt=e??null,Pe=null,wt=0;}function Te(t){!xe||!ye||Ae.push({...t,queuedAt:Date.now()});}async function si(t){if(!xe||!ye||Ae.length===0)return;let e=null;if(t.config.verifyUserToken)try{e=await t.config.verifyUserToken();}catch{}if(xt())return;let r=Ae.splice(0,100);try{let n=await t.client.submitActivity(ye,r,{userTraits:vt??void 0,reporterTokenHash:Gr??void 0,optedIn:!0,hostJwt:e??void 0});n.ok||(St(n.error?.code),n.error?.code?.startsWith("HTTP_4")||Ae.unshift(...r.slice(0,50)));}catch{Ae.unshift(...r.slice(0,50));}}async function en(t){let e=Date.now();return Pe&&e-wt<ei?Pe:Et(t)}async function Et(t){if(!_e||xt())return null;let e=await _e.getMyTier(t);return e.ok&&e.data?(Pe=e.data,wt=Date.now(),Pe):(St(e.error?.code),null)}async function tn(t=10){if(!_e||xt())return null;try{let e=await _e.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})):(St(e.error?.code),null)}catch{return null}}var jr=null,zr=null,Wr=null,Vr="";function oi(t){let e=()=>{let n=location.pathname;if(n===Vr)return;Vr=n,!qr.has(`${t}:${n}`)&&(qr.add(`${t}:${n}`),Te({action:"screen_view_unique_per_day",metadata:{route:n}}));};Wr=history.pushState.bind(history),history.pushState=function(...n){Wr(...n),e();},window.addEventListener("popstate",e),e(),jr=new MutationObserver(()=>e());let r=document.querySelector("main")??document.body;jr.observe(r,{childList:true,subtree:false}),zr=n=>{let s=n.target.closest("[data-testid]");if(!s)return;let i=s.dataset.testid;i&&Te({action:"element_selected",metadata:{testid:i,route:location.pathname}});},document.addEventListener("click",zr,{capture:true,passive:true});}var we=null;function rn(t,e){if(!e.showInWidget)return;we&&we.remove(),we=document.createElement("div"),we.id="mushi-tier-badge",Object.assign(we.style,{position:"fixed",bottom:"56px",right:"16px",zIndex:"2147483645",fontFamily:"system-ui, sans-serif"});let r=we.attachShadow({mode:"closed"});r.innerHTML=`
2199
+ `,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();}setIdentifiedUser(e){this.identifiedUser=e,this.isOpen&&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",g=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(g)),p.setAttribute("role","banner");let w=document.createElement("button");if(w.className="mushi-banner-dismiss",w.textContent="\u2715",w.setAttribute("aria-label","Dismiss feedback banner"),w.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 f=document.createElement("nav");f.className="mushi-banner-actions",f.setAttribute("aria-label","Feedback banner actions");let S=(R=false)=>{let E=document.createElement("span");E.className=`mushi-banner-divider${R?" mushi-banner-extra":""}`,E.setAttribute("aria-hidden","true"),E.textContent="|",f.appendChild(E);},$=(R,E,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",E),f.appendChild(k);};$(a,()=>this.open()),o&&(S(true),$(l,()=>this.open({featureRequest:true}),true));for(let R of e.links??[]){let E=R.label?.trim();if(!E)continue;let y=R.href&&(/^https?:\/\//i.test(R.href)||R.href.startsWith("/"))?R.href:void 0;if(S(true),y){let k=document.createElement("a");k.className="mushi-banner-link mushi-banner-extra",k.href=y,k.textContent=E,k.target="_blank",k.rel="noopener noreferrer",f.appendChild(k);}else $(E,()=>{R.featureRequest?this.open({featureRequest:true}):this.open();},true);}S(true),$("\u{1F4EC} My reports",()=>this.openReporter(),true),p.appendChild(f),p.appendChild(w);}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(w);}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=Ar(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 g=this.config.draggable;if(!g)return;let p=8,w=typeof g=="object"?g.axis??"both":"both",d=0,m=0;if(w!=="y"&&(l.key==="ArrowLeft"?d=-p:l.key==="ArrowRight"&&(d=p)),w!=="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=`${Nr(a)}${Br(a)}${Fr(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 Y=this.config.draggable;return Y&&typeof Y=="object"?Y.axis??"both":"both"})(),a=window.innerWidth,o=window.innerHeight,l=e.offsetWidth||52,g=e.offsetHeight||52,p=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sai-left")||"0")||0,w=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,f=e.getBoundingClientRect(),S=this.fabPos?.x??0,$=this.fabPos?.y??0,R=f.left-S,E=f.top-$,y=p+c-R,k=a-w-c-l-R,b=d+c-E,_=o-m-c-g-E,V=i==="y"?0:Math.max(y,Math.min(k,r)),W=i==="x"?0:Math.max(b,Math.min(_,n)),A=V;if(s){let Y=this.config.draggable;(Y===true||typeof Y=="object"&&(Y.snapToEdge??true))&&i!=="y"&&(A=f.left+l/2<a/2?p+c-R:a-w-c-l-R);}this.fabPos={x:A,y:W},e.style.setProperty("--mushi-drag-x",`${A}px`),e.style.setProperty("--mushi-drag-y",`${W}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;},g=6,p=d=>{if(!a)return;let m=d.clientX-r,c=d.clientY-n;!o&&Math.hypot(m,c)>g&&(o=true,e.classList.add("dragging"),e.setAttribute("aria-grabbed","true")),o&&(d.preventDefault(),this.moveFab(e,s+m,i+c,false));},w=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 f=S=>{S.stopImmediatePropagation(),e.removeEventListener("click",f,{capture:true});};e.addEventListener("click",f,{capture:true});}o=false;}};e.addEventListener("pointerdown",l),e.addEventListener("pointermove",p),e.addEventListener("pointerup",w),e.addEventListener("pointercancel",w);}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,identifiedUser:this.identifiedUser,testerReputation:this.testerReputation,testerInfo:this.testerInfo,screenshotCapturing:this.screenshotCapturing,screenshotAttached:this.screenshotAttached,screenshotPreview:this.screenshotPreview,screenshotHint:this.resolveScreenshotHint(),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,pageFaviconHref:Cr()}}attachHandlers(e){let r=this.locale;Or(e),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.step==="category"&&(this.showAllCategories=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 g=o?.value??"";o&&(o.value=""),this.sendAssistantMessage(g);}),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=pt,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 g=o.innerHTML,p=()=>{o.innerHTML="Copied \u2713",window.setTimeout(()=>{o.isConnected&&(o.innerHTML=g);},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 g=e.querySelector('[data-role="char-counter"]');g&&(g.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"),g=this.effectiveMinLength();if(o.length<g){if(l){let w=`${r.step3.tooShort} (${o.length}/${g})`;l.textContent=w,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 w=this.selectedCategory,d=this.resolveBaseCategory(w),m=this.config.categories&&this.config.categories.length>0,c=this.callbacks.onSubmit({category:d,...m?{userCategory:w}:{},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(w=>{if(this.step!=="success")return;w&&(this.lastReportId=w.reportId??null,this.lastSubmitQueuedOffline=!!w.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"&&Pr(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 Ye(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 Ur(t){if(typeof globalThis>"u")return;let e={ready:()=>t.getIsMounted(),getStep:()=>t.getRecorderStep(),getTriggerCenter:()=>Ye(t.getRecorderTrigger()),getCategoryCenter:r=>Ye(t.getRecorderCategoryButton(r)),getIntentCenter:r=>Ye(t.getRecorderIntentButton(r)),getSubmitCenter:()=>Ye(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 Kr="mushi_session_min_day_",Ae=[],gt=null,ft=null,ye=null,vt=null,Gr=null,_e=null,xe=false,Pe=null,wt=0,ei=300*1e3,Yr=0,ti=900*1e3;function xt(){return Date.now()<Yr}function St(t){t?.startsWith("HTTP_4")&&(Yr=Date.now()+ti);}var qr=new Set;function bt(t){return `mushi_rewards_consent_${t}`}function ri(t){try{return localStorage.getItem(bt(t))==="1"}catch{return false}}function yt(t,e){try{e?localStorage.setItem(bt(t),"1"):localStorage.removeItem(bt(t)),xe=e;}catch{}}function Xr(){return new Date().toISOString().slice(0,10)}function Jr(t){try{let e=sessionStorage.getItem(`${Kr}${t}_${Xr()}`);return e?parseInt(e,10):0}catch{return 0}}function ni(t){let e=Xr(),r=`${Kr}${t}_${e}`;try{let n=Jr(t)+1;return sessionStorage.setItem(r,String(n)),n}catch{return 99}}function Zr(t){_e=t.client,ye=t.userId,vt=t.traits??null,Gr=t.reporterToken??null;let{projectId:e}=t,r=Math.max(3e4,t.config.flushIntervalMs??3e5);t.config.consentMode==="auto"?(xe=true,yt(e,true)):xe=ri(e),t.config.trackActivity&&oi(e),gt&&clearInterval(gt),gt=setInterval(()=>si(t),r),ft&&clearInterval(ft),ft=setInterval(()=>{if(!xe||!ye)return;let n=Jr(e);n<60&&(ni(e),Te({action:"session_minute",metadata:{minutes_today:n+1}}));},6e4),t.config.showInWidget&&Et(ye).then(n=>{n&&rn(n,t.config);}),t.config.consentMode!=="auto"&&!xe&&ai(e,t.config);}function Qr(t,e){ye=t,vt=e??null,Pe=null,wt=0;}function Te(t){!xe||!ye||Ae.push({...t,queuedAt:Date.now()});}async function si(t){if(!xe||!ye||Ae.length===0)return;let e=null;if(t.config.verifyUserToken)try{e=await t.config.verifyUserToken();}catch{}if(xt())return;let r=Ae.splice(0,100);try{let n=await t.client.submitActivity(ye,r,{userTraits:vt??void 0,reporterTokenHash:Gr??void 0,optedIn:!0,hostJwt:e??void 0});n.ok||(St(n.error?.code),n.error?.code?.startsWith("HTTP_4")||Ae.unshift(...r.slice(0,50)));}catch{Ae.unshift(...r.slice(0,50));}}async function en(t){let e=Date.now();return Pe&&e-wt<ei?Pe:Et(t)}async function Et(t){if(!_e||xt())return null;let e=await _e.getMyTier(t);return e.ok&&e.data?(Pe=e.data,wt=Date.now(),Pe):(St(e.error?.code),null)}async function tn(t=10){if(!_e||xt())return null;try{let e=await _e.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})):(St(e.error?.code),null)}catch{return null}}var jr=null,zr=null,Wr=null,Vr="";function oi(t){let e=()=>{let n=location.pathname;if(n===Vr)return;Vr=n,!qr.has(`${t}:${n}`)&&(qr.add(`${t}:${n}`),Te({action:"screen_view_unique_per_day",metadata:{route:n}}));};Wr=history.pushState.bind(history),history.pushState=function(...n){Wr(...n),e();},window.addEventListener("popstate",e),e(),jr=new MutationObserver(()=>e());let r=document.querySelector("main")??document.body;jr.observe(r,{childList:true,subtree:false}),zr=n=>{let s=n.target.closest("[data-testid]");if(!s)return;let i=s.dataset.testid;i&&Te({action:"element_selected",metadata:{testid:i,route:location.pathname}});},document.addEventListener("click",zr,{capture:true,passive:true});}var we=null;function rn(t,e){if(!e.showInWidget)return;we&&we.remove(),we=document.createElement("div"),we.id="mushi-tier-badge",Object.assign(we.style,{position:"fixed",bottom:"56px",right:"16px",zIndex:"2147483645",fontFamily:"system-ui, sans-serif"});let r=we.attachShadow({mode:"closed"});r.innerHTML=`
2189
2200
  <style>
2190
2201
  :host { display: block; }
2191
2202
  .badge {
@@ -2267,6 +2278,6 @@
2267
2278
  border-radius: 4px;
2268
2279
  transition: all 0.1s ease;
2269
2280
  display: none;
2270
- `,document.body.appendChild(c),c}function o(c){if(!e)return;let f=c.getBoundingClientRect();e.style.left=`${f.left}px`,e.style.top=`${f.top}px`,e.style.width=`${f.width}px`,e.style.height=`${f.height}px`,e.style.display="block";}function l(c){let f=c.target;f!==e&&o(f);}function g(c){c.preventDefault(),c.stopPropagation();let f=c.target;if(f===e||(c.composedPath?c.composedPath():[]).some(E=>E instanceof Element&&E.id==="mushi-mushi-widget"))return;let R=i(f);w(R);}function p(c){c.key==="Escape"&&w(null);}function w(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",g,true),document.addEventListener("keydown",p,true);})}function m(){t&&(t=false,document.body.style.cursor="",document.removeEventListener("mousemove",l,true),document.removeEventListener("click",g,true),document.removeEventListener("keydown",p,true),e&&(e.remove(),e=null));}return {activate:d,deactivate:m,isActive:()=>t}}function At(){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 g=l.target instanceof Element?l.target:null;if(!g)return;let p=g.closest('button,a,[role="button"],input,textarea,select,[data-mushi-track]')??g;i({ts:Date.now(),kind:"click",payload:{tag:p.tagName.toLowerCase(),id:p.id||void 0,text:Si(p)}});}return history.pushState=function(...g){let p=e.apply(this,g);return a("pushState"),p},history.replaceState=function(...g){let p=r.apply(this,g);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,w)=>p.ts-w.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 Si(t){let e=(t.textContent??"").replace(/\s+/g," ").trim();return e?e.slice(0,80):void 0}var Ei=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ki=/^[0-9a-f]{20,}$/i,Ri=/^\d+$/,Ci=/^[a-z0-9]{16,}$/i;function an(t){return t.length===0?t:Ei.test(t)||ki.test(t)||Ri.test(t)||Ci.test(t)&&/\d/.test(t)?"[id]":t}function ln(t,e){let r=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;if(e?.length){let n=Ti(r,e);if(n)return n}return "/"+r.split("/").filter(n=>n.length>0).map(an).join("/")}function Ti(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],g=r[o];if(!(l.startsWith("[")&&l.endsWith("]"))&&!l.startsWith(":")&&l!==g){a=false;break}}if(a)return "/"+i.join("/")}return null}function Mi(){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 $i(){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 Li(){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 Ii(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 _t(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",g=new Map,p=null,w=null;async function d(){if(typeof window>"u")return;let y=ln(window.location.pathname,e.routeTemplates),k=Date.now(),b=g.get(y)??0;if(k-b<a)return;g.set(y,k);let _=null;l==="auto"?_=n()??s():l==="session-only"&&(_=s());let W={route:y,page_title:typeof document<"u"&&(document.title||"").slice(0,300)||null,dom_summary:o?Li():null,testids:Mi(),network_paths:r().slice(-50),query_param_keys:$i(),user_id_hash:await Ii(_),observed_at:new Date().toISOString()};i(W);}function m(){w||(w=setTimeout(()=>{w=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 f=window.history.pushState.bind(window.history),S=window.history.replaceState.bind(window.history),$=function(...k){let b=f(...k);return c(),b},R=function(...k){let b=S(...k);return c(),b};window.history.pushState=$,window.history.replaceState=R;let E=()=>c();return window.addEventListener("popstate",E),m(),{destroy(){window.removeEventListener("popstate",E),window.history.pushState===$&&(window.history.pushState=f),window.history.replaceState===R&&(window.history.replaceState=S),w&&(clearTimeout(w),w=null),g.clear();},flushNow(){g.clear(),d();}}}function cn(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 g=n(t[l]);if(typeof g=="number"&&g>=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 Ai(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 Qe=null;async function _i(){if(Qe)return Qe;try{return Qe=await import('rrweb'),Qe}catch{return null}}async function un(t){let e=t.maxDurationMs??3e4,r=await _i();if(!r?.record)return Ai(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(g){s.push(g),cn(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 cn(s,e,400),[...s]},destroy(){l(),s.length=0;}}}function dn(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),g=Math.round(s.width*l),p=Math.round(s.height*l);for(let k of [a,o])k.width=g,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 w=a.getContext("2d"),d=o.getContext("2d");if(!w||!d){n(new Error("Canvas not supported"));return}w.drawImage(s,0,0,g,p),i.appendChild(a),i.appendChild(o),e.appendChild(i);let m="highlight",c=false,f=null,S=[],$=k=>{let b=o.getBoundingClientRect(),_="touches"in k?k.touches[0]??k.changedTouches[0]:null,W=_?_.clientX:k.clientX,z=_?_.clientY:k.clientY;return {x:(W-b.left)/b.width*g,y:(z-b.top)/b.height*p}},R=()=>{d.clearRect(0,0,g,p);for(let k of S)if(k.tool==="highlight"&&k.points.length>=2){let[b,_]=k.points;d.fillStyle="rgba(255, 230, 0, 0.35)",d.fillRect(Math.min(b.x,_.x),Math.min(b.y,_.y),Math.abs(_.x-b.x),Math.abs(_.y-b.y));}else if(k.tool==="arrow"&&k.points.length>=2){let[b,_]=k.points;d.strokeStyle="#ef4444",d.lineWidth=3,d.beginPath(),d.moveTo(b.x,b.y),d.lineTo(_.x,_.y),d.stroke();}},E=k=>{c=true,f=$(k);},y=k=>{if(!c||!f)return;c=false;let b=$(k);if(m==="blur"){let _=Math.min(f.x,b.x),W=Math.min(f.y,b.y),z=Math.abs(b.x-f.x),A=Math.abs(b.y-f.y);z>=1&&A>=1&&(w.filter="blur(8px)",w.drawImage(a,_,W,z,A,_,W,z,A),w.filter="none");}else S.push({tool:m,points:[f,b]});f=null,R();};o.addEventListener("mousedown",E),o.addEventListener("mouseup",y),o.addEventListener("touchstart",E,{passive:true}),o.addEventListener("touchend",y),r({canvas:a,setTool(k){m=k;},getDataUrl(){let k=document.createElement("canvas");k.width=g,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",E),o.removeEventListener("mouseup",y),o.removeEventListener("touchstart",E),o.removeEventListener("touchend",y),i.remove();}});},s.onerror=()=>n(new Error("Failed to load screenshot")),s.src=t;})}function pn(){try{let t=globalThis;return t.Sentry?t.Sentry:void 0}catch{return}}function Pi(){try{return globalThis.__SENTRY_REPLAY__}catch{return}}function Di(){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 Pt(t,e={}){let r=Math.max(0,e.breadcrumbsLimit??30),n={},s=pn();if(!s)return n;n.sdk=Di();try{let o=s;if(typeof o.lastEventId=="function")n.eventId=o.lastEventId()??void 0;else {let g=s.getCurrentHub?.()?.getScope?.();n.eventId=g?.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[g,p]of Object.entries(o))(typeof p=="string"||typeof p=="number"||typeof p=="boolean")&&(l[g]=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(g=>{let p=g;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 g=l.spanContext?.();n.traceId=g?.traceId??l.traceId??void 0,n.spanId=g?.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?.()??Pi();n.replayId=l?.getReplayId?.()??void 0;}catch{}return n}function Dt(t,e={}){let r=pn();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 Oi=["/login","/logout","/signup","/sso/*","/auth/*"];function mn(t,e={}){let r=[];if(e.rageClick!==false){let f=function(S){let $=Date.now();if(S.target===c){if(m.push($),m=m.filter(R=>$-R<500),m.length>=3){let R=S.target;t.onTrigger("rage_click",{element:R.tagName,id:R.id,text:R.textContent?.slice(0,50)}),m=[];}}else c=S.target,m=[$];};let m=[],c=null;document.addEventListener("click",f,true),r.push(()=>document.removeEventListener("click",f,true));}if(e.longTask!==false&&typeof PerformanceObserver<"u")try{let m=new PerformanceObserver(c=>{for(let f of c.getEntries())f.duration>5e3&&t.onTrigger("long_task",{duration:Math.round(f.duration),startTime:Math.round(f.startTime)});});m.observe({entryTypes:["longtask"]}),r.push(()=>m.disconnect());}catch{}let n=Hi(e.apiCascade);if(n.enabled){let m=[],c=globalThis.fetch;globalThis.fetch=async function(...f){let[S,$]=f,R=Xe(S),E=!!Je(S,$)||Ze(R,{apiEndpoint:e.apiEndpoint,ignoreUrls:n.ignoreUrls});try{let y=await c.apply(this,f);return !E&&!y.ok&&y.status>=400&&hn(m,t),y}catch(y){throw E||hn(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(A){return f.some(K=>K.endsWith("/*")?A.startsWith(K.slice(0,-2)):A===K||A.startsWith(K+"/"))},E=function(){let A=window.location?.pathname??"";R(A)||t.onTrigger("page_dwell",{thresholdMs:c,path:A});},y=function(){S&&clearTimeout(S);let A=window.location?.pathname??"";R(A)||(S=setTimeout(E,c));},k=function(){let A=window.location?.pathname??"";A!==$&&($=A,y());};let m=typeof e.pageDwell=="object"?e.pageDwell??{}:{},c=m.thresholdMs||300*1e3,f=m.excludeRoutes!==void 0?m.excludeRoutes:Oi,S=null,$=window.location?.pathname??"";y();let b=window.history,_=b?.pushState,W=b?.replaceState;b&&_&&W&&(b.pushState=function(...A){let K=_.apply(this,A);return k(),K},b.replaceState=function(...A){let K=W.apply(this,A);return k(),K});let z=()=>k();window.addEventListener("popstate",z),r.push(()=>{S&&clearTimeout(S),window.removeEventListener("popstate",z),b&&_&&(b.pushState=_),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,f=m.storageKey??(e.projectId?`mushi:${e.projectId}:firstSessionShown`:"mushi:firstSessionShown"),S=false;try{S=window.localStorage?.getItem(f)==="1";}catch{}if(!S){let $=setTimeout(()=>{try{window.localStorage?.setItem(f,"1");}catch{}t.onTrigger("first_session",{delayMs:c});},c);r.push(()=>clearTimeout($));}}if(e.errorBoundary){let m=function(f){t.onTrigger("error_boundary",{message:f.message,filename:f.filename,lineno:f.lineno,colno:f.colno});},c=function(f){t.onTrigger("error_boundary",{message:f.reason instanceof Error?f.reason.message:String(f.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 Hi(t){return t===false?{enabled:false,ignoreUrls:[]}:t&&typeof t=="object"?{enabled:t.enabled!==false,ignoreUrls:t.ignoreUrls??[]}:{enabled:true,ignoreUrls:[]}}function hn(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 gn="mushi:lastDismiss",et="mushi:consecDismiss",Ot="mushi:lastShown";function tt(t){try{return localStorage.getItem(t)}catch{return null}}function rt(t,e){try{localStorage.setItem(t,e);}catch{}}function fn(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(w){let d=Date.now();if(parseInt(tt(et)??"0",10)>=n)return false;let c=tt(gn);if(c&&d-parseInt(c,10)<r*60*60*1e3)return false;if(s>0&&i===0){let f=tt(Ot);if(f&&d-parseInt(f,10)<s)return false}return i>=e||a.has(w)?false:(a.add(w),i++,rt(Ot,String(d)),true)}function l(){rt(gn,String(Date.now()));let w=parseInt(tt(et)??"0",10);rt(et,String(w+1));}function g(){rt(et,"0");}function p(){i=0,a.clear();try{localStorage.removeItem(Ot);}catch{}}return {shouldShow:o,recordDismissal:l,recordSubmission:g,reset:p}}var he=null,nt=class{constructor(){}static init(e){if(he)return qe({scope:"mushi",level:"warn",format:"pretty"}).warn("Already initialized \u2014 call destroy() first to reinitialize"),he;let r={...ar(),...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?Ji():(he=Bi(r),he)}static getInstance(){return he}static destroy(){he?.destroy(),he=null;}static diagnose(){return he?.diagnose()??vn()}};function Bi(t){let e=Fi(t),r=e,n=t.debug??false?qe({scope:"mushi",level:"debug",format:"pretty"}):lt,s=null,i=null,a=or({projectId:e.projectId,apiKey:e.apiKey,...e.apiEndpoint?{apiEndpoint:e.apiEndpoint}:{},getUserToken:()=>s,sdkPackage:be,sdkVersion:te}),o=lr(e.preFilter),l=hr(e.offline),g=gr({maxBurst:10,refillRate:1,refillIntervalMs:5e3}),p=fr();function w(u){return u.map(h=>{let x={...h};if(typeof h.message=="string"&&(x.message=p.scrub(h.message)),h.data&&typeof h.data=="object"){let L={};for(let[I,O]of Object.entries(h.data))L[I]=typeof O=="string"?p.scrub(O):O;x.data=L;}return x})}function d(u){if(!u)return;let h={};for(let[x,L]of Object.entries(u))h[x]=typeof L=="string"?p.scrub(L):L;return h}let m=null,c=null,f=null,S=null,$=null,R=null,E=At(),y=null,k=0,b,_=`mushi:tester-jwt:${e.projectId}`;function W(){try{return typeof localStorage<"u"?localStorage.getItem(_):null}catch{return null}}function A(){try{typeof localStorage<"u"&&localStorage.removeItem(_);}catch{}}async function K(u){let h=await a.getTesterStatus(u);if(!h.ok||!h.data){A();return}let x=h.data;if(!x.is_tester||!x.tester_id){A();return}b.setTesterSession(u,{id:x.tester_id,public_handle:x.public_handle??null,display_name:x.display_name??null});let L=await a.getMyReputation(u);if(L.ok&&L.data){let I=L.data;I.reputation&&b.setTesterReputation(I.reputation);}}function Se(){if(r.capture?.console!==false?m??=kt():(m?.destroy(),m=null),r.capture?.network!==false){let I={apiEndpoint:Ht(r),ignoreUrls:r.capture?.ignoreUrls,tracePropagation:r.capture?.tracePropagation,sessionId:Le()};c?c.updateOptions(I):c=Ct(I);}else c?.destroy(),c=null;if(r.capture?.performance!==false?f??=Lt():(f?.destroy(),f=null),r.capture?.screenshot!=="off"){let I={privacy:r.privacy};S?S.updateOptions(I):S=$t(I);}else S=null;S||(U=null),b.setAllowScreenshotRemove(r.privacy?.allowUserRemoveScreenshot!==false),r.capture?.elementSelector!==false?$??=It():($?.deactivate(),$=null,de=null);let u=r.capture?.discoverInventory,h=u===true?{}:u&&typeof u=="object"?u:null;h!=null&&h.enabled!==false?(R?.destroy(),R=_t({config:h,getRecentNetworkPaths:()=>c?c.getEntries().map(I=>{try{let O=new URL(I.url,typeof window<"u"?window.location.href:"http://localhost");return O.host&&typeof window<"u"&&O.host!==window.location.host?null:O.pathname}catch{return null}}).filter(I=>I!=null&&I.length>0&&I.length<200):[],getUserId:()=>Y?.id??null,getSessionId:Le,onEvent:I=>{a.postDiscoveryEvent({...I,sdk_version:te}).catch(O=>{n.debug("discovery emit failed",{err:String(O)});});}})):(R?.destroy(),R=null);let L=r.capture?.replay??"off";if(L==="rrweb"||L==="lite"){let I=++k;un({redactSelectors:r.privacy?.redactSelectors}).then(O=>{if(I!==k){O.destroy();return}y?.destroy(),y=O,y.start();});}else k++,y?.destroy(),y=null;}let G=new Map;function V(u,h){G.get(u)?.forEach(x=>x({type:u,data:h}));}let U=null,de=null,me=null,De=false,Y=null,M={},C={},T=br({max:50});T.add({category:"lifecycle",level:"info",message:"Mushi SDK init",data:{projectId:e.projectId,sdkVersion:te}});let H=null;H=Zi(T);let D=false;async function ae(){if(!S||D)return null;D=true;let u=b.getIsOpen();u&&b.hidePanel();let h=document.getElementById("mushi-mushi-widget"),x=h?.style.visibility??"";h&&(h.style.visibility="hidden"),await new Promise(L=>{requestAnimationFrame(()=>requestAnimationFrame(()=>L()));});try{return await S.take()}finally{D=false,h&&(h.style.visibility=x),u&&b.showPanel();}}async function Me(u){let h=r.capture?.screenshot;!S||h==="off"||U||u==="open"&&h!=="auto"||u==="submit"&&h!=="on-report"&&h!=="auto"||(n.debug("Auto-capturing screenshot",{when:u,mode:h}),U=await ae(),b.setScreenshotAttached(U!==null),b.setScreenshotPreview(U));}b=new Ge(e.widget,{onSubmit:async({category:u,userCategory:h,description:x,intent:L})=>(n.info("Report submitted",{category:u,userCategory:h,intent:L}),J?.recordSubmission(),await Me("submit"),await ke(u,x,L,h)??{reportId:null,queuedOffline:true}),onOpen:()=>{n.debug("Widget opened"),Me("open"),y?.start(),V("widget:opened");},onClose:()=>{n.debug("Widget closed"),me&&(J?.recordDismissal(),V("proactive:dismissed",{type:me})),U=null,de=null,me=null,V("widget:closed");},onScreenshotRequest:async()=>{!S||r.capture?.screenshot==="off"||(n.debug("Taking screenshot"),U=await ae(),b.setScreenshotAttached(U!==null),b.setScreenshotPreview(U));},onScreenshotRemove:()=>{n.debug("Screenshot attachment removed"),U=null,b.setScreenshotAttached(false);},onScreenshotAnnotateRequest:async u=>{if(!U||u.childElementCount>0)return;let h;try{h=await dn(U,u);}catch(Z){n.warn("Screenshot annotation failed",{error:Z instanceof Error?Z.message:String(Z)});return}let x=document.createElement("div");x.className="mushi-annotate-toolbar";let L=Z=>{(U=h.getDataUrl(),b.setScreenshotAttached(true),b.setScreenshotPreview(U)),h.destroy(),x.remove();},I=[{id:"highlight",label:"\u270F\uFE0F Highlight"},{id:"blur",label:"\u{1F512} Blur"},{id:"arrow",label:"\u2197\uFE0F Arrow"}];for(let Z of I){let N=document.createElement("button");N.type="button",N.className="mushi-attach-btn",N.dataset.tool=Z.id,N.textContent=Z.label,N.addEventListener("click",()=>{h.setTool(Z.id),x.querySelectorAll("button[data-tool]").forEach(le=>le.classList.remove("active")),N.classList.add("active");}),x.appendChild(N);}x.querySelector('button[data-tool="highlight"]')?.classList.add("active");let O=document.createElement("button");O.type="button",O.className="mushi-attach-btn",O.textContent="\u2713 Done",O.addEventListener("click",()=>L()),x.appendChild(O),u.insertBefore(x,u.firstChild);},onElementSelectorRequest:async()=>{if(!(!$||r.capture?.elementSelector===false)){n.debug("Element selector activated"),b.setElementCapturing(true),b.hidePanel();try{let u=await $.activate();u?(de=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 x=await a.replyToReporterReport(u,X(),h);if(!x.ok)throw new Error(x.error?.message??"Could not send reply")},async onReporterFeedback(u,h,x){let L=await a.replyToReporterReport(u,X(),x??"",h);if(!L.ok)throw new Error(L.error?.message??"Could not send feedback");return L.data?.feedback??null},async onReporterReopen(u,h){let x=await a.reopenReporterReport(u,X(),h);if(!x.ok)throw new Error(x.error?.message??"Could not reopen report");return x.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),tn(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(I=>({tester_id:I.tester_id,rank:I.rank,public_handle:I.public_handle,display_name:I.display_name,points_30d:I.points_30d,total_points:I.total_points??0,badge:I.badge_slug}));if(b.setGlobalLeaderboard(L,!1),u){let I=await a.getMyReputation(u);if(I.ok&&I.data){let O=I.data;O.reputation&&b.setTesterReputation(O.reputation);}}}catch{b.setGlobalLeaderboard([],false);}},async onCrossAppReportsOpen(){let u=W();if(!u){b.setCrossAppReports([],false);return}try{let h=await a.getCrossAppReports(u),x=h.ok?h.data?.reports??[]:[];b.setCrossAppReports(x,!1);}catch{b.setCrossAppReports([],false);}},onTesterSignOut(){A();},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 x=await a.askAssistant({message:u,threadId:h,context:i});return x.ok?x.data??null:null}},te),Se(),typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>b.mount()):b.mount());let Ee=W();Ee&&K(Ee).catch(()=>A());let ne=null,J=null,P=r.proactive;P&&(P.rageClick!==false||P.longTask!==false||P.apiCascade!==false||P.errorBoundary===true||P.pageDwell||P.firstSession)&&typeof document<"u"&&(J=fn(P?.cooldown),ne=mn({onTrigger:(u,h)=>{if(!J.shouldShow(u)){n.debug("Proactive trigger suppressed by fatigue prevention",{type:u});return}n.info("Proactive trigger fired",{type:u,context:h}),me=u,V("proactive:triggered",{type:u,context:h}),u==="first_session"?b.pulseTrigger?.():b.open();}},{rageClick:P?.rageClick,longTask:P?.longTask,apiCascade:P?.apiCascade,apiEndpoint:Ht(r),errorBoundary:P?.errorBoundary,pageDwell:P?.pageDwell,firstSession:P?.firstSession,projectId:e.projectId}),n.debug("Proactive triggers enabled",{rageClick:P?.rageClick!==false,longTask:P?.longTask!==false,apiCascade:P?.apiCascade!==false,errorBoundary:P?.errorBoundary===true,pageDwell:!!P?.pageDwell,firstSession:!!P?.firstSession})),l.startAutoSync(a),l.flush(a).then(u=>{u.sent>0&&n.info("Synced offline reports",{sent:u.sent});});function B(u){if(De=true,u.enabled===false){r=e,Ki(t.projectId),Se(),b.updateConfig(r.widget),n.debug("Runtime SDK config disabled; using bootstrap config",{version:u.version});return}r=Ni(r,u),Se(),u.widget&&b.updateConfig(r.widget),n.debug("Applied runtime SDK config",{version:u.version});}if(qi(t)){let u=Wi(t.projectId);u&&B(u),a.getSdkConfig().then(h=>{h.ok&&h.data?(Vi(t.projectId,h.data),B(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");Oe(),n.info("Initialized",{projectId:t.projectId});async function Oe(){if(r.widget?.outdatedBanner==="off")return;let u=Gi(be);u&&He(u);let h=await a.getLatestSdkVersion(be);!h.ok||!h.data||(Yi(be,h.data),He(h.data));}function He(u){let h=u.latest,x=!!(h&&Xi(te,h));if(!x&&!u.deprecated)return;let L=u.deprecationMessage??(x?`Update ${be} to ${h}.`:null);n.warn("Mushi SDK is outdated",{package:be,current:te,latest:h,deprecated:u.deprecated,message:L}),r.widget?.outdatedBanner!=="console-only"&&b.setSdkFreshness({latest:h,current:te,deprecated:u.deprecated,message:L});}async function ke(u,h,x,L){let I=o.check(h);if(!I.passed){n.info("Report blocked by pre-filter",{reason:I.reason});return}let O=t.preFilter?.wasmClassifier;if(O)try{let j=await O.classify({description:h,category:u,url:typeof location<"u"?location.href:void 0,hasScreenshot:U!==null,hasSelectedElement:de!==null,hasNetworkErrors:c?.getEntries()?.some(se=>se.status>=400||!!se.error)??!1,hasConsoleErrors:m?.getEntries()?.some(se=>se.level==="error")??!1,proactiveTrigger:me??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(!g.tryConsume()){n.warn("Report throttled \u2014 rate limit exceeded");return}let Z=p.scrub(o.truncate(h)),N=t.sentry?Pt(t.sentry):void 0,le=await mr().catch(()=>null),Nt=r.capture?.console===false?void 0:m?.getEntries(),Ft=r.capture?.network===false?void 0:c?.getEntries(),Ut=w(T.getAll()),qt=d(Object.keys(C).length>0?{...C}:void 0),jt=N?{...N,...N.breadcrumbs?{breadcrumbs:w(N.breadcrumbs)}:{},...N.tags?{tags:d(N.tags)}:{}}:void 0,zt=U?await Mr(U).catch(()=>null):null;U&&!zt&&n.warn("Screenshot dropped \u2014 could not compress under wire budget");let ce={id:ut(),projectId:t.projectId,category:u,...L?{userCategory:L}:{},description:Z,userIntent:x,environment:ct(),consoleLogs:Nt,networkLogs:Ft,performanceMetrics:r.capture?.performance===false?void 0:f?.getMetrics(),timeline:E.getEntries({consoleLogs:Nt,networkLogs:Ft}),screenshotDataUrl:zt??void 0,selectedElement:de??void 0,...y?{replayEvents:y.flush()}:{},metadata:{...M,...Y?{user:Y}:{},...N?.release?{sentryRelease:N.release}:{}},sessionId:Le(),reporterToken:X(),...le?{fingerprintHash:le}:{},appVersion:t.integrations?.vercel?.analyticsId,sdkPackage:be,sdkVersion:te,proactiveTrigger:me??void 0,...Ut.length>0?{breadcrumbs:Ut}:{},...qt?{tags:qt}:{},...jt?{sentryContext:jt}:{},sentryEventId:N?.eventId,sentryReplayId:N?.replayId,createdAt:new Date().toISOString()};if(T.add({category:"lifecycle",level:"info",message:`Mushi report submitting (${u})`,data:{reportId:ce.id,category:u}}),t.integrations?.custom){let j={addMetadata(se,xn){ce.metadata[se]=xn;},setCategory(se){ce.category=se;},setDescription(se){ce.description=se;}};t.integrations.custom(j);}let F=ce;if(t.beforeSendFeedback)try{let j=await Promise.race([Promise.resolve(t.beforeSendFeedback(ce)),new Promise(se=>setTimeout(()=>se(ce),2e3))]);if(j===null){n.info("Report dropped by beforeSendFeedback hook",{reportId:ce.id});return}F=j;}catch(j){n.warn("beforeSendFeedback hook threw \u2014 sending unmodified report",{error:j instanceof Error?j.message:String(j)});}if(V("report:submitted",{reportId:F.id}),typeof navigator<"u"&&!navigator.onLine)return await l.enqueue(F),n.info("Offline \u2014 report queued",{reportId:F.id}),V("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}),V("report:sent",{reportId:q.data?.reportId}),q.data?.cursorAgentId){let j=q.data;V("report:dispatched",{reportId:j.reportId,agentId:j.cursorAgentId,fixId:j.fixId});}T.add({category:"lifecycle",level:"info",message:`Mushi report sent (${q.data?.reportId??ce.id})`}),Te({action:"report_submit",metadata:{category:u,reportId:q.data?.reportId??ce.id}});try{t.sentry&&q.data?.reportId&&Dt(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}),V("report:failed",{reportId:F.id,error:q.error}),T.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),V("report:failed",{reportId:F.id,error:q.error}),T.add({category:"lifecycle",level:"warning",message:`Mushi report queued for retry (${F.id})`}));return U=null,de=null,me=null,q?.ok?{reportId:q.data?.reportId??ce.id,queuedOffline:false}:{reportId:null,queuedOffline:true}}let it={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){Y=u;},setMetadata(u,h){M[u]=h;},setScreen(u){E.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){B(u);},diagnose(){return ji({apiEndpoint:Ht(r),widgetMounted:b.getIsMounted(),runtimeConfigLoaded:De,captureScreenshotAvailable:S!==null,captureNetworkIntercepting:c!==null,widgetDiagnostics:b.getWidgetDiagnostics()})},destroy(){ne?.destroy(),J?.reset(),b.destroy(),m?.destroy(),c?.destroy(),f?.destroy(),$?.deactivate(),E.destroy(),R?.destroy(),R=null,y?.destroy(),y=null,l.stopAutoSync(),H?.(),H=null,T.clear(),G.clear(),he=null,n.debug("Destroyed");},async captureEvent(u){if(!g.tryConsume())return n.warn("captureEvent throttled \u2014 rate limit exceeded"),null;let h=p.scrub(o.truncate(u.description)),x=u.category??"bug",L=t.sentry?Pt(t.sentry):void 0,I=w(T.getAll()),O=d(Object.keys(C).length===0&&!u.tags?void 0:{...C,...u.tags??{}}),Z=L?{...L,...L.breadcrumbs?{breadcrumbs:w(L.breadcrumbs)}:{},...L.tags?{tags:d(L.tags)}:{}}:void 0,N={id:ut(),projectId:t.projectId,category:x,description:h,environment:ct(),timeline:E.getEntries(),metadata:{...u.metadata??{},...Y?{user:Y}:{},...u.error?{error:u.error}:{},...u.severity?{severity:u.severity}:{},...u.component?{component:u.component}:{},...u.source?{source:u.source}:{source:"captureEvent"}},...I.length>0?{breadcrumbs:I}:{},...O&&Object.keys(O).length>0?{tags:O}:{},...Z?{sentryContext:Z}:{},sessionId:Le(),reporterToken:X(),sdkPackage:be,sdkVersion:te,sentryEventId:L?.eventId,sentryReplayId:L?.replayId,createdAt:new Date().toISOString()};if(V("report:submitted",{reportId:N.id}),typeof navigator<"u"&&!navigator.onLine)return await l.enqueue(N),V("report:queued",{reportId:N.id}),null;let le=await a.submitReport(N);if(le.ok){V("report:sent",{reportId:le.data?.reportId});try{t.sentry&&le.data?.reportId&&Dt(le.data.reportId);}catch{}return le.data?.reportId??null}return await l.enqueue(N),V("report:failed",{reportId:N.id,error:le.error}),null},async captureException(u,h){let x=yr(u);T.add({category:"lifecycle",level:"error",message:`Mushi.captureException(${x.name}): ${x.message}`,...x.stack?{data:{stack:x.stack.slice(0,500)}}:{}});let L=h?.description?.trim()||`${x.name}: ${x.message}`||"Uncaught exception";return it.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:x.name,message:x.message,...x.stack?{stack:x.stack}:{}},metadata:{...h?.metadata??{},...x.cause?{cause:x.cause}:{}}})},identify(u,h){if(Y={id:u,...h?.email?{email:h.email}:{},...h?.name?{name:h.name}:{}},h)for(let[x,L]of Object.entries(h))x!=="email"&&x!=="name"&&(M[`user.${x}`]=L);if(T.add({category:"lifecycle",level:"info",message:`Mushi.identify(${u})`}),r.rewards?.enabled){let x={client:a,config:r.rewards,projectId:e.projectId,userId:u,traits:h?{email:h.email,name:h.name,provider:h.provider}:void 0};Y.id===u?Zr(x):Qr(u,x.traits),r.rewards.showInWidget!==false&&a.getMyPoints(u).then(L=>{if(!L.ok)return;let I=L.data;b.setRewardsState({tier:I.tier?{slug:I.tier.slug??"free",displayName:I.tier.display_name??"Free",pointsThreshold:I.tier.points_threshold??0}:null,nextTier:I.next_tier?{displayName:I.next_tier.display_name??"",pointsThreshold:I.next_tier.points_threshold??0}:null,totalPoints:I.total_points??0,pointsForReport:I.report_submit_pts??50});}).catch(()=>{});}},identifyWithToken(u){if(s=u&&typeof u=="string"?u:null,s){let h=vr(s);h?.sub&&(Y={id:h.sub,...h.email?{email:h.email}:{},...h.name?{name:h.name}:{}}),T.add({category:"lifecycle",level:"info",message:"Mushi.identifyWithToken()"});}else T.add({category:"lifecycle",level:"info",message:"Mushi.identifyWithToken(null)"});},publishPageContext(u){i=u&&u.route?u:null;},openAssistant(){b.openAssistantTab();},addBreadcrumb(u){T.add(u);},getBreadcrumbs(){return T.getAll()},setTag(u,h){typeof u!="string"||u.length===0||(C[u]=h);},setTags(u){if(!(!u||typeof u!="object"))for(let[h,x]of Object.entries(u))typeof h=="string"&&h.length>0&&(C[h]=x);},clearTag(u){if(typeof u=="string"&&u.length>0){delete C[u];return}for(let h of Object.keys(C))delete C[h];},async getReputation(){if(!Y?.id)return null;let u=await a.getMyPoints(Y.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 Y?.id?en(Y.id):null},recordActivity(u,h){r.rewards?.enabled&&Te({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 x=await a.replyToReporterReport(u,X(),h);return x.ok?x.data?.comment??null:null},async submitFeedbackSignal(u,h,x){let L=await a.replyToReporterReport(u,X(),x??"",h);return L.ok?L.data?.feedback??null:null},async reopenReport(u,h){let x=await a.reopenReporterReport(u,X(),h);return x.ok?x.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)&&Ur(b),typeof window<"u"&&typeof localStorage<"u"){let u="mushi:last-run",h=null;try{let x=localStorage.getItem(u);h=x===null?null:x==="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(x){n.warn("onCrashedLastRun hook threw",{error:x instanceof Error?x.message:String(x)});}}return it}function Ni(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,g=l?.bannerVariant,p=l?.bannerPosition,w=l?.bannerMessage,d=l?.bannerLabel,m=l?.bannerBugCta,c=l?.bannerFeatureCta,f=g||p||w!=null||d!=null||m!=null||c!=null?{...t.widget?.bannerConfig??{},...g?{variant:g}:{},...p?{position:p}:{},...w!=null?{message:w}:{},...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}:{},...f?{bannerConfig:f}:{},...t.widget?.betaMode?{betaMode:t.widget.betaMode}:{}},capture:{...t.capture,...e.capture},privacy:{...t.privacy}}}function Fi(t){if(!t.preset)return t;let e=Ui(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 Ui(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 Ht(t){return t.apiEndpoint??Ue}function qi(t){return t.runtimeConfig!==false}async function ji(t){let e=await zi(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:te,widgetHostPointerSafe:t.widgetDiagnostics?.widgetHostPointerSafe??false,widgetHostBounds:t.widgetDiagnostics?.widgetHostBounds??null,widgetSuppressed:t.widgetDiagnostics?.widgetSuppressed??false,bannerRendered:t.widgetDiagnostics?.bannerRendered??false}}async function vn(){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:te,widgetHostPointerSafe:false,widgetHostBounds:null,widgetSuppressed:false,bannerRendered:false}}async function zi(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}:{},[Re]:"diagnose"})).ok,cspAllowed:!0}}catch{return {reachable:false,cspAllowed:false}}finally{r&&clearTimeout(r);}}function Bt(t){return `mushi:sdk-config:${t}`}function wn(t){return `mushi:sdk-version:${t}`}function Wi(t){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(Bt(t));return e?JSON.parse(e).config??null:null}catch{return null}}function Vi(t,e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Bt(t),JSON.stringify({cachedAt:Date.now(),config:e}));}catch{}}function Ki(t){if(!(typeof localStorage>"u"))try{localStorage.removeItem(Bt(t));}catch{}}function Gi(t){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(wn(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 Yi(t,e){if(!(typeof localStorage>"u"))try{localStorage.setItem(wn(t),JSON.stringify({cachedAt:Date.now(),data:e}));}catch{}}function Xi(t,e){let r=bn(t),n=bn(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 bn(t){return t.split(/[.-]/).map(e=>Number.parseInt(e,10)).filter(e=>Number.isFinite(e))}function Ji(){return {report:()=>{},on:()=>()=>{},setUser:()=>{},setMetadata:()=>{},setScreen:()=>{},isOpen:()=>false,open:()=>{},close:()=>{},updateConfig:()=>{},diagnose:vn,openWith:()=>{},show:()=>{},hide:()=>{},attachTo:()=>()=>{},setTrigger:()=>{},openReporter:()=>{},destroy:()=>{he=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 Zi(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(yn).join(" ")});}catch{}return r.apply(this,s)},console.warn=function(...s){try{t.add({category:"console",level:"warning",message:s.map(yn).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 yn(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 Qi(){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 eo(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 to(){if(typeof document>"u"||typeof window>"u")return;let t=window;if(t.__mushiLoaderInit)return;let e=Qi();if(!e)return;let r=eo(e.dataset);if(r){t.__mushiLoaderInit=true;try{nt.init(r);}catch{}}}to();
2281
+ `,document.body.appendChild(c),c}function o(c){if(!e)return;let f=c.getBoundingClientRect();e.style.left=`${f.left}px`,e.style.top=`${f.top}px`,e.style.width=`${f.width}px`,e.style.height=`${f.height}px`,e.style.display="block";}function l(c){let f=c.target;f!==e&&o(f);}function g(c){c.preventDefault(),c.stopPropagation();let f=c.target;if(f===e||(c.composedPath?c.composedPath():[]).some(E=>E instanceof Element&&E.id==="mushi-mushi-widget"))return;let R=i(f);w(R);}function p(c){c.key==="Escape"&&w(null);}function w(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",g,true),document.addEventListener("keydown",p,true);})}function m(){t&&(t=false,document.body.style.cursor="",document.removeEventListener("mousemove",l,true),document.removeEventListener("click",g,true),document.removeEventListener("keydown",p,true),e&&(e.remove(),e=null));}return {activate:d,deactivate:m,isActive:()=>t}}function At(){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 g=l.target instanceof Element?l.target:null;if(!g)return;let p=g.closest('button,a,[role="button"],input,textarea,select,[data-mushi-track]')??g;i({ts:Date.now(),kind:"click",payload:{tag:p.tagName.toLowerCase(),id:p.id||void 0,text:Si(p)}});}return history.pushState=function(...g){let p=e.apply(this,g);return a("pushState"),p},history.replaceState=function(...g){let p=r.apply(this,g);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,w)=>p.ts-w.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 Si(t){let e=(t.textContent??"").replace(/\s+/g," ").trim();return e?e.slice(0,80):void 0}var Ei=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ki=/^[0-9a-f]{20,}$/i,Ri=/^\d+$/,Ci=/^[a-z0-9]{16,}$/i;function an(t){return t.length===0?t:Ei.test(t)||ki.test(t)||Ri.test(t)||Ci.test(t)&&/\d/.test(t)?"[id]":t}function ln(t,e){let r=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;if(e?.length){let n=Ti(r,e);if(n)return n}return "/"+r.split("/").filter(n=>n.length>0).map(an).join("/")}function Ti(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],g=r[o];if(!(l.startsWith("[")&&l.endsWith("]"))&&!l.startsWith(":")&&l!==g){a=false;break}}if(a)return "/"+i.join("/")}return null}function Mi(){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 $i(){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 Li(){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 Ii(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 _t(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",g=new Map,p=null,w=null;async function d(){if(typeof window>"u")return;let y=ln(window.location.pathname,e.routeTemplates),k=Date.now(),b=g.get(y)??0;if(k-b<a)return;g.set(y,k);let _=null;l==="auto"?_=n()??s():l==="session-only"&&(_=s());let V={route:y,page_title:typeof document<"u"&&(document.title||"").slice(0,300)||null,dom_summary:o?Li():null,testids:Mi(),network_paths:r().slice(-50),query_param_keys:$i(),user_id_hash:await Ii(_),observed_at:new Date().toISOString()};i(V);}function m(){w||(w=setTimeout(()=>{w=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 f=window.history.pushState.bind(window.history),S=window.history.replaceState.bind(window.history),$=function(...k){let b=f(...k);return c(),b},R=function(...k){let b=S(...k);return c(),b};window.history.pushState=$,window.history.replaceState=R;let E=()=>c();return window.addEventListener("popstate",E),m(),{destroy(){window.removeEventListener("popstate",E),window.history.pushState===$&&(window.history.pushState=f),window.history.replaceState===R&&(window.history.replaceState=S),w&&(clearTimeout(w),w=null),g.clear();},flushNow(){g.clear(),d();}}}function cn(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 g=n(t[l]);if(typeof g=="number"&&g>=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 Ai(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 Qe=null;async function _i(){if(Qe)return Qe;try{return Qe=await import('rrweb'),Qe}catch{return null}}async function un(t){let e=t.maxDurationMs??3e4,r=await _i();if(!r?.record)return Ai(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(g){s.push(g),cn(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 cn(s,e,400),[...s]},destroy(){l(),s.length=0;}}}function dn(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),g=Math.round(s.width*l),p=Math.round(s.height*l);for(let k of [a,o])k.width=g,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 w=a.getContext("2d"),d=o.getContext("2d");if(!w||!d){n(new Error("Canvas not supported"));return}w.drawImage(s,0,0,g,p),i.appendChild(a),i.appendChild(o),e.appendChild(i);let m="highlight",c=false,f=null,S=[],$=k=>{let b=o.getBoundingClientRect(),_="touches"in k?k.touches[0]??k.changedTouches[0]:null,V=_?_.clientX:k.clientX,W=_?_.clientY:k.clientY;return {x:(V-b.left)/b.width*g,y:(W-b.top)/b.height*p}},R=()=>{d.clearRect(0,0,g,p);for(let k of S)if(k.tool==="highlight"&&k.points.length>=2){let[b,_]=k.points;d.fillStyle="rgba(255, 230, 0, 0.35)",d.fillRect(Math.min(b.x,_.x),Math.min(b.y,_.y),Math.abs(_.x-b.x),Math.abs(_.y-b.y));}else if(k.tool==="arrow"&&k.points.length>=2){let[b,_]=k.points;d.strokeStyle="#ef4444",d.lineWidth=3,d.beginPath(),d.moveTo(b.x,b.y),d.lineTo(_.x,_.y),d.stroke();}},E=k=>{c=true,f=$(k);},y=k=>{if(!c||!f)return;c=false;let b=$(k);if(m==="blur"){let _=Math.min(f.x,b.x),V=Math.min(f.y,b.y),W=Math.abs(b.x-f.x),A=Math.abs(b.y-f.y);W>=1&&A>=1&&(w.filter="blur(8px)",w.drawImage(a,_,V,W,A,_,V,W,A),w.filter="none");}else S.push({tool:m,points:[f,b]});f=null,R();};o.addEventListener("mousedown",E),o.addEventListener("mouseup",y),o.addEventListener("touchstart",E,{passive:true}),o.addEventListener("touchend",y),r({canvas:a,setTool(k){m=k;},getDataUrl(){let k=document.createElement("canvas");k.width=g,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",E),o.removeEventListener("mouseup",y),o.removeEventListener("touchstart",E),o.removeEventListener("touchend",y),i.remove();}});},s.onerror=()=>n(new Error("Failed to load screenshot")),s.src=t;})}function pn(){try{let t=globalThis;return t.Sentry?t.Sentry:void 0}catch{return}}function Pi(){try{return globalThis.__SENTRY_REPLAY__}catch{return}}function Di(){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 Pt(t,e={}){let r=Math.max(0,e.breadcrumbsLimit??30),n={},s=pn();if(!s)return n;n.sdk=Di();try{let o=s;if(typeof o.lastEventId=="function")n.eventId=o.lastEventId()??void 0;else {let g=s.getCurrentHub?.()?.getScope?.();n.eventId=g?.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[g,p]of Object.entries(o))(typeof p=="string"||typeof p=="number"||typeof p=="boolean")&&(l[g]=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(g=>{let p=g;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 g=l.spanContext?.();n.traceId=g?.traceId??l.traceId??void 0,n.spanId=g?.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?.()??Pi();n.replayId=l?.getReplayId?.()??void 0;}catch{}return n}function Dt(t,e={}){let r=pn();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 Oi=["/login","/logout","/signup","/sso/*","/auth/*"];function mn(t,e={}){let r=[];if(e.rageClick!==false){let f=function(S){let $=Date.now();if(S.target===c){if(m.push($),m=m.filter(R=>$-R<500),m.length>=3){let R=S.target;t.onTrigger("rage_click",{element:R.tagName,id:R.id,text:R.textContent?.slice(0,50)}),m=[];}}else c=S.target,m=[$];};let m=[],c=null;document.addEventListener("click",f,true),r.push(()=>document.removeEventListener("click",f,true));}if(e.longTask!==false&&typeof PerformanceObserver<"u")try{let m=new PerformanceObserver(c=>{for(let f of c.getEntries())f.duration>5e3&&t.onTrigger("long_task",{duration:Math.round(f.duration),startTime:Math.round(f.startTime)});});m.observe({entryTypes:["longtask"]}),r.push(()=>m.disconnect());}catch{}let n=Hi(e.apiCascade);if(n.enabled){let m=[],c=globalThis.fetch;globalThis.fetch=async function(...f){let[S,$]=f,R=Xe(S),E=!!Je(S,$)||Ze(R,{apiEndpoint:e.apiEndpoint,ignoreUrls:n.ignoreUrls});try{let y=await c.apply(this,f);return !E&&!y.ok&&y.status>=400&&hn(m,t),y}catch(y){throw E||hn(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(A){return f.some(G=>G.endsWith("/*")?A.startsWith(G.slice(0,-2)):A===G||A.startsWith(G+"/"))},E=function(){let A=window.location?.pathname??"";R(A)||t.onTrigger("page_dwell",{thresholdMs:c,path:A});},y=function(){S&&clearTimeout(S);let A=window.location?.pathname??"";R(A)||(S=setTimeout(E,c));},k=function(){let A=window.location?.pathname??"";A!==$&&($=A,y());};let m=typeof e.pageDwell=="object"?e.pageDwell??{}:{},c=m.thresholdMs||300*1e3,f=m.excludeRoutes!==void 0?m.excludeRoutes:Oi,S=null,$=window.location?.pathname??"";y();let b=window.history,_=b?.pushState,V=b?.replaceState;b&&_&&V&&(b.pushState=function(...A){let G=_.apply(this,A);return k(),G},b.replaceState=function(...A){let G=V.apply(this,A);return k(),G});let W=()=>k();window.addEventListener("popstate",W),r.push(()=>{S&&clearTimeout(S),window.removeEventListener("popstate",W),b&&_&&(b.pushState=_),b&&V&&(b.replaceState=V);});}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,f=m.storageKey??(e.projectId?`mushi:${e.projectId}:firstSessionShown`:"mushi:firstSessionShown"),S=false;try{S=window.localStorage?.getItem(f)==="1";}catch{}if(!S){let $=setTimeout(()=>{try{window.localStorage?.setItem(f,"1");}catch{}t.onTrigger("first_session",{delayMs:c});},c);r.push(()=>clearTimeout($));}}if(e.errorBoundary){let m=function(f){t.onTrigger("error_boundary",{message:f.message,filename:f.filename,lineno:f.lineno,colno:f.colno});},c=function(f){t.onTrigger("error_boundary",{message:f.reason instanceof Error?f.reason.message:String(f.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 Hi(t){return t===false?{enabled:false,ignoreUrls:[]}:t&&typeof t=="object"?{enabled:t.enabled!==false,ignoreUrls:t.ignoreUrls??[]}:{enabled:true,ignoreUrls:[]}}function hn(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 gn="mushi:lastDismiss",et="mushi:consecDismiss",Ot="mushi:lastShown";function tt(t){try{return localStorage.getItem(t)}catch{return null}}function rt(t,e){try{localStorage.setItem(t,e);}catch{}}function fn(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(w){let d=Date.now();if(parseInt(tt(et)??"0",10)>=n)return false;let c=tt(gn);if(c&&d-parseInt(c,10)<r*60*60*1e3)return false;if(s>0&&i===0){let f=tt(Ot);if(f&&d-parseInt(f,10)<s)return false}return i>=e||a.has(w)?false:(a.add(w),i++,rt(Ot,String(d)),true)}function l(){rt(gn,String(Date.now()));let w=parseInt(tt(et)??"0",10);rt(et,String(w+1));}function g(){rt(et,"0");}function p(){i=0,a.clear();try{localStorage.removeItem(Ot);}catch{}}return {shouldShow:o,recordDismissal:l,recordSubmission:g,reset:p}}var he=null,nt=class{constructor(){}static init(e){if(he)return qe({scope:"mushi",level:"warn",format:"pretty"}).warn("Already initialized \u2014 call destroy() first to reinitialize"),he;let r={...ar(),...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?Ji():(he=Bi(r),he)}static getInstance(){return he}static destroy(){he?.destroy(),he=null;}static diagnose(){return he?.diagnose()??vn()}};function Bi(t){let e=Fi(t),r=e,n=t.debug??false?qe({scope:"mushi",level:"debug",format:"pretty"}):lt,s=null,i=null,a=or({projectId:e.projectId,apiKey:e.apiKey,...e.apiEndpoint?{apiEndpoint:e.apiEndpoint}:{},getUserToken:()=>s,sdkPackage:be,sdkVersion:te}),o=lr(e.preFilter),l=hr(e.offline),g=gr({maxBurst:10,refillRate:1,refillIntervalMs:5e3}),p=fr();function w(u){return u.map(h=>{let x={...h};if(typeof h.message=="string"&&(x.message=p.scrub(h.message)),h.data&&typeof h.data=="object"){let I={};for(let[L,O]of Object.entries(h.data))I[L]=typeof O=="string"?p.scrub(O):O;x.data=I;}return x})}function d(u){if(!u)return;let h={};for(let[x,I]of Object.entries(u))h[x]=typeof I=="string"?p.scrub(I):I;return h}let m=null,c=null,f=null,S=null,$=null,R=null,E=At(),y=null,k=0,b,_=`mushi:tester-jwt:${e.projectId}`;function V(){try{return typeof localStorage<"u"?localStorage.getItem(_):null}catch{return null}}function A(){try{typeof localStorage<"u"&&localStorage.removeItem(_);}catch{}}async function G(u){let h=await a.getTesterStatus(u);if(!h.ok||!h.data){A();return}let x=h.data;if(!x.is_tester||!x.tester_id){A();return}b.setTesterSession(u,{id:x.tester_id,public_handle:x.public_handle??null,display_name:x.display_name??null});let I=await a.getMyReputation(u);if(I.ok&&I.data){let L=I.data;L.reputation&&b.setTesterReputation(L.reputation);}}function Se(){if(r.capture?.console!==false?m??=kt():(m?.destroy(),m=null),r.capture?.network!==false){let L={apiEndpoint:Ht(r),ignoreUrls:r.capture?.ignoreUrls,tracePropagation:r.capture?.tracePropagation,sessionId:Le()};c?c.updateOptions(L):c=Ct(L);}else c?.destroy(),c=null;if(r.capture?.performance!==false?f??=Lt():(f?.destroy(),f=null),r.capture?.screenshot!=="off"){let L={privacy:r.privacy};r.capture?.screenshotProvider?S=null:S?S.updateOptions(L):S=$t(L);}else S=null;!S&&!r.capture?.screenshotProvider&&(q=null),b.setAllowScreenshotRemove(r.privacy?.allowUserRemoveScreenshot!==false),r.capture?.elementSelector!==false?$??=It():($?.deactivate(),$=null,de=null);let u=r.capture?.discoverInventory,h=u===true?{}:u&&typeof u=="object"?u:null;h!=null&&h.enabled!==false?(R?.destroy(),R=_t({config:h,getRecentNetworkPaths:()=>c?c.getEntries().map(L=>{try{let O=new URL(L.url,typeof window<"u"?window.location.href:"http://localhost");return O.host&&typeof window<"u"&&O.host!==window.location.host?null:O.pathname}catch{return null}}).filter(L=>L!=null&&L.length>0&&L.length<200):[],getUserId:()=>F?.id??null,getSessionId:Le,onEvent:L=>{a.postDiscoveryEvent({...L,sdk_version:te}).catch(O=>{n.debug("discovery emit failed",{err:String(O)});});}})):(R?.destroy(),R=null);let I=r.capture?.replay??"off";if(I==="rrweb"||I==="lite"){let L=++k;un({redactSelectors:r.privacy?.redactSelectors}).then(O=>{if(L!==k){O.destroy();return}y?.destroy(),y=O,y.start();});}else k++,y?.destroy(),y=null;}let Y=new Map;function K(u,h){Y.get(u)?.forEach(x=>x({type:u,data:h}));}let q=null,de=null,me=null,De=false,F=null,M={},C={},T=br({max:50});T.add({category:"lifecycle",level:"info",message:"Mushi SDK init",data:{projectId:e.projectId,sdkVersion:te}});let H=null;H=Zi(T);let P=false;async function ae(){if(P)return null;let u=r.capture?.screenshotProvider;if(u){P=true;try{return await u()??null}catch(L){n.warn("screenshotProvider threw, falling back to built-in capturer",{error:L instanceof Error?L.message:String(L)});}finally{P=false;}}if(!S)return null;P=true;let h=b.getIsOpen();h&&b.hidePanel();let x=document.getElementById("mushi-mushi-widget"),I=x?.style.visibility??"";x&&(x.style.visibility="hidden"),await new Promise(L=>{requestAnimationFrame(()=>requestAnimationFrame(()=>L()));});try{return await S.take()}finally{P=false,x&&(x.style.visibility=I),h&&b.showPanel();}}async function Me(u){let h=r.capture?.screenshot;!(S||r.capture?.screenshotProvider)||h==="off"||q||u==="open"&&h!=="auto"||u==="submit"&&h!=="on-report"&&h!=="auto"||(n.debug("Auto-capturing screenshot",{when:u,mode:h}),q=await ae(),b.setScreenshotAttached(q!==null),b.setScreenshotPreview(q));}b=new Ge(e.widget,{onSubmit:async({category:u,userCategory:h,description:x,intent:I})=>(n.info("Report submitted",{category:u,userCategory:h,intent:I}),J?.recordSubmission(),await Me("submit"),await ke(u,x,I,h)??{reportId:null,queuedOffline:true}),onOpen:()=>{n.debug("Widget opened"),Me("open"),y?.start(),K("widget:opened");},onClose:()=>{n.debug("Widget closed"),me&&(J?.recordDismissal(),K("proactive:dismissed",{type:me})),q=null,de=null,me=null,K("widget:closed");},onScreenshotRequest:async()=>{!(S||r.capture?.screenshotProvider)||r.capture?.screenshot==="off"||(n.debug("Taking screenshot"),q=await ae(),b.setScreenshotAttached(q!==null),b.setScreenshotPreview(q));},onScreenshotRemove:()=>{n.debug("Screenshot attachment removed"),q=null,b.setScreenshotAttached(false);},onScreenshotAnnotateRequest:async u=>{if(!q||u.childElementCount>0)return;let h;try{h=await dn(q,u);}catch(Z){n.warn("Screenshot annotation failed",{error:Z instanceof Error?Z.message:String(Z)});return}let x=document.createElement("div");x.className="mushi-annotate-toolbar";let I=Z=>{(q=h.getDataUrl(),b.setScreenshotAttached(true),b.setScreenshotPreview(q)),h.destroy(),x.remove();},L=[{id:"highlight",label:"\u270F\uFE0F Highlight"},{id:"blur",label:"\u{1F512} Blur"},{id:"arrow",label:"\u2197\uFE0F Arrow"}];for(let Z of L){let N=document.createElement("button");N.type="button",N.className="mushi-attach-btn",N.dataset.tool=Z.id,N.textContent=Z.label,N.addEventListener("click",()=>{h.setTool(Z.id),x.querySelectorAll("button[data-tool]").forEach(le=>le.classList.remove("active")),N.classList.add("active");}),x.appendChild(N);}x.querySelector('button[data-tool="highlight"]')?.classList.add("active");let O=document.createElement("button");O.type="button",O.className="mushi-attach-btn",O.textContent="\u2713 Done",O.addEventListener("click",()=>I()),x.appendChild(O),u.insertBefore(x,u.firstChild);},onElementSelectorRequest:async()=>{if(!(!$||r.capture?.elementSelector===false)){n.debug("Element selector activated"),b.setElementCapturing(true),b.hidePanel();try{let u=await $.activate();u?(de=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 x=await a.replyToReporterReport(u,X(),h);if(!x.ok)throw new Error(x.error?.message??"Could not send reply")},async onReporterFeedback(u,h,x){let I=await a.replyToReporterReport(u,X(),x??"",h);if(!I.ok)throw new Error(I.error?.message??"Could not send feedback");return I.data?.feedback??null},async onReporterReopen(u,h){let x=await a.reopenReporterReport(u,X(),h);if(!x.ok)throw new Error(x.error?.message??"Could not reopen report");return x.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),tn(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=V(),h=await a.getPublicLeaderboard(50),I=(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(I,!1),u){let L=await a.getMyReputation(u);if(L.ok&&L.data){let O=L.data;O.reputation&&b.setTesterReputation(O.reputation);}}}catch{b.setGlobalLeaderboard([],false);}},async onCrossAppReportsOpen(){let u=V();if(!u){b.setCrossAppReports([],false);return}try{let h=await a.getCrossAppReports(u),x=h.ok?h.data?.reports??[]:[];b.setCrossAppReports(x,!1);}catch{b.setCrossAppReports([],false);}},onTesterSignOut(){A();},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 x=await a.askAssistant({message:u,threadId:h,context:i});return x.ok?x.data??null:null}},te),Se(),typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>b.mount()):b.mount());let Ee=V();Ee&&G(Ee).catch(()=>A());let ne=null,J=null,D=r.proactive;D&&(D.rageClick!==false||D.longTask!==false||D.apiCascade!==false||D.errorBoundary===true||D.pageDwell||D.firstSession)&&typeof document<"u"&&(J=fn(D?.cooldown),ne=mn({onTrigger:(u,h)=>{if(!J.shouldShow(u)){n.debug("Proactive trigger suppressed by fatigue prevention",{type:u});return}n.info("Proactive trigger fired",{type:u,context:h}),me=u,K("proactive:triggered",{type:u,context:h}),u==="first_session"?b.pulseTrigger?.():b.open();}},{rageClick:D?.rageClick,longTask:D?.longTask,apiCascade:D?.apiCascade,apiEndpoint:Ht(r),errorBoundary:D?.errorBoundary,pageDwell:D?.pageDwell,firstSession:D?.firstSession,projectId:e.projectId}),n.debug("Proactive triggers enabled",{rageClick:D?.rageClick!==false,longTask:D?.longTask!==false,apiCascade:D?.apiCascade!==false,errorBoundary:D?.errorBoundary===true,pageDwell:!!D?.pageDwell,firstSession:!!D?.firstSession})),l.startAutoSync(a),l.flush(a).then(u=>{u.sent>0&&n.info("Synced offline reports",{sent:u.sent});});function B(u){if(De=true,u.enabled===false){r=e,Ki(t.projectId),Se(),b.updateConfig(r.widget),n.debug("Runtime SDK config disabled; using bootstrap config",{version:u.version});return}r=Ni(r,u),Se(),u.widget&&b.updateConfig(r.widget),n.debug("Applied runtime SDK config",{version:u.version});}if(qi(t)){let u=Wi(t.projectId);u&&B(u),a.getSdkConfig().then(h=>{h.ok&&h.data?(Vi(t.projectId,h.data),B(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");Oe(),n.info("Initialized",{projectId:t.projectId});async function Oe(){if(r.widget?.outdatedBanner==="off")return;let u=Gi(be);u&&He(u);let h=await a.getLatestSdkVersion(be);!h.ok||!h.data||(Yi(be,h.data),He(h.data));}function He(u){let h=u.latest,x=!!(h&&Xi(te,h));if(!x&&!u.deprecated)return;let I=u.deprecationMessage??(x?`Update ${be} to ${h}.`:null);n.warn("Mushi SDK is outdated",{package:be,current:te,latest:h,deprecated:u.deprecated,message:I}),r.widget?.outdatedBanner!=="console-only"&&b.setSdkFreshness({latest:h,current:te,deprecated:u.deprecated,message:I});}async function ke(u,h,x,I){let L=o.check(h);if(!L.passed){n.info("Report blocked by pre-filter",{reason:L.reason});return}let O=t.preFilter?.wasmClassifier;if(O)try{let z=await O.classify({description:h,category:u,url:typeof location<"u"?location.href:void 0,hasScreenshot:q!==null,hasSelectedElement:de!==null,hasNetworkErrors:c?.getEntries()?.some(se=>se.status>=400||!!se.error)??!1,hasConsoleErrors:m?.getEntries()?.some(se=>se.level==="error")??!1,proactiveTrigger:me??void 0});if(z.verdict==="block"){n.info("Report blocked by on-device classifier",{modelId:z.modelId,confidence:z.confidence,reason:z.reason});return}n.debug("On-device classifier verdict",{...z});}catch(z){n.warn("On-device classifier threw \u2014 falling through to server",{error:z instanceof Error?z.message:String(z)});}if(!g.tryConsume()){n.warn("Report throttled \u2014 rate limit exceeded");return}let Z=p.scrub(o.truncate(h)),N=t.sentry?Pt(t.sentry):void 0,le=await mr().catch(()=>null),Nt=r.capture?.console===false?void 0:m?.getEntries(),Ft=r.capture?.network===false?void 0:c?.getEntries(),Ut=w(T.getAll()),qt=d(Object.keys(C).length>0?{...C}:void 0),jt=N?{...N,...N.breadcrumbs?{breadcrumbs:w(N.breadcrumbs)}:{},...N.tags?{tags:d(N.tags)}:{}}:void 0,zt=q?await Mr(q).catch(()=>null):null;q&&!zt&&n.warn("Screenshot dropped \u2014 could not compress under wire budget");let ce={id:ut(),projectId:t.projectId,category:u,...I?{userCategory:I}:{},description:Z,userIntent:x,environment:ct(),consoleLogs:Nt,networkLogs:Ft,performanceMetrics:r.capture?.performance===false?void 0:f?.getMetrics(),timeline:E.getEntries({consoleLogs:Nt,networkLogs:Ft}),screenshotDataUrl:zt??void 0,selectedElement:de??void 0,...y?{replayEvents:y.flush()}:{},metadata:{...M,...F?{user:F}:{},...N?.release?{sentryRelease:N.release}:{}},sessionId:Le(),reporterToken:X(),...le?{fingerprintHash:le}:{},appVersion:t.integrations?.vercel?.analyticsId,sdkPackage:be,sdkVersion:te,proactiveTrigger:me??void 0,...Ut.length>0?{breadcrumbs:Ut}:{},...qt?{tags:qt}:{},...jt?{sentryContext:jt}:{},sentryEventId:N?.eventId,sentryReplayId:N?.replayId,createdAt:new Date().toISOString()};if(T.add({category:"lifecycle",level:"info",message:`Mushi report submitting (${u})`,data:{reportId:ce.id,category:u}}),t.integrations?.custom){let z={addMetadata(se,xn){ce.metadata[se]=xn;},setCategory(se){ce.category=se;},setDescription(se){ce.description=se;}};t.integrations.custom(z);}let U=ce;if(t.beforeSendFeedback)try{let z=await Promise.race([Promise.resolve(t.beforeSendFeedback(ce)),new Promise(se=>setTimeout(()=>se(ce),2e3))]);if(z===null){n.info("Report dropped by beforeSendFeedback hook",{reportId:ce.id});return}U=z;}catch(z){n.warn("beforeSendFeedback hook threw \u2014 sending unmodified report",{error:z instanceof Error?z.message:String(z)});}if(K("report:submitted",{reportId:U.id}),typeof navigator<"u"&&!navigator.onLine)return await l.enqueue(U),n.info("Offline \u2014 report queued",{reportId:U.id}),K("report:queued",{reportId:U.id}),{reportId:null,queuedOffline:true};let j=await a.submitReport(U);if(!j.ok&&j.error?.code==="PAYLOAD_TOO_LARGE"&&(Array.isArray(U.replayEvents)&&U.replayEvents.length>0&&(n.warn("Report too large \u2014 dropping replay buffer and retrying",{reportId:U.id}),U={...U,replayEvents:void 0},j=await a.submitReport(U)),!j.ok&&j.error?.code==="PAYLOAD_TOO_LARGE"&&U.screenshotDataUrl&&(n.warn("Report still too large \u2014 dropping screenshot and retrying",{reportId:U.id}),U={...U,screenshotDataUrl:void 0},j=await a.submitReport(U))),j.ok){if(n.info("Report sent",{reportId:j.data?.reportId}),K("report:sent",{reportId:j.data?.reportId}),j.data?.cursorAgentId){let z=j.data;K("report:dispatched",{reportId:z.reportId,agentId:z.cursorAgentId,fixId:z.fixId});}T.add({category:"lifecycle",level:"info",message:`Mushi report sent (${j.data?.reportId??ce.id})`}),Te({action:"report_submit",metadata:{category:u,reportId:j.data?.reportId??ce.id}});try{t.sentry&&j.data?.reportId&&Dt(j.data.reportId);}catch{}}else j.error?.code==="PAYLOAD_TOO_LARGE"||j.error?.code==="SERIALIZE_FAILED"?(n.warn("Report exceeds size limit after degradation \u2014 dropping",{reportId:U.id,error:j.error}),K("report:failed",{reportId:U.id,error:j.error}),T.add({category:"lifecycle",level:"error",message:`Mushi report dropped \u2014 payload too large (${U.id})`})):(n.warn("Report failed, queuing for retry",{reportId:U.id,error:j.error}),await l.enqueue(U),K("report:failed",{reportId:U.id,error:j.error}),T.add({category:"lifecycle",level:"warning",message:`Mushi report queued for retry (${U.id})`}));return q=null,de=null,me=null,j?.ok?{reportId:j.data?.reportId??ce.id,queuedOffline:false}:{reportId:null,queuedOffline:true}}let it={report(u){b.open(u);},on(u,h){return Y.has(u)||Y.set(u,new Set),Y.get(u).add(h),()=>Y.get(u)?.delete(h)},setUser(u){F=u;},setMetadata(u,h){M[u]=h;},setScreen(u){E.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){B(u);},diagnose(){return ji({apiEndpoint:Ht(r),widgetMounted:b.getIsMounted(),runtimeConfigLoaded:De,captureScreenshotAvailable:S!==null,captureNetworkIntercepting:c!==null,widgetDiagnostics:b.getWidgetDiagnostics()})},destroy(){ne?.destroy(),J?.reset(),b.destroy(),m?.destroy(),c?.destroy(),f?.destroy(),$?.deactivate(),E.destroy(),R?.destroy(),R=null,y?.destroy(),y=null,l.stopAutoSync(),H?.(),H=null,T.clear(),Y.clear(),he=null,n.debug("Destroyed");},async captureEvent(u){if(!g.tryConsume())return n.warn("captureEvent throttled \u2014 rate limit exceeded"),null;let h=p.scrub(o.truncate(u.description)),x=u.category??"bug",I=t.sentry?Pt(t.sentry):void 0,L=w(T.getAll()),O=d(Object.keys(C).length===0&&!u.tags?void 0:{...C,...u.tags??{}}),Z=I?{...I,...I.breadcrumbs?{breadcrumbs:w(I.breadcrumbs)}:{},...I.tags?{tags:d(I.tags)}:{}}:void 0,N={id:ut(),projectId:t.projectId,category:x,description:h,environment:ct(),timeline:E.getEntries(),metadata:{...u.metadata??{},...F?{user:F}:{},...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}:{},...O&&Object.keys(O).length>0?{tags:O}:{},...Z?{sentryContext:Z}:{},sessionId:Le(),reporterToken:X(),sdkPackage:be,sdkVersion:te,sentryEventId:I?.eventId,sentryReplayId:I?.replayId,createdAt:new Date().toISOString()};if(K("report:submitted",{reportId:N.id}),typeof navigator<"u"&&!navigator.onLine)return await l.enqueue(N),K("report:queued",{reportId:N.id}),null;let le=await a.submitReport(N);if(le.ok){K("report:sent",{reportId:le.data?.reportId});try{t.sentry&&le.data?.reportId&&Dt(le.data.reportId);}catch{}return le.data?.reportId??null}return await l.enqueue(N),K("report:failed",{reportId:N.id,error:le.error}),null},async captureException(u,h){let x=yr(u);T.add({category:"lifecycle",level:"error",message:`Mushi.captureException(${x.name}): ${x.message}`,...x.stack?{data:{stack:x.stack.slice(0,500)}}:{}});let I=h?.description?.trim()||`${x.name}: ${x.message}`||"Uncaught exception";return it.captureEvent({description:I,category:h?.category??"bug",severity:h?.severity??"high",...h?.component?{component:h.component}:{},...h?.tags?{tags:h.tags}:{},source:h?.source??"captureException",error:{name:x.name,message:x.message,...x.stack?{stack:x.stack}:{}},metadata:{...h?.metadata??{},...x.cause?{cause:x.cause}:{}}})},identify(u,h){if(F={id:u,...h?.email?{email:h.email}:{},...h?.name?{name:h.name}:{}},b.setIdentifiedUser(F.name||F.email?{name:F.name,email:F.email}:null),h)for(let[x,I]of Object.entries(h))x!=="email"&&x!=="name"&&(M[`user.${x}`]=I);if(T.add({category:"lifecycle",level:"info",message:`Mushi.identify(${u})`}),r.rewards?.enabled){let x={client:a,config:r.rewards,projectId:e.projectId,userId:u,traits:h?{email:h.email,name:h.name,provider:h.provider}:void 0};F.id===u?Zr(x):Qr(u,x.traits),r.rewards.showInWidget!==false&&a.getMyPoints(u).then(I=>{if(!I.ok)return;let L=I.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=vr(s);h?.sub&&(F={id:h.sub,...h.email?{email:h.email}:{},...h.name?{name:h.name}:{}},b.setIdentifiedUser(F.name||F.email?{name:F.name,email:F.email}:null)),T.add({category:"lifecycle",level:"info",message:"Mushi.identifyWithToken()"});}else F=null,b.setIdentifiedUser(null),T.add({category:"lifecycle",level:"info",message:"Mushi.identifyWithToken(null)"});},publishPageContext(u){i=u&&u.route?u:null;},openAssistant(){b.openAssistantTab();},addBreadcrumb(u){T.add(u);},getBreadcrumbs(){return T.getAll()},setTag(u,h){typeof u!="string"||u.length===0||(C[u]=h);},setTags(u){if(!(!u||typeof u!="object"))for(let[h,x]of Object.entries(u))typeof h=="string"&&h.length>0&&(C[h]=x);},clearTag(u){if(typeof u=="string"&&u.length>0){delete C[u];return}for(let h of Object.keys(C))delete C[h];},async getReputation(){if(!F?.id)return null;let u=await a.getMyPoints(F.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 F?.id?en(F.id):null},recordActivity(u,h){r.rewards?.enabled&&Te({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 x=await a.replyToReporterReport(u,X(),h);return x.ok?x.data?.comment??null:null},async submitFeedbackSignal(u,h,x){let I=await a.replyToReporterReport(u,X(),x??"",h);return I.ok?I.data?.feedback??null:null},async reopenReport(u,h){let x=await a.reopenReporterReport(u,X(),h);return x.ok?x.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)&&Ur(b),typeof window<"u"&&typeof localStorage<"u"){let u="mushi:last-run",h=null;try{let x=localStorage.getItem(u);h=x===null?null:x==="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(x){n.warn("onCrashedLastRun hook threw",{error:x instanceof Error?x.message:String(x)});}}return it}function Ni(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,g=l?.bannerVariant,p=l?.bannerPosition,w=l?.bannerMessage,d=l?.bannerLabel,m=l?.bannerBugCta,c=l?.bannerFeatureCta,f=g||p||w!=null||d!=null||m!=null||c!=null?{...t.widget?.bannerConfig??{},...g?{variant:g}:{},...p?{position:p}:{},...w!=null?{message:w}:{},...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}:{},...f?{bannerConfig:f}:{},...t.widget?.betaMode?{betaMode:t.widget.betaMode}:{}},capture:{...t.capture,...e.capture},privacy:{...t.privacy}}}function Fi(t){if(!t.preset)return t;let e=Ui(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 Ui(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 Ht(t){return t.apiEndpoint??Ue}function qi(t){return t.runtimeConfig!==false}async function ji(t){let e=await zi(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:te,widgetHostPointerSafe:t.widgetDiagnostics?.widgetHostPointerSafe??false,widgetHostBounds:t.widgetDiagnostics?.widgetHostBounds??null,widgetSuppressed:t.widgetDiagnostics?.widgetSuppressed??false,bannerRendered:t.widgetDiagnostics?.bannerRendered??false}}async function vn(){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:te,widgetHostPointerSafe:false,widgetHostBounds:null,widgetSuppressed:false,bannerRendered:false}}async function zi(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}:{},[Re]:"diagnose"})).ok,cspAllowed:!0}}catch{return {reachable:false,cspAllowed:false}}finally{r&&clearTimeout(r);}}function Bt(t){return `mushi:sdk-config:${t}`}function wn(t){return `mushi:sdk-version:${t}`}function Wi(t){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(Bt(t));return e?JSON.parse(e).config??null:null}catch{return null}}function Vi(t,e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Bt(t),JSON.stringify({cachedAt:Date.now(),config:e}));}catch{}}function Ki(t){if(!(typeof localStorage>"u"))try{localStorage.removeItem(Bt(t));}catch{}}function Gi(t){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(wn(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 Yi(t,e){if(!(typeof localStorage>"u"))try{localStorage.setItem(wn(t),JSON.stringify({cachedAt:Date.now(),data:e}));}catch{}}function Xi(t,e){let r=bn(t),n=bn(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 bn(t){return t.split(/[.-]/).map(e=>Number.parseInt(e,10)).filter(e=>Number.isFinite(e))}function Ji(){return {report:()=>{},on:()=>()=>{},setUser:()=>{},setMetadata:()=>{},setScreen:()=>{},isOpen:()=>false,open:()=>{},close:()=>{},updateConfig:()=>{},diagnose:vn,openWith:()=>{},show:()=>{},hide:()=>{},attachTo:()=>()=>{},setTrigger:()=>{},openReporter:()=>{},destroy:()=>{he=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 Zi(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(yn).join(" ")});}catch{}return r.apply(this,s)},console.warn=function(...s){try{t.add({category:"console",level:"warning",message:s.map(yn).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 yn(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 Qi(){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 eo(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 to(){if(typeof document>"u"||typeof window>"u")return;let t=window;if(t.__mushiLoaderInit)return;let e=Qi();if(!e)return;let r=eo(e.dataset);if(r){t.__mushiLoaderInit=true;try{nt.init(r);}catch{}}}to();
2271
2282
  })();//# sourceMappingURL=mushi.loader.global.js.map
2272
2283
  //# sourceMappingURL=mushi.loader.global.js.map