@protobase/ui 0.62.3 → 0.62.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/dist/package.js +1 -1
- package/dist/shell/assets/{app-C5MP7OgJ.js → app-B_ojAtG3.js} +4 -4
- package/dist/shell/assets/calls-C63xSTRj.js +2 -0
- package/dist/shell/assets/{index-C-RfkRTE.js → index-D8oHLXjS.js} +2 -2
- package/dist/shell/assets/{records-map-C5LoYF8K.js → records-map-DOXcutuQ.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-DC02tB2e.js → shared-protobase-ui-CX80Ectk.js} +2 -2
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/{app-C5MP7OgJ.js.map → app-B_ojAtG3.js.map} +1 -1
- package/dist/shell-source-maps/assets/calls-C63xSTRj.js.map +1 -0
- package/dist/shell-source-maps/assets/{index-C-RfkRTE.js.map → index-D8oHLXjS.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-C5LoYF8K.js.map → records-map-DOXcutuQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{shared-protobase-ui-DC02tB2e.js.map → shared-protobase-ui-CX80Ectk.js.map} +1 -1
- package/package.json +4 -4
- package/dist/shell/assets/calls-DwVdIhNM.js +0 -2
- package/dist/shell-source-maps/assets/calls-DwVdIhNM.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=class extends Error{constructor(e){super(e),this.name=`PublishRefused`}},t=e=>new RTCPeerConnection(e),n=e=>{let t=[...e],n=t.find(e=>e.type===`transport`&&typeof e.selectedCandidatePairId==`string`),r=t.find(e=>e.type===`candidate-pair`&&(e.id===n?.selectedCandidatePairId||!n&&e.selected===!0||!n&&e.nominated===!0&&e.state===`succeeded`)),i=0,a=0;for(let e of t)e.type===`inbound-rtp`&&(i+=Math.max(0,Number(e.packetsLost??0)),a+=Number(e.packetsReceived??0));let o=typeof r?.currentRoundTripTime==`number`?r.currentRoundTripTime*1e3:void 0;return{...o!==void 0&&{roundTripMs:o},...i+a>0&&{lostRatio:i/(i+a)}}},r=async(e,t)=>{let r=e.connectionState,i=r===`connected`?n((await e.getStats()).values()):{};return{...t!==void 0&&{member:t},state:r,...i}},i=e=>{let t=new Map;for(let n of e.split(/\r?\nm=/).slice(1)){let e=/^a=mid:(\S+)/m.exec(n)?.[1],r=/^a=msid:(\S+) \S+/m.exec(n)?.[1];e!==void 0&&r!==void 0&&r!==`-`&&t.set(r,e)}return t},a=e=>/^o=mozilla/m.test(e),o=typeof navigator<`u`&&/Firefox\//.test(navigator.userAgent),s=(e,t)=>o===a(t)?e.polite:o,c=(n,{iceServers:a,send:o,onTracks:c,createPeerConnection:l=t})=>{let u=new Map,d=new Map,f=[],p,m=Promise.resolve(),h=(e,{track:t,stream:n})=>e.addTransceiver(t,{direction:`sendonly`,streams:[n]}).sender,g=({member:e,sid:t})=>{let n=u.get(e)?.pc,r=n?.remoteDescription&&i(n.remoteDescription.sdp).get(t);return r===void 0?void 0:n.getTransceivers().find(e=>e.mid===r)?.receiver.track},_=()=>c(f.map(e=>({...e,...g(e)&&{track:g(e)}}))),v=(e,t)=>{let n=l({iceServers:a});t.pc=n,t.senders=new Map,n.onnegotiationneeded=async()=>{let r=n.setLocalDescription();t.makingOffer=r;try{await r,t.pc===n&&o({type:`signal`,to:e,description:n.localDescription.toJSON()})}finally{t.makingOffer===r&&(t.makingOffer=void 0)}},n.onicecandidate=r=>{r.candidate&&t.pc===n&&o({type:`signal`,to:e,candidate:r.candidate.toJSON()})},n.oniceconnectionstatechange=()=>{n.iceConnectionState===`failed`&&n.restartIce()},n.ontrack=()=>_();for(let[e,r]of d)t.senders.set(e,h(n,r))},y=e=>{let t={polite:n<e,ignoreOffer:!1};return u.set(e,t),v(e,t),t},b=async(e,t)=>{await t.makingOffer,t.pc.close(),v(e,t)},x=e=>{u.get(e)?.pc.close(),u.delete(e)},S=async(e,t,n)=>{let r=u.get(e)??y(e);if(t){let n=t.type===`offer`&&(r.makingOffer!==void 0||r.pc.signalingState!==`stable`);if(r.ignoreOffer=!s(r,t.sdp)&&n,r.ignoreOffer)return;n&&!r.pc.currentRemoteDescription&&await b(e,r)}let{pc:i}=r;t&&(await i.setRemoteDescription(t),t.type===`offer`&&(await i.setLocalDescription(),o({type:`signal`,to:e,description:i.localDescription.toJSON()})),_()),n&&await i.addIceCandidate(n).catch(e=>{if(!r.ignoreOffer)throw e})},C=async t=>{switch(t.type){case`peers`:{let e=new Set(t.members);for(let t of u.keys())e.has(t)||x(t);for(let t of e)u.has(t)||y(t);return}case`signal`:return S(t.from,t.description,t.candidate);case`tracks`:f=t.tracks,_();return;case`published`:p?.resolve();return;case`publish-refused`:p?.reject(new e(t.reason));return}},w=async e=>{let t=Object.entries(e);for(let[e]of t)if(d.has(e))throw Error(`The call already sends a ${e} track: unpublish it first`);if(t.length===0)return;let n=t.map(([e,t])=>{let n=new MediaStream([t]);return[e,{track:t,sid:n.id,stream:n}]}),r=new Promise((e,t)=>p={resolve:e,reject:t});o({type:`publish`,tracks:n.map(([e,{track:t,sid:n}])=>({cid:n,kind:t.kind,source:e}))});try{await r}finally{p=void 0}for(let[e,t]of n){d.set(e,t);for(let n of u.values())n.senders.set(e,h(n.pc,t))}};return{receive:C,publish:e=>{let t=m.then(()=>w(e));return m=t.catch(()=>{}),t},unpublish:async e=>{let t=d.get(e);if(t){d.delete(e);for(let t of u.values()){let n=t.senders.get(e);n&&t.pc.signalingState!==`closed`&&t.pc.removeTrack(n),t.senders.delete(e)}o({type:`unpublish`,sid:t.sid})}},mute:(e,t)=>{let n=d.get(e);n&&(n.track.enabled=!t,o({type:`mute`,sid:n.sid,muted:t}))},restartIce:async()=>{for(let e of u.values())e.pc.restartIce()},resumeState:async e=>({participant:e,tracks:[...d].map(([e,{track:t,sid:n}])=>({cid:n,sid:n,kind:t.kind,source:e}))}),resumed:async()=>{},sending:()=>new Map([...d].map(([e,{track:t}])=>[e,{track:t,simulcast:!1}])),connections:()=>Promise.all([...u].map(([e,t])=>r(t.pc,e))),close:()=>{p?.reject(Error(`The call ended`));for(let e of[...u.keys()])x(e)}}},l=e=>{let t=!1,n=!1,r=[],i=async()=>{t=!0,n=!1,await e()},a=()=>{for(let e of r.splice(0))e()};return{request:async()=>{if(t){n=!0;return}await i()},answered:async()=>{if(t=!1,n)return i();a()},abandon:()=>{t&&(n=!0),t=!1},get pending(){return n},settled:()=>t||n?new Promise(e=>r.push(e)):Promise.resolve(),reset:()=>{t=!1,n=!1,a()}}},u=[{rid:`q`,quality:`low`,scale:4,maxBitrate:15e4},{rid:`h`,quality:`medium`,scale:2,maxBitrate:5e5},{rid:`f`,quality:`high`,scale:1,maxBitrate:12e5}],d=12e5,f=(e,t,n)=>{if(t.kind===`audio`)return{cid:t.id,kind:`audio`,source:e};let{width:r=0,height:i=0}=t.getSettings(),a=n?u.map(e=>({quality:e.quality,width:Math.round(r/e.scale),height:Math.round(i/e.scale),bitrate:e.maxBitrate})):[];return{cid:t.id,kind:`video`,source:e,width:r,height:i,...n&&{layers:a}}},p=(e,t)=>{if(e.kind!==`audio`)return t?u.map(e=>({rid:e.rid,scaleResolutionDownBy:e.scale,maxBitrate:e.maxBitrate})):[{maxBitrate:d}]},m=({iceServers:n,send:i,onTracks:a,onUnpublished:o,createPeerConnection:s=t})=>{let c=s({iceServers:n,bundlePolicy:`max-bundle`}),u=new Map,d=[],m={},h=[],g=0,_,v=Promise.resolve(),y=l(async()=>{let e=await c.createOffer();await c.setLocalDescription(e),i({type:`offer`,sdp:e.sdp,id:++g})}),b=async()=>{c.getTransceivers().length>0&&await y.request()},x=async()=>{await b(),await y.settled()},S=e=>{let t=Object.keys(m).find(t=>m[t]===e);return t===void 0?void 0:c.getTransceivers().find(e=>e.mid===t)?.receiver.track},C=()=>a(h.map(e=>({...e,...S(e.sid)&&{track:S(e.sid)}})));c.onicecandidate=e=>{e.candidate&&i({type:`candidate`,candidate:e.candidate.toJSON()})},c.oniceconnectionstatechange=()=>{c.iceConnectionState===`failed`&&w()},c.ontrack=()=>C();let w=async()=>{c.restartIce(),await x()},T=e=>{let t=u.get(e);return t?(u.delete(e),c.signalingState!==`closed`&&c.removeTrack(t.transceiver.sender),!0):!1},E=async t=>{switch(t.type){case`answer`:if(t.id!==g)return;m={...m,...t.mids},await c.setRemoteDescription({type:`answer`,sdp:t.sdp});for(let e of d.splice(0))await c.addIceCandidate(e);C(),await y.answered();return;case`candidate`:c.remoteDescription?await c.addIceCandidate(t.candidate):d.push(t.candidate);return;case`sections`:for(let e=0;e<t.audio;e++)c.addTransceiver(`audio`,{direction:`recvonly`});for(let e=0;e<t.video;e++)c.addTransceiver(`video`,{direction:`recvonly`});await b();return;case`tracks`:h=t.tracks,C();return;case`unpublished`:{let e=[...u.values()].find(e=>e.sid===t.sid);if(!e)return;T(e.source),await b(),o(e.source);return}case`published`:_?.resolve(t.tracks);return;case`publish-refused`:_?.reject(new e(t.reason));return}},D=async(e,t)=>{let n=Object.entries(e).map(([e,n])=>{if(u.has(e))throw Error(`The call already sends a ${e} track: unpublish it first`);let r=n.kind===`video`&&!!t.simulcast,i=p(n,r);return{source:e,track:n,transceiver:c.addTransceiver(n,{direction:`sendonly`,...i&&{sendEncodings:i}}),simulcast:r}});if(n.length===0)return;let r=new Promise((e,t)=>_={resolve:e,reject:t});i({type:`publish`,tracks:n.map(e=>f(e.source,e.track,e.simulcast))});try{let e=await r;for(let t of n)u.set(t.source,{...t,sid:e.find(e=>e.cid===t.track.id).sid})}catch(e){for(let e of n)e.transceiver.stop();throw e}finally{_=void 0}await x()};return{receive:E,publish:(e,t={})=>{let n=v.then(()=>D(e,t));return v=n.catch(()=>{}),n},unpublish:async e=>{T(e)&&await x()},mute:(e,t)=>{let n=u.get(e);n?.sid&&(n.track.enabled=!t,i({type:`mute`,sid:n.sid,muted:t}))},restartIce:w,resumeState:async e=>{if(c.signalingState===`have-local-offer`&&(await c.setLocalDescription({type:`rollback`}),y.abandon()),!c.localDescription||!c.remoteDescription)return;let t=[...u.values()].flatMap(e=>e.sid?[{cid:e.track.id,sid:e.sid,kind:e.track.kind,source:e.source}]:[]);return{participant:e,offer:c.localDescription.sdp,answer:c.remoteDescription.sdp,tracks:t}},resumed:async()=>{y.pending&&await b()},sending:()=>new Map([...u.values()].map(e=>[e.source,{track:e.track,simulcast:e.simulcast}])),connections:async()=>[await r(c)],close:()=>{_?.reject(Error(`The call ended`)),y.reset(),c.close()}}},h=e=>Math.min(1e4,500*2**e),g=e=>{let t=new URL(e,globalThis.location?.href);return t.protocol=t.protocol.replace(/^http/,`ws`),t.href},_={1e3:`ended`,1008:`removed`},v=new Set([1011,1013]),y=e=>{let t=e.WebSocket??WebSocket,n=e.retryDelayMs??h,r=e.maxRetries??8,i=g(e.url),a,o,s=``,l=``,u=[],d=[],f=!1,p=!1,y=!1,b=!1,x=0,S=Promise.resolve(),C,w=new Promise((e,t)=>C={resolve:e,reject:t}),T=e=>{a.readyState===t.OPEN&&a.send(JSON.stringify(e))},E=t=>e.onState?.(t),D=(e,n)=>{f||(f=!0,o?.close(),o=void 0,(a.readyState===t.OPEN||a.readyState===t.CONNECTING)&&a.close(1e3),C.reject(n??Error(`The call was left: ${e}`)),E({state:`left`,reason:e,...n!==void 0&&{error:n}}))},O=t=>{let n={iceServers:t.iceServers,send:T,onTracks:t=>{d=t,e.onTracks?.(t)},onUnpublished:t=>e.onUnpublished?.(t),...e.createPeerConnection&&{createPeerConnection:e.createPeerConnection}};return t.mode===`peer`?c(t.participant,n):m(n)},k=async t=>{switch(t.type){case`joined`:{let e=o?.sending();o?.close(),s=t.participant,l=t.call,o=O(t),x=0,E({state:`joined`}),C.resolve(M);for(let[t,{track:n,simulcast:r}]of e??[])M.publish({[t]:n},{simulcast:r}).catch(e=>D(`ended`,e));return}case`resumed`:b=!0,x=0,E({state:`joined`}),await o?.resumed();return;case`speakers`:e.onSpeakers?.(t.speakers);return;case`members`:u=t.members,e.onMembers?.(u);return;case`left`:t.reason===`rejoin`?p=!0:D(t.reason);return;default:await o?.receive(t)}},A=e=>{y=!1,b=!1,a=new t(i),a.onopen=()=>{y=!0,S=S.then(async()=>{let t=e===`resume`&&o?await o.resumeState(s):void 0;T(t?{type:`resume`,call:l,...t}:{type:`join`})})},a.onmessage=e=>{let t=JSON.parse(String(e.data));S=S.then(()=>k(t)).catch(e=>D(`ended`,e))},a.onclose=t=>{S=S.then(()=>j(e,t.code))}},j=(e,t)=>{if(f)return;if(p)return p=!1,A(`join`);let i=_[t];if(i)return D(i);if(!s&&!v.has(t))return D(`refused`);if(x++,x>r)return D(s?`ended`:`unavailable`);E(s?{state:`resuming`}:{state:`connecting`});let a=e===`resume`&&y&&!b?`join`:`resume`;setTimeout(()=>{f||A(a)},n(x-1))},M={get id(){return l},get participant(){return s},members:()=>u,publish:async(e,t)=>{if(!o)throw Error(`The call was left`);await o.publish(e,t)},unpublish:async e=>{await o?.unpublish(e)},mute:(e,t)=>o?.mute(e,t),view:(e,t)=>T(t===`hidden`?{type:`view`,sids:e,width:0,height:0,hidden:!0}:{type:`view`,sids:e,...t}),restartIce:async()=>{await o?.restartIce()},leave:()=>{f||(T({type:`leave`}),D(`ended`))},tracks:()=>d,connections:async()=>o?o.connections():[]};return E({state:`connecting`}),A(`join`),w};export{e as PublishRefused,y as joinCall};
|
|
2
|
+
//# debugId=badf1493-463e-4f1a-a00b-4805ee79ae57
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n,n as r,t as i}from"./react-CR5VJ85Q.js";import{R as a,Yt as o,t as s}from"./app-
|
|
2
|
-
//# debugId=
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n,n as r,t as i}from"./react-CR5VJ85Q.js";import{R as a,Yt as o,t as s}from"./app-B_ojAtG3.js";import{c}from"./preload-helper-SYSsmQ2O.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=t(n(),1),u=r(),d=e({default:()=>f}),f={},p=`protobase-api-origin`,m=async e=>{e.getPlatform()===`ios`&&e.isPluginAvailable(`Keyboard`)&&await e.nativePromise(`Keyboard`,`setAccessoryBarVisible`,{isVisible:!0})},h=e=>[...e.split(`,`).map(e=>e.trim()).filter(e=>e&&!/^maximum-scale\s*=/.test(e)),`maximum-scale=1`].join(`, `),g=e=>{let t=e.querySelector(`meta[name="viewport"]`);t&&t.setAttribute(`content`,h(t.getAttribute(`content`)??``))},_=e=>{if(e.length===0)return;if(e.length>1)throw Error(`The page has ${e.length} ${p} meta tags; it may have one`);let t=e[0],n=URL.canParse(t)?new URL(t):void 0;if(!n||n.protocol!==`http:`&&n.protocol!==`https:`||n.origin!==t)throw Error(`The page's ${p} meta tag holds "${t}", which is not an http or https origin such as https://shop.example.com`);return t},v=()=>_([...document.querySelectorAll(`meta[name="${p}"]`)].map(e=>e.content)),y=t(i(),1),b=document.getElementById(`root`);if(!b)throw Error(`index.html needs an element with id "root"`);var x=o(window);x&&(g(document),m(x)),(0,u.createRoot)(b).render((0,y.jsx)(l.StrictMode,{children:(0,y.jsx)(s,{baseUrl:`${v()??``}/api/v1`,ui:a(d),locale:c(),nativeBridge:x})}));
|
|
2
|
+
//# debugId=fca072d7-8d2d-4053-964b-21232cbc9045
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{It as r,q as i}from"./app-
|
|
2
|
-
//# debugId=
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{It as r,q as i}from"./app-B_ojAtG3.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./maplibre-CjNYwEqW.js";import{t as p}from"./cn-Bi0ZEjD9.js";var m=e(t(),1),h=512,g=85.051129,_=16,v=Array.from({length:23},(e,t)=>t),y=e=>e.type===`LineString`?e.coordinates:e.type===`MultiPolygon`?e.coordinates.flat(2):e.coordinates.flat(),b=e=>{let t=Math.max(-85.051129,Math.min(g,e))*Math.PI/180;return .5-Math.log(Math.tan(Math.PI/4+t/2))/(2*Math.PI)},x=e=>{let t=y(e),n=t.map(([e])=>e),r=t.map(([,e])=>b(e)),i=(Math.max(...n)-Math.min(...n))/360*h,a=(Math.max(...r)-Math.min(...r))*h;return Math.max(i,a)},S=(e,t)=>{let n=e.flatMap(e=>{if(!e.area)return[];let n=e.area.type===`LineString`||e.area.type===`MultiLineString`?`line`:`polygon`;return[{type:`Feature`,geometry:e.area,properties:{key:e.key,kind:n,span:x(e.area),chosen:t?.includes(e.key)??!1}}]});return{type:`FeatureCollection`,features:[...n.filter(e=>!e.properties.chosen),...n.filter(e=>e.properties.chosen)]}},C=e=>[`interpolate`,[`linear`],[`zoom`],...v.flatMap(t=>[t,[`*`,e,[`min`,1,[`max`,0,[`/`,[`-`,[`*`,[`get`,`span`],2**t],_],32]]]]])],w=e(n(),1),T=`position-area-fills`,E=[`==`,[`get`,`kind`],`polygon`],D=[`==`,[`get`,`kind`],`line`],O=(e,t)=>[`case`,[`get`,`chosen`],e,t],k=({points:e,selected:t,colors:n})=>{let r=S(e,t);if(r.features.length===0)return null;let i=[`case`,[`get`,`chosen`],n.chosen,n.area];return(0,w.jsxs)(s,{id:`position-areas`,type:`geojson`,data:r,children:[(0,w.jsx)(u,{id:T,type:`fill`,filter:E,paint:{"fill-color":i,"fill-opacity":C(O(.15,.1))}}),(0,w.jsx)(u,{id:`position-area-outlines`,type:`line`,filter:E,paint:{"line-color":i,"line-width":1.5,"line-dasharray":[3,2],"line-opacity":C(.8)}}),(0,w.jsx)(u,{id:`position-area-lines`,type:`line`,filter:D,layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-color":i,"line-width":6,"line-opacity":C(O(.6,.35))}})]})},A=(e,t)=>{let n=document.createElement(`span`);n.style.color=`var(${t})`,e.append(n);let r=getComputedStyle(n).color;n.remove();let i=document.createElement(`canvas`);i.width=1,i.height=1;let a=i.getContext(`2d`,{willReadFrequently:!0});if(!a)return r;a.fillStyle=r,a.fillRect(0,0,1,1);let[o,s,c,l]=a.getImageData(0,0,1,1).data;return`rgba(${o}, ${s}, ${c}, ${l/255})`},j=28,M={padding:48,maxZoom:15,duration:0},N={padding:48,maxZoom:16,duration:300},P=32,F=()=>r(`compact`,e=>new Intl.NumberFormat(e,{notation:`compact`,maximumFractionDigits:1})),I=e=>[[e.west,e.south],[e.east,e.north]],L=({style:e,layers:t,initial:n,points:r,buckets:s,fit:u,onFitted:h,onMove:g,selected:_,covered:v,onSelect:y,onClear:b,markerLabel:x,bucketLabel:S})=>{let C=(0,m.useRef)(null),[E,D]=(0,m.useState)([]),[O,L]=(0,m.useState)(),R=new globalThis.Map(r.map(e=>[e.key,e])),z=r.map(e=>e.key).join(`,`),B=u&&JSON.stringify(u),V=()=>{let e=C.current?.getMap();e&&D(i(r.map(t=>({key:t.key,...e.project([t.longitude,t.latitude])})),j))},H=()=>{let e=C.current?.getMap();if(!e)return;let t=e.getBounds(),n=e.getCenter();g({bounds:{south:t.getSouth(),west:t.getWest(),north:t.getNorth(),east:t.getEast()},zoom:e.getZoom()},{latitude:n.lat,longitude:n.lng,zoom:e.getZoom()})},U=()=>{let e=C.current?.getMap();e&&u&&(e.fitBounds(I(u),M),h(),H())};(0,m.useEffect)(V,[z]),(0,m.useEffect)(U,[B]);let W=E.find(e=>_!==void 0&&e.keys.some(e=>_.includes(e)))?.at;return(0,m.useEffect)(()=>{let e=C.current?.getMap(),t=W===void 0?void 0:R.get(W);if(!e||!t||v===0)return;let{y:n}=e.project([t.longitude,t.latitude]),r=e.getContainer().clientHeight-v;n>P&&n<r||e.easeTo({center:[t.longitude,t.latitude],offset:[0,(P-v)/2],duration:300})},[W,v]),(0,w.jsxs)(d,{ref:C,mapLib:f,mapStyle:e,initialViewState:n??{latitude:0,longitude:0,zoom:1},style:{width:`100%`,height:`100%`},onLoad:()=>{let e=C.current.getMap().getContainer();L({area:A(e,`--primary`),chosen:A(e,`--foreground`)}),V(),u?U():H()},onZoomEnd:V,onMoveEnd:H,onClick:b,children:[(0,w.jsx)(a,{showCompass:!1}),(0,w.jsx)(c,{layers:t,below:T}),O&&(0,w.jsx)(k,{points:r,selected:_,colors:O}),s.map(e=>(0,w.jsx)(l,{latitude:e.latitude,longitude:e.longitude,anchor:`center`,children:(0,w.jsx)(`button`,{type:`button`,"aria-label":S(e.count),className:`flex size-10 cursor-pointer items-center justify-center rounded-full border-2 border-background bg-primary text-xs font-semibold text-primary-foreground tabular-nums shadow`,onClick:t=>{t.stopPropagation(),C.current?.getMap().fitBounds(I(e.bounds),N)},children:F().format(e.count)})},`${e.latitude},${e.longitude}`)),E.map(e=>{let t=R.get(e.at);if(!t)return null;let n=_!==void 0&&e.keys.some(e=>_.includes(e)),r=e.keys.every(e=>R.get(e)?.approximate);return(0,w.jsx)(l,{latitude:t.latitude,longitude:t.longitude,anchor:`bottom`,style:{zIndex:+!!n},children:(0,w.jsxs)(`button`,{type:`button`,"aria-label":x(e.keys),"aria-pressed":n,className:`relative block cursor-pointer`,onClick:t=>{t.stopPropagation(),y(e.keys)},children:[(0,w.jsx)(o,{"aria-hidden":!0,"data-approximate":r||void 0,className:p(`size-8 drop-shadow`,r?n?`fill-background text-foreground`:`fill-background text-primary`:n?`fill-foreground text-background`:`fill-primary text-primary-foreground`),strokeWidth:r?2:1.5,strokeDasharray:r?`3 2`:void 0}),e.keys.length>1&&(0,w.jsx)(`span`,{className:`absolute -right-2 -top-1 min-w-5 rounded-full border border-background bg-foreground px-1 text-center text-[11px] font-medium leading-4 text-background tabular-nums`,children:e.keys.length})]})},e.at)})]})};export{L as RecordsMap};
|
|
2
|
+
//# debugId=ce5dcbad-b90d-4e79-ac65-8118db586b9c
|
package/dist/shell/assets/{shared-protobase-ui-DC02tB2e.js → shared-protobase-ui-CX80Ectk.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{G as r,V as i,q as a}from"./vendor-xNCj9Gc_.js";import{$ as o,A as s,At as c,B as l,Bt as u,C as d,Ct as f,D as p,Dt as m,E as h,Et as g,F as ee,Ft as _,G as v,Gt as y,H as b,Ht as x,I as S,J as C,Jt as w,K as T,Kt as E,L as D,Lt as O,M as te,Mt as ne,N as re,Nt as ie,O as ae,Ot as oe,P as se,Pt as k,Q as ce,R as le,Rt as ue,S as de,St as fe,T as pe,Tt as A,U as me,Ut as he,V as ge,Vt as _e,W as ve,Wt as ye,X as be,Xt as xe,Y as Se,Z as Ce,_ as we,_t as Te,a as Ee,at as De,b as Oe,bt as ke,c as j,ct as Ae,d as je,dt as M,et as Me,f as Ne,ft as N,g as Pe,gt as Fe,h as Ie,ht as P,i as Le,it as Re,j as F,jt as ze,k as Be,kt as Ve,l as He,lt as Ue,m as We,mt as Ge,n as Ke,nt as qe,o as Je,ot as Ye,p as Xe,pt as Ze,qt as I,r as Qe,rt as $e,s as et,st as L,t as tt,tt as nt,u as rt,ut as it,v as at,vt as ot,w as st,wt as R,x as ct,xt as lt,y as ut,yt as dt,z as ft,zt as z}from"./app-C5MP7OgJ.js";import{n as pt,o as B,t as mt}from"./preload-helper-SYSsmQ2O.js";import{t as V}from"./cn-Bi0ZEjD9.js";var H={name:`mic-off`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]};H.node;var U=B(H),W={name:`mic`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]};W.node;var G=B(W),K={name:`monitor-up`,size:24,node:[[`path`,{d:`m9 10 3-3 3 3`,key:`11gsxs`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]};K.node;var ht=B(K),q={name:`monitor-x`,size:24,node:[[`path`,{d:`m14.5 12.5-5-5`,key:`1jahn5`}],[`path`,{d:`m9.5 12.5 5-5`,key:`1k2t7b`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]};q.node;var gt=B(q),_t={name:`phone-off`,size:24,node:[[`path`,{d:`M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272`,key:`1wngk7`}],[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}],[`path`,{d:`M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473`,key:`10hv5p`}]]};_t.node;var vt=B(_t),yt={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};yt.node;var bt=B(yt),xt={name:`video-off`,size:24,node:[[`path`,{d:`M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196`,key:`w8jjjt`}],[`path`,{d:`M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`1xawa7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};xt.node;var St=B(xt),Ct={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};Ct.node;var wt=B(Ct),Tt={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Tt.node;var Et=B(Tt),Dt=e=>new Date(Date.parse(`${e}T00:00:00Z`)-864e5).toISOString().slice(0,10),Ot=(e,t,n=_())=>k(Date.parse(e),n)===k(Date.parse(t),n),kt=(e,t=Date.now(),n=_())=>{let r=k(Date.parse(e),n),i=k(t,n);return r===i?F(`today`):r===Dt(i)?F(`yesterday`):ie(Date.parse(`${r}T00:00:00Z`))},J=e(n(),1),At=({tone:e=`day`,label:t})=>{let n=t??F(`newMessages`),r=V(`h-px flex-1`,e===`new`?`bg-danger`:`bg-border`);return(0,J.jsxs)(`div`,{role:`separator`,"aria-label":n,"data-tone":e,"data-chat-divider":``,className:`flex items-center gap-3 text-xs font-medium`,children:[(0,J.jsx)(`span`,{className:r}),(0,J.jsx)(`span`,{className:e===`new`?`text-danger`:`text-muted-foreground`,children:n}),(0,J.jsx)(`span`,{className:r})]})},jt=({row:e,resource:t,recordKey:n,...r})=>{let i=Se(),a=L(),o=t??i?.resource??a?.model.name;if(o===void 0)throw Error(`RecordLink needs a resource outside a list display or a record`);return(0,J.jsx)(R,{to:{kind:`record`,resource:o,key:e?e.key:n},...r})},Y=e(t(),1),Mt=e=>{if(e?.kind!==`signed-in`)return;let{id:t,name:n}=e.user;return{id:t,...n&&{name:n}}},Nt=()=>{let e=w()?.state;return(0,Y.useMemo)(()=>Mt(e),[e])},Pt=(e,t)=>{e.srcObject=new MediaStream([t]);let n=()=>{t.readyState===`live`&&e.play().catch(e=>{if(!(e instanceof DOMException&&(e.name===`AbortError`||e.name===`NotAllowedError`)))throw e})};return e.addEventListener(`pause`,n),()=>e.removeEventListener(`pause`,n)},Ft=({track:e,...t})=>{let n=(0,Y.useCallback)(t=>t?Pt(t,e):void 0,[e]);return(0,J.jsx)(`video`,{ref:n,autoPlay:!0,playsInline:!0,muted:!0,...t})},It=({track:e})=>{let t=(0,Y.useCallback)(t=>t?Pt(t,e):void 0,[e]);return(0,J.jsx)(`audio`,{ref:t,autoPlay:!0})},Lt=e=>V(`size-10 rounded-full`,!e&&`bg-danger-soft text-danger-text`),Rt=({name:e,member:t,camera:n,microphoneOn:r,cameraOn:i,microphone:a,cameraAvailable:o,notices:s,onMicrophone:l,onCamera:u,onJoin:d,cancel:f})=>(0,J.jsxs)(`section`,{"aria-label":j(`preview`),className:`flex size-full min-h-0 flex-col items-center justify-center gap-3 bg-background p-4`,children:[(0,J.jsx)(`figure`,{className:`relative flex aspect-video w-full max-w-md items-center justify-center overflow-hidden rounded-lg bg-neutral-900`,children:n&&i?(0,J.jsx)(Ft,{track:n,"aria-label":j(`preview`),className:`size-full -scale-x-100 object-cover`}):(0,J.jsx)(c,{initials:N(e),hue:M(t),size:`md`,className:`size-16 text-xl ring-0`})}),s.length>0&&(0,J.jsx)(`div`,{role:`status`,className:`flex w-full max-w-md flex-col gap-1`,children:s.map(e=>(0,J.jsx)(`p`,{className:`rounded-md bg-warning-soft px-3 py-1.5 text-xs text-foreground`,children:e},e))}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(z,{size:`icon`,"aria-label":j(`microphone`),"aria-pressed":r,disabled:!a,className:Lt(r),onClick:l,children:r?(0,J.jsx)(G,{className:`size-4`}):(0,J.jsx)(U,{className:`size-4`})}),(0,J.jsx)(z,{size:`icon`,"aria-label":j(`camera`),"aria-pressed":i,disabled:!o,className:Lt(i),onClick:u,children:i?(0,J.jsx)(wt,{className:`size-4`}):(0,J.jsx)(St,{className:`size-4`})}),(0,J.jsx)(z,{variant:`primary`,className:`h-10 rounded-full px-5`,onClick:d,children:j(`joinCall`)}),(0,J.jsx)(g,{to:f,className:`px-2 text-sm text-muted-foreground hover:text-foreground`,children:j(`leave`)})]})]}),zt={ended:`ended`,removed:`removed`,full:`full`,refused:`refused`,unavailable:`unavailable`},Bt=({reason:e,onJoinAgain:t})=>(0,J.jsxs)(`section`,{role:`status`,className:`flex size-full min-h-0 flex-col items-center justify-center gap-3 bg-background p-4 text-center`,children:[(0,J.jsx)(`p`,{className:`text-sm text-foreground`,children:j(e===`rejoin`?`ended`:zt[e])}),t&&e!==`removed`&&e!==`refused`&&(0,J.jsx)(z,{onClick:t,children:j(`callAgain`)})]}),Vt=(e,t)=>t<640?e<=2?1:2:Math.min(4,Math.ceil(Math.sqrt(e))),Ht=({people:e,sharers:t,width:n})=>t[0]===void 0?e<=1?{kind:`alone`}:{kind:`grid`,columns:Vt(e,n)}:{kind:`share`,sharer:t[0]},Ut=({roundTripMs:e,lostRatio:t})=>(e??0)>400||(t??0)>.05?`poor`:`good`,Wt=(e,t,n)=>e===`failed`||e!==`connected`&&n-t>=15e3,Gt=(e,t=.05)=>{let n;for(let[r,i]of e)i>=t&&(!n||i>n[1])&&(n=[r,i]);return n?.[0]},Kt=(e,t)=>e.find(e=>e.source===t&&e.track),qt=({members:e,self:t,tracks:n,own:r,nameOf:i,speaker:a,connections:o,seen:s,now:c})=>(e.some(e=>e.member===t)?e:[{member:t,joined_at:``},...e]).map(({member:e})=>{let l={member:e,name:i(e),...a===e&&{speaking:!0}};if(e===t)return{...l,self:!0,...r.camera&&{camera:r.camera},...r.microphone&&{microphone:r.microphone},...r.screen&&{screen:r.screen},microphoneOff:!r.microphone||!r.microphoneOn,cameraOff:!r.camera||!r.cameraOn};let u=n.filter(t=>t.member===e),[d,f,p,m]=[`camera`,`microphone`,`screen`,`screen-audio`].map(e=>Kt(u,e)),h=o.find(t=>t.member===e),g=Wt(h?.state,s.get(e)??c,c)?`failed`:h?.state===`connected`?Ut(h):void 0;return{...l,...d&&{camera:d.track},...f&&{microphone:f.track},...p&&{screen:p.track},...m&&{screenAudio:m.track},microphoneOff:!f||f.muted,cameraOff:!d||d.muted,...g&&{connection:g}}}),Jt=e=>V(`size-10 rounded-full`,!e&&`bg-danger-soft text-danger-text`),Yt=({microphoneOn:e,cameraOn:t,sharing:n,onMicrophone:r,onCamera:i,onShare:a,leave:o})=>(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":j(`joinCall`),className:`flex shrink-0 items-center justify-center gap-2 py-2`,children:[(0,J.jsx)(z,{size:`icon`,"aria-label":j(`microphone`),"aria-pressed":e,title:j(`microphone`),className:Jt(e),onClick:r,children:e?(0,J.jsx)(G,{className:`size-4`}):(0,J.jsx)(U,{className:`size-4`})}),(0,J.jsx)(z,{size:`icon`,"aria-label":j(`camera`),"aria-pressed":t,title:j(`camera`),className:Jt(t),onClick:i,children:t?(0,J.jsx)(wt,{className:`size-4`}):(0,J.jsx)(St,{className:`size-4`})}),a&&(0,J.jsx)(z,{size:`icon`,"aria-label":j(n?`stopSharing`:`shareScreen`),"aria-pressed":!!n,title:j(n?`stopSharing`:`shareScreen`),className:`size-10 rounded-full`,onClick:a,children:n?(0,J.jsx)(gt,{className:`size-4`}):(0,J.jsx)(ht,{className:`size-4`})}),(0,J.jsxs)(g,{to:o,className:V(u({variant:`danger`}),`h-10 rounded-full px-4`),children:[(0,J.jsx)(vt,{className:`size-4`}),j(`leave`)]})]}),X=({person:e,screen:t=!1,className:n})=>{let r=t?e.screen:e.cameraOff?void 0:e.camera,i=t?e.self?j(`youAreSharing`):j(`sharing`,e.name):e.self?`${e.name} (${j(`you`)})`:e.name;return(0,J.jsxs)(`figure`,{"data-member":e.member,"data-speaking":e.speaking?`true`:void 0,"aria-label":i,className:V(`relative flex min-h-0 min-w-0 items-center justify-center overflow-hidden rounded-lg bg-neutral-900 ring-offset-2 ring-offset-background`,e.speaking&&!t&&`ring-2 ring-success`,n),children:[r?(0,J.jsx)(Ft,{track:r,className:V(`size-full`,t?`object-contain`:`object-cover`,e.self&&!t&&`-scale-x-100`)}):(0,J.jsx)(c,{initials:N(e.name),hue:M(e.member),size:`md`,className:`size-16 text-xl ring-0`}),e.connection===`failed`&&!e.self&&(0,J.jsx)(`p`,{role:`status`,className:`absolute inset-x-1 top-1 truncate rounded bg-black/70 px-2 py-1 text-center text-xs text-white`,children:j(`cannotConnect`,e.name)}),(0,J.jsxs)(`figcaption`,{className:`absolute bottom-1.5 left-1.5 flex max-w-[calc(100%-0.75rem)] items-center gap-1 rounded bg-black/60 px-1.5 py-0.5 text-xs text-white`,children:[!t&&e.microphoneOff&&(0,J.jsx)(U,{role:`img`,"aria-label":j(`muted`),className:`size-3 shrink-0`}),!t&&e.connection===`poor`&&(0,J.jsx)(Et,{role:`img`,"aria-label":j(`poorConnection`),className:`size-3 shrink-0 text-warning`}),(0,J.jsx)(`span`,{className:`truncate`,children:i})]})]})},Xt=()=>{let[e,t]=(0,Y.useState)(0);return{ref:(0,Y.useCallback)(e=>{if(!e)return;t(e.clientWidth);let n=new ResizeObserver(([e])=>t(e.contentRect.width));return n.observe(e),()=>n.disconnect()},[]),width:e}},Zt=4,Qt=({people:e,columns:t})=>(0,J.jsx)(`div`,{className:`grid size-full min-h-0 gap-2`,style:{gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${Math.ceil(e.length/t)}, minmax(0, 1fr))`},children:e.map(e=>(0,J.jsx)(X,{person:e},e.member))}),$t=({people:e,sharer:t,narrow:n})=>{let r=e.slice(0,Zt),i=e.length-r.length;return(0,J.jsxs)(`div`,{className:V(`flex size-full min-h-0 gap-2`,n?`flex-col`:`flex-row`),children:[(0,J.jsx)(X,{person:t,screen:!0,className:`min-h-0 flex-1`}),(0,J.jsxs)(`div`,{className:V(`flex shrink-0 gap-2`,n?`h-20 flex-row`:`w-40 flex-col`),children:[r.map(e=>(0,J.jsx)(X,{person:e,className:n?`aspect-video h-full`:`aspect-video w-full`},e.member)),i>0&&(0,J.jsxs)(`p`,{className:`flex items-center justify-center rounded-lg bg-muted px-2 text-xs text-muted-foreground`,children:[`+`,i]})]})]})},en=({layout:e,people:t,narrow:n})=>e.kind===`share`?(0,J.jsx)($t,{people:t,sharer:t.find(t=>t.member===e.sharer),narrow:n}):e.kind===`grid`?(0,J.jsx)(Qt,{people:t,columns:e.columns}):(0,J.jsxs)(`div`,{className:`relative size-full min-h-0`,children:[(0,J.jsx)(X,{person:t[0],className:`size-full`}),(0,J.jsx)(`p`,{className:`absolute inset-x-0 top-3 text-center text-sm text-white drop-shadow`,children:j(`alone`)})]}),tn=({people:e,state:t,notices:n=[],controls:r,className:i})=>{let{ref:a,width:o}=Xt(),s=o>0&&o<640,c=Ht({people:e.length,sharers:e.filter(e=>e.screen).map(e=>e.member),width:o}),l=[...t===`resuming`?[j(`reconnecting`)]:[],...n];return(0,J.jsxs)(`section`,{ref:a,"aria-label":j(`joinCall`),"data-layout":c.kind,className:V(`flex size-full min-h-0 flex-col gap-2 bg-background p-2`,i),children:[l.length>0&&(0,J.jsx)(`div`,{role:`status`,className:`flex shrink-0 flex-col gap-1`,children:l.map(e=>(0,J.jsxs)(`p`,{className:`flex items-center gap-2 rounded-md bg-warning-soft px-3 py-1.5 text-xs text-foreground`,children:[e===j(`reconnecting`)&&(0,J.jsx)(x,{className:`size-3`}),e]},e))}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1`,children:t===`joining`?(0,J.jsxs)(`p`,{role:`status`,className:`flex size-full items-center justify-center gap-2 text-muted-foreground`,children:[(0,J.jsx)(x,{className:`size-4`}),j(`connecting`)]}):(0,J.jsx)(en,{layout:c,people:e,narrow:s})}),(0,J.jsx)(Yt,{...r}),e.filter(e=>!e.self).flatMap(e=>[[`microphone`,e.microphone],[`screen-audio`,e.screenAudio]].map(([t,n])=>n&&{key:`${e.member} ${t}`,track:n})).filter(e=>e!==void 0).map(({key:e,track:t})=>(0,J.jsx)(It,{track:t},e))]})},nn=200,rn=1e3,an=(e,t)=>{e.getFloatTimeDomainData(t);let n=0;for(let e of t)n+=e*e;return Math.min(1,Math.sqrt(n/t.length)*4)},on=e=>{let[t,n]=(0,Y.useState)(),r=[...e].map(([e,t])=>`${e}:${t.id}`).join(`,`);return(0,Y.useEffect)(()=>{if(e.size===0||typeof AudioContext>`u`)return;let t=new AudioContext,r=new Map([...e].map(([e,n])=>{let r=t.createAnalyser();return r.fftSize=512,t.createMediaStreamSource(new MediaStream([n])).connect(r),[e,r]})),i=new Float32Array(512),a,o=setInterval(()=>{let e=Gt(new Map([...r].map(([e,t])=>[e,an(t,i)])));e&&(a={member:e,at:Date.now()}),n(a&&Date.now()-a.at<rn?a.member:void 0)},nn);return()=>{clearInterval(o),t.close()}},[r]),t},sn=new Set([`NotAllowedError`,`SecurityError`]),cn=new Set([`NotFoundError`,`NotReadableError`,`OverconstrainedError`]),ln=async(e,t)=>{try{return{track:(await e.getUserMedia({[t]:!0})).getTracks()[0],blocked:!1}}catch(e){if(!(e instanceof DOMException))throw e;if(sn.has(e.name))return{blocked:!0};if(cn.has(e.name))return{blocked:!1};throw e}},un=async(e=navigator.mediaDevices)=>{try{let t=await e.getUserMedia({audio:!0,video:!0});return{microphone:t.getAudioTracks()[0],camera:t.getVideoTracks()[0],blocked:{microphone:!1,camera:!1},none:!1}}catch(e){if(!(e instanceof DOMException)||!(sn.has(e.name)||cn.has(e.name)))throw e}let[t,n]=[await ln(e,`audio`),await ln(e,`video`)];return{...t.track&&{microphone:t.track},...n.track&&{camera:n.track},blocked:{microphone:t.blocked,camera:n.blocked},none:!t.track&&!n.track&&!t.blocked&&!n.blocked}},dn=2e3,Z=e=>{for(let t of e)t?.stop()},fn=e=>{let[t,n]=(0,Y.useState)({kind:`check`}),[r,i]=(0,Y.useState)(),[a,o]=(0,Y.useState)(!0),[s,c]=(0,Y.useState)(!0),[l,u]=(0,Y.useState)([]),[d,f]=(0,Y.useState)([]),[p,m]=(0,Y.useState)([]),[h,g]=(0,Y.useState)(),[ee,_]=(0,Y.useState)(!1),v=(0,Y.useRef)(void 0),y=(0,Y.useRef)(!1),b=(0,Y.useRef)([]),x=(0,Y.useRef)(new Map),S=(0,Y.useRef)(Promise.resolve(void 0));(0,Y.useEffect)(()=>{let e=!1;return y.current=!1,S.current=un().then(t=>{if(e){Z([t.microphone,t.camera]);return}return b.current.push(t.microphone,t.camera),i(t),t}),()=>{e=!0,y.current=!0,v.current?.leave(),v.current=void 0,Z(b.current),b.current=[]}},[]),(0,Y.useEffect)(()=>{for(let{member:e}of d)x.current.has(e)||x.current.set(e,Date.now())},[d]),(0,Y.useEffect)(()=>{if(t.kind!==`in`)return;let e=setInterval(()=>void v.current?.connections().then(m),dn);return()=>clearInterval(e)},[t.kind]);let C=(0,Y.useCallback)(async()=>{n({kind:`joining`});let{joinCall:t,PublishRefused:r}=await mt(async()=>{let{joinCall:e,PublishRefused:t}=await import(`./calls-DwVdIhNM.js`);return{joinCall:e,PublishRefused:t}},[]),i=await t({url:e,onTracks:u,onMembers:f,onState:e=>{(e.state===`joined`||e.state===`resuming`)&&n({kind:`in`,resuming:e.state===`resuming`}),e.state===`left`&&n({kind:`left`,reason:e.reason})}}).then(e=>e,()=>void 0);if(!i)return;if(y.current)return i.leave();v.current=i;let o=await S.current,c={...o?.microphone&&{microphone:o.microphone},...o?.camera&&{camera:o.camera}};await i.publish(c).then(()=>{c.microphone&&i.mute(`microphone`,!a),c.camera&&i.mute(`camera`,!s)},e=>{if(!(e instanceof r))throw e;_(!0)})},[e,a,s]),w=(0,Y.useCallback)(()=>{let e=!a;o(e),r?.microphone&&(r.microphone.enabled=e),v.current?.mute(`microphone`,!e)},[a,r]),T=(0,Y.useCallback)(()=>{let e=!s;c(e),r?.camera&&(r.camera.enabled=e),v.current?.mute(`camera`,!e)},[s,r]),E=(0,Y.useCallback)(async e=>{g(void 0),Z([e.video,e.audio]),await v.current?.unpublish(`screen`),e.audio&&await v.current?.unpublish(`screen-audio`)},[]),D=(0,Y.useCallback)(async()=>{if(h)return E(h);let e;try{e=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0})}catch(e){if(e instanceof DOMException&&e.name===`NotAllowedError`)return;throw e}let t={video:e.getVideoTracks()[0],...e.getAudioTracks()[0]&&{audio:e.getAudioTracks()[0]}};b.current.push(t.video,t.audio),t.video.addEventListener(`ended`,()=>void E(t)),await v.current?.publish({screen:t.video,...t.audio&&{"screen-audio":t.audio}}),g(t)},[h,E]),O=typeof navigator<`u`&&typeof navigator.mediaDevices?.getDisplayMedia==`function`;return{phase:t,devices:r,microphoneOn:a,cameraOn:s,tracks:l,members:d,connections:p,screen:h,refusedSending:ee,seen:x.current,self:v.current?.participant,join:C,toggleMicrophone:w,toggleCamera:T,...O&&{toggleScreen:D}}},pn=(e,t)=>[...e?.blocked.microphone?[j(`noMicrophone`)]:[],...e?.blocked.camera?[j(`noCamera`)]:[],...e?.none?[j(`noDevices`)]:[],...t?[j(`refused`)]:[]],mn=({url:e,leave:t,nameOf:n=e=>e,className:r})=>{let i=fn(e),a=w(),o=a?.state.kind===`signed-in`?a.state.user:void 0,s=i.self??o?.id??``,[c]=(0,Y.useState)(()=>Date.now()),{devices:l,phase:u}=i,d={...l?.microphone&&{microphone:l.microphone},...l?.camera&&{camera:l.camera},...i.screen&&{screen:i.screen.video},microphoneOn:i.microphoneOn,cameraOn:i.cameraOn},f=new Map([...l?.microphone&&i.microphoneOn?[[s,l.microphone]]:[],...i.tracks.filter(e=>e.source===`microphone`&&e.track&&!e.muted).map(e=>[e.member,e.track])]),p=on(u.kind===`in`?f:new Map),m=pn(l,i.refusedSending);if(u.kind===`left`)return(0,J.jsx)(Bt,{reason:u.reason,onJoinAgain:()=>void i.join()});if(u.kind===`check`)return(0,J.jsx)(Rt,{name:o?.name??j(`you`),member:s,...l?.camera&&{camera:l.camera},microphoneOn:i.microphoneOn,cameraOn:i.cameraOn,microphone:!!l?.microphone,cameraAvailable:!!l?.camera,notices:m,onMicrophone:i.toggleMicrophone,onCamera:i.toggleCamera,onJoin:()=>void i.join(),cancel:t});let h=qt({members:i.members,self:s,tracks:i.tracks,own:d,nameOf:n,...p&&{speaker:p},connections:i.connections,seen:i.seen,now:Math.max(c,Date.now())});return(0,J.jsx)(tn,{...r&&{className:r},people:h,state:u.kind===`joining`?`joining`:u.resuming?`resuming`:`joined`,notices:m,controls:{microphoneOn:i.microphoneOn&&!!l?.microphone,cameraOn:i.cameraOn&&!!l?.camera,sharing:!!i.screen,onMicrophone:i.toggleMicrophone,onCamera:i.toggleCamera,...i.toggleScreen&&{onShare:()=>void i.toggleScreen()},leave:t}})},Q=(e,t)=>{let{address:n,href:r,open:i}=A(),a=n?.kind===`record`&&n.resource===e&&n.key===t&&n.call===`join`,o=e=>({href:e,onFollow:()=>i(e)});return{joining:a,join:o(r({kind:`record`,resource:e,key:t,call:`join`})),leave:o(r({kind:`record`,resource:e,key:t}))}},hn=({resource:e,recordKey:t,...n})=>{let{joining:r,leave:i}=Q(e,t);return r?(0,J.jsx)(mn,{leave:i,...n},`${e}/${t}`):null},$=(e,t)=>{let n=y(),r=a(),o=I.recordCalls(e,t),s=i({queryKey:o,queryFn:()=>n.calls(e,t)});return(0,Y.useEffect)(()=>{let i=I.recordCalls(e,t),a=n.channel(e,t),o=a.on(xe,e=>e.server&&r.setQueryData(i,e.payload.items)),s=a.onStatus(e=>e.state===`joined`&&void r.invalidateQueries({queryKey:i}));return()=>{o(),s(),a.leave()}},[n,r,e,t]),{...s,ongoing:s.data?.find(e=>e.ended_at===null)}},gn=({resource:e,recordKey:t,className:n})=>{let{ongoing:r,isPending:i}=$(e,t),{joining:a,join:o}=Q(e,t);if(i)return null;if(!r)return a?null:(0,J.jsxs)(g,{to:o,className:V(u({size:`sm`}),n),children:[(0,J.jsx)(bt,{className:`size-3.5`}),j(`startCall`)]});let s=r.members.length;return(0,J.jsxs)(`span`,{role:`status`,className:V(`inline-flex items-center gap-1.5 rounded-md bg-success-soft px-2 py-0.5 text-body text-foreground`,n),children:[(0,J.jsx)(bt,{className:`size-3.5 text-success`}),j(`inProgress`),(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,J.jsx)(`span`,{"aria-label":j(`people`,s),children:s}),!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,J.jsx)(g,{to:o,className:u({variant:`primary`,size:`sm`}),children:j(`join`)})]})]})},_n={width:640,height:480},vn=e=>e.flatMap(e=>{if(`src`in e)return[{image:{url:e.src},alt:e.alt}];let t=m(e,_n);return t?[{image:t,alt:e.alt??``}]:[]}),yn=({images:e,label:t,fit:n=`cover`,swipe:r=!0,className:i})=>{let a=vn(e),o=be(a.length);return(0,J.jsxs)(`div`,{role:`group`,"aria-roledescription":`carousel`,"aria-label":t,className:V(`group/carousel relative overflow-hidden`,i),children:[(0,J.jsx)(Ce,{"data-carousel-track":!0,carousel:o,swipe:r,slides:a.map(({image:e,alt:t})=>(0,J.jsx)(Ze,{image:e,alt:t,loading:`lazy`,className:V(`size-full`,n===`cover`?`object-cover`:`object-contain`)}))}),(0,J.jsx)(ce,{carousel:o,count:a.length,swipe:r,reveal:`group-hover/carousel:opacity-100`,className:`inset-0`})]})},bn=({name:e,label:t,options:n,value:r,onChange:i})=>(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":t,className:`flex flex-col gap-2`,children:n.map(t=>(0,J.jsxs)(`label`,{className:V(`block rounded-lg border p-3 transition-colors has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-primary`,t.disabled?`cursor-default bg-background opacity-60`:t.value===r?`cursor-pointer border-primary bg-primary-soft`:`cursor-pointer bg-background hover:bg-surface`),children:[(0,J.jsx)(`input`,{type:`radio`,name:e,value:t.value,checked:t.value===r,disabled:t.disabled,onChange:()=>i(t.value),className:`sr-only`}),(0,J.jsx)(`span`,{className:V(`block font-medium`,t.value===r&&`text-primary-text`),children:t.label}),t.description&&(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-snug text-muted-foreground`,children:t.description})]},t.value))}),xn=(e,t,n)=>{let o=y(),s=a(),c=[...new Set(n)].sort();return i({queryKey:I.pickedLabels(e.name,c.join(`,`)),enabled:c.length>0,placeholderData:r,queryFn:()=>$e(s,o,e,c,t)}).data??new Map},Sn=e=>{let{resources:t,views:n}=_e(),r=t[e.resource];if(!r)throw Error(`RecordPicker: the app has no resource named "${e.resource}"`);if(r.primaryKey.length!==1)throw Error(`RecordPicker: "${e.resource}" has a composite key, which a picker cannot name`);let i=n[e.resource],a=e.multiple?e.value:e.value===void 0?[]:[e.value],[o,s]=(0,Y.useState)({}),c=xn(r,i,a),l=e=>o[e]??c.get(e)??e,u=(e,t)=>s(n=>({...n,[e]:t}));if(!e.multiple){let{value:t,onChange:n}=e;return(0,J.jsx)(P,{target:r,view:i,value:t??``,label:t===void 0?void 0:l(t),invalid:e.invalid,onChange:(e,t)=>{u(e,t),n(e)}})}let{value:d,onChange:f}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(P,{target:r,view:i,value:``,chosen:d,several:!0,invalid:e.invalid,onChange:(e,t)=>{u(e,t),f(d.includes(e)?d.filter(t=>t!==e):[...d,e])}}),d.length>0&&(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:d.map(e=>(0,J.jsx)(it,{label:l(e),onRemove:()=>f(d.filter(t=>t!==e))},e))})]})};export{de as ActionCard,Ae as ActionInputError,ye as ApiProvider,tt as App,R as AppLink,Xe as AssistantDock,v as AuthLayout,Me as AvailabilityMark,z as Button,gn as CallMark,mn as CallView,yn as Carousel,At as ChatDivider,s as ChatMessage,Be as ChatThread,bn as Choices,ft as CodeForm,Oe as CompactTable,st as Composer,ue as Dialog,we as DiffView,Ve as Field,ct as FieldList,rt as Form,ze as Input,qe as LogoMark,Ue as Markdown,h as MentionBox,pe as MentionedText,T as MenuSelect,Ge as OtpInput,Ie as PartView,hn as RecordCall,jt as RecordLink,Sn as RecordPicker,l as ResendCodeButton,O as ResponsiveDialog,oe as Section,pt as Segmented,d as SidePanel,o as SignInPrompt,x as Spinner,nt as StatusMark,Pe as StepList,f as Textarea,ge as allowDelayMs,u as buttonClass,kt as chatDayLabel,Fe as definePlugin,Te as defineUi,at as diffStats,p as emptyDraft,Ke as isConflict,b as isFramed,ae as mentionedIds,D as mergeUi,ut as parseDiff,se as pluginApi,ee as protobaseVersion,Ot as sameChatDay,dt as statusRefreshMs,le as uiFromModule,re as useApiToken,A as useAppAddress,me as useArmedAfterFocus,Ne as useAssistant,je as useAssistantClient,We as useBackendData,y as useClient,Re as useFacets,ne as useFieldControl,ve as useGuardedPress,De as useHistogram,Le as useInbox,L as useLayoutRecord,fe as useList,C as useListDisplay,Ee as useMarkNotificationsRead,ot as useMembers,he as useMeta,ke as useOwnStatus,S as usePlugin,He as usePresence,et as usePushNotifications,te as useRecord,Q as useRecordCallAddress,$ as useRecordCalls,E as useResourceClient,Ye as useSeries,Nt as useSignedInUser,lt as useStatuses,Je as useUnreadNotifications,Qe as useUpdateRecord};
|
|
2
|
-
//# debugId=
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{G as r,V as i,q as a}from"./vendor-xNCj9Gc_.js";import{$ as o,A as s,At as c,B as l,Bt as u,C as d,Ct as f,D as p,Dt as m,E as h,Et as g,F as ee,Ft as _,G as v,Gt as y,H as b,Ht as x,I as S,J as C,Jt as w,K as T,Kt as E,L as D,Lt as O,M as te,Mt as ne,N as re,Nt as ie,O as ae,Ot as oe,P as se,Pt as k,Q as ce,R as le,Rt as ue,S as de,St as fe,T as pe,Tt as A,U as me,Ut as he,V as ge,Vt as _e,W as ve,Wt as ye,X as be,Xt as xe,Y as Se,Z as Ce,_ as we,_t as Te,a as Ee,at as De,b as Oe,bt as ke,c as j,ct as Ae,d as je,dt as M,et as Me,f as Ne,ft as N,g as Pe,gt as Fe,h as Ie,ht as P,i as Le,it as Re,j as F,jt as ze,k as Be,kt as Ve,l as He,lt as Ue,m as We,mt as Ge,n as Ke,nt as qe,o as Je,ot as Ye,p as Xe,pt as Ze,qt as I,r as Qe,rt as $e,s as et,st as L,t as tt,tt as nt,u as rt,ut as it,v as at,vt as ot,w as st,wt as R,x as ct,xt as lt,y as ut,yt as dt,z as ft,zt as z}from"./app-B_ojAtG3.js";import{n as pt,o as B,t as mt}from"./preload-helper-SYSsmQ2O.js";import{t as V}from"./cn-Bi0ZEjD9.js";var H={name:`mic-off`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]};H.node;var U=B(H),W={name:`mic`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]};W.node;var G=B(W),K={name:`monitor-up`,size:24,node:[[`path`,{d:`m9 10 3-3 3 3`,key:`11gsxs`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]};K.node;var ht=B(K),q={name:`monitor-x`,size:24,node:[[`path`,{d:`m14.5 12.5-5-5`,key:`1jahn5`}],[`path`,{d:`m9.5 12.5 5-5`,key:`1k2t7b`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]};q.node;var gt=B(q),_t={name:`phone-off`,size:24,node:[[`path`,{d:`M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272`,key:`1wngk7`}],[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}],[`path`,{d:`M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473`,key:`10hv5p`}]]};_t.node;var vt=B(_t),yt={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};yt.node;var bt=B(yt),xt={name:`video-off`,size:24,node:[[`path`,{d:`M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196`,key:`w8jjjt`}],[`path`,{d:`M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`1xawa7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};xt.node;var St=B(xt),Ct={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};Ct.node;var wt=B(Ct),Tt={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Tt.node;var Et=B(Tt),Dt=e=>new Date(Date.parse(`${e}T00:00:00Z`)-864e5).toISOString().slice(0,10),Ot=(e,t,n=_())=>k(Date.parse(e),n)===k(Date.parse(t),n),kt=(e,t=Date.now(),n=_())=>{let r=k(Date.parse(e),n),i=k(t,n);return r===i?F(`today`):r===Dt(i)?F(`yesterday`):ie(Date.parse(`${r}T00:00:00Z`))},J=e(n(),1),At=({tone:e=`day`,label:t})=>{let n=t??F(`newMessages`),r=V(`h-px flex-1`,e===`new`?`bg-danger`:`bg-border`);return(0,J.jsxs)(`div`,{role:`separator`,"aria-label":n,"data-tone":e,"data-chat-divider":``,className:`flex items-center gap-3 text-xs font-medium`,children:[(0,J.jsx)(`span`,{className:r}),(0,J.jsx)(`span`,{className:e===`new`?`text-danger`:`text-muted-foreground`,children:n}),(0,J.jsx)(`span`,{className:r})]})},jt=({row:e,resource:t,recordKey:n,...r})=>{let i=Se(),a=L(),o=t??i?.resource??a?.model.name;if(o===void 0)throw Error(`RecordLink needs a resource outside a list display or a record`);return(0,J.jsx)(R,{to:{kind:`record`,resource:o,key:e?e.key:n},...r})},Y=e(t(),1),Mt=e=>{if(e?.kind!==`signed-in`)return;let{id:t,name:n}=e.user;return{id:t,...n&&{name:n}}},Nt=()=>{let e=w()?.state;return(0,Y.useMemo)(()=>Mt(e),[e])},Pt=(e,t)=>{e.srcObject=new MediaStream([t]);let n=()=>{t.readyState===`live`&&e.play().catch(e=>{if(!(e instanceof DOMException&&(e.name===`AbortError`||e.name===`NotAllowedError`)))throw e})};return e.addEventListener(`pause`,n),()=>e.removeEventListener(`pause`,n)},Ft=({track:e,...t})=>{let n=(0,Y.useCallback)(t=>t?Pt(t,e):void 0,[e]);return(0,J.jsx)(`video`,{ref:n,autoPlay:!0,playsInline:!0,muted:!0,...t})},It=({track:e})=>{let t=(0,Y.useCallback)(t=>t?Pt(t,e):void 0,[e]);return(0,J.jsx)(`audio`,{ref:t,autoPlay:!0})},Lt=e=>V(`size-10 rounded-full`,!e&&`bg-danger-soft text-danger-text`),Rt=({name:e,member:t,camera:n,microphoneOn:r,cameraOn:i,microphone:a,cameraAvailable:o,notices:s,onMicrophone:l,onCamera:u,onJoin:d,cancel:f})=>(0,J.jsxs)(`section`,{"aria-label":j(`preview`),className:`flex size-full min-h-0 flex-col items-center justify-center gap-3 bg-background p-4`,children:[(0,J.jsx)(`figure`,{className:`relative flex aspect-video w-full max-w-md items-center justify-center overflow-hidden rounded-lg bg-neutral-900`,children:n&&i?(0,J.jsx)(Ft,{track:n,"aria-label":j(`preview`),className:`size-full -scale-x-100 object-cover`}):(0,J.jsx)(c,{initials:N(e),hue:M(t),size:`md`,className:`size-16 text-xl ring-0`})}),s.length>0&&(0,J.jsx)(`div`,{role:`status`,className:`flex w-full max-w-md flex-col gap-1`,children:s.map(e=>(0,J.jsx)(`p`,{className:`rounded-md bg-warning-soft px-3 py-1.5 text-xs text-foreground`,children:e},e))}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(z,{size:`icon`,"aria-label":j(`microphone`),"aria-pressed":r,disabled:!a,className:Lt(r),onClick:l,children:r?(0,J.jsx)(G,{className:`size-4`}):(0,J.jsx)(U,{className:`size-4`})}),(0,J.jsx)(z,{size:`icon`,"aria-label":j(`camera`),"aria-pressed":i,disabled:!o,className:Lt(i),onClick:u,children:i?(0,J.jsx)(wt,{className:`size-4`}):(0,J.jsx)(St,{className:`size-4`})}),(0,J.jsx)(z,{variant:`primary`,className:`h-10 rounded-full px-5`,onClick:d,children:j(`joinCall`)}),(0,J.jsx)(g,{to:f,className:`px-2 text-sm text-muted-foreground hover:text-foreground`,children:j(`leave`)})]})]}),zt={ended:`ended`,removed:`removed`,full:`full`,refused:`refused`,unavailable:`unavailable`},Bt=({reason:e,onJoinAgain:t})=>(0,J.jsxs)(`section`,{role:`status`,className:`flex size-full min-h-0 flex-col items-center justify-center gap-3 bg-background p-4 text-center`,children:[(0,J.jsx)(`p`,{className:`text-sm text-foreground`,children:j(e===`rejoin`?`ended`:zt[e])}),t&&e!==`removed`&&e!==`refused`&&(0,J.jsx)(z,{onClick:t,children:j(`callAgain`)})]}),Vt=(e,t)=>t<640?e<=2?1:2:Math.min(4,Math.ceil(Math.sqrt(e))),Ht=({people:e,sharers:t,width:n})=>t[0]===void 0?e<=1?{kind:`alone`}:{kind:`grid`,columns:Vt(e,n)}:{kind:`share`,sharer:t[0]},Ut=({roundTripMs:e,lostRatio:t})=>(e??0)>400||(t??0)>.05?`poor`:`good`,Wt=(e,t,n)=>e===`failed`||e!==`connected`&&n-t>=15e3,Gt=(e,t=.05)=>{let n;for(let[r,i]of e)i>=t&&(!n||i>n[1])&&(n=[r,i]);return n?.[0]},Kt=(e,t)=>e.find(e=>e.source===t&&e.track),qt=({members:e,self:t,tracks:n,own:r,nameOf:i,speaker:a,connections:o,seen:s,now:c})=>(e.some(e=>e.member===t)?e:[{member:t,joined_at:``},...e]).map(({member:e})=>{let l={member:e,name:i(e),...a===e&&{speaking:!0}};if(e===t)return{...l,self:!0,...r.camera&&{camera:r.camera},...r.microphone&&{microphone:r.microphone},...r.screen&&{screen:r.screen},microphoneOff:!r.microphone||!r.microphoneOn,cameraOff:!r.camera||!r.cameraOn};let u=n.filter(t=>t.member===e),[d,f,p,m]=[`camera`,`microphone`,`screen`,`screen-audio`].map(e=>Kt(u,e)),h=o.find(t=>t.member===e),g=Wt(h?.state,s.get(e)??c,c)?`failed`:h?.state===`connected`?Ut(h):void 0;return{...l,...d&&{camera:d.track},...f&&{microphone:f.track},...p&&{screen:p.track},...m&&{screenAudio:m.track},microphoneOff:!f||f.muted,cameraOff:!d||d.muted,...g&&{connection:g}}}),Jt=e=>V(`size-10 rounded-full`,!e&&`bg-danger-soft text-danger-text`),Yt=({microphoneOn:e,cameraOn:t,sharing:n,onMicrophone:r,onCamera:i,onShare:a,leave:o})=>(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":j(`joinCall`),className:`flex shrink-0 items-center justify-center gap-2 py-2`,children:[(0,J.jsx)(z,{size:`icon`,"aria-label":j(`microphone`),"aria-pressed":e,title:j(`microphone`),className:Jt(e),onClick:r,children:e?(0,J.jsx)(G,{className:`size-4`}):(0,J.jsx)(U,{className:`size-4`})}),(0,J.jsx)(z,{size:`icon`,"aria-label":j(`camera`),"aria-pressed":t,title:j(`camera`),className:Jt(t),onClick:i,children:t?(0,J.jsx)(wt,{className:`size-4`}):(0,J.jsx)(St,{className:`size-4`})}),a&&(0,J.jsx)(z,{size:`icon`,"aria-label":j(n?`stopSharing`:`shareScreen`),"aria-pressed":!!n,title:j(n?`stopSharing`:`shareScreen`),className:`size-10 rounded-full`,onClick:a,children:n?(0,J.jsx)(gt,{className:`size-4`}):(0,J.jsx)(ht,{className:`size-4`})}),(0,J.jsxs)(g,{to:o,className:V(u({variant:`danger`}),`h-10 rounded-full px-4`),children:[(0,J.jsx)(vt,{className:`size-4`}),j(`leave`)]})]}),X=({person:e,screen:t=!1,className:n})=>{let r=t?e.screen:e.cameraOff?void 0:e.camera,i=t?e.self?j(`youAreSharing`):j(`sharing`,e.name):e.self?`${e.name} (${j(`you`)})`:e.name;return(0,J.jsxs)(`figure`,{"data-member":e.member,"data-speaking":e.speaking?`true`:void 0,"aria-label":i,className:V(`relative flex min-h-0 min-w-0 items-center justify-center overflow-hidden rounded-lg bg-neutral-900 ring-offset-2 ring-offset-background`,e.speaking&&!t&&`ring-2 ring-success`,n),children:[r?(0,J.jsx)(Ft,{track:r,className:V(`size-full`,t?`object-contain`:`object-cover`,e.self&&!t&&`-scale-x-100`)}):(0,J.jsx)(c,{initials:N(e.name),hue:M(e.member),size:`md`,className:`size-16 text-xl ring-0`}),e.connection===`failed`&&!e.self&&(0,J.jsx)(`p`,{role:`status`,className:`absolute inset-x-1 top-1 truncate rounded bg-black/70 px-2 py-1 text-center text-xs text-white`,children:j(`cannotConnect`,e.name)}),(0,J.jsxs)(`figcaption`,{className:`absolute bottom-1.5 left-1.5 flex max-w-[calc(100%-0.75rem)] items-center gap-1 rounded bg-black/60 px-1.5 py-0.5 text-xs text-white`,children:[!t&&e.microphoneOff&&(0,J.jsx)(U,{role:`img`,"aria-label":j(`muted`),className:`size-3 shrink-0`}),!t&&e.connection===`poor`&&(0,J.jsx)(Et,{role:`img`,"aria-label":j(`poorConnection`),className:`size-3 shrink-0 text-warning`}),(0,J.jsx)(`span`,{className:`truncate`,children:i})]})]})},Xt=()=>{let[e,t]=(0,Y.useState)(0);return{ref:(0,Y.useCallback)(e=>{if(!e)return;t(e.clientWidth);let n=new ResizeObserver(([e])=>t(e.contentRect.width));return n.observe(e),()=>n.disconnect()},[]),width:e}},Zt=4,Qt=({people:e,columns:t})=>(0,J.jsx)(`div`,{className:`grid size-full min-h-0 gap-2`,style:{gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${Math.ceil(e.length/t)}, minmax(0, 1fr))`},children:e.map(e=>(0,J.jsx)(X,{person:e},e.member))}),$t=({people:e,sharer:t,narrow:n})=>{let r=e.slice(0,Zt),i=e.length-r.length;return(0,J.jsxs)(`div`,{className:V(`flex size-full min-h-0 gap-2`,n?`flex-col`:`flex-row`),children:[(0,J.jsx)(X,{person:t,screen:!0,className:`min-h-0 flex-1`}),(0,J.jsxs)(`div`,{className:V(`flex shrink-0 gap-2`,n?`h-20 flex-row`:`w-40 flex-col`),children:[r.map(e=>(0,J.jsx)(X,{person:e,className:n?`aspect-video h-full`:`aspect-video w-full`},e.member)),i>0&&(0,J.jsxs)(`p`,{className:`flex items-center justify-center rounded-lg bg-muted px-2 text-xs text-muted-foreground`,children:[`+`,i]})]})]})},en=({layout:e,people:t,narrow:n})=>e.kind===`share`?(0,J.jsx)($t,{people:t,sharer:t.find(t=>t.member===e.sharer),narrow:n}):e.kind===`grid`?(0,J.jsx)(Qt,{people:t,columns:e.columns}):(0,J.jsxs)(`div`,{className:`relative size-full min-h-0`,children:[(0,J.jsx)(X,{person:t[0],className:`size-full`}),(0,J.jsx)(`p`,{className:`absolute inset-x-0 top-3 text-center text-sm text-white drop-shadow`,children:j(`alone`)})]}),tn=({people:e,state:t,notices:n=[],controls:r,className:i})=>{let{ref:a,width:o}=Xt(),s=o>0&&o<640,c=Ht({people:e.length,sharers:e.filter(e=>e.screen).map(e=>e.member),width:o}),l=[...t===`resuming`?[j(`reconnecting`)]:[],...n];return(0,J.jsxs)(`section`,{ref:a,"aria-label":j(`joinCall`),"data-layout":c.kind,className:V(`flex size-full min-h-0 flex-col gap-2 bg-background p-2`,i),children:[l.length>0&&(0,J.jsx)(`div`,{role:`status`,className:`flex shrink-0 flex-col gap-1`,children:l.map(e=>(0,J.jsxs)(`p`,{className:`flex items-center gap-2 rounded-md bg-warning-soft px-3 py-1.5 text-xs text-foreground`,children:[e===j(`reconnecting`)&&(0,J.jsx)(x,{className:`size-3`}),e]},e))}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1`,children:t===`joining`?(0,J.jsxs)(`p`,{role:`status`,className:`flex size-full items-center justify-center gap-2 text-muted-foreground`,children:[(0,J.jsx)(x,{className:`size-4`}),j(`connecting`)]}):(0,J.jsx)(en,{layout:c,people:e,narrow:s})}),(0,J.jsx)(Yt,{...r}),e.filter(e=>!e.self).flatMap(e=>[[`microphone`,e.microphone],[`screen-audio`,e.screenAudio]].map(([t,n])=>n&&{key:`${e.member} ${t}`,track:n})).filter(e=>e!==void 0).map(({key:e,track:t})=>(0,J.jsx)(It,{track:t},e))]})},nn=200,rn=1e3,an=(e,t)=>{e.getFloatTimeDomainData(t);let n=0;for(let e of t)n+=e*e;return Math.min(1,Math.sqrt(n/t.length)*4)},on=e=>{let[t,n]=(0,Y.useState)(),r=[...e].map(([e,t])=>`${e}:${t.id}`).join(`,`);return(0,Y.useEffect)(()=>{if(e.size===0||typeof AudioContext>`u`)return;let t=new AudioContext,r=new Map([...e].map(([e,n])=>{let r=t.createAnalyser();return r.fftSize=512,t.createMediaStreamSource(new MediaStream([n])).connect(r),[e,r]})),i=new Float32Array(512),a,o=setInterval(()=>{let e=Gt(new Map([...r].map(([e,t])=>[e,an(t,i)])));e&&(a={member:e,at:Date.now()}),n(a&&Date.now()-a.at<rn?a.member:void 0)},nn);return()=>{clearInterval(o),t.close()}},[r]),t},sn=new Set([`NotAllowedError`,`SecurityError`]),cn=new Set([`NotFoundError`,`NotReadableError`,`OverconstrainedError`]),ln=async(e,t)=>{try{return{track:(await e.getUserMedia({[t]:!0})).getTracks()[0],blocked:!1}}catch(e){if(!(e instanceof DOMException))throw e;if(sn.has(e.name))return{blocked:!0};if(cn.has(e.name))return{blocked:!1};throw e}},un=async(e=navigator.mediaDevices)=>{try{let t=await e.getUserMedia({audio:!0,video:!0});return{microphone:t.getAudioTracks()[0],camera:t.getVideoTracks()[0],blocked:{microphone:!1,camera:!1},none:!1}}catch(e){if(!(e instanceof DOMException)||!(sn.has(e.name)||cn.has(e.name)))throw e}let[t,n]=[await ln(e,`audio`),await ln(e,`video`)];return{...t.track&&{microphone:t.track},...n.track&&{camera:n.track},blocked:{microphone:t.blocked,camera:n.blocked},none:!t.track&&!n.track&&!t.blocked&&!n.blocked}},dn=2e3,Z=e=>{for(let t of e)t?.stop()},fn=e=>{let[t,n]=(0,Y.useState)({kind:`check`}),[r,i]=(0,Y.useState)(),[a,o]=(0,Y.useState)(!0),[s,c]=(0,Y.useState)(!0),[l,u]=(0,Y.useState)([]),[d,f]=(0,Y.useState)([]),[p,m]=(0,Y.useState)([]),[h,g]=(0,Y.useState)(),[ee,_]=(0,Y.useState)(!1),v=(0,Y.useRef)(void 0),y=(0,Y.useRef)(!1),b=(0,Y.useRef)([]),x=(0,Y.useRef)(new Map),S=(0,Y.useRef)(Promise.resolve(void 0));(0,Y.useEffect)(()=>{let e=!1;return y.current=!1,S.current=un().then(t=>{if(e){Z([t.microphone,t.camera]);return}return b.current.push(t.microphone,t.camera),i(t),t}),()=>{e=!0,y.current=!0,v.current?.leave(),v.current=void 0,Z(b.current),b.current=[]}},[]),(0,Y.useEffect)(()=>{for(let{member:e}of d)x.current.has(e)||x.current.set(e,Date.now())},[d]),(0,Y.useEffect)(()=>{if(t.kind!==`in`)return;let e=setInterval(()=>void v.current?.connections().then(m),dn);return()=>clearInterval(e)},[t.kind]);let C=(0,Y.useCallback)(async()=>{n({kind:`joining`});let{joinCall:t,PublishRefused:r}=await mt(async()=>{let{joinCall:e,PublishRefused:t}=await import(`./calls-C63xSTRj.js`);return{joinCall:e,PublishRefused:t}},[]),i=await t({url:e,onTracks:u,onMembers:f,onState:e=>{(e.state===`joined`||e.state===`resuming`)&&n({kind:`in`,resuming:e.state===`resuming`}),e.state===`left`&&n({kind:`left`,reason:e.reason})}}).then(e=>e,()=>void 0);if(!i)return;if(y.current)return i.leave();v.current=i;let o=await S.current,c={...o?.microphone&&{microphone:o.microphone},...o?.camera&&{camera:o.camera}};await i.publish(c).then(()=>{c.microphone&&i.mute(`microphone`,!a),c.camera&&i.mute(`camera`,!s)},e=>{if(!(e instanceof r))throw e;_(!0)})},[e,a,s]),w=(0,Y.useCallback)(()=>{let e=!a;o(e),r?.microphone&&(r.microphone.enabled=e),v.current?.mute(`microphone`,!e)},[a,r]),T=(0,Y.useCallback)(()=>{let e=!s;c(e),r?.camera&&(r.camera.enabled=e),v.current?.mute(`camera`,!e)},[s,r]),E=(0,Y.useCallback)(async e=>{g(void 0),Z([e.video,e.audio]),await v.current?.unpublish(`screen`),e.audio&&await v.current?.unpublish(`screen-audio`)},[]),D=(0,Y.useCallback)(async()=>{if(h)return E(h);let e;try{e=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0})}catch(e){if(e instanceof DOMException&&e.name===`NotAllowedError`)return;throw e}let t={video:e.getVideoTracks()[0],...e.getAudioTracks()[0]&&{audio:e.getAudioTracks()[0]}};b.current.push(t.video,t.audio),t.video.addEventListener(`ended`,()=>void E(t)),await v.current?.publish({screen:t.video,...t.audio&&{"screen-audio":t.audio}}),g(t)},[h,E]),O=typeof navigator<`u`&&typeof navigator.mediaDevices?.getDisplayMedia==`function`;return{phase:t,devices:r,microphoneOn:a,cameraOn:s,tracks:l,members:d,connections:p,screen:h,refusedSending:ee,seen:x.current,self:v.current?.participant,join:C,toggleMicrophone:w,toggleCamera:T,...O&&{toggleScreen:D}}},pn=(e,t)=>[...e?.blocked.microphone?[j(`noMicrophone`)]:[],...e?.blocked.camera?[j(`noCamera`)]:[],...e?.none?[j(`noDevices`)]:[],...t?[j(`refused`)]:[]],mn=({url:e,leave:t,nameOf:n=e=>e,className:r})=>{let i=fn(e),a=w(),o=a?.state.kind===`signed-in`?a.state.user:void 0,s=i.self??o?.id??``,[c]=(0,Y.useState)(()=>Date.now()),{devices:l,phase:u}=i,d={...l?.microphone&&{microphone:l.microphone},...l?.camera&&{camera:l.camera},...i.screen&&{screen:i.screen.video},microphoneOn:i.microphoneOn,cameraOn:i.cameraOn},f=new Map([...l?.microphone&&i.microphoneOn?[[s,l.microphone]]:[],...i.tracks.filter(e=>e.source===`microphone`&&e.track&&!e.muted).map(e=>[e.member,e.track])]),p=on(u.kind===`in`?f:new Map),m=pn(l,i.refusedSending);if(u.kind===`left`)return(0,J.jsx)(Bt,{reason:u.reason,onJoinAgain:()=>void i.join()});if(u.kind===`check`)return(0,J.jsx)(Rt,{name:o?.name??j(`you`),member:s,...l?.camera&&{camera:l.camera},microphoneOn:i.microphoneOn,cameraOn:i.cameraOn,microphone:!!l?.microphone,cameraAvailable:!!l?.camera,notices:m,onMicrophone:i.toggleMicrophone,onCamera:i.toggleCamera,onJoin:()=>void i.join(),cancel:t});let h=qt({members:i.members,self:s,tracks:i.tracks,own:d,nameOf:n,...p&&{speaker:p},connections:i.connections,seen:i.seen,now:Math.max(c,Date.now())});return(0,J.jsx)(tn,{...r&&{className:r},people:h,state:u.kind===`joining`?`joining`:u.resuming?`resuming`:`joined`,notices:m,controls:{microphoneOn:i.microphoneOn&&!!l?.microphone,cameraOn:i.cameraOn&&!!l?.camera,sharing:!!i.screen,onMicrophone:i.toggleMicrophone,onCamera:i.toggleCamera,...i.toggleScreen&&{onShare:()=>void i.toggleScreen()},leave:t}})},Q=(e,t)=>{let{address:n,href:r,open:i}=A(),a=n?.kind===`record`&&n.resource===e&&n.key===t&&n.call===`join`,o=e=>({href:e,onFollow:()=>i(e)});return{joining:a,join:o(r({kind:`record`,resource:e,key:t,call:`join`})),leave:o(r({kind:`record`,resource:e,key:t}))}},hn=({resource:e,recordKey:t,...n})=>{let{joining:r,leave:i}=Q(e,t);return r?(0,J.jsx)(mn,{leave:i,...n},`${e}/${t}`):null},$=(e,t)=>{let n=y(),r=a(),o=I.recordCalls(e,t),s=i({queryKey:o,queryFn:()=>n.calls(e,t)});return(0,Y.useEffect)(()=>{let i=I.recordCalls(e,t),a=n.channel(e,t),o=a.on(xe,e=>e.server&&r.setQueryData(i,e.payload.items)),s=a.onStatus(e=>e.state===`joined`&&void r.invalidateQueries({queryKey:i}));return()=>{o(),s(),a.leave()}},[n,r,e,t]),{...s,ongoing:s.data?.find(e=>e.ended_at===null)}},gn=({resource:e,recordKey:t,className:n})=>{let{ongoing:r,isPending:i}=$(e,t),{joining:a,join:o}=Q(e,t);if(i)return null;if(!r)return a?null:(0,J.jsxs)(g,{to:o,className:V(u({size:`sm`}),n),children:[(0,J.jsx)(bt,{className:`size-3.5`}),j(`startCall`)]});let s=r.members.length;return(0,J.jsxs)(`span`,{role:`status`,className:V(`inline-flex items-center gap-1.5 rounded-md bg-success-soft px-2 py-0.5 text-body text-foreground`,n),children:[(0,J.jsx)(bt,{className:`size-3.5 text-success`}),j(`inProgress`),(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,J.jsx)(`span`,{"aria-label":j(`people`,s),children:s}),!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,J.jsx)(g,{to:o,className:u({variant:`primary`,size:`sm`}),children:j(`join`)})]})]})},_n={width:640,height:480},vn=e=>e.flatMap(e=>{if(`src`in e)return[{image:{url:e.src},alt:e.alt}];let t=m(e,_n);return t?[{image:t,alt:e.alt??``}]:[]}),yn=({images:e,label:t,fit:n=`cover`,swipe:r=!0,className:i})=>{let a=vn(e),o=be(a.length);return(0,J.jsxs)(`div`,{role:`group`,"aria-roledescription":`carousel`,"aria-label":t,className:V(`group/carousel relative overflow-hidden`,i),children:[(0,J.jsx)(Ce,{"data-carousel-track":!0,carousel:o,swipe:r,slides:a.map(({image:e,alt:t})=>(0,J.jsx)(Ze,{image:e,alt:t,loading:`lazy`,className:V(`size-full`,n===`cover`?`object-cover`:`object-contain`)}))}),(0,J.jsx)(ce,{carousel:o,count:a.length,swipe:r,reveal:`group-hover/carousel:opacity-100`,className:`inset-0`})]})},bn=({name:e,label:t,options:n,value:r,onChange:i})=>(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":t,className:`flex flex-col gap-2`,children:n.map(t=>(0,J.jsxs)(`label`,{className:V(`block rounded-lg border p-3 transition-colors has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-primary`,t.disabled?`cursor-default bg-background opacity-60`:t.value===r?`cursor-pointer border-primary bg-primary-soft`:`cursor-pointer bg-background hover:bg-surface`),children:[(0,J.jsx)(`input`,{type:`radio`,name:e,value:t.value,checked:t.value===r,disabled:t.disabled,onChange:()=>i(t.value),className:`sr-only`}),(0,J.jsx)(`span`,{className:V(`block font-medium`,t.value===r&&`text-primary-text`),children:t.label}),t.description&&(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-snug text-muted-foreground`,children:t.description})]},t.value))}),xn=(e,t,n)=>{let o=y(),s=a(),c=[...new Set(n)].sort();return i({queryKey:I.pickedLabels(e.name,c.join(`,`)),enabled:c.length>0,placeholderData:r,queryFn:()=>$e(s,o,e,c,t)}).data??new Map},Sn=e=>{let{resources:t,views:n}=_e(),r=t[e.resource];if(!r)throw Error(`RecordPicker: the app has no resource named "${e.resource}"`);if(r.primaryKey.length!==1)throw Error(`RecordPicker: "${e.resource}" has a composite key, which a picker cannot name`);let i=n[e.resource],a=e.multiple?e.value:e.value===void 0?[]:[e.value],[o,s]=(0,Y.useState)({}),c=xn(r,i,a),l=e=>o[e]??c.get(e)??e,u=(e,t)=>s(n=>({...n,[e]:t}));if(!e.multiple){let{value:t,onChange:n}=e;return(0,J.jsx)(P,{target:r,view:i,value:t??``,label:t===void 0?void 0:l(t),invalid:e.invalid,onChange:(e,t)=>{u(e,t),n(e)}})}let{value:d,onChange:f}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(P,{target:r,view:i,value:``,chosen:d,several:!0,invalid:e.invalid,onChange:(e,t)=>{u(e,t),f(d.includes(e)?d.filter(t=>t!==e):[...d,e])}}),d.length>0&&(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:d.map(e=>(0,J.jsx)(it,{label:l(e),onRemove:()=>f(d.filter(t=>t!==e))},e))})]})};export{de as ActionCard,Ae as ActionInputError,ye as ApiProvider,tt as App,R as AppLink,Xe as AssistantDock,v as AuthLayout,Me as AvailabilityMark,z as Button,gn as CallMark,mn as CallView,yn as Carousel,At as ChatDivider,s as ChatMessage,Be as ChatThread,bn as Choices,ft as CodeForm,Oe as CompactTable,st as Composer,ue as Dialog,we as DiffView,Ve as Field,ct as FieldList,rt as Form,ze as Input,qe as LogoMark,Ue as Markdown,h as MentionBox,pe as MentionedText,T as MenuSelect,Ge as OtpInput,Ie as PartView,hn as RecordCall,jt as RecordLink,Sn as RecordPicker,l as ResendCodeButton,O as ResponsiveDialog,oe as Section,pt as Segmented,d as SidePanel,o as SignInPrompt,x as Spinner,nt as StatusMark,Pe as StepList,f as Textarea,ge as allowDelayMs,u as buttonClass,kt as chatDayLabel,Fe as definePlugin,Te as defineUi,at as diffStats,p as emptyDraft,Ke as isConflict,b as isFramed,ae as mentionedIds,D as mergeUi,ut as parseDiff,se as pluginApi,ee as protobaseVersion,Ot as sameChatDay,dt as statusRefreshMs,le as uiFromModule,re as useApiToken,A as useAppAddress,me as useArmedAfterFocus,Ne as useAssistant,je as useAssistantClient,We as useBackendData,y as useClient,Re as useFacets,ne as useFieldControl,ve as useGuardedPress,De as useHistogram,Le as useInbox,L as useLayoutRecord,fe as useList,C as useListDisplay,Ee as useMarkNotificationsRead,ot as useMembers,he as useMeta,ke as useOwnStatus,S as usePlugin,He as usePresence,et as usePushNotifications,te as useRecord,Q as useRecordCallAddress,$ as useRecordCalls,E as useResourceClient,Ye as useSeries,Nt as useSignedInUser,lt as useStatuses,Je as useUnreadNotifications,Qe as useUpdateRecord};
|
|
2
|
+
//# debugId=97f3411c-b648-4ca9-acbb-6be69060b6df
|
package/dist/shell/index.html
CHANGED
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
}
|
|
19
19
|
document.documentElement.dataset.theme = stored === 'light' || stored === 'dark' ? stored : matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
|
20
20
|
</script>
|
|
21
|
-
<script type="importmap">{"imports":{"react":"/assets/shared-react-CuZpzdyh.js","react/jsx-runtime":"/assets/shared-react-jsx-runtime-Csr2Kx2w.js","react-dom":"/assets/shared-react-dom-BNlY7-7i.js","@protobase/ui":"/assets/shared-protobase-ui-
|
|
22
|
-
<script type="module" crossorigin src="/assets/index-
|
|
21
|
+
<script type="importmap">{"imports":{"react":"/assets/shared-react-CuZpzdyh.js","react/jsx-runtime":"/assets/shared-react-jsx-runtime-Csr2Kx2w.js","react-dom":"/assets/shared-react-dom-BNlY7-7i.js","@protobase/ui":"/assets/shared-protobase-ui-CX80Ectk.js"}}</script>
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-D8oHLXjS.js"></script>
|
|
23
23
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/assets/react-CR5VJ85Q.js">
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/vendor-xNCj9Gc_.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/cn-Bi0ZEjD9.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-SYSsmQ2O.js">
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/app-
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/app-B_ojAtG3.js">
|
|
29
29
|
<link rel="stylesheet" crossorigin href="/assets/app-GUjJKojE.css">
|
|
30
30
|
<link rel="stylesheet" crossorigin href="/assets/index-BgcF_WZ0.css">
|
|
31
31
|
<link rel="stylesheet" href="/protobase.theme.css">
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"protobase": "0.62.
|
|
2
|
+
"protobase": "0.62.4",
|
|
3
3
|
"pluginApi": 1,
|
|
4
4
|
"paths": [
|
|
5
5
|
"/index.html",
|
|
6
6
|
"/assets",
|
|
7
7
|
"/protobase.sw.js"
|
|
8
8
|
],
|
|
9
|
-
"builtAt":
|
|
9
|
+
"builtAt": 1793317213952,
|
|
10
10
|
"native": {
|
|
11
11
|
"@capacitor/android": "8.5.3",
|
|
12
12
|
"@capacitor/app": "8.1.2",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const cacheName = "protobase-shell-
|
|
2
|
-
const precache = ["/index.html","/assets/shared-react-CuZpzdyh.js","/assets/shared-react-jsx-runtime-Csr2Kx2w.js","/assets/shared-react-dom-BNlY7-7i.js","/assets/shared-protobase-ui-
|
|
1
|
+
const cacheName = "protobase-shell-05d59f22d77a949d"
|
|
2
|
+
const precache = ["/index.html","/assets/shared-react-CuZpzdyh.js","/assets/shared-react-jsx-runtime-Csr2Kx2w.js","/assets/shared-react-dom-BNlY7-7i.js","/assets/shared-protobase-ui-CX80Ectk.js","/assets/index-D8oHLXjS.js","/assets/rolldown-runtime-hePW80VL.js","/assets/react-CR5VJ85Q.js","/assets/vendor-xNCj9Gc_.js","/assets/cn-Bi0ZEjD9.js","/assets/preload-helper-SYSsmQ2O.js","/assets/app-B_ojAtG3.js","/assets/app-GUjJKojE.css","/assets/index-BgcF_WZ0.css","/protobase.theme.css","/protobase.favicon.svg"]
|
|
3
3
|
const revalidated = ["/protobase.theme.css","/protobase.favicon.svg"]
|
|
4
4
|
|
|
5
5
|
const fromCache = (request) =>
|