@flexkit/studio 0.2.33 → 0.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-page-7XT4K75G.js +4 -0
- package/dist/chat-page-7XT4K75G.js.map +1 -0
- package/dist/{chunk-2MVQXXY7.js → chunk-2FCVATRT.js} +3 -3
- package/dist/{chunk-2MVQXXY7.js.map → chunk-2FCVATRT.js.map} +1 -1
- package/dist/{chunk-S7VNSSIK.js → chunk-3OBELKJU.js} +2 -2
- package/dist/{chunk-S7VNSSIK.js.map → chunk-3OBELKJU.js.map} +1 -1
- package/dist/{chunk-YKM3FUGK.js → chunk-6AJRQSFO.js} +3 -3
- package/dist/{chunk-YKM3FUGK.js.map → chunk-6AJRQSFO.js.map} +1 -1
- package/dist/{chunk-DHE6PO3V.js → chunk-7JA6SI5H.js} +2 -2
- package/dist/{chunk-DHE6PO3V.js.map → chunk-7JA6SI5H.js.map} +1 -1
- package/dist/{chunk-RLVHUIFC.js → chunk-CHNQZU2P.js} +2 -2
- package/dist/{chunk-RLVHUIFC.js.map → chunk-CHNQZU2P.js.map} +1 -1
- package/dist/{chunk-HSGUVQXU.js → chunk-DFBG7PUJ.js} +8 -8
- package/dist/{chunk-HSGUVQXU.js.map → chunk-DFBG7PUJ.js.map} +1 -1
- package/dist/{chunk-K3HW6YWS.js → chunk-EUWIIL3X.js} +2 -2
- package/dist/{chunk-K3HW6YWS.js.map → chunk-EUWIIL3X.js.map} +1 -1
- package/dist/chunk-G5N6HEPW.js +2 -0
- package/dist/chunk-G5N6HEPW.js.map +1 -0
- package/dist/chunk-HR4QZ5TD.js +3 -0
- package/dist/chunk-HR4QZ5TD.js.map +1 -0
- package/dist/chunk-KO2JLLUJ.js +2 -0
- package/dist/chunk-KO2JLLUJ.js.map +1 -0
- package/dist/{chunk-CFYO546Y.js → chunk-PC5Z37LT.js} +3 -3
- package/dist/{chunk-CFYO546Y.js.map → chunk-PC5Z37LT.js.map} +1 -1
- package/dist/{chunk-U5XZWEPO.js → chunk-PSECMZJC.js} +3 -3
- package/dist/{chunk-U5XZWEPO.js.map → chunk-PSECMZJC.js.map} +1 -1
- package/dist/chunk-RBGXXVF4.js +7 -0
- package/dist/{chunk-VUZ7GHSO.js.map → chunk-RBGXXVF4.js.map} +1 -1
- package/dist/chunk-RULCANNM.js +7 -0
- package/dist/chunk-RULCANNM.js.map +1 -0
- package/dist/{chunk-NFEQBTIW.js → chunk-U6NFYYTF.js} +2 -2
- package/dist/{chunk-NFEQBTIW.js.map → chunk-U6NFYYTF.js.map} +1 -1
- package/dist/{chunk-S26WK6RF.js → chunk-VFV44YZB.js} +2 -2
- package/dist/{chunk-S26WK6RF.js.map → chunk-VFV44YZB.js.map} +1 -1
- package/dist/{chunk-6I7D2JBA.js → chunk-VRDTHLA3.js} +3 -3
- package/dist/{chunk-6I7D2JBA.js.map → chunk-VRDTHLA3.js.map} +1 -1
- package/dist/{chunk-7ODGH7G2.js → chunk-WU2KCXBC.js} +2 -2
- package/dist/{chunk-7ODGH7G2.js.map → chunk-WU2KCXBC.js.map} +1 -1
- package/dist/{chunk-RFUMT6ZR.js → chunk-XYFS6X74.js} +2 -2
- package/dist/{chunk-RFUMT6ZR.js.map → chunk-XYFS6X74.js.map} +1 -1
- package/dist/{chunk-UB22GYFK.js → chunk-YC7PBLTK.js} +2 -2
- package/dist/{chunk-UB22GYFK.js.map → chunk-YC7PBLTK.js.map} +1 -1
- package/dist/{entry-ROTT3ZDN.js → entry-APJ4V7PW.js} +2 -2
- package/dist/{entry-ROTT3ZDN.js.map → entry-APJ4V7PW.js.map} +1 -1
- package/dist/index.css +43 -0
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/list-7IHDJM54.js +3 -0
- package/dist/{list-N4E3VXM5.js.map → list-7IHDJM54.js.map} +1 -1
- package/dist/{list-RCTHBJOK.js → list-7WFALOUT.js} +2 -2
- package/dist/{list-RCTHBJOK.js.map → list-7WFALOUT.js.map} +1 -1
- package/dist/pages-BV3ABSFQ.js +5 -0
- package/dist/{pages-XUJGIHQI.js.map → pages-BV3ABSFQ.js.map} +1 -1
- package/dist/plugin-pages-OWGJPPWV.js +2 -0
- package/dist/{plugin-pages-FEQILAQR.js.map → plugin-pages-OWGJPPWV.js.map} +1 -1
- package/dist/project-selector-V5N2724B.js +2 -0
- package/dist/project-selector-V5N2724B.js.map +1 -0
- package/dist/record-links-3P3XSW66.js +2 -0
- package/dist/{record-links-HO4SEHOA.js.map → record-links-3P3XSW66.js.map} +1 -1
- package/dist/{root-CCUROZVR.js → root-F2GTYDJM.js} +2 -2
- package/dist/{root-CCUROZVR.js.map → root-F2GTYDJM.js.map} +1 -1
- package/dist/{root-GQL3P63Z.js → root-GBBZ3DX5.js} +3 -3
- package/dist/{root-GQL3P63Z.js.map → root-GBBZ3DX5.js.map} +1 -1
- package/dist/{root-KXY4A6DW.js → root-J62PBDZ2.js} +2 -2
- package/dist/{root-KXY4A6DW.js.map → root-J62PBDZ2.js.map} +1 -1
- package/dist/{root-BUXIQKA5.js → root-LYRL7VPN.js} +3 -3
- package/dist/{root-BUXIQKA5.js.map → root-LYRL7VPN.js.map} +1 -1
- package/dist/{root-VA3E6HEY.js → root-NIL2UHKS.js} +2 -2
- package/dist/{root-VA3E6HEY.js.map → root-NIL2UHKS.js.map} +1 -1
- package/dist/{root-MLEJUEMJ.js → root-RGZZYETM.js} +4 -4
- package/dist/{root-MLEJUEMJ.js.map → root-RGZZYETM.js.map} +1 -1
- package/dist/{search-YY4GQQRM.js → search-IIGNCQEZ.js} +2 -2
- package/dist/{search-YY4GQQRM.js.map → search-IIGNCQEZ.js.map} +1 -1
- package/dist/skills-pages-T52MF4DO.js +2 -0
- package/dist/{skills-pages-SAOZTUOH.js.map → skills-pages-T52MF4DO.js.map} +1 -1
- package/dist/source-IJAAJDGW.js +2 -0
- package/dist/{source-2S24MZ5D.js.map → source-IJAAJDGW.js.map} +1 -1
- package/dist/{spec-renderer-ZSIVMKVE.js → spec-renderer-Z6GVHLFU.js} +2 -2
- package/dist/{spec-renderer-ZSIVMKVE.js.map → spec-renderer-Z6GVHLFU.js.map} +1 -1
- package/dist/ui.js +1 -1
- package/package.json +4 -4
- package/dist/chat-page-LR7XC2US.js +0 -4
- package/dist/chat-page-LR7XC2US.js.map +0 -1
- package/dist/chunk-3SY46ERM.js +0 -2
- package/dist/chunk-3SY46ERM.js.map +0 -1
- package/dist/chunk-C3OHXPJV.js +0 -2
- package/dist/chunk-C3OHXPJV.js.map +0 -1
- package/dist/chunk-L5T56MRH.js +0 -7
- package/dist/chunk-L5T56MRH.js.map +0 -1
- package/dist/chunk-VUZ7GHSO.js +0 -7
- package/dist/list-N4E3VXM5.js +0 -3
- package/dist/pages-XUJGIHQI.js +0 -5
- package/dist/plugin-pages-FEQILAQR.js +0 -2
- package/dist/project-selector-U64ROZ5D.js +0 -2
- package/dist/project-selector-U64ROZ5D.js.map +0 -1
- package/dist/record-links-HO4SEHOA.js +0 -2
- package/dist/skills-pages-SAOZTUOH.js +0 -2
- package/dist/source-2S24MZ5D.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-HKN6BX5U.js';import {c}from'./chunk-MBBE4RND.js';import {b,c as c$1}from'./chunk-5CVDMZUI.js';import {useState,useEffect}from'react';var d="0.2.
|
|
1
|
+
import'./index.css';import {a}from'./chunk-HKN6BX5U.js';import {c}from'./chunk-MBBE4RND.js';import {b,c as c$1}from'./chunk-5CVDMZUI.js';import {useState,useEffect}from'react';var d="0.2.34",L={current:d,latest:d,isCurrent:true};function le(){let e=b(),[t,r]=useState(null);return useEffect(()=>{if(e)return e.onUpdateDownloaded(o=>{r(o.version);})},[e]),e?t===null?{current:e.version,latest:e.version,isCurrent:true}:{current:e.version,latest:t,isCurrent:false,upgrade:()=>e.installUpdate()}:L}var U="flexkit:telemetry",V="flexkit:error-reporting",B=/^(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)$|\.(localhost|test|local)$/i;function M(e){return e.override==="on"?true:e.override==="off"||!e.hosted||e.domain!=="flexkit.io"||e.version==="0.0.0"?false:e.isDesktop||!B.test(e.hostname)}function Y(){try{let e=a();return e?.getItem(U)??e?.getItem(V)??null}catch{return null}}function k({hosted:e}){return typeof window>"u"?false:M({hosted:e,isDesktop:!!b(),domain:c$1,hostname:window.location.hostname,version:d,override:Y()})}async function v(e,t,{keepalive:r=false}={}){return (await fetch(e,{body:t,credentials:"same-origin",headers:{"Content-Type":"application/json"},keepalive:r,method:"POST"})).status}var f={componentStack:4e3,message:2e3,name:200,path:500,stack:8e3,userAgent:500},$=10,G=6e4,K=50,z=5e3,R=/^[a-z0-9]{1,64}$/;function g(e,t){return e.length>t?e.slice(0,t):e}function J(e){let t=e;try{/^[a-z][a-z0-9+.-]*:/i.test(e)&&(t=new URL(e).pathname);}catch{}return g(t.split(/[?#]/)[0]??"",f.path)}function H(e){if(e instanceof Error)return {name:e.name||"Error",message:typeof e.message=="string"?e.message:"",stack:typeof e.stack=="string"?e.stack:void 0};if(typeof e=="string")return {name:"Error",message:e};if(e==null)return {name:"Error",message:`Non-Error thrown: ${String(e)}`};if(typeof e=="object"){let t=e.constructor?.name;return {name:"Error",message:`Non-Error thrown: ${typeof t=="string"&&t?t:"object"}`}}return {name:"Error",message:`Non-Error thrown: ${typeof e}`}}var X=[/ResizeObserver loop (limit exceeded|completed with undelivered notifications)/i,/^Script error\.?$/i,/The (operation|user) (was )?aborted/i,/signal is aborted without reason/i],A=/\b(chrome|moz|safari(-web)?|ms-browser)-extension:\/\//i,F=/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi;function Z(e){return e.replace(F,"<email>")}function q(e,t){return e.name==="AbortError"||X.some(r=>r.test(e.message))||t&&A.test(t)?true:!!(e.stack&&A.test(e.stack))}function W(e,t){let r=H(e);if(q(r,t.sourceUrl))return null;let o={source:t.source,name:g(r.name,f.name),message:g(Z(r.message),f.message),occurredAt:(t.now??new Date).toISOString()};return r.stack&&(o.stack=g(r.stack,f.stack)),t.componentStack&&(o.componentStack=g(t.componentStack,f.componentStack)),t.path&&(o.path=J(t.path)),t.projectId&&R.test(t.projectId)&&(o.projectId=t.projectId),o}function Q(e){return `${e.name}
|
|
2
2
|
${e.message}
|
|
3
|
-
${e.stack??""}`}var ee=new TextEncoder;function P(e){return ee.encode(e).length}function te(e,t,r=G){let o=P(JSON.stringify({app:e,errors:[]})),s=[];for(let i of t.slice(0,$)){let n=P(JSON.stringify(i))+(s.length?1:0);if(o+n>r)break;o+=n,s.push(i);}return s.length===0?null:{body:JSON.stringify({app:e,errors:s}),count:s.length}}function re({app:e,send:t,getPath:r,now:o=()=>new Date,setTimer:s=(n,u)=>setTimeout(n,u),clearTimer:i=n=>clearTimeout(n)}){let n=[],u=new Set,_=0,y=null,a=null,E=false;function T(){a===null&&n.length>0&&!E&&(a=s(()=>{a=null,x();},z));}function D(l){let S=te(e,n);return S?(n.splice(0,S.count),t(S.body,{unloading:l}).then(p=>{(p===401||p===403||p===429)&&(E=true,n.length=0);}).catch(()=>{}),n.length>0):(n.shift(),n.length>0)}function x({unloading:l=false}={}){try{if(E)return;a!==null&&l&&(i(a),a=null),n.length>0&&D(l),T();}catch{}}return {report(l,S){try{if(E||_>=K)return;let p=W(l,{...S,now:o(),path:r?.(),projectId:y});if(!p)return;let b=Q(p);if(u.has(b))return;u.add(b),_+=1,n.push(p),T();}catch{}},setProjectId(l){y=l;},flush:x,pending:()=>n,dispose(){a!==null&&(i(a),a=null),E=true,n.length=0;}}}var ne=async(e,{unloading:t})=>{let r=c.clientErrors;if(t&&!b()&&typeof navigator<"u"&&typeof navigator.sendBeacon=="function")try{if(navigator.sendBeacon(r,new Blob([e],{type:"text/plain"})))return null}catch{}return v(r,e,{keepalive:t})},m=null;function we(e,{source:t="manual",componentStack:r}={}){m?.report(e,{source:t,componentStack:r});}function Re(e){m?.setProjectId(e);}function _e({hosted:e}){if(typeof window>"u"||m)return ()=>{};if(!k({hosted:e}))return ()=>{};let t=b(),r=re({app:{platform:t?"desktop":"web",version:d,userAgent:g(navigator.userAgent,f.userAgent)},send:ne,getPath:()=>window.location.pathname});function o(n){r.report(n.error??n.message,{source:"window",sourceUrl:n.filename});}function s(n){r.report(n.reason,{source:"unhandledrejection"});}function i(){r.flush({unloading:true});}return window.addEventListener("error",o),window.addEventListener("unhandledrejection",s),window.addEventListener("pagehide",i),m=r,()=>{window.removeEventListener("error",o),window.removeEventListener("unhandledrejection",s),window.removeEventListener("pagehide",i),r.flush({unloading:true}),r.dispose(),m===r&&(m=null);}}function oe(e){return e.event==="graph_opened"?`graph_opened:${e.projectId}`:e.event}function ie(e){let t=new Set,r=new Set;return {track(o,{onDelivered:s}={}){let i=oe(o);if(t.has(i)||r.has(i))return;t.add(i);let n=u=>{t.delete(i),u!==null&&u>=200&&u<300&&(r.add(i),s?.());};try{e(JSON.stringify(o)).then(n,()=>n(null));}catch{n(null);}}}}var w=null;function Oe(e){e.event==="graph_opened"&&!R.test(e.projectId)||w?.track(e);}var C="flexkit:desktop-launch-recorded";function se(e){try{return sessionStorage.getItem(e)==="1"}catch{return false}}function ae(e){try{sessionStorage.setItem(e,"1");}catch{}}function Ae({hosted:e}){if(!k({hosted:e}))return ()=>{};let t=ie(o=>v(c.productEvents,o,{keepalive:true})),r=b();return w=t,r&&!se(C)&&t.track({appVersion:r.version,event:"desktop_app_opened",os:r.platform},{onDelivered:()=>ae(C)}),()=>{w===t&&(w=null);}}export{le as a,we as b,Re as c,_e as d,Oe as e,Ae as f};//# sourceMappingURL=chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
${e.stack??""}`}var ee=new TextEncoder;function P(e){return ee.encode(e).length}function te(e,t,r=G){let o=P(JSON.stringify({app:e,errors:[]})),s=[];for(let i of t.slice(0,$)){let n=P(JSON.stringify(i))+(s.length?1:0);if(o+n>r)break;o+=n,s.push(i);}return s.length===0?null:{body:JSON.stringify({app:e,errors:s}),count:s.length}}function re({app:e,send:t,getPath:r,now:o=()=>new Date,setTimer:s=(n,u)=>setTimeout(n,u),clearTimer:i=n=>clearTimeout(n)}){let n=[],u=new Set,_=0,y=null,a=null,E=false;function T(){a===null&&n.length>0&&!E&&(a=s(()=>{a=null,x();},z));}function D(l){let S=te(e,n);return S?(n.splice(0,S.count),t(S.body,{unloading:l}).then(p=>{(p===401||p===403||p===429)&&(E=true,n.length=0);}).catch(()=>{}),n.length>0):(n.shift(),n.length>0)}function x({unloading:l=false}={}){try{if(E)return;a!==null&&l&&(i(a),a=null),n.length>0&&D(l),T();}catch{}}return {report(l,S){try{if(E||_>=K)return;let p=W(l,{...S,now:o(),path:r?.(),projectId:y});if(!p)return;let b=Q(p);if(u.has(b))return;u.add(b),_+=1,n.push(p),T();}catch{}},setProjectId(l){y=l;},flush:x,pending:()=>n,dispose(){a!==null&&(i(a),a=null),E=true,n.length=0;}}}var ne=async(e,{unloading:t})=>{let r=c.clientErrors;if(t&&!b()&&typeof navigator<"u"&&typeof navigator.sendBeacon=="function")try{if(navigator.sendBeacon(r,new Blob([e],{type:"text/plain"})))return null}catch{}return v(r,e,{keepalive:t})},m=null;function we(e,{source:t="manual",componentStack:r}={}){m?.report(e,{source:t,componentStack:r});}function Re(e){m?.setProjectId(e);}function _e({hosted:e}){if(typeof window>"u"||m)return ()=>{};if(!k({hosted:e}))return ()=>{};let t=b(),r=re({app:{platform:t?"desktop":"web",version:d,userAgent:g(navigator.userAgent,f.userAgent)},send:ne,getPath:()=>window.location.pathname});function o(n){r.report(n.error??n.message,{source:"window",sourceUrl:n.filename});}function s(n){r.report(n.reason,{source:"unhandledrejection"});}function i(){r.flush({unloading:true});}return window.addEventListener("error",o),window.addEventListener("unhandledrejection",s),window.addEventListener("pagehide",i),m=r,()=>{window.removeEventListener("error",o),window.removeEventListener("unhandledrejection",s),window.removeEventListener("pagehide",i),r.flush({unloading:true}),r.dispose(),m===r&&(m=null);}}function oe(e){return e.event==="graph_opened"?`graph_opened:${e.projectId}`:e.event}function ie(e){let t=new Set,r=new Set;return {track(o,{onDelivered:s}={}){let i=oe(o);if(t.has(i)||r.has(i))return;t.add(i);let n=u=>{t.delete(i),u!==null&&u>=200&&u<300&&(r.add(i),s?.());};try{e(JSON.stringify(o)).then(n,()=>n(null));}catch{n(null);}}}}var w=null;function Oe(e){e.event==="graph_opened"&&!R.test(e.projectId)||w?.track(e);}var C="flexkit:desktop-launch-recorded";function se(e){try{return sessionStorage.getItem(e)==="1"}catch{return false}}function ae(e){try{sessionStorage.setItem(e,"1");}catch{}}function Ae({hosted:e}){if(!k({hosted:e}))return ()=>{};let t=ie(o=>v(c.productEvents,o,{keepalive:true})),r=b();return w=t,r&&!se(C)&&t.track({appVersion:r.version,event:"desktop_app_opened",os:r.platform},{onDelivered:()=>ae(C)}),()=>{w===t&&(w=null);}}export{le as a,we as b,Re as c,_e as d,Oe as e,Ae as f};//# sourceMappingURL=chunk-PSECMZJC.js.map
|
|
4
|
+
//# sourceMappingURL=chunk-PSECMZJC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/use-studio-version.ts","../src/core/telemetry.ts","../src/core/error/error-reporter.ts","../src/core/analytics/product-events.ts"],"names":["STUDIO_VERSION","WEB_VERSION","useStudioVersion","desktop","getDesktop","downloaded","setDownloaded","useState","useEffect","update","TELEMETRY_STORAGE_KEY","LEGACY_TELEMETRY_STORAGE_KEY","LOCAL_HOSTNAME","isTelemetryEnabled","env","readOverride","storage","getLocalStorage","isStudioTelemetryEnabled","hosted","flexkitDomain","postToUserApi","path","body","keepalive","LIMITS","MAX_ERRORS_PER_REPORT","MAX_REPORT_BYTES","MAX_ERRORS_PER_SESSION","FLUSH_INTERVAL_MS","PROJECT_ID_PATTERN","truncate","value","max","toReportPath","pathOrUrl","describeError","error","constructorName","NOISE_MESSAGES","EXTENSION_URL","EMAIL_ADDRESS","maskMessage","message","isNoiseError","details","sourceUrl","pattern","buildClientError","options","entry","errorKey","encoder","byteLength","buildReportBody","app","queue","maxBytes","size","errors","errorSize","createErrorReporter","send","getPath","now","setTimer","callback","ms","clearTimer","timer","seen","accepted","projectId","stopped","schedule","flush","sendNext","unloading","next","status","key","id","sendReportToBff","url","userApiPaths","installed","reportStudioError","source","componentStack","setErrorReportingProjectId","installErrorReporter","reporter","onError","event","onUnhandledRejection","onPageHide","productEventKey","studioEvent","createProductEventTracker","pending","delivered","onDelivered","settle","tracker","trackStudioEvent","DESKTOP_LAUNCH_STORAGE_KEY","readSessionFlag","writeSessionFlag","installProductEvents","current"],"mappings":"gLAeO,IAAMA,CAAAA,CAA0D,QAAA,CACjEC,CAAAA,CAA6B,CAAE,OAAA,CAASD,CAAAA,CAAgB,MAAA,CAAQA,CAAAA,CAAgB,SAAA,CAAW,IAAK,CAAA,CAO/F,SAASE,EAAAA,EAAkC,CAChD,IAAMC,CAAAA,CAAUC,CAAAA,EAAW,CACrB,CAACC,CAAAA,CAAYC,CAAa,CAAA,CAAIC,SAAwB,IAAI,CAAA,CAYhE,OAVAC,SAAAA,CAAU,IAAM,CACd,GAAKL,CAAAA,CAIL,OAAOA,CAAAA,CAAQ,kBAAA,CAAoBM,CAAAA,EAAW,CAC5CH,CAAAA,CAAcG,CAAAA,CAAO,OAAO,EAC9B,CAAC,CACH,CAAA,CAAG,CAACN,CAAO,CAAC,CAAA,CAEPA,CAAAA,CAIDE,CAAAA,GAAe,IAAA,CACV,CAAE,OAAA,CAASF,CAAAA,CAAQ,OAAA,CAAS,MAAA,CAAQA,CAAAA,CAAQ,QAAS,SAAA,CAAW,IAAK,CAAA,CAGvE,CAAE,OAAA,CAASA,CAAAA,CAAQ,OAAA,CAAS,MAAA,CAAQE,CAAAA,CAAY,SAAA,CAAW,KAAA,CAAO,OAAA,CAAS,IAAMF,CAAAA,CAAQ,aAAA,EAAgB,CAAA,CAPvGF,CAQX,CClCO,IAAMS,CAAAA,CAAwB,mBAAA,CAExBC,CAAAA,CAA+B,yBAAA,CAatCC,CAAAA,CAAiB,0EAAA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AAgBD,CAA0B,CAAA,EACxDI,CAAAA,CAAQ,KAAA,CACN,CAAE,UAAA,CAAY1G,CAAAA,CAAQ,QAAS,KAAA,CAAO,oBAAA,CAAsB,GAAIA,CAAAA,CAAQ,QAAS,CAAA,CACjF,CAAE,WAAA,CAAa,IAAMwG,GAAiBF,CAA0B,CAAE,CACpE,CAAA,CAGK,IAAM,CACPF,CAAAA,GAAYM,CAAAA,GACdN,CAAAA,CAAU,IAAA,EAEd,CACF","file":"chunk-U5XZWEPO.js","sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\nimport { getDesktop } from './desktop';\n\nexport interface StudioVersion {\n current: string;\n latest: string;\n isCurrent: boolean;\n /** Applies the newer version (the desktop app restarts into it); undefined when there is nothing to apply. */\n upgrade?: () => void;\n}\n\n// `@flexkit/studio`'s own version, inlined at build time; a build without the\n// define (tests, tooling) shows a placeholder.\nexport const STUDIO_VERSION = typeof __STUDIO_VERSION__ === 'string' ? __STUDIO_VERSION__ : '0.0.0';\nconst WEB_VERSION: StudioVersion = { current: STUDIO_VERSION, latest: STUDIO_VERSION, isCurrent: true };\n\n/**\n * The Studio version shown in the app bar. The web Studio is always current\n * (the hosted Studio deploys with the packages); the desktop app reports its\n * own version and the update it has downloaded, if any.\n */\nexport function useStudioVersion(): StudioVersion {\n const desktop = getDesktop();\n const [downloaded, setDownloaded] = useState<string | null>(null);\n\n useEffect(() => {\n if (!desktop) {\n return;\n }\n\n return desktop.onUpdateDownloaded((update) => {\n setDownloaded(update.version);\n });\n }, [desktop]);\n\n if (!desktop) {\n return WEB_VERSION;\n }\n\n if (downloaded === null) {\n return { current: desktop.version, latest: desktop.version, isCurrent: true };\n }\n\n return { current: desktop.version, latest: downloaded, isCurrent: false, upgrade: () => desktop.installUpdate() };\n}\n","import { getDesktop } from './desktop';\nimport { flexkitDomain } from './domains';\nimport { getLocalStorage } from './local-storage';\nimport { STUDIO_VERSION } from './use-studio-version';\n\n/**\n * The on/off decision and the transport shared by the Studio's error reports\n * (core/error/error-reporter.ts) and product events\n * (core/analytics/product-events.ts).\n */\n\n/** Turns error reports and product events on (`on`) or off (`off`) in this browser, whatever the environment. */\nexport const TELEMETRY_STORAGE_KEY = 'flexkit:telemetry';\n/** The key error reporting shipped with; still honoured. */\nexport const LEGACY_TELEMETRY_STORAGE_KEY = 'flexkit:error-reporting';\n\nexport interface TelemetryEnvironment {\n /** The Studio lists the signed-in user's projects (hosted Studio, desktop app). */\n hosted: boolean;\n isDesktop: boolean;\n domain: string;\n hostname: string;\n version: string;\n /** The local storage setting in this browser, if any. */\n override: string | null;\n}\n\nconst LOCAL_HOSTNAME = /^(localhost|127\\.0\\.0\\.1|\\[::1\\]|0\\.0\\.0\\.0)$|\\.(localhost|test|local)$/i;\n\n/**\n * On for the hosted Studio and the desktop app against the production\n * backend, and off in development: a local backend (`flexkit.test`), a local\n * host, or a build without a version. The local storage setting forces it\n * `on` or `off`.\n */\nexport function isTelemetryEnabled(env: TelemetryEnvironment): boolean {\n if (env.override === 'on') {\n return true;\n }\n\n if (env.override === 'off') {\n return false;\n }\n\n if (!env.hosted || env.domain !== 'flexkit.io' || env.version === '0.0.0') {\n return false;\n }\n\n return env.isDesktop || !LOCAL_HOSTNAME.test(env.hostname);\n}\n\nfunction readOverride(): string | null {\n try {\n const storage = getLocalStorage();\n\n return storage?.getItem(TELEMETRY_STORAGE_KEY) ?? storage?.getItem(LEGACY_TELEMETRY_STORAGE_KEY) ?? null;\n } catch {\n return null;\n }\n}\n\n/** Whether this Studio sends error reports and product events to Flexkit. */\nexport function isStudioTelemetryEnabled({ hosted }: { hosted: boolean }): boolean {\n if (typeof window === 'undefined') {\n return false;\n }\n\n return isTelemetryEnabled({\n hosted,\n isDesktop: Boolean(getDesktop()),\n domain: flexkitDomain,\n hostname: window.location.hostname,\n version: STUDIO_VERSION,\n override: readOverride(),\n });\n}\n\n/**\n * POSTs JSON to a user-level backend route through the Studio's server proxy,\n * which adds the session. `keepalive` lets the request outlive the page.\n * Returns the response status.\n */\nexport async function postToUserApi(path: string, body: string, { keepalive = false } = {}): Promise<number> {\n const response = await fetch(path, {\n body,\n credentials: 'same-origin',\n headers: { 'Content-Type': 'application/json' },\n keepalive,\n method: 'POST',\n });\n\n return response.status;\n}\n","import { userApiPaths } from '../api-paths';\nimport { getDesktop } from '../desktop';\nimport { STUDIO_VERSION } from '../use-studio-version';\nimport { isStudioTelemetryEnabled, postToUserApi } from '../telemetry';\n\n/**\n * Reports unexpected Studio errors (uncaught errors, unhandled rejections and\n * errors caught by the error boundaries) to Flexkit through the Studio's own\n * BFF (`/api/flexkit/-/client-errors`), which forwards the session so the\n * report is attributed to the signed-in user.\n *\n * Reports carry the error, the Studio path (no query string or hash) and the\n * current project id; never request bodies, form values or record data.\n */\n\nexport type ClientErrorSource = 'window' | 'unhandledrejection' | 'react' | 'manual';\n\nexport interface ClientError {\n source: ClientErrorSource;\n name: string;\n message: string;\n stack?: string;\n componentStack?: string;\n path?: string;\n projectId?: string;\n occurredAt: string;\n}\n\nexport interface ClientErrorApp {\n platform: 'web' | 'desktop';\n version: string;\n userAgent?: string;\n}\n\nexport interface ClientErrorReport {\n app: ClientErrorApp;\n errors: ClientError[];\n}\n\n/** Field limits of the backend schema. */\nconst LIMITS = {\n componentStack: 4_000,\n message: 2_000,\n name: 200,\n path: 500,\n stack: 8_000,\n userAgent: 500,\n} as const;\n\n/** The backend accepts 1 to 10 errors per report. */\nexport const MAX_ERRORS_PER_REPORT = 10;\n/** The backend refuses bodies over 64 KB; `keepalive` requests share a 64 KB budget too. */\nexport const MAX_REPORT_BYTES = 60_000;\n/** Reports kept per page session; anything after that is dropped. */\nexport const MAX_ERRORS_PER_SESSION = 50;\n/** At most one report is sent per interval; errors in between are batched. */\nexport const FLUSH_INTERVAL_MS = 5_000;\n\n/** Kept for callers and tests that name the gate after error reporting. */\nexport {\n isTelemetryEnabled as isErrorReportingEnabled,\n LEGACY_TELEMETRY_STORAGE_KEY as ERROR_REPORTING_STORAGE_KEY,\n type TelemetryEnvironment as ErrorReportingEnvironment,\n} from '../telemetry';\n\nexport const PROJECT_ID_PATTERN = /^[a-z0-9]{1,64}$/;\n\nfunction truncate(value: string, max: number): string {\n return value.length > max ? value.slice(0, max) : value;\n}\n\n/** The pathname of a path or URL, without query string or hash. */\nexport function toReportPath(pathOrUrl: string): string {\n let path = pathOrUrl;\n\n try {\n if (/^[a-z][a-z0-9+.-]*:/i.test(pathOrUrl)) {\n path = new URL(pathOrUrl).pathname;\n }\n } catch {\n // Not a URL; strip by hand below.\n }\n\n return truncate(path.split(/[?#]/)[0] ?? '', LIMITS.path);\n}\n\nexport interface ErrorDetails {\n name: string;\n message: string;\n stack?: string;\n}\n\n/**\n * Name, message and stack of anything thrown. A non-Error value (a rejected\n * promise with a plain object) is described by its type only, so record data\n * someone rejected with never leaves the browser.\n */\nexport function describeError(error: unknown): ErrorDetails {\n if (error instanceof Error) {\n return {\n name: error.name || 'Error',\n message: typeof error.message === 'string' ? error.message : '',\n stack: typeof error.stack === 'string' ? error.stack : undefined,\n };\n }\n\n if (typeof error === 'string') {\n return { name: 'Error', message: error };\n }\n\n if (error === null || error === undefined) {\n return { name: 'Error', message: `Non-Error thrown: ${String(error)}` };\n }\n\n if (typeof error === 'object') {\n const constructorName = (error as { constructor?: { name?: unknown } }).constructor?.name;\n\n return {\n name: 'Error',\n message: `Non-Error thrown: ${typeof constructorName === 'string' && constructorName ? constructorName : 'object'}`,\n };\n }\n\n return { name: 'Error', message: `Non-Error thrown: ${typeof error}` };\n}\n\nconst NOISE_MESSAGES = [\n /ResizeObserver loop (limit exceeded|completed with undelivered notifications)/i,\n // Cross-origin script errors carry nothing to act on.\n /^Script error\\.?$/i,\n /The (operation|user) (was )?aborted/i,\n /signal is aborted without reason/i,\n];\n\nconst EXTENSION_URL = /\\b(chrome|moz|safari(-web)?|ms-browser)-extension:\\/\\//i;\n\nconst EMAIL_ADDRESS = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}/gi;\n\n/** Masks email addresses an error message may quote from a record or form. */\nexport function maskMessage(message: string): string {\n return message.replace(EMAIL_ADDRESS, '<email>');\n}\n\n/** Errors that are not Studio bugs: browser quirks, aborted requests, browser extensions. */\nexport function isNoiseError(details: ErrorDetails, sourceUrl?: string): boolean {\n if (details.name === 'AbortError') {\n return true;\n }\n\n if (NOISE_MESSAGES.some((pattern) => pattern.test(details.message))) {\n return true;\n }\n\n if (sourceUrl && EXTENSION_URL.test(sourceUrl)) {\n return true;\n }\n\n return Boolean(details.stack && EXTENSION_URL.test(details.stack));\n}\n\nexport interface BuildClientErrorOptions {\n source: ClientErrorSource;\n componentStack?: string;\n path?: string;\n projectId?: string | null;\n /** The script the error came from (`ErrorEvent.filename`), checked for browser extensions. */\n sourceUrl?: string;\n now?: Date;\n}\n\n/** The report entry for an error, or null when it is noise. */\nexport function buildClientError(error: unknown, options: BuildClientErrorOptions): ClientError | null {\n const details = describeError(error);\n\n if (isNoiseError(details, options.sourceUrl)) {\n return null;\n }\n\n const entry: ClientError = {\n source: options.source,\n name: truncate(details.name, LIMITS.name),\n message: truncate(maskMessage(details.message), LIMITS.message),\n occurredAt: (options.now ?? new Date()).toISOString(),\n };\n\n if (details.stack) {\n entry.stack = truncate(details.stack, LIMITS.stack);\n }\n\n if (options.componentStack) {\n entry.componentStack = truncate(options.componentStack, LIMITS.componentStack);\n }\n\n if (options.path) {\n entry.path = toReportPath(options.path);\n }\n\n if (options.projectId && PROJECT_ID_PATTERN.test(options.projectId)) {\n entry.projectId = options.projectId;\n }\n\n return entry;\n}\n\n/** Identity of an error within a page session: the same message and stack are reported once. */\nexport function errorKey(error: Pick<ClientError, 'message' | 'name' | 'stack'>): string {\n return `${error.name}\\n${error.message}\\n${error.stack ?? ''}`;\n}\n\nconst encoder = new TextEncoder();\n\nfunction byteLength(value: string): number {\n return encoder.encode(value).length;\n}\n\n/**\n * Takes the errors that fit one report (at most 10 and `maxBytes` of JSON)\n * off the front of the queue. Returns the request body and how many errors it holds.\n */\nexport function buildReportBody(\n app: ClientErrorApp,\n queue: readonly ClientError[],\n maxBytes = MAX_REPORT_BYTES\n): { body: string; count: number } | null {\n // The envelope plus each error once, joined by commas.\n let size = byteLength(JSON.stringify({ app, errors: [] } satisfies ClientErrorReport));\n const errors: ClientError[] = [];\n\n for (const error of queue.slice(0, MAX_ERRORS_PER_REPORT)) {\n const errorSize = byteLength(JSON.stringify(error)) + (errors.length ? 1 : 0);\n\n if (size + errorSize > maxBytes) {\n break;\n }\n\n size += errorSize;\n errors.push(error);\n }\n\n if (errors.length === 0) {\n return null;\n }\n\n return { body: JSON.stringify({ app, errors } satisfies ClientErrorReport), count: errors.length };\n}\n\nexport type SendReport = (body: string, options: { unloading: boolean }) => Promise<number | null>;\n\nexport interface ErrorReporterOptions {\n app: ClientErrorApp;\n send: SendReport;\n /** The current Studio path; only its pathname is sent. */\n getPath?: () => string | undefined;\n now?: () => Date;\n setTimer?: (callback: () => void, ms: number) => unknown;\n clearTimer?: (timer: unknown) => void;\n}\n\nexport interface ErrorReporter {\n report: (error: unknown, options: Omit<BuildClientErrorOptions, 'path' | 'projectId' | 'now'>) => void;\n setProjectId: (projectId: string | null) => void;\n /** Sends the next report now; `unloading` uses a beacon or keepalive request that outlives the page. */\n flush: (options?: { unloading?: boolean }) => void;\n /** Errors waiting to be sent (tests). */\n pending: () => readonly ClientError[];\n dispose: () => void;\n}\n\n/** The queue, dedupe, cap and batching; the transport and the clock are injected. */\nexport function createErrorReporter({\n app,\n send,\n getPath,\n now = () => new Date(),\n setTimer = (callback, ms) => setTimeout(callback, ms),\n clearTimer = (timer) => clearTimeout(timer as ReturnType<typeof setTimeout>),\n}: ErrorReporterOptions): ErrorReporter {\n const queue: ClientError[] = [];\n const seen = new Set<string>();\n let accepted = 0;\n let projectId: string | null = null;\n let timer: unknown = null;\n let stopped = false;\n\n function schedule(): void {\n if (timer === null && queue.length > 0 && !stopped) {\n timer = setTimer(() => {\n timer = null;\n flush();\n }, FLUSH_INTERVAL_MS);\n }\n }\n\n function sendNext(unloading: boolean): boolean {\n const next = buildReportBody(app, queue);\n\n if (!next) {\n // An error that cannot fit a report on its own; drop it.\n queue.shift();\n\n return queue.length > 0;\n }\n\n queue.splice(0, next.count);\n send(next.body, { unloading })\n .then((status) => {\n // Rate limited or not allowed: stop for this page session rather than retry.\n if (status === 401 || status === 403 || status === 429) {\n stopped = true;\n queue.length = 0;\n }\n })\n .catch(() => {\n // Never report the reporter's own failures.\n });\n\n return queue.length > 0;\n }\n\n function flush({ unloading = false }: { unloading?: boolean } = {}): void {\n try {\n if (stopped) {\n return;\n }\n\n if (timer !== null && unloading) {\n clearTimer(timer);\n timer = null;\n }\n\n // One report per flush, also when the page goes away: beacons and\n // keepalive requests share a 64 KB budget, so a second would be refused.\n if (queue.length > 0) {\n sendNext(unloading);\n }\n\n schedule();\n } catch {\n // Error reporting must never break the Studio.\n }\n }\n\n return {\n report(error, options) {\n try {\n if (stopped || accepted >= MAX_ERRORS_PER_SESSION) {\n return;\n }\n\n const entry = buildClientError(error, {\n ...options,\n now: now(),\n path: getPath?.(),\n projectId,\n });\n\n if (!entry) {\n return;\n }\n\n const key = errorKey(entry);\n\n if (seen.has(key)) {\n return;\n }\n\n seen.add(key);\n accepted += 1;\n queue.push(entry);\n schedule();\n } catch {\n // Error reporting must never break the Studio.\n }\n },\n setProjectId(id) {\n projectId = id;\n },\n flush,\n pending: () => queue,\n dispose() {\n if (timer !== null) {\n clearTimer(timer);\n timer = null;\n }\n\n stopped = true;\n queue.length = 0;\n },\n };\n}\n\n/** Sends a report through the BFF; a beacon when the page is going away on the web. */\nexport const sendReportToBff: SendReport = async (body, { unloading }) => {\n const url = userApiPaths.clientErrors;\n\n // A beacon outlives the page. The BFF reads its JSON body like a fetch's\n // and the browser sends the session cookie with it (same origin). The\n // desktop app's BFF only answers script requests, so it uses `keepalive`.\n if (unloading && !getDesktop() && typeof navigator !== 'undefined' && typeof navigator.sendBeacon === 'function') {\n try {\n // text/plain is CORS-safelisted, so no browser refuses the beacon; the body is still JSON.\n if (navigator.sendBeacon(url, new Blob([body], { type: 'text/plain' }))) {\n return null;\n }\n } catch {\n // Fall back to a keepalive fetch.\n }\n }\n\n return postToUserApi(url, body, { keepalive: unloading });\n};\n\nlet installed: ErrorReporter | null = null;\n\n/** Reports an error caught by the Studio (an error boundary, for example). Does nothing when reporting is off. */\nexport function reportStudioError(\n error: unknown,\n { source = 'manual', componentStack }: { source?: ClientErrorSource; componentStack?: string } = {}\n): void {\n installed?.report(error, { source, componentStack });\n}\n\n/** The project the Studio shows, added to reports; null outside a project. */\nexport function setErrorReportingProjectId(projectId: string | null): void {\n installed?.setProjectId(projectId);\n}\n\n/**\n * Starts reporting uncaught errors and unhandled rejections when reporting is\n * enabled for this environment. Returns the function that stops it.\n */\nexport function installErrorReporter({ hosted }: { hosted: boolean }): () => void {\n if (typeof window === 'undefined' || installed) {\n return () => undefined;\n }\n\n if (!isStudioTelemetryEnabled({ hosted })) {\n return () => undefined;\n }\n\n const desktop = getDesktop();\n\n const reporter = createErrorReporter({\n app: {\n platform: desktop ? 'desktop' : 'web',\n version: STUDIO_VERSION,\n userAgent: truncate(navigator.userAgent, LIMITS.userAgent),\n },\n send: sendReportToBff,\n getPath: () => window.location.pathname,\n });\n\n function onError(event: ErrorEvent): void {\n reporter.report(event.error ?? event.message, { source: 'window', sourceUrl: event.filename });\n }\n\n function onUnhandledRejection(event: PromiseRejectionEvent): void {\n reporter.report(event.reason, { source: 'unhandledrejection' });\n }\n\n function onPageHide(): void {\n reporter.flush({ unloading: true });\n }\n\n window.addEventListener('error', onError);\n window.addEventListener('unhandledrejection', onUnhandledRejection);\n window.addEventListener('pagehide', onPageHide);\n installed = reporter;\n\n return () => {\n window.removeEventListener('error', onError);\n window.removeEventListener('unhandledrejection', onUnhandledRejection);\n window.removeEventListener('pagehide', onPageHide);\n reporter.flush({ unloading: true });\n reporter.dispose();\n\n if (installed === reporter) {\n installed = null;\n }\n };\n}\n","import { userApiPaths } from '../api-paths';\nimport { getDesktop } from '../desktop';\nimport { PROJECT_ID_PATTERN } from '../error/error-reporter';\nimport { isStudioTelemetryEnabled, postToUserApi } from '../telemetry';\n\n/**\n * Product events only the Studio can see, sent to Flexkit through the\n * Studio's own server proxy (`/api/flexkit/-/product-events`) with the\n * session: the Graph app opened, the desktop app launched. They follow the\n * Studio's telemetry setting (see core/telemetry.ts) and carry ids, the\n * desktop app version and the OS only.\n */\nexport type StudioProductEvent =\n | { event: 'graph_opened'; projectId: string }\n | { event: 'desktop_app_opened'; appVersion: string; os: 'darwin' | 'linux' | 'win32' };\n\n/** Identity of an event within a page session; the backend also counts each once per day. */\nexport function productEventKey(studioEvent: StudioProductEvent): string {\n return studioEvent.event === 'graph_opened' ? `graph_opened:${studioEvent.projectId}` : studioEvent.event;\n}\n\n/** Sends the event body; resolves with the response status. */\nexport type SendProductEvent = (body: string) => Promise<number>;\n\nexport interface ProductEventTracker {\n track: (studioEvent: StudioProductEvent, options?: { onDelivered?: () => void }) => void;\n}\n\n/**\n * Sends each event once per page session through `send`. An event counts as\n * sent only once the backend accepted it, so one sent while offline or signed\n * out is sent again next time. Never throws.\n */\nexport function createProductEventTracker(send: SendProductEvent): ProductEventTracker {\n const pending = new Set<string>();\n const delivered = new Set<string>();\n\n return {\n track(studioEvent, { onDelivered } = {}) {\n const key = productEventKey(studioEvent);\n\n if (pending.has(key) || delivered.has(key)) {\n return;\n }\n\n pending.add(key);\n\n const settle = (status: number | null): void => {\n pending.delete(key);\n\n if (status !== null && status >= 200 && status < 300) {\n delivered.add(key);\n onDelivered?.();\n }\n };\n\n try {\n send(JSON.stringify(studioEvent)).then(settle, () => settle(null));\n } catch {\n settle(null);\n }\n },\n };\n}\n\nlet tracker: ProductEventTracker | null = null;\n\n/** Records an event when product events are on (see `installProductEvents`); otherwise does nothing. */\nexport function trackStudioEvent(studioEvent: StudioProductEvent): void {\n if (studioEvent.event === 'graph_opened' && !PROJECT_ID_PATTERN.test(studioEvent.projectId)) {\n return;\n }\n\n tracker?.track(studioEvent);\n}\n\n/** Session storage flag: this desktop app launch was recorded (page reloads keep it, a relaunch does not). */\nexport const DESKTOP_LAUNCH_STORAGE_KEY = 'flexkit:desktop-launch-recorded';\n\nfunction readSessionFlag(key: string): boolean {\n try {\n return sessionStorage.getItem(key) === '1';\n } catch {\n return false;\n }\n}\n\nfunction writeSessionFlag(key: string): void {\n try {\n sessionStorage.setItem(key, '1');\n } catch {\n // Without session storage the backend's once-per-day count still applies.\n }\n}\n\n/**\n * Turns product events on for this environment and records the desktop app\n * launch (once per launch, once the user is signed in). Returns the function\n * that turns them off again.\n */\nexport function installProductEvents({ hosted }: { hosted: boolean }): () => void {\n if (!isStudioTelemetryEnabled({ hosted })) {\n return () => undefined;\n }\n\n const current = createProductEventTracker((body) =>\n postToUserApi(userApiPaths.productEvents, body, { keepalive: true })\n );\n const desktop = getDesktop();\n\n tracker = current;\n\n if (desktop && !readSessionFlag(DESKTOP_LAUNCH_STORAGE_KEY)) {\n current.track(\n { appVersion: desktop.version, event: 'desktop_app_opened', os: desktop.platform },\n { onDelivered: () => writeSessionFlag(DESKTOP_LAUNCH_STORAGE_KEY) }\n );\n }\n\n return () => {\n if (tracker === current) {\n tracker = null;\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/use-studio-version.ts","../src/core/telemetry.ts","../src/core/error/error-reporter.ts","../src/core/analytics/product-events.ts"],"names":["STUDIO_VERSION","WEB_VERSION","useStudioVersion","desktop","getDesktop","downloaded","setDownloaded","useState","useEffect","update","TELEMETRY_STORAGE_KEY","LEGACY_TELEMETRY_STORAGE_KEY","LOCAL_HOSTNAME","isTelemetryEnabled","env","readOverride","storage","getLocalStorage","isStudioTelemetryEnabled","hosted","flexkitDomain","postToUserApi","path","body","keepalive","LIMITS","MAX_ERRORS_PER_REPORT","MAX_REPORT_BYTES","MAX_ERRORS_PER_SESSION","FLUSH_INTERVAL_MS","PROJECT_ID_PATTERN","truncate","value","max","toReportPath","pathOrUrl","describeError","error","constructorName","NOISE_MESSAGES","EXTENSION_URL","EMAIL_ADDRESS","maskMessage","message","isNoiseError","details","sourceUrl","pattern","buildClientError","options","entry","errorKey","encoder","byteLength","buildReportBody","app","queue","maxBytes","size","errors","errorSize","createErrorReporter","send","getPath","now","setTimer","callback","ms","clearTimer","timer","seen","accepted","projectId","stopped","schedule","flush","sendNext","unloading","next","status","key","id","sendReportToBff","url","userApiPaths","installed","reportStudioError","source","componentStack","setErrorReportingProjectId","installErrorReporter","reporter","onError","event","onUnhandledRejection","onPageHide","productEventKey","studioEvent","createProductEventTracker","pending","delivered","onDelivered","settle","tracker","trackStudioEvent","DESKTOP_LAUNCH_STORAGE_KEY","readSessionFlag","writeSessionFlag","installProductEvents","current"],"mappings":"gLAeO,IAAMA,CAAAA,CAA0D,QAAA,CACjEC,CAAAA,CAA6B,CAAE,OAAA,CAASD,CAAAA,CAAgB,MAAA,CAAQA,CAAAA,CAAgB,SAAA,CAAW,IAAK,CAAA,CAO/F,SAASE,EAAAA,EAAkC,CAChD,IAAMC,CAAAA,CAAUC,CAAAA,EAAW,CACrB,CAACC,CAAAA,CAAYC,CAAa,CAAA,CAAIC,SAAwB,IAAI,CAAA,CAYhE,OAVAC,SAAAA,CAAU,IAAM,CACd,GAAKL,CAAAA,CAIL,OAAOA,CAAAA,CAAQ,kBAAA,CAAoBM,CAAAA,EAAW,CAC5CH,CAAAA,CAAcG,CAAAA,CAAO,OAAO,EAC9B,CAAC,CACH,CAAA,CAAG,CAACN,CAAO,CAAC,CAAA,CAEPA,CAAAA,CAIDE,CAAAA,GAAe,IAAA,CACV,CAAE,OAAA,CAASF,CAAAA,CAAQ,OAAA,CAAS,MAAA,CAAQA,CAAAA,CAAQ,QAAS,SAAA,CAAW,IAAK,CAAA,CAGvE,CAAE,OAAA,CAASA,CAAAA,CAAQ,OAAA,CAAS,MAAA,CAAQE,CAAAA,CAAY,SAAA,CAAW,KAAA,CAAO,OAAA,CAAS,IAAMF,CAAAA,CAAQ,aAAA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,IAAK,CAAC,CACrE,CAAA,CACMpB,EAAUC,CAAAA,EAAW,CAE3B,OAAAmG,CAAAA,CAAUM,CAAAA,CAEN1G,GAAW,CAACuG,EAAAA,CAAgBD,CAA0B,CAAA,EACxDI,CAAAA,CAAQ,KAAA,CACN,CAAE,UAAA,CAAY1G,CAAAA,CAAQ,QAAS,KAAA,CAAO,oBAAA,CAAsB,GAAIA,CAAAA,CAAQ,QAAS,CAAA,CACjF,CAAE,WAAA,CAAa,IAAMwG,GAAiBF,CAA0B,CAAE,CACpE,CAAA,CAGK,IAAM,CACPF,CAAAA,GAAYM,CAAAA,GACdN,CAAAA,CAAU,IAAA,EAEd,CACF","file":"chunk-PSECMZJC.js","sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\nimport { getDesktop } from './desktop';\n\nexport interface StudioVersion {\n current: string;\n latest: string;\n isCurrent: boolean;\n /** Applies the newer version (the desktop app restarts into it); undefined when there is nothing to apply. */\n upgrade?: () => void;\n}\n\n// `@flexkit/studio`'s own version, inlined at build time; a build without the\n// define (tests, tooling) shows a placeholder.\nexport const STUDIO_VERSION = typeof __STUDIO_VERSION__ === 'string' ? __STUDIO_VERSION__ : '0.0.0';\nconst WEB_VERSION: StudioVersion = { current: STUDIO_VERSION, latest: STUDIO_VERSION, isCurrent: true };\n\n/**\n * The Studio version shown in the app bar. The web Studio is always current\n * (the hosted Studio deploys with the packages); the desktop app reports its\n * own version and the update it has downloaded, if any.\n */\nexport function useStudioVersion(): StudioVersion {\n const desktop = getDesktop();\n const [downloaded, setDownloaded] = useState<string | null>(null);\n\n useEffect(() => {\n if (!desktop) {\n return;\n }\n\n return desktop.onUpdateDownloaded((update) => {\n setDownloaded(update.version);\n });\n }, [desktop]);\n\n if (!desktop) {\n return WEB_VERSION;\n }\n\n if (downloaded === null) {\n return { current: desktop.version, latest: desktop.version, isCurrent: true };\n }\n\n return { current: desktop.version, latest: downloaded, isCurrent: false, upgrade: () => desktop.installUpdate() };\n}\n","import { getDesktop } from './desktop';\nimport { flexkitDomain } from './domains';\nimport { getLocalStorage } from './local-storage';\nimport { STUDIO_VERSION } from './use-studio-version';\n\n/**\n * The on/off decision and the transport shared by the Studio's error reports\n * (core/error/error-reporter.ts) and product events\n * (core/analytics/product-events.ts).\n */\n\n/** Turns error reports and product events on (`on`) or off (`off`) in this browser, whatever the environment. */\nexport const TELEMETRY_STORAGE_KEY = 'flexkit:telemetry';\n/** The key error reporting shipped with; still honoured. */\nexport const LEGACY_TELEMETRY_STORAGE_KEY = 'flexkit:error-reporting';\n\nexport interface TelemetryEnvironment {\n /** The Studio lists the signed-in user's projects (hosted Studio, desktop app). */\n hosted: boolean;\n isDesktop: boolean;\n domain: string;\n hostname: string;\n version: string;\n /** The local storage setting in this browser, if any. */\n override: string | null;\n}\n\nconst LOCAL_HOSTNAME = /^(localhost|127\\.0\\.0\\.1|\\[::1\\]|0\\.0\\.0\\.0)$|\\.(localhost|test|local)$/i;\n\n/**\n * On for the hosted Studio and the desktop app against the production\n * backend, and off in development: a local backend (`flexkit.test`), a local\n * host, or a build without a version. The local storage setting forces it\n * `on` or `off`.\n */\nexport function isTelemetryEnabled(env: TelemetryEnvironment): boolean {\n if (env.override === 'on') {\n return true;\n }\n\n if (env.override === 'off') {\n return false;\n }\n\n if (!env.hosted || env.domain !== 'flexkit.io' || env.version === '0.0.0') {\n return false;\n }\n\n return env.isDesktop || !LOCAL_HOSTNAME.test(env.hostname);\n}\n\nfunction readOverride(): string | null {\n try {\n const storage = getLocalStorage();\n\n return storage?.getItem(TELEMETRY_STORAGE_KEY) ?? storage?.getItem(LEGACY_TELEMETRY_STORAGE_KEY) ?? null;\n } catch {\n return null;\n }\n}\n\n/** Whether this Studio sends error reports and product events to Flexkit. */\nexport function isStudioTelemetryEnabled({ hosted }: { hosted: boolean }): boolean {\n if (typeof window === 'undefined') {\n return false;\n }\n\n return isTelemetryEnabled({\n hosted,\n isDesktop: Boolean(getDesktop()),\n domain: flexkitDomain,\n hostname: window.location.hostname,\n version: STUDIO_VERSION,\n override: readOverride(),\n });\n}\n\n/**\n * POSTs JSON to a user-level backend route through the Studio's server proxy,\n * which adds the session. `keepalive` lets the request outlive the page.\n * Returns the response status.\n */\nexport async function postToUserApi(path: string, body: string, { keepalive = false } = {}): Promise<number> {\n const response = await fetch(path, {\n body,\n credentials: 'same-origin',\n headers: { 'Content-Type': 'application/json' },\n keepalive,\n method: 'POST',\n });\n\n return response.status;\n}\n","import { userApiPaths } from '../api-paths';\nimport { getDesktop } from '../desktop';\nimport { STUDIO_VERSION } from '../use-studio-version';\nimport { isStudioTelemetryEnabled, postToUserApi } from '../telemetry';\n\n/**\n * Reports unexpected Studio errors (uncaught errors, unhandled rejections and\n * errors caught by the error boundaries) to Flexkit through the Studio's own\n * BFF (`/api/flexkit/-/client-errors`), which forwards the session so the\n * report is attributed to the signed-in user.\n *\n * Reports carry the error, the Studio path (no query string or hash) and the\n * current project id; never request bodies, form values or record data.\n */\n\nexport type ClientErrorSource = 'window' | 'unhandledrejection' | 'react' | 'manual';\n\nexport interface ClientError {\n source: ClientErrorSource;\n name: string;\n message: string;\n stack?: string;\n componentStack?: string;\n path?: string;\n projectId?: string;\n occurredAt: string;\n}\n\nexport interface ClientErrorApp {\n platform: 'web' | 'desktop';\n version: string;\n userAgent?: string;\n}\n\nexport interface ClientErrorReport {\n app: ClientErrorApp;\n errors: ClientError[];\n}\n\n/** Field limits of the backend schema. */\nconst LIMITS = {\n componentStack: 4_000,\n message: 2_000,\n name: 200,\n path: 500,\n stack: 8_000,\n userAgent: 500,\n} as const;\n\n/** The backend accepts 1 to 10 errors per report. */\nexport const MAX_ERRORS_PER_REPORT = 10;\n/** The backend refuses bodies over 64 KB; `keepalive` requests share a 64 KB budget too. */\nexport const MAX_REPORT_BYTES = 60_000;\n/** Reports kept per page session; anything after that is dropped. */\nexport const MAX_ERRORS_PER_SESSION = 50;\n/** At most one report is sent per interval; errors in between are batched. */\nexport const FLUSH_INTERVAL_MS = 5_000;\n\n/** Kept for callers and tests that name the gate after error reporting. */\nexport {\n isTelemetryEnabled as isErrorReportingEnabled,\n LEGACY_TELEMETRY_STORAGE_KEY as ERROR_REPORTING_STORAGE_KEY,\n type TelemetryEnvironment as ErrorReportingEnvironment,\n} from '../telemetry';\n\nexport const PROJECT_ID_PATTERN = /^[a-z0-9]{1,64}$/;\n\nfunction truncate(value: string, max: number): string {\n return value.length > max ? value.slice(0, max) : value;\n}\n\n/** The pathname of a path or URL, without query string or hash. */\nexport function toReportPath(pathOrUrl: string): string {\n let path = pathOrUrl;\n\n try {\n if (/^[a-z][a-z0-9+.-]*:/i.test(pathOrUrl)) {\n path = new URL(pathOrUrl).pathname;\n }\n } catch {\n // Not a URL; strip by hand below.\n }\n\n return truncate(path.split(/[?#]/)[0] ?? '', LIMITS.path);\n}\n\nexport interface ErrorDetails {\n name: string;\n message: string;\n stack?: string;\n}\n\n/**\n * Name, message and stack of anything thrown. A non-Error value (a rejected\n * promise with a plain object) is described by its type only, so record data\n * someone rejected with never leaves the browser.\n */\nexport function describeError(error: unknown): ErrorDetails {\n if (error instanceof Error) {\n return {\n name: error.name || 'Error',\n message: typeof error.message === 'string' ? error.message : '',\n stack: typeof error.stack === 'string' ? error.stack : undefined,\n };\n }\n\n if (typeof error === 'string') {\n return { name: 'Error', message: error };\n }\n\n if (error === null || error === undefined) {\n return { name: 'Error', message: `Non-Error thrown: ${String(error)}` };\n }\n\n if (typeof error === 'object') {\n const constructorName = (error as { constructor?: { name?: unknown } }).constructor?.name;\n\n return {\n name: 'Error',\n message: `Non-Error thrown: ${typeof constructorName === 'string' && constructorName ? constructorName : 'object'}`,\n };\n }\n\n return { name: 'Error', message: `Non-Error thrown: ${typeof error}` };\n}\n\nconst NOISE_MESSAGES = [\n /ResizeObserver loop (limit exceeded|completed with undelivered notifications)/i,\n // Cross-origin script errors carry nothing to act on.\n /^Script error\\.?$/i,\n /The (operation|user) (was )?aborted/i,\n /signal is aborted without reason/i,\n];\n\nconst EXTENSION_URL = /\\b(chrome|moz|safari(-web)?|ms-browser)-extension:\\/\\//i;\n\nconst EMAIL_ADDRESS = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}/gi;\n\n/** Masks email addresses an error message may quote from a record or form. */\nexport function maskMessage(message: string): string {\n return message.replace(EMAIL_ADDRESS, '<email>');\n}\n\n/** Errors that are not Studio bugs: browser quirks, aborted requests, browser extensions. */\nexport function isNoiseError(details: ErrorDetails, sourceUrl?: string): boolean {\n if (details.name === 'AbortError') {\n return true;\n }\n\n if (NOISE_MESSAGES.some((pattern) => pattern.test(details.message))) {\n return true;\n }\n\n if (sourceUrl && EXTENSION_URL.test(sourceUrl)) {\n return true;\n }\n\n return Boolean(details.stack && EXTENSION_URL.test(details.stack));\n}\n\nexport interface BuildClientErrorOptions {\n source: ClientErrorSource;\n componentStack?: string;\n path?: string;\n projectId?: string | null;\n /** The script the error came from (`ErrorEvent.filename`), checked for browser extensions. */\n sourceUrl?: string;\n now?: Date;\n}\n\n/** The report entry for an error, or null when it is noise. */\nexport function buildClientError(error: unknown, options: BuildClientErrorOptions): ClientError | null {\n const details = describeError(error);\n\n if (isNoiseError(details, options.sourceUrl)) {\n return null;\n }\n\n const entry: ClientError = {\n source: options.source,\n name: truncate(details.name, LIMITS.name),\n message: truncate(maskMessage(details.message), LIMITS.message),\n occurredAt: (options.now ?? new Date()).toISOString(),\n };\n\n if (details.stack) {\n entry.stack = truncate(details.stack, LIMITS.stack);\n }\n\n if (options.componentStack) {\n entry.componentStack = truncate(options.componentStack, LIMITS.componentStack);\n }\n\n if (options.path) {\n entry.path = toReportPath(options.path);\n }\n\n if (options.projectId && PROJECT_ID_PATTERN.test(options.projectId)) {\n entry.projectId = options.projectId;\n }\n\n return entry;\n}\n\n/** Identity of an error within a page session: the same message and stack are reported once. */\nexport function errorKey(error: Pick<ClientError, 'message' | 'name' | 'stack'>): string {\n return `${error.name}\\n${error.message}\\n${error.stack ?? ''}`;\n}\n\nconst encoder = new TextEncoder();\n\nfunction byteLength(value: string): number {\n return encoder.encode(value).length;\n}\n\n/**\n * Takes the errors that fit one report (at most 10 and `maxBytes` of JSON)\n * off the front of the queue. Returns the request body and how many errors it holds.\n */\nexport function buildReportBody(\n app: ClientErrorApp,\n queue: readonly ClientError[],\n maxBytes = MAX_REPORT_BYTES\n): { body: string; count: number } | null {\n // The envelope plus each error once, joined by commas.\n let size = byteLength(JSON.stringify({ app, errors: [] } satisfies ClientErrorReport));\n const errors: ClientError[] = [];\n\n for (const error of queue.slice(0, MAX_ERRORS_PER_REPORT)) {\n const errorSize = byteLength(JSON.stringify(error)) + (errors.length ? 1 : 0);\n\n if (size + errorSize > maxBytes) {\n break;\n }\n\n size += errorSize;\n errors.push(error);\n }\n\n if (errors.length === 0) {\n return null;\n }\n\n return { body: JSON.stringify({ app, errors } satisfies ClientErrorReport), count: errors.length };\n}\n\nexport type SendReport = (body: string, options: { unloading: boolean }) => Promise<number | null>;\n\nexport interface ErrorReporterOptions {\n app: ClientErrorApp;\n send: SendReport;\n /** The current Studio path; only its pathname is sent. */\n getPath?: () => string | undefined;\n now?: () => Date;\n setTimer?: (callback: () => void, ms: number) => unknown;\n clearTimer?: (timer: unknown) => void;\n}\n\nexport interface ErrorReporter {\n report: (error: unknown, options: Omit<BuildClientErrorOptions, 'path' | 'projectId' | 'now'>) => void;\n setProjectId: (projectId: string | null) => void;\n /** Sends the next report now; `unloading` uses a beacon or keepalive request that outlives the page. */\n flush: (options?: { unloading?: boolean }) => void;\n /** Errors waiting to be sent (tests). */\n pending: () => readonly ClientError[];\n dispose: () => void;\n}\n\n/** The queue, dedupe, cap and batching; the transport and the clock are injected. */\nexport function createErrorReporter({\n app,\n send,\n getPath,\n now = () => new Date(),\n setTimer = (callback, ms) => setTimeout(callback, ms),\n clearTimer = (timer) => clearTimeout(timer as ReturnType<typeof setTimeout>),\n}: ErrorReporterOptions): ErrorReporter {\n const queue: ClientError[] = [];\n const seen = new Set<string>();\n let accepted = 0;\n let projectId: string | null = null;\n let timer: unknown = null;\n let stopped = false;\n\n function schedule(): void {\n if (timer === null && queue.length > 0 && !stopped) {\n timer = setTimer(() => {\n timer = null;\n flush();\n }, FLUSH_INTERVAL_MS);\n }\n }\n\n function sendNext(unloading: boolean): boolean {\n const next = buildReportBody(app, queue);\n\n if (!next) {\n // An error that cannot fit a report on its own; drop it.\n queue.shift();\n\n return queue.length > 0;\n }\n\n queue.splice(0, next.count);\n send(next.body, { unloading })\n .then((status) => {\n // Rate limited or not allowed: stop for this page session rather than retry.\n if (status === 401 || status === 403 || status === 429) {\n stopped = true;\n queue.length = 0;\n }\n })\n .catch(() => {\n // Never report the reporter's own failures.\n });\n\n return queue.length > 0;\n }\n\n function flush({ unloading = false }: { unloading?: boolean } = {}): void {\n try {\n if (stopped) {\n return;\n }\n\n if (timer !== null && unloading) {\n clearTimer(timer);\n timer = null;\n }\n\n // One report per flush, also when the page goes away: beacons and\n // keepalive requests share a 64 KB budget, so a second would be refused.\n if (queue.length > 0) {\n sendNext(unloading);\n }\n\n schedule();\n } catch {\n // Error reporting must never break the Studio.\n }\n }\n\n return {\n report(error, options) {\n try {\n if (stopped || accepted >= MAX_ERRORS_PER_SESSION) {\n return;\n }\n\n const entry = buildClientError(error, {\n ...options,\n now: now(),\n path: getPath?.(),\n projectId,\n });\n\n if (!entry) {\n return;\n }\n\n const key = errorKey(entry);\n\n if (seen.has(key)) {\n return;\n }\n\n seen.add(key);\n accepted += 1;\n queue.push(entry);\n schedule();\n } catch {\n // Error reporting must never break the Studio.\n }\n },\n setProjectId(id) {\n projectId = id;\n },\n flush,\n pending: () => queue,\n dispose() {\n if (timer !== null) {\n clearTimer(timer);\n timer = null;\n }\n\n stopped = true;\n queue.length = 0;\n },\n };\n}\n\n/** Sends a report through the BFF; a beacon when the page is going away on the web. */\nexport const sendReportToBff: SendReport = async (body, { unloading }) => {\n const url = userApiPaths.clientErrors;\n\n // A beacon outlives the page. The BFF reads its JSON body like a fetch's\n // and the browser sends the session cookie with it (same origin). The\n // desktop app's BFF only answers script requests, so it uses `keepalive`.\n if (unloading && !getDesktop() && typeof navigator !== 'undefined' && typeof navigator.sendBeacon === 'function') {\n try {\n // text/plain is CORS-safelisted, so no browser refuses the beacon; the body is still JSON.\n if (navigator.sendBeacon(url, new Blob([body], { type: 'text/plain' }))) {\n return null;\n }\n } catch {\n // Fall back to a keepalive fetch.\n }\n }\n\n return postToUserApi(url, body, { keepalive: unloading });\n};\n\nlet installed: ErrorReporter | null = null;\n\n/** Reports an error caught by the Studio (an error boundary, for example). Does nothing when reporting is off. */\nexport function reportStudioError(\n error: unknown,\n { source = 'manual', componentStack }: { source?: ClientErrorSource; componentStack?: string } = {}\n): void {\n installed?.report(error, { source, componentStack });\n}\n\n/** The project the Studio shows, added to reports; null outside a project. */\nexport function setErrorReportingProjectId(projectId: string | null): void {\n installed?.setProjectId(projectId);\n}\n\n/**\n * Starts reporting uncaught errors and unhandled rejections when reporting is\n * enabled for this environment. Returns the function that stops it.\n */\nexport function installErrorReporter({ hosted }: { hosted: boolean }): () => void {\n if (typeof window === 'undefined' || installed) {\n return () => undefined;\n }\n\n if (!isStudioTelemetryEnabled({ hosted })) {\n return () => undefined;\n }\n\n const desktop = getDesktop();\n\n const reporter = createErrorReporter({\n app: {\n platform: desktop ? 'desktop' : 'web',\n version: STUDIO_VERSION,\n userAgent: truncate(navigator.userAgent, LIMITS.userAgent),\n },\n send: sendReportToBff,\n getPath: () => window.location.pathname,\n });\n\n function onError(event: ErrorEvent): void {\n reporter.report(event.error ?? event.message, { source: 'window', sourceUrl: event.filename });\n }\n\n function onUnhandledRejection(event: PromiseRejectionEvent): void {\n reporter.report(event.reason, { source: 'unhandledrejection' });\n }\n\n function onPageHide(): void {\n reporter.flush({ unloading: true });\n }\n\n window.addEventListener('error', onError);\n window.addEventListener('unhandledrejection', onUnhandledRejection);\n window.addEventListener('pagehide', onPageHide);\n installed = reporter;\n\n return () => {\n window.removeEventListener('error', onError);\n window.removeEventListener('unhandledrejection', onUnhandledRejection);\n window.removeEventListener('pagehide', onPageHide);\n reporter.flush({ unloading: true });\n reporter.dispose();\n\n if (installed === reporter) {\n installed = null;\n }\n };\n}\n","import { userApiPaths } from '../api-paths';\nimport { getDesktop } from '../desktop';\nimport { PROJECT_ID_PATTERN } from '../error/error-reporter';\nimport { isStudioTelemetryEnabled, postToUserApi } from '../telemetry';\n\n/**\n * Product events only the Studio can see, sent to Flexkit through the\n * Studio's own server proxy (`/api/flexkit/-/product-events`) with the\n * session: the Graph app opened, the desktop app launched. They follow the\n * Studio's telemetry setting (see core/telemetry.ts) and carry ids, the\n * desktop app version and the OS only.\n */\nexport type StudioProductEvent =\n | { event: 'graph_opened'; projectId: string }\n | { event: 'desktop_app_opened'; appVersion: string; os: 'darwin' | 'linux' | 'win32' };\n\n/** Identity of an event within a page session; the backend also counts each once per day. */\nexport function productEventKey(studioEvent: StudioProductEvent): string {\n return studioEvent.event === 'graph_opened' ? `graph_opened:${studioEvent.projectId}` : studioEvent.event;\n}\n\n/** Sends the event body; resolves with the response status. */\nexport type SendProductEvent = (body: string) => Promise<number>;\n\nexport interface ProductEventTracker {\n track: (studioEvent: StudioProductEvent, options?: { onDelivered?: () => void }) => void;\n}\n\n/**\n * Sends each event once per page session through `send`. An event counts as\n * sent only once the backend accepted it, so one sent while offline or signed\n * out is sent again next time. Never throws.\n */\nexport function createProductEventTracker(send: SendProductEvent): ProductEventTracker {\n const pending = new Set<string>();\n const delivered = new Set<string>();\n\n return {\n track(studioEvent, { onDelivered } = {}) {\n const key = productEventKey(studioEvent);\n\n if (pending.has(key) || delivered.has(key)) {\n return;\n }\n\n pending.add(key);\n\n const settle = (status: number | null): void => {\n pending.delete(key);\n\n if (status !== null && status >= 200 && status < 300) {\n delivered.add(key);\n onDelivered?.();\n }\n };\n\n try {\n send(JSON.stringify(studioEvent)).then(settle, () => settle(null));\n } catch {\n settle(null);\n }\n },\n };\n}\n\nlet tracker: ProductEventTracker | null = null;\n\n/** Records an event when product events are on (see `installProductEvents`); otherwise does nothing. */\nexport function trackStudioEvent(studioEvent: StudioProductEvent): void {\n if (studioEvent.event === 'graph_opened' && !PROJECT_ID_PATTERN.test(studioEvent.projectId)) {\n return;\n }\n\n tracker?.track(studioEvent);\n}\n\n/** Session storage flag: this desktop app launch was recorded (page reloads keep it, a relaunch does not). */\nexport const DESKTOP_LAUNCH_STORAGE_KEY = 'flexkit:desktop-launch-recorded';\n\nfunction readSessionFlag(key: string): boolean {\n try {\n return sessionStorage.getItem(key) === '1';\n } catch {\n return false;\n }\n}\n\nfunction writeSessionFlag(key: string): void {\n try {\n sessionStorage.setItem(key, '1');\n } catch {\n // Without session storage the backend's once-per-day count still applies.\n }\n}\n\n/**\n * Turns product events on for this environment and records the desktop app\n * launch (once per launch, once the user is signed in). Returns the function\n * that turns them off again.\n */\nexport function installProductEvents({ hosted }: { hosted: boolean }): () => void {\n if (!isStudioTelemetryEnabled({ hosted })) {\n return () => undefined;\n }\n\n const current = createProductEventTracker((body) =>\n postToUserApi(userApiPaths.productEvents, body, { keepalive: true })\n );\n const desktop = getDesktop();\n\n tracker = current;\n\n if (desktop && !readSessionFlag(DESKTOP_LAUNCH_STORAGE_KEY)) {\n current.track(\n { appVersion: desktop.version, event: 'desktop_app_opened', os: desktop.platform },\n { onDelivered: () => writeSessionFlag(DESKTOP_LAUNCH_STORAGE_KEY) }\n );\n }\n\n return () => {\n if (tracker === current) {\n tracker = null;\n }\n };\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import'./index.css';import {b}from'./chunk-CAZ6EUR2.js';import {b as b$2}from'./chunk-2DXR5NJV.js';import {e as e$1,a as a$2,b as b$1}from'./chunk-6AJRQSFO.js';import {g as g$2,b as b$5}from'./chunk-MBBE4RND.js';import {Y,Z,aa,ba,_,ca,n}from'./chunk-RULCANNM.js';import {e as e$2,g as g$1,h,j}from'./chunk-A4DPLZZF.js';import {e,f,g}from'./chunk-G5N6HEPW.js';import {b as b$4}from'./chunk-5JUG4BEF.js';import {k,p,q,s,t}from'./chunk-S7Z6KKIN.js';import {a,b as b$3,c as c$1,d,e as e$3}from'./chunk-N33S7BSG.js';import {a as a$1,c}from'./chunk-X3SHNHHM.js';import {AlertCircle,X,ChevronDown,ArrowUp,ArrowDown,Star,CircleCheck,CircleX,Check,Copy}from'lucide-react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useRef,useState,useEffect,useCallback,useMemo}from'react';import {useReactTable,getSortedRowModel,getPaginationRowModel,getFilteredRowModel,getCoreRowModel,flexRender}from'@tanstack/react-table';import {useVirtualizer}from'@tanstack/react-virtual';import {gql}from'@apollo/client';import {useMutation}from'@apollo/client/react';import {getText,getSchema,getTextSerializersFromSchema}from'@tiptap/core';import {Node}from'@tiptap/pm/model';import {TiptapLink,TiptapImage,UploadImagesPlugin,TaskList,TaskItem,HorizontalRule,StarterKit,CodeBlockLowlight,Youtube,Twitter,Mathematics,CharacterCount,Placeholder,AIHighlight,TiptapUnderline,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle}from'novel';import {Markdown}from'tiptap-markdown';import {cx}from'class-variance-authority';import {createLowlight,common}from'lowlight';import {defaultStyles,FileIcon}from'react-file-icon';import {isValid,format}from'date-fns';function Xr(){return jsxs(e,{variant:"destructive",children:[jsx(AlertCircle,{className:"fk:h-4 fk:w-4"}),jsx(f,{children:"Project Paused"}),jsxs(g,{children:["This project has been paused. To troubleshoot this error, please"," ",jsx("a",{className:"fk:text-blue-500 fk:underline",href:"https://flexkit.io/docs/errors/project-paused",target:"_blank",rel:"noopener noreferrer",children:"follow these steps"}),"."]})]})}function Kr(){let{schemaErrorMessage:e$2}=e$1();if(!e$2)return jsx(Fragment,{});let[t,n,...r]=e$2.split(`
|
|
2
|
+
`);return jsxs(e,{className:"fk:mb-4",variant:"destructive",children:[jsx(AlertCircle,{className:"fk:h-4 fk:w-4"}),jsx(f,{children:"Schema mismatch"}),jsxs(g,{children:[jsx("p",{children:t}),n?jsx("p",{className:"fk:mt-1",children:n}):null,r.length>0?jsx("ul",{className:"fk:mt-2 fk:list-disc fk:pl-4",children:r.map(o=>jsx("li",{children:o.replace(/^- /,"")},o))}):null]})]})}function lt({scrollHeight:e,scrollTop:t,clientHeight:n}){if(n<=0)return false;let r=t>0?Math.max(600,n):1;return e-t-n<r}var ln=36,cn=15,fn=2,ut=40;function pt(e){if(!e)return;let t=e.split(/\s+/);if(t.includes("fk:h-20"))return 80;if(t.includes("fk:h-10"))return 40;if(t.includes("fk:h-9"))return 36}function un(e,t){return e??pt(t)??ln}function lo({classNames:e,columns:t,data:n,entityName:r,hasMore:o=false,initialSelectionState:l,isLoadingMore:s=false,onEntitySelectionChange:b$1,onLoadMore:u,onScroll:k,onSortingChange:S,pageSize:M,rowHeightEstimate:g,rowAdditionState:i,rowDeletionState:T,scrollToTopKey:X,sorting:de,toolbarComponent:j}){let y=useRef(null),{schemaErrorMessage:N}=e$1(),[C,me]=useState(l??{}),[Ot,Ut]=useState({}),[zt,Bt]=useState([]),[Xt,jt]=useState([]),$t=de??Xt;useEffect(()=>{y.current?.scrollTo({top:0,left:0});},[r,X]),useEffect(()=>{if(!l)return;let a=Object.keys(C).sort().join(","),c=Object.keys(l).sort().join(",");a!==c&&me(l);},[l,C]);function Jt(a){if(S){S(a);return}jt(a);}let V=useReactTable({data:n,columns:t,state:{sorting:$t,columnVisibility:Ot,rowSelection:C,columnFilters:zt},initialState:{pagination:{pageSize:M??50}},enableRowSelection:true,onRowSelectionChange:Kt,onSortingChange:Jt,onColumnFiltersChange:Bt,onColumnVisibilityChange:Ut,getCoreRowModel:getCoreRowModel(),getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getRowId:a=>a._id,manualFiltering:true,manualPagination:true,manualSorting:true,meta:{getRowBackground:a=>mn(a,T,i)}}),{rows:$}=V.getRowModel(),Pe=un(g,e?.row),qt=pt(e?.row)!=null,Le=useVirtualizer({count:$.length,estimateSize:()=>Pe,getItemKey:a=>$[a]?.id??a,getScrollElement:()=>y.current,overscan:cn,scrollMargin:ut}),F=V.getVisibleLeafColumns(),Ie=V.getHeaderGroups(),R=Ie.length===1,K=useVirtualizer({horizontal:true,count:F.length,estimateSize:a=>F[a].getSize(),getItemKey:a=>F[a].id,getScrollElement:()=>y.current,overscan:fn,enabled:R}),Gt=JSON.stringify(F.map(a=>[a.id,a.getSize()]));useEffect(()=>{K.measure();},[Gt,K]);let H=K.getVirtualItems(),W=R?H[0]?.index??0:0,_e=R?(H[H.length-1]?.index??-1)+1:F.length,Y$1=R?H[0]?.start??0:0,Q=R?Math.max(0,K.getTotalSize()-(H[H.length-1]?.end??0)):0,Ve=Le.getVirtualItems(),{paddingTop:Fe,paddingBottom:He}=dn(Ve,Le.getTotalSize(),ut),pe=useRef(u),Oe=useRef(o),ge=useRef(s);pe.current=u,Oe.current=o,ge.current=s;let ke=useCallback(a=>{if(!pe.current||!Oe.current||ge.current)return;let c=a??y.current;c&<(c)&&(ge.current=true,pe.current());},[]),Ue=b();useEffect(()=>{Ue&&ke();},[ke,$.length,o,s,Ue]);function Kt(a){let c=Object.keys(typeof a=="function"?a(C):a);me(a),b$1?.(c);}function Wt(a){k?.(a),ke(a.currentTarget);}return N?jsx(Fragment,{}):jsxs("div",{className:a$1("fk:flex fk:h-full fk:min-h-0 fk:w-full fk:min-w-0 fk:flex-col fk:gap-4",e?.wrapper),children:[j&&j(V),jsx("div",{className:"fk:relative fk:min-h-0 fk:min-w-0 fk:flex-1 fk:-mb-px",children:jsx(a,{delayDuration:400,children:jsxs(Y,{className:a$1("fk:grid fk:pb-20",e?.table),"aria-colcount":F.length,style:{minWidth:V.getTotalSize()},containerClassName:e?.tableContainer,onScroll:Wt,ref:y,children:[jsx(Z,{className:"fk:sticky fk:top-0 fk:z-20 fk:grid",children:Ie.map(a=>jsxs(aa,{className:"fk:flex fk:w-full",children:[Y$1>0?jsx(le,{width:Y$1,header:true}):null,(R?a.headers.slice(W,_e):a.headers).map((c,P)=>jsxs(ba,{"aria-colindex":R?W+P+1:void 0,className:a$1("fk:flex fk:shrink-0 fk:items-center",c.column.id==="actions"&&"fk:pl-0"),colSpan:c.colSpan,style:c.getSize()?{width:`${c.getSize().toString()}px`}:{},children:[c.isPlaceholder?null:flexRender(c.column.columnDef.header,c.getContext()),s?jsx("div",{"aria-hidden":true,className:"fk:pointer-events-none fk:absolute fk:top-10.25 fk:right-px fk:left-px fk:z-20 fk:h-0.5 fk:overflow-hidden fk:opacity-4",children:jsx("div",{className:"fk:animate-progress fk:h-full fk:w-full fk:bg-foreground"})}):null]},c.id)),Q>0?jsx(le,{width:Q,header:true}):null]},a.id))}),jsx(_,{className:"fk:grid fk:relative",children:$.length===0?jsx(aa,{children:jsx(ca,{className:"fk:h-24 fk:text-center",colSpan:t.length,children:"No results."})}):jsxs(Fragment,{children:[Fe>0?jsx(dt,{height:Fe}):null,Ve.map(a=>{let c=$[a.index];return jsxs(aa,{className:a$1(V.options.meta.getRowBackground(c),"fk:flex fk:w-full fk:overflow-hidden fk:transition-none",!qt&&g==null&&"fk:h-9",e?.row),"data-index":a.index,"data-state":c.getIsSelected()&&"selected",style:{height:`${Pe.toString()}px`},children:[Y$1>0?jsx(le,{width:Y$1}):null,c.getVisibleCells().slice(W,_e).map((P,Yt)=>jsx(ca,{className:a$1("fk:flex fk:shrink-0 fk:items-center fk:truncate",P.column.id==="actions"&&"fk:pl-1!"),"aria-colindex":W+Yt+1,style:{width:P.column.getSize()},children:flexRender(P.column.columnDef.cell,P.getContext())},P.id)),Q>0?jsx(le,{width:Q}):null]},a.key)}),He>0?jsx(dt,{height:He}):null]})})]})})})]})}function dn(e,t,n){if(e.length===0)return {paddingTop:0,paddingBottom:0};let r=e[0]?.start??0,o=e[e.length-1]?.end??0;return {paddingTop:Math.max(0,r-n),paddingBottom:Math.max(0,t-(o-n))}}function le({width:e,header:t=false}){return jsx(t?"th":"td",{"aria-hidden":true,style:{width:e,flexShrink:0,padding:0,border:0}})}function dt({height:e}){return jsx("tr",{"aria-hidden":true,className:"fk:pointer-events-none fk:border-0",style:{display:"block",height:`${e.toString()}px`},children:jsx("td",{className:"fk:p-0 fk:border-0"})})}function mn(e,t,n){return t?.includes(e.original._id)?"fk:bg-row-removed fk:hover:bg-row-removed-hover":n?.some(r=>r._id===e.original._id)?"fk:bg-row-added fk:hover:bg-row-added-hover":""}function po({table:e}){let[t]=e.getState().sorting;if(!t)return null;let r=e.getColumn(t.id)?.columnDef.meta?.label??t.id,o=t.desc?"desc":"asc";return jsxs(c,{"aria-label":`Clear sorting by ${r}`,className:"fk:h-8 fk:px-2 fk:lg:px-3 fk:text-success fk:border-none",onClick:()=>{e.resetSorting();},size:"sm",variant:"outline",children:["Sorted by ",r," ",o,jsx(X,{className:"fk:ml-1 fk:h-4 fk:w-4"})]})}function So(){let[e,t]=useState(false),[n,r]=useState(gql`
|
|
3
|
+
mutation updateEntity($any: Any) {
|
|
4
|
+
any
|
|
5
|
+
}
|
|
6
|
+
`),[o,l]=useState({}),[s,{data:b,loading:u,error:k}]=useMutation(n,o),S=a$2(k),{isProjectDisabled:M,isProjectReadOnly:g}=(()=>{if(S?.statusCode===403){let i=b$1(S.bodyText);if(i&&typeof i.code=="string"){if(i.code==="PROJECT_PAUSED")return {isProjectDisabled:true,isProjectReadOnly:false};if(i.code==="READ_ONLY_MODE")return {isProjectDisabled:false,isProjectReadOnly:true}}return {isProjectDisabled:true,isProjectReadOnly:false}}return {isProjectDisabled:false,isProjectReadOnly:false}})();return useEffect(()=>{e&&(s(),t(false));},[e,s]),[t,r,l,{data:b,loading:u,error:k,isProjectDisabled:M,isProjectReadOnly:g}]}function Se({column:e,title:t,className:n}){if(!e.getCanSort())return jsx("div",{className:a$1("fk:flex fk:items-center",n),children:t});let r=e.getIsSorted()==="asc",o=e.getIsSorted()==="desc";return jsxs("div",{className:a$1("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-1",n),children:[jsx("span",{className:"fk:truncate",children:t}),jsxs(e$2,{children:[jsx(g$1,{asChild:true,children:jsx("button",{"aria-label":`Sort ${t}`,className:"fk:inline-flex fk:shrink-0 fk:items-center fk:justify-center fk:rounded-sm fk:p-0.5 fk:text-muted-foreground fk:outline-hidden fk:hover:bg-accent fk:hover:text-accent-foreground fk:focus-visible:ring-1 fk:focus-visible:ring-ring fk:corner-squircle",type:"button",children:jsx(ChevronDown,{className:"fk:h-3.5 fk:w-3.5"})})}),jsxs(h,{align:"end",className:"fk:w-44",children:[jsxs(j,{"aria-checked":r,className:a$1(r&&"fk:bg-accent fk:text-accent-foreground"),onSelect:()=>{if(r){e.clearSorting();return}e.toggleSorting(false);},role:"menuitemcheckbox",children:[jsx(ArrowUp,{className:a$1("fk:h-4 fk:w-4",r&&"fk:text-white")}),"Sort Ascending"]}),jsxs(j,{"aria-checked":o,className:a$1(o&&"fk:bg-accent fk:text-accent-foreground"),onSelect:()=>{if(o){e.clearSorting();return}e.toggleSorting(true);},role:"menuitemcheckbox",children:[jsx(ArrowDown,{className:a$1("fk:h-4 fk:w-4",o&&"fk:text-white")}),"Sort Descending"]})]})]})]})}function xe({value:e}){return jsx("div",{className:"fk:flex fk:w-full fk:justify-center",children:e?jsx(CircleCheck,{className:"fk:w-4 fk:h-4 fk:text-emerald-500"}):jsx(CircleX,{className:"fk:w-4 fk:h-4 fk:text-muted-foreground"})})}var ht=500,En=3e3;function w({value:e}){let t=useRef(null),n=useRef(null),[r,o]=useState(false),[l,s]=useState(false);useEffect(()=>()=>{n.current&&clearTimeout(n.current);},[]);function b(){let g=t.current;return g?g.scrollWidth>g.clientWidth:false}async function u(g){if(g.preventDefault(),g.stopPropagation(),!!e){try{await navigator.clipboard.writeText(e);}catch{return}o(true),s(true),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{o(false),s(false);},En);}}function k(){b();}function S(g){if(!r){if(g){s(b());return}s(false);}}if(!e)return jsx("div",{className:"fk:truncate"});let M=e.length>ht?`${e.slice(0,ht)}\u2026`:e;return jsxs(b$3,{open:l,onOpenChange:S,children:[jsx(c$1,{asChild:true,children:jsxs("button",{"aria-label":"Copy value",className:a$1("fk:group/copyable fk:relative fk:flex fk:w-full fk:min-w-0 fk:items-center fk:rounded-sm fk:border-0 fk:bg-transparent fk:px-0.5 fk:-mx-0.5 fk:py-0.5 fk:text-left fk:text-inherit fk:font-inherit fk:corner-squircle","fk:cursor-pointer fk:transition-[transform,background-color] fk:duration-75 fk:ease-out","fk:hover:bg-muted/50 fk:active:translate-y-px fk:active:scale-[0.98] fk:active:bg-muted/70","fk:focus-visible:outline-hidden fk:focus-visible:ring-1 fk:focus-visible:ring-ring"),onClick:u,onPointerEnter:k,type:"button",children:[jsx("span",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:pr-4",ref:t,children:e}),jsx("span",{"aria-hidden":true,className:a$1("fk:pointer-events-none fk:absolute fk:right-0.5 fk:top-1/2 fk:flex fk:-translate-y-1/2 fk:items-center fk:justify-center","fk:rounded-sm fk:bg-muted/80 fk:p-0.5 fk:text-muted-foreground fk:shadow-sm fk:ring-1 fk:ring-border/60 fk:corner-squircle","fk:transition-opacity fk:duration-100",r?"fk:opacity-100 fk:text-foreground":"fk:opacity-0 fk:group-hover/copyable:opacity-100 fk:group-focus-visible/copyable:opacity-100"),children:r?jsx(Check,{className:"fk:size-3"}):jsx(Copy,{className:"fk:size-3"})})]})}),jsx(e$3,{className:"fk:max-w-xs fk:wrap-break-word",children:r?"Copied to clipboard":M})]})}function B({value:e}){let t=typeof e=="object"||Array.isArray(e)?JSON.stringify(e):e;return t=t==="null"||t==null?"":String(t),jsx(w,{value:t})}var Zn=AIHighlight,er=Placeholder,tr=TiptapLink.configure({HTMLAttributes:{class:cx("fk:text-muted-foreground fk:underline fk:underline-offset-[3px] fk:hover:text-primary fk:transition-colors fk:cursor-pointer")}}),nr=Markdown.configure({html:true,tightLists:true,tightListClass:"tight",bulletListMarker:"-",linkify:false,breaks:false,transformPastedText:false,transformCopiedText:false}),rr=TiptapImage.extend({addProseMirrorPlugins(){return [UploadImagesPlugin({imageClass:cx("fk:opacity-40 fk:rounded-lg fk:border fk:border-stone-200 fk:corner-squircle")})]}}).configure({allowBase64:true,HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted fk:corner-squircle")}}),or=TaskList.configure({HTMLAttributes:{class:cx("fk:not-prose fk:pl-2 ")}}),ir=TaskItem.configure({HTMLAttributes:{class:cx("fk:flex gap-2 fk:items-start fk:my-2")},nested:true}),ar=HorizontalRule.configure({HTMLAttributes:{class:cx("mt-4 mb-6 border-t border-muted-foreground")}}),sr=StarterKit.configure({bulletList:{HTMLAttributes:{class:cx("fk:list-disc fk:list-outside fk:leading-3 fk:-mt-2")}},orderedList:{HTMLAttributes:{class:cx("fk:list-decimal fk:list-outside fk:leading-3 fk:-mt-2")}},listItem:{HTMLAttributes:{class:cx("fk:leading-normal fk:-mb-2")}},blockquote:{HTMLAttributes:{class:cx("fk:border-l-4 fk:border-primary")}},codeBlock:false,code:{HTMLAttributes:{class:cx("fk:rounded-md fk:bg-muted fk:px-1.5 fk:py-1 fk:font-mono fk:font-medium fk:corner-squircle"),spellcheck:"false"}},horizontalRule:false,dropcursor:{color:"#DBEAFE",width:4},gapcursor:false}),lr=CodeBlockLowlight.configure({lowlight:createLowlight(common)}),cr=Youtube.configure({HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted fk:corner-squircle")},inline:false}),fr=Twitter.configure({HTMLAttributes:{class:cx("fk:not-prose")},inline:false}),ur=Mathematics.configure({HTMLAttributes:{class:cx("fk:text-foreground fk:rounded-sm fk:p-1 fk:hover:bg-muted fk:cursor-pointer fk:corner-squircle")},katexOptions:{throwOnError:false}}),dr=CharacterCount.configure(),Tt=[sr,er,tr,rr,or,ir,ar,Zn,lr,cr,fr,ur,dr,TiptapUnderline,nr,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle];var ve;function hr(){let e=getSchema(Tt);return {schema:e,textSerializers:getTextSerializersFromSchema(e)}}function yt(e,t=100){if(!e)return "";try{let n=JSON.parse(e);return ve??=hr(),getText(Node.fromJSON(ve.schema,n),{textSerializers:ve.textSerializers}).substring(0,t)}catch{return e.substring(0,t)}}function St({value:e}){let t=useMemo(()=>yt(e),[e]);return jsx(w,{value:t})}var wt=250,xr=25e5,v=new Map,Ce=new Map,Ae=new Set,xt=new Map;function ce(e){if(xt.has(e))return;let t=new Image;t.decoding="async",t.src=e,xt.set(e,t);}function fe(e){let t=v.get(e);t&&v.set(e,{...t,lastUsedAt:Date.now()});}function vr(){if(v.size<=wt)return;let e=Array.from(v.entries()).sort((n,r)=>n[1].lastUsedAt-r[1].lastUsedAt),t=Math.max(1,Math.ceil(wt*.1));for(let n=0;n<t&&n<e.length;n+=1){let[r,o]=e[n];v.delete(r),URL.revokeObjectURL(o.objectUrl);}}async function Cr(e){if(Ae.has(e)){ce(e);return}if(v.has(e)){fe(e);return}let t=Ce.get(e);if(t){await t;return}let n=(async()=>{try{let r=await fetch(e,{mode:"cors",cache:"force-cache"});if(!r.ok){ce(e);return}let o=await r.blob();if(o.size>xr)return;let l=URL.createObjectURL(o);v.set(e,{objectUrl:l,byteSize:o.size,lastUsedAt:Date.now()}),vr();}catch(r){r instanceof TypeError&&Ae.add(e),ce(e);}})();Ce.set(e,n),await n,Ce.delete(e);}function vt(e){let t=useMemo(()=>{if(!e)return null;let o=v.get(e);return o?(fe(e),o.objectUrl):null},[e]),[n,r]=useState(t);return useEffect(()=>{if(!e){r(null);return}if(Ae.has(e)){ce(e),r(null);return}let o=v.get(e);if(o){fe(e),r(o.objectUrl);return}r(null);let l=false;return Cr(e).then(()=>{let s=v.get(e);s&&(l||(fe(e),r(s.objectUrl)));}),()=>{l=true;}},[e]),n}var De="fk:bg-[#fafafa] [--asset-checker:#f0f0f0] [background-image:linear-gradient(45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(-45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(45deg,transparent_75%,var(--asset-checker)_75%),linear-gradient(-45deg,transparent_75%,var(--asset-checker)_75%)] [background-position:0_0,0_4px,4px_-4px,-4px_0px] [background-size:8px_8px] fk:dark:bg-[#222] dark:[--asset-checker:#2a2a2a]";function Ct({value:e}){return Array.isArray(e)?jsx(Mr,{value:e}):jsx(Er,{value:e})}function Er({value:e}){let t=e?.path??"",n=!!t,r=n&&/\.(png|jpe?g|gif|webp|avif|svg)$/i.test(t),o=u=>{let[k]=u.split("?"),S=k.split(".");return S.length>1?S.pop().toLowerCase():"file"},l=n?t.endsWith(".svg")?`${b$5}${t}`:`${b$5}${t}?w=84&h=84&f=webp`:null,s=n?t.endsWith(".svg")?`${b$5}${t}`:`${b$5}${t}?w=624&h=624&f=webp`:"",b=vt(l);return n?jsx("div",{className:"fk:z-10",children:r?jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("img",{alt:"asset",className:`fk:w-7 fk:h-7 fk:cursor-zoom-in fk:overflow-hidden fk:rounded-md fk:object-contain ${De} fk:corner-squircle`,decoding:"async",src:b??void 0})}),jsx(d,{children:jsx(e$3,{children:jsx("img",{alt:"asset",className:`fk:w-52 fk:h-52 fk:overflow-hidden fk:rounded-md fk:object-contain ${De} fk:corner-squircle`,decoding:"async",src:s})})})]}):jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("div",{className:"fk:w-7 fk:h-7 fk:rounded-sm fk:bg-transparent fk:flex fk:items-center fk:justify-center fk:[&>svg]:h-full fk:[&>svg]:w-auto fk:corner-squircle",children:(()=>{let u=o(t),k=defaultStyles[u];return jsx(FileIcon,{extension:u,...k||{}})})()})}),jsx(d,{children:jsx(e$3,{children:jsx("div",{className:"fk:text-sm fk:text-muted-foreground",children:"Preview not available"})})})]})}):null}function Mr({value:e}){let t=e.filter(o=>!!o.path).slice(0,3),n=Math.max(e[0]?.totalCount??0,e.length);if(t.length===0)return n>0?jsx("div",{className:"fk:flex fk:items-center",children:jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:n===1?"1 asset":`${n} assets`})}):null;let r=n-t.length;return jsxs("div",{className:"fk:flex fk:items-center",children:[jsx("div",{className:"fk:flex fk:-space-x-2",children:t.map(o=>jsx("img",{alt:"asset",className:`fk:h-7 fk:w-7 fk:overflow-hidden fk:rounded-md fk:object-contain ${De} fk:corner-squircle`,decoding:"async",src:`${b$5}${o.path}?w=84&h=84&f=webp`},o._id))}),r>0?jsxs("span",{className:"fk:ml-2 fk:text-xs fk:text-muted-foreground",children:["+",r]}):null]})}function Me({value:e}){if(e==null||e===""||typeof e!="string")return jsx(w,{value:""});let t=new Date(e);if(!isValid(t))return jsx(w,{value:""});let n=format(t,"MMM d, yyyy")+" at "+format(t,"HH:mm");return jsx(w,{value:n})}function Rr(e){return "groupLabel"in e}function Pr(e){return e.flatMap(t=>Rr(t)?t.items:[t])}function Lr(e,t){if(!t)return e;let n=Pr(t).find(r=>String(r.value)===e);return n?n.label:e}function Et({value:e,options:t}){if(e==null)return jsx(w,{value:""});let n=String(e),r=Lr(n,t?.list);return jsx(w,{value:r})}function Nt({value:e}){return !e||!e.split(",").length?null:jsx("div",{className:"fk:flex fk:flex-wrap fk:gap-1 fk:max-w-full truncate",children:e.split(",").map(t=>jsx(b$4,{className:"fk:px-2.5 fk:py-0 fk:font-normal fk:text-[0.6875rem] fk:leading-4",variant:"secondary",children:t},t))})}function Rt(e,t=5){let n=Number.isFinite(t)&&t>=1?Math.floor(t):5,r=typeof e=="string"&&e.trim()!==""?Number(e):e;if(typeof r!="number"||!Number.isFinite(r))return null;let o=Math.min(n,Math.max(0,Math.round(r)));return {filled:o,max:n,label:`${String(o)} out of ${String(n)} stars`}}function Pt({value:e,options:t}){let n=Rt(e,t?.max);return n?jsx("span",{"aria-label":n.label,className:"fk:inline-flex fk:items-center fk:gap-0.5",role:"img",title:n.label,children:Array.from({length:n.max},(r,o)=>jsx(Star,{"aria-hidden":true,className:o<n.filled?"fk:h-3.5 fk:w-3.5 fk:fill-amber-400 fk:text-amber-400":"fk:h-3.5 fk:w-3.5 fk:fill-transparent fk:text-muted-foreground/40",strokeWidth:1.5},o))}):jsx("span",{})}var _r=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function Lt(e){try{let{pathname:t}=new URL(e);return t.split("/").pop()||t}catch{let[t]=e.split("?");return t}}function It(e){return e.originalFilename?e.originalFilename:e.path?e.path:e.url?Lt(e.url):""}function _t(e){let t=It(e),[n]=t.split("?"),r=n.split(".");return r.length>1?r.pop().toLowerCase():"file"}function Vt(e){return e.mimeType?e.mimeType.startsWith("image/"):_r.test(It(e))}function Re(e,t){if(!e||!t||Lt(e).toLowerCase().endsWith(".svg"))return e;let n=new URLSearchParams({f:"webp",h:String(t.height),w:String(t.width)}),r=e.includes("?")?"&":"?";return `${e}${r}${n.toString()}`}var Or=FileIcon,Ft="fk:bg-[#fafafa] [--asset-checker:#f0f0f0] [background-image:linear-gradient(45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(-45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(45deg,transparent_75%,var(--asset-checker)_75%),linear-gradient(-45deg,transparent_75%,var(--asset-checker)_75%)] [background-position:0_0,0_4px,4px_-4px,-4px_0px] [background-size:8px_8px] fk:dark:bg-[#222] dark:[--asset-checker:#2a2a2a]";function Ht({value:e}){let[t$1,n]=useState(false),r=e?.url??"";if(!e||!r&&!e.path&&!e.originalFilename)return null;if(!(Vt(e)&&!!r)){let u=_t(e),k=defaultStyles[u];return jsx("div",{className:"fk:z-10",children:jsx(a,{children:jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("div",{className:"fk:w-7 fk:h-7 fk:rounded-sm fk:bg-transparent fk:flex fk:items-center fk:justify-center fk:[&>svg]:h-full fk:[&>svg]:w-auto fk:corner-squircle",children:jsx(Or,{extension:u,...k||{}})})}),jsx(d,{children:jsx(e$3,{children:jsx("div",{className:"fk:text-sm fk:text-muted-foreground",children:"Preview not available"})})})]})})})}let l=Re(r,{width:84,height:84}),s$1=Re(r,{width:624,height:624});function b(u){u.stopPropagation(),n(true);}return jsx("div",{className:"fk:z-10",children:jsxs(a,{children:[jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("img",{src:l,alt:"asset",className:`fk:w-12 fk:h-12 fk:cursor-zoom-in fk:overflow-hidden fk:rounded-md fk:object-contain ${Ft} fk:corner-squircle`,onClick:b})}),jsx(d,{children:jsx(e$3,{children:jsx("img",{src:s$1,alt:"asset",className:`fk:w-52 fk:h-52 fk:overflow-hidden fk:rounded-md fk:object-contain ${Ft} fk:corner-squircle`})})})]}),jsx(k,{open:t$1,onOpenChange:n,children:jsxs(p,{className:"fk:sm:max-w-4xl fk:p-3",children:[jsxs(q,{children:[jsx(s,{className:"fk:sr-only",children:"Asset preview"}),jsx(t,{className:"fk:sr-only",children:"Enlarged asset preview"})]}),jsx("img",{src:r,alt:"asset",className:"fk:max-h-[85vh] fk:w-full fk:overflow-hidden fk:rounded-md fk:object-contain fk:corner-squircle"})]})})]})})}var Ur=new Set(["text","number","datetime","switch","select"]);function Xi({attributesSchema:e,checkboxSelect:t,actionsComponent:n$1,enableColumnSorting:r=false}){let[,o]=g$2(),l=b$2(e,o.user?.spaces),s={datetime:"datetime",editor:"editor",asset:"asset",number:"text",relationship:"text",select:"select",switch:"boolean",text:"text",textarea:"text"},b={boolean:xe,date:B,datetime:Me,editor:St,asset:Ct,number:B,relationship:B,select:Et,switch:xe,text:B,textarea:B,tags:Nt,rating:Pt,assetPreviewField:Ht},u=l.map(i=>{if(i.name==="_updatedAt")return null;let T=(i.inputType==="relationship"&&i.relationship?.entity==="_asset"?"asset":void 0)??i.previewType??s[i.inputType],X=b[T]??b.text;if(i.hidden===true)return null;let de=T==="tags",j=r&&i.scope==="global"&&Ur.has(i.inputType);return {accessorKey:i.name,filterFn:(y,N,C)=>de?true:(Array.isArray(C)?C:[C]).includes(y.getValue(N)),header:({column:y})=>j?jsx(Se,{column:y,title:i.label}):jsx("div",{className:"fk:flex fk:items-center",children:i.label}),cell:({row:y})=>{let N=X;return T==="select"||T==="rating"?jsx(N,{value:y.getValue(i.name),options:i.options}):T==="assetPreviewField"?jsx(N,{value:y.original}):jsx(N,{value:y.getValue(i.name)})},enableSorting:j,enableHiding:true,meta:{label:i.label},size:i.options?.size??150}}).filter(i=>i!==null),k={id:"actions",cell:({row:i})=>n$1?n$1(i):null,size:80},S={accessorKey:"_updatedAt",header:({column:i})=>r?jsx(Se,{column:i,title:"Updated At"}):jsx("div",{className:"fk:flex fk:items-center",children:"Updated At"}),cell:({row:i})=>jsx(Me,{value:i.getValue("_updatedAt")}),enableSorting:r,enableHiding:false,meta:{label:"Updated At"},size:220},M={id:"select",cell:({row:i,table:T})=>jsx(n,{"aria-label":"Select row",checked:i.getIsSelected(),onCheckedChange:X=>{T.toggleAllPageRowsSelected(false),i.toggleSelected(!!X);}}),enableSorting:false,enableHiding:false,size:50},g={id:"select",header:({table:i})=>jsx(n,{className:"fk:dark:bg-white/15","aria-label":"Select all",checked:i.getIsAllPageRowsSelected()||i.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:T=>{i.toggleAllPageRowsSelected(!!T);}}),cell:({row:i})=>jsx(n,{"aria-label":"Select row",checked:i.getIsSelected(),onCheckedChange:T=>{i.toggleSelected(!!T);}}),enableSorting:false,enableHiding:false,size:50};return [...t==="single"?[M]:[],...t==="multiple"?[g]:[],...n$1?[k]:[],...u,S]}export{Xr as a,Kr as b,lt as c,lo as d,po as e,So as f,Tt as g,It as h,_t as i,Vt as j,Re as k,Se as l,Xi as m};//# sourceMappingURL=chunk-RBGXXVF4.js.map
|
|
7
|
+
//# sourceMappingURL=chunk-RBGXXVF4.js.map
|