@uptimizr/dashboard 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/__next.__PAGE__.txt +2 -2
- package/out/__next._full.txt +3 -3
- package/out/__next._head.txt +1 -1
- package/out/__next._index.txt +2 -2
- package/out/__next._tree.txt +2 -2
- package/out/_next/static/chunks/0k9-8s-jof_gw.js +1 -0
- package/out/_next/static/chunks/13oqt2aoms4f6.js +1 -0
- package/out/_next/static/chunks/259xlbe69b9tc.js +1 -0
- package/out/_next/static/chunks/{2mleh3pbge181.js → 2t9zu9v_g9kr9.js} +1 -1
- package/out/_next/static/chunks/34rcp8qrbp522.js +3 -0
- package/out/_next/static/chunks/38wksra3d_k-4.js +1 -0
- package/out/_next/static/chunks/3ef6upwlgr4q-.css +3 -0
- package/out/_next/static/chunks/3l6t8b3addlw7.js +1 -0
- package/out/_next/static/chunks/413o2v11bygt5.js +1 -0
- package/out/_not-found/__next._full.txt +2 -2
- package/out/_not-found/__next._head.txt +1 -1
- package/out/_not-found/__next._index.txt +2 -2
- package/out/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/out/_not-found/__next._not-found.txt +1 -1
- package/out/_not-found/__next._tree.txt +2 -2
- package/out/_not-found.html +1 -1
- package/out/_not-found.txt +2 -2
- package/out/index.html +1 -1
- package/out/index.txt +3 -3
- package/package.json +3 -3
- package/out/_next/static/chunks/1fruncg3k-3pu.js +0 -3
- package/out/_next/static/chunks/224_scesvd739.js +0 -1
- package/out/_next/static/chunks/2_hgfg-cjqw1-.js +0 -1
- package/out/_next/static/chunks/2ktxjmx03u9l3.js +0 -1
- package/out/_next/static/chunks/2kw33jl_i9o5j.css +0 -3
- package/out/_next/static/chunks/30363ptka3vzy.js +0 -1
- package/out/_next/static/chunks/39ojyykom0z2r.js +0 -1
- package/out/_next/static/chunks/3jha6wlqw8459.js +0 -1
- /package/out/_next/static/{2AsIePMYsPfJoAl46w-g4 → M5esRfAVlWSeBcfLV_jVr}/_buildManifest.js +0 -0
- /package/out/_next/static/{2AsIePMYsPfJoAl46w-g4 → M5esRfAVlWSeBcfLV_jVr}/_clientMiddlewareManifest.js +0 -0
- /package/out/_next/static/{2AsIePMYsPfJoAl46w-g4 → M5esRfAVlWSeBcfLV_jVr}/_ssgManifest.js +0 -0
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,13329,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"BailoutToCSR",{enumerable:!0,get:function(){return l}});let n=e.r(65711);function l({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new n.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},18316,(e,t,s)=>{"use strict";function n(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"encodeURIPath",{enumerable:!0,get:function(){return n}})},18480,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"PreloadChunks",{enumerable:!0,get:function(){return o}});let n=e.r(28100),l=e.r(49698),r=e.r(75126),a=e.r(18316),i=e.r(60177);function o({moduleIds:e}){if("u">typeof window)return null;let t=r.workAsyncStorage.getStore();if(void 0===t)return null;let s=[];if(t.reactLoadableManifest&&e){let n=t.reactLoadableManifest;for(let t of e){if(!n[t])continue;let e=n[t].files;s.push(...e)}}if(0===s.length)return null;let c=(0,i.getAssetTokenQuery)();return(0,n.jsx)(n.Fragment,{children:s.map(e=>{let s=`${t.assetPrefix}/_next/${(0,a.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,n.jsx)("link",{precedence:"dynamic",href:s,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,l.preload)(s,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},61401,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"default",{enumerable:!0,get:function(){return c}});let n=e.r(28100),l=e.r(11623),r=e.r(13329),a=e.r(18480);function i(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(i(()=>null)),loading:null,ssr:!0},c=function(e){let t={...o,...e},s=(0,l.lazy)(()=>t.loader().then(i)),c=t.loading;function d(e){let i=c?(0,n.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?l.Suspense:l.Fragment,u=t.ssr?(0,n.jsxs)(n.Fragment,{children:["u"<typeof window?(0,n.jsx)(a.PreloadChunks,{moduleIds:t.modules}):null,(0,n.jsx)(s,{...e})]}):(0,n.jsx)(r.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(s,{...e})});return(0,n.jsx)(d,{...o?{fallback:i}:{},children:u})}return d.displayName="LoadableComponent",d}},61776,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"default",{enumerable:!0,get:function(){return l}});let n=e.r(81258)._(e.r(61401));function l(e,t){let s={};"function"==typeof e&&(s.loader=e);let l={...s,...t};return(0,n.default)({...l,modules:l.loadableGenerated?.modules})}("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},14936,e=>{"use strict";var t=e.i(37998),s=e.i(28100),n=e.i(61776),l=e.i(11623),r=e.i(82665),a=e.i(20880);let i={window:"1h"},o=[{id:"1h",label:"Last hour"},{id:"24h",label:"Last 24h"},{id:"7d",label:"Last 7 days"},{id:"all",label:"All time"}],c={"1h":36e5,"24h":864e5,"7d":6048e5};function d(e,t=Date.now()){return"all"===e.window?{}:"custom"===e.window?{since:e.since,until:e.until}:{since:t-c[e.window],until:t}}function u(e,t=Date.now()){return{...d(e,t),scene:e.scene&&e.scene.length>0?e.scene:void 0,source:e.source,cameraMode:e.cameraMode}}let m=[60,300,900,1800,3600,10800,21600,43200,86400,604800];function x(e,t=80){let s=Math.max(60,Math.round(e/t/1e3));return m.find(e=>e>=s)??604800}function p(e){return"xr-controller"===e?"XR controller":e.charAt(0).toUpperCase()+e.slice(1)}let h=["mouse","touch","stylus","pen","xr-controller","hand","gaze","transient","other"];var g=e.i(56054);function f(e,t=1){let[s,n,l]=(0,g.heatRgb)(e);return`rgba(${Math.round(255*s)}, ${Math.round(255*n)}, ${Math.round(255*l)}, ${t})`}function b(e,t=0){return Number.isFinite(e)?e.toLocaleString(void 0,{maximumFractionDigits:t}):"—"}var v=e.i(60614),j=e.i(88725);let y=e=>import(e);async function w(e,t={}){var s;let n,l=t.fetchImpl??fetch;try{let s=await l(e,{signal:t.signal});if(!s.ok)return{source:e,code:"manifest-fetch",message:`HTTP ${s.status}`};n=await s.json()}catch(t){return{source:e,code:"manifest-fetch",message:S(t)}}return"object"==typeof(s=n)&&null!==s&&"number"==typeof s.version&&Array.isArray(s.panels)&&s.panels.every(e=>"object"==typeof e&&null!==e&&"string"==typeof e.url&&e.url.length>0&&"number"==typeof e.contract&&(void 0===e.export||"string"==typeof e.export)&&(void 0===e.id||"string"==typeof e.id))?n:{source:e,code:"manifest-invalid",message:"Manifest shape is invalid"}}async function N(e,t={}){let s=t.importModule??y,n=[],l=[];for(let r of(await Promise.all(e.panels.map(e=>k(e,s,t.allowOrigins)))))"panel"in r?n.push(r.panel):l.push(r.error);return{panels:n,errors:l}}async function k(e,t,s){var n;let l,r,a=e.url;if(1!==e.contract)return{error:{source:a,code:"incompatible",message:`Panel declares contract ${e.contract}; host requires 1`}};if(!function(e,t){let s;if(!t||0===t.length)return!0;try{s=new URL(e).origin}catch{return!1}return t.includes(s)}(e.url,s))return{error:{source:a,code:"origin-blocked",message:"Module origin is not in the allowlist"}};try{l=await t(e.url)}catch(e){return{error:{source:a,code:"import-failed",message:S(e)}}}let i=e.export??"default",o=void 0!==(r=(n=l)[i])?r:"default"===i&&void 0!==n.panel?n.panel:void 0;return void 0===o?{error:{source:a,code:"export-missing",message:`No "${i}" export found`}}:"object"==typeof o&&null!==o&&"string"==typeof o.id&&0!==o.id.length&&"string"==typeof o.title&&"function"==typeof o.render&&(void 0===o.load||"function"==typeof o.load)&&(void 0===o.enabled||"function"==typeof o.enabled)&&(void 0===o.span||1===o.span||2===o.span)&&(void 0===o.surfaces||Array.isArray(o.surfaces))&&1?{panel:o}:{error:{source:a,code:"invalid-panel",message:"Export is not a valid PanelDefinition"}}}function S(e){return e instanceof Error?e.message:String(e)}var M=l;let P={hidden:[],settings:{}},C={load:()=>P,save:()=>{}};var _=e.i(93425);function z({panelId:e,spec:t,values:n,onChange:r,onReset:a,showReset:i=!0}){let o=(0,l.useId)(),c=Object.keys(t);return 0===c.length?null:(0,s.jsxs)("div",{className:"space-y-3","data-panel-settings":e,children:[c.map(e=>{let l=t[e];if(!l)return null;let a=`${o}-${e}`,i=l.label??e;return(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("label",{htmlFor:a,className:"text-xs font-medium text-fg",children:i}),"number"===l.type?(0,s.jsxs)("span",{className:"text-xs tabular-nums text-fg-muted",children:[String(n[e]),l.unit?` ${l.unit}`:""]}):null]}),"number"===l.type?(0,s.jsx)("input",{id:a,type:"range",className:"w-full accent-amber",min:l.min,max:l.max,step:l.step??1,value:Number(n[e]),onChange:t=>r(e,Number(t.target.value))}):null,"boolean"===l.type?(0,s.jsxs)("label",{htmlFor:a,className:"flex items-center gap-2 text-xs text-fg-muted",children:[(0,s.jsx)("input",{id:a,type:"checkbox",className:"accent-amber",checked:!!n[e],onChange:t=>r(e,t.target.checked)}),l.help??"Enabled"]}):null,"select"===l.type?(0,s.jsx)("select",{id:a,className:"w-full rounded-md border border-edge bg-ink px-2 py-1 text-xs text-fg",value:String(n[e]),onChange:t=>r(e,t.target.value),children:l.options.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label??e.value},e.value))}):null,"boolean"!==l.type&&l.help?(0,s.jsx)("p",{className:"text-[11px] leading-tight text-fg-muted",children:l.help}):null]},e)}),i?(0,s.jsx)("button",{type:"button",onClick:a,className:"text-[11px] text-fg-muted underline-offset-2 transition hover:text-amber hover:underline",children:"Reset to defaults"}):null]})}function R({panels:e,ctx:t,surface:n,revision:r=0}){let a=function(e,t){let s=(0,l.useMemo)(()=>{var t;let s;return(void 0)??(t=`uptimizr:dashboard:panels:${e}`,(s=window.localStorage?window.localStorage:null)?{load(){try{let e=s.getItem(t);return e?function(e){if(!e||"object"!=typeof e)return P;let t=Array.isArray(e.hidden)?e.hidden.filter(e=>"string"==typeof e):[],s={};if(e.settings&&"object"==typeof e.settings)for(let[t,n]of Object.entries(e.settings)){if(!n||"object"!=typeof n)continue;let e={};for(let[t,s]of Object.entries(n))("number"==typeof s||"boolean"==typeof s||"string"==typeof s)&&(e[t]=s);Object.keys(e).length>0&&(s[t]=e)}return{hidden:t,settings:s}}(JSON.parse(e)):P}catch{return P}},save(e){try{0===e.hidden.length&&0===Object.keys(e.settings).length?s.removeItem(t):s.setItem(t,JSON.stringify(e))}catch{}}}:C)},[void 0,e]),[n,r]=(0,l.useState)(P),[a,i]=(0,l.useState)(!1),o=(0,l.useRef)(t);o.current=t,(0,l.useEffect)(()=>{r(s.load()),i(!0)},[s]);let c=(0,l.useCallback)(e=>{r(e),s.save(e)},[s]),d=(0,l.useCallback)(e=>{r(t=>{if(t.hidden.includes(e))return t;let n={...t,hidden:[...t.hidden,e]};return s.save(n),n})},[s]),u=(0,l.useCallback)(e=>{r(t=>{if(!t.hidden.includes(e))return t;let n={...t,hidden:t.hidden.filter(t=>t!==e)};return s.save(n),n})},[s]),m=(0,l.useCallback)(()=>{r(e=>{if(0===e.hidden.length)return e;let t={...e,hidden:[]};return s.save(t),t})},[s]),x=(0,l.useCallback)((e,t,n)=>{r(l=>{let r={...l.settings[e]??{},[t]:n},a=function(e,t){let s={};if(!e)return s;for(let n of Object.keys(t)){let l=e[n];l&&t[n]!==l.default&&(s[n]=t[n])}return s}(o.current(e),r),i={...l.settings};Object.keys(a).length>0?i[e]=a:delete i[e];let c={...l,settings:i};return s.save(c),c})},[s]),p=(0,l.useCallback)(e=>{r(t=>{if(!t.settings[e])return t;let n={...t.settings};delete n[e];let l={...t,settings:n};return s.save(l),l})},[s]),h=(0,l.useCallback)(e=>n.settings[e]??{},[n]),g=(0,l.useCallback)(e=>n.hidden.includes(e),[n]);return{hydrated:a,hidden:n.hidden,isHidden:g,hide:d,show:u,showAll:m,overridesFor:h,setSetting:x,resetSettings:p,replace:c}}(n,(0,M.useCallback)(t=>e.find(e=>e.id===t)?.settings,[e])),i=(0,M.useMemo)(()=>e.filter(e=>(e.surfaces??["overview"]).includes(n)).map(e=>{let s=function(e,t){let s={};if(!e)return s;for(let n of Object.keys(e))s[n]=function(e,t){switch(e.type){case"number":var s,n;let l;if("number"!=typeof t||!Number.isFinite(t))return e.default;return s=e.min,n=e.max,l=t,"number"==typeof s&&l<s&&(l=s),"number"==typeof n&&l>n&&(l=n),l;case"boolean":return"boolean"==typeof t?t:e.default;case"select":if("string"!=typeof t)return e.default;return e.options.some(e=>e.value===t)?t:e.default}}(e[n],t?.[n]);return s}(e.settings,a.overridesFor(e.id));return{panel:e,panelCtx:{...t,settings:s}}}).filter(({panel:e,panelCtx:t})=>{if(!e.enabled)return!0;try{return e.enabled(t)}catch(t){return console.error(`Panel "${e.id}" enabled() threw; hiding it`,t),!1}}),[e,n,t,a]),o=a.hydrated?i.filter(({panel:e})=>!a.isHidden(e.id)):i,c=a.hydrated?i.filter(({panel:e})=>a.isHidden(e.id)):[];return(0,s.jsxs)(s.Fragment,{children:[c.length>0?(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(T,{hidden:c.map(({panel:e})=>({id:e.id,title:e.title})),onRestore:a.show,onRestoreAll:a.showAll})}):null,o.map(({panel:e,panelCtx:t})=>(0,s.jsx)("div",{className:2===e.span?"lg:col-span-2":void 0,children:(0,s.jsx)(A,{panel:e,ctx:t,revision:r,onHide:()=>a.hide(e.id),settingsForm:e.settings?(0,s.jsx)(z,{panelId:e.id,spec:e.settings,values:t.settings,onChange:(t,s)=>a.setSetting(e.id,t,s),onReset:()=>a.resetSettings(e.id)}):void 0})},e.id))]})}function T({hidden:e,onRestore:t,onRestoreAll:n}){return(0,s.jsxs)("section",{className:"flex flex-wrap items-center gap-2 rounded-xl border border-dashed border-edge bg-panel/60 px-4 py-2.5 text-xs text-fg-muted",children:[(0,s.jsxs)("span",{className:"font-medium uppercase tracking-wide",children:["Hidden panels (",e.length,")"]}),e.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>t(e.id),className:"rounded-md border border-edge px-2 py-1 text-fg transition hover:border-amber hover:text-fg-hi",children:["+ ",e.title]},e.id)),(0,s.jsx)("button",{type:"button",onClick:n,className:"ml-auto text-fg-muted underline-offset-2 transition hover:text-amber hover:underline",children:"Show all"})]})}function A({panel:e,ctx:t,revision:n,onHide:r,settingsForm:a}){let{data:i,loading:o,error:c}=function(e,t,s=0){let[n,r]=(0,l.useState)({data:null,loading:!!e.load,error:null}),a=JSON.stringify({params:t.params,settings:t.settings});return(0,l.useEffect)(()=>{if(!e.load)return void r({data:null,loading:!1,error:null});let s=!0,n=new AbortController;return r(e=>({...e,loading:!0,error:null})),e.load({...t,signal:n.signal}).then(e=>{s&&r({data:e,loading:!1,error:null})},e=>{s&&!n.signal.aborted&&r({data:null,loading:!1,error:e instanceof Error?e:Error(String(e))})}),()=>{s=!1,n.abort()}},[e,a,t.surface,t.sessionId,s]),n}(e,t,n),d="function"==typeof e.subtitle?e.subtitle(t):e.subtitle,u=o&&!!e.load&&null==i,m=function(){let[e,t]=(0,M.useState)(!1);return(0,M.useEffect)(()=>t(!0),[]),e}(),x=!e.clientOnly||m;return(0,s.jsx)(_.Panel,{title:e.title,subtitle:d,help:e.help,collapsible:e.collapsible,onHide:r,settings:a,children:x?c?(0,s.jsxs)("p",{className:"text-sm text-fg-muted",children:["Could not load: ",c.message]}):u?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"Loading…"}):(0,s.jsx)(E,{panelId:e.id,children:e.render({data:i,ctx:t})}):null})}class E extends M.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){console.error(`Panel "${this.props.panelId}" failed to render`,e)}componentDidUpdate(e){e.panelId!==this.props.panelId&&this.state.error&&this.setState({error:null})}render(){return this.state.error?(0,s.jsxs)("p",{className:"text-sm text-fg-muted",children:["Could not render: ",this.state.error.message]}):this.props.children}}var I=e.i(18637);function $({bins:e,cellSize:t}){let n=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let t=n.current;if(!t)return;let s=t.getContext("2d");if(!s||(s.clearRect(0,0,360,360),s.fillStyle="#0b0e14",s.fillRect(0,0,360,360),0===e.length))return;let l=1/0,r=-1/0,a=1/0,i=-1/0,o=0;for(let t of e)t.gx<l&&(l=t.gx),t.gx>r&&(r=t.gx),t.gz<a&&(a=t.gz),t.gz>i&&(i=t.gz),t.count>o&&(o=t.count);let c=344/Math.max(r-l+1,i-a+1);for(let t of e){s.fillStyle=f(o>0?t.count/o:0,.9);let e=8+(t.gx-l)*c,n=8+(i-t.gz)*c;s.fillRect(e,n,Math.ceil(c),Math.ceil(c))}},[e,t]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsxs)("div",{className:"relative inline-block",children:[(0,s.jsx)("canvas",{ref:n,width:360,height:360,className:"rounded-lg border border-edge","aria-label":"Floor-plan position heatmap"}),e.length>0?(0,s.jsx)(I.HeatLegend,{title:"Dwell density",lowLabel:"rarely",highLabel:"most",note:`${t} m cells`}):null]})}),0===e.length?(0,s.jsx)("p",{className:"mt-2 text-center text-xs text-fg-muted",children:"No camera-position data in range. Capture a first-person session to populate the plan."}):null]})}function D({points:e}){let t=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let s=t.current;if(!s)return;let n=s.getContext("2d");if(!n||(n.clearRect(0,0,360,360),n.fillStyle="#0b0e14",n.fillRect(0,0,360,360),0===e.length))return;let l=1/0,r=-1/0,a=1/0,i=-1/0;for(let t of e)t.gx<l&&(l=t.gx),t.gx>r&&(r=t.gx),t.gz<a&&(a=t.gz),t.gz>i&&(i=t.gz);let o=344/Math.max(r-l+1,i-a+1),c=(e,t)=>[8+(e-l+.5)*o,8+(i-t+.5)*o],d=function(e){let t=new Map;for(let s of e){let e=t.get(s.session_id);e||(e=[],t.set(s.session_id,e));let n=e[e.length-1];n&&n.gx===s.gx&&n.gz===s.gz||e.push({gx:s.gx,gz:s.gz})}return[...t.values()].map(e=>({cells:e}))}(e);for(let e of(n.lineWidth=2,n.lineJoin="round",n.lineCap="round",n.globalCompositeOperation="lighter",n.strokeStyle="rgba(251, 191, 36, 0.18)",d)){if(e.cells.length<2)continue;n.beginPath();let[t,s]=c(e.cells[0].gx,e.cells[0].gz);n.moveTo(t,s);for(let t=1;t<e.cells.length;t++){let[s,l]=c(e.cells[t].gx,e.cells[t].gz);n.lineTo(s,l)}n.stroke()}n.globalCompositeOperation="source-over"},[e]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)("canvas",{ref:t,width:360,height:360,className:"rounded-lg border border-edge","aria-label":"Aggregate desire-line paths"})}),0===e.length?(0,s.jsx)("p",{className:"mt-2 text-center text-xs text-fg-muted",children:"No camera-path data in range. Capture first-person sessions to populate the desire lines."}):null]})}let F={hover:"#60a5fa",pick:"#34d399",click:"#fbbf24",drag:"#f472b6",select:"#a78bfa",squeeze:"#fb7185",grab:"#22d3ee",release:"#94a3b8",teleport:"#f59e0b"};function L(e){return F[e]??"#64748b"}function O({rows:e,topN:t=8}){let n=function(e,t){let s=new Map;for(let t of e){let e=s.get(t.mesh);e||(e={mesh:t.mesh,total:0,kinds:[]},s.set(t.mesh,e)),e.kinds.push({kind:t.kind,count:t.count}),e.total+=t.count}let n=[...s.values()].sort((e,t)=>t.total-e.total).slice(0,t);for(let e of n)e.kinds.sort((e,t)=>t.count-e.count);return n}(e,t);if(0===n.length)return(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No mesh interactions in range."});let l=[...new Set(e.map(e=>e.kind))];return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("ul",{className:"space-y-2",children:n.map(e=>(0,s.jsxs)("li",{className:"text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"truncate font-mono text-xs text-fg",children:e.mesh}),(0,s.jsx)("span",{className:"tabular-nums text-fg-muted",children:b(e.total)})]}),(0,s.jsx)("div",{className:"mt-1 flex h-2 w-full overflow-hidden rounded bg-ink/60",children:e.kinds.map(t=>(0,s.jsx)("div",{className:"h-full",style:{width:`${e.total>0?t.count/e.total*100:0}%`,backgroundColor:L(t.kind)},title:`${t.kind}: ${b(t.count)}`},t.kind))})]},e.mesh))}),(0,s.jsx)("ul",{className:"flex flex-wrap gap-x-3 gap-y-1",children:l.map(e=>(0,s.jsxs)("li",{className:"flex items-center gap-1.5 text-xs text-fg-muted",children:[(0,s.jsx)("span",{className:"inline-block h-2 w-2 rounded-sm",style:{backgroundColor:L(e)}}),e]},e))})]})}let U={mouse:"#60a5fa",touch:"#34d399",stylus:"#a78bfa",pen:"#a78bfa","xr-controller":"#fbbf24",hand:"#f472b6",gaze:"#22d3ee",transient:"#fb7185",keyboard:"#f59e0b",gamepad:"#c084fc",other:"#94a3b8"};function B(e){return U[e]??"#64748b"}function H({buckets:e}){if(e.length<2)return(0,s.jsx)("span",{className:"text-[10px] text-fg-muted",children:"—"});let t=e.reduce((e,t)=>Math.max(e,t),0)||1;return(0,s.jsx)("div",{className:"flex h-5 items-end gap-px","aria-hidden":!0,children:e.map((e,n)=>(0,s.jsx)("div",{className:"w-1 rounded-sm bg-sky-400/70",style:{height:`${Math.max(8,e/t*100)}%`}},n))})}function G({delta:e}){return e>0?(0,s.jsxs)("span",{className:"tabular-nums text-xs text-emerald-400",children:["▲ ",b(e)]}):e<0?(0,s.jsxs)("span",{className:"tabular-nums text-xs text-rose-400",children:["▼ ",b(-e)]}):(0,s.jsx)("span",{className:"text-xs text-fg-muted",children:"—"})}function K({sources:e,trend:t,topN:n=8}){let l=function(e,t,s){let n=new Map;for(let t of e){let e=n.get(t.mesh);e||(e={total:0,sources:new Map},n.set(t.mesh,e)),e.total+=t.count,e.sources.set(t.source,(e.sources.get(t.source)??0)+t.count)}let l=new Map;for(let e of t){let t=l.get(e.mesh);t?t.push(e):l.set(e.mesh,[e])}return[...n.entries()].map(([e,t])=>{let s=(l.get(e)??[]).slice().sort((e,t)=>e.bucket-t.bucket).map(e=>e.count),n=Math.floor(s.length/2),r=s.slice(0,n).reduce((e,t)=>e+t,0),a=s.slice(n).reduce((e,t)=>e+t,0);return{mesh:e,total:t.total,sources:[...t.sources.entries()].map(([e,t])=>({source:e,count:t})).sort((e,t)=>t.count-e.count),buckets:s,delta:a-r}}).sort((e,t)=>t.total-e.total).slice(0,s)}(e,t,n);return 0===l.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No mesh interactions in range."}):(0,s.jsx)("ol",{className:"space-y-2",children:l.map((e,t)=>(0,s.jsx)("li",{className:"text-sm",children:(0,s.jsxs)("details",{className:"group",children:[(0,s.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3",children:[(0,s.jsx)("span",{className:"w-5 shrink-0 text-right tabular-nums text-xs text-fg-muted",children:t+1}),(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-fg",children:e.mesh}),(0,s.jsx)(H,{buckets:e.buckets}),(0,s.jsx)(G,{delta:e.delta}),(0,s.jsx)("span",{className:"w-12 shrink-0 text-right tabular-nums text-fg-muted",children:b(e.total)})]}),(0,s.jsx)("ul",{className:"mt-1.5 space-y-1 pl-8",children:e.sources.map(t=>(0,s.jsxs)("li",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-sm",style:{backgroundColor:B(t.source)}}),(0,s.jsx)("span",{className:"w-24 shrink-0 truncate text-fg-muted",children:t.source}),(0,s.jsx)("div",{className:"h-1.5 flex-1 overflow-hidden rounded bg-ink/60",children:(0,s.jsx)("div",{className:"h-full rounded",style:{width:`${e.total>0?t.count/e.total*100:0}%`,backgroundColor:B(t.source)}})}),(0,s.jsx)("span",{className:"w-10 shrink-0 text-right tabular-nums text-fg-muted",children:b(t.count)})]},t.source))})]})},e.mesh))})}let V={mouse:"#60a5fa",touch:"#34d399",stylus:"#a78bfa",pen:"#a78bfa","xr-controller":"#fbbf24",hand:"#f472b6",gaze:"#22d3ee",transient:"#fb7185",keyboard:"#f59e0b",gamepad:"#c084fc",other:"#94a3b8"};function W(e){return V[e]??"#64748b"}function X({sources:e,actions:t,topActions:n=8}){let l=function(e){let t=new Map;for(let s of e)t.set(s.source,(t.get(s.source)??0)+s.count);let s=[...t.values()].reduce((e,t)=>e+t,0);return[...t.entries()].map(([e,t])=>({source:e,count:t,share:s>0?t/s:0})).sort((e,t)=>t.count-e.count)}(e),r=t.slice(0,n);return 0===l.length&&0===r.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No input interactions in range."}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted",children:"Modality share"}),0===l.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No source-bearing interactions in range."}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex h-3 w-full overflow-hidden rounded bg-ink/60",children:l.map(e=>(0,s.jsx)("div",{className:"h-full",style:{width:`${100*e.share}%`,backgroundColor:W(e.source)},title:`${e.source}: ${b(e.count)}`},e.source))}),(0,s.jsx)("ul",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1",children:l.map(e=>(0,s.jsxs)("li",{className:"flex items-center gap-1.5 text-xs text-fg-muted",children:[(0,s.jsx)("span",{className:"inline-block h-2 w-2 rounded-sm",style:{backgroundColor:W(e.source)}}),e.source,(0,s.jsxs)("span",{className:"tabular-nums text-fg",children:[Math.round(100*e.share),"%"]})]},e.source))})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted",children:"Most-used shortcuts"}),0===r.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No input_action events in range."}):(0,s.jsx)("ul",{className:"space-y-1.5",children:r.map(e=>(0,s.jsxs)("li",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-sm",style:{backgroundColor:W(e.source)}}),(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-fg",children:e.action}),(0,s.jsx)("span",{className:"shrink-0 text-xs text-fg-muted",children:e.source}),(0,s.jsx)("span",{className:"w-12 shrink-0 text-right tabular-nums text-fg-muted",children:b(e.count)})]},`${e.action}/${e.source}`))})]})]})}function J({coverage:e,proxyMeshes:t,cellSize:n,topN:l=12}){if(0===t.length)return(0,s.jsxs)("div",{className:"space-y-2 text-sm text-fg-muted",children:[(0,s.jsx)("p",{children:"No scene proxy is registered, so there is no reference geometry to call “dead”."}),(0,s.jsx)("p",{children:"Register proxy geometry (ADR 0014) via the scene representation API to enumerate the regions visitors could approach."})]});if(0===e.length)return(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No camera-position samples in range — every region reads as dead. Widen the range or check that first-person camera samples are being captured."});let r=function(e,t,s,n=1){let l=s*n,r=t.slice(0,600).map(t=>{let n=0;for(let r of e)(function(e,t,s,n,l,r){let a=(e+.5)*n,i=(t+.5)*n,o=(s+.5)*n,[c,d,u,m,x,p]=l;return a>=c-r&&a<=m+r&&i>=d-r&&i<=x+r&&o>=u-r&&o<=p+r})(r.vx,r.vy,r.vz,s,t.aabb,l)&&(n+=r.count);return{mesh:t.name,path:t.path,nearbySamples:n,dead:0===n}});return r.sort((e,t)=>e.nearbySamples-t.nearbySamples),{rows:r,deadCount:r.filter(e=>e.dead).length,total:r.length}}(e,t,n),a=r.rows.reduce((e,t)=>Math.max(e,t.nearbySamples),0)||1,i=r.rows.slice(0,l);return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("p",{className:"text-xs text-fg-muted",children:[(0,s.jsx)("span",{className:"tabular-nums text-fg",children:b(r.deadCount)})," of"," ",(0,s.jsx)("span",{className:"tabular-nums text-fg",children:b(r.total)})," proxy meshes are dead (no nearby camera samples)."]}),(0,s.jsx)("ul",{className:"space-y-1.5",children:i.map(e=>(0,s.jsxs)("li",{className:"text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"truncate font-mono text-xs text-fg",title:e.path??e.mesh,children:e.mesh}),e.dead?(0,s.jsx)("span",{className:"shrink-0 rounded bg-rose-500/20 px-1.5 text-xs text-rose-300",children:"dead"}):(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-xs text-fg-muted",children:b(e.nearbySamples)})]}),(0,s.jsx)("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded bg-ink/60",children:(0,s.jsx)("div",{className:"h-full rounded bg-sky-500/70",style:{width:`${e.nearbySamples/a*100}%`}})})]},e.path??e.mesh))})]})}function q({label:e,value:t}){return(0,s.jsxs)("div",{className:"rounded-lg bg-ink/60 p-3",children:[(0,s.jsx)("div",{className:"text-xs uppercase tracking-wide text-fg-muted",children:e}),(0,s.jsx)("div",{className:"mt-1 text-2xl font-semibold tabular-nums text-fg-hi",children:t})]})}function Y({bins:e}){if(0===e.length)return(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No FPS samples in range."});let t=[...e].sort((e,t)=>e.bucket-t.bucket),n=t.reduce((e,t)=>Math.max(e,t.sessions),0)||1,l=t.length>1?t[1].bucket-t[0].bucket:10;return(0,s.jsx)("div",{className:"space-y-1.5",children:t.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsxs)("span",{className:"w-16 shrink-0 text-right tabular-nums text-fg-muted",children:[e.bucket,"–",e.bucket+l]}),(0,s.jsx)("div",{className:"h-4 flex-1 overflow-hidden rounded bg-ink/60",children:(0,s.jsx)("div",{className:"h-full rounded bg-emerald-500/70",style:{width:`${e.sessions/n*100}%`}})}),(0,s.jsx)("span",{className:"w-10 shrink-0 tabular-nums text-fg-muted",children:e.sessions})]},e.bucket))})}function Z({distribution:e,histogram:t}){return e&&0!==e.samples?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,s.jsx)(q,{label:"p05 FPS (worst)",value:b(e.p05_fps,1)}),(0,s.jsx)(q,{label:"p50 FPS (typical)",value:b(e.p50_fps,1)}),(0,s.jsx)(q,{label:"p95 FPS (best)",value:b(e.p95_fps,1)}),(0,s.jsx)(q,{label:"Sessions",value:b(e.sessions)})]}),(0,s.jsx)(Y,{bins:t})]}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No performance samples in range."})}function Q(e){return`${Math.round(100*e)}%`}function ee({data:e}){if(!e||0===e.samples)return(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No frame-perf samples in range."});let t=e.p50_fps>=50&&e.p50_render_scale>0&&e.p50_render_scale<.9,n=[{label:"Median FPS",value:b(Math.round(e.p50_fps))},{label:"Avg FPS",value:b(Math.round(e.avg_fps))},{label:"Median render scale",value:Q(e.p50_render_scale)},{label:"Avg render scale",value:Q(e.avg_render_scale)},{label:"Downscaled frames",value:Q(e.downscaled_share)},{label:"Samples",value:b(e.samples)}];return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3",children:n.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{className:"text-xs text-fg-muted",children:e.label}),(0,s.jsx)("dd",{className:"tabular-nums text-lg text-fg",children:e.value})]},e.label))}),t?(0,s.jsxs)("p",{className:"rounded-md border border-amber/40 bg-amber/10 px-3 py-2 text-xs text-amber",children:["Good FPS is being bought with resolution — the median frame renders at"," ",Q(e.p50_render_scale)," scale. The headline FPS overstates the device experience."]}):null]})}let et={orbit:"Orbit",pan:"Pan",dolly:"Dolly",zoom:"Zoom",roll:"Roll",fly:"Fly",navigate:"Navigate"};function es({stats:e}){let t=[...e].sort((e,t)=>t.gestures-e.gestures),n=t.reduce((e,t)=>e+t.gestures,0),l=t.reduce((e,t)=>Math.max(e,t.gestures),0);return 0===t.length||0===n?(0,s.jsxs)("p",{className:"text-sm text-fg-muted",children:["No camera-navigation gestures in range. Enable ",(0,s.jsx)("code",{children:"cameraGesture"})," capture in the SDK (on by default for Babylon) to populate this."]}):(0,s.jsx)("ul",{className:"space-y-3",children:t.map(e=>{var t,r;let a=n>0?e.gestures/n*100:0;return(0,s.jsxs)("li",{className:"text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"font-medium text-fg",children:et[t=e.kind]??t.charAt(0).toUpperCase()+t.slice(1)}),(0,s.jsxs)("span",{className:"tabular-nums text-fg-muted",children:[b(e.gestures),(0,s.jsxs)("span",{className:"ml-1 text-xs text-fg-muted",children:["· ",a.toFixed(0),"%"]}),(0,s.jsxs)("span",{className:"ml-2 text-xs text-fg-muted",children:["avg ",!Number.isFinite(r=e.avg_ms)||r<=0?"0 ms":r<1e3?`${Math.round(r)} ms`:`${(r/1e3).toFixed(r<1e4?2:1)} s`]})]})]}),(0,s.jsx)("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded bg-ink/60",children:(0,s.jsx)("div",{className:"h-full rounded bg-amber",style:{width:`${l>0?e.gestures/l*100:0}%`}})})]},e.kind)})})}let en="#161210",el={fontSize:13,color:"#a8917c"},er={padding:"6px 10px",fontSize:13,borderTop:"1px solid #34291f"};function ea({sessions:e,onSelect:t,selectedId:n}){return 0===e.length?(0,s.jsx)("p",{style:el,children:"No sessions in range."}):(0,s.jsx)("div",{style:{maxHeight:320,overflow:"auto"},children:(0,s.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",textAlign:"left"},children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{style:{fontSize:11,textTransform:"uppercase",color:"#a8917c"},children:[(0,s.jsx)("th",{style:{padding:"6px 10px"},children:"Session"}),(0,s.jsx)("th",{style:{padding:"6px 10px"},children:"Visitor"}),(0,s.jsx)("th",{style:{padding:"6px 10px",textAlign:"right"},children:"Events"}),(0,s.jsx)("th",{style:{padding:"6px 10px"},children:"Started"})]})}),(0,s.jsx)("tbody",{children:e.map(e=>{var l;let r,a=e.session_id===n;return(0,s.jsxs)("tr",{onClick:t?()=>t(e.session_id):void 0,style:{cursor:t?"pointer":"default",background:a?"rgba(237,166,62,0.15)":void 0},children:[(0,s.jsx)("td",{style:{...er,fontFamily:"ui-monospace, monospace",color:"#d8c8b8"},children:e.session_id.slice(0,12)}),(0,s.jsx)("td",{style:{...er,fontFamily:"ui-monospace, monospace",color:"#a8917c"},children:e.visitor_id.slice(0,8)}),(0,s.jsx)("td",{style:{...er,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:b(e.events)}),(0,s.jsx)("td",{style:{...er,fontSize:12,color:"#a8917c"},children:Number.isNaN((r=new Date((l=e.started_at).includes("T")?l:l.replace(" ","T")+"Z")).getTime())?l:r.toLocaleString()})]},e.session_id)})})]})})}function ei({bins:e,gridSize:t,size:n=320,className:r,style:a}){let i=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let s=i.current;if(!s)return;let l=s.getContext("2d");l&&function(e,t,s,n){if(e.clearRect(0,0,n,n),e.fillStyle=en,e.fillRect(0,0,n,n),0===t.length)return;let l=t.reduce((e,t)=>Math.max(e,t.count),0),r=n/s;for(let s of t)e.fillStyle=f(l>0?s.count/l:0,.85),e.fillRect(s.gx*r,s.gy*r,Math.ceil(r),Math.ceil(r))}(l,e,t,n)},[e,t,n]),(0,s.jsx)("canvas",{ref:i,width:n,height:n,className:r,style:a,"aria-label":"Pointer heatmap"})}function eo({bins:e,gridSize:t,size:n=340,className:r,style:a}){let i=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let s=i.current;if(!s)return;let l=s.getContext("2d");if(!l)return;let r=Math.min(window.devicePixelRatio||1,2);s.width=n*r,s.height=n*r,l.setTransform(r,0,0,r,0,0),function(e,t,s,n){let l=n/2,r=n/2,a=n/2-18;if(e.clearRect(0,0,n,n),e.fillStyle=en,e.fillRect(0,0,n,n),e.strokeStyle="#34291f",e.lineWidth=1,e.beginPath(),e.arc(l,r,a,0,2*Math.PI),e.stroke(),e.beginPath(),e.arc(l,r,a/2,0,2*Math.PI),e.stroke(),t.length>0){let n=t.reduce((e,t)=>Math.max(e,t.count),0),i=2*Math.PI/s;for(let o of t){let t=n>0?o.count/n:0,c=1-(o.elevation_bin+1)/s,d=1-o.elevation_bin/s,u=Math.max(0,c)*a,m=Math.max(0,d)*a,x=o.azimuth_bin*i,p=x+i;e.beginPath(),e.arc(l,r,m,x,p),e.arc(l,r,u,p,x,!0),e.closePath(),e.fillStyle=f(t,.85),e.fill()}}let i=(t,s,n)=>{e.lineWidth=3,e.strokeStyle="rgba(22,18,16,0.9)",e.strokeText(t,s,n),e.fillStyle="#d8c8b8",e.fillText(t,s,n)};for(let t of(e.font="600 10px ui-sans-serif, system-ui, sans-serif",e.textAlign="left",e.textBaseline="middle",e.strokeStyle="rgba(203,213,225,0.35)",e.lineWidth=1,e.beginPath(),e.moveTo(l,r),e.lineTo(l,r-a),e.stroke(),[0,a/2,a]))e.beginPath(),e.moveTo(l-3,r-t),e.lineTo(l+3,r-t),e.stroke();i("up",l+6,r),i("horizon",l+6,r-a/2),i("down",l+6,r-a+2)}(l,e,t,n)},[e,t,n]),(0,s.jsx)("canvas",{ref:i,className:r,style:{width:n,height:n,...a},"aria-label":"Camera view-direction heatmap: top-down polar plot where the center is looking up, the middle ring is the horizon, and the rim is looking down; color shows how often each direction was viewed."})}let ec={background:"rgba(32,25,19,0.6)",borderRadius:8,padding:12},ed={fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"#a8917c"},eu={marginTop:4,fontSize:24,fontWeight:600,color:"#f4eadf",fontVariantNumeric:"tabular-nums"};function em({label:e,value:t}){return(0,s.jsxs)("div",{style:ec,children:[(0,s.jsx)("div",{style:ed,children:e}),(0,s.jsx)("div",{style:eu,children:t})]})}function ex({perf:e}){return e&&0!==e.samples?(0,s.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:12},children:[(0,s.jsx)(em,{label:"Samples",value:b(e.samples)}),(0,s.jsx)(em,{label:"Avg FPS",value:b(e.avg_fps,1)}),(0,s.jsx)(em,{label:"p50 FPS",value:b(e.p50_fps,1)}),(0,s.jsx)(em,{label:"Min FPS",value:b(e.min_fps,1)})]}):(0,s.jsx)("p",{style:el,children:"No performance samples in range."})}function ep({bins:e,gridSize:t}){return(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(ei,{bins:e,gridSize:t,className:"rounded-lg border border-edge"})})}function eh({meshes:e}){let t=e.reduce((e,t)=>Math.max(e,t.count),0);return 0===e.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No mesh interactions in range."}):(0,s.jsx)("ul",{className:"space-y-1.5",children:e.map(e=>(0,s.jsxs)("li",{className:"text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"truncate font-mono text-xs text-fg",children:e.mesh}),(0,s.jsx)("span",{className:"tabular-nums text-fg-muted",children:b(e.count)})]}),(0,s.jsx)("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded bg-ink/60",children:(0,s.jsx)("div",{className:"h-full rounded bg-amber",style:{width:`${t>0?e.count/t*100:0}%`}})})]},e.mesh))})}var eg=e.i(37215);let ef=(0,l.lazy)(()=>e.A(78573).then(e=>({default:e.CameraDome3DView}))),eb=(0,l.lazy)(()=>e.A(47410).then(e=>({default:e.WorldHeatmap3DView}))),ev=(0,l.lazy)(()=>e.A(70162).then(e=>({default:e.FlowSankey3DView}))),ej=(0,l.lazy)(()=>e.A(21269).then(e=>({default:e.GazeClickDivergence3DView})));function ey({children:e}){return(0,s.jsx)(l.Suspense,{fallback:(0,s.jsx)("div",{className:"grid min-h-[12rem] place-items-center text-sm text-fg-muted",children:"Loading 3D view…"}),children:e})}function ew(e){return"session"===e.surface&&e.sessionId?{...e.params,session:e.sessionId}:e.params}async function eN(e){let t=e.params.scene;if(t){let s=await e.api.sceneRepresentation(t).catch(()=>null);return s?.proxy?.meshes??[]}return(0,v.mergeSceneProxies)(e.api,e.params)}let ek=[{id:"top-meshes",title:"Top meshes",subtitle:"Most-interacted meshes",span:1,surfaces:["overview","session"],settings:{limit:{type:"number",label:"Top N",help:"How many meshes to rank in the list.",default:25,min:5,max:100,step:5}},load:e=>e.api.topMeshes({...ew(e),source:void 0,scene:void 0,limit:e.settings.limit}),render:({data:e})=>(0,s.jsx)(eh,{meshes:e??[]})},{id:"mesh-leaderboard",title:"Part-popularity leaderboard",subtitle:"Ranked meshes, with trend and input split",help:"The most-interacted meshes ranked by total active interactions (clicks / hovers / picks / drags — passive gaze is excluded), each with a trend sparkline (rising/falling over the range) and an input-source split (mouse / touch / XR / …). Expand a row to see which sources drove it. Unlike the plain Top-meshes list, gaze-only hits don't inflate the ranking.",span:1,surfaces:["overview","session"],load:async e=>{let[t,s]=await Promise.all([e.api.topMeshesBySource({...ew(e),source:void 0,limit:400}),e.api.topMeshesTrend({...ew(e),source:void 0,interval:function(e){let{since:t,until:s}=e.params;return null==t||null==s||s<=t?3600:x(s-t,24)}(e),limit:2e3})]);return{sources:t,trend:s}},render:({data:e})=>(0,s.jsx)(K,{sources:e.sources??[],trend:e.trend??[]})},{id:"pointer-heatmap",title:"Pointer heatmap",subtitle:"Normalized screen positions",span:1,surfaces:["overview","session"],clientOnly:!0,settings:{bins:{type:"number",label:"Grid resolution",help:"Bins per axis for the 2D pointer grid. More bins sharpen detail; fewer smooth the heat.",default:50,min:10,max:120,step:10}},load:e=>e.api.pointerHeatmap({...ew(e),bins:e.settings.bins}),render:({data:e,ctx:t})=>(0,s.jsx)(ep,{bins:e??[],gridSize:t.settings.bins})},{id:"camera-dome-3d",title:eg.CAMERA_DOME_TITLE,subtitle:eg.CAMERA_DOME_SUBTITLE,span:2,surfaces:["overview","session"],clientOnly:!0,settings:{bins:{type:"number",label:"Direction resolution",help:"Angular bins for the view-direction dome. More bins resolve finer look-directions; fewer aggregate them.",default:36,min:12,max:72,step:6}},load:e=>e.api.cameraHeatmap({...ew(e),source:void 0,bins:e.settings.bins}),render:({data:e,ctx:t})=>(0,s.jsx)(ey,{children:(0,s.jsx)(ef,{bins:e??[],gridSize:t.settings.bins})})},{id:"floor-plan",title:"Floor-plan heatmap",subtitle:"Where visitors stand (top-down, first-person)",help:"Camera positions binned on the ground plane — the first-person counterpart of the pointer heatmap. Filter to the first-person camera mode to isolate walkable sessions.",span:1,surfaces:["overview","session"],clientOnly:!0,settings:{cellSize:{type:"number",label:"Cell size",help:"Ground-plane bin size in world units. Larger cells smooth the dwell heat; smaller cells sharpen spatial resolution.",default:1,min:.25,max:5,step:.25,unit:"m"}},enabled:e=>"viewer"!==e.filters.cameraMode,load:e=>e.api.cameraPositionHeatmap({...ew(e),cellSize:e.settings.cellSize}),render:({data:e,ctx:t})=>(0,s.jsx)($,{bins:e??[],cellSize:t.settings.cellSize})},{id:"desire-lines",title:"Desire lines",subtitle:"The routes visitors actually walk",help:"Every session's camera path, binned onto the ground plane and overlaid as a faint poly-line. Where many visitors walk the same way the lines pile up into bright 'desire lines' — the routes people take vs. the ones the scene intended. Filter to the first-person camera mode to isolate walkable sessions.",span:1,surfaces:["overview"],clientOnly:!0,enabled:e=>"viewer"!==e.filters.cameraMode,load:e=>e.api.aggregatePaths({...ew(e),cellSize:1}),render:({data:e})=>(0,s.jsx)(D,{points:e??[]})},{id:"mesh-interaction-kinds",title:"Interaction kinds",subtitle:"How visitors act on each mesh",help:"Per-mesh breakdown of interaction kinds (hover, pick, click, drag, …) from mesh_interaction events. The dwell ranking says which objects draw attention; this says how people act on them — a hovered-but-never-picked mesh reads very differently from a dragged one.",span:1,surfaces:["overview","session"],load:e=>e.api.meshKinds({...ew(e),limit:200}),render:({data:e})=>(0,s.jsx)(O,{rows:e??[]})},{id:"input-modality-split",title:"Input-modality split",subtitle:"Keyboard / gamepad / touch / XR — and top shortcuts",help:"How visitors drive the experience: the share of interactions per input source (mouse / touch / keyboard / gamepad / XR), from the input-source breakdown (ADR 0011), paired with the most-used app-level shortcuts/actions from input_action events (ADR 0023).",span:1,surfaces:["overview","session"],load:async e=>{let[t,s]=await Promise.all([e.api.interactionsBySource({...ew(e),source:void 0,limit:100}),e.api.topInputActions({...ew(e),source:void 0,limit:50})]);return{sources:t,actions:s}},render:({data:e})=>(0,s.jsx)(X,{sources:e.sources??[],actions:e.actions??[]})},{id:"render-scale-truth",title:"Render-scale truth",subtitle:"Is that FPS real, or downscaled?",help:"Adaptive renderers keep frame rate up by quietly dropping resolution. This pairs the FPS headline with the render scale that bought it, and flags the 'good FPS at a low render scale' case where the headline overstates the real device experience.",span:1,surfaces:["overview","session"],load:e=>e.api.renderScale(ew(e)),render:({data:e})=>(0,s.jsx)(ee,{data:e})},{id:"perf-distribution",title:"Performance distribution",subtitle:"p05 / p50 / p95 FPS bands, not just the average",help:"The shape of rendering performance, not a single average: p05 (worst), p50 (typical) and p95 (best) FPS computed per-session then aggregated (ADR 0028 §1), plus a histogram of per-session median FPS. One session contributes one data point, so a few chatty sessions can't skew the curve.",span:1,surfaces:["overview","session"],load:async e=>{let[t,s]=await Promise.all([e.api.perfDistribution(ew(e)),e.api.fpsHistogram(ew(e))]);return{distribution:t,histogram:s}},render:({data:e})=>(0,s.jsx)(Z,{distribution:e.distribution,histogram:e.histogram??[]})},{id:"world-heatmap-3d",title:eg.WORLD_HEATMAP_TITLE,subtitle:eg.WORLD_HEATMAP_SUBTITLE,span:2,surfaces:["overview","session"],clientOnly:!0,settings:{cellSize:{type:"number",label:"Voxel size",help:"World-space voxel size for binning pointer hits. Larger voxels smooth the heat; smaller ones sharpen spatial detail.",default:.5,min:.1,max:2,step:.1,unit:"m"}},load:async e=>{let[t,s,n]=await Promise.all([e.api.worldHeatmap({...ew(e),cellSize:e.settings.cellSize}),eN(e),e.api.worldHeatmapStats({...ew(e),cellSize:e.settings.cellSize})]);return{voxels:t,proxyMeshes:s,totals:{cells:n.cells,hits:n.hits}}},render:({data:e,ctx:t})=>(0,s.jsx)(ey,{children:(0,s.jsx)(eb,{voxels:e.voxels,cellSize:t.settings.cellSize,proxyMeshes:e.proxyMeshes,totals:e.totals})})},{id:"navigation-mix",title:"Navigation-style mix",subtitle:"Orbit / pan / dolly / zoom / roll / fly share + avg gesture duration",span:1,surfaces:["overview","session"],load:e=>e.api.cameraGestures({...ew(e),source:void 0}),render:({data:e})=>(0,s.jsx)(es,{stats:e??[]})},{id:"dead-zone-report",title:"Dead-zone report",subtitle:"Scene parts visitors never approach",help:"The negative space: registered proxy meshes (ADR 0014) with near-zero camera proximity, computed by subtracting the occupied camera-position voxels (scene coverage) from the scene's proxy geometry. Ranked coldest first. Requires a registered scene proxy to know which regions could be visited.",span:1,surfaces:["overview","session"],load:async e=>{let[t,s]=await Promise.all([e.api.coverage({...ew(e),cellSize:1}),eN(e)]);return{coverage:t,proxyMeshes:s}},render:({data:e})=>(0,s.jsx)(J,{coverage:e.coverage??[],proxyMeshes:e.proxyMeshes??[],cellSize:1})},{id:"flow-sankey-3d",title:eg.FLOW_SANKEY_TITLE,subtitle:eg.FLOW_SANKEY_SUBTITLE,help:eg.FLOW_SANKEY_HELP,span:2,surfaces:["overview","session"],clientOnly:!0,settings:{maxLinks:{type:"number",label:"Max links",help:"Maximum aggregate flow links drawn before the panel caps for legibility.",default:80,min:10,max:200,step:10}},load:async e=>{let t={...ew(e),cameraMode:void 0},[s,n]=await Promise.all([e.api.flowHeatmap({...t,bins:36,limit:400,groupByOrigin:!0}),eN(e)]);return{links:s,proxyMeshes:n,flowQuery:t}},render:({data:e,ctx:t})=>(0,s.jsx)(ey,{children:(0,s.jsx)(ev,{links:e.links,gridSize:36,proxyMeshes:e.proxyMeshes,maxLinks:t.settings.maxLinks,baseUrl:t.baseUrl,apiKey:t.apiKey,flowQuery:e.flowQuery,hasFirstPerson:t.capabilities.hasFirstPerson})})},{id:"gaze-click-divergence-3d",title:eg.GAZE_CLICK_TITLE,subtitle:eg.GAZE_CLICK_SUBTITLE,span:2,surfaces:["overview","session"],clientOnly:!0,settings:{cellSize:{type:"number",label:"Voxel size",help:"Shared world-space voxel size for both the gaze and click grids, so the divergence field stays aligned.",default:.5,min:.1,max:2,step:.1,unit:"m"}},load:async e=>{let[t,s,n]=await Promise.all([e.api.gazeHeatmap({...ew(e),source:void 0,cellSize:e.settings.cellSize}),e.api.worldHeatmap({...ew(e),cellSize:e.settings.cellSize}),eN(e)]);return{gaze:t,click:s,proxyMeshes:n}},render:({data:e,ctx:t})=>(0,s.jsx)(ey,{children:(0,s.jsx)(ej,{gazeVoxels:e.gaze,clickVoxels:e.click,cellSize:t.settings.cellSize,proxyMeshes:e.proxyMeshes})})}];function eS(e){return e?e.split(",").map(e=>e.trim()).filter(e=>e.length>0):[]}let eM={panels:[],errors:[],loading:!1};function eP({errors:e}){let[t,n]=(0,l.useState)(!1);return 0===e.length||t?null:(0,s.jsxs)("section",{className:"rounded-xl border border-dashed border-amber/60 bg-panel/60 px-4 py-3 text-xs text-fg-muted",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("span",{className:"font-medium uppercase tracking-wide text-fg",children:[e.length," panel",1===e.length?"":"s"," failed to load"]}),(0,s.jsx)("button",{type:"button",onClick:()=>n(!0),className:"text-fg-muted underline-offset-2 transition hover:text-amber hover:underline",children:"Dismiss"})]}),(0,s.jsx)("ul",{className:"mt-2 space-y-1",children:e.map((e,t)=>(0,s.jsxs)("li",{className:"font-mono",children:[(0,s.jsx)("span",{className:"text-fg",children:e.source}),(0,s.jsxs)("span",{className:"text-fg-muted",children:[" ","— [",e.code,"] ",e.message]})]},`${e.source}-${t}`))})]})}function eC({bins:e,gridSize:t}){return(0,s.jsx)(_.Panel,{title:"View-direction heatmap",subtitle:"Top-down sphere — center = looking up, rim = looking down",help:(0,s.jsxs)(s.Fragment,{children:["A flattened top-down view of where the camera pointed."," ",(0,s.jsx)("strong",{children:"Distance from the center"})," is the up/down tilt: the ",(0,s.jsx)("strong",{children:"center"})," ","is looking straight up, the ",(0,s.jsx)("strong",{children:"middle ring"})," is the horizon (level), and the"," ",(0,s.jsx)("strong",{children:"outer rim"})," is looking straight down. The"," ",(0,s.jsx)("strong",{children:"angle around the disc"})," is the facing (azimuth) direction. Color shows how often each direction was viewed, normalized to the most-viewed direction in range."]}),children:(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,s.jsx)(eo,{bins:e,gridSize:t,className:"rounded-lg border border-edge"}),e.length>0?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-fg-muted",children:[(0,s.jsx)("span",{className:"font-medium text-fg",children:"View density"}),(0,s.jsx)("span",{children:"rarely"}),(0,s.jsx)("span",{className:"h-2 w-28 rounded-sm",style:{background:g.HEAT_GRADIENT}}),(0,s.jsx)("span",{children:"most-viewed"})]}):null]})})}function e_(e){return null==e?"":new Date(e-6e4*new Date(e).getTimezoneOffset()).toISOString().slice(0,16)}function ez(e){if(!e)return;let t=new Date(e).getTime();return Number.isNaN(t)?void 0:t}function eR({filters:e,scenes:t,onChange:n,busy:l}){let r=t=>n({...e,...t});return(0,s.jsxs)("section",{className:"mb-6 flex flex-wrap items-end gap-x-4 gap-y-3 rounded-xl border border-edge bg-panel p-4",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{className:"text-xs text-fg-muted",children:"Time window"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Time window",children:[o.map(t=>{let n=e.window===t.id;return(0,s.jsx)("button",{type:"button",onClick:()=>r({window:t.id}),className:`rounded-md border px-2.5 py-1.5 text-xs transition ${n?"border-amber bg-amber/10 text-saffron":"border-edge text-fg hover:border-amber/60 hover:text-fg-hi"}`,children:t.label},t.id)}),(0,s.jsx)("button",{type:"button",onClick:()=>r({window:"custom",since:e.since??Date.now()-864e5,until:e.until??Date.now()}),className:`rounded-md border px-2.5 py-1.5 text-xs transition ${"custom"===e.window?"border-amber bg-amber/10 text-saffron":"border-edge text-fg hover:border-amber/60 hover:text-fg-hi"}`,children:"Custom"})]})]}),"custom"===e.window?(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-fg-muted",children:["From",(0,s.jsx)("input",{type:"datetime-local",value:e_(e.since),onChange:e=>r({since:ez(e.target.value)}),className:"rounded-md border border-edge bg-ink px-2 py-1.5 text-xs text-fg outline-none focus:border-saffron"})]}),(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-fg-muted",children:["To",(0,s.jsx)("input",{type:"datetime-local",value:e_(e.until),onChange:e=>r({until:ez(e.target.value)}),className:"rounded-md border border-edge bg-ink px-2 py-1.5 text-xs text-fg outline-none focus:border-saffron"})]})]}):null,(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-fg-muted",children:["Scene",(0,s.jsxs)("select",{value:e.scene??"",onChange:e=>r({scene:e.target.value||void 0}),className:"min-w-40 rounded-md border border-edge bg-ink px-2 py-1.5 text-xs text-fg outline-none focus:border-saffron",children:[(0,s.jsx)("option",{value:"",children:"All scenes"}),t.map(e=>(0,s.jsxs)("option",{value:e.scene_id,children:[e.scene_id," (",e.events.toLocaleString(),")"]},e.scene_id))]})]}),(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-fg-muted",children:["Input source",(0,s.jsxs)("select",{value:e.source??"",onChange:e=>r({source:e.target.value||void 0}),className:"min-w-36 rounded-md border border-edge bg-ink px-2 py-1.5 text-xs text-fg outline-none focus:border-saffron",children:[(0,s.jsx)("option",{value:"",children:"All sources"}),h.map(e=>(0,s.jsx)("option",{value:e,children:p(e)},e))]})]}),(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-fg-muted",children:["Camera mode",(0,s.jsxs)("select",{value:e.cameraMode??"",onChange:e=>r({cameraMode:e.target.value||void 0}),className:"min-w-36 rounded-md border border-edge bg-ink px-2 py-1.5 text-xs text-fg outline-none focus:border-saffron",children:[(0,s.jsx)("option",{value:"",children:"All cameras"}),(0,s.jsx)("option",{value:"viewer",children:"Viewer (orbit)"}),(0,s.jsx)("option",{value:"first-person",children:"First-person (walk)"})]})]}),(0,s.jsx)("span",{className:`ml-auto text-xs ${l?"text-saffron":"text-fg-muted"}`,"aria-live":"polite",children:l?"Refreshing…":"Up to date"})]})}function eT({rows:e}){let t=function(e){let t=new Map;for(let s of e){let e=t.get(s.source);e||(e={source:s.source,total:0,sessions:0,byType:[]},t.set(s.source,e)),e.total+=s.count,e.sessions=Math.max(e.sessions,s.sessions),e.byType.push({event_type:s.event_type,count:s.count})}for(let e of t.values())e.byType.sort((e,t)=>t.count-e.count);return[...t.values()].sort((e,t)=>t.total-e.total)}(e),n=t.reduce((e,t)=>Math.max(e,t.total),0);return(0,s.jsx)(_.Panel,{title:"Input sources",subtitle:"Interactions by input source",children:0===t.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No source-bearing interactions in range."}):(0,s.jsx)("ul",{className:"space-y-3",children:t.map(e=>(0,s.jsxs)("li",{className:"text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"font-medium text-fg",children:p(e.source)}),(0,s.jsxs)("span",{className:"tabular-nums text-fg-muted",children:[b(e.total),(0,s.jsxs)("span",{className:"ml-1 text-xs text-fg-muted",children:["· ",b(e.sessions)," ",1===e.sessions?"session":"sessions"]})]})]}),(0,s.jsx)("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded bg-ink/60",children:(0,s.jsx)("div",{className:"h-full rounded bg-amber",style:{width:`${n>0?e.total/n*100:0}%`}})}),(0,s.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:e.byType.map(e=>{let t;return(0,s.jsxs)("span",{className:"rounded bg-ink/60 px-1.5 py-0.5 font-mono text-[11px] text-fg-muted",children:[(t=e.event_type.replace(/_/g," ")).charAt(0).toUpperCase()+t.slice(1)," ",b(e.count)]},e.event_type)})})]},e.source))})})}function eA({perf:e}){return(0,s.jsx)(_.Panel,{title:"Rendering performance",subtitle:"frame_perf samples",children:(0,s.jsx)(ex,{perf:e})})}function eE({label:e,value:t,unit:n}){return(0,s.jsxs)("div",{className:"rounded-lg bg-ink/60 p-3",children:[(0,s.jsx)("div",{className:"text-xs uppercase tracking-wide text-fg-muted",children:e}),(0,s.jsxs)("div",{className:"mt-1 text-2xl font-semibold tabular-nums text-fg-hi",children:[t,n?(0,s.jsx)("span",{className:"ml-1 text-sm font-normal text-fg-muted",children:n}):null]})]})}function eI(e){return b(e/1048576,1)}function e$({bins:e}){if(0===e.length)return(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No FPS samples in range."});let t=[...e].sort((e,t)=>e.bucket-t.bucket),n=t.reduce((e,t)=>Math.max(e,t.sessions),0)||1,l=t.length>1?t[1].bucket-t[0].bucket:10;return(0,s.jsx)("div",{className:"space-y-1.5",children:t.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsxs)("span",{className:"w-16 shrink-0 text-right tabular-nums text-fg-muted",children:[e.bucket,"–",e.bucket+l]}),(0,s.jsx)("div",{className:"h-4 flex-1 overflow-hidden rounded bg-ink/60",children:(0,s.jsx)("div",{className:"h-full rounded bg-emerald-500/70",style:{width:`${e.sessions/n*100}%`}})}),(0,s.jsx)("span",{className:"w-10 shrink-0 tabular-nums text-fg-muted",children:e.sessions})]},e.bucket))})}function eD({data:e}){let{distribution:t,histogram:n,frameTime:l,jank:r,byDevice:a,byScene:i,resources:o,stability:c}=e,d=(t?.samples??0)>0;return(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold uppercase tracking-wide text-fg-muted",children:"Performance"}),(0,s.jsx)(_.Panel,{title:"FPS distribution",subtitle:"per-session p05 / p50 / p95, summarized across sessions",children:d?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,s.jsx)(eE,{label:"p05 FPS (worst)",value:b(t.p05_fps,1)}),(0,s.jsx)(eE,{label:"p50 FPS (typical)",value:b(t.p50_fps,1)}),(0,s.jsx)(eE,{label:"p95 FPS (best)",value:b(t.p95_fps,1)}),(0,s.jsx)(eE,{label:"Sessions",value:b(t.sessions)})]}),(0,s.jsx)(e$,{bins:n})]}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No performance samples in range."})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[(0,s.jsx)(_.Panel,{title:"Frame time",subtitle:"per-session median & worst-window p95",children:l&&0!==l.sessions?(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsx)(eE,{label:"p50 frame time",value:b(l.p50_ms,1),unit:"ms"}),(0,s.jsx)(eE,{label:"p95 frame time",value:b(l.p95_ms,1),unit:"ms"})]}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No frame-time samples in range."})}),(0,s.jsx)(_.Panel,{title:"Jank",subtitle:"long frames per sample window",children:r&&0!==r.sessions?(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsx)(eE,{label:"Median session",value:b(r.median_rate,2)}),(0,s.jsx)(eE,{label:"Worst decile",value:b(r.worst_decile_rate,2)})]}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No jank data in range."})})]}),(0,s.jsx)(_.Panel,{title:"FPS by device",subtitle:"per-session median FPS, by session_start.device + UA-derived browser/OS",children:0===a.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No device data in range."}):(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full text-left text-sm",children:[(0,s.jsx)("thead",{className:"text-xs uppercase tracking-wide text-fg-muted",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"py-1 pr-4 font-medium",children:"Backend"}),(0,s.jsx)("th",{className:"py-1 pr-4 font-medium",children:"Browser"}),(0,s.jsx)("th",{className:"py-1 pr-4 font-medium",children:"OS"}),(0,s.jsx)("th",{className:"py-1 pr-4 font-medium",children:"Mobile"}),(0,s.jsx)("th",{className:"py-1 pr-4 font-medium",children:"GPU"}),(0,s.jsx)("th",{className:"py-1 pr-4 text-right font-medium",children:"Sessions"}),(0,s.jsx)("th",{className:"py-1 text-right font-medium",children:"p50 FPS"})]})}),(0,s.jsx)("tbody",{className:"text-fg",children:a.map((e,t)=>(0,s.jsxs)("tr",{className:"border-t border-ink/60",children:[(0,s.jsx)("td",{className:"py-1 pr-4",children:e.engine||"—"}),(0,s.jsx)("td",{className:"py-1 pr-4",children:e.browser||"—"}),(0,s.jsx)("td",{className:"py-1 pr-4",children:e.os||"—"}),(0,s.jsx)("td",{className:"py-1 pr-4",children:"true"===e.is_mobile?"yes":"no"}),(0,s.jsx)("td",{className:"py-1 pr-4 max-w-[16rem] truncate",title:e.renderer,children:e.renderer||"—"}),(0,s.jsx)("td",{className:"py-1 pr-4 text-right tabular-nums",children:b(e.sessions)}),(0,s.jsx)("td",{className:"py-1 text-right tabular-nums",children:b(e.p50_fps,1)})]},`${e.engine}|${e.browser}|${e.os}|${e.is_mobile}|${e.renderer}|${t}`))})]})})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[(0,s.jsx)(_.Panel,{title:"FPS by scene",subtitle:"per-session median FPS per scene",children:0===i.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No scene data in range."}):(0,s.jsxs)("table",{className:"w-full text-left text-sm",children:[(0,s.jsx)("thead",{className:"text-xs uppercase tracking-wide text-fg-muted",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"py-1 pr-4 font-medium",children:"Scene"}),(0,s.jsx)("th",{className:"py-1 pr-4 text-right font-medium",children:"Sessions"}),(0,s.jsx)("th",{className:"py-1 text-right font-medium",children:"p50 FPS"})]})}),(0,s.jsx)("tbody",{className:"text-fg",children:i.map(e=>(0,s.jsxs)("tr",{className:"border-t border-ink/60",children:[(0,s.jsx)("td",{className:"py-1 pr-4",children:e.scene_id||"—"}),(0,s.jsx)("td",{className:"py-1 pr-4 text-right tabular-nums",children:b(e.sessions)}),(0,s.jsx)("td",{className:"py-1 text-right tabular-nums",children:b(e.p50_fps,1)})]},e.scene_id))})]})}),(0,s.jsx)(_.Panel,{title:"Stability",subtitle:"hard failures frame_perf can't show",children:c?(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,s.jsx)(eE,{label:"Context losses",value:b(c.context_losses)}),(0,s.jsx)(eE,{label:"Compile stalls",value:b(c.compile_stalls)}),(0,s.jsx)(eE,{label:"Incidents",value:b(c.incidents)})]}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No stability data in range."})})]}),(0,s.jsx)(_.Panel,{title:"Resource footprint",subtitle:"per-session p50 / p95 of what the scene asked of the device",children:o&&0!==o.sessions?(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[(0,s.jsx)(eE,{label:"p50 JS heap",value:eI(o.p50_js_heap_bytes),unit:"MB"}),(0,s.jsx)(eE,{label:"p50 texture",value:eI(o.p50_texture_bytes),unit:"MB"}),(0,s.jsx)(eE,{label:"p50 triangles",value:b(o.p50_triangles)}),(0,s.jsx)(eE,{label:"p95 JS heap",value:eI(o.p95_js_heap_bytes),unit:"MB"}),(0,s.jsx)(eE,{label:"p95 texture",value:eI(o.p95_texture_bytes),unit:"MB"}),(0,s.jsx)(eE,{label:"p95 triangles",value:b(o.p95_triangles)})]}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No resource samples in range."})})]})}function eF({label:e,value:t,tone:n="neutral",hint:l}){return(0,s.jsxs)("div",{className:"rounded-lg border border-edge bg-ink/40 px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-wide text-fg-muted",children:e}),(0,s.jsx)("p",{className:`mt-0.5 text-lg font-semibold tabular-nums ${"bad"===n?"text-red-300":"warn"===n?"text-amber-300":"good"===n?"text-emerald-300":"text-fg-hi"}`,children:t}),l?(0,s.jsx)("p",{className:"text-[11px] text-fg-muted",children:l}):null]})}function eL({counts:e,perf:t}){let n=new Map(e.map(e=>[e.event_type,e.count])),l=e=>n.get(e)??0,r=l("session_start"),a=l("runtime_error"),i=l("context_lost"),o=l("focus_change"),c=l("visibility_change"),d=l("viewport_resize"),u=e.reduce((e,t)=>e+t.count,0),m=r>0?a/r:0;return(0,s.jsx)(_.Panel,{title:"Scene health",subtitle:"Errors, GPU context loss & attention gaps in the selected window",children:u>0?(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[(0,s.jsx)(eF,{label:"Errors",value:b(a),tone:a>0?"bad":"good",hint:r>0?`${m.toFixed(2)} / session`:void 0}),(0,s.jsx)(eF,{label:"Context loss",value:b(i),tone:i>0?"warn":"good",hint:"GPU device lost"}),(0,s.jsx)(eF,{label:"Avg FPS",value:t&&t.samples>0?b(t.avg_fps,1):"—",tone:t&&t.samples>0?t.avg_fps>=50?"good":"warn":"neutral",hint:t&&t.samples>0?`min ${b(t.min_fps,0)}`:void 0}),(0,s.jsx)(eF,{label:"Sessions",value:b(r)}),(0,s.jsx)(eF,{label:"Attention",value:b(o+c),hint:"focus + visibility changes"}),(0,s.jsx)(eF,{label:"Resizes",value:b(d),hint:"viewport changes"})]}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No events in range."})})}let eO=["fatal","error","warning","info"];function eU(e){let t=eO.indexOf(e);return -1===t?eO.length:t}function eB({label:e,value:t,tone:n="neutral"}){return(0,s.jsxs)("div",{className:"rounded-lg border border-edge bg-ink/40 px-3 py-2.5",children:[(0,s.jsx)("p",{className:"truncate text-xs uppercase tracking-wide text-fg-muted",title:e,children:e}),(0,s.jsx)("p",{className:`mt-0.5 text-lg font-semibold tabular-nums ${"bad"===n?"text-red-300":"warn"===n?"text-amber-300":"text-fg-hi"}`,children:t})]})}function eH({title:e,buckets:t,tones:n}){return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wide text-fg-muted",children:e}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:t.map(e=>(0,s.jsx)(eB,{label:e.label,value:b(e.count),tone:n?.(e)},e.key))})]})}function eG({rows:e}){let{bySeverity:t,byCategory:n,byBackend:l,total:r}=function(e){let t=new Map,s=new Map,n=new Map,l=0;for(let r of e){let e=Number(r.incidents)||0;if(e<=0)continue;l+=e,t.set(r.severity,(t.get(r.severity)??0)+e),s.set(r.category,(s.get(r.category)??0)+e);let a=""===r.backend?"unknown":r.backend;n.set(a,(n.get(a)??0)+e)}let r=e=>[...e.entries()].map(([e,t])=>({key:e,label:e,count:t})),a=r(t).sort((e,t)=>eU(e.key)-eU(t.key)||e.key.localeCompare(t.key)),i=(e,t)=>t.count-e.count||e.key.localeCompare(t.key);return{bySeverity:a,byCategory:r(s).sort(i),byBackend:r(n).sort(i),total:l}}(e);return(0,s.jsx)(_.Panel,{title:"Engine diagnostics",subtitle:"GPU-health incidents by severity, category & backend in the selected window",children:0===r?(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No engine diagnostics in range."}),(0,s.jsxs)("p",{className:"text-xs text-fg-muted",children:["Engine diagnostics (",(0,s.jsx)("code",{className:"text-fg-hi",children:"graphics_diagnostic"}),") are"," ",(0,s.jsx)("span",{className:"text-fg-hi",children:"opt-in and off by default"}),". Enable"," ",(0,s.jsx)("code",{className:"text-fg-hi",children:"captureGraphicsDiagnostics"})," in the SDK to surface GPU errors, device losses, and shader-compile failures here."]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(eH,{title:"By severity",buckets:t,tones:e=>{var t;return"fatal"===(t=e.key)||"error"===t?"bad":"warning"===t?"warn":"neutral"}}),(0,s.jsx)(eH,{title:"By category",buckets:n}),(0,s.jsx)(eH,{title:"By backend",buckets:l})]})})}function eK({label:e,value:t}){return(0,s.jsxs)("div",{className:"rounded-lg border border-edge bg-ink/40 px-3 py-2.5",children:[(0,s.jsx)("p",{className:"truncate text-xs uppercase tracking-wide text-fg-muted",title:e,children:e}),(0,s.jsx)("p",{className:"mt-0.5 text-lg font-semibold tabular-nums text-fg-hi",children:t})]})}function eV({title:e,buckets:t}){return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wide text-fg-muted",children:e}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:t.map(e=>(0,s.jsx)(eK,{label:e.label,value:b(e.count)},e.key))})]})}function eW({rows:e}){let{byApi:t,byBackend:n,byShadingLanguage:l,total:r}=function(e){let t=new Map,s=new Map,n=new Map,l=0;for(let r of e){let e=Number(r.sessions)||0;if(e<=0)continue;l+=e;let a=(t,s)=>{let n=""===s?"unknown":s;t.set(n,(t.get(n)??0)+e)};a(t,r.api),a(s,r.backend),a(n,r.shadingLanguage)}let r=(e,t)=>t.count-e.count||e.key.localeCompare(t.key),a=e=>[...e.entries()].map(([e,t])=>({key:e,label:e,count:t})).sort(r);return{byApi:a(t),byBackend:a(s),byShadingLanguage:a(n),total:l}}(e);return(0,s.jsx)(_.Panel,{title:"Rendering technology",subtitle:"Sessions by graphics API, backend & shading language in the selected window",children:0===r?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No sessions in range."}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(eV,{title:"By API",buckets:t}),(0,s.jsx)(eV,{title:"By backend",buckets:n}),(0,s.jsx)(eV,{title:"By shading language",buckets:l})]})})}function eX({label:e,value:t,hint:n}){return(0,s.jsxs)("div",{className:"rounded-lg border border-edge bg-ink/40 px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-wide text-fg-muted",children:e}),(0,s.jsx)("p",{className:"mt-0.5 text-lg font-semibold tabular-nums text-fg-hi",children:t}),n?(0,s.jsx)("p",{className:"text-[11px] text-fg-muted",children:n}):null]})}function eJ({buckets:e,bucketSize:t}){if(0===e.length)return(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No camera samples in range."});let n=[...e].sort((e,t)=>e.bucket-t.bucket),l=n.reduce((e,t)=>Math.max(e,t.count),0)||1;return(0,s.jsx)("div",{className:"flex flex-col gap-1",children:n.map(e=>{let n=e.bucket*t;return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"w-24 shrink-0 text-right font-mono text-[11px] text-fg-muted",children:[b(n,1),"–",b(n+t,1)]}),(0,s.jsx)("div",{className:"h-3.5 flex-1 overflow-hidden rounded-sm bg-ink/60",children:(0,s.jsx)("div",{className:"h-full rounded-sm bg-amber",style:{width:`${e.count/l*100}%`}})}),(0,s.jsx)("span",{className:"w-12 shrink-0 text-right font-mono text-[11px] text-fg-muted",children:b(e.count)})]},e.bucket)})})}function eq({coverage:e,cellSize:t,distance:n,bucketSize:l,navigation:r}){let a=e.length,i=e.reduce((e,t)=>e+t.count,0),o=r.reduce((e,t)=>e+t.total_distance,0),c=r.reduce((e,t)=>e+t.segments,0),d=r.reduce((e,t)=>e+t.active_segments,0),u=r.length,m=a>0||r.length>0;return(0,s.jsx)(_.Panel,{title:"Scene traversal",subtitle:"Coverage, camera distance & navigation effort — derived from camera_sample",collapsible:!0,defaultCollapsed:!0,children:m?(0,s.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[(0,s.jsx)(eX,{label:"Visited cells",value:b(a),hint:`${b(t,2)} u voxels`}),(0,s.jsx)(eX,{label:"Camera samples",value:b(i)}),(0,s.jsx)(eX,{label:"Avg travel",value:b(u>0?o/u:0,1),hint:u>0?`over ${b(u)} sessions`:void 0}),(0,s.jsx)(eX,{label:"Active movement",value:`${b(100*(c>0?d/c:0),0)}%`,hint:"of camera segments"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-1.5 text-xs uppercase tracking-wide text-fg-muted",children:"Camera distance distribution"}),(0,s.jsx)(eJ,{buckets:n,bucketSize:l})]})]}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"No camera samples in range."})})}let eY={babylon:"Babylon.js","babylon-lite":"Babylon (lite)",three:"three.js",playcanvas:"PlayCanvas",r3f:"react-three-fiber",aframe:"A-Frame"};function eZ({project:e,playgroundUrl:t,onView:n,onOpenOverlay:r}){var a;let i=e.scene,o=i?.engines.length?i.engines:[],[c,d]=(0,l.useState)(i?.defaultEngine??o[0]??""),u=t.length>0&&c.length>0;return(0,s.jsxs)("div",{className:"flex flex-col gap-3 rounded-xl border border-edge bg-panel p-4",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-fg-hi",children:i?.label??e.name}),(0,s.jsx)("p",{className:"text-xs text-fg-muted",children:e.name})]}),i?(0,s.jsx)("span",{className:"shrink-0 rounded-full border border-edge bg-ink/50 px-2 py-0.5 text-[11px] text-fg-muted",children:"first-person"===i.cameraMode?"first-person":"viewer"}):null]}),i?.description?(0,s.jsx)("p",{className:"text-xs leading-relaxed text-fg-muted",children:i.description}):(0,s.jsx)("p",{className:"text-xs leading-relaxed text-fg-muted",children:"A project without scene metadata — open its analytics directly."}),o.length>1?(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-[11px] text-fg-muted",children:["Engine",(0,s.jsx)("select",{className:"rounded-md border border-edge bg-ink px-2 py-1.5 text-xs text-fg outline-none focus:border-saffron",value:c,onChange:e=>d(e.target.value),children:o.map(e=>(0,s.jsx)("option",{value:e,children:eY[e]??e},e))})]}):1===o.length?(0,s.jsxs)("p",{className:"text-[11px] text-fg-muted",children:["Engine: ",eY[a=o[0]]??a]}):null,(0,s.jsxs)("div",{className:"mt-auto flex flex-wrap gap-2 pt-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>n(e),className:"rounded-md bg-amber px-3 py-1.5 text-xs font-medium text-ink transition hover:bg-ember",children:"View analytics"}),i?(0,s.jsx)("button",{type:"button",disabled:!u,onClick:()=>r(e,c),className:"rounded-md border border-edge px-3 py-1.5 text-xs text-fg transition hover:border-amber hover:text-fg-hi disabled:opacity-40",children:"Open live scene"}):null]})]})}function eQ({projects:e,playgroundUrl:t,onView:n}){let[r,a]=(0,l.useState)(null),i=(0,l.useMemo)(()=>{let t=[],s=[],n=[];for(let l of e)l.scene?"first-person"===l.scene.cameraMode?s.push(l):t.push(l):n.push(l);return{viewer:t,firstPerson:s,other:n}},[e]),o=(e,s)=>{let n=e.scene;n&&t&&a({url:`${t.replace(/\/$/,"")}/?scene=${encodeURIComponent(n.id)}&engine=${encodeURIComponent(s)}`,title:`${n.label} \xb7 ${eY[s]??s}`})},c=(e,l)=>l.length>0?(0,s.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,s.jsx)("h2",{className:"text-xs font-semibold uppercase tracking-wide text-fg-muted",children:e}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:l.map(e=>(0,s.jsx)(eZ,{project:e,playgroundUrl:t,onView:n,onOpenOverlay:o},e.id))})]}):null;return(0,s.jsxs)(_.Panel,{title:"Scenes",subtitle:"Pick a scene to explore its analytics, or open it live to test capture.",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[c("Viewer",i.viewer),c("First-person",i.firstPerson),c("Other projects",i.other)]}),r?(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/70 p-4 sm:p-8",role:"dialog","aria-modal":"true","aria-label":"Live scene overlay",children:(0,s.jsxs)("div",{className:"mx-auto flex h-full w-full max-w-6xl flex-col overflow-hidden rounded-xl border border-edge bg-panel",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 border-b border-edge px-4 py-2.5",children:[(0,s.jsx)("p",{className:"text-sm text-fg",children:r.title}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("a",{href:r.url,target:"_blank",rel:"noreferrer",className:"rounded-md border border-edge px-3 py-1.5 text-xs text-fg transition hover:border-amber hover:text-fg-hi",children:"Open in new tab ↗"}),(0,s.jsx)("button",{type:"button",onClick:()=>a(null),className:"rounded-md border border-edge px-3 py-1.5 text-xs text-fg transition hover:border-amber hover:text-fg-hi",children:"Close ✕"})]})]}),(0,s.jsx)("iframe",{title:r.title,src:r.url,className:"h-full w-full flex-1 bg-ink"})]})}):null]})}function e0({sessions:e,onSelect:t,selectedId:n}){return(0,s.jsx)(_.Panel,{title:"Sessions",subtitle:t?`${e.length} most recent \xb7 select to drill in`:`${e.length} most recent`,children:(0,s.jsx)(ea,{sessions:e,onSelect:t,selectedId:n})})}function e1({baseUrl:e,apiKey:t,sessionId:n,scene:r}){let i=(0,l.useRef)(null),[o,c]=(0,l.useState)([]),[d,u]=(0,l.useState)("loading");return(0,l.useEffect)(()=>{let s=!1;return u("loading"),new a.CollectorApi(e,t).sessionTrajectory(n,{scene:r,limit:5e3}).then(e=>{s||(c(e),u("ready"))}).catch(()=>{s||(c([]),u("error"))}),()=>{s=!0}},[e,t,n,r]),(0,l.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.getContext("2d");if(!t||(t.clearRect(0,0,360,360),t.fillStyle="#0b0e14",t.fillRect(0,0,360,360),0===o.length))return;let s=1/0,n=-1/0,l=1/0,r=-1/0;for(let e of o)e.x<s&&(s=e.x),e.x>n&&(n=e.x),e.z<l&&(l=e.z),e.z>r&&(r=e.z);let a=328/Math.max(n-s,r-l,.001),c=e=>[16+(e.x-s)*a,16+(r-e.z)*a];t.lineWidth=2,t.strokeStyle="#38bdf8",t.beginPath(),o.forEach((e,s)=>{let[n,l]=c(e);0===s?t.moveTo(n,l):t.lineTo(n,l)}),t.stroke();let d=o[0],u=o[o.length-1];if(d){let[e,s]=c(d);t.fillStyle="#22c55e",t.beginPath(),t.arc(e,s,5,0,2*Math.PI),t.fill()}if(u){let[e,s]=c(u);t.fillStyle="#ef4444",t.beginPath(),t.arc(e,s,5,0,2*Math.PI),t.fill()}},[o]),(0,s.jsxs)(_.Panel,{title:"Walked path",subtitle:"Camera trajectory (top-down)",help:"The ordered route this session's camera took across the X/Z ground plane — green is the start, red is the end. Meaningful for first-person (walkable) sessions.",children:[(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)("canvas",{ref:i,width:360,height:360,className:"rounded-lg border border-edge","aria-label":"Session camera trajectory"})}),"loading"===d?(0,s.jsx)("p",{className:"mt-2 text-center text-xs text-fg-muted",children:"Loading trajectory…"}):"error"===d?(0,s.jsx)("p",{className:"mt-2 text-center text-xs text-red-400",children:"Failed to load trajectory."}):0===o.length?(0,s.jsx)("p",{className:"mt-2 text-center text-xs text-fg-muted",children:"No camera movement recorded for this session."}):null]})}function e2(e){return e>=36e5?`${Math.round(e/36e5)}h`:e>=6e4?`${Math.round(e/6e4)}m`:e>=1e3?`${Math.round(e/1e3)}s`:`${e}ms`}function e5({buckets:e,intervalMs:t,onBrush:n,onClear:r,brushed:a}){let i=(0,l.useRef)(null),o=(0,l.useRef)(null),[c,d]=(0,l.useState)(640),u=(0,l.useRef)(null),[m,x]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>d(Math.max(320,e.clientWidth));t();let s=new ResizeObserver(t);return s.observe(e),()=>s.disconnect()},[]);let p={x:40,y:14,w:Math.max(1,c-40-36),h:114},h=e.length>0?{start:e[0].bucket,end:e[e.length-1].bucket+t}:null,g=(0,l.useCallback)(e=>{if(!h)return 0;let t=(e-p.x)/p.w;return Math.round(h.start+Math.max(0,Math.min(1,t))*(h.end-h.start))},[h,p.x,p.w]);(0,l.useEffect)(()=>{let s=o.current;if(!s)return;let n=s.getContext("2d");if(!n)return;if(n.clearRect(0,0,c,150),n.fillStyle="#0b0e14",n.fillRect(0,0,c,150),0===e.length||!h){n.fillStyle="#64748b",n.font="12px system-ui, sans-serif",n.textAlign="center",n.fillText("No events in range",c/2,75);return}let l=e.reduce((e,t)=>Math.max(e,t.events),0)||1,r=h.end-h.start,a=Math.max(1,p.w/e.length*.8);for(let t of e){let e=p.x+(t.bucket-h.start)/r*p.w,s=t.events/l*p.h;n.fillStyle="rgba(56, 189, 248, 0.55)",n.fillRect(e,p.y+p.h-s,a,s)}if(n.font="10px system-ui, sans-serif",n.textBaseline="middle",n.fillStyle="rgba(56, 189, 248, 0.95)",n.textAlign="right",n.fillText(String(l),p.x-5,p.y+4),n.fillText("0",p.x-5,p.y+p.h),n.textBaseline="alphabetic",n.fillStyle="rgba(56, 189, 248, 0.7)",n.textAlign="left",n.fillText(`events / ${e2(t)}`,p.x,144),m){let e=Math.min(m.x0,m.x1),t=Math.max(m.x0,m.x1);n.fillStyle="rgba(56, 189, 248, 0.18)",n.fillRect(e,p.y,t-e,p.h),n.strokeStyle="rgba(56, 189, 248, 0.8)",n.lineWidth=1,n.strokeRect(e,p.y,t-e,p.h)}},[e,c,h,m,t,p.x,p.y,p.w,p.h]);let f=()=>{let e=u.current;if(u.current=null,x(null),!e||4>Math.abs(e.x1-e.x0))return;let t=g(Math.min(e.x0,e.x1)),s=g(Math.max(e.x0,e.x1));s>t&&n(t,s)};return(0,s.jsx)(_.Panel,{title:"Event volume over time",subtitle:`Bars: events per ${e2(t)} \xb7 drag to zoom the time window`,children:(0,s.jsxs)("div",{ref:i,className:"relative",children:[(0,s.jsx)("canvas",{ref:o,width:c,height:150,className:"w-full cursor-crosshair rounded-lg border border-edge",onMouseDown:e=>{let t=e.currentTarget.getBoundingClientRect(),s=e.clientX-t.left;u.current={x0:s,x1:s},x({x0:s,x1:s})},onMouseMove:e=>{if(!u.current)return;let t=e.currentTarget.getBoundingClientRect(),s={...u.current,x1:e.clientX-t.left};u.current=s,x(s)},onMouseUp:f,onMouseLeave:f,"aria-label":"Event volume time series"}),a&&r?(0,s.jsx)("button",{type:"button",onClick:r,className:"absolute right-2 top-2 rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg transition hover:border-amber hover:text-fg-hi",children:"Clear zoom"}):null]})})}var e3=e.i(19761);function e4({label:e,value:t}){return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-3 py-0.5",children:[(0,s.jsx)("span",{className:"shrink-0 text-xs text-fg-muted",children:e}),(0,s.jsx)("span",{className:"min-w-0 truncate text-right font-mono text-xs text-fg",title:t,children:t})]})}function e6({title:e,rows:t}){return 0===t.length?null:(0,s.jsxs)("div",{className:"rounded-lg border border-edge bg-ink/40 p-3",children:[(0,s.jsx)("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-fg-muted",children:e}),t.map(([e,t])=>(0,s.jsx)(e4,{label:e,value:t},e))]})}function e8(e){let t=[];for(let[s,n]of e){let e=null==n||""===n?null:Array.isArray(n)?n.join(" × "):"boolean"==typeof n?n?"yes":"no":"object"==typeof n?JSON.stringify(n):String(n);null!=e&&t.push([s,e])}return t}function e9({baseUrl:e,apiKey:t,sessionId:n,hiddenTypes:r,onToggleType:a,onSetAllHidden:i}){let o,c,d,[u,m]=(0,l.useState)([]),[x,p]=(0,l.useState)("loading"),[h,g]=(0,l.useState)(null),[f,b]=(0,l.useState)(new Set);(0,l.useEffect)(()=>{let s=!1;return p("loading"),g(null),m([]),b(new Set),(async()=>{try{let l=await (0,e3.fetchSessionEvents)({endpoint:e,apiKey:t,sessionId:n});if(s)return;m(l),p(0===l.length?"empty":"ready")}catch(e){if(s)return;p("error"),g(e instanceof Error?e.message:"Failed to load session data.")}})(),()=>{s=!0}},[e,t,n]);let{meta:v,byType:j,allTypes:y,sorted:w}=(0,l.useMemo)(()=>{let e=[...u].sort((e,t)=>e.ts-t.ts),t=new Map;for(let s of e)t.set(s.type,(t.get(s.type)??0)+1);let s=[...t.keys()].sort(),n=e[0];return{meta:{start:n,end:e[e.length-1],startEvent:e.find(e=>"session_start"===e.type)},byType:t,allTypes:s,sorted:e}},[u]);if("ready"!==x)return(0,s.jsx)(_.Panel,{title:"Session data",subtitle:"Metadata and captured event breakdown",children:(0,s.jsx)("p",{className:"py-6 text-center text-sm text-fg-muted",children:"loading"===x?"Loading session data…":"empty"===x?"No events captured for this session.":h??"Session data unavailable."})});let N=v.start,k=v.end,S=v.startEvent,M=N&&k?k.ts-N.ts:0,P=e=>e?new Date(e).toLocaleString():"—",C=N?.pageMeta,z=e8([["Project",N?.projectId],["Session",N?.sessionId],["Visitor",N?.visitorId],["SDK",N?.sdkVersion],["Scene ID",N?.sceneId],["URL",N?.url],["Started",P(N?.ts)],["Ended",P(k?.ts)],["Duration",(c=Math.floor((o=Math.round(M/1e3))/60),d=o%60,c>0?`${c}m ${d}s`:`${d}s`)],["Events",String(w.length)]]),R=C?e8([["Title",C.title],["Language",C.language],["Referrer",C.referrer],["Viewport",C.viewport],["Device pixel ratio",C.devicePixelRatio]]):[],T=S?.type==="session_start"?S.device:void 0,A=S?.type==="session_start"?S.graphics:void 0,E=S?.type==="session_start"?S.scene:void 0,I=S?.type==="session_start"?S.connector:void 0,$=S?.type==="session_start"?S.user:void 0,D=e8([["Engine",T?.engine],["Graphics API",A?.api],["Backend",A?.backend],["API version",A?.apiVersion],["Shading language",A?.shadingLanguage],["GPU vendor",T?.vendor],["GPU renderer",T?.renderer],["Max texture size",T?.maxTextureSize],["CPU cores",T?.hardwareConcurrency],["Device memory (GB)",T?.deviceMemoryGb],["Mobile",T?.isMobile]]),F=e8([["Connector",I?[I.name,I.version].filter(Boolean).join(" "):null],["Coordinate system",I?.coordinateSystem],["Description",E?.description],["Camera type",E?.cameraType],["Camera name",E?.cameraName],["Mesh count",E?.meshCount],["User id",$?.id],["User traits",$?.traits]]),L=y.every(e=>r.has(e));return(0,s.jsxs)(_.Panel,{title:"Session data",subtitle:"Metadata that was sent and a per-feature breakdown — toggle a type to show/hide it in the replay, expand to inspect raw payloads",help:(0,s.jsxs)(s.Fragment,{children:["Project-level metadata beyond the ",(0,s.jsx)("strong",{children:"Project ID"}),"isn't stored in the OSS collector (Phase 1) — everything here is derived from the session's own events. The"," ",(0,s.jsx)("strong",{children:"Device / graphics"})," and ",(0,s.jsx)("strong",{children:"Scene / connector"})," blocks come from the one-time ",(0,s.jsx)("code",{children:"session_start"})," event."]}),children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,s.jsx)(e6,{title:"Identity",rows:z}),(0,s.jsx)(e6,{title:"Page context",rows:R}),(0,s.jsx)(e6,{title:"Device / graphics",rows:D}),(0,s.jsx)(e6,{title:"Scene / connector",rows:F})]}),(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,s.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-fg-muted",children:["Captured features (",y.length," event types)"]}),(0,s.jsx)("button",{type:"button",onClick:()=>i(!L,y),className:"rounded-md border border-edge px-2 py-1 text-xs text-fg transition hover:border-amber hover:text-fg-hi",children:L?"Show all":"Hide all"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:y.map(e=>{let t=!r.has(e),n=f.has(e),l=w.filter(t=>t.type===e).slice(0,3);return(0,s.jsxs)("div",{className:`self-start rounded-lg border border-edge bg-ink/40 ${n?"sm:col-span-2 lg:col-span-3":""}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-2.5 py-1.5",children:[(0,s.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>a(e),className:"accent-amber"}),(0,s.jsx)("span",{className:"truncate font-mono text-xs text-fg",children:e})]}),(0,s.jsx)("span",{className:"tabular-nums text-xs text-fg-muted",children:j.get(e)}),(0,s.jsx)("button",{type:"button",onClick:()=>b(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s}),"aria-expanded":n?"true":"false",className:"rounded border border-edge px-1.5 py-0.5 text-[10px] text-fg-muted transition hover:border-amber hover:text-fg-hi",children:n?"Hide raw":"Raw"})]}),n?(0,s.jsxs)("pre",{className:"max-h-64 overflow-auto border-t border-edge bg-black/30 px-3 py-2 text-[10px] leading-relaxed text-fg",children:[l.map(e=>JSON.stringify(e,null,2)).join("\n\n"),(j.get(e)??0)>l.length?`
|
|
2
|
-
|
|
3
|
-
… ${(j.get(e)??0)-l.length} more`:""]}):null]},e)})})]})]})}function e7(e){return e.length>10?`${e.slice(0,8)}…`:e}function te(e,t){let s=Math.max(0,Math.round((t-e)/1e3));if(s<60)return`${s}s ago`;let n=Math.floor(s/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}let tt={active:"bg-emerald-400",recent:"bg-amber-400",idle:"bg-fg-muted"},ts={idle:"offline",connecting:"connecting…",open:"live",reconnecting:"reconnecting…"};function tn({status:e,sessions:t}){let n="open"===e;return(0,s.jsxs)("span",{className:"inline-flex items-center gap-2 rounded-full border border-edge bg-ink px-3 py-1 text-xs",children:[(0,s.jsxs)("span",{className:"relative flex h-2 w-2",children:[n?(0,s.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"}):null,(0,s.jsx)("span",{className:`relative inline-flex h-2 w-2 rounded-full ${n?"bg-emerald-400":"idle"===e?"bg-fg-muted":"bg-amber-400"}`})]}),(0,s.jsx)("span",{className:"font-medium text-fg",children:n?`${b(t)} live now`:ts[e]})]})}function tl({snapshot:e,status:t,feed:n,now:l,onSelectSession:r}){let a=e?.sessions??[],i=e?.activeSessions??0,o=e?.activeVisitors??0;return(0,s.jsxs)(_.Panel,{title:"Live now",subtitle:"Active sessions and a real-time event feed, updating in place.",help:(0,s.jsx)(s.Fragment,{children:"Sessions seen within the liveness window, streamed over SSE from the collector. The roster is intentionally non-identifying — no geo, user-agent, or visitor id. Click a session to follow it live."}),children:[(0,s.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-4",children:[(0,s.jsx)(tn,{status:t,sessions:i}),(0,s.jsxs)("span",{className:"text-xs text-fg-muted",children:[(0,s.jsx)("span",{className:"font-semibold text-fg",children:b(o)})," visitor",1===o?"":"s"]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("p",{className:"mb-2 text-xs uppercase tracking-wide text-fg-muted",children:["Sessions (",a.length,")"]}),0===a.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"open"===t?"No active sessions right now.":"Waiting for live data…"}):(0,s.jsx)("ul",{className:"flex max-h-64 flex-col gap-1 overflow-y-auto pr-1",children:a.map(e=>(0,s.jsx)("li",{children:r?(0,s.jsxs)("button",{type:"button",onClick:()=>r(e.sessionId),className:"flex w-full items-center gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition hover:border-edge hover:bg-ink",children:[(0,s.jsx)("span",{className:`h-2 w-2 flex-none rounded-full ${tt[e.activity]}`,"aria-hidden":"true"}),(0,s.jsx)("span",{className:"font-mono text-xs text-fg",children:e7(e.sessionId)}),(0,s.jsx)("span",{className:"truncate text-xs text-fg-muted",children:e.sceneId}),(0,s.jsx)("span",{className:"ml-auto flex-none text-xs text-fg-muted",children:te(e.lastSeen,l)})]}):(0,s.jsxs)("div",{className:"flex w-full items-center gap-2 px-2 py-1.5",children:[(0,s.jsx)("span",{className:`h-2 w-2 flex-none rounded-full ${tt[e.activity]}`,"aria-hidden":"true"}),(0,s.jsx)("span",{className:"font-mono text-xs text-fg",children:e7(e.sessionId)}),(0,s.jsx)("span",{className:"truncate text-xs text-fg-muted",children:e.sceneId}),(0,s.jsx)("span",{className:"ml-auto flex-none text-xs text-fg-muted",children:te(e.lastSeen,l)})]})},e.sessionId))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-xs uppercase tracking-wide text-fg-muted",children:"Event feed"}),0===n.length?(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"open"===t?"Listening for events…":"Waiting for live data…"}):(0,s.jsx)("ul",{className:"flex max-h-64 flex-col gap-1 overflow-y-auto pr-1 font-mono text-xs",children:n.map((e,t)=>(0,s.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-2 py-1",children:[(0,s.jsx)("span",{className:"flex-none rounded bg-amber/15 px-1.5 py-0.5 text-[11px] text-saffron",children:e.type}),(0,s.jsx)("span",{className:"text-fg-muted",children:e7(e.sessionId)}),(0,s.jsx)("span",{className:"ml-auto flex-none text-fg-muted",children:te(e.ts,l)})]},`${e.sessionId}-${e.ts}-${t}`))})]})]})]})}let tr=(0,n.default)(()=>e.A(69091).then(e=>e.SessionReplay),{loadableGenerated:{modules:[12449]},ssr:!1}),ta=(0,n.default)(()=>e.A(15867).then(e=>e.WorldHeatmap3DView),{loadableGenerated:{modules:[94452]},ssr:!1}),ti=(0,n.default)(()=>e.A(15867).then(e=>e.ClickRays3DView),{loadableGenerated:{modules:[94452]},ssr:!1}),to={sessions:[],camera:[],perf:null,gaze:[],clickRays:[],hasFirstPerson:!1,proxyMeshes:[],timeseries:[],counts:[],diagnostics:[],renderingTech:[],coverage:[],distance:[],navigation:[],sources:[],floorPlan:[],performance:{distribution:null,histogram:[],frameTime:null,jank:null,byDevice:[],byScene:[],resources:null,stability:null},intervalMs:36e5};e.s(["default",0,function(){let[e,n]=(0,l.useState)(r.DEFAULT_COLLECTOR_URL),[o,c]=(0,l.useState)(r.DEFAULT_API_KEY),[m,p]=(0,l.useState)([]),[h,g]=(0,l.useState)(""),[f,b]=(0,l.useState)(i),[y,k]=(0,l.useState)([]),[S,M]=(0,l.useState)(to),[P,C]=(0,l.useState)("idle"),[z,T]=(0,l.useState)(null),[A,E]=(0,l.useState)(null),[I,$]=(0,l.useState)("idle"),[D,F]=(0,l.useState)(new Set),[L,O]=(0,l.useState)([]),[U,B]=(0,l.useState)(()=>Date.now()),[H,G]=(0,l.useState)(0),[K,V]=(0,l.useState)(void 0),W=(0,l.useRef)(void 0),X=(0,l.useRef)(new Set),J=(0,l.useRef)(f);J.current=f;let q=(0,l.useRef)(i.window),Y=(0,l.useRef)(h);Y.current=h;let Z=(0,l.useRef)(A);Z.current=A;let Q=(0,l.useRef)(null),ee=(0,l.useRef)(null),et=(0,l.useRef)(!1),es=(0,l.useCallback)((e,t)=>{let s=`/projects/${encodeURIComponent(e)}`;return t?`${s}/session/${encodeURIComponent(t)}`:s},[]),en=(0,l.useCallback)(e=>{window.location.pathname!==e&&window.history.pushState({},"",e)},[]);(0,l.useEffect)(()=>{let e=window.location.pathname.match(/^\/projects\/([^/]+)(?:\/session\/([^/]+))?/);e?.[1]&&(Q.current=decodeURIComponent(e[1]),e[2]&&(ee.current=decodeURIComponent(e[2])))},[]),(0,l.useEffect)(()=>{r.COLLECTOR_URL_IS_PINNED||n(window.location.origin)},[]),(0,l.useEffect)(()=>{let e=!1;return fetch("/api/projects").then(e=>e.ok?e.json():[]).then(t=>{if(e||!Array.isArray(t)||0===t.length)return;p(t);let[s]=t,n=Q.current,l=(n?t.find(e=>e.id===n):void 0)??t.find(e=>e.apiKey===r.DEFAULT_API_KEY)??s;l&&(g(l.id),c(l.apiKey),(n&&l.id===n||1===t.length&&!l.scene)&&(et.current=!0))}).catch(()=>{}),()=>{e=!0}},[]);let el=(0,l.useCallback)(async t=>{let s=t??o;if(!s){C("error"),T("An API key is required.");return}C("loading"),T(null),E(null),$("idle");let n=J.current,l=u(n),r=d(n),i=new a.CollectorApi(e,s);try{let e=await i.sessions({...l,source:void 0,limit:100}),t=r.until??Date.now(),s=r.since;if(null==s){let n=e.reduce((e,t)=>{var s;let n=(s=t.started_at,new Date(s.includes("T")?s:s.replace(" ","T")+"Z").getTime());return Number.isFinite(n)?Math.min(e,n):e},Date.now());s=Number.isFinite(n)?n:t-864e5}let n=x(Math.max(6e4,t-s)),a=1e3*n,[o,c,d,u,m,p,h,g,f,b,v,j,y,w,N]=await Promise.all([i.cameraHeatmap({...l,source:void 0,bins:36}),i.perf({...l,source:void 0}),i.gazeHeatmap({...l,source:void 0,cellSize:.5}),i.clickRays({...l,cellSize:.5}),i.scenes({since:r.since,until:r.until,limit:200}),i.timeseries({since:r.since,until:r.until,scene:l.scene,interval:n}),i.eventCounts({since:r.since,until:r.until,scene:l.scene}),i.graphicsDiagnosticCounts({...l,source:void 0}),i.renderingTechnology({...l,source:void 0}),i.coverage({...l,source:void 0,cellSize:1}),i.cameraDistance({...l,source:void 0,bucketSize:1}),i.navigation({...l,source:void 0}),i.interactionsBySource(l),i.cameraPositionHeatmap({...l,source:void 0,cameraMode:"first-person",cellSize:1}),(async()=>{let[e,t,s,n,r,a,o,c]=await Promise.all([i.perfDistribution({...l,source:void 0}),i.fpsHistogram({...l,source:void 0}),i.frameTimePercentiles({...l,source:void 0}),i.jankRate({...l,source:void 0}),i.perfByDevice({...l,source:void 0}),i.perfByScene({...l,source:void 0,scene:void 0}),i.resourcePercentiles({...l,source:void 0}),i.stabilityCounts({...l,source:void 0})]);return{distribution:e,histogram:t,frameTime:s,jank:n,byDevice:r,byScene:a,resources:o,stability:c}})()]);k(m),M(t=>({sessions:e,camera:o,perf:c,gaze:d,clickRays:u,hasFirstPerson:w.length>0,proxyMeshes:t.proxyMeshes,timeseries:p,counts:h,diagnostics:g,renderingTech:f,coverage:b,distance:v,navigation:j,sources:y,floorPlan:w,performance:N,intervalMs:a})),C("ready")}catch(e){M(to),C("error"),T(e instanceof a.ApiError?`${e.status}: ${e.message}`:e instanceof Error?e.message:"Request failed.")}},[o,e]),er=(0,l.useCallback)(e=>{g(e.id),c(e.apiKey),V(void 0),W.current=void 0,en(es(e.id)),el(e.apiKey)},[el,es,en]);(0,l.useEffect)(()=>{if("idle"===P)return;let e=setTimeout(()=>void el(),300);return()=>clearTimeout(e)},[f]);let ea="idle"!==P&&!!o,ei=(0,l.useRef)(0),eo=(0,l.useRef)(!1);eo.current=null!=A;let ec=(0,l.useCallback)(e=>{O(t=>[e,...t].slice(0,30)),X.current.forEach(t=>t(e)),!eo.current&&e.sceneId&&e.sceneId!==W.current&&(W.current=e.sceneId,V(e.sceneId),G(e=>e+1));let t=Date.now();eo.current||t-ei.current<5e3||(ei.current=t,el(),G(e=>e+1))},[el]),{snapshot:ed,status:eu}=(0,j.useLivePresence)(e,o,ea);(0,j.useLiveStream)(e,o,ea,ec),(0,l.useEffect)(()=>{if(!ea)return;let e=setInterval(()=>B(Date.now()),1e3);return()=>clearInterval(e)},[ea]),(0,l.useEffect)(()=>{if(!ea)return;let t=new a.CollectorApi(e,o),s=!1,n=async()=>{let e=d(J.current),n=await t.scenes({since:e.since,until:e.until,limit:200}).catch(()=>null);!s&&n&&k(n)},l=setInterval(()=>void n(),5e3);return()=>{s=!0,clearInterval(l)}},[ea,e,o]);let em=f.scene&&f.scene.length>0?f.scene:void 0;(0,l.useEffect)(()=>{if("idle"===P)return;let t=!1;return(async()=>{let s=new a.CollectorApi(e,o),n=em?(await s.sceneRepresentation(em).catch(()=>null))?.proxy?.meshes??[]:await (0,v.mergeSceneProxies)(s,u(J.current));t||M(e=>({...e,proxyMeshes:n}))})(),()=>{t=!0}},[em,e,o,P,H]);let ex=(0,l.useCallback)(async t=>{let s=u(J.current),n=new a.CollectorApi(e,o),[l,r,i]=await Promise.all([n.cameraHeatmap({...s,source:void 0,bins:36,session:t}),n.perf({...s,source:void 0,session:t}),n.sessionMeta(t).catch(()=>null)]);return{id:t,meta:i,camera:l,perf:r}},[e,o]),ep=(0,l.useCallback)(async e=>{let t=Y.current;t&&en(es(t,e)),window.scrollTo({top:0,behavior:"smooth"}),E({id:e,meta:null,camera:[],perf:null}),$("loading"),F(new Set);try{E(await ex(e)),$("ready")}catch(e){$("error"),T(e instanceof a.ApiError?`${e.status}: ${e.message}`:e instanceof Error?e.message:"Request failed.")}},[ex,es,en]),eh=(0,l.useCallback)(()=>{let e=Y.current;e&&en(es(e)),E(null),$("idle"),F(new Set)},[es,en]),eg=(0,l.useCallback)(e=>{let t=m.find(t=>t.id===e);g(e),t&&c(t.apiKey),M(to),k([]),C("idle"),T(null),E(null),$("idle"),F(new Set)},[m]),ef=(0,l.useCallback)(e=>{F(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),eb=(0,l.useCallback)((e,t)=>{F(e?new Set(t):new Set)},[]),ev=(0,l.useCallback)((e,t)=>{b(s=>("custom"!==s.window&&(q.current=s.window),{...s,window:"custom",since:e,until:t}))},[]),ej=(0,l.useCallback)(()=>{b(e=>({...e,window:q.current}))},[]);(0,l.useEffect)(()=>{et.current&&o&&(et.current=!1,el())},[m,o,el]),(0,l.useEffect)(()=>{if("ready"===P&&ee.current){let e=ee.current;ee.current=null,ep(e)}},[P,ep]),(0,l.useEffect)(()=>{let e=()=>{let e=window.location.pathname.match(/^\/projects\/[^/]+(?:\/session\/([^/]+))?/),t=e?.[1]?decodeURIComponent(e[1]):null;t?Z.current?.id!==t&&ep(t):Z.current&&eh()};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[ep,eh]);let ey="loading"===P,ew=(0,l.useMemo)(()=>new a.CollectorApi(e,o),[e,o]),eN=(0,l.useMemo)(()=>u(f),[f,H]),e_=(0,l.useCallback)(e=>{let t=X.current;return t.add(e),()=>{t.delete(e)}},[]),ez=(0,l.useMemo)(()=>({selectSession:e=>void ep(e),setTimeRange:(e,t)=>ev(e,t),setFilters:e=>b(t=>({...t,...e}))}),[ep,ev]),eE={api:ew,baseUrl:e,apiKey:o,params:eN,filters:f,capabilities:{hasFirstPerson:S.hasFirstPerson},actions:ez,live:{presence:ed,enabled:ea,subscribe:e_,sceneId:ea?K:void 0},settings:{}},eI={...eE,surface:"overview"},e$=A?{...eE,surface:"session",sessionId:A.id}:null,eF=function(){let[e,s]=(0,l.useState)(eM);return(0,l.useEffect)(()=>{let e,n,l=(e=eS(t.default.env.NEXT_PUBLIC_PANELS_MANIFEST_URL),n=eS(t.default.env.NEXT_PUBLIC_PANELS_ALLOWED_ORIGINS),{enabled:e.length>0,manifestUrls:e,allowOrigins:n});if(!l.enabled)return;let r=!1,a=new AbortController;return s({panels:[],errors:[],loading:!0}),(async()=>{let e=[],t=[],n=new Set;for(let s of l.manifestUrls){let r=await w(s,{signal:a.signal});if("code"in r){t.push(r);continue}let i=await N(r,{allowOrigins:l.allowOrigins.length>0?l.allowOrigins:void 0});for(let s of(t.push(...i.errors),i.panels)){if(n.has(s.id)){t.push({source:s.id,code:"invalid-panel",message:`Duplicate panel id "${s.id}" from another manifest — ignored`});continue}n.add(s.id),e.push(s)}}r||s({panels:e,errors:t,loading:!1})})(),()=>{r=!0,a.abort()}},[]),e}(),eO=(0,l.useMemo)(()=>(function(e,t){let s=new Map;for(let t of e)s.set(t.id,t);let n=[...e],l=[];for(let e of t){if(s.has(e.id)){l.push({source:e.id,code:"invalid-panel",message:`Duplicate panel id "${e.id}" — kept the existing panel`});continue}s.set(e.id,e),n.push(e)}return{panels:n,errors:l}})(ek,eF.panels),[eF.panels]),eU=eO.panels,eB=(0,l.useMemo)(()=>[...eF.errors,...eO.errors],[eF.errors,eO.errors]),eH=!!(A&&ed?.sessions.some(e=>e.sessionId===A.id)),eK=(0,l.useRef)(eH);return(0,l.useEffect)(()=>{let e=eK.current;if(eK.current=eH,!e||eH)return;let t=Z.current;if(!t||"ready"!==I)return;let s=t.id,n=!1;return(async()=>{try{let e=await ex(s);n||Z.current?.id!==s||E(e)}catch{}})(),()=>{n=!0}},[eH,I,ex]),(0,l.useEffect)(()=>{if(!eH||"ready"!==I)return;let e=Z.current?.id;if(!e)return;let t=!1,s=setInterval(()=>{(async()=>{try{let s=await ex(e);t||Z.current?.id!==e||E(s)}catch{}})()},1e3);return()=>{t=!0,clearInterval(s)}},[eH,I,ex]),(0,s.jsxs)("main",{className:"mx-auto max-w-6xl px-6 py-8",children:[(0,s.jsxs)("header",{className:"mb-6 flex items-center gap-3",children:[(0,s.jsx)("img",{src:"/logo.svg",alt:"Uptimizr",width:36,height:36,className:"h-9 w-9 shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"font-display text-2xl font-bold text-fg-hi",children:"Uptimizr"}),(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"Analytics for 3D scenes — open-source collector."})]})]}),(0,s.jsxs)("form",{className:"mb-6 flex flex-wrap items-end gap-3 rounded-xl border border-edge bg-panel p-4",onSubmit:e=>{e.preventDefault(),h&&en(es(h)),el()},children:[m.length>0?(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-fg-muted",children:["Project",(0,s.jsx)("select",{className:"min-w-56 rounded-md border border-edge bg-ink px-3 py-2 text-sm text-fg outline-none focus:border-saffron",value:h,onChange:e=>eg(e.target.value),children:m.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))})]}):null,(0,s.jsxs)("label",{className:"flex flex-1 flex-col gap-1 text-xs text-fg-muted",children:["Collector URL",(0,s.jsx)("input",{className:"min-w-56 rounded-md border border-edge bg-ink px-3 py-2 text-sm text-fg outline-none focus:border-saffron",value:e,onChange:e=>n(e.target.value),placeholder:"http://localhost:4318"})]}),(0,s.jsxs)("label",{className:"flex flex-1 flex-col gap-1 text-xs text-fg-muted",children:["Project API key",(0,s.jsx)("input",{className:"min-w-56 rounded-md border border-edge bg-ink px-3 py-2 text-sm text-fg outline-none focus:border-saffron",value:o,onChange:e=>c(e.target.value),type:"password",placeholder:"utk_…"})]}),(0,s.jsx)("button",{type:"submit",disabled:"loading"===P,className:"rounded-md bg-amber px-4 py-2 text-sm font-medium text-ink transition hover:bg-ember disabled:opacity-50",children:"loading"===P?"Loading…":"Load"})]}),"idle"!==P?(0,s.jsx)(eR,{filters:f,scenes:y,onChange:b,busy:ey}):null,z?(0,s.jsx)("div",{className:"mb-6 rounded-lg border border-red-900/60 bg-red-950/40 px-4 py-3 text-sm text-red-300",children:z}):null,"idle"===P?m.length>0?(0,s.jsx)(eQ,{projects:m,playgroundUrl:r.DEFAULT_PLAYGROUND_URL,onView:er}):(0,s.jsx)("p",{className:"text-sm text-fg-muted",children:"Enter your collector URL and a project API key, then load to view analytics."}):A?(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[eB.length>0?(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(eP,{errors:eB})}):null,(0,s.jsxs)("div",{className:"lg:col-span-2 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge bg-panel p-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-wide text-fg-muted",children:"Session"}),(0,s.jsx)("p",{className:"font-mono text-sm text-fg",children:A.id}),(0,s.jsx)("p",{className:"mt-1 text-xs text-fg-muted",children:"loading"===I?"Loading session…":[A.meta?.scene?.sceneId?`scene: ${A.meta.scene.sceneId}`:null,A.meta?.device?.gpu?`gpu: ${A.meta.device.gpu}`:null,A.meta?.startedAt?`started: ${A.meta.startedAt}`:null].filter(Boolean).join(" · ")||"No session metadata."})]}),(0,s.jsx)("button",{type:"button",onClick:eh,className:"rounded-md border border-edge px-3 py-2 text-sm text-fg transition hover:border-amber hover:text-fg-hi",children:"← All sessions"})]}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(tr,{baseUrl:e,apiKey:o,sessionId:A.id,hiddenTypes:D,isLive:eH})}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(e9,{baseUrl:e,apiKey:o,sessionId:A.id,hiddenTypes:D,onToggleType:ef,onSetAllHidden:eb})}),(0,s.jsx)(eA,{perf:A.perf}),e$?(0,s.jsx)(R,{panels:eU,ctx:e$,surface:"session",revision:H}):null,(0,s.jsx)(eC,{bins:A.camera,gridSize:36}),A.meta?.scene?.cameraType==="free"?(0,s.jsx)(e1,{baseUrl:e,apiKey:o,sessionId:A.id,scene:A.meta?.scene?.sceneId??f.scene}):null,(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(e0,{sessions:S.sessions,selectedId:A.id,onSelect:ep})})]}):(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[eB.length>0?(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(eP,{errors:eB})}):null,(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(tl,{snapshot:ed,status:eu,feed:L,now:U,onSelectSession:ep})}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(e5,{buckets:S.timeseries,intervalMs:S.intervalMs,onBrush:ev,brushed:"custom"===f.window,onClear:ej})}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(eL,{counts:S.counts,perf:S.perf})}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(eG,{rows:S.diagnostics})}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(eW,{rows:S.renderingTech})}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(eq,{coverage:S.coverage,cellSize:1,distance:S.distance,bucketSize:1,navigation:S.navigation})}),(0,s.jsx)(eA,{perf:S.perf}),(0,s.jsx)(R,{panels:eU,ctx:eI,surface:"overview",revision:H}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(eD,{data:S.performance})}),(0,s.jsx)(eT,{rows:S.sources}),(0,s.jsx)(eC,{bins:S.camera,gridSize:36}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(_.Panel,{title:"Gaze heatmap (3D)",subtitle:"Camera-pose gaze hit-points voxel-binned in world space — what viewers actually look at",children:(0,s.jsx)(ta,{voxels:S.gaze,cellSize:.5,proxyMeshes:S.proxyMeshes,legendTitle:"Gaze density",legendLow:"few looks",legendHigh:"most looks",legendNote:"Each marker is a voxel where the camera-forward (gaze) ray hit your scene. Enable gaze capture in the SDK to populate this.",emptyLabel:"No gaze hit-points in range. Enable gaze capture in the SDK."})})}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(_.Panel,{title:"Click rays (3D)",subtitle:"Each click joined to the view it was made from — gate by viewpoint or focus a mesh; double-click to recenter",children:(0,s.jsx)(ti,{rays:S.clickRays,cellSize:.5,proxyMeshes:S.proxyMeshes})})}),(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(e0,{sessions:S.sessions,onSelect:ep})})]})]})}],14936)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,56054,e=>{"use strict";e.s(["HEAT_GRADIENT",0,"linear-gradient(to right, rgb(178,47,38), rgb(224,123,57), rgb(244,200,75))","heatRgb",0,function(e){let t=Math.max(0,Math.min(1,e)),s=[.878,.482,.224],r=(e,t,s)=>[e[0]+(t[0]-e[0])*s,e[1]+(t[1]-e[1])*s,e[2]+(t[2]-e[2])*s];return t<.5?r([.698,.184,.149],s,t/.5):r(s,[.957,.784,.294],(t-.5)/.5)},"percentileMax",0,function(e,t=.95){if(0===e.length)return 1;let s=[...e].sort((e,t)=>e-t),r=Math.max(0,Math.min(1,t))*(s.length-1),n=Math.floor(r),i=Math.ceil(r);return Math.max(1,n===i?s[n]:s[n]+(s[i]-s[n])*(r-n))}])},18637,e=>{"use strict";var t=e.i(28100),s=e.i(56054);e.s(["HeatLegend",0,function({title:e,lowLabel:r="low",highLabel:n="high",note:i}){return(0,t.jsxs)("div",{className:"pointer-events-none absolute bottom-3 left-3 rounded-md border border-edge bg-ink/80 px-3 py-2 text-fg backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"mb-1 text-xs font-medium text-fg",children:e}),(0,t.jsx)("div",{className:"h-2 w-36 rounded-sm",style:{background:s.HEAT_GRADIENT}}),(0,t.jsxs)("div",{className:"mt-1 flex w-36 justify-between text-[10px] text-fg-muted",children:[(0,t.jsx)("span",{children:r}),(0,t.jsx)("span",{children:n})]}),i?(0,t.jsx)("div",{className:"mt-1 max-w-44 text-[10px] leading-tight text-fg-muted",children:i}):null]})}])},20880,e=>{"use strict";class t extends Error{status;constructor(e,t){super(e),this.status=t,this.name="ApiError"}}function s(e){return e.endsWith("/")?e:`${e}/`}e.s(["ApiError",0,t,"CollectorApi",0,class{baseUrl;apiKey;constructor(e,t){this.baseUrl=e,this.apiKey=t}async get(e,r={}){let n=new URL(e,s(this.baseUrl));for(let[e,t]of Object.entries(r))null!=t&&n.searchParams.set(e,String(t));let i=await fetch(n,{headers:{"x-api-key":this.apiKey},cache:"no-store"});if(!i.ok)throw new t(await i.text().catch(()=>"")||i.statusText,i.status);return await i.json()}sessions(e){return this.get("api/v1/sessions",e).then(e=>e.map(e=>({...e,events:Number(e.events)})))}pointerHeatmap(e){return this.get("api/v1/heatmaps/pointer",e)}cameraHeatmap(e){return this.get("api/v1/heatmaps/camera",e)}topMeshes(e){return this.get("api/v1/meshes/top",e).then(e=>e.map(e=>({...e,count:Number(e.count)})))}meshKinds(e){return this.get("api/v1/meshes/kinds",e).then(e=>e.map(e=>({mesh:String(e.mesh??""),kind:String(e.kind??""),count:Number(e.count??0)})))}topMeshesBySource(e){return this.get("api/v1/meshes/sources",e).then(e=>e.map(e=>({mesh:String(e.mesh??""),source:String(e.source??""),count:Number(e.count??0)})))}topMeshesTrend(e){return this.get("api/v1/meshes/trend",e).then(e=>e.map(e=>({mesh:String(e.mesh??""),bucket:Number(e.bucket??0),count:Number(e.count??0)})))}topInputActions(e){return this.get("api/v1/input-actions/top",e).then(e=>e.map(e=>({action:String(e.action??""),source:String(e.source??""),count:Number(e.count??0)})))}perf(e){return this.get("api/v1/perf",e).then(e=>({samples:Number(e.samples??0),avg_fps:Number(e.avg_fps??0),min_fps:Number(e.min_fps??0),p50_fps:Number(e.p50_fps??0)}))}renderScale(e){return this.get("api/v1/perf/render-scale",e).then(e=>{let t=e[0]??{},s=Number(t.downscaled_samples??0),r=Number(t.scale_samples??0);return{samples:Number(t.samples??0),avg_fps:Number(t.avg_fps??0),p50_fps:Number(t.p50_fps??0),avg_render_scale:Number(t.avg_render_scale??0),p50_render_scale:Number(t.p50_render_scale??0),downscaled_samples:s,scale_samples:r,downscaled_share:r>0?s/r:0}})}perfDistribution(e){return this.get("api/v1/perf/distribution",e).then(e=>{let t=e[0]??{};return{sessions:Number(t.sessions??0),samples:Number(t.samples??0),p05_fps:Number(t.p05_fps??0),p50_fps:Number(t.p50_fps??0),p95_fps:Number(t.p95_fps??0)}})}fpsHistogram(e){return this.get("api/v1/perf/fps-histogram",e).then(e=>e.map(e=>({bucket:Number(e.bucket??0),sessions:Number(e.sessions??0)})))}frameTimePercentiles(e){return this.get("api/v1/perf/frame-time",e).then(e=>{let t=e[0]??{};return{sessions:Number(t.sessions??0),samples:Number(t.samples??0),p50_ms:Number(t.p50_ms??0),p95_ms:Number(t.p95_ms??0)}})}jankRate(e){return this.get("api/v1/perf/jank",e).then(e=>{let t=e[0]??{};return{sessions:Number(t.sessions??0),total_long_frames:Number(t.total_long_frames??0),median_rate:Number(t.median_rate??0),worst_decile_rate:Number(t.worst_decile_rate??0)}})}perfByDevice(e){return this.get("api/v1/perf/by-device",e).then(e=>e.map(e=>({engine:String(e.engine??""),is_mobile:String(e.is_mobile??""),renderer:String(e.renderer??""),browser:String(e.browser??""),os:String(e.os??""),sessions:Number(e.sessions??0),samples:Number(e.samples??0),p50_fps:Number(e.p50_fps??0)})))}perfByScene(e){return this.get("api/v1/perf/by-scene",e).then(e=>e.map(e=>({scene_id:String(e.scene_id??""),sessions:Number(e.sessions??0),samples:Number(e.samples??0),p50_fps:Number(e.p50_fps??0)})))}resourcePercentiles(e){return this.get("api/v1/perf/resource-percentiles",e).then(e=>{let t=e[0]??{};return{sessions:Number(t.sessions??0),samples:Number(t.samples??0),p50_js_heap_bytes:Number(t.p50_js_heap_bytes??0),p95_js_heap_bytes:Number(t.p95_js_heap_bytes??0),p50_texture_bytes:Number(t.p50_texture_bytes??0),p95_texture_bytes:Number(t.p95_texture_bytes??0),p50_triangles:Number(t.p50_triangles??0),p95_triangles:Number(t.p95_triangles??0)}})}stabilityCounts(e){return this.get("api/v1/perf/stability",e).then(e=>{let t=e[0]??{};return{context_losses:Number(t.context_losses??0),compile_stalls:Number(t.compile_stalls??0),incidents:Number(t.incidents??0)}})}graphicsDiagnosticCounts(e){return this.get("api/v1/graphics-diagnostics",e).then(e=>e.map(e=>({severity:String(e.severity??""),category:String(e.category??""),backend:String(e.backend??""),incidents:Number(e.incidents??0)})))}renderingTechnology(e){return this.get("api/v1/rendering-technology",e).then(e=>e.map(e=>({api:String(e.api??""),backend:String(e.backend??""),apiVersion:String(e.api_version??""),shadingLanguage:String(e.shading_language??""),sessions:Number(e.sessions??0)})))}worldHeatmap(e){return this.get("api/v1/heatmaps/world",e).then(e=>e.map(e=>({vx:Number(e.vx),vy:Number(e.vy),vz:Number(e.vz),count:Number(e.count)})))}gazeHeatmap(e){return this.get("api/v1/heatmaps/gaze",e).then(e=>e.map(e=>({vx:Number(e.vx),vy:Number(e.vy),vz:Number(e.vz),count:Number(e.count)})))}worldHeatmapStats(e){return this.get("api/v1/heatmaps/world/stats",e).then(e=>({cellSize:Number(e.cellSize??0),cells:Number(e.cells??0),hits:Number(e.hits??0)}))}gazeHeatmapStats(e){return this.get("api/v1/heatmaps/gaze/stats",e).then(e=>({cellSize:Number(e.cellSize??0),cells:Number(e.cells??0),hits:Number(e.hits??0)}))}cameraPositionHeatmap(e){return this.get("api/v1/heatmaps/position",e).then(e=>e.map(e=>({gx:Number(e.gx),gz:Number(e.gz),avg_y:Number(e.avg_y??0),count:Number(e.count??0)})))}sessionTrajectory(e,t){return this.get(`api/v1/sessions/${encodeURIComponent(e)}/trajectory`,t).then(e=>e.map(e=>({ts:Number(e.ts),x:Number(e.x),y:Number(e.y),z:Number(e.z)})))}aggregatePaths(e){return this.get("api/v1/paths",e).then(e=>e.map(e=>({session_id:String(e.session_id??""),ts:Number(e.ts),gx:Number(e.gx),gz:Number(e.gz)})))}clickRays(e){return this.get("api/v1/heatmaps/click-rays",e).then(e=>e.map(e=>({camVoxel:[Number(e.cam_vx),Number(e.cam_vy),Number(e.cam_vz)],origin:[Number(e.origin_x),Number(e.origin_y),Number(e.origin_z)],hitVoxel:[Number(e.hit_vx),Number(e.hit_vy),Number(e.hit_vz)],hit:[Number(e.hit_x),Number(e.hit_y),Number(e.hit_z)],mesh:String(e.mesh??""),count:Number(e.count)})))}flowHeatmap(e){return this.get("api/v1/heatmaps/flow",e).then(e=>e.map(e=>{let t={azimuth_bin:Number(e.azimuth_bin),elevation_bin:Number(e.elevation_bin),mesh:String(e.mesh??""),count:Number(e.count)};return null!=e.origin_vx&&(t.originVoxel=[Number(e.origin_vx),Number(e.origin_vy),Number(e.origin_vz)],t.origin=[Number(e.origin_x),Number(e.origin_y),Number(e.origin_z)]),t}))}scenes(e){return this.get("api/v1/scenes",e).then(e=>e.map(e=>({...e,events:Number(e.events)})))}timeseries(e){return this.get("api/v1/timeseries",e).then(e=>e.map(e=>({bucket:Number(e.bucket),events:Number(e.events??0),avg_fps:Number(e.avg_fps??0)})))}eventCounts(e){return this.get("api/v1/event-counts",e).then(e=>e.map(e=>({event_type:String(e.event_type),count:Number(e.count??0)})))}funnel(e,t){return this.get("api/v1/funnel",{...t,steps:JSON.stringify(e)}).then(e=>e.map(e=>({step:Number(e.step),sessions:Number(e.sessions??0)})))}coverage(e){return this.get("api/v1/coverage",e).then(e=>e.map(e=>({vx:Number(e.vx),vy:Number(e.vy),vz:Number(e.vz),count:Number(e.count??0)})))}cameraDistance(e){return this.get("api/v1/camera/distance",e).then(e=>e.map(e=>({bucket:Number(e.bucket),count:Number(e.count??0)})))}navigation(e){return this.get("api/v1/navigation",e).then(e=>e.map(e=>({session_id:String(e.session_id??""),segments:Number(e.segments??0),total_distance:Number(e.total_distance??0),active_segments:Number(e.active_segments??0),active_distance:Number(e.active_distance??0)})))}cameraGestures(e){return this.get("api/v1/camera-gestures",e).then(e=>e.map(e=>({kind:String(e.kind??""),gestures:Number(e.gestures??0),total_ms:Number(e.total_ms??0),avg_ms:Number(e.avg_ms??0),max_ms:Number(e.max_ms??0)})))}interactionsBySource(e){return this.get("api/v1/interactions/sources",e).then(e=>e.map(e=>({event_type:String(e.event_type??""),source:String(e.source??""),count:Number(e.count??0),sessions:Number(e.sessions??0)})))}sessionMeta(e){return this.get(`api/v1/sessions/${encodeURIComponent(e)}/meta`)}async sceneRepresentation(e){try{return await this.get(`api/v1/scenes/${encodeURIComponent(e)}/representation`)}catch(e){if(e instanceof t&&404===e.status)return null;throw e}}async liveToken(){let e=new URL("api/v1/live/token",s(this.baseUrl)),r=await fetch(e,{method:"POST",headers:{"x-api-key":this.apiKey},cache:"no-store"});if(!r.ok)throw new t(await r.text().catch(()=>"")||r.statusText,r.status);return await r.json()}livePresenceUrl(e){let t=new URL("api/v1/live/presence",s(this.baseUrl));return t.searchParams.set("token",e),t.toString()}liveStreamUrl(e,t){let r=new URL("api/v1/live/stream",s(this.baseUrl));return r.searchParams.set("token",e),t&&t.length>0&&r.searchParams.set("types",t.join(",")),r.toString()}liveSessionUrl(e,t){let r=new URL(`api/v1/live/sessions/${encodeURIComponent(t)}`,s(this.baseUrl));return r.searchParams.set("token",e),r.toString()}}])},37215,e=>{"use strict";var t=e.i(28100);let s=(0,t.jsxs)(t.Fragment,{children:["Each ",(0,t.jsx)("strong",{children:"source"})," is a camera ",(0,t.jsx)("em",{children:"gaze-direction bin"})," — a cell on the sphere of where viewers were looking (grouped by azimuth/elevation). Each ",(0,t.jsx)("strong",{children:"target"})," is a"," ",(0,t.jsx)("em",{children:"mesh that was clicked"}),". A ribbon's thickness is how many clicks on that mesh happened while viewers looked from that direction, so you can see which viewpoints drive interaction with which objects. When the scene reports ",(0,t.jsx)("em",{children:"standpoints"}),' (where the viewer stood, §7.8), pick one to gate the flow to clicks made from that vantage — a pin marks it in the scene. "All standpoints" is the aggregate view. Switch to ',(0,t.jsx)("strong",{children:"Two-stage"})," ","for a three-column ",(0,t.jsx)("em",{children:"standpoint → gaze sector → mesh"}),' flow with a birdview minimap; the busiest standpoints/meshes are kept and the tail folds into an "Other" node.']});e.s(["CAMERA_DOME_SUBTITLE",0,"Where the audience looked, mapped onto a sphere — drag to orbit, +/- to zoom, double-click to focus","CAMERA_DOME_TITLE",0,"View-direction dome (3D)","CLICK_RAYS_SUBTITLE",0,"Each click joined to the view it was made from — gate by viewpoint or focus a mesh; double-click to recenter","CLICK_RAYS_TITLE",0,"Click rays (3D)","FLOW_SANKEY_HELP",0,s,"FLOW_SANKEY_SUBTITLE",0,"Direction-bin → mesh links (aggregate), or standpoint → gaze → mesh (two-stage) — double-click to focus","FLOW_SANKEY_TITLE",0,"Flow Sankey (3D)","GAZE_CLICK_SUBTITLE",0,"Where viewers look (gaze) vs. where they act (clicks), voxel-binned in world space — double-click to focus","GAZE_CLICK_TITLE",0,"Gaze vs. click divergence","WORLD_HEATMAP_SUBTITLE",0,"Pointer hit-points voxel-binned in world space — drag to orbit, +/- to zoom, double-click to focus","WORLD_HEATMAP_TITLE",0,"World heatmap (3D)"])},82665,e=>{"use strict";var t=e.i(37998);let s=!!t.default.env.NEXT_PUBLIC_COLLECTOR_URL,r=t.default.env.NEXT_PUBLIC_COLLECTOR_URL??"http://localhost:4318",n="1"===t.default.env.DASHBOARD_STATIC?"":t.default.env.NEXT_PUBLIC_API_KEY??"",i=t.default.env.NEXT_PUBLIC_PLAYGROUND_URL??"http://localhost:5173";e.s(["COLLECTOR_URL_IS_PINNED",0,s,"DEFAULT_API_KEY",0,n,"DEFAULT_COLLECTOR_URL",0,r,"DEFAULT_PLAYGROUND_URL",0,i])},60614,e=>{"use strict";async function t(e,t){let s=await e.scenes(t).catch(()=>[]);if(0===s.length)return[];let r=await Promise.all(s.map(t=>e.sceneRepresentation(t.scene_id).catch(()=>null))),n=new Set,i=[];for(let e of r)for(let t of e?.proxy?.meshes??[])n.has(t.name)||(n.add(t.name),i.push(t));return i}e.s(["mergeSceneProxies",0,t])},88725,e=>{"use strict";var t=e.i(11623);e.i(82665);var s=e.i(20880);function r(e,t,s,r){let n={cancelled:!1,source:null,timer:null},i=0,a=async()=>{let a;if(n.cancelled)return;r(0===i?"connecting":"reconnecting");try{let{token:s}=await e.liveToken();a=t(s)}catch{o();return}if(n.cancelled)return;let l=new EventSource(a);n.source=l,l.onopen=()=>{i=0,r("open")},l.onerror=()=>{l.close(),n.source===l&&(n.source=null),o()},s(l)},o=()=>{if(n.cancelled)return;r("reconnecting");let e=Math.min(1e3*2**i,15e3);i+=1,n.timer=setTimeout(()=>void a(),e)};return a(),()=>{n.cancelled=!0,n.timer&&clearTimeout(n.timer),n.source?.close(),n.source=null}}async function n(e,t,s){let r=e.getReader(),n=new TextDecoder,i="";for(t.addEventListener("abort",()=>void r.cancel().catch(()=>{}));;){let{done:e,value:t}=await r.read();if(e)return;let a=(i+=n.decode(t,{stream:!0})).indexOf("\n\n");for(;a>=0;){let e=i.slice(0,a);i=i.slice(a+2);let t="message",r=[];for(let s of e.split("\n"))!s.startsWith(":")&&(s.startsWith("event:")?t=s.slice(6).trim():s.startsWith("data:")&&r.push(s.slice(5).replace(/^ /,"")));"event"===t&&r.length>0&&s(r.join("\n")),a=i.indexOf("\n\n")}}}e.s(["useLivePresence",0,function(e,n,i){let[a,o]=(0,t.useState)(null),[l,c]=(0,t.useState)("idle");return(0,t.useEffect)(()=>{if(!i||!n||!e){c("idle"),o(null);return}let t=new s.CollectorApi(e,n);return r(t,e=>t.livePresenceUrl(e),e=>{e.addEventListener("presence",e=>{try{o(JSON.parse(e.data))}catch{}})},c)},[e,n,i]),{snapshot:a,status:l}},"useLiveSession",0,function(e,r,i,a,o,l){let[c,u]=(0,t.useState)("idle"),[m,h]=(0,t.useState)(!1),[p,d]=(0,t.useState)(0),g=(0,t.useRef)(o),b=(0,t.useRef)(l);return g.current=o,b.current=l,(0,t.useEffect)(()=>{if(!a||!r||!e||!i)return void u("idle");let t=new s.CollectorApi(e,r),o=!1,l=0,c=null,m=null;h(!1),d(0);let p=()=>{if(o)return;u("reconnecting");let e=Math.min(1e3*2**l,15e3);l+=1,m=setTimeout(()=>void v(),e)},v=async()=>{let e;if(!o){u(0===l?"connecting":"reconnecting"),b.current(),d(0);try{({token:e}=await t.liveToken())}catch{p();return}if(!o){c=new AbortController;try{let s=await fetch(t.liveSessionUrl(e,i),{headers:{accept:"text/event-stream"},cache:"no-store",signal:c.signal});if(403===s.status){h(!0),u("idle");return}if(!s.ok||!s.body)return void p();l=0,u("open"),await n(s.body,c.signal,e=>{try{g.current(JSON.parse(e)),d(e=>e+1)}catch{}}),o||p()}catch{o||p()}}}};return v(),()=>{o=!0,m&&clearTimeout(m),c?.abort()}},[e,r,i,a]),{status:c,gated:m,count:p}},"useLiveStream",0,function(e,n,i,a,o){let[l,c]=(0,t.useState)("idle"),u=(0,t.useRef)(a);u.current=a;let m=o&&o.length>0?[...o].sort().join(","):"";return(0,t.useEffect)(()=>{if(!i||!n||!e)return void c("idle");let t=new s.CollectorApi(e,n),a=m?m.split(","):void 0;return r(t,e=>t.liveStreamUrl(e,a),e=>{e.addEventListener("event",e=>{try{u.current(JSON.parse(e.data))}catch{}})},c)},[e,n,i,m]),{status:l}}])},93425,e=>{"use strict";var t=e.i(28100),s=e.i(11623);function r({children:e,label:s="More information"}){return(0,t.jsxs)("span",{className:"group relative inline-flex",children:[(0,t.jsx)("button",{type:"button","aria-label":s,className:"flex h-4 w-4 items-center justify-center rounded-full border border-edge text-[10px] font-bold leading-none text-fg-muted transition hover:border-amber hover:text-fg-hi focus:outline-none focus:ring-1 focus:ring-amber",children:"?"}),(0,t.jsx)("span",{role:"tooltip",className:"pointer-events-none absolute left-1/2 top-6 z-20 w-64 -translate-x-1/2 rounded-md border border-edge bg-ink/95 p-2.5 text-xs font-normal normal-case leading-relaxed tracking-normal text-fg opacity-0 shadow-lg shadow-black/40 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100",children:e})]})}function n({label:e,onClick:s,active:r=!1,children:i}){return(0,t.jsx)("button",{type:"button","aria-label":e,title:e,onClick:s,"aria-pressed":r,className:`flex h-6 w-6 items-center justify-center rounded-md border text-sm leading-none transition focus:outline-none focus:ring-1 focus:ring-amber ${r?"border-amber text-amber":"border-edge text-fg-muted hover:border-amber hover:text-fg-hi"}`,children:i})}e.s(["Panel",0,function({title:e,subtitle:i,help:a,children:o,className:l="",collapsible:c=!1,defaultCollapsed:u=!1,onHide:m,settings:h}){let[p,d]=(0,s.useState)(c&&u),[g,b]=(0,s.useState)(!1),v=(0,t.jsxs)("header",{className:p?"":"mb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold uppercase tracking-wide text-fg",children:e}),c?(0,t.jsx)("span",{"aria-hidden":"true",className:"text-xs text-fg-muted",children:p?"▸":"▾"}):null,a?(0,t.jsx)(r,{label:`About: ${e}`,children:a}):null]}),i?(0,t.jsx)("p",{className:"mt-0.5 text-xs text-fg-muted",children:i}):null]}),_=!!h||!!m;return(0,t.jsxs)("section",{className:`rounded-xl border border-edge bg-panel p-4 shadow-lg shadow-black/20 ${l}`,children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[c?(0,t.jsx)("button",{type:"button",onClick:()=>d(e=>!e),"aria-expanded":p?"false":"true",className:"min-w-0 flex-1 text-left",children:v}):(0,t.jsx)("div",{className:"min-w-0 flex-1",children:v}),_?(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[h?(0,t.jsx)(n,{label:`${e} settings`,active:g,onClick:()=>b(e=>!e),children:(0,t.jsx)("span",{"aria-hidden":"true",children:"⚙"})}):null,m?(0,t.jsx)(n,{label:`Hide ${e}`,onClick:m,children:(0,t.jsx)("span",{"aria-hidden":"true",children:"×"})}):null]}):null]}),h&&g?(0,t.jsx)("div",{className:"mb-3 rounded-lg border border-edge bg-ink/40 p-3",children:h}):null,p?null:o]})}])},78573,e=>{e.v(t=>Promise.all(["static/chunks/39ojyykom0z2r.js"].map(t=>e.l(t))).then(()=>t(48939)))},47410,e=>{e.v(t=>Promise.all(["static/chunks/30363ptka3vzy.js"].map(t=>e.l(t))).then(()=>t(53993)))},70162,e=>{e.v(t=>Promise.all(["static/chunks/3jha6wlqw8459.js"].map(t=>e.l(t))).then(()=>t(19399)))},21269,e=>{e.v(t=>Promise.all(["static/chunks/2_hgfg-cjqw1-.js"].map(t=>e.l(t))).then(()=>t(39592)))},69091,e=>{e.v(t=>Promise.all(["static/chunks/06m_64ysu9kn0.js"].map(t=>e.l(t))).then(()=>t(12449)))},15867,e=>{e.v(t=>Promise.all(["static/chunks/2ktxjmx03u9l3.js"].map(t=>e.l(t))).then(()=>t(94452)))}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,2348,2413,e=>{"use strict";let t=1/1.2;e.s(["ZOOM_IN_FACTOR",0,t,"ZOOM_OUT_FACTOR",0,1.2,"attachDoubleClickFocus",0,function(e,t,s){let a=()=>{let t=e.pick(e.pointerX,e.pointerY);t?.hit&&t.pickedPoint&&s.setTarget(t.pickedPoint)};return t.addEventListener("dblclick",a),()=>t.removeEventListener("dblclick",a)},"disableWheelZoom",0,function(e){e.inputs.removeByType("ArcRotateCameraMouseWheelInput")},"resetFocus",0,function(e,t){e.setTarget(t.target),e.alpha=t.alpha,e.beta=t.beta,e.radius=t.radius},"stepZoom",0,function(e,t){let s=e.lowerRadiusLimit??.01,a=e.upperRadiusLimit??1/0;e.radius=Math.min(a,Math.max(s,e.radius*t))}],2348);var s=e.i(28100);e.s(["ZoomButtons",0,function({onZoom:e,onReset:a}){let n="grid h-8 w-8 place-items-center rounded-md border border-edge bg-ink/80 text-lg leading-none text-fg backdrop-blur transition hover:bg-ink hover:text-white";return(0,s.jsxs)("div",{className:"absolute right-3 top-3 flex flex-col gap-1",children:[(0,s.jsx)("button",{type:"button","aria-label":"Zoom in",className:n,onClick:()=>e(t),children:"+"}),(0,s.jsx)("button",{type:"button","aria-label":"Zoom out",className:n,onClick:()=>e(1.2),children:"−"}),a?(0,s.jsx)("button",{type:"button","aria-label":"Reset camera focus to center",title:"Reset focus to center",className:n,onClick:a,children:(0,s.jsxs)("svg",{viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":"true",children:[(0,s.jsx)("circle",{cx:"8",cy:"8",r:"3"}),(0,s.jsx)("path",{d:"M8 1v2.5M8 12.5V15M1 8h2.5M12.5 8H15"})]})}):null]})}],2413)},25476,e=>{"use strict";e.s(["attachMeshHover",0,function(e,t,s){let a=0,n=null,c=t=>{let c=t.offsetX,i=t.offsetY;a||(a=requestAnimationFrame(()=>{var t,r;let l;a=0;let h=e.pick(c,i,e=>e.isPickable&&e.isEnabled()),o=h?.pickedMesh?(t=h.pickedMesh,r=h.thinInstanceIndex??-1,(l=t.metadata)?r>=0&&l.hoverLabels?l.hoverLabels[r]??null:l.hoverLabel??null:null):null;o?s({label:o,x:c,y:i}):null!==n&&s(null),n=o}))},i=()=>{a&&(cancelAnimationFrame(a),a=0),null!==n&&(n=null,s(null))};return t.addEventListener("pointermove",c),t.addEventListener("pointerleave",i),()=>{t.removeEventListener("pointermove",c),t.removeEventListener("pointerleave",i),a&&cancelAnimationFrame(a)}}])},39592,e=>{"use strict";var t=e.i(28100),s=e.i(11623),a=e.i(56054),n=e.i(2348),c=e.i(25476),i=e.i(2413);function r(e){let t=Math.min(1,Math.max(0,e));return[.118+(.22-.118)*t,.227+.513*t,.541+(.97-.541)*t]}function l(e){return`${e.vx}|${e.vy}|${e.vz}`}function h({mode:e}){return(0,t.jsxs)("div",{className:"absolute bottom-3 right-3 max-w-72 rounded-md border border-edge bg-ink/80 px-2 py-1.5 text-xs text-fg backdrop-blur",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-sm bg-[#38bdf8]"}),"divergence"===e?"Gaze-heavy":"Gaze"]}),(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-sm bg-[#f4c84b]"}),"divergence"===e?"Click-heavy":"Clicks"]})]}),(0,t.jsx)("p",{className:"mt-1 text-fg-muted",children:"divergence"===e?"Per-voxel normalized difference: which signal dominates each cell. Color & size scale with the gap.":"Gaze = where viewers looked; Clicks = where they acted. Cells with gaze but no clicks are looked-at but un-acted-on."})]})}function o({active:e,onClick:s,children:a}){return(0,t.jsx)("button",{type:"button",onClick:s,className:`rounded px-2 py-0.5 font-medium transition ${e?"bg-amber text-ink":"text-fg-muted hover:text-fg"}`,children:a})}e.s(["GazeClickDivergence3DView",0,function({gazeVoxels:u,clickVoxels:d,cellSize:j,proxyMeshes:k=[]}){let v=(0,s.useRef)(null),m=(0,s.useRef)(null),p=(0,s.useRef)(null),[g,x]=(0,s.useState)("loading"),[b,f]=(0,s.useState)(null),[y,w]=(0,s.useState)("overlay"),[z,q]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let t=v.current;if(!t)return;if(0===u.length&&0===d.length&&0===k.length)return void x("empty");let s=!1,i=null;return x("loading"),f(null),(async()=>{try{let[{Engine:h},{Scene:o},{ArcRotateCamera:v},{HemisphericLight:g},{Vector3:b,Color3:f,Color4:w,Matrix:z},{MeshBuilder:C},{StandardMaterial:M}]=await Promise.all([e.A(3905),e.A(94432),e.A(59694),e.A(88004),e.A(27940),e.A(27124),e.A(14074),e.A(35983),e.A(18561)]);if(s)return;let _=u.reduce((e,t)=>Math.max(e,t.count),1),A=d.reduce((e,t)=>Math.max(e,t.count),1),P=[...u,...d],N=0,L=0,R=0,F=0;for(let e of P)N+=(e.vx+.5)*j,L+=(e.vy+.5)*j,R+=(e.vz+.5)*j,F++;if(0===F)for(let e of k)N+=(e.aabb[0]+e.aabb[3])/2,L+=(e.aabb[1]+e.aabb[4])/2,R+=(e.aabb[2]+e.aabb[5])/2,F++;let T=new b(N/F,L/F,R/F),E=4*j;for(let e of P){let t=(e.vx+.5)*j-T.x,s=(e.vy+.5)*j-T.y,a=(e.vz+.5)*j-T.z;E=Math.max(E,Math.sqrt(t*t+s*s+a*a))}for(let e of k){let t=(e.aabb[0]+e.aabb[3])/2-T.x,s=(e.aabb[1]+e.aabb[4])/2-T.y,a=(e.aabb[2]+e.aabb[5])/2-T.z;E=Math.max(E,Math.sqrt(t*t+s*s+a*a))}let S=new h(t,!0,{preserveDrawingBuffer:!1}),B=new o(S);B.clearColor=new w(.04,.05,.07,1);let O=new v("divergence-cam",Math.PI/4,Math.PI/3,2.4*E,T,B);if(O.attachControl(t,!0),(0,n.disableWheelZoom)(O),m.current=O,p.current={target:T,alpha:O.alpha,beta:O.beta,radius:O.radius},new g("divergence-light",new b(.4,1,.3),B),k.length>0){let e=C.CreateBox("scene-proxy",{size:1},B),t=new M("scene-proxy-mat",B);t.wireframe=!0,t.disableLighting=!0,t.emissiveColor=new f(.32,.4,.52),t.alpha=.35,e.material=t,e.isPickable=!0,e.thinInstanceEnablePicking=!0,e.metadata={hoverLabels:k.map(e=>e.name)};let s=k.length,a=new Float32Array(16*s);for(let e=0;e<s;e++){let t=k[e].aabb,s=Math.max(t[3]-t[0],.001),n=Math.max(t[4]-t[1],.001),c=Math.max(t[5]-t[2],.001);z.Scaling(s,n,c).multiply(z.Translation((t[0]+t[3])/2,(t[1]+t[4])/2,(t[2]+t[5])/2)).copyToArray(a,16*e)}e.thinInstanceSetBuffer("matrix",a,16,!0)}let Z=Math.max(.02*E,.25*j)/(.9*j),I=(e,t,s,a,n)=>{if(0===t.length)return;let c=C.CreateSphere(e,{diameter:.9*j,segments:6},B),i=new M(`${e}-mat`,B);i.diffuseColor=new f(1,1,1),i.specularColor=new f(0,0,0),c.material=i,c.metadata={hoverLabel:n};let r=t.length,l=new Float32Array(16*r),h=new Float32Array(4*r);for(let e=0;e<r;e++){let n=t[e],c=n.count/s,i=Z*(.5+.5*c);z.Scaling(i,i,i).multiply(z.Translation((n.vx+.5)*j,(n.vy+.5)*j,(n.vz+.5)*j)).copyToArray(l,16*e);let[r,o,u]=a(c);h[4*e]=r,h[4*e+1]=o,h[4*e+2]=u,h[4*e+3]=1}c.thinInstanceSetBuffer("matrix",l,16,!1),c.thinInstanceSetBuffer("color",h,4,!0)};if("divergence"===y){let e=new Map(u.map(e=>[l(e),e])),t=new Map(d.map(e=>[l(e),e])),s=new Set([...e.keys(),...t.keys()]),n=[],c=[];for(let a of s){let s=(e.get(a)?.count??0)/_,i=(t.get(a)?.count??0)/A,r=t.get(a)??e.get(a),l=i-s,h={vx:r.vx,vy:r.vy,vz:r.vz,count:1e3*Math.abs(l)};(l>=0?n:c).push(h)}I("div-click",n,1e3,a.heatRgb,"Click-heavy"),I("div-gaze",c,1e3,r,"Gaze-heavy")}else("overlay"===y||"gaze"===y)&&I("gaze-voxel",u,_,r,"Gaze"),("overlay"===y||"click"===y)&&I("click-voxel",d,A,a.heatRgb,"Click");S.runRenderLoop(()=>B.render());let D=()=>S.resize();window.addEventListener("resize",D);let G=(0,c.attachMeshHover)(B,t,q),$=(0,n.attachDoubleClickFocus)(B,t,O);x("ready"),i=()=>{window.removeEventListener("resize",D),G(),$(),q(null),m.current=null,p.current=null,B.dispose(),S.dispose()}}catch(e){if(s)return;x("error"),f(e instanceof Error?e.message:"Failed to render overlay.")}})(),()=>{s=!0,i?.()}},[u,d,j,k,y]),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("canvas",{ref:v,className:"aspect-video w-full rounded-lg border border-edge bg-ink"}),z?(0,t.jsx)("div",{className:"pointer-events-none absolute z-10 max-w-64 truncate rounded border border-edge bg-ink/90 px-1.5 py-0.5 text-xs text-white shadow backdrop-blur",style:{left:z.x+12,top:z.y+12},children:z.label}):null,"ready"===g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"absolute left-3 top-3 flex items-center gap-1 rounded-md border border-edge bg-ink/80 p-0.5 text-xs backdrop-blur",children:[(0,t.jsx)(o,{active:"overlay"===y,onClick:()=>w("overlay"),children:"Overlay"}),(0,t.jsx)(o,{active:"gaze"===y,onClick:()=>w("gaze"),children:"Gaze"}),(0,t.jsx)(o,{active:"click"===y,onClick:()=>w("click"),children:"Clicks"}),(0,t.jsx)(o,{active:"divergence"===y,onClick:()=>w("divergence"),children:"Divergence"})]}),(0,t.jsx)(i.ZoomButtons,{onZoom:e=>m.current&&(0,n.stepZoom)(m.current,e),onReset:()=>m.current&&p.current&&(0,n.resetFocus)(m.current,p.current)}),(0,t.jsx)(h,{mode:y})]}):(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-sm text-fg-muted",children:"loading"===g?"Rendering…":"empty"===g?"No gaze or click hit-points in range. Enable gaze + pointer capture in the SDK.":"error"===g?b??"Overlay unavailable.":null})]})}])},3905,e=>{e.v(t=>Promise.all(["static/chunks/3pdpaqzwhhijn.js","static/chunks/08bm3ye5govev.js","static/chunks/0g6u34xkzrpjn.js","static/chunks/25ctnyh7njp-d.js","static/chunks/2gh4z57fem0_v.js","static/chunks/3vaho-xrtuchd.js","static/chunks/0g7p8zp2kxve5.js"].map(t=>e.l(t))).then(()=>t(66232)))},94432,e=>{e.v(t=>Promise.all(["static/chunks/2kje_jvmwsvwo.js","static/chunks/1j--a56ji33_x.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/2npk7tr63h7rl.js","static/chunks/3vaho-xrtuchd.js","static/chunks/3g_h_00xs9u59.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/25ctnyh7njp-d.js","static/chunks/1vpcaaf-0dn7q.js"].map(t=>e.l(t))).then(()=>t(92494)))},59694,e=>{e.v(t=>Promise.all(["static/chunks/1j--a56ji33_x.js","static/chunks/0oap0o8a8a_cl.js","static/chunks/0f_nv15a8q415.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/245h82k-g1nxr.js","static/chunks/3ovd8o_usay7j.js","static/chunks/3vaho-xrtuchd.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/25ctnyh7njp-d.js","static/chunks/2npk7tr63h7rl.js","static/chunks/3pyggl13glbdc.js"].map(t=>e.l(t))).then(()=>t(67186)))},88004,e=>{e.v(t=>Promise.all(["static/chunks/2p8dbh81chhon.js","static/chunks/1oara6fkfvgs3.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/25ctnyh7njp-d.js","static/chunks/3pdpaqzwhhijn.js"].map(t=>e.l(t))).then(()=>t(15768)))},27940,e=>{e.v(t=>Promise.all(["static/chunks/0w0sx062qmcsh.js","static/chunks/25ctnyh7njp-d.js","static/chunks/3pdpaqzwhhijn.js"].map(t=>e.l(t))).then(()=>t(23235)))},27124,e=>{e.v(t=>Promise.all(["static/chunks/1par9m038tiov.js","static/chunks/1j--a56ji33_x.js","static/chunks/2j-sax2xfdv7l.js","static/chunks/340pg0qkv5tqq.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/0gwa154w_0wuh.js","static/chunks/0oap0o8a8a_cl.js","static/chunks/0f_nv15a8q415.js","static/chunks/3vaho-xrtuchd.js","static/chunks/3pyggl13glbdc.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/3g_h_00xs9u59.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/25ctnyh7njp-d.js","static/chunks/2npk7tr63h7rl.js","static/chunks/01aeari2x_tlz.js"].map(t=>e.l(t))).then(()=>t(70928)))},14074,e=>{e.v(t=>Promise.all(["static/chunks/1zcrrq1fx8g2y.js","static/chunks/1tdg_eolxlcdl.js","static/chunks/1j--a56ji33_x.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/0vddljjnmozzx.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/3vaho-xrtuchd.js","static/chunks/0f_nv15a8q415.js","static/chunks/3g_h_00xs9u59.js","static/chunks/2npk7tr63h7rl.js","static/chunks/25ctnyh7njp-d.js"].map(t=>e.l(t))).then(()=>t(87566)))},35983,e=>{e.v(t=>Promise.all(["static/chunks/4227p7752rnny.js","static/chunks/1j--a56ji33_x.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/2npk7tr63h7rl.js","static/chunks/1vkww9l6lgqag.js","static/chunks/25ctnyh7njp-d.js","static/chunks/0f_nv15a8q415.js","static/chunks/3vaho-xrtuchd.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/3pyggl13glbdc.js","static/chunks/3pdpaqzwhhijn.js"].map(t=>e.l(t))).then(()=>t(50608)))},18561,e=>{e.v(t=>Promise.all(["static/chunks/1j--a56ji33_x.js","static/chunks/1vkww9l6lgqag.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/2npk7tr63h7rl.js","static/chunks/117ys3lltfmcu.js","static/chunks/25ctnyh7njp-d.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/3g_h_00xs9u59.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/3vaho-xrtuchd.js"].map(t=>e.l(t))).then(()=>t(85106)))}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,2348,2413,e=>{"use strict";let t=1/1.2;e.s(["ZOOM_IN_FACTOR",0,t,"ZOOM_OUT_FACTOR",0,1.2,"attachDoubleClickFocus",0,function(e,t,a){let n=()=>{let t=e.pick(e.pointerX,e.pointerY);t?.hit&&t.pickedPoint&&a.setTarget(t.pickedPoint)};return t.addEventListener("dblclick",n),()=>t.removeEventListener("dblclick",n)},"disableWheelZoom",0,function(e){e.inputs.removeByType("ArcRotateCameraMouseWheelInput")},"resetFocus",0,function(e,t){e.setTarget(t.target),e.alpha=t.alpha,e.beta=t.beta,e.radius=t.radius},"stepZoom",0,function(e,t){let a=e.lowerRadiusLimit??.01,n=e.upperRadiusLimit??1/0;e.radius=Math.min(n,Math.max(a,e.radius*t))}],2348);var a=e.i(28100);e.s(["ZoomButtons",0,function({onZoom:e,onReset:n}){let i="grid h-8 w-8 place-items-center rounded-md border border-edge bg-ink/80 text-lg leading-none text-fg backdrop-blur transition hover:bg-ink hover:text-white";return(0,a.jsxs)("div",{className:"absolute right-3 top-3 flex flex-col gap-1",children:[(0,a.jsx)("button",{type:"button","aria-label":"Zoom in",className:i,onClick:()=>e(t),children:"+"}),(0,a.jsx)("button",{type:"button","aria-label":"Zoom out",className:i,onClick:()=>e(1.2),children:"−"}),n?(0,a.jsx)("button",{type:"button","aria-label":"Reset camera focus to center",title:"Reset focus to center",className:i,onClick:n,children:(0,a.jsxs)("svg",{viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":"true",children:[(0,a.jsx)("circle",{cx:"8",cy:"8",r:"3"}),(0,a.jsx)("path",{d:"M8 1v2.5M8 12.5V15M1 8h2.5M12.5 8H15"})]})}):null]})}],2413)},25476,e=>{"use strict";e.s(["attachMeshHover",0,function(e,t,a){let n=0,i=null,s=t=>{let s=t.offsetX,r=t.offsetY;n||(n=requestAnimationFrame(()=>{var t,l;let o;n=0;let c=e.pick(s,r,e=>e.isPickable&&e.isEnabled()),u=c?.pickedMesh?(t=c.pickedMesh,l=c.thinInstanceIndex??-1,(o=t.metadata)?l>=0&&o.hoverLabels?o.hoverLabels[l]??null:o.hoverLabel??null:null):null;u?a({label:u,x:s,y:r}):null!==i&&a(null),i=u}))},r=()=>{n&&(cancelAnimationFrame(n),n=0),null!==i&&(i=null,a(null))};return t.addEventListener("pointermove",s),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointermove",s),t.removeEventListener("pointerleave",r),n&&cancelAnimationFrame(n)}}])},48939,e=>{"use strict";var t=e.i(28100),a=e.i(11623);function n(e){return Number.isNaN(e)||e<0?0:e>1?1:e}function i(e){let t=n(e),a=[[0,.1,.9],[0,.85,1],[.1,.9,.2],[1,.85,0],[1,.15,0],[1,1,1]],i=a.length-1,s=t*i,r=Math.min(Math.floor(s),i-1),l=s-r,o=a[r],c=a[r+1];return o&&c?[o[0]+(c[0]-o[0])*l,o[1]+(c[1]-o[1])*l,o[2]+(c[2]-o[2])*l]:[1,1,1]}var s=e.i(56054),r=e.i(2348),l=e.i(25476),o=e.i(18637),c=e.i(2413);e.s(["CameraDome3DView",0,function({bins:u,gridSize:h}){let d=(0,a.useRef)(null),m=(0,a.useRef)(null),p=(0,a.useRef)(null),[b,g]=(0,a.useState)("loading"),[f,x]=(0,a.useState)(null),[v,w]=(0,a.useState)("markers"),[k,j]=(0,a.useState)(null);return(0,a.useEffect)(()=>{let t=d.current;if(!t)return;if(0===u.length)return void g("empty");let a=!1,o=null;return g("loading"),x(null),(async()=>{try{let[{Engine:c},{Scene:d},{ArcRotateCamera:b},{HemisphericLight:f},{Vector3:x,Color3:w,Color4:k,Matrix:y},{MeshBuilder:M},{StandardMaterial:z},{Mesh:C},{DynamicTexture:_}]=await Promise.all([e.A(3905),e.A(94432),e.A(59694),e.A(88004),e.A(27940),e.A(27124),e.A(14074),e.A(2213),e.A(15002),e.A(35983),e.A(18561)]);if(a)return;let A=new c(t,!0,{preserveDrawingBuffer:!1}),L=new d(A);L.clearColor=new k(.04,.05,.07,1);let I=x.Zero(),S=new b("dome-cam",Math.PI/3,Math.PI/2.4,3.6,I,L);S.attachControl(t,!0),S.lowerRadiusLimit=1.6,S.upperRadiusLimit=8,(0,r.disableWheelZoom)(S),m.current=S,p.current={target:I,alpha:S.alpha,beta:S.beta,radius:S.radius},new f("dome-light",new x(.3,1,.2),L);let E=M.CreateSphere("dome",{diameter:2,segments:20},L),P=new z("dome-mat",L);P.wireframe=!0,P.disableLighting=!0,P.emissiveColor=new w(.16,.2,.28),P.alpha=.5,E.material=P,E.isPickable=!1;let $=[];for(let e=0;e<=64;e++){let t=e/64*Math.PI*2;$.push(new x(Math.cos(t),0,Math.sin(t)))}let B=M.CreateLines("dome-horizon",{points:$},L);B.color=new w(.3,.36,.46),B.isPickable=!1;let T=M.CreateLines("dome-forward",{points:[x.Zero(),new x(1.25,0,0)]},L);T.color=new w(.4,.7,.95),T.isPickable=!1;let R=u.reduce((e,t)=>Math.max(e,t.count),1),N=h>0?h:1;if("markers"===v){let e=M.CreateBox("dome-marker",{size:1},L),t=new z("dome-marker-mat",L);t.disableLighting=!0,t.emissiveColor=w.White(),t.specularColor=new w(0,0,0),e.material=t,e.isPickable=!0,e.thinInstanceEnablePicking=!0;let a=u.length,n=new Float32Array(16*a),i=new Float32Array(4*a),r=Array(a);for(let e=0;e<a;e++){let t=u[e],a=(t.azimuth_bin+.5)/N*Math.PI*2-Math.PI,l=(t.elevation_bin+.5)/N*Math.PI-Math.PI/2,o=Math.cos(l),c=o*Math.cos(a),h=Math.sin(l),d=o*Math.sin(a),m=t.count/R,p=.03+.12*m;y.Scaling(p,p,p).multiply(y.Translation(c,h,d)).copyToArray(n,16*e);let[b,g,f]=(0,s.heatRgb)(m);i[4*e]=b,i[4*e+1]=g,i[4*e+2]=f,i[4*e+3]=1,r[e]=`dir (${t.azimuth_bin}, ${t.elevation_bin}) \xb7 ${t.count}`}e.thinInstanceSetBuffer("matrix",n,16,!0),e.thinInstanceSetBuffer("color",i,4,!0),e.metadata={hoverLabels:r}}else{let e=function(e,t={}){let a=void 0!==t.width&&t.width>0?Math.floor(t.width):256,s=void 0!==t.height&&t.height>0?Math.floor(t.height):Math.max(1,Math.floor(a/2)),r=t.colorRamp??i,l=void 0!==t.blurBins&&t.blurBins>0?t.blurBins:1.5,o=n(t.alphaFloor??0),c=n(t.opacity??1),u=e.gridSize>0?e.gridSize:1,h=new Uint8ClampedArray(a*s*4),d=e.bins.filter(e=>e.count>0);if(0===d.length)return{width:a,height:s,rgba:h};let m=Math.max(1e-4,Math.PI/u*l),p=2*m*m,b=Math.cos(Math.min(Math.PI,3*m)),g=d.map(e=>{var t,a;let n,[i,s]=(t=e.azimuthBin,a=e.elevationBin,[(t+.5)/u*Math.PI*2-Math.PI,(a+.5)/u*Math.PI-Math.PI/2]);return[(n=Math.cos(s))*Math.cos(i),Math.sin(s),n*Math.sin(i)]}),f=new Float32Array(a*s),x=0;for(let e=0;e<s;e++){let t=Math.PI/2-(e+.5)/s*Math.PI,n=Math.cos(t),i=Math.sin(t);for(let t=0;t<a;t++){let s=(t+.5)/a*Math.PI*2-Math.PI,r=n*Math.cos(s),l=n*Math.sin(s),o=0;for(let e=0;e<d.length;e++){let t=g[e],a=r*t[0]+i*t[1]+l*t[2];if(a<b)continue;let n=Math.acos(a>1?1:a<-1?-1:a);o+=d[e].count*Math.exp(-(n*n)/p)}f[e*a+t]=o,o>x&&(x=o)}}if(x<=0)return{width:a,height:s,rgba:h};for(let e=0;e<f.length;e++){let t=n(f[e]/x),[a,i,s]=r(t),l=(o+(1-o)*t)*c,u=4*e;h[u]=Math.round(255*a),h[u+1]=Math.round(255*i),h[u+2]=Math.round(255*s),h[u+3]=Math.round(255*n(l))}return{width:a,height:s,rgba:h}}({bins:u.map(e=>({azimuthBin:e.azimuth_bin,elevationBin:e.elevation_bin,count:e.count})),gridSize:N},{width:256,blurBins:1.5,opacity:.95}),t=new _("dome-skytex",{width:e.width,height:e.height},L,!1);t.hasAlpha=!0;let a=t.getContext(),s=a.createImageData(e.width,e.height);s.data.set(e.rgba),a.putImageData(s,0,0),t.update();let r=M.CreateSphere("dome-sky",{diameter:2,segments:48,sideOrientation:C.DOUBLESIDE},L),l=new z("dome-sky-mat",L);l.disableLighting=!0,l.emissiveColor=w.White(),l.diffuseColor=new w(0,0,0),l.specularColor=new w(0,0,0),l.emissiveTexture=t,l.opacityTexture=t,l.backFaceCulling=!1,r.material=l,r.isPickable=!1}A.runRenderLoop(()=>L.render());let F=()=>A.resize();window.addEventListener("resize",F);let q=(0,l.attachMeshHover)(L,t,j),D=(0,r.attachDoubleClickFocus)(L,t,S);g("ready"),o=()=>{window.removeEventListener("resize",F),q(),D(),j(null),m.current=null,p.current=null,L.dispose(),A.dispose()}}catch(e){if(a)return;g("error"),x(e instanceof Error?e.message:"Failed to render dome.")}})(),()=>{a=!0,o?.()}},[u,h,v]),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("canvas",{ref:d,className:"aspect-video w-full rounded-lg border border-edge bg-ink"}),k?(0,t.jsx)("div",{className:"pointer-events-none absolute z-10 max-w-[16rem] truncate rounded border border-edge bg-ink/90 px-1.5 py-0.5 text-xs text-white shadow backdrop-blur",style:{left:k.x+12,top:k.y+12},children:k.label}):null,"ready"===b?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute left-3 top-3 flex overflow-hidden rounded-md border border-edge bg-ink/80 text-xs backdrop-blur",children:["markers","skydome"].map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>w(e),className:`px-2.5 py-1 ${v===e?"bg-fg/15 font-medium text-white":"text-fg-muted hover:text-fg"}`,children:"markers"===e?"Markers":"Skydome"},e))}),(0,t.jsx)(c.ZoomButtons,{onZoom:e=>m.current&&(0,r.stepZoom)(m.current,e),onReset:()=>m.current&&p.current&&(0,r.resetFocus)(m.current,p.current)}),(0,t.jsx)(o.HeatLegend,{title:"Gaze density",lowLabel:"rarely",highLabel:"most-viewed",note:"markers"===v?"Each marker is a look-direction (camera forward). Blue line = forward, ring = horizon. Color & size scale with how often that direction was viewed.":"Continuous equirectangular heat field: the same gaze bins splatted into a smooth thermal texture wrapped on the dome. The in-scene SDK overlay (showGazeSkydome) renders this inward so you can stand inside it in WebXR."})]}):(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-sm text-fg-muted",children:"loading"===b?"Rendering…":"empty"===b?"No camera samples in range.":"error"===b?f??"Dome unavailable.":null})]})}],48939)},53993,e=>{"use strict";var t=e.i(28100),a=e.i(11623),n=e.i(56054),i=e.i(2348),s=e.i(25476),r=e.i(18637),l=e.i(2413);function o({shape:e,onChange:a}){let n=e=>`h-8 px-2.5 text-xs font-medium leading-none transition first:rounded-l-md last:rounded-r-md ${e?"bg-ink text-white":"bg-ink/80 text-fg hover:text-white"}`,i="sphere"===e,s="cube"===e;return(0,t.jsxs)("div",{className:"absolute left-3 top-3 flex overflow-hidden rounded-md border border-edge backdrop-blur",role:"group","aria-label":"Voxel marker shape",children:[(0,t.jsx)("button",{type:"button",className:n(i),"aria-pressed":i,onClick:()=>a("sphere"),children:"Spheres"}),(0,t.jsx)("button",{type:"button",className:n(s),"aria-pressed":s,onClick:()=>a("cube"),children:"Cubes"})]})}e.s(["WorldHeatmap3DView",0,function({voxels:c,cellSize:u,proxyMeshes:h=[],legendTitle:d="Pointer-hit density",legendLow:m="few hits",legendHigh:p="most hits",legendNote:b="Each marker is a voxel where the pointer hit your scene. Color & size scale with hits, normalized to the 95th-percentile cell so a few hotspots don't wash out the rest.",emptyLabel:g="No 3D hit-points in range.",totals:f}){let x=(0,a.useRef)(null),v=(0,a.useRef)(null),w=(0,a.useRef)(null),[k,j]=(0,a.useState)("loading"),[y,M]=(0,a.useState)(null),[z,C]=(0,a.useState)("sphere"),[_,A]=(0,a.useState)(null);(0,a.useEffect)(()=>{let t=x.current;if(!t)return;if(0===c.length&&0===h.length)return void j("empty");let a=!1,r=null;return j("loading"),M(null),(async()=>{try{let[{Engine:l},{Scene:o},{ArcRotateCamera:d},{HemisphericLight:m},{Vector3:p,Color3:b,Color4:g,Matrix:f},{MeshBuilder:x},{StandardMaterial:k}]=await Promise.all([e.A(3905),e.A(94432),e.A(59694),e.A(88004),e.A(27940),e.A(27124),e.A(14074),e.A(35983),e.A(18561)]);if(a)return;let y=(0,n.percentileMax)(c.map(e=>e.count),.95),M=0,C=0,_=0,L=0;for(let e of c)M+=(e.vx+.5)*u,C+=(e.vy+.5)*u,_+=(e.vz+.5)*u,L++;if(0===L)for(let e of h)M+=(e.aabb[0]+e.aabb[3])/2,C+=(e.aabb[1]+e.aabb[4])/2,_+=(e.aabb[2]+e.aabb[5])/2,L++;let I=new p(M/L,C/L,_/L),S=4*u;for(let e of c){let t=(e.vx+.5)*u-I.x,a=(e.vy+.5)*u-I.y,n=(e.vz+.5)*u-I.z;S=Math.max(S,Math.sqrt(t*t+a*a+n*n))}for(let e of h){let t=(e.aabb[0]+e.aabb[3])/2-I.x,a=(e.aabb[1]+e.aabb[4])/2-I.y,n=(e.aabb[2]+e.aabb[5])/2-I.z;S=Math.max(S,Math.sqrt(t*t+a*a+n*n))}let E=new l(t,!0,{preserveDrawingBuffer:!1}),P=new o(E);P.clearColor=new g(.04,.05,.07,1);let $=new d("world-cam",Math.PI/4,Math.PI/3,2.4*S,I,P);if($.attachControl(t,!0),(0,i.disableWheelZoom)($),v.current=$,w.current={target:I,alpha:$.alpha,beta:$.beta,radius:$.radius},new m("world-light",new p(.4,1,.3),P),h.length>0){let e=x.CreateBox("scene-proxy",{size:1},P),t=new k("scene-proxy-mat",P);t.wireframe=!0,t.disableLighting=!0,t.emissiveColor=new b(.32,.4,.52),t.alpha=.35,e.material=t,e.isPickable=!0,e.thinInstanceEnablePicking=!0,e.metadata={hoverLabels:h.map(e=>e.name)};let a=h.length,n=new Float32Array(16*a);for(let e=0;e<a;e++){let t=h[e].aabb,a=Math.max(t[3]-t[0],.001),i=Math.max(t[4]-t[1],.001),s=Math.max(t[5]-t[2],.001);f.Scaling(a,i,s).multiply(f.Translation((t[0]+t[3])/2,(t[1]+t[4])/2,(t[2]+t[5])/2)).copyToArray(n,16*e)}e.thinInstanceSetBuffer("matrix",n,16,!0)}if(c.length>0){let e="cube"===z?x.CreateBox("world-voxel",{size:.9*u},P):x.CreateSphere("world-voxel",{diameter:.9*u,segments:6},P),t=new k("world-voxel-mat",P);t.diffuseColor=new b(1,1,1),t.specularColor=new b(0,0,0),e.material=t;let a=c.length,i=new Float32Array(16*a),s=new Float32Array(4*a),r=new Float32Array(a),l=Math.max(.02*S,.25*u)/(.9*u);for(let e=0;e<a;e++){let t=c[e],a=Math.min(1,t.count/y),o=l*(.5+.5*a);r[e]=o,f.Scaling(o,o,o).multiply(f.Translation((t.vx+.5)*u,(t.vy+.5)*u,(t.vz+.5)*u)).copyToArray(i,16*e);let[h,d,m]=(0,n.heatRgb)(a);s[4*e]=h,s[4*e+1]=d,s[4*e+2]=m,s[4*e+3]=1}e.thinInstanceSetBuffer("matrix",i,16,!1),e.thinInstanceSetBuffer("color",s,4,!0);let o=$.radius,h=0,d=()=>{let t=Math.min(8,Math.max(.6,$.radius/o));if(!(.01>Math.abs(t-h))){h=t;for(let e=0;e<a;e++){let a=r[e]*t,n=16*e;i[n]=a,i[n+5]=a,i[n+10]=a}e.thinInstanceBufferUpdated("matrix")}};d(),P.onBeforeRenderObservable.add(d)}E.runRenderLoop(()=>P.render());let B=()=>E.resize();window.addEventListener("resize",B);let T=(0,s.attachMeshHover)(P,t,A),R=(0,i.attachDoubleClickFocus)(P,t,$);j("ready"),r=()=>{window.removeEventListener("resize",B),T(),R(),A(null),v.current=null,w.current=null,P.dispose(),E.dispose()}}catch(e){if(a)return;j("error"),M(e instanceof Error?e.message:"Failed to render heatmap.")}})(),()=>{a=!0,r?.()}},[c,u,h,z]);let L=f?f.cells>c.length?` Showing the ${c.length.toLocaleString()} busiest of ${f.cells.toLocaleString()} occupied cells (${f.hits.toLocaleString()} total hits).`:` ${f.cells.toLocaleString()} occupied cells, ${f.hits.toLocaleString()} total hits.`:"";return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("canvas",{ref:x,className:"aspect-video w-full rounded-lg border border-edge bg-ink"}),_?(0,t.jsx)("div",{className:"pointer-events-none absolute z-10 max-w-[16rem] truncate rounded border border-edge bg-ink/90 px-1.5 py-0.5 text-xs text-white shadow backdrop-blur",style:{left:_.x+12,top:_.y+12},children:_.label}):null,"ready"===k?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o,{shape:z,onChange:C}),(0,t.jsx)(l.ZoomButtons,{onZoom:e=>v.current&&(0,i.stepZoom)(v.current,e),onReset:()=>v.current&&w.current&&(0,i.resetFocus)(v.current,w.current)}),(0,t.jsx)(r.HeatLegend,{title:d,lowLabel:m,highLabel:p,note:b+L})]}):(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-sm text-fg-muted",children:"loading"===k?"Rendering…":"empty"===k?g:"error"===k?y??"Heatmap unavailable.":null})]})}])},39592,e=>{"use strict";var t=e.i(28100),a=e.i(11623),n=e.i(56054),i=e.i(2348),s=e.i(25476),r=e.i(2413);function l(e){let t=Math.min(1,Math.max(0,e));return[.118+(.22-.118)*t,.227+.513*t,.541+(.97-.541)*t]}function o(e){return`${e.vx}|${e.vy}|${e.vz}`}function c({mode:e}){return(0,t.jsxs)("div",{className:"absolute bottom-3 right-3 max-w-72 rounded-md border border-edge bg-ink/80 px-2 py-1.5 text-xs text-fg backdrop-blur",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-sm bg-[#38bdf8]"}),"divergence"===e?"Gaze-heavy":"Gaze"]}),(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-sm bg-[#f4c84b]"}),"divergence"===e?"Click-heavy":"Clicks"]})]}),(0,t.jsx)("p",{className:"mt-1 text-fg-muted",children:"divergence"===e?"Per-voxel normalized difference: which signal dominates each cell. Color & size scale with the gap.":"Gaze = where viewers looked; Clicks = where they acted. Cells with gaze but no clicks are looked-at but un-acted-on."})]})}function u({active:e,onClick:a,children:n}){return(0,t.jsx)("button",{type:"button",onClick:a,className:`rounded px-2 py-0.5 font-medium transition ${e?"bg-amber text-ink":"text-fg-muted hover:text-fg"}`,children:n})}e.s(["GazeClickDivergence3DView",0,function({gazeVoxels:h,clickVoxels:d,cellSize:m,proxyMeshes:p=[]}){let b=(0,a.useRef)(null),g=(0,a.useRef)(null),f=(0,a.useRef)(null),[x,v]=(0,a.useState)("loading"),[w,k]=(0,a.useState)(null),[j,y]=(0,a.useState)("overlay"),[M,z]=(0,a.useState)(null);return(0,a.useEffect)(()=>{let t=b.current;if(!t)return;if(0===h.length&&0===d.length&&0===p.length)return void v("empty");let a=!1,r=null;return v("loading"),k(null),(async()=>{try{let[{Engine:c},{Scene:u},{ArcRotateCamera:b},{HemisphericLight:x},{Vector3:w,Color3:k,Color4:y,Matrix:M},{MeshBuilder:C},{StandardMaterial:_}]=await Promise.all([e.A(3905),e.A(94432),e.A(59694),e.A(88004),e.A(27940),e.A(27124),e.A(14074),e.A(35983),e.A(18561)]);if(a)return;let A=h.reduce((e,t)=>Math.max(e,t.count),1),L=d.reduce((e,t)=>Math.max(e,t.count),1),I=[...h,...d],S=0,E=0,P=0,$=0;for(let e of I)S+=(e.vx+.5)*m,E+=(e.vy+.5)*m,P+=(e.vz+.5)*m,$++;if(0===$)for(let e of p)S+=(e.aabb[0]+e.aabb[3])/2,E+=(e.aabb[1]+e.aabb[4])/2,P+=(e.aabb[2]+e.aabb[5])/2,$++;let B=new w(S/$,E/$,P/$),T=4*m;for(let e of I){let t=(e.vx+.5)*m-B.x,a=(e.vy+.5)*m-B.y,n=(e.vz+.5)*m-B.z;T=Math.max(T,Math.sqrt(t*t+a*a+n*n))}for(let e of p){let t=(e.aabb[0]+e.aabb[3])/2-B.x,a=(e.aabb[1]+e.aabb[4])/2-B.y,n=(e.aabb[2]+e.aabb[5])/2-B.z;T=Math.max(T,Math.sqrt(t*t+a*a+n*n))}let R=new c(t,!0,{preserveDrawingBuffer:!1}),N=new u(R);N.clearColor=new y(.04,.05,.07,1);let F=new b("divergence-cam",Math.PI/4,Math.PI/3,2.4*T,B,N);if(F.attachControl(t,!0),(0,i.disableWheelZoom)(F),g.current=F,f.current={target:B,alpha:F.alpha,beta:F.beta,radius:F.radius},new x("divergence-light",new w(.4,1,.3),N),p.length>0){let e=C.CreateBox("scene-proxy",{size:1},N),t=new _("scene-proxy-mat",N);t.wireframe=!0,t.disableLighting=!0,t.emissiveColor=new k(.32,.4,.52),t.alpha=.35,e.material=t,e.isPickable=!0,e.thinInstanceEnablePicking=!0,e.metadata={hoverLabels:p.map(e=>e.name)};let a=p.length,n=new Float32Array(16*a);for(let e=0;e<a;e++){let t=p[e].aabb,a=Math.max(t[3]-t[0],.001),i=Math.max(t[4]-t[1],.001),s=Math.max(t[5]-t[2],.001);M.Scaling(a,i,s).multiply(M.Translation((t[0]+t[3])/2,(t[1]+t[4])/2,(t[2]+t[5])/2)).copyToArray(n,16*e)}e.thinInstanceSetBuffer("matrix",n,16,!0)}let q=Math.max(.02*T,.25*m)/(.9*m),D=(e,t,a,n,i)=>{if(0===t.length)return;let s=C.CreateSphere(e,{diameter:.9*m,segments:6},N),r=new _(`${e}-mat`,N);r.diffuseColor=new k(1,1,1),r.specularColor=new k(0,0,0),s.material=r,s.metadata={hoverLabel:i};let l=t.length,o=new Float32Array(16*l),c=new Float32Array(4*l);for(let e=0;e<l;e++){let i=t[e],s=i.count/a,r=q*(.5+.5*s);M.Scaling(r,r,r).multiply(M.Translation((i.vx+.5)*m,(i.vy+.5)*m,(i.vz+.5)*m)).copyToArray(o,16*e);let[l,u,h]=n(s);c[4*e]=l,c[4*e+1]=u,c[4*e+2]=h,c[4*e+3]=1}s.thinInstanceSetBuffer("matrix",o,16,!1),s.thinInstanceSetBuffer("color",c,4,!0)};if("divergence"===j){let e=new Map(h.map(e=>[o(e),e])),t=new Map(d.map(e=>[o(e),e])),a=new Set([...e.keys(),...t.keys()]),i=[],s=[];for(let n of a){let a=(e.get(n)?.count??0)/A,r=(t.get(n)?.count??0)/L,l=t.get(n)??e.get(n),o=r-a,c={vx:l.vx,vy:l.vy,vz:l.vz,count:1e3*Math.abs(o)};(o>=0?i:s).push(c)}D("div-click",i,1e3,n.heatRgb,"Click-heavy"),D("div-gaze",s,1e3,l,"Gaze-heavy")}else("overlay"===j||"gaze"===j)&&D("gaze-voxel",h,A,l,"Gaze"),("overlay"===j||"click"===j)&&D("click-voxel",d,L,n.heatRgb,"Click");R.runRenderLoop(()=>N.render());let O=()=>R.resize();window.addEventListener("resize",O);let Z=(0,s.attachMeshHover)(N,t,z),V=(0,i.attachDoubleClickFocus)(N,t,F);v("ready"),r=()=>{window.removeEventListener("resize",O),Z(),V(),z(null),g.current=null,f.current=null,N.dispose(),R.dispose()}}catch(e){if(a)return;v("error"),k(e instanceof Error?e.message:"Failed to render overlay.")}})(),()=>{a=!0,r?.()}},[h,d,m,p,j]),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("canvas",{ref:b,className:"aspect-video w-full rounded-lg border border-edge bg-ink"}),M?(0,t.jsx)("div",{className:"pointer-events-none absolute z-10 max-w-64 truncate rounded border border-edge bg-ink/90 px-1.5 py-0.5 text-xs text-white shadow backdrop-blur",style:{left:M.x+12,top:M.y+12},children:M.label}):null,"ready"===x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"absolute left-3 top-3 flex items-center gap-1 rounded-md border border-edge bg-ink/80 p-0.5 text-xs backdrop-blur",children:[(0,t.jsx)(u,{active:"overlay"===j,onClick:()=>y("overlay"),children:"Overlay"}),(0,t.jsx)(u,{active:"gaze"===j,onClick:()=>y("gaze"),children:"Gaze"}),(0,t.jsx)(u,{active:"click"===j,onClick:()=>y("click"),children:"Clicks"}),(0,t.jsx)(u,{active:"divergence"===j,onClick:()=>y("divergence"),children:"Divergence"})]}),(0,t.jsx)(r.ZoomButtons,{onZoom:e=>g.current&&(0,i.stepZoom)(g.current,e),onReset:()=>g.current&&f.current&&(0,i.resetFocus)(g.current,f.current)}),(0,t.jsx)(c,{mode:j})]}):(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-sm text-fg-muted",children:"loading"===x?"Rendering…":"empty"===x?"No gaze or click hit-points in range. Enable gaze + pointer capture in the SDK.":"error"===x?w??"Overlay unavailable.":null})]})}])},19399,e=>{"use strict";var t=e.i(28100),a=e.i(11623),n=e.i(20880);let i="__other_sp__",s="__other_mesh__";function r(e){return`${e[0]}|${e[1]}|${e[2]}`}function l(e,t){return t<=1?0:1.4-e/(t-1)*2.8}var o=e.i(56054),c=e.i(2348),u=e.i(25476),h=e.i(18637),d=e.i(2413);let m="__all__",p={maxStandpoints:6,maxMeshes:10,maxRibbons:70};function b(e,t){return`${e}|${t}`}function g({label:e,value:a,onChange:n,allLabel:i,options:s}){return(0,t.jsxs)("label",{className:"flex items-center gap-1.5 rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg backdrop-blur",children:[(0,t.jsx)("span",{className:"font-medium text-fg-muted",children:e}),(0,t.jsxs)("select",{className:"max-w-[12rem] bg-transparent text-white outline-none",value:a,onChange:e=>n(e.target.value),children:[(0,t.jsx)("option",{value:m,children:i}),s.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))]})]})}function f({active:e,onClick:a,children:n,disabled:i=!1,title:s}){return(0,t.jsx)("button",{type:"button",onClick:a,disabled:i,title:s,className:`rounded px-2 py-0.5 font-medium transition ${i?"cursor-not-allowed text-fg-muted/40":e?"bg-amber text-ink":"text-fg-muted hover:text-fg"}`,children:n})}function x({standpoints:e,proxyMeshes:n,selectedKey:i,onSelect:s}){let r=(0,a.useRef)(null),l=(0,a.useMemo)(()=>e.filter(e=>e.origin),[e]),o=(0,a.useMemo)(()=>{let e=1/0,t=-1/0,a=1/0,i=-1/0,s=(n,s)=>{e=Math.min(e,n),t=Math.max(t,n),a=Math.min(a,s),i=Math.max(i,s)};for(let e of n)s(e.aabb[0],e.aabb[2]),s(e.aabb[3],e.aabb[5]);for(let e of l)s(e.origin[0],e.origin[2]);return Number.isFinite(e)?(t-e<.001&&(e-=1,t+=1),i-a<.001&&(a-=1,i+=1),{minX:e,maxX:t,minZ:a,maxZ:i}):{minX:-1,maxX:1,minZ:-1,maxZ:1}},[n,l]),c=(0,a.useMemo)(()=>{let e=Math.min(134/(o.maxX-o.minX),94/(o.maxZ-o.minZ));return(t,a)=>[8+(t-o.minX)*e,8+(a-o.minZ)*e]},[o]),u=(0,a.useMemo)(()=>l.reduce((e,t)=>Math.max(e,t.count),1),[l]);return(0,a.useEffect)(()=>{let e=r.current,t=e?.getContext("2d");if(!t)return;let a=window.devicePixelRatio||1;for(let i of(e.width=150*a,e.height=110*a,t.setTransform(a,0,0,a,0,0),t.clearRect(0,0,150,110),t.fillStyle="rgba(8,10,14,0.85)",t.fillRect(0,0,150,110),t.strokeStyle="rgba(120,140,170,0.35)",t.lineWidth=1,n)){let[e,a]=c(i.aabb[0],i.aabb[2]),[n,s]=c(i.aabb[3],i.aabb[5]);t.strokeRect(Math.min(e,n),Math.min(a,s),Math.abs(n-e),Math.abs(s-a))}for(let e of l){let[a,n]=c(e.origin[0],e.origin[2]),s=2+e.count/u*4,r=e.key===i;t.beginPath(),t.arc(a,n,s,0,2*Math.PI),t.fillStyle=r?"rgba(242,115,242,1)":"rgba(242,115,242,0.55)",t.fill(),r&&(t.beginPath(),t.arc(a,n,s+2.5,0,2*Math.PI),t.strokeStyle="rgba(255,255,255,0.9)",t.lineWidth=1.5,t.stroke())}},[n,l,c,u,i]),(0,t.jsxs)("div",{className:"absolute right-3 top-3 rounded-md border border-edge bg-ink/80 p-1 backdrop-blur",children:[(0,t.jsx)("div",{className:"px-1 pb-0.5 text-[10px] font-medium text-fg-muted",children:"Standpoints (top view)"}),(0,t.jsx)("canvas",{ref:r,className:"h-27.5 w-37.5 cursor-pointer rounded",onClick:e=>{let t=r.current;if(!t||0===l.length)return;let a=t.getBoundingClientRect(),n=(e.clientX-a.left)/a.width*150,i=(e.clientY-a.top)/a.height*110,o=null,u=1/0;for(let e of l){let[t,a]=c(e.origin[0],e.origin[2]),s=(t-n)**2+(a-i)**2;s<u&&(u=s,o=e)}o&&u<=196&&s(o.key)}})]})}e.s(["FlowSankey3DView",0,function({links:v,gridSize:w,proxyMeshes:k=[],maxLinks:j=80,baseUrl:y,apiKey:M,flowQuery:z,hasFirstPerson:C=!1}){let _=(0,a.useRef)(null),A=(0,a.useRef)(null),L=(0,a.useRef)(null),[I,S]=(0,a.useState)("loading"),[E,P]=(0,a.useState)(null),[$,B]=(0,a.useState)(m),[T,R]=(0,a.useState)(m),[N,F]=(0,a.useState)(m),[q,D]=(0,a.useState)("aggregate"),[O,Z]=(0,a.useState)(null),[V,W]=(0,a.useState)("all"),[H,K]=(0,a.useState)(v),U=!!(y&&z),G=(0,a.useMemo)(()=>z?JSON.stringify(z):"",[z]),Y=(0,a.useRef)(!1);(0,a.useEffect)(()=>{!Y.current&&C&&(W("first-person"),Y.current=!0)},[C]),(0,a.useEffect)(()=>{C&&"viewer"===V&&W("first-person")},[C,V]),(0,a.useEffect)(()=>{U||K(v)},[v,U]),(0,a.useEffect)(()=>{if(!y||!z)return;let e=!1,t=new n.CollectorApi(y,M??""),a="all"===V?void 0:V;return t.flowHeatmap({...z,bins:w,limit:400,groupByOrigin:!0,cameraMode:a}).then(t=>{e||K(t)}).catch(()=>{e||K([])}),()=>{e=!0}},[y,M,G,V,w]);let X=(0,a.useMemo)(()=>{let e=new Map;for(let t of H){if(!t.originVoxel)continue;let a=r(t.originVoxel),n=t.origin,i=e.get(a);i?(i.count+=t.count,n&&(i.ox+=n[0]*t.count,i.oy+=n[1]*t.count,i.oz+=n[2]*t.count,i.wsum+=t.count)):e.set(a,{key:a,voxel:t.originVoxel,count:t.count,ox:n?n[0]*t.count:0,oy:n?n[1]*t.count:0,oz:n?n[2]*t.count:0,wsum:n?t.count:0})}return[...e.values()].map(e=>({key:e.key,voxel:e.voxel,count:e.count,origin:e.wsum>0?[e.ox/e.wsum,e.oy/e.wsum,e.oz/e.wsum]:void 0})).sort((e,t)=>t.count-e.count)},[H]),J=X.length>0,Q=(0,a.useMemo)(()=>N===m?null:X.find(e=>e.key===N)??null,[X,N]),ee=(0,a.useMemo)(()=>(function(e,t,a,n){let o=e.filter(e=>e.originVoxel);if(0===o.length)return{standpoints:[],gazes:[],meshes:[],ribbons:[],maxCount:1};let c=t.slice(0,Math.max(1,n.maxStandpoints)),u=new Set(c.map(e=>e.key)),h=e=>{let t=e.originVoxel?r(e.originVoxel):i;return u.has(t)?t:i},d=new Map;for(let e of o)d.set(e.mesh,(d.get(e.mesh)??0)+e.count);let m=new Set([...d.entries()].sort((e,t)=>t[1]-e[1]).slice(0,Math.max(1,n.maxMeshes)).map(([e])=>e)),p=e=>m.has(e)?e:s,b=new Map;for(let e of o){let t=h(e),a=p(e.mesh),n=`${t}|${e.azimuth_bin}|${e.elevation_bin}|${a}`,i=b.get(n);i?i.count+=e.count:b.set(n,{standpointId:t,gazeId:`${t}|${e.azimuth_bin}|${e.elevation_bin}`,meshId:a,azimuthBin:e.azimuth_bin,elevationBin:e.elevation_bin,count:e.count})}let g=[...b.values()].sort((e,t)=>t.count-e.count),f=g.slice(0,Math.max(1,n.maxRibbons)),x=g.slice(Math.max(1,n.maxRibbons));if(x.length>0){let e=new Map(f.map(e=>[`${e.standpointId}|${e.azimuthBin}|${e.elevationBin}|${s}`,e]));for(let t of x){let a=`${t.standpointId}|${t.azimuthBin}|${t.elevationBin}|${s}`,n=e.get(a);if(n)n.count+=t.count;else{let n={standpointId:t.standpointId,gazeId:t.gazeId,meshId:s,azimuthBin:t.azimuthBin,elevationBin:t.elevationBin,count:t.count};e.set(a,n),f.push(n)}}}let v=new Set(f.map(e=>e.standpointId)),w=new Set(f.map(e=>e.meshId)),k=[...c.filter(e=>v.has(e.key)).map(e=>e.key),...v.has(i)?[i]:[]],j=k.map((e,t)=>{let a=c.find(t=>t.key===e),n=f.filter(t=>t.standpointId===e).reduce((e,t)=>e+t.count,0);return{id:e,kind:"standpoint",pos:[-2.6,l(t,k.length),0],count:n,label:a?`[${a.voxel[0]}, ${a.voxel[1]}, ${a.voxel[2]}]`:"Other standpoints",isOther:e===i}}),y=new Map(j.map(e=>[e.id,e.pos[1]])),M=new Map;for(let e of f)M.set(e.meshId,(M.get(e.meshId)??0)+e.count);let z=[...w].sort((e,t)=>(M.get(t)??0)-(M.get(e)??0));z.sort((e,t)=>(e===s)-(t===s));let C=z.map((e,t)=>({id:e,kind:"mesh",pos:[2.6,l(t,z.length),0],count:M.get(e)??0,label:e===s?"Other meshes":e,isOther:e===s})),_=new Map;for(let e of f){let t=_.get(e.gazeId);t?t.count+=e.count:_.set(e.gazeId,{az:e.azimuthBin,el:e.elevationBin,sp:e.standpointId,count:e.count})}let A=[..._.entries()].map(([e,t])=>{let n=y.get(t.sp)??0,i=(t.az+.5)/a-.5;return{id:e,kind:"gaze",pos:[0,n+((t.el+.5)/a-.5)*.85,1.6*i],count:t.count,label:`(${t.az}, ${t.el})`,isOther:!1}}),L=f.reduce((e,t)=>Math.max(e,t.count),1);return{standpoints:j,gazes:A,meshes:C,ribbons:f,maxCount:L}})(H,X,w,p),[H,X,w]),et="twostage"===q&&J;(0,a.useEffect)(()=>{"twostage"!==q||J||D("aggregate")},[q,J]);let ea=(0,a.useMemo)(()=>{if(N!==m&&J)return H.filter(e=>e.originVoxel&&r(e.originVoxel)===N);if(!J)return H;let e=new Map;for(let t of H){let a=`${t.azimuth_bin}|${t.elevation_bin}|${t.mesh}`,n=e.get(a);n?n.count+=t.count:e.set(a,{azimuth_bin:t.azimuth_bin,elevation_bin:t.elevation_bin,mesh:t.mesh,count:t.count})}return[...e.values()]},[H,N,J]),en=(0,a.useMemo)(()=>[...ea].sort((e,t)=>t.count-e.count).slice(0,Math.max(1,j)),[ea,j]),ei=(0,a.useMemo)(()=>{let e=new Map;for(let t of en)e.set(t.mesh,(e.get(t.mesh)??0)+t.count);return[...e.entries()].sort((e,t)=>t[1]-e[1])},[en]),es=(0,a.useMemo)(()=>{let e=new Map;for(let t of en){let a=b(t.azimuth_bin,t.elevation_bin),n=e.get(a);n?n.count+=t.count:e.set(a,{azimuthBin:t.azimuth_bin,elevationBin:t.elevation_bin,count:t.count})}return[...e.values()].sort((e,t)=>t.count-e.count)},[en]);(0,a.useEffect)(()=>{!et&&$!==m&&(ei.some(([e])=>e===$)||B(m))},[et,$,ei]),(0,a.useEffect)(()=>{!et&&T!==m&&(es.some(e=>b(e.azimuthBin,e.elevationBin)===T)||R(m))},[et,T,es]),(0,a.useEffect)(()=>{!et&&N!==m&&(X.some(e=>e.key===N)||F(m))},[et,N,X]),(0,a.useEffect)(()=>{B(m),R(m),F(m)},[q]);let er=(0,a.useMemo)(()=>et?ee.ribbons.filter(e=>{let t=N===m||e.standpointId===N,a=T===m||b(e.azimuthBin,e.elevationBin)===T,n=$===m||e.meshId===$;return t&&a&&n}).length:en.filter(e=>{let t=T===m||b(e.azimuth_bin,e.elevation_bin)===T,a=$===m||e.mesh===$;return t&&a}).length,[et,ee,en,$,T,N]),el=et?ee.ribbons.length:en.length,eo=(0,a.useMemo)(()=>et?ee.standpoints.map(e=>({value:e.id,label:`${e.label} \xb7 ${e.count}`})):X.slice(0,24).map(e=>({value:e.key,label:`[${e.voxel[0]}, ${e.voxel[1]}, ${e.voxel[2]}] \xb7 ${e.count}`})),[et,ee,X]),ec=(0,a.useMemo)(()=>{if(et){let e=new Map;for(let t of ee.ribbons){let a=b(t.azimuthBin,t.elevationBin),n=e.get(a);n?n.count+=t.count:e.set(a,{az:t.azimuthBin,el:t.elevationBin,count:t.count})}return[...e.values()].sort((e,t)=>t.count-e.count).map(e=>({value:b(e.az,e.el),label:`(${e.az}, ${e.el}) \xb7 ${e.count}`}))}return es.map(e=>({value:b(e.azimuthBin,e.elevationBin),label:`(${e.azimuthBin}, ${e.elevationBin}) \xb7 ${e.count}`}))},[et,ee,es]),eu=(0,a.useMemo)(()=>et?ee.meshes.map(e=>({value:e.id,label:`${e.label} \xb7 ${e.count}`})):ei.map(([e,t])=>({value:e,label:`${e} \xb7 ${t}`})),[et,ee,ei]);return(0,a.useEffect)(()=>{let t=_.current;if(!t||et)return;if(0===en.length)return void S("empty");let a=!1,n=null;return S("loading"),P(null),(async()=>{try{let[{Engine:i},{Scene:s},{ArcRotateCamera:r},{HemisphericLight:l},{Vector3:h,Color3:d,Color4:p},{MeshBuilder:g},{StandardMaterial:f}]=await Promise.all([e.A(3905),e.A(94432),e.A(59694),e.A(88004),e.A(27940),e.A(27124),e.A(14074),e.A(18561)]);if(a)return;let x=new i(t,!0,{preserveDrawingBuffer:!1}),v=new s(x);v.clearColor=new p(.04,.05,.07,1);let j=new Map;for(let e of k)j.set(e.name,function(e){let t=e.aabb;return[(t[0]+t[3])/2,(t[1]+t[4])/2,(t[2]+t[5])/2]}(e));let y=new Map,M=ei.map(([e])=>e).filter(e=>!j.has(e));for(let e=0;e<M.length;e++){let t=M[e],a=function(e){let t=0;for(let a=0;a<e.length;a++)t=31*t+e.charCodeAt(a)|0;return Math.abs(t)}(t),n=e/Math.max(1,M.length)*Math.PI*2+a%100/100*.35;y.set(t,[2.2*Math.cos(n),-.35+(a%7-3)*.06,2.2*Math.sin(n)])}for(let[e,t]of j.entries())y.set(e,t);let z=0,C=0,_=0,I=0;for(let e of y.values())z+=e[0],C+=e[1],_+=e[2],I++;let E=new h(z/Math.max(1,I),C/Math.max(1,I),_/Math.max(1,I)),P=1.8;for(let e of y.values()){let t=e[0]-E.x,a=e[1]-E.y,n=e[2]-E.z;P=Math.max(P,Math.sqrt(t*t+a*a+n*n))}let B=.75*P+1,R=Math.max(1,P/1.8),N=en.reduce((e,t)=>Math.max(e,t.count),1),F=new f("flow-source-node",v);F.disableLighting=!0,F.emissiveColor=new d(.45,.75,1);let q=new f("flow-target-node",v);q.disableLighting=!0,q.emissiveColor=new d(1,.82,.42);let D=new Set,O=new Set,V=e=>{let t=T===m||b(e.azimuth_bin,e.elevation_bin)===T,a=$===m||e.mesh===$;return t&&a},W=new Set,H=new Set;for(let e of en)V(e)&&(W.add(b(e.azimuth_bin,e.elevation_bin)),H.add(e.mesh));for(let e of en){let t=`${e.azimuth_bin}|${e.elevation_bin}`,a=y.get(e.mesh);if(!a)continue;let n=V(e),i=(e.azimuth_bin+.5)/w*Math.PI*2-Math.PI,s=(e.elevation_bin+.5)/w*Math.PI-Math.PI/2,r=Math.cos(s),l=r*Math.cos(i),c=Math.sin(s),u=r*Math.sin(i),p=new h(E.x+l*B,E.y+c*B,E.z+u*B),b=new h(a[0],a[1],a[2]);if(!D.has(t)){let e=g.CreateSphere(`flow-src-${t}`,{diameter:.12*R,segments:6},v);e.position=p;let a=F.clone(`flow-src-mat-${t}`);a.alpha=W.has(t)||$===m&&T===m?1:.22,e.material=a,e.isPickable=!1,D.add(t)}if(!O.has(e.mesh)){let t=g.CreateSphere(`flow-target-${e.mesh}`,{diameter:.2*R,segments:7},v);t.position=b;let a=q.clone(`flow-target-mat-${e.mesh}`);a.alpha=H.has(e.mesh)||$===m&&T===m?1:.22,t.material=a,t.isPickable=!0,t.metadata={hoverLabel:e.mesh},O.add(e.mesh)}let x=p.add(b).scale(.5),k=x.subtract(E),j=Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z),M=j>1e-6?k.x/j:0,z=j>1e-6?k.y/j:1,C=j>1e-6?k.z/j:0,_=(.35+e.count/N*.75)*R,A=new h(x.x+M*_,x.y+z*_+.12*R,x.z+C*_),L=[];for(let e=0;e<=18;e++){let t=e/18,a=1-t;L.push(new h(a*a*p.x+2*a*t*A.x+t*t*b.x,a*a*p.y+2*a*t*A.y+t*t*b.y,a*a*p.z+2*a*t*A.z+t*t*b.z))}let I=e.count/N,[S,P,Z]=(0,o.heatRgb)(I),K=g.CreateTube(`flow-link-${e.mesh}-${t}`,{path:L,radius:(n?1:.4)*(.012+.04*I)*R,tessellation:8,cap:0,sideOrientation:0},v),U=new f(`flow-link-mat-${e.mesh}-${t}`,v);U.disableLighting=!0,U.emissiveColor=new d(S,P,Z),U.alpha=n?.35+.65*I:.08,K.material=U,K.isPickable=!0,K.metadata={hoverLabel:e.mesh}}let K=new r("flow-cam",Math.PI/4,Math.PI/3,3.4*P,E,v);K.attachControl(t,!0),(0,c.disableWheelZoom)(K),A.current=K,L.current={target:E,alpha:K.alpha,beta:K.beta,radius:K.radius},new l("flow-light",new h(.3,1,.2),v);let U=g.CreateSphere("flow-source-dome",{diameter:2*B,segments:20},v);U.position=E;let G=new f("flow-source-dome-mat",v);G.wireframe=!0,G.disableLighting=!0,G.emissiveColor=new d(.16,.2,.28),G.alpha=.35,U.material=G,U.isPickable=!1;let Y=Q?.origin;if(Y){let e=new h(Y[0],Y[1],Y[2]),t=g.CreateSphere("flow-standpoint",{diameter:.26*R,segments:10},v);t.position=e;let a=new f("flow-standpoint-mat",v);a.disableLighting=!0,a.emissiveColor=new d(.95,.45,.95),t.material=a,t.isPickable=!1;let n=g.CreateLines("flow-standpoint-stem",{points:[e,new h(e.x,E.y,e.z)]},v);n.color=new d(.95,.45,.95),n.isPickable=!1}x.runRenderLoop(()=>v.render());let X=()=>x.resize();window.addEventListener("resize",X);let J=(0,u.attachMeshHover)(v,t,Z),ee=(0,c.attachDoubleClickFocus)(v,t,K);S("ready"),n=()=>{window.removeEventListener("resize",X),J(),ee(),Z(null),A.current=null,L.current=null,v.dispose(),x.dispose()}}catch(e){if(a)return;S("error"),P(e instanceof Error?e.message:"Failed to render flow links.")}})(),()=>{a=!0,n?.()}},[en,w,k,$,T,Q,et]),(0,a.useEffect)(()=>{let t=_.current;if(!t||!et)return;if(0===ee.ribbons.length)return void S("empty");let a=!1,n=null;return S("loading"),P(null),(async()=>{try{let[{Engine:i},{Scene:s},{ArcRotateCamera:r},{HemisphericLight:l},{Vector3:h,Color3:d,Color4:p},{MeshBuilder:g},{StandardMaterial:f}]=await Promise.all([e.A(3905),e.A(94432),e.A(59694),e.A(88004),e.A(27940),e.A(27124),e.A(14074),e.A(18561)]);if(a)return;let x=new i(t,!0,{preserveDrawingBuffer:!1}),v=new s(x);v.clearColor=new p(.04,.05,.07,1);let w=e=>{let t=N===m||e.standpointId===N,a=T===m||b(e.azimuthBin,e.elevationBin)===T,n=$===m||e.meshId===$;return t&&a&&n},k=N!==m||T!==m||$!==m,j=new Set;for(let e of ee.ribbons)w(e)&&(j.add(e.standpointId),j.add(e.gazeId),j.add(e.meshId));let y={standpoint:[.95,.45,.95],gaze:[.45,.75,1],mesh:[1,.82,.42]},M={standpoint:.26,gaze:.13,mesh:.22},z=[...ee.standpoints,...ee.gazes,...ee.meshes],C=new Map(z.map(e=>[e.id,e.pos])),_=new Map(z.map(e=>[e.id,e.label]));for(let e of z){let t=g.CreateSphere(`ts-node-${e.kind}-${e.id}`,{diameter:M[e.kind],segments:8},v);t.position=new h(e.pos[0],e.pos[1],e.pos[2]);let a=new f(`ts-node-mat-${e.kind}-${e.id}`,v);a.disableLighting=!0;let[n,i,s]=y[e.kind];a.emissiveColor=new d(n,i,s),a.alpha=!k||j.has(e.id)?1:.2,t.material=a,t.isPickable=!0,t.metadata={hoverLabel:e.label}}let I=(e,t,a)=>{let n=e[0],i=e[1],s=e[2],r=t[0],l=t[1],o=t[2],c=[(n+r)/2,(i+l)/2+a,(s+o)/2],u=[];for(let e=0;e<=12;e++){let t=e/12,a=1-t;u.push(new h(a*a*n+2*a*t*c[0]+t*t*r,a*a*i+2*a*t*c[1]+t*t*l,a*a*s+2*a*t*c[2]+t*t*o))}return u};for(let e of ee.ribbons){let t=C.get(e.standpointId),a=C.get(e.gazeId),n=C.get(e.meshId);if(!t||!a||!n)continue;let i=e.count/ee.maxCount,s=.18+.5*i,r=[...I(t,a,s),...I(a,n,s).slice(1)],l=w(e),[c,u,h]=(0,o.heatRgb)(i),m=g.CreateTube(`ts-link-${e.standpointId}-${e.gazeId}-${e.meshId}`,{path:r,radius:(l?1:.4)*(.012+.04*i),tessellation:8,cap:0,sideOrientation:0},v),p=new f(`ts-link-mat-${e.standpointId}-${e.gazeId}-${e.meshId}`,v);p.disableLighting=!0,p.emissiveColor=new d(c,u,h),p.alpha=l?.35+.65*i:k?.06:.18,m.material=p,m.isPickable=!0,m.metadata={hoverLabel:_.get(e.meshId)??e.meshId}}let E=h.Zero(),P=new r("ts-cam",Math.PI/2,Math.PI/2.4,8.5,E,v);P.attachControl(t,!0),(0,c.disableWheelZoom)(P),A.current=P,L.current={target:E,alpha:P.alpha,beta:P.beta,radius:P.radius},new l("ts-light",new h(.3,1,.2),v),x.runRenderLoop(()=>v.render());let B=()=>x.resize();window.addEventListener("resize",B);let R=(0,u.attachMeshHover)(v,t,Z),F=(0,c.attachDoubleClickFocus)(v,t,P);S("ready"),n=()=>{window.removeEventListener("resize",B),R(),F(),Z(null),A.current=null,L.current=null,v.dispose(),x.dispose()}}catch(e){if(a)return;S("error"),P(e instanceof Error?e.message:"Failed to render flow links.")}})(),()=>{a=!0,n?.()}},[et,ee,N,T,$]),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("canvas",{ref:_,className:"aspect-video w-full rounded-lg border border-edge bg-ink"}),O?(0,t.jsx)("div",{className:"pointer-events-none absolute z-10 max-w-[16rem] truncate rounded border border-edge bg-ink/90 px-1.5 py-0.5 text-xs text-white shadow backdrop-blur",style:{left:O.x+12,top:O.y+12},children:O.label}):null,"ready"===I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"absolute left-3 top-3 flex flex-wrap gap-2",children:[J?(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-edge bg-ink/80 p-0.5 text-xs backdrop-blur",children:[(0,t.jsx)(f,{active:!et,onClick:()=>D("aggregate"),children:"Aggregate"}),(0,t.jsx)(f,{active:et,onClick:()=>D("twostage"),children:"Two-stage"})]}):null,U?(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-edge bg-ink/80 p-0.5 text-xs backdrop-blur",children:[(0,t.jsx)(f,{active:"first-person"===V,onClick:()=>W("first-person"),children:"Walk"}),(0,t.jsx)(f,{active:"viewer"===V,onClick:()=>W("viewer"),disabled:C,title:C?"Orbit (viewer) flow isn't available for walkable scenes":void 0,children:"Orbit"}),(0,t.jsx)(f,{active:"all"===V,onClick:()=>W("all"),children:"All"})]}):null,J?(0,t.jsx)(g,{label:"Standpoint",value:N,onChange:F,allLabel:"All standpoints",options:eo}):null,(0,t.jsx)(g,{label:et?"Gaze":"Source",value:T,onChange:R,allLabel:et?"All gaze sectors":"All sources",options:ec}),(0,t.jsx)(g,{label:"Mesh",value:$,onChange:B,allLabel:"All meshes",options:eu})]}),et?(0,t.jsx)(x,{standpoints:X,proxyMeshes:k,selectedKey:N,onSelect:e=>F(t=>t===e?m:e)}):null,(0,t.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex max-w-[20rem] flex-col items-end gap-2",children:[U&&!C?(0,t.jsxs)("div",{className:"rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg-muted backdrop-blur",children:["Orbit-dominated scene — viewer ",(0,t.jsx)("em",{children:"position"})," adds little here. Use the"," ",(0,t.jsx)("strong",{children:"View dome"})," (§7.5) above for where viewers looked."]}):null,(0,t.jsxs)("div",{className:"rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg backdrop-blur",children:["Active links: ",er,"/",el]})]}),(0,t.jsx)(d.ZoomButtons,{onZoom:e=>A.current&&(0,c.stepZoom)(A.current,e),onReset:()=>A.current&&L.current&&(0,c.resetFocus)(A.current,L.current)}),(0,t.jsx)(h.HeatLegend,{title:"Flow volume",lowLabel:"fewer links",highLabel:"dominant links",note:et?"Three columns: standpoint → gaze sector → mesh. Top standpoints/meshes are kept; the tail folds into an “Other” node. Pick a standpoint (or click the minimap), gaze sector, or mesh to emphasize matching ribbons.":"Each arc aggregates clicks from one camera-direction bin to a mesh. Pick a source or mesh to emphasize matching links and dim the rest."})]}):(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-sm text-fg-muted",children:"loading"===I?"Rendering…":"empty"===I?"No aggregate flow links in range.":"error"===I?E??"Flow view unavailable.":null})]})}],19399)},64434,e=>{"use strict";e.s([],4255),e.i(4255);var t=e.i(48939),a=e.i(53993),n=e.i(19399),i=e.i(39592),s=e.i(28100),r=e.i(11623),l=e.i(56054),o=e.i(2348),c=e.i(25476),u=e.i(18637),h=e.i(2413);let d="__all__";function m(e){return`${e[0]},${e[1]},${e[2]}`}function p({label:e,value:t,onChange:a,allLabel:n,options:i}){return(0,s.jsxs)("label",{className:"flex items-center gap-1.5 rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg backdrop-blur",children:[(0,s.jsx)("span",{className:"font-medium text-fg-muted",children:e}),(0,s.jsxs)("select",{className:"max-w-[12rem] bg-transparent text-white outline-none",value:t,onChange:e=>a(e.target.value),children:[(0,s.jsx)("option",{value:d,children:n}),i.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]})]})}var b=e.i(37215);e.s(["CAMERA_DOME_SUBTITLE",()=>b.CAMERA_DOME_SUBTITLE,"CAMERA_DOME_TITLE",()=>b.CAMERA_DOME_TITLE,"CLICK_RAYS_SUBTITLE",()=>b.CLICK_RAYS_SUBTITLE,"CLICK_RAYS_TITLE",()=>b.CLICK_RAYS_TITLE,"CameraDome3DView",()=>t.CameraDome3DView,"ClickRays3DView",0,function({rays:t,cellSize:a,proxyMeshes:n=[]}){let i=(0,r.useRef)(null),b=(0,r.useRef)(null),g=(0,r.useRef)(null),[f,x]=(0,r.useState)("loading"),[v,w]=(0,r.useState)(null),[k,j]=(0,r.useState)(d),[y,M]=(0,r.useState)(d),[z,C]=(0,r.useState)(null),_=(0,r.useMemo)(()=>{let e=new Map;for(let a of t){let t=m(a.camVoxel),n=e.get(t);n?n.count+=a.count:e.set(t,{key:t,voxel:a.camVoxel,count:a.count})}return[...e.values()].sort((e,t)=>t.count-e.count)},[t]),A=(0,r.useMemo)(()=>{let e=new Map;for(let a of t)""!==a.mesh&&e.set(a.mesh,(e.get(a.mesh)??0)+a.count);return[...e.entries()].map(([e,t])=>({name:e,count:t})).sort((e,t)=>t.count-e.count)},[t]);return(0,r.useEffect)(()=>{k!==d&&(_.some(e=>e.key===k)||j(d))},[k,_]),(0,r.useEffect)(()=>{y!==d&&(A.some(e=>e.name===y)||M(d))},[y,A]),(0,r.useEffect)(()=>{let s=i.current;if(!s)return;if(0===t.length)return void x("empty");let r=!1,u=null;return x("loading"),w(null),(async()=>{try{let[{Engine:i},{Scene:h},{ArcRotateCamera:p},{HemisphericLight:f},{Vector3:v,Color3:w,Color4:j,Matrix:M},{MeshBuilder:z},{StandardMaterial:_}]=await Promise.all([e.A(3905),e.A(94432),e.A(59694),e.A(88004),e.A(27940),e.A(27124),e.A(14074),e.A(35983),e.A(18561)]);if(r)return;let A=k===d?t:t.filter(e=>m(e.camVoxel)===k);if(0===A.length)return void x("empty");let L=A.reduce((e,t)=>Math.max(e,t.count),1),I=0,S=0,E=0,P=0,$=(e,t,a)=>{I+=e,S+=t,E+=a,P++};for(let e of A)$(e.origin[0],e.origin[1],e.origin[2]),$(e.hit[0],e.hit[1],e.hit[2]);let B=P>0?new v(I/P,S/P,E/P):v.Zero(),T=4*a;for(let e of A)for(let t of[e.origin,e.hit]){let e=t[0]-B.x,a=t[1]-B.y,n=t[2]-B.z;T=Math.max(T,Math.sqrt(e*e+a*a+n*n))}let R=new i(s,!0,{preserveDrawingBuffer:!1}),N=new h(R);N.clearColor=new j(.04,.05,.07,1);let F=new p("rays-cam",Math.PI/4,Math.PI/3,2.4*T,B,N);if(F.attachControl(s,!0),(0,o.disableWheelZoom)(F),b.current=F,g.current={target:B,alpha:F.alpha,beta:F.beta,radius:F.radius},new f("rays-light",new v(.4,1,.3),N),n.length>0){let e=z.CreateBox("scene-proxy",{size:1},N),t=new _("scene-proxy-mat",N);t.wireframe=!0,t.disableLighting=!0,t.emissiveColor=new w(.32,.4,.52),t.alpha=.35,e.material=t,e.isPickable=!0,e.thinInstanceEnablePicking=!0,e.metadata={hoverLabels:n.map(e=>e.name)};let a=n.length,i=new Float32Array(16*a);for(let e=0;e<a;e++){let t=n[e].aabb,a=Math.max(t[3]-t[0],.001),s=Math.max(t[4]-t[1],.001),r=Math.max(t[5]-t[2],.001);M.Scaling(a,s,r).multiply(M.Translation((t[0]+t[3])/2,(t[1]+t[4])/2,(t[2]+t[5])/2)).copyToArray(i,16*e)}e.thinInstanceSetBuffer("matrix",i,16,!0)}let q=[],D=[];for(let e of A){let t=e.count/L,[a,n,i]=(0,l.heatRgb)(t),s=new j(a,n,i,.35+.65*t);q.push([new v(e.origin[0],e.origin[1],e.origin[2]),new v(e.hit[0],e.hit[1],e.hit[2])]),D.push([s,s])}q.length>0&&(z.CreateLineSystem("click-rays",{lines:q,colors:D,useVertexAlpha:!0},N).isPickable=!1);let O=new Map;for(let e of A)O.set(m(e.camVoxel),e.camVoxel);if(O.size>0){let e=z.CreateSphere("rays-eye",{diameter:.6*a,segments:6},N),t=new _("rays-eye-mat",N);t.disableLighting=!0,t.emissiveColor=new w(.9,.95,1),e.material=t;let n=[...O.values()],i=new Float32Array(16*n.length);for(let e=0;e<n.length;e++){let t=n[e];M.Translation((t[0]+.5)*a,(t[1]+.5)*a,(t[2]+.5)*a).copyToArray(i,16*e)}e.thinInstanceSetBuffer("matrix",i,16,!0)}if(y!==d){let e=t.filter(e=>e.mesh===y);if(e.length>0){let t,i=n.find(e=>e.name===y);if(i){let e=i.aabb;t=new v((e[0]+e[3])/2,(e[1]+e[4])/2,(e[2]+e[5])/2)}else{let a=0,n=0,i=0;for(let t of e)a+=t.hit[0],n+=t.hit[1],i+=t.hit[2];t=new v(a/e.length,n/e.length,i/e.length)}let s=Math.max(3*a,.18*T),r=e.reduce((e,t)=>Math.max(e,t.count),1),o=[],c=[];for(let a of e){let e=a.origin[0]-a.hit[0],n=a.origin[1]-a.hit[1],i=a.origin[2]-a.hit[2],u=Math.sqrt(e*e+n*n+i*i)||1,h=a.count/r,d=s*(.4+.6*h),m=new v(t.x+e/u*d,t.y+n/u*d,t.z+i/u*d),[p,b,g]=(0,l.heatRgb)(h),f=new j(p,b,g,1);o.push([t.clone(),m]),c.push([new j(p,b,g,.25),f])}z.CreateLineSystem("mesh-rose",{lines:o,colors:c,useVertexAlpha:!0},N).isPickable=!1;let u=z.CreateSphere("mesh-rose-hub",{diameter:.8*a,segments:8},N),h=new _("mesh-rose-hub-mat",N);h.disableLighting=!0,h.emissiveColor=new w(1,.85,.4),u.material=h,u.position=t,u.isPickable=!0,u.metadata={hoverLabel:y}}}R.runRenderLoop(()=>N.render());let Z=()=>R.resize();window.addEventListener("resize",Z);let V=(0,c.attachMeshHover)(N,s,C),W=(0,o.attachDoubleClickFocus)(N,s,F);x("ready"),u=()=>{window.removeEventListener("resize",Z),V(),W(),C(null),b.current=null,g.current=null,N.dispose(),R.dispose()}}catch(e){if(r)return;x("error"),w(e instanceof Error?e.message:"Failed to render click rays.")}})(),()=>{r=!0,u?.()}},[t,a,n,k,y]),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("canvas",{ref:i,className:"aspect-video w-full rounded-lg border border-edge bg-ink"}),z?(0,s.jsx)("div",{className:"pointer-events-none absolute z-10 max-w-[16rem] truncate rounded border border-edge bg-ink/90 px-1.5 py-0.5 text-xs text-white shadow backdrop-blur",style:{left:z.x+12,top:z.y+12},children:z.label}):null,"ready"===f?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"absolute left-3 top-3 flex gap-2",children:[(0,s.jsx)(p,{label:"Viewpoint",value:k,onChange:j,allLabel:"All viewpoints",options:_.map(e=>({value:e.key,label:`(${e.voxel.join(", ")}) \xb7 ${e.count}`}))}),(0,s.jsx)(p,{label:"Mesh rose",value:y,onChange:M,allLabel:"No mesh focus",options:A.map(e=>({value:e.name,label:`${e.name} \xb7 ${e.count}`}))})]}),(0,s.jsx)(h.ZoomButtons,{onZoom:e=>b.current&&(0,o.stepZoom)(b.current,e),onReset:()=>b.current&&g.current&&(0,o.resetFocus)(b.current,g.current)}),(0,s.jsx)(u.HeatLegend,{title:"Click volume",lowLabel:"few clicks",highLabel:"most clicks",note:"Lines run from the camera position (bright eye) to where the click landed. Pick a viewpoint to see only clicks made from there; pick a mesh to see which directions its clicks came from."})]}):(0,s.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-sm text-fg-muted",children:"loading"===f?"Rendering…":"empty"===f?"No correlated clicks in range.":"error"===f?v??"Click rays unavailable.":null})]})},"FLOW_SANKEY_HELP",()=>b.FLOW_SANKEY_HELP,"FLOW_SANKEY_SUBTITLE",()=>b.FLOW_SANKEY_SUBTITLE,"FLOW_SANKEY_TITLE",()=>b.FLOW_SANKEY_TITLE,"FlowSankey3DView",()=>n.FlowSankey3DView,"GAZE_CLICK_SUBTITLE",()=>b.GAZE_CLICK_SUBTITLE,"GAZE_CLICK_TITLE",()=>b.GAZE_CLICK_TITLE,"GazeClickDivergence3DView",()=>i.GazeClickDivergence3DView,"WORLD_HEATMAP_SUBTITLE",()=>b.WORLD_HEATMAP_SUBTITLE,"WORLD_HEATMAP_TITLE",()=>b.WORLD_HEATMAP_TITLE,"WorldHeatmap3DView",()=>a.WorldHeatmap3DView],64434)},94452,e=>{e.n(e.i(64434))},3905,e=>{e.v(t=>Promise.all(["static/chunks/3pdpaqzwhhijn.js","static/chunks/08bm3ye5govev.js","static/chunks/0g6u34xkzrpjn.js","static/chunks/25ctnyh7njp-d.js","static/chunks/2gh4z57fem0_v.js","static/chunks/3vaho-xrtuchd.js","static/chunks/0g7p8zp2kxve5.js"].map(t=>e.l(t))).then(()=>t(66232)))},94432,e=>{e.v(t=>Promise.all(["static/chunks/2kje_jvmwsvwo.js","static/chunks/1j--a56ji33_x.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/2npk7tr63h7rl.js","static/chunks/3vaho-xrtuchd.js","static/chunks/3g_h_00xs9u59.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/25ctnyh7njp-d.js","static/chunks/1vpcaaf-0dn7q.js"].map(t=>e.l(t))).then(()=>t(92494)))},59694,e=>{e.v(t=>Promise.all(["static/chunks/1j--a56ji33_x.js","static/chunks/0oap0o8a8a_cl.js","static/chunks/0f_nv15a8q415.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/245h82k-g1nxr.js","static/chunks/3ovd8o_usay7j.js","static/chunks/3vaho-xrtuchd.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/25ctnyh7njp-d.js","static/chunks/2npk7tr63h7rl.js","static/chunks/3pyggl13glbdc.js"].map(t=>e.l(t))).then(()=>t(67186)))},88004,e=>{e.v(t=>Promise.all(["static/chunks/2p8dbh81chhon.js","static/chunks/1oara6fkfvgs3.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/25ctnyh7njp-d.js","static/chunks/3pdpaqzwhhijn.js"].map(t=>e.l(t))).then(()=>t(15768)))},27940,e=>{e.v(t=>Promise.all(["static/chunks/0w0sx062qmcsh.js","static/chunks/25ctnyh7njp-d.js","static/chunks/3pdpaqzwhhijn.js"].map(t=>e.l(t))).then(()=>t(23235)))},27124,e=>{e.v(t=>Promise.all(["static/chunks/1par9m038tiov.js","static/chunks/1j--a56ji33_x.js","static/chunks/2j-sax2xfdv7l.js","static/chunks/340pg0qkv5tqq.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/0gwa154w_0wuh.js","static/chunks/0oap0o8a8a_cl.js","static/chunks/0f_nv15a8q415.js","static/chunks/3vaho-xrtuchd.js","static/chunks/3pyggl13glbdc.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/3g_h_00xs9u59.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/25ctnyh7njp-d.js","static/chunks/2npk7tr63h7rl.js","static/chunks/01aeari2x_tlz.js"].map(t=>e.l(t))).then(()=>t(70928)))},14074,e=>{e.v(t=>Promise.all(["static/chunks/1zcrrq1fx8g2y.js","static/chunks/1tdg_eolxlcdl.js","static/chunks/1j--a56ji33_x.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/0vddljjnmozzx.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/3vaho-xrtuchd.js","static/chunks/0f_nv15a8q415.js","static/chunks/3g_h_00xs9u59.js","static/chunks/2npk7tr63h7rl.js","static/chunks/25ctnyh7njp-d.js"].map(t=>e.l(t))).then(()=>t(87566)))},2213,e=>{e.v(t=>Promise.all(["static/chunks/3wqs57qehored.js","static/chunks/1j--a56ji33_x.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/2npk7tr63h7rl.js","static/chunks/1vkww9l6lgqag.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/0f_nv15a8q415.js","static/chunks/3pyggl13glbdc.js","static/chunks/3vaho-xrtuchd.js","static/chunks/25ctnyh7njp-d.js","static/chunks/3pdpaqzwhhijn.js"].map(t=>e.l(t))).then(()=>t(95758)))},15002,e=>{e.v(t=>Promise.all(["static/chunks/34gp3hvr3j6um.js","static/chunks/0x6i6e6863tir.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/3vaho-xrtuchd.js","static/chunks/2gh4z57fem0_v.js","static/chunks/25ctnyh7njp-d.js","static/chunks/28ycc-1519hl2.js"].map(t=>e.l(t))).then(()=>t(95729)))},35983,e=>{e.v(t=>Promise.all(["static/chunks/4227p7752rnny.js","static/chunks/1j--a56ji33_x.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/2npk7tr63h7rl.js","static/chunks/1vkww9l6lgqag.js","static/chunks/25ctnyh7njp-d.js","static/chunks/0f_nv15a8q415.js","static/chunks/3vaho-xrtuchd.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/3pyggl13glbdc.js","static/chunks/3pdpaqzwhhijn.js"].map(t=>e.l(t))).then(()=>t(50608)))},18561,e=>{e.v(t=>Promise.all(["static/chunks/1j--a56ji33_x.js","static/chunks/1vkww9l6lgqag.js","static/chunks/3pdpaqzwhhijn.js","static/chunks/2npk7tr63h7rl.js","static/chunks/117ys3lltfmcu.js","static/chunks/25ctnyh7njp-d.js","static/chunks/1vzmzrjhlm1q5.js","static/chunks/3g_h_00xs9u59.js","static/chunks/1vpcaaf-0dn7q.js","static/chunks/3vaho-xrtuchd.js"].map(t=>e.l(t))).then(()=>t(85106)))}]);
|