@crewlethq/artifact-kit 0.66.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kit.css +1 -1
- package/dist/kit.js +1 -1
- package/dist/theme.js +1 -1
- package/package.json +4 -4
package/dist/kit.js
CHANGED
|
@@ -9,4 +9,4 @@ Error generating stack: `+n.message+`
|
|
|
9
9
|
`).replace(Bx,"")}function m2(e,t){return t=wg(t),wg(e)===t}function we(e,t,a,n,l,r){switch(a){case"children":if(typeof n=="string")t==="body"||t==="textarea"&&n===""||Hr(e,n);else if(typeof n=="number"||typeof n=="bigint")t!=="body"&&Hr(e,""+n);else return;break;case"className":ps(e,"class",n);break;case"tabIndex":ps(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":ps(e,a,n);break;case"style":fm(e,n,r);return;case"data":if(t!=="object"){ps(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=ks(n),e.setAttribute(a,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof r=="function"&&(a==="formAction"?(t!=="input"&&we(e,t,"name",l.name,l,null),we(e,t,"formEncType",l.formEncType,l,null),we(e,t,"formMethod",l.formMethod,l,null),we(e,t,"formTarget",l.formTarget,l,null)):(we(e,t,"encType",l.encType,l,null),we(e,t,"method",l.method,l,null),we(e,t,"target",l.target,l,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=ks(n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=Xa);return;case"onScroll":n!=null&&ae("scroll",e);return;case"onScrollEnd":n!=null&&ae("scrollend",e);return;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(E(61));if(a=n.__html,a!=null){if(l.children!=null)throw Error(E(60));r?.__html!==a&&(e.innerHTML=a)}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}a=ks(n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":n===!0?e.setAttribute(a,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(a,n):e.removeAttribute(a);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(a):e.setAttribute(a,n);break;case"popover":ae("beforetoggle",e),ae("toggle",e),Cs(e,"popover",n);break;case"xlinkActuate":cn(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":cn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":cn(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":cn(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":cn(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":cn(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":cn(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":cn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":cn(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Cs(e,"is",n);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=i4.get(a)||a,Cs(e,a,n);else return}ce=!0}function vh(e,t,a,n,l,r){switch(a){case"style":fm(e,n,r);return;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(E(61));if(a=n.__html,a!=null){if(l.children!=null)throw Error(E(60));r?.__html!==a&&(e.innerHTML=a)}}break;case"children":if(typeof n=="string")Hr(e,n);else if(typeof n=="number"||typeof n=="bigint")Hr(e,""+n);else return;break;case"onScroll":n!=null&&ae("scroll",e);return;case"onScrollEnd":n!=null&&ae("scrollend",e);return;case"onClick":n!=null&&(e.onclick=Xa);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!om.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(l=a.endsWith("Capture"),r=a.slice(2,l?a.length-7:void 0),t=e[Jt]||null,t=t!=null?t[a]:null,typeof t=="function"&&e.removeEventListener(r,t,l),typeof n=="function")){typeof t!="function"&&t!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(r,n,l);break e}ce=!0,a in e?e[a]=n:n===!0?e.setAttribute(a,""):Cs(e,a,n)}return}ce=!0}function At(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ae("error",e),ae("load",e);var n=!1,l=!1,r;for(r in a)if(a.hasOwnProperty(r)){var i=a[r];if(i!=null)switch(r){case"src":n=!0;break;case"srcSet":l=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(E(137,t));default:we(e,t,r,i,a,null)}}l&&we(e,t,"srcSet",a.srcSet,a,null),n&&we(e,t,"src",a.src,a,null);return;case"input":ae("invalid",e);var o=r=i=l=null,s=null,c=null;for(n in a)if(a.hasOwnProperty(n)){var d=a[n];if(d!=null)switch(n){case"name":l=d;break;case"type":i=d;break;case"checked":s=d;break;case"defaultChecked":c=d;break;case"value":r=d;break;case"defaultValue":o=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(E(137,t));break;default:we(e,t,n,d,a,null)}}um(e,r,o,s,c,i,l,!1);return;case"select":ae("invalid",e),n=i=r=null;for(l in a)if(a.hasOwnProperty(l)&&(o=a[l],o!=null))switch(l){case"value":r=o;break;case"defaultValue":i=o;break;case"multiple":n=o;default:we(e,t,l,o,a,null)}t=r,a=i,e.multiple=!!n,t!=null?Tr(e,!!n,t,!1):a!=null&&Tr(e,!!n,a,!0);return;case"textarea":ae("invalid",e),r=l=n=null;for(i in a)if(a.hasOwnProperty(i)&&(o=a[i],o!=null))switch(i){case"value":n=o;break;case"defaultValue":l=o;break;case"children":r=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(E(91));break;default:we(e,t,i,o,a,null)}hm(e,n,l,r);return;case"option":for(s in a)a.hasOwnProperty(s)&&(n=a[s],n!=null)&&(s==="selected"?e.selected=n&&typeof n!="function"&&typeof n!="symbol":we(e,t,s,n,a,null));return;case"dialog":ae("beforetoggle",e),ae("toggle",e),ae("cancel",e),ae("close",e);break;case"iframe":case"object":ae("load",e);break;case"video":case"audio":for(n=0;n<co.length;n++)ae(co[n],e);break;case"image":ae("error",e),ae("load",e);break;case"details":ae("toggle",e);break;case"embed":case"source":case"link":ae("error",e),ae("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in a)if(a.hasOwnProperty(c)&&(n=a[c],n!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(E(137,t));default:we(e,t,c,n,a,null)}return;default:if(Rh(t)){for(d in a)a.hasOwnProperty(d)&&(n=a[d],n!==void 0&&vh(e,t,d,n,a,void 0));return}}for(o in a)a.hasOwnProperty(o)&&(n=a[o],n!=null&&we(e,t,o,n,a,null))}var qx={};function Vx(e,t,a,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var l=null,r=null,i=null,o=null,s=null,c=null,d=null;for(m in a){var v=a[m];if(a.hasOwnProperty(m)&&v!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":s=v;default:n.hasOwnProperty(m)||we(e,t,m,null,n,v)}}for(var u in n){var m=n[u];if(v=a[u],n.hasOwnProperty(u)&&(m!=null||v!=null))switch(u){case"type":m!==v&&(ce=!0),r=m;break;case"name":m!==v&&(ce=!0),l=m;break;case"checked":m!==v&&(ce=!0),c=m;break;case"defaultChecked":m!==v&&(ce=!0),d=m;break;case"value":m!==v&&(ce=!0),i=m;break;case"defaultValue":m!==v&&(ce=!0),o=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(E(137,t));break;default:m!==v&&we(e,t,u,m,n,v)}}Od(e,i,o,s,c,d,r,l);return;case"select":m=i=o=u=null;for(r in a)if(s=a[r],a.hasOwnProperty(r)&&s!=null)switch(r){case"value":break;case"multiple":m=s;default:n.hasOwnProperty(r)||we(e,t,r,null,n,s)}for(l in n)if(r=n[l],s=a[l],n.hasOwnProperty(l)&&(r!=null||s!=null))switch(l){case"value":r!==s&&(ce=!0),u=r;break;case"defaultValue":r!==s&&(ce=!0),o=r;break;case"multiple":r!==s&&(ce=!0),i=r;default:r!==s&&we(e,t,l,r,n,s)}t=o,a=i,n=m,u!=null?Tr(e,!!a,u,!1):!!n!=!!a&&(t!=null?Tr(e,!!a,t,!0):Tr(e,!!a,a?[]:"",!1));return;case"textarea":m=u=null;for(o in a)if(l=a[o],a.hasOwnProperty(o)&&l!=null&&!n.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:we(e,t,o,null,n,l)}for(i in n)if(l=n[i],r=a[i],n.hasOwnProperty(i)&&(l!=null||r!=null))switch(i){case"value":l!==r&&(ce=!0),u=l;break;case"defaultValue":l!==r&&(ce=!0),m=l;break;case"children":break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(E(91));break;default:l!==r&&we(e,t,i,l,n,r)}dm(e,u,m);return;case"option":for(var b in a)u=a[b],a.hasOwnProperty(b)&&u!=null&&!n.hasOwnProperty(b)&&(b==="selected"?e.selected=!1:we(e,t,b,null,n,u));for(s in n)u=n[s],m=a[s],n.hasOwnProperty(s)&&u!==m&&(u!=null||m!=null)&&(s==="selected"?(u!==m&&(ce=!0),e.selected=u&&typeof u!="function"&&typeof u!="symbol"):we(e,t,s,u,n,m));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var y in a)u=a[y],a.hasOwnProperty(y)&&u!=null&&!n.hasOwnProperty(y)&&we(e,t,y,null,n,u);for(c in n)if(u=n[c],m=a[c],n.hasOwnProperty(c)&&u!==m&&(u!=null||m!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(E(137,t));break;default:we(e,t,c,u,n,m)}return;default:if(Rh(t)){for(var S in a)u=a[S],a.hasOwnProperty(S)&&u!==void 0&&!n.hasOwnProperty(S)&&vh(e,t,S,void 0,n,u);for(d in n)u=n[d],m=a[d],!n.hasOwnProperty(d)||u===m||u===void 0&&m===void 0||vh(e,t,d,u,n,m);return}}for(var h in a)u=a[h],a.hasOwnProperty(h)&&u!=null&&!n.hasOwnProperty(h)&&we(e,t,h,null,n,u);for(v in n)u=n[v],m=a[v],!n.hasOwnProperty(v)||u===m||u==null&&m==null||we(e,t,v,u,n,m)}function yg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Yx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),n=0;n<a.length;n++){var l=a[n],r=l.transferSize,i=l.initiatorType,o=l.duration;if(r&&o&&yg(i)){for(i=0,o=l.responseEnd,n+=1;n<a.length;n++){var s=a[n],c=s.startTime;if(c>o)break;var d=s.transferSize,v=s.initiatorType;d&&yg(v)&&(s=s.responseEnd,i+=d*(s<o?1:(o-c)/(s-c)))}if(--n,t+=8*(r+i)/(l.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var wh=null,yh=null;function ho(e){return e.nodeType===9?e:e.ownerDocument}function bg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function v2(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function w2(e,t,a,n){return a=ho(a).createElement(e),a[_t]=n,a[Jt]=t,At(a,e,t),gt(a),a}function bh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var pd=null;function jx(){var e=window.event;return e&&e.type==="popstate"?e===pd?!1:(pd=e,!0):(pd=null,!1)}var bf=typeof setTimeout=="function"?setTimeout:void 0,Kx=typeof clearTimeout=="function"?clearTimeout:void 0,xg=typeof Promise=="function"?Promise:void 0,_g=typeof requestAnimationFrame=="function"?requestAnimationFrame:bf,Ix=typeof queueMicrotask=="function"?queueMicrotask:typeof xg<"u"?function(e){return xg.resolve(null).then(e).catch(Xx)}:bf;function Xx(e){setTimeout(function(){throw e})}function il(e){return e==="head"}function Tg(e,t){var a=t,n=0;do{var l=a.nextSibling;if(e.removeChild(a),l&&l.nodeType===8)if(a=l.data,a==="/$"||a==="/&"){if(n===0){e.removeChild(l),Kr(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")md(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,md(a);for(var r=a.firstChild;r;){var i=r.nextSibling,o=r.nodeName;r[xo]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&r.rel.toLowerCase()==="stylesheet"||a.removeChild(r),r=i}}else a==="body"&&md(e.ownerDocument.body);a=l}while(a);Kr(t)}function Eg(e,t){var a=e;e=0;do{var n=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=n}while(a)}function y2(e,t,a){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,a!=null&&(e.style.viewTransitionClass=a),a=getComputedStyle(e),a.display==="inline"){if(t=e.getClientRects(),t.length===1)var n=1;else for(var l=n=0;l<t.length;l++){var r=t[l];0<r.width&&0<r.height&&n++}n===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+a.paddingTop,e.marginBottom="-"+a.paddingBottom)}}function b2(e,t){e=e.style,t=t.style;var a=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(a=t.display,e.display=a==null||typeof a=="boolean"?"":a,a=t.margin,a!=null?e.margin=a:(a=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=a==null||typeof a=="boolean"?"":a,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function x2(e,t,a){return a=a.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=a.innerHeight&&e.left<=a.innerWidth}}function xh(e){var t=e.getBoundingClientRect(),a=getComputedStyle(e);return x2(t,a,e)}function Qx(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var a=getComputedStyle(e);return x2(t,a,e)}function Zx(e){return e.documentElement.clientHeight}function Jx(e){this.addEventListener("load",e),this.addEventListener("error",e)}function Fx(e,t,a,n,l,r,i,o,s){var c=t.nodeType===9?t:t.ownerDocument;try{var d=c.startViewTransition({update:function(){var u=c.defaultView,m=u.navigation&&u.navigation.transition,b=c.fonts.status;n();var y=[];if(b==="loaded"&&(Zx(c),c.fonts.status==="loading"&&y.push(c.fonts.ready)),b=y.length,e!==null)for(var S=e.suspenseyImages,h=0,f=0;f<S.length;f++){var p=S[f];if(!p.complete){var w=p.getBoundingClientRect();if(0<w.bottom&&0<w.right&&w.top<u.innerHeight&&w.left<u.innerWidth){if(h+=R2(p),h>Qs){y.length=b;break}p=new Promise(Jx.bind(p)),y.push(p)}}}if(0<y.length)return u=Promise.race([Promise.all(y),new Promise(function(T){return setTimeout(T,500)})]).then(l,l),(m?Promise.allSettled([m.finished,u]):u).then(r,r);if(l(),m)return m.finished.then(r,r);r()},types:a});c.__reactViewTransition=d;var v=[];return d.ready.then(function(){for(var u=c.documentElement.getAnimations({subtree:!0}),m=0;m<u.length;m++){var b=u[m],y=b.effect,S=y.pseudoElement;if(S!=null&&S.startsWith("::view-transition")){v.push(b),b=y.getKeyframes();for(var h=S=void 0,f=!0,p=0;p<b.length;p++){var w=b[p],T=w.width;if(S===void 0)S=T;else if(S!==T){f=!1;break}if(T=w.height,h===void 0)h=T;else if(h!==T){f=!1;break}delete w.width,delete w.height,w.transform==="none"&&delete w.transform}f&&S!==void 0&&h!==void 0&&(y.setKeyframes(b),f=getComputedStyle(y.target,y.pseudoElement),f.width!==S||f.height!==h)&&(f=b[0],f.width=S,f.height=h,f=b[b.length-1],f.width=S,f.height=h,y.setKeyframes(b))}}i()},function(u){c.__reactViewTransition===d&&(c.__reactViewTransition=null);try{typeof u=="object"&&u!==null&&u.name==="InvalidStateError"&&(u.message==="View transition was skipped because document visibility state is hidden."||u.message==="Skipping view transition because document visibility state has become hidden."||u.message==="Skipping view transition because viewport size changed."||u.message==="Transition was aborted because of invalid state")&&(u=null),u!==null&&s(u)}finally{n(),l(),i()}}),d.finished.finally(function(){for(var u=0;u<v.length;u++)v[u].cancel();c.__reactViewTransition===d&&(c.__reactViewTransition=null),o()}),d}catch{return n(),l(),i(),null}}function Tl(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}Tl.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:Ne({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)};Tl.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,a=e.getAnimations({subtree:!0}),n=[],l=0;l<a.length;l++){var r=a[l].effect;r!==null&&r.target===e&&r.pseudoElement===t&&n.push(a[l])}return n};Tl.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function _2(e){return{name:e,group:new Tl("group",e),imagePair:new Tl("image-pair",e),old:new Tl("old",e),new:new Tl("new",e)}}function oa(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}oa.prototype.addEventListener=function(e,t,a){var n=null,l=null;if(!(a!=null&&typeof a!="boolean"&&(n=a.signal||null,n!==null&&n.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var r=this._eventListeners;if(T2(r,e,t,a)===-1){var i=this,o=t;a!=null&&typeof a!="boolean"&&a.once===!0&&(o=function(s){i.removeEventListener(e,t,a),typeof t=="function"?t.call(this,s):t.handleEvent(s)}),n!==null&&(l=i.removeEventListener.bind(i,e,t,a),n.addEventListener("abort",l,{once:!0}),l=n.removeEventListener.bind(n,"abort",l)),n=qr(a),r.push({type:e,listener:t,optionsOrUseCapture:a,attachedListener:o,cleanup:l}),Zt(this._fragmentFiber.child,!1,$x,e,o,n)}this._eventListeners=r}};function $x(e,t,a,n){return lt(e).addEventListener(t,a,n),!1}oa.prototype.removeEventListener=function(e,t,a){var n=this._eventListeners;if(n!==null&&(t=T2(n,e,t,a),t!==-1)){var l=n[t];a=l.attachedListener;var r=l.cleanup;l=qr(l.optionsOrUseCapture),Zt(this._fragmentFiber.child,!1,Wx,e,a,l),n.splice(t,1),r!==null&&r()}};function Wx(e,t,a,n){return lt(e).removeEventListener(t,a,n),!1}function qr(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Sg(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function T2(e,t,a,n){if(e.length===0)return-1;n=Sg(n);for(var l=0;l<e.length;l++){var r=e[l];if(r.type===t&&r.listener===a&&Sg(r.optionsOrUseCapture)===n)return l}return-1}oa.prototype.dispatchEvent=function(e){var t=Ll(this._fragmentFiber);if(t===null)return!0;t=lt(t);var a=this._eventListeners;if(a!==null&&0<a.length||!e.bubbles){var n=t.nodeType===9?t.createComment(""):document.createTextNode("");if(a)for(var l=0;l<a.length;l++){var r=a[l];n.addEventListener(r.type,r.attachedListener,qr(r.optionsOrUseCapture))}if(t.appendChild(n),e=n.dispatchEvent(e),a)for(l=0;l<a.length;l++)r=a[l],n.removeEventListener(r.type,r.attachedListener,qr(r.optionsOrUseCapture));return t.removeChild(n),e}return t.dispatchEvent(e)};oa.prototype.focus=function(e){Zt(this._fragmentFiber.child,!0,E2,e,void 0,void 0)};function E2(e,t){return e.tag===6?!1:(e=lt(e),u3(e,t))}oa.prototype.focusLast=function(e){var t=[];Zt(this._fragmentFiber.child,!0,xf,t,void 0,void 0);for(var a=t.length-1;0<=a&&!E2(t[a],e);a--);};function xf(e,t){return t.push(e),!1}oa.prototype.blur=function(){var e=Ll(this._fragmentFiber);e!==null&&(e=lt(e),e=ho(e).activeElement,e!==null&&Zt(this._fragmentFiber.child,!1,Px,e,void 0,void 0))};function Px(e,t){return e.tag===6?!1:(e=lt(e),e===t||e.contains(t)?(t.blur(),!0):!1)}oa.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),Zt(this._fragmentFiber.child,!1,e3,e,void 0,void 0)};function e3(e,t){return e.tag===6||(e=lt(e),t.observe(e)),!1}oa.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),Zt(this._fragmentFiber.child,!1,t3,e,void 0,void 0);for(var a=t=0;a<Na.length;a++){var n=Na[a];n.fragmentInstance===this&&n.observer===e?e.unobserve(n.instance):Na[t++]=n}Na.length=t}};function t3(e,t){return e.tag===6||(e=lt(e),t.unobserve(e)),!1}var Na=[],gd=!1;function a3(e,t,a){Na.push({fragmentInstance:e,observer:t,instance:a}),gd||(gd=!0,d3(function(){gd=!1;var n=Na;Na=[];for(var l=0;l<n.length;l++){var r=n[l];r.observer.unobserve(r.instance)}}))}oa.prototype.getClientRects=function(){var e=[];return Zt(this._fragmentFiber.child,!1,n3,e,void 0,void 0),e};function n3(e,t){if(e.tag===6){e=e.stateNode;var a=e.ownerDocument.createRange();a.selectNodeContents(e),t.push.apply(t,a.getClientRects())}else e=lt(e),t.push.apply(t,e.getClientRects());return!1}oa.prototype.getRootNode=function(e){var t=Ll(this._fragmentFiber);return t===null?this:lt(t).getRootNode(e)};oa.prototype.compareDocumentPosition=function(e){var t=Ll(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];Zt(this._fragmentFiber.child,!1,xf,a,void 0,void 0);var n=lt(t);if(a.length===0){if(a=n,l1(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(a=t)}t=this._fragmentFiber;var l=n=a.compareDocumentPosition(e);return a===e?l=Node.DOCUMENT_POSITION_CONTAINS:n&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=Xg(t)[1],a===null?l=Node.DOCUMENT_POSITION_PRECEDING:(e=lt(a).compareDocumentPosition(e),l=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),l|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=lt(a[0]),l=lt(a[a.length-1]);var r=l1(this._fragmentFiber)?t.parentElement:n;if(r==null)return Node.DOCUMENT_POSITION_DISCONNECTED;n=r.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,r=r.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_CONTAINED_BY;var i=t.compareDocumentPosition(e),o=l.compareDocumentPosition(e),s=i&Node.DOCUMENT_POSITION_CONTAINED_BY||o&Node.DOCUMENT_POSITION_CONTAINED_BY;return o=n&&r&&i&Node.DOCUMENT_POSITION_FOLLOWING&&o&Node.DOCUMENT_POSITION_PRECEDING,t=n&&t===e||r&&l===e||s||o?Node.DOCUMENT_POSITION_CONTAINED_BY:!n&&t===e||!r&&l===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:i,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||l3(t,this._fragmentFiber,a[0],a[a.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function l3(e,t,a,n,l){var r=_l(l);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!r)e:{for(;r!==null;){if(r.tag===7&&(r===t||r.alternate===t)){a=!0;break e}r=r.return}a=!1}return a}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(r===null)return r=l.ownerDocument,l===r||l===r.documentElement||l===r.body;e:{for(r=t,t=Ll(t);r!==null;){if(!(r.tag!==5&&r.tag!==3&&r.tag!==27||r!==t&&r.alternate!==t)){r=!0;break e}r=r.return}r=!1}return r}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!r)&&!(t=r===a)&&(t=wd(a,r,r1),t===null?t=!1:(Zt(t,!0,Hb,r,a),r=ur,ur=null,t=r!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!r)&&!(t=r===n)&&(t=wd(n,r,r1),t===null?t=!1:(Zt(t,!0,Db,r,n),r=ur,vd=ur=null,t=r!==null)),t):!1}function Ag(e,t){var a=e.ownerDocument.createRange();a.selectNodeContents(e),e=a.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}oa.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(E(566));var t=[];Zt(this._fragmentFiber.child,!1,xf,t,void 0,void 0);var a=e!==!1;if(t.length===0){var n=Xg(this._fragmentFiber);if(n=a?n[1]||n[0]||Ll(this._fragmentFiber):n[0]||n[1],n===null)return;if(n.tag===6){e=lt(n),Ag(e,a);return}if(n=lt(n),n.nodeType!==9){if(n.nodeType===11){a="host"in n?n.host:null,a!==null&&a.scrollIntoView(e);return}n.scrollIntoView(e)}}for(n=a?t.length-1:0;n!==(a?-1:t.length);){var l=t[n];l.tag===6?(l=lt(l),Ag(l,a)):lt(l).scrollIntoView(e),n+=a?-1:1}};function r3(e,t){return e=lt(e),S2(e,t),!1}function S2(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function A2(e,t){var a=t._eventListeners;if(a!==null)for(var n=0;n<a.length;n++){var l=a[n];e.addEventListener(l.type,l.attachedListener,qr(l.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(r){for(var i=0,o=0;o<Na.length;o++){var s=Na[o];(s.fragmentInstance!==t||s.observer!==r||s.instance!==e)&&(Na[i++]=s)}Na.length=i,r.observe(e)}),S2(e,t))}function i3(e,t){var a=t._eventListeners;if(a!==null)for(var n=0;n<a.length;n++){var l=a[n];e.removeEventListener(l.type,l.attachedListener,qr(l.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(r){typeof r.rootMargin=="string"?a3(t,r,e):r.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function _h(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":_h(a),Ac(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function o3(e,t,a,n){for(;e.nodeType===1;){var l=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[xo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==l.rel||e.getAttribute("href")!==(l.href==null||l.href===""?null:l.href)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin)||e.getAttribute("title")!==(l.title==null?null:l.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(l.src==null?null:l.src)||e.getAttribute("type")!==(l.type==null?null:l.type)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=l.name==null?null:""+l.name;if(l.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=wa(e.nextSibling),e===null)break}return null}function s3(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=wa(e.nextSibling),e===null))return null;return e}function M2(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=wa(e.nextSibling),e===null))return null;return e}function Th(e){return e.data==="$?"||e.data==="$~"}function _f(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function c3(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var n=function(){t(),a.removeEventListener("DOMContentLoaded",n)};a.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function wa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Eh=null;function Mg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return wa(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Ng(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function u3(e,t){function a(){n=!0}if(e.ownerDocument.activeElement===e)return!0;var n=!1;try{e.ownerDocument.addEventListener("focus",a,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",a,!0)}return n}function d3(e){_g(function(){_g(function(t){return e(t)})})}function N2(e,t,a){switch(t=ho(a),e){case"html":if(e=t.documentElement,!e)throw Error(E(452));return e;case"head":if(e=t.head,!e)throw Error(E(453));return e;case"body":if(e=t.body,!e)throw Error(E(454));return e;default:throw Error(E(451))}}function O2(e,t,a){for(var n in a){var l=a[n];a.hasOwnProperty(n)&&l!=null&&we(e,t,n,null,qx,l)}a.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Xa&&(e.onclick=null),Ac(e)}function md(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ac(e)}var ya=new Map,Og=new Set;function fo(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Tn=he.d;he.d={f:h3,r:f3,D:p3,C:g3,L:m3,m:v3,X:y3,S:w3,M:b3};function h3(){var e=Tn.f(),t=qc();return e||t}function f3(e){var t=Xr(e);t!==null&&t.tag===5&&t.type==="form"?fv(t):Tn.r(e)}var Fr=typeof document>"u"?null:document;function z2(e,t,a){var n=Fr;if(n&&typeof t=="string"&&t){var l=ga(t);l='link[rel="'+e+'"][href="'+l+'"]',typeof a=="string"&&(l+='[crossorigin="'+a+'"]'),Og.has(l)||(Og.add(l),e={rel:e,crossOrigin:a,href:t},n.querySelector(l)===null&&(t=n.createElement("link"),At(t,"link",e),gt(t),n.head.appendChild(t)))}}function p3(e){Tn.D(e),z2("dns-prefetch",e,null)}function g3(e,t){Tn.C(e,t),z2("preconnect",e,t)}function m3(e,t,a){Tn.L(e,t,a);var n=Fr;if(n&&e&&t){var l='link[rel="preload"][as="'+ga(t)+'"]';t==="image"&&a&&a.imageSrcSet?(l+='[imagesrcset="'+ga(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(l+='[imagesizes="'+ga(a.imageSizes)+'"]')):l+='[href="'+ga(e)+'"]';var r=l;switch(t){case"style":r=Vr(e);break;case"script":r=$r(e)}if(!(ya.has(r)||(e=Ne({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ya.set(r,e),n.querySelector(l)!==null||t==="style"&&n.querySelector(Mo(r))||t==="script"&&n.querySelector(No(r))))){var i=n.createElement("link");At(i,"link",e),t==="style"&&(i[ec]=!0,i.onload=i.onerror=function(){rm(i)}),gt(i),n.head.appendChild(i)}}}function v3(e,t){Tn.m(e,t);var a=Fr;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",l='link[rel="modulepreload"][as="'+ga(n)+'"][href="'+ga(e)+'"]',r=l;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=$r(e)}if(!ya.has(r)&&(e=Ne({rel:"modulepreload",href:e},t),ya.set(r,e),a.querySelector(l)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(No(r)))return}n=a.createElement("link"),At(n,"link",e),gt(n),a.head.appendChild(n)}}}function w3(e,t,a){Tn.S(e,t,a);var n=Fr;if(n&&e){var l=_r(n).hoistableStyles,r=Vr(e);t=t||"default";var i=l.get(r);if(!i){var o={loading:0,preload:null};if(i=n.querySelector(Mo(r)))o.loading=5;else{e=Ne({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ya.get(r))&&Tf(e,a);var s=i=n.createElement("link");gt(s),At(s,"link",e),s._p=new Promise(function(c,d){s.onload=c,s.onerror=d}),s.addEventListener("load",function(){o.loading|=1}),s.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Is(i,t,n)}i={type:"stylesheet",instance:i,count:1,state:o},l.set(r,i)}}}function y3(e,t){Tn.X(e,t);var a=Fr;if(a&&e){var n=_r(a).hoistableScripts,l=$r(e),r=n.get(l);r||(r=a.querySelector(No(l)),r||(e=Ne({src:e,async:!0},t),(t=ya.get(l))&&Ef(e,t),r=a.createElement("script"),gt(r),At(r,"link",e),a.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},n.set(l,r))}}function b3(e,t){Tn.M(e,t);var a=Fr;if(a&&e){var n=_r(a).hoistableScripts,l=$r(e),r=n.get(l);r||(r=a.querySelector(No(l)),r||(e=Ne({src:e,async:!0,type:"module"},t),(t=ya.get(l))&&Ef(e,t),r=a.createElement("script"),gt(r),At(r,"link",e),a.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},n.set(l,r))}}function zg(e,t,a,n){var l=(l=Kn.current)?fo(l):null;if(!l)throw Error(E(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Vr(a.href),t=_r(l).hoistableStyles,n=t.get(a),n||(n={type:"style",instance:null,count:0,state:null},t.set(a,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Vr(a.href);var r=_r(l).hoistableStyles,i=r.get(e);if(i||(l=l.ownerDocument||l,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,i),(r=l.querySelector(Mo(e)))?r._p||(i.instance=r,i.state.loading=5):(r=ya.get(e),r||(r={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ya.set(e,r)),x3(l,e,r,i.state))),t&&n===null)throw Error(E(528,""));return i}if(t&&n!==null)throw Error(E(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(a=$r(a),t=_r(l).hoistableScripts,n=t.get(a),n||(n={type:"script",instance:null,count:0,state:null},t.set(a,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(E(444,e))}}function Vr(e){return'href="'+ga(e)+'"'}function Mo(e){return'link[rel="stylesheet"]['+e+"]"}function C2(e){return Ne({},e,{"data-precedence":e.precedence,precedence:null})}function x3(e,t,a,n){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[ec]!==!0){n.loading=1;return}}else t=e.createElement("link"),t[ec]=!0,t.onload=t.onerror=rm.bind(null,t),At(t,"link",a),gt(t),e.head.appendChild(t);n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2})}function $r(e){return'[src="'+ga(e)+'"]'}function No(e){return"script[async]"+e}function Cg(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+ga(a.href)+'"]');if(n)return t.instance=n,gt(n),n;var l=Ne({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),gt(n),At(n,"style",l),Is(n,a.precedence,e),t.instance=n;case"stylesheet":l=Vr(a.href);var r=e.querySelector(Mo(l));if(r)return t.state.loading|=4,t.instance=r,gt(r),r;n=C2(a),(l=ya.get(l))&&Tf(n,l),r=(e.ownerDocument||e).createElement("link"),gt(r);var i=r;return i._p=new Promise(function(o,s){i.onload=o,i.onerror=s}),At(r,"link",n),t.state.loading|=4,Is(r,a.precedence,e),t.instance=r;case"script":return r=$r(a.src),(l=e.querySelector(No(r)))?(t.instance=l,gt(l),l):(n=a,(l=ya.get(r))&&(n=Ne({},a),Ef(n,l)),e=e.ownerDocument||e,l=e.createElement("script"),gt(l),At(l,"link",n),e.head.appendChild(l),t.instance=l);case"void":return null;default:throw Error(E(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,Is(n,a.precedence,e));return t.instance}function Is(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),l=n.length?n[n.length-1]:null,r=l,i=0;i<n.length;i++){var o=n[i];if(o.dataset.precedence===t)r=o;else if(r!==l)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Tf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ef(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Xs=null;function kg(e,t,a){if(Xs===null){var n=new Map,l=Xs=new Map;l.set(a,n)}else l=Xs,n=l.get(a),n||(n=new Map,l.set(a,n));if(n.has(e))return n;for(n.set(e,null),a=a.getElementsByTagName(e),l=0;l<a.length;l++){var r=a[l];if(!(r[xo]||r[_t]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var i=r.getAttribute(t)||"";i=e+i;var o=n.get(i);o?o.push(r):n.set(i,[r])}}return n}function Sh(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function _3(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Rg(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function k2(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function R2(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Hg(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=R2(t),e.suspenseyImages.push(t)),e=S3.bind(e),t.decode().then(e,e))}function T3(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var l=Vr(n.href),r=t.querySelector(Mo(l));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=po.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=r,gt(r);return}r=t.ownerDocument||t,n=C2(n),(l=ya.get(l))&&Tf(n,l),r=r.createElement("link"),gt(r);var i=r;i._p=new Promise(function(o,s){i.onload=o,i.onerror=s}),At(r,"link",n),a.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=po.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Qs=0;function E3(e,t){return e.stylesheets&&e.count===0&&Zs(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var n=setTimeout(function(){if(e.stylesheets&&Zs(e,e.stylesheets),e.unsuspend){var r=e.unsuspend;e.unsuspend=null,r()}},6e4+t);0<e.imgBytes&&Qs===0&&(Qs=62500*Yx());var l=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Zs(e,e.stylesheets),e.unsuspend)){var r=e.unsuspend;e.unsuspend=null,r()}},(e.imgBytes>Qs?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(l)}}:null}function H2(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Zs(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function po(){this.count--,H2(this)}function S3(){this.imgCount--,H2(this)}var Tc=null;function Zs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Tc=new Map,t.forEach(A3,e),Tc=null,po.call(e))}function A3(e,t){if(!(t.state.loading&4)){var a=Tc.get(e);if(a)var n=a.get(null);else{a=new Map,Tc.set(e,a);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<l.length;r++){var i=l[r];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(a.set(i.dataset.precedence,i),n=i)}n&&a.set(null,n)}l=t.instance,i=l.getAttribute("data-precedence"),r=a.get(i)||n,r===n&&a.set(null,l),a.set(i,l),this.count++,n=po.bind(this),l.addEventListener("load",n),l.addEventListener("error",n),r?r.parentNode.insertBefore(l,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(l,e.firstChild)),t.state.loading|=4}}var Yr={$$typeof:Ia,Provider:null,Consumer:null,_currentValue:El,_currentValue2:El,_threadCount:0};function M3(e,t,a,n,l,r,i,o,s){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ku(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ku(0),this.hiddenUpdates=Ku(null),this.identifierPrefix=n,this.onUncaughtError=l,this.onCaughtError=r,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.transitionTypes=null,this.incompleteTransitions=new Map}function D2(e,t,a,n,l,r,i,o,s,c,d,v){return e=new M3(e,t,a,i,s,c,d,v,o),t=1,r===!0&&(t|=24),r=Xt(3,null,null,t),e.current=r,r.stateNode=e,t=jh(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:n,isDehydrated:a,cache:t},Xh(r),e}function G2(e){return e?(e=wr,e):wr}function L2(e,t,a,n,l,r){l=G2(l),n.context===null?n.context=l:n.pendingContext=l,n=Xn(t),n.payload={element:a},r=r===void 0?null:r,r!==null&&(n.callback=r),a=Qn(e,n,t),a!==null&&(Qt(a,e,t),Ii(a,e,t))}function Dg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Sf(e,t){Dg(e,t),(e=e.alternate)&&Dg(e,t)}function U2(e){if(e.tag===13||e.tag===31){var t=ql(e,67108864);t!==null&&Qt(t,e,67108864),Sf(e,67108864)}}function Gg(e){if(e.tag===13||e.tag===31){var t=ra();t=Ch(t);var a=ql(e,t);a!==null&&Qt(a,e,t),Sf(e,t)}}var jr=!0;function N3(e,t,a,n){var l=K.T;K.T=null;var r=he.p;try{he.p=2,Af(e,t,a,n)}finally{he.p=r,K.T=l}}function O3(e,t,a,n){var l=K.T;K.T=null;var r=he.p;try{he.p=8,Af(e,t,a,n)}finally{he.p=r,K.T=l}}function Af(e,t,a,n){if(jr){var l=Ah(n);if(l===null)fd(e,t,n,Ec,a),Lg(e,n);else if(C3(l,e,t,a,n))n.stopPropagation();else if(Lg(e,n),t&4&&-1<z3.indexOf(e)){for(;l!==null;){var r=Xr(l);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var i=yl(r.pendingLanes);if(i!==0){var o=r;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var s=1<<31-la(i);o.entanglements[1]|=s,i&=~s}Pa(r),(de&6)===0&&(wc=aa()+500,Ao(0,!1))}}break;case 31:case 13:o=ql(r,2),o!==null&&Qt(o,r,2),qc(),Sf(r,2)}if(r=Ah(n),r===null&&fd(e,t,n,Ec,a),r===l)break;l=r}l!==null&&n.stopPropagation()}else fd(e,t,n,null,a)}}function Ah(e){return e=Hh(e),Mf(e)}var Ec=null;function Mf(e){if(Ec=null,e=_l(e),e!==null){var t=vo(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=jg(t),e!==null)return e;e=null}else if(a===31){if(e=Kg(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ec=e,null}function B2(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Kb()){case Fg:return 2;case $g:return 8;case Ps:case Ib:return 32;case Wg:return 268435456;default:return 32}default:return 32}}var Mh=!1,$n=null,Wn=null,Pn=null,go=new Map,mo=new Map,Ln=[],z3="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Lg(e,t){switch(e){case"focusin":case"focusout":$n=null;break;case"dragenter":case"dragleave":Wn=null;break;case"mouseover":case"mouseout":Pn=null;break;case"pointerover":case"pointerout":go.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":mo.delete(t.pointerId)}}function Hi(e,t,a,n,l,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:r,targetContainers:[l]},t!==null&&(t=Xr(t),t!==null&&U2(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function C3(e,t,a,n,l){switch(t){case"focusin":return $n=Hi($n,e,t,a,n,l),!0;case"dragenter":return Wn=Hi(Wn,e,t,a,n,l),!0;case"mouseover":return Pn=Hi(Pn,e,t,a,n,l),!0;case"pointerover":var r=l.pointerId;return go.set(r,Hi(go.get(r)||null,e,t,a,n,l)),!0;case"gotpointercapture":return r=l.pointerId,mo.set(r,Hi(mo.get(r)||null,e,t,a,n,l)),!0}return!1}function q2(e){var t=_l(e.target);if(t!==null){var a=vo(t);if(a!==null){if(t=a.tag,t===13){if(t=jg(a),t!==null){e.blockedOn=t,c1(e.priority,function(){Gg(a)});return}}else if(t===31){if(t=Kg(a),t!==null){e.blockedOn=t,c1(e.priority,function(){Gg(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Js(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Ah(e.nativeEvent);if(a===null){a=e.nativeEvent;var n=new a.constructor(a.type,a);zd=n,a.target.dispatchEvent(n),zd=null}else return t=Xr(a),t!==null&&U2(t),e.blockedOn=a,!1;t.shift()}return!0}function Ug(e,t,a){Js(e)&&a.delete(t)}function k3(){Mh=!1,$n!==null&&Js($n)&&($n=null),Wn!==null&&Js(Wn)&&(Wn=null),Pn!==null&&Js(Pn)&&(Pn=null),go.forEach(Ug),mo.forEach(Ug)}function Os(e,t){e.blockedOn===t&&(e.blockedOn=null,Mh||(Mh=!0,rt.unstable_scheduleCallback(rt.unstable_NormalPriority,k3)))}var zs=null;function Bg(e){zs!==e&&(zs=e,rt.unstable_scheduleCallback(rt.unstable_NormalPriority,function(){zs===e&&(zs=null);for(var t=0;t<e.length;t+=3){var a=e[t],n=e[t+1],l=e[t+2];if(typeof n!="function"){if(Mf(n||a)===null)continue;break}var r=Xr(a);r!==null&&(e.splice(t,3),t-=3,Xd(r,{pending:!0,data:l,method:a.method,action:n},n,l))}}))}function Kr(e){function t(s){return Os(s,e)}$n!==null&&Os($n,e),Wn!==null&&Os(Wn,e),Pn!==null&&Os(Pn,e),go.forEach(t),mo.forEach(t);for(var a=0;a<Ln.length;a++){var n=Ln[a];n.blockedOn===e&&(n.blockedOn=null)}for(;0<Ln.length&&(a=Ln[0],a.blockedOn===null);)q2(a),a.blockedOn===null&&Ln.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(n=0;n<a.length;n+=3){var l=a[n],r=a[n+1],i=l[Jt]||null;if(typeof r=="function")i||Bg(a);else if(i){var o=null;if(r&&r.hasAttribute("formAction")){if(l=r,i=r[Jt]||null)o=i.formAction;else if(Mf(l)!==null)continue}else o=i.action;typeof o=="function"?a[n+1]=o:(a.splice(n,3),n-=3),Bg(a)}}}function V2(){function e(r){r.canIntercept&&r.info==="react-transition"&&r.intercept({handler:function(){return new Promise(function(i){return l=i})},focusReset:"manual",scroll:"manual"})}function t(){l!==null&&(l(),l=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var r=navigation.currentEntry;r&&r.url!=null&&navigation.navigate(r.url,{state:r.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,l=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),l!==null&&(l(),l=null)}}}function Nf(e){this._internalRoot=e}jc.prototype.render=Nf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(E(409));var a=t.current,n=ra();L2(a,n,e,t,null,null)};jc.prototype.unmount=Nf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;L2(e.current,2,null,e,null,null),qc(),t[Ir]=null}};function jc(e){this._internalRoot=e}jc.prototype.unstable_scheduleHydration=function(e){if(e){var t=lm();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ln.length&&t!==0&&t<Ln[a].priority;a++);Ln.splice(a,0,e),a===0&&q2(e)}};var qg=Vg.version;if(qg!=="19.3.1")throw Error(E(527,qg,"19.3.1"));he.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(E(188)):(e=Object.keys(e).join(","),Error(E(268,e)));return e=Rb(t),e=e!==null?Ig(e):null,e=e===null?null:e.stateNode,e};var R3={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:K,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Di=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Di.isDisabled&&Di.supportsFiber))try{wo=Di.inject(R3),na=Di}catch{}var Di;Kc.createRoot=function(e,t){if(!Yg(e))throw Error(E(299));var a=!1,n="",l=xv,r=_v,i=Tv;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(l=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=D2(e,1,!1,null,null,a,n,null,l,r,i,V2),e[Ir]=t.current,yf(e),new Nf(t)};Kc.hydrateRoot=function(e,t,a){if(!Yg(e))throw Error(E(299));var n=!1,l="",r=xv,i=_v,o=Tv,s=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(l=a.identifierPrefix),a.onUncaughtError!==void 0&&(r=a.onUncaughtError),a.onCaughtError!==void 0&&(i=a.onCaughtError),a.onRecoverableError!==void 0&&(o=a.onRecoverableError),a.formState!==void 0&&(s=a.formState)),t=D2(e,1,!0,t,a??null,n,l,s,r,i,o,V2),t.context=G2(null),a=t.current,n=ra(),n=Ch(n),l=Xn(n),l.callback=null,Qn(a,l,n),a=n,t.current.lanes=a,bo(t,a),Pa(t),e[Ir]=t.current,yf(e),new jc(t)};Kc.version="19.3.1"});var I2=Ua((z_,K2)=>{"use strict";function j2(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(j2)}catch(e){console.error(e)}}j2(),K2.exports=Y2()});var sw=Ua(lu=>{"use strict";var F3=Symbol.for("react.transitional.element"),$3=Symbol.for("react.fragment");function ow(e,t,a){var n=null;if(a!==void 0&&(n=""+a),t.key!==void 0&&(n=""+t.key),"key"in t){a={};for(var l in t)l!=="key"&&(a[l]=t[l])}else a=t;return t=a.ref,{$$typeof:F3,type:e,key:n,ref:t!==void 0?t:null,props:a}}lu.Fragment=$3;lu.jsx=ow;lu.jsxs=ow});var be=Ua((J_,cw)=>{"use strict";cw.exports=sw()});var Ny=j(I2(),1);var Ic=["purple","cyan","green","amber","rose","blue"];var Oo=e=>typeof e=="string"&&Ic.includes(e);var X2={editing:{human:0,agent:1},viewing:{human:2,agent:3},idle:{human:4,agent:5}};function Of(e){return e.map((t,a)=>({member:t,index:a})).sort((t,a)=>X2[t.member.activity][t.member.kind]-X2[a.member.activity][a.member.kind]||t.index-a.index).map(({member:t})=>t)}var Xc=Ic.filter(e=>e!=="purple");function zf(e,t=new Map){let a=new Map,n=new Map(Xc.map(r=>[r,0])),l=(r,i)=>{a.set(r,i),n.set(i,(n.get(i)??0)+1)};for(let r of e)r.kind==="agent"&&r.hue!==void 0&&l(r.id,r.hue);for(let r of e){if(a.has(r.id))continue;let i=t.get(r.id);i!==void 0&&l(r.id,i)}for(let r of e){if(a.has(r.id))continue;let i=Xc[0];for(let o of Xc)(n.get(o)??0)<(n.get(i)??0)&&(i=o);l(r.id,i)}return a}function Q2(e,t=2){if(e.length===0)return"";if(e.length===1)return e[0];if(e.length<=t)return`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`;let a=e.length-t;return`${e.slice(0,t).join(", ")} and ${a===1?"1 other":`${a} others`}`}var zo={activity:(e,t)=>e==="editing"?"Editing":e==="idle"?"Idle":t==="agent"?"Reading":"Viewing",here:(e,t)=>t?e===0?"Only you are here":`You and ${e===1?"1 other":`${e} others`} are here`:e===1?"1 person is here":`${e} people are here`,member:e=>e.location?`${e.name}, ${e.location}`:`${e.name}, ${zo.activity(e.activity,e.kind).toLowerCase()}`,more:e=>`${e} more`,editing:e=>`${e} is editing`,alsoHere:e=>e.length===0?"":`${Q2(e)} ${e.length===1?"is":"are"} also here.`};function Co(e){return{...zo,...e}}var F2=["text","longtext","number","checkbox","select","multiselect","status","person","date","url","rating"],Zc=e=>typeof e=="string"&&F2.includes(e);var H3={text:"Text",longtext:"Long text",number:"Number",checkbox:"Checkbox",select:"Select",multiselect:"Multi-select",status:"Status",person:"Person",date:"Date",url:"URL",rating:"Rating"},Cf=e=>e===1?"1 change":`${e} changes`,Yl={rowHeader:"Row",addRow:"Add row",empty:"Empty",checked:"Checked",unchecked:"Not checked",rating:(e,t)=>`${e} of ${t} stars`,archived:e=>`Archived: ${e}`,unknownPerson:"Unknown person",types:H3,saving:"Saving",forbidden:"You can view this sheet but not edit it.",couldNotSave:"Could not save this change.",notANumber:e=>`${e} must be a number.`,belowMin:(e,t)=>`${e} must be at least ${t}.`,aboveMax:(e,t)=>`${e} must be at most ${t}.`,tooLong:(e,t)=>`${e} must be at most ${t} characters.`,required:e=>`${e} is required.`,notAnOption:e=>`${e} must be one of its options.`,tooManyItems:(e,t)=>`${e} holds at most ${t} options.`,notAPerson:e=>`${e} must be a person or an agent in this company.`,notADate:e=>`${e} must be a date.`,notAUrl:e=>`${e} must be a web address starting with https:// or http://.`,notARating:(e,t)=>`${e} must be a whole number from 1 to ${t}.`,notABoolean:e=>`${e} must be checked or not checked.`,readOnly:e=>`${e} is read only.`,conflict:(e,t)=>`${e} changed this to ${t} while you were editing.`,keepMine:"Keep yours",useTheirs:e=>`Use ${e}'s`,someone:"Someone",changed:(e,t,a)=>`Changed by ${e}, ${t}.${a===null?"":` Was ${a}.`}`,history:"Cell history",sync:e=>e.offline?e.saving===0?"Offline.":`Offline. ${Cf(e.saving)} will sync when you reconnect.`:e.failed!==void 0&&e.failed>0?"Could not save.":e.refused!==void 0&&e.refused>0?`${Cf(e.refused)} not saved`:e.saving>0?`Saving ${Cf(e.saving)}`:"Saved",retry:"Retry",dismiss:"Dismiss",notSaved:e=>`Not saved: ${e}`,rowActions:e=>`Actions for row ${e}`,deleteRow:"Delete row",rowActionsHelp:"Shift with F10 opens the actions of the row.",filter:"Filter options",noOptions:"No matching options",clear:"Clear",keyboardHelp:"Arrow keys move between cells. Enter or F2 edits a cell, Escape cancels, and typing replaces its value. Space toggles a checkbox. Control or Command with C and V copies and pastes. Control or Command with Alt and H opens the history of a cell.",sortBy:e=>`Sort by ${e}`,columnSettings:e=>`Column settings for ${e}`,columnSettingsHelp:"Enter on a column header opens the settings of that column.",addColumn:"Add column"};function ko(e){return{...Yl,...e,types:{...Yl.types,...e?.types}}}var D3={violet:"purple",indigo:"purple",teal:"cyan",sky:"cyan",emerald:"green",lime:"green",yellow:"amber",orange:"amber",red:"rose",pink:"rose"};function Jc(e){if(e===void 0)return"neutral";let t=e.trim().toLowerCase();return Oo(t)?t:D3[t]??"neutral"}var G3=["neutral","info","success","warning","danger"],L3={green:"success",amber:"warning",rose:"danger",blue:"info",cyan:"info",purple:"neutral"},U3={todo:"neutral",in_progress:"info",done:"success",blocked:"danger"};function Fc(e){let t=e.color?.trim().toLowerCase();if(t!==void 0&&G3.includes(t))return t;if(t!==void 0){let a=Jc(t);if(a!=="neutral")return L3[a]}return e.category?U3[e.category]:"neutral"}function En(e,t){return e.options?.find(a=>a.id===t)}function jl(e){return(e.options??[]).filter(t=>!t.archived)}function Hf(e){let t=new Set,a=[];for(let n of e.split(",")){let[l="",r]=n.split(":"),i=l.trim();if(i==="")continue;let o=i.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"");for(o===""&&(o=`option_${a.length+1}`);t.has(o);)o=`${o}_`;t.add(o);let s=r?.trim();a.push(s?{id:o,label:i,color:s}:{id:o,label:i})}return a}var $2=1e3,W2=2e4,P2=2048,kf=5,ew=10,tw=1900,aw=2200;function en(e){let t=e.max??kf;return Number.isInteger(t)&&t>=1?Math.min(t,ew):kf}function ol(e){return e.maxLength??(e.type==="longtext"?W2:$2)}var B3=e=>Array.isArray(e)&&e.every(t=>typeof t=="string");function Rt(e,t){if(t==null)return e.type==="checkbox"?!1:e.type==="multiselect"?[]:null;switch(e.type){case"checkbox":return t===!0;case"number":{let a=typeof t=="number"?t:typeof t=="string"&&t.trim()!==""?Number(t):Number.NaN;return Number.isFinite(a)?a:null}case"rating":return typeof t=="number"&&Number.isInteger(t)&&t>=1?t:null;case"multiselect":return B3(t)?t:[];case"text":case"longtext":case"url":case"date":return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null;case"select":case"status":case"person":return typeof t=="string"?t:null}}function tn(e){return e===null||e===""||Array.isArray(e)&&e.length===0}function Wr(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((a,n)=>a===t[n]):e===t}function Pr(e,t){return e?.find(a=>a.id===t)}function q3(e,t){let a=e.precision,n=a===void 0?{maximumFractionDigits:10}:{minimumFractionDigits:a,maximumFractionDigits:a};return e.numberStyle==="percent"?new Intl.NumberFormat(t,{style:"percent",...n}):e.numberStyle==="currency"&&e.currency?new Intl.NumberFormat(t,{style:"currency",currency:e.currency,...n}):new Intl.NumberFormat(t,n)}var V3=/^(\d{4})-(\d{2})-(\d{2})$/;function nw(e){let t=V3.exec(e);if(!t)return null;let a=Number(t[1]),n=Number(t[2]),l=Number(t[3]),r=new Date(Date.UTC(a,n-1,l));return r.getUTCFullYear()!==a||r.getUTCMonth()!==n-1||r.getUTCDate()!==l||a<tw||a>aw?null:{year:a,month:n,day:l}}function ba(e,t,a){let{labels:n,locale:l}=a;if(e.type==="checkbox")return t===!0?n.checked:n.unchecked;if(tn(t))return"";switch(e.type){case"number":return typeof t=="number"?q3(e,l).format(t):"";case"rating":return typeof t=="number"?n.rating(t,en(e)):"";case"select":case"status":{let r=En(e,String(t));return r?r.archived?n.archived(r.label):r.label:String(t)}case"multiselect":return t.map(r=>{let i=En(e,r);return i?i.archived?n.archived(i.label):i.label:r}).join(", ");case"person":return Pr(a.people,String(t))?.name??n.unknownPerson;case"date":{let r=String(t);if(nw(r))return new Intl.DateTimeFormat(l,{dateStyle:"medium",timeZone:"UTC"}).format(new Date(`${r}T00:00:00Z`));let i=Date.parse(r);return Number.isNaN(i)?r:new Intl.DateTimeFormat(l,{dateStyle:"medium",timeStyle:"short"}).format(i)}default:return String(t)}}function ei(e,t,a){if(e.type==="checkbox")return t===!0?"TRUE":"FALSE";if(tn(t))return"";switch(e.type){case"number":return typeof t!="number"?"":e.numberStyle==="percent"?`${Rf(t*100,10)}%`:String(t);case"select":case"status":return En(e,String(t))?.label??String(t);case"multiselect":return t.map(n=>En(e,n)?.label??n).join(", ");case"person":return Pr(a.people,String(t))?.name??String(t);default:return String(t)}}function Rf(e,t){let a=10**t;return Math.round(e*a)/a}var it=e=>({ok:!1,error:e});function Z2(e,t){let a=t.trim().toLowerCase(),n=jl(e),l=n.find(r=>r.id===t.trim())??n.find(r=>r.label.toLowerCase()===a);return l?l.id:null}function Y3(e,t){let a=t.trim().toLowerCase();if(!e||a==="")return null;let n=e.find(r=>r.id===t.trim()||r.name.toLowerCase()===a);if(n)return n.id;let l=e.filter(r=>r.name.toLowerCase().startsWith(a));return l.length===1?l[0].id:null}var j3=new Set(["true","yes","y","1","x","checked","on","\u2713","\u2714"]),K3=new Set(["false","no","n","0","","unchecked","off"]);function I3(e,t,a){let n=t.trim().replace(/\s+/g,""),l=n.endsWith("%");if(l&&(n=n.slice(0,-1)),n=n.replace(/^[$€£¥]|[$€£¥]$/g,""),/^-?\d{1,3}(,\d{3})+(\.\d+)?$/.test(n)&&(n=n.replaceAll(",","")),!/^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i.test(n))return it(a.notANumber(e.label));let r=Number(n);if((l||e.numberStyle==="percent")&&(r/=100),!Number.isFinite(r))return it(a.notANumber(e.label));e.precision!==void 0&&(r=Rf(r,e.precision));let i=o=>e.numberStyle==="percent"?`${Rf(o*100,10)}%`:String(o);return e.min!==void 0&&r<e.min?it(a.belowMin(e.label,i(e.min))):e.max!==void 0&&r>e.max?it(a.aboveMax(e.label,i(e.max))):{ok:!0,value:r}}function X3(e,t,a){let n=t.trim();if(!e.time)return nw(n.slice(0,10))&&(n.length===10||n[10]==="T"||n[10]===" ")?{ok:!0,value:n.slice(0,10)}:it(a.notADate(e.label));let l=Date.parse(n);if(Number.isNaN(l))return it(a.notADate(e.label));let r=new Date(l).getUTCFullYear();return r<tw||r>aw?it(a.notADate(e.label)):{ok:!0,value:new Date(l).toISOString().replace(/\.000Z$/,"Z")}}function Q3(e,t,a){let n=t.trim();!/^[a-z][a-z0-9+.-]*:/i.test(n)&&/^[^\s/]+\.[^\s/]+/.test(n)&&(n=`https://${n}`);let l;try{l=new URL(n)}catch{return it(a.notAUrl(e.label))}return l.protocol!=="https:"&&l.protocol!=="http:"||n.length>P2||l.host===""?it(a.notAUrl(e.label)):{ok:!0,value:n}}function ti(e,t,a){let{labels:n}=a;if(t.trim()===""&&e.type!=="checkbox")return e.required?it(n.required(e.label)):{ok:!0,value:e.type==="multiselect"?[]:null};switch(e.type){case"checkbox":{let r=t.trim().toLowerCase();return j3.has(r)?{ok:!0,value:!0}:K3.has(r)?{ok:!0,value:!1}:it(n.notABoolean(e.label))}case"number":return I3(e,t,n);case"rating":{let r=en(e),i=t.trim(),o=/^★+$/.test(i)?i.length:Number(i);return o===0?e.required?it(n.required(e.label)):{ok:!0,value:null}:!Number.isInteger(o)||o<1||o>r?it(n.notARating(e.label,r)):{ok:!0,value:o}}case"text":{let r=t.replace(/\s*[\r\n]+\s*/g," ");return r.length>ol(e)?it(n.tooLong(e.label,ol(e))):{ok:!0,value:r}}case"longtext":return t.length>ol(e)?it(n.tooLong(e.label,ol(e))):{ok:!0,value:t};case"select":case"status":{let r=Z2(e,t);return r===null?it(n.notAnOption(e.label)):{ok:!0,value:r}}case"multiselect":{let r=[];for(let i of t.split(/[,;\n]/)){if(i.trim()==="")continue;let o=Z2(e,i);if(o===null)return it(n.notAnOption(e.label));r.includes(o)||r.push(o)}return e.maxItems!==void 0&&r.length>e.maxItems?it(n.tooManyItems(e.label,e.maxItems)):{ok:!0,value:r}}case"person":{let r=Y3(a.people,t);return r===null?it(n.notAPerson(e.label)):{ok:!0,value:r}}case"date":return X3(e,t,n);case"url":return Q3(e,t,n)}}function Df(e,t,a){let{labels:n}=a;if(e.required&&e.type!=="checkbox"&&tn(t))return n.required(e.label);if(tn(t))return null;switch(e.type){case"checkbox":return typeof t=="boolean"?null:n.notABoolean(e.label);case"select":case"status":return typeof t=="string"&&jl(e).some(l=>l.id===t)?null:n.notAnOption(e.label);case"multiselect":{if(!Array.isArray(t))return n.notAnOption(e.label);let l=new Set(jl(e).map(r=>r.id));return t.every(r=>l.has(r)||En(e,r)?.archived)?e.maxItems!==void 0&&t.length>e.maxItems?n.tooManyItems(e.label,e.maxItems):null:n.notAnOption(e.label)}case"person":return typeof t=="string"&&Pr(a.people,t)?null:n.notAPerson(e.label);case"rating":return typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=en(e)?null:n.notARating(e.label,en(e));default:{let l=ti(e,ei(e,t,a),a);return l.ok?null:l.error}}}function lw(e,t,a,n){let l=e.type!=="checkbox"&&tn(t),r=e.type!=="checkbox"&&tn(a);if(l||r)return l===r?0:l?1:-1;switch(e.type){case"number":case"rating":return t-a;case"checkbox":return+(t===!0)-+(a===!0);case"select":case"status":{let i=o=>(e.options??[]).findIndex(s=>s.id===o);return i(t)-i(a)}default:return ba(e,t,n).localeCompare(ba(e,a,n),n.locale,{numeric:!0})}}var Kl=e=>!!(e.ctrlKey||e.metaKey),J2=(e,t,a)=>Math.min(Math.max(e,t),a);function Gf(e,t,a){let n=a.rows-1,l=a.cols-1;if(a.cols===0)return null;let r=Kl(t);switch(t.key){case"ArrowUp":return{row:r?e.row<0?-1:0:Math.max(e.row-1,-1),col:e.col};case"ArrowDown":return n<0?e:{row:r?n:J2(e.row+1,-1,n),col:e.col};case"ArrowLeft":return{row:e.row,col:r?0:Math.max(e.col-1,0)};case"ArrowRight":return{row:e.row,col:r?l:Math.min(e.col+1,l)};case"Home":return r?{row:n<0?-1:0,col:0}:{row:e.row,col:0};case"End":return r?{row:Math.max(n,-1),col:l}:{row:e.row,col:l};case"PageUp":return{row:e.row<0?-1:Math.max(e.row-a.page,0),col:e.col};case"PageDown":return n<0?e:{row:J2(e.row+a.page,0,n),col:e.col};default:return null}}function Lf(e,t){let a=Math.max(e.row,0),n=Math.max(t.row,0);return{top:Math.min(a,n),bottom:Math.max(a,n),left:Math.min(e.col,t.col),right:Math.max(e.col,t.col)}}var Uf=(e,t,a)=>t>=e.top&&t<=e.bottom&&a>=e.left&&a<=e.right;function Bf(e,t,a,n,l=8){if(n===0)return[0,-1];let r=t>0?t:a*40,i=Math.max(0,Math.floor(e/a)-l),o=Math.min(n-1,Math.ceil((e+r)/a)+l);return[i,o]}function qf(e,t,a,n,l){let r=e*n,i=r+n,o=t,s=t+Math.max(a-l,n);return r<o?r:i>s?i-Math.max(a-l,n):t}function Vf(e,t,a,n,l){let r=n-t,i=e-a;return r>=l||r>=i?"below":"above"}var $c={text:200,longtext:260,number:112,checkbox:104,select:144,multiselect:208,status:144,person:176,date:136,url:208,rating:128},Il=52,Wc=32,an=e=>e.width!==void 0&&e.width>0?e.width:$c[e.type];function Yf(e){let t=[],a=Il;for(let n of e)t.push(a),a+=an(n);return t}function jf(e){return[...e.filter(t=>t.frozen),...e.filter(t=>!t.frozen)]}var Kf=e=>e.key.length===1&&!Kl(e)&&!e.altKey,Pc={text:[120,280],longtext:[160,320],number:[80,180],checkbox:[72,180],select:[104,240],multiselect:[$c.multiselect,280],status:[112,260],person:[120,240],date:[112,180],url:[160,280],rating:[104,180]},rw=8;function If(e,t){if(!(t>0))return $c[e];let[a,n]=Pc[e];return Math.min(n,Math.max(a,Math.ceil(t)))}function Xf(e,t,a,n=rw){switch(e.type){case"select":case"status":return jl(e).map(l=>l.id);case"checkbox":case"multiselect":return[];case"rating":return[en(e)];default:{let l=[];for(let r of t){let i=Rt(e,r.values[e.field]);if(tn(i))continue;let o=ba(e,i,a).length;l.length===n&&o<=l[n-1].length||(l.push({value:i,length:o}),l.sort((s,c)=>c.length-s.length),l.length>n&&l.pop())}return l.map(r=>r.value)}}}function Z3(e){return/[\t\n\r"]/.test(e)?`"${e.replaceAll('"','""')}"`:e}function Qf(e,t,a,n){let l=[];for(let r=a.top;r<=a.bottom;r+=1){let i=t[r];if(!i)continue;let o=[];for(let s=a.left;s<=a.right;s+=1){let c=e[s];c&&o.push(Z3(ei(c,Rt(c,i.values[c.field]),n)))}l.push(o.join(" "))}return l.join(`
|
|
10
10
|
`)}function Zf(e){let t=[],a=[],n="",l=!1,r=0,i=e.replace(/\r\n?/g,`
|
|
11
11
|
`);for(;r<i.length;){let o=i[r];if(l){if(o==='"'&&i[r+1]==='"'){n+='"',r+=2;continue}if(o==='"'){l=!1,r+=1;continue}n+=o,r+=1;continue}o==='"'&&n===""?l=!0:o===" "?(a.push(n),n=""):o===`
|
|
12
|
-
`?(a.push(n),t.push(a),a=[],n=""):n+=o,r+=1}return(n!==""||a.length>0)&&(a.push(n),t.push(a)),t}function Jf(e,t,a,n,l){let r={edits:[],refused:[]};if(n.length===0)return r;let i=n.length===1&&n[0].length===1,o=i?a.bottom-a.top+1:n.length,s=i?a.right-a.left+1:Math.max(...n.map(c=>c.length));for(let c=0;c<o;c+=1){let d=t[a.top+c];if(!d)break;for(let v=0;v<s;v+=1){let u=e[a.left+v];if(!u)break;if(u.readOnly)continue;let m=i?n[0][0]:n[c]?.[v];if(m===void 0)continue;let b=ti(u,m,l);if(!b.ok){r.refused.push({rowId:d.id,field:u.field,error:b.error});continue}Wr(b.value,Rt(u,d.values[u.field]))||r.edits.push({rowId:d.id,field:u.field,value:b.value})}}return r}function Ff(e,t,a,n){let l={edits:[],refused:[]};for(let r=a.top;r<=a.bottom;r+=1){let i=t[r];if(i)for(let o=a.left;o<=a.right;o+=1){let s=e[o];if(!s||s.readOnly)continue;let c=s.type==="checkbox"?!1:s.type==="multiselect"?[]:null;if(!Wr(Rt(s,i.values[s.field]),c)){if(s.required&&s.type!=="checkbox"){l.refused.push({rowId:i.id,field:s.field,error:n.labels.required(s.label)});continue}l.edits.push({rowId:i.id,field:s.field,value:c})}}}return l}function Ro(e,t,a){if(e==="forbidden"||e==="capability_not_declared")return a.forbidden;let n=t?.trim();return n||a.couldNotSave}var Qc=(e,t)=>`${e}\0${t}`,$f=class{constructor(){on(this,"waiting",new Map);on(this,"refusals",new Map);on(this,"listeners",new Set);on(this,"failed",0)}begin(e,t){let a=Qc(e,t);this.refusals.delete(a),this.waiting.set(a,(this.waiting.get(a)??0)+1),this.emit();let n=!1;return l=>{if(n)return;n=!0;let r=(this.waiting.get(a)??1)-1;r<=0?this.waiting.delete(a):this.waiting.set(a,r),l.ok||(this.refusals.set(a,l.message),this.failed+=1),this.emit()}}isPending(e,t){return this.waiting.has(Qc(e,t))}refusal(e,t){return this.refusals.get(Qc(e,t))}dismiss(e,t){this.refusals.delete(Qc(e,t))&&this.emit()}get saving(){let e=0;for(let t of this.waiting.values())e+=t;return e}dismissAll(){this.refusals.size!==0&&(this.refusals.clear(),this.emit())}sync(e=!1){return{saving:this.saving,offline:e,refused:this.refusals.size}}get failures(){return this.failed}resetFailures(){this.failed=0}decorate(e){return this.waiting.size===0&&this.refusals.size===0?[...e]:e.map(t=>{let a=[],n={};for(let l of this.waiting.keys()){let[r,i]=l.split("\0");r===t.id&&a.push(i)}for(let[l,r]of this.refusals){let[i,o]=l.split("\0");i===t.id&&(n[o]=r)}return a.length===0&&Object.keys(n).length===0?t:{...t,pending:[...t.pending??[],...a],refused:{...t.refused,...n}}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(){for(let e of this.listeners)e()}};function iw(e,t){let a=e instanceof Date?e:new Date(e);return Number.isNaN(a.getTime())?"":new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(a)}function eu(e,t,a,n){return t.changed(e.by,iw(e.at,n),a)}var tu=e=>e.previous!==void 0;function Wf(e,t,a,n){if(!a)return[...t];let l=e.find(i=>i.field===a.field);if(!l)return[...t];let r=a.direction==="descending"?-1:1;return t.map((i,o)=>({row:i,index:o,value:Rt(l,i.values[l.field])})).sort((i,o)=>{let s=c=>c===null||c===""||Array.isArray(c)&&c.length===0;return l.type!=="checkbox"&&(s(i.value)||s(o.value))?s(i.value)===s(o.value)?i.index-o.index:s(i.value)?1:-1:r*lw(l,i.value,o.value,n)||i.index-o.index}).map(({row:i})=>i)}function au(e,t){return!e||e.field!==t?{field:t,direction:"ascending"}:e.direction==="ascending"?{field:t,direction:"descending"}:null}var xa=(e,t)=>`${e}\0${t}`;function Pf(e){let t=new Map;for(let a of e??[]){let n=xa(a.rowId,a.field),l=t.get(n);l?l.push(a):t.set(n,[a])}for(let a of t.values())a.sort((n,l)=>+!!l.editing-+!!n.editing);return t}function ep(e){let t=new Map;for(let a of e??[])t.has(a.rowId)||t.set(a.rowId,a);return t}function tp(e,t=2){let a=new Map;for(let n of e??[]){let l=a.get(n.field)??[];l.length<t&&!l.some(r=>r.id===n.id)&&l.push(n),a.set(n.field,l)}return a}function ap(e){return e.map(t=>t.name).join(", ")}function np(e,t,a,n,l=zo){let{labels:r}=n,i=[`${e.label}.`];e.readOnly&&i.push(r.readOnly(e.label)),t.pending?.includes(e.field)&&i.push(`${r.saving}.`);let o=t.refused?.[e.field];o&&i.push(o);let s=a.map(d=>d.name);s.length>0&&i.push(l.alsoHere(s));let c=t.changed?.[e.field];if(c){let d=tu(c)&&ba(e,Rt(e,c.previous),n)||null;i.push(eu(c,r,d,n.locale))}return i.join(" ")}function nu(e,t,a,n){let l=e.find(r=>r.type==="text");if(l){let r=ba(l,Rt(l,t.values[l.field]),n);if(r)return r}return String(a+1)}var lp=j(ht(),1),uw=j(be(),1),W3=(0,lp.createContext)(2);function dw({level:e,children:t}){return(0,uw.jsx)(W3.Provider,{value:e,children:t})}var P3=j(ht(),1);var hw="data-crewlet-focus-returned";function ai(e,t){if(!e)return!1;let a=()=>e.removeAttribute(hw);return e.setAttribute(hw,""),e.addEventListener("blur",a,{once:!0}),e.focus(t),e.ownerDocument.activeElement===e?!0:(e.removeEventListener("blur",a),a(),!1)}function k(...e){return e.filter(Boolean).join(" ")}var e5=["todo","in_progress","done","blocked"];function t5(e){if(e.options)return e.options.map(t=>{let a={id:t.id,label:t.label};return t.color&&(a.color=t.color),t.category&&e5.includes(t.category)&&(a.category=t.category),t.archived&&(a.archived=!0),a})}function fw(e){let t=[];for(let a of e?.columns??[]){if(a.hidden)continue;let n=a.type,l=Zc(n),r={field:a.key,label:a.label||a.key,type:l?n:"text"};l||(r.readOnly=!0),a.primary&&(r.frozen=!0),a.required&&(r.required=!0),a.min!==void 0&&(r.min=a.min),a.max!==void 0&&(r.max=a.max),a.max_length!==void 0&&(r.maxLength=a.max_length),a.max_items!==void 0&&(r.maxItems=a.max_items);let i=t5(a);i&&(r.options=i),t.push(r)}return t}function a5(e,t){let a=t.trim();if(a===""||a==="plain")return;let n=/^currency:([A-Za-z]{3})$/.exec(a);if(n){e.numberStyle="currency",e.currency=n[1].toUpperCase();return}if(a==="percent"){e.numberStyle="percent";return}let l=/^0(?:\.(0+))?(%)?$/.exec(a);l&&(e.precision=l[1]?.length??0,l[2]&&(e.numberStyle="percent"))}var Ho=e=>{if(e===null||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0},pw=["field","type","label","format","options","width","readonly","required","frozen","min","max","max-length","max-items","time"];function gw(e){let t=e("field")?.trim();if(!t)return null;let a=e("type")?.trim()??"text",n=Zc(a),l={field:t,label:e("label")?.trim()||t,type:n?a:"text"};(!n||e("readonly")!==null)&&(l.readOnly=!0),e("required")!==null&&(l.required=!0),e("frozen")!==null&&(l.frozen=!0),e("time")!==null&&(l.time=!0);let r=Ho(e("width"));r!==void 0&&(l.width=r);let i=Ho(e("min"));i!==void 0&&(l.min=i);let o=Ho(e("max"));o!==void 0&&(l.max=o);let s=Ho(e("max-length"));s!==void 0&&(l.maxLength=s);let c=Ho(e("max-items"));c!==void 0&&(l.maxItems=c);let d=e("options");d&&(l.options=Hf(d));let v=e("format");return v&&l.type==="number"&&a5(l,v),l}function mw(e){let t=e?.trim();return t?t.startsWith("-")?{field:t.slice(1),direction:"descending"}:{field:t,direction:"ascending"}:null}function vw(e,t){return t===void 0?[...e]:e.map((a,n)=>n<t?{...a,frozen:!0}:a)}var ww=e=>e!==void 0&&Oo(e)?e:void 0;function yw(e){let t={id:e.seat,name:e.displayName,kind:e.kind},a=ww(e.avatar?.hue);return a&&(t.hue=a),e.avatar?.character&&(t.character=e.avatar.character),t}function bw(e,t){return e.filter(a=>a.seat!==t)}function xw(e,t){return zf(e.map(a=>({id:a.session,kind:a.kind,hue:ww(a.avatar?.hue)})),t)}function _w(e,t,a,n){let l=[];for(let r of bw(e,a)){let i=r.focus;i.collection!==t||!i.doc||!i.field||l.push({rowId:i.doc,field:i.field,id:r.session,name:r.displayName,kind:r.kind,hue:n.get(r.session)??"purple",editing:r.activity==="editing",idle:r.activity==="idle"})}return l}function Tw(e,t){return e.filter(a=>a.focus.collection===t)}function Ew(e,t,a){return bw(e,t).map(n=>{let l={id:n.session,seat:n.seat,name:n.displayName,kind:n.kind,activity:n.activity},r=a.get(n.session);return r&&(l.hue=r),n.avatar?.character&&(l.character=n.avatar.character),l})}var F=j(ht(),1);var Aw=j(be(),1),Sw={xs:12,sm:14,md:16,lg:20,xl:24},Mw=1.75,n5=`var(--crewlet-glyph-stroke, ${Mw})`;function l5(e){return e===void 0?"1em":typeof e=="number"?`${e}px`:e in Sw?`${Sw[e]}px`:e}function vt({size:e,title:t,filled:a=!1,fillable:n,className:l,style:r,children:i,...o}){let s=l5(e);return(0,Aw.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,stroke:"currentColor",...t?{role:"img","aria-label":t}:{"aria-hidden":!0,focusable:!1},className:l===void 0?"crewlet-glyph":`crewlet-glyph ${l}`,...o,viewBox:"0 0 24 24",fill:n&&a?"currentColor":"none",strokeWidth:Mw,strokeLinecap:"round",strokeLinejoin:"round",style:{...r,strokeWidth:n5},children:i})}var U=j(be(),1);function ru(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M12 5v14"}),(0,U.jsx)("path",{d:"m19 12-7 7-7-7"})]})}function rp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"m5 12 7-7 7 7"}),(0,U.jsx)("path",{d:"M12 19V5"})]})}function ni(e){return(0,U.jsx)(vt,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"M20 6 9 17l-5-5"})})}function ip(e){return(0,U.jsx)(vt,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"m15 18-6-6 6-6"})})}function li(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,U.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}function op(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("path",{d:"m16 9-5.5 5.5L8 12"})]})}function sp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"19",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"5",cy:"12",r:"1"})]})}function cp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"12",cy:"5",r:"1"}),(0,U.jsx)("circle",{cx:"12",cy:"19",r:"1"})]})}function up(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M15 3h6v6"}),(0,U.jsx)("path",{d:"M10 14 21 3"}),(0,U.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function iu(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("path",{d:"M12 16v-4"}),(0,U.jsx)("path",{d:"M12 8h.01"})]})}function dp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}),(0,U.jsx)("path",{d:"m15 5 4 4"})]})}function ou(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M5 12h14"}),(0,U.jsx)("path",{d:"M12 5v14"})]})}function hp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,U.jsx)("path",{d:"M3 3v5h5"}),(0,U.jsx)("path",{d:"M12 7v5l4 2"})]})}function fp(e){return(0,U.jsx)(vt,{...e,fillable:!0,children:(0,U.jsx)("path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"})})}function pp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M10 11v6"}),(0,U.jsx)("path",{d:"M14 11v6"}),(0,U.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),(0,U.jsx)("path",{d:"M3 6h18"}),(0,U.jsx)("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}function gp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),(0,U.jsx)("path",{d:"M12 9v4"}),(0,U.jsx)("path",{d:"M12 17h.01"})]})}function Do(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M18 6 6 18"}),(0,U.jsx)("path",{d:"m6 6 12 12"})]})}var _a=j(be(),1),r5={neutral:(0,_a.jsx)(iu,{size:"md"}),info:(0,_a.jsx)(iu,{size:"md"}),success:(0,_a.jsx)(op,{size:"md"}),warning:(0,_a.jsx)(gp,{size:"md"}),danger:(0,_a.jsx)(li,{size:"md"})},ri=({variant:e="info",title:t,icon:a,layout:n="card",action:l,live:r,className:i,children:o,...s})=>(0,_a.jsxs)("div",{...s,"aria-live":r,className:k("crewlet-callout",`crewlet-callout--${e}`,`crewlet-callout--${n}`,i),children:[(0,_a.jsx)("span",{className:"crewlet-callout__icon","aria-hidden":!0,children:a??r5[e]}),(0,_a.jsxs)("div",{className:"crewlet-callout__content",children:[t?(0,_a.jsx)("span",{className:"crewlet-callout__title",children:t}):null,o]}),l?(0,_a.jsx)("div",{className:"crewlet-callout__action",children:l}):null]});var Nw=j(be(),1);function Ow({size:e="em",className:t,...a}){return(0,Nw.jsx)("span",{...a,"aria-hidden":"true",className:k("crewlet-spinner",`crewlet-spinner--${e}`,t)})}var zw=j(be(),1);function Ht({as:e="span",id:t,className:a,children:n}){return(0,zw.jsx)(e,{id:t,className:k("crewlet-visually-hidden",a),children:n})}var Ca=j(ht(),1);var wt=j(be(),1);function Cw({variant:e="primary",size:t="medium",shape:a="square",block:n,className:l},r){return k("crewlet-btn",`crewlet-btn--${e}`,`crewlet-btn--${t}`,`crewlet-btn--${a}`,n&&"crewlet-btn--block",r,l)}function mp({leadingIcon:e,trailingIcon:t,loading:a,children:n}){return(0,wt.jsxs)(wt.Fragment,{children:[a?(0,wt.jsx)(Ow,{className:"crewlet-btn__spinner"}):e?(0,wt.jsx)("span",{className:"crewlet-btn__icon",children:e}):null,(0,wt.jsx)("span",{className:"crewlet-btn__label",children:n}),t?(0,wt.jsx)("span",{className:"crewlet-btn__icon",children:t}):null]})}var ka=(0,Ca.forwardRef)(function({variant:t="primary",size:a="medium",shape:n="square",leadingIcon:l,trailingIcon:r,block:i,className:o,type:s="button",asChild:c=!1,loading:d=!1,pressed:v,disabledReason:u,disabled:m,onClick:b,title:y,children:S,...h},f){let p=(0,Ca.useId)(),T=Cw({variant:t,size:a,shape:n,block:i,className:o},d?"crewlet-btn--loading":void 0);if(c){let N=Ca.Children.only(S);if(!(0,Ca.isValidElement)(N))throw new Error("Button with asChild expects exactly one valid React element child.");let O=N;return(0,Ca.cloneElement)(O,{...h,title:y,className:k(O.props.className,T)},(0,wt.jsx)(mp,{leadingIcon:l,trailingIcon:r,children:O.props.children}))}let C=d||u!==void 0;return(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsx)("button",{...h,ref:f,type:s,className:T,disabled:m,title:y,"aria-label":h["aria-label"]??(S===void 0?y:void 0),"aria-pressed":v,"aria-busy":d||void 0,"aria-disabled":C||void 0,"aria-describedby":u===void 0?h["aria-describedby"]:k(h["aria-describedby"],p),onClick:N=>{if(C){N.preventDefault();return}b?.(N)},children:(0,wt.jsx)(mp,{leadingIcon:l,trailingIcon:r,loading:d,children:S})}),u===void 0?null:(0,wt.jsx)(Ht,{id:p,children:u})]})}),CS=(0,Ca.forwardRef)(function({variant:t="primary",size:a="medium",shape:n="square",leadingIcon:l,trailingIcon:r,block:i,className:o,external:s=!1,title:c,children:d,...v},u){let m=r??(s?(0,wt.jsx)(up,{size:"sm"}):void 0);return(0,wt.jsx)("a",{...v,ref:u,className:Cw({variant:t,size:a,shape:n,block:i,className:o}),title:c,"aria-label":v["aria-label"]??(d===void 0?c:void 0),target:s?"_blank":v.target,rel:s?"noreferrer":v.rel,children:(0,wt.jsx)(mp,{leadingIcon:l,trailingIcon:m,children:d})})});var Go=j(ht(),1),kw=j(be(),1),Sn="crewlet:viewchange",ot=4;function ii(e,t,a,n=ot,l="below"){let r=e.y+e.height+n,i=e.y-n-t.height,o=a.y+a.height-r,s=e.y-n-a.y,d=(l==="below"?o>=t.height||o>=s:s>=t.height||s>=o)?l:l==="below"?"above":"below",v=d==="below"?r:i,u=a.y+a.height-t.height,m=Math.max(a.y,Math.min(v,u)),b=a.x+a.width-t.width;return{left:Math.max(a.x,Math.min(e.x,b)),top:m,side:d}}function oi(){return{x:0,y:0,width:window.innerWidth,height:window.innerHeight}}function si(e,t,a){let n={x:e.left-(a?t.x:0),y:e.top-(a?t.y:0),width:e.width,height:e.height};return i5(n,{x:0,y:0,width:t.width,height:t.height})}function i5(e,t){return e.x+e.width<t.x||e.y+e.height<t.y||e.x>t.x+t.width||e.y>t.y+t.height}var o5=(0,Go.createContext)(null);function sl(){let e=(0,Go.useContext)(o5);return e||(typeof document>"u"?null:document.body)}var De=j(ht(),1);var vp={duration:{instant:"75ms",fast:"120ms",base:"150ms",moderate:"200ms",slow:"300ms",breath:"2200ms",turn:"1000ms",sweep:"1500ms"},easing:{default:"ease",out:"ease-out",inOut:"ease-in-out",emphasized:"cubic-bezier(0.16, 1, 0.3, 1)",spring:"cubic-bezier(0.34, 1.56, 0.64, 1)"}};var wp={base:"0",raised:"1",sticky:"10",presence:"20",dropdown:"100",overlay:"200",layerBase:"9000",layerMax:"9899",modal:"9999",popover:"10000",toast:"10001"};var Rw=Symbol.for("crewlet.layer-stack");function s5(){let e=globalThis,t=e[Rw];if(t)return t;let a={entries:[],opened:0,armed:null,listeners:new Set,version:0,locks:0,restore:null};return e[Rw]=a,a}var Ee=s5();function Hw(){Ee.version+=1;for(let e of[...Ee.listeners])e()}function c5(e){return Ee.listeners.add(e),()=>Ee.listeners.delete(e)}function ci(e){let t;for(let a of Ee.entries)e&&a.kind!==e||(!t||a.order>t.order)&&(t=a);return t}var yp={base:Number(wp.layerBase),max:Number(wp.layerMax)};function u5(e){let t=0;for(let a of Ee.entries)a.order<e&&(t+=1);return t}function d5(e){return e===0?yp.base:Math.min(yp.base+u5(e),yp.max)}var h5=229;function ui(e){let t="nativeEvent"in e&&e.nativeEvent||e;return!!t.isComposing||t.keyCode===h5}function Xl(e){let t=["a[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","[contenteditable='true']","[tabindex]"].join(",");return[...e.querySelectorAll(t)].filter(a=>a.tabIndex>=0&&!a.disabled&&!a.closest("[hidden],[inert]")&&(typeof a.checkVisibility!="function"||a.checkVisibility()))}function Dw(e){if(ui(e))return;if(e.key==="Escape"){if(e.defaultPrevented)return;let c=ci();if(!c)return;e.preventDefault(),c.dismissable()&&c.dismiss("escape");return}if(e.key!=="Tab"||e.defaultPrevented)return;let t=ci("modal"),a=t?.panel();if(!t||!a)return;let n=ci("popup"),l=document.activeElement;if(n&&n.order>t.order&&l&&n.panel()?.contains(l))return;let r=Xl(a);if(r.length===0){e.preventDefault(),a.focus();return}let i=r[0],o=r[r.length-1];if(!(l instanceof Node)||!a.contains(l)){e.preventDefault(),(e.shiftKey?o:i).focus();return}let s=c=>(l.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;e.shiftKey&&!r.some(c=>c!==l&&!s(c))?(e.preventDefault(),o.focus()):!e.shiftKey&&!r.some(c=>c!==l&&s(c))&&(e.preventDefault(),i.focus())}function Gw(e){Ee.armed=null;let t=ci();if(!t||!(e.target instanceof Node))return;let a=e.target;if(t.kind==="modal"){a===t.veil()&&(Ee.armed=t);return}[t.panel(),...t.inside()].some(l=>l?.contains(a))||t.dismissable()&&t.dismiss("outside")}function Lw(e){let t=Ee.armed;Ee.armed=null,!(!t||t!==ci()||e.target!==t.veil())&&t.dismissable()&&t.dismiss("outside")}function Uw(e){return Ee.entries.length===0&&(document.addEventListener("keydown",Dw),document.addEventListener("pointerdown",Gw,!0),document.addEventListener("click",Lw,!0)),Ee.entries.push(e),Hw(),()=>{let t=Ee.entries.indexOf(e);t>=0&&Ee.entries.splice(t,1),Ee.armed===e&&(Ee.armed=null),Ee.entries.length===0&&(document.removeEventListener("keydown",Dw),document.removeEventListener("pointerdown",Gw,!0),document.removeEventListener("click",Lw,!0)),Hw()}}function Bw(e){let t=(0,De.useRef)(0);return e&&t.current===0&&(t.current=++Ee.opened),e||(t.current=0),t.current}function f5(e){if(!e)return[];let t;for(let n of Ee.entries)n.kind!=="modal"||!n.panel()?.contains(e)||(!t||n.order>t.order)&&(t=n);let a=t?.panel();return t&&a?[e,a,...t.returnTo]:[e]}function qw(e){return(0,De.useSyncExternalStore)(c5,()=>Ee.version,()=>0),{zIndex:d5(e),isTopmost:e!==0&&ci()?.order===e}}function Vw({onClose:e,dismissable:t=!0,initialFocus:a}){let n=(0,De.useRef)(null),l=(0,De.useRef)(null),r=(0,De.useRef)(e),i=(0,De.useRef)(t),o=(0,De.useRef)(a);r.current=e,i.current=t,o.current=a;let s=Bw(!0),[c]=(0,De.useState)(()=>typeof document>"u"?[]:f5(document.activeElement)),d=qw(s);(0,De.useLayoutEffect)(()=>Uw({kind:"modal",order:s,panel:()=>n.current,returnTo:c,veil:()=>l.current,inside:()=>[],dismiss:()=>r.current(),dismissable:()=>i.current}),[s,c]),(0,De.useEffect)(()=>{let m=n.current;return m&&!m.contains(document.activeElement)&&(o.current?.()??Xl(m)[0]??m).focus(),()=>{let b=document.activeElement;if(!(b&&Ee.entries.some(y=>y.panel()?.contains(b)))){for(let y of c)if(!(!(y instanceof HTMLElement)||!y.isConnected||y===document.body)&&ai(y))return}}},[c]);let v=(0,De.useCallback)(m=>{n.current=m},[]),u=(0,De.useCallback)(m=>{l.current=m},[]);return{panelRef:v,veilRef:u,...d}}function di({open:e,onDismiss:t}){let a=(0,De.useRef)(null),n=(0,De.useRef)(null),l=(0,De.useRef)(t);l.current=t;let r=Bw(e),i=qw(r);(0,De.useLayoutEffect)(()=>{if(e)return Uw({kind:"popup",order:r,panel:()=>a.current,returnTo:[],veil:()=>null,inside:()=>[n.current],dismiss:c=>l.current(c),dismissable:()=>!0})},[e,r]);let o=(0,De.useCallback)(c=>{a.current=c},[]),s=(0,De.useCallback)(c=>{n.current=c},[]);return{panelRef:o,insideRef:s,...i}}function Yw(e){(0,De.useLayoutEffect)(()=>{if(!(!e||typeof document>"u"))return Ee.locks===0&&(Ee.restore=document.body.style.overflow,document.body.style.overflow="hidden"),Ee.locks+=1,()=>{Ee.locks-=1,Ee.locks===0&&(document.body.style.overflow=Ee.restore??"",Ee.restore=null)}},[e])}var Ra=j(ht(),1),cl=j(be(),1),ul=(0,Ra.forwardRef)(function({label:t,icon:a,size:n="md",variant:l="ghost",pressed:r,disabledReason:i,className:o,type:s="button",asChild:c=!1,disabled:d,onClick:v,title:u,children:m,...b},y){let S=(0,Ra.useId)(),h=k("crewlet-icon-btn",`crewlet-icon-btn--${n}`,`crewlet-icon-btn--${l}`,o),f=a??m;if(c){let w=Ra.Children.only(m);if(!(0,Ra.isValidElement)(w))throw new Error("IconButton with asChild expects exactly one valid React element child.");let T=w;return(0,Ra.cloneElement)(T,{...b,"aria-label":t,title:u??t,className:k(T.props.className,h)})}let p=i!==void 0;return(0,cl.jsxs)(cl.Fragment,{children:[(0,cl.jsx)("button",{...b,ref:y,type:s,className:h,disabled:d,title:u??t,"aria-label":t,"aria-pressed":r,"aria-disabled":p||void 0,"aria-describedby":p?k(b["aria-describedby"],S):b["aria-describedby"],onClick:w=>{if(p){w.preventDefault();return}v?.(w)},children:f}),p?(0,cl.jsx)(Ht,{id:S,children:i}):null]})}),XS=(0,Ra.forwardRef)(function({label:t,href:a,icon:n,size:l="md",variant:r="ghost",current:i=!1,className:o,title:s,...c},d){return(0,cl.jsx)("a",{...c,ref:d,href:a,className:k("crewlet-icon-btn",`crewlet-icon-btn--${l}`,`crewlet-icon-btn--${r}`,i&&"crewlet-icon-btn--current",o),title:s??t,"aria-label":t,"aria-current":i?"page":void 0,children:n})});var Ha=j(ht(),1),Kw=j(nr(),1);var fe=j(be(),1);function Iw({open:e,...t}){let a=sl();return e&&a?(0,fe.jsx)(g5,{container:a,...t},p5(a)):null}var jw=new WeakMap,bp=0;function p5(e){let t=jw.get(e);return t!==void 0?t:(bp+=1,jw.set(e,bp),bp)}function yt(e){return e!=null&&e!==!1&&e!==""}function g5({container:e,onClose:t,title:a,subtitle:n,icon:l,footer:r,footerStart:i,headerActions:o,onBack:s,backLabel:c="Back",children:d,size:v="sm",variant:u="dialog",shape:m="framed",placement:b,phoneSheet:y=!1,role:S="dialog",dismissable:h=!0,closeOnBackdrop:f=!0,backdrop:p="veil",showCloseButton:w=!0,stackBody:T=!1,flush:C=!1,className:N,ariaLabel:O,describedBy:I,initialFocus:R,onSubmit:te,closeLabel:Se="Close",closeDisabledReason:me="Closing is unavailable until this finishes.",...q}){let H=(0,Ha.useId)(),Ve=`${H}-title`,z=`${H}-subtitle`,Y=m==="prompt"&&u==="dialog",P=!Y,Ze=u==="sheet",et=b??(Y?"center":"top"),Dt=y&&u==="dialog"&&!Y,st=(0,Ha.useRef)(null),G=(0,Ha.useRef)(null),se=(0,Ha.useRef)(null),ct=(0,Ha.useRef)(R);ct.current=R;let A=(0,Ha.useCallback)(()=>{let He=ct.current?.();if(He)return He;let at=G.current?Xl(G.current)[0]:void 0;return at||((se.current?Xl(se.current)[0]:void 0)??st.current)},[]),oe=Vw({onClose:t,dismissable:h,initialFocus:A});Yw(!0);let Je=yt(a)?Ve:void 0,L=I??(yt(n)?z:void 0),X={...q,ref:He=>{st.current=He,oe.panelRef(He)},className:k("crewlet-modal",`crewlet-modal--${u}`,u==="dialog"?`crewlet-modal--${v}`:void 0,Y?"crewlet-modal--prompt":void 0,N),role:S,"aria-modal":!0,"aria-labelledby":Je,"aria-label":Je===void 0?O:void 0,"aria-describedby":L,tabIndex:-1},Oe=P&&w,tt=(0,fe.jsxs)(fe.Fragment,{children:[P&&(yt(a)||yt(n)||yt(o)||Oe||s)?(0,fe.jsxs)("div",{className:k("crewlet-modal__header",Ze?"crewlet-modal__header--sheet":yt(n)?"crewlet-modal__header--subtitled":void 0),children:[s?(0,fe.jsx)(ul,{className:"crewlet-modal__back",label:c,icon:(0,fe.jsx)(ip,{size:"md"}),onClick:s}):null,yt(l)?(0,fe.jsx)("span",{className:"crewlet-modal__icon","aria-hidden":"true",children:l}):null,(0,fe.jsxs)("div",{className:"crewlet-modal__heading",children:[yt(a)?(0,fe.jsx)("h1",{className:k("crewlet-modal__title",Ze?"crewlet-modal__title--sheet":void 0),id:Ve,children:a}):null,yt(n)?(0,fe.jsx)("p",{className:"crewlet-modal__subtitle",id:z,children:n}):null]}),yt(o)?(0,fe.jsx)("div",{className:"crewlet-modal__actions",children:o}):null,Oe?(0,fe.jsx)(ul,{className:"crewlet-modal__close",label:Se,icon:(0,fe.jsx)(Do,{size:"md"}),onClick:t,disabledReason:h?void 0:me}):null]}):null,yt(d)||Y&&yt(a)?(0,fe.jsxs)("div",{ref:G,className:k("crewlet-modal__body",T?"crewlet-modal__body--stacked":void 0,C?"crewlet-modal__body--flush":void 0,Ze?"crewlet-modal__body--sheet":void 0),children:[Y&&yt(a)?(0,fe.jsx)("p",{className:"crewlet-modal__prompt-title",id:Ve,children:a}):null,(0,fe.jsx)(dw,{level:2,children:d})]}):null,yt(r)||yt(i)?(0,fe.jsxs)("div",{ref:se,className:k("crewlet-modal__footer",Ze?"crewlet-modal__footer--sheet":void 0),children:[yt(i)?(0,fe.jsx)("div",{className:"crewlet-modal__footer-start",children:i}):null,(0,fe.jsx)("div",{className:"crewlet-modal__footer-end",children:r})]}):null]});return(0,Kw.createPortal)((0,fe.jsx)("div",{ref:f?oe.veilRef:void 0,className:k("crewlet-modal-overlay",`crewlet-modal-overlay--${u}`,`crewlet-modal-overlay--${et}`,Dt&&"crewlet-modal-overlay--phone-sheet",p==="clear"&&"crewlet-modal-overlay--clear",e===document.body?"crewlet-modal-overlay--fixed":"crewlet-modal-overlay--in-host"),role:"presentation",style:{zIndex:oe.zIndex},children:(0,fe.jsx)("div",{...X,children:te?(0,fe.jsx)("form",{className:"crewlet-modal__form",onSubmit:He=>{He.preventDefault(),te()},children:tt}):tt})}),e)}function xp({open:e,onClose:t,onConfirm:a,title:n,message:l,children:r,confirmLabel:i="Confirm",cancelLabel:o="Cancel",destructive:s=!1,confirmVariant:c,cancelVariant:d="ghost",confirmDisabled:v=!1,confirmDisabledReason:u="Complete the confirmation above to continue.",submitting:m=!1,busyReason:b="Waiting for this to finish.",shape:y="prompt",size:S="sm"}){let h=`${(0,Ha.useId)()}-message`,f=c??(s?"danger":"primary"),p=v||m,w=(0,Ha.useCallback)(()=>{p||(async()=>{try{await a()}catch{}})()},[p,a]);return(0,fe.jsxs)(Iw,{open:e,onClose:t,title:n,shape:y,size:S,role:s?"alertdialog":"dialog",describedBy:yt(l)?h:void 0,dismissable:!m,closeDisabledReason:b,onSubmit:w,stackBody:!0,footer:(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(ka,{variant:d,onClick:t,disabledReason:m?b:void 0,children:o}),(0,fe.jsx)(ka,{type:"submit",variant:f,loading:m,disabledReason:v?u:void 0,children:i})]}),children:[yt(l)?(0,fe.jsx)("p",{className:"crewlet-modal__message",id:h,children:l}):null,r]})}var m5=j(be(),1);function dl(e){return`crewlet-presence-hue--${e}`}var hu=j(ht(),1);var su=j(be(),1),Ap={paths:["M543.42 868.92 l-34.44 -0.24 0 -58.77 0 -58.77 -28.92 0 -28.80 0 -40.20 -39.61 c-119.78 -118.25 -181.49 -179.97 -204.30 -204.30 -15.87 -16.93 -82.75 -96.74 -92.51 -110.38 l-3.76 -5.17 26.80 -18.46 c14.69 -10.11 34.09 -23.51 43.14 -29.86 55.25 -38.32 70.29 -48.43 71.12 -47.49 0.47 0.47 11.64 13.87 24.69 29.74 13.17 15.87 27.98 33.62 32.80 39.50 4.94 5.88 21.63 26.10 37.15 44.90 15.52 18.81 28.56 34.21 29.15 34.21 0.47 0.12 0.82 -30.44 0.82 -67.83 l0 -68.06 37.26 -34.56 c43.38 -40.20 61.83 -57.13 75.11 -69 l9.52 -8.46 261.78 0 261.90 0 47.14 45.73 c25.98 25.16 52.43 51.02 58.66 57.36 l11.52 11.52 0.24 67.94 0.35 67.83 31.74 -40.79 c17.51 -22.33 34.91 -45.02 38.91 -50.19 15.16 -20.34 44.32 -57.72 45.14 -58.07 0.71 -0.24 104.97 75.82 126.83 92.51 2.23 1.65 4.58 3.41 5.17 3.76 1.65 1.18 -7.99 14.22 -46.08 62.07 -35.38 44.32 -49.84 61.13 -92.39 106.97 -19.28 20.81 -38.91 41.73 -148.70 157.40 l-34.68 36.56 -26.45 0.12 c-19.04 0 -26.92 0.35 -27.98 1.41 -1.06 1.06 -1.41 15.05 -1.41 55.72 l0 54.31 -34.91 0.47 c-19.28 0.24 -53.72 0.24 -76.41 0 l-41.49 -0.47 0 -55.72 0 -55.72 -99.33 0 -99.33 0 -0.24 56.19 -0.35 56.07 -39.97 0 c-21.98 0 -55.48 -0.12 -74.29 -0.35z m94.74 -13.87 l7.17 -0.82 0 -54.89 c0 -49.02 0.24 -55.13 1.88 -55.72 1.06 -0.35 51.84 -0.71 112.85 -0.71 l110.97 0 0 55.84 0 55.84 62.89 0 62.89 0 0 -55.84 0 -55.84 31.50 0 31.50 0 14.69 -14.93 c30.80 -31.50 113.20 -118.49 144.47 -152.58 48.66 -53.01 81.34 -90.28 104.85 -119.43 22.80 -28.45 44.43 -56.42 44.43 -57.48 0 -0.59 -2 -2.47 -4.35 -4.23 -2.47 -1.76 -7.05 -5.17 -10.34 -7.64 -3.17 -2.35 -16.93 -12.34 -30.56 -22.22 -13.52 -9.87 -33.50 -24.57 -44.43 -32.68 -16.34 -12.11 -19.98 -14.34 -21.39 -13.17 -0.94 0.82 -5.88 6.82 -10.81 13.40 -4.94 6.47 -13.99 18.46 -20.10 26.57 -6.23 8.11 -26.57 34.44 -45.37 58.54 -18.81 24.10 -36.56 47.02 -39.50 50.78 -5.29 7.05 -5.29 7.05 -11.40 7.05 l-6.23 0 0 -79.58 0 -79.58 -37.85 -37.03 c-20.92 -20.45 -45.14 -44.08 -53.95 -52.66 l-15.99 -15.63 -256.84 0 -256.73 0 -47.49 44.20 c-26.21 24.33 -51.13 47.49 -55.60 51.37 l-7.88 7.05 0 79.11 0 79.23 -6.35 0 -6.35 0 -48.66 -58.54 c-26.80 -32.09 -55.95 -67.24 -64.89 -78.17 -8.93 -10.81 -16.69 -19.63 -17.16 -19.63 -0.94 0 -8.58 5.17 -34.32 22.92 -34.21 23.74 -46.08 31.86 -62.65 43.26 -10.34 7.05 -19.28 13.28 -19.87 13.87 -0.59 0.47 2.35 5.05 6.47 10.11 13.87 16.93 53.13 63.12 66.77 78.40 21.86 24.57 83.81 87.69 145.41 148.23 31.62 31.03 68.65 67.36 82.28 80.76 l24.69 24.45 33.50 0.24 33.38 0.35 0.35 59.13 0.24 59.01 53.37 0 c29.27 0 56.54 -0.35 60.54 -0.71z","M535.78 783.81 l-0.35 -59.13 -36.67 0 -36.67 0 -6.82 -6.47 c-48.78 -46.43 -176.91 -173.03 -210.41 -207.82 -24.69 -25.74 -75.70 -81.70 -93.69 -102.85 -3.29 -3.88 -5.29 -7.17 -4.70 -7.76 1.29 -1.06 58.30 -40.32 82.05 -56.42 l16.34 -11.05 3.64 4.47 c11.05 13.87 76.99 92.51 98.98 118.14 l25.74 29.97 15.63 0.35 15.52 0.35 0 -82.87 0 -82.75 50.55 -46.67 c27.86 -25.74 50.55 -47.14 50.55 -47.72 0 -0.59 46.78 -1.06 111.55 -1.06 l111.55 0 15.52 14.81 c15.28 14.58 15.52 14.69 17.98 12.58 1.29 -1.18 8.46 -7.76 15.75 -14.58 l13.40 -12.46 17.75 -0.71 c9.76 -0.47 58.77 -0.82 108.85 -0.82 l90.98 0 14.34 13.75 c7.76 7.64 24.57 23.86 37.15 36.20 12.58 12.34 29.15 28.45 36.67 35.85 l13.87 13.40 0.24 82.87 0.35 82.99 14.22 0.35 14.34 0.35 4.47 -5.64 c2.47 -3.06 11.52 -14.11 19.98 -24.45 8.46 -10.34 30.56 -38.32 49.14 -62.30 43.85 -56.42 46.20 -59.36 48.43 -59.36 2.12 0 4.82 1.88 47.96 33.27 43.02 31.27 45.37 33.03 45.37 34.09 0 0.82 -39.03 46.20 -62.42 72.53 -62.42 70.29 -106.50 117.67 -184.08 197.60 l-50.78 52.43 -13.28 0.71 c-7.29 0.47 -23.98 0.82 -37.03 0.82 l-23.86 0 0 57.01 0 57.01 -49.37 0 -49.37 0 0 -56.42 0 -56.42 -114.37 0 c-63.01 0 -120.13 0.35 -126.95 0.82 l-12.58 0.71 0 55.72 0 55.60 -47.61 0 -47.61 0 -0.24 -59.01z m443.16 -373.22 l-0.35 -119.66 -223.93 0.12 -223.93 0.12 -0.35 119.43 -0.24 119.55 224.52 0 224.52 0 -0.24 -119.55z","M546.36 516.39 c-0.24 -0.59 -0.47 -4.94 -0.35 -9.76 0 -4.82 0.12 -52.54 0.35 -106.15 l0.24 -97.21 209.59 0.24 209.47 0.35 0.35 106.73 0.24 106.62 -209.71 0 c-115.43 0 -209.94 -0.35 -210.18 -0.82z m121.07 -100.50 l-0.35 -66.18 -34.32 -0.35 -34.44 -0.24 0 66.41 0 66.41 34.68 0 34.68 0 -0.24 -66.06z m260.96 0 l-0.35 -66.18 -34.09 0 -34.09 0 0 10.93 c0 5.88 0.12 35.62 0.35 66.06 l0.24 55.25 34.09 0 34.09 0 -0.24 -66.06z"],box:{left:110.48999999999992,top:196.30999999999992,right:1389.0800000000002,bottom:869.2899999999998},centroid:{x:755.6746766446299,y:497.3295661269271}},uu=e=>e.reduce((t,a,n)=>{let l=e[(n+1)%e.length];return t+a[0]*l[1]-l[0]*a[1]},0);function Xw(e,t,a){for(let n of e)n.forEach((l,r)=>{let i=n[(r+1)%n.length];l[1]!==i[1]&&a.push(l[1]<i[1]?{x0:l[0],y0:l[1],x1:i[0],y1:i[1],wind:1,add:t}:{x0:i[0],y0:i[1],x1:l[0],y1:l[1],wind:-1,add:t})})}var hi=(e,t)=>t===e.y0?e.x0:t===e.y1?e.x1:e.x0+(t-e.y0)*(e.x1-e.x0)/(e.y1-e.y0);function v5(e){let t=new Set;for(let a of e)t.add(a.y0),t.add(a.y1);for(let a=0;a<e.length;a+=1){let n=e[a];for(let l=a+1;l<e.length&&e[l].y0<n.y1;l+=1){let r=e[l],i=Math.max(n.y0,r.y0),o=Math.min(n.y1,r.y1);if(o<=i)continue;let s=hi(n,i)-hi(r,i),c=hi(n,o)-hi(r,o);s*c<0&&t.add(i+(o-i)*s/(s-c))}}return[...t].sort((a,n)=>a-n)}var w5=1e-9;function y5(){let e=new Map;return(t,a)=>{let n=e.get(t);n||e.set(t,n=[]);for(let l of n)if(Math.abs(l-a)<=w5)return l;return n.push(a),a}}function b5(e,t,a,n){let l=e.map(d=>({e:d,a:n(t,hi(d,t)),b:n(a,hi(d,a))})).sort((d,v)=>d.a+d.b-(v.a+v.b)),r=[],i=0,o=0,s=!1,c=[0,0];for(let d=0;d<l.length;){let{a:v,b:u}=l[d];for(;d<l.length&&l[d].a===v&&l[d].b===u;d+=1){let{e:b}=l[d];b.add?i+=b.wind:o+=b.wind}let m=i!==0&&o===0;m&&!s?c=[v,u]:!m&&s&&r.push({left:c,right:[v,u]}),s=m}return r}function Qw(e,t){let a=[],n=0;for(let[l,r]of e){let i=l;for(;n<t.length&&t[n][1]<=i;)n+=1;for(let o=n;o<t.length&&t[o][0]<r&&i<r;o+=1){let[s,c]=t[o];s>i&&a.push([i,s]),i=Math.max(i,c)}i<r&&a.push([i,r])}return a}function x5(e,t){let a=[];return t.forEach((n,l)=>{let r=e[l],i=e[l+1];for(let{left:o,right:s}of n)a.push([[s[0],r],[s[1],i]]),a.push([[o[1],i],[o[0],r]])}),e.forEach((n,l)=>{let r=l>0?t[l-1].map(({left:o,right:s})=>[o[1],s[1]]):[],i=l<t.length?t[l].map(({left:o,right:s})=>[o[0],s[0]]):[];for(let[o,s]of Qw(i,r))a.push([[o,n],[s,n]]);for(let[o,s]of Qw(r,i))a.push([[s,n],[o,n]])}),a.filter(([n,l])=>n[0]!==l[0]||n[1]!==l[1])}var Mp=1e-9;function _5(e){let t=[...e],a=!0;for(;a&&t.length>=3;){a=!1;let n=[];for(let l=0;l<t.length;l+=1){let r=n.length>0?n[n.length-1]:t[t.length-1],i=t[l],o=t[(l+1)%t.length],s=i[0]-r[0],c=i[1]-r[1],d=o[0]-i[0],v=o[1]-i[1],u=Math.hypot(s,c)<Mp,m=Math.abs(s*v-c*d)<Mp;if(u||m){a=!0;continue}n.push(i)}t=n}return t}function T5(e){let t=r=>`${r[0]} ${r[1]}`,a=new Map;e.forEach(([r],i)=>{let o=a.get(t(r));o?o.push(i):a.set(t(r),[i])});let n=new Uint8Array(e.length),l=[];return e.forEach((r,i)=>{if(n[i])return;let o=[],s=i;for(;s!==void 0;){n[s]=1;let[c,d]=e[s];if(o.push(c),d[0]===r[0][0]&&d[1]===r[0][1])break;s=a.get(t(d))?.find(v=>!n[v])}l.push(o)}),l.map(_5).filter(r=>r.length>=3&&Math.abs(uu(r))>Mp)}function Np(e,t=[]){let a=[];Xw(e,!0,a),Xw(t,!1,a),a.sort((s,c)=>s.y0-c.y0);let n=v5(a),l=y5(),r=[],i=0,o=[];for(let s=0;s+1<n.length;s+=1){let c=n[s],d=n[s+1];for(;i<a.length&&a[i].y0<=c;)o.push(a[i++]);o=o.filter(v=>v.y1>c),r.push(b5(o,c,d,l))}return T5(x5(n,r))}var E5=e=>e.reduce((t,a)=>t+uu(a),0)/2;function S5(e){let t=0,a=0;for(let l of e)l.forEach((r,i)=>{let o=l[(i+1)%l.length],s=r[0]*o[1]-o[0]*r[1];t+=(r[0]+o[0])*s,a+=(r[1]+o[1])*s});let n=6*E5(e);return[t/n,a/n]}var _p=e=>uu(e)<0?e.reverse():e;function ty(e,t,a=4){let n=[];for(let l of e)l.forEach((r,i)=>{let o=l[(i+1)%l.length],s=l[(i+2)%l.length],c=Math.hypot(o[0]-r[0],o[1]-r[1]),d=(o[1]-r[1])/c,v=-(o[0]-r[0])/c,u=Math.hypot(s[0]-o[0],s[1]-o[1]),m=(s[1]-o[1])/u,b=-(s[0]-o[0])/u,y=t;n.push(_p([[r[0]+d*y,r[1]+v*y],[o[0]+d*y,o[1]+v*y],[o[0]-d*y,o[1]-v*y],[r[0]-d*y,r[1]-v*y]]));let S=(o[0]-r[0])*(s[1]-o[1])-(o[1]-r[1])*(s[0]-o[0]);if(S===0)return;let h=S>0?1:-1,f=[o[0]+h*d*y,o[1]+h*v*y],p=[o[0]+h*m*y,o[1]+h*b*y],w=d+m,T=v+b,C=w*w+T*T;if(C>0&&2/Math.sqrt(C)<=a){let N=[o[0]+h*w*2*y/C,o[1]+h*T*2*y/C];n.push(_p([o,f,N,p]))}else n.push(_p([o,f,p]))});return n}var Zw=e=>Math.round(e*100)/100;function Jw(e){return e.map(t=>`M${t.map(([n,l])=>`${Zw(n)} ${Zw(l)}`).filter((n,l,r)=>n!==r[l-1]).join("L")}Z`).join("")}var ay=["crewlet","hexlet","peaklet","prismlet","towerlet","bricklet","gemlet","coglet","pluslet","shieldlet","stacklet","sparklet","cloudlet","foxlet","rocketlet","crownlet","cactlet","wisplet","heartlet","flasklet","chiplet","duolet","chatlet","pagelet","archlet","dashlet","octlet","conelet","hivelet","folderlet"],Uo=e=>typeof e=="string"&&ay.includes(e),cu=96,A5=1.35,ny=.9,Lo=1.3,M5=2,Tp={full:{width:.164,height:.62},compact:{width:.19,height:.68},offset:.312},Ep={half:3.2,depth:2.6},Fw=e=>Math.round(e*100)/100;function $w(e,t){let a=[];return e.forEach((n,l)=>{let r=typeof t=="number"?t:t[l]??0;if(!r){a.push(n);return}let i=o=>{let s=o[0]-n[0],c=o[1]-n[1],d=Math.min(r/Math.hypot(s,c),.45);return[n[0]+s*d,n[1]+c*d]};a.push(i(e[(l-1+e.length)%e.length]),i(e[(l+1)%e.length]))}),a}var Ww=e=>`M${e.map(([t,a])=>`${Fw(t)} ${Fw(a)}`).join("L")}Z`;function Le(e,t=0){let a=typeof t=="number"?e.map(()=>t):t;return uu(e)<0?$w([...e].reverse(),[...a].reverse()):$w(e,a)}var pe=(e,t,a,n,l=0)=>Le([[e,t],[e+a,t],[e+a,t+n],[e,t+n]],l),Ge=(e,t,a,n=10)=>[pe(e,a,n,cu-a),pe(t,a,n,cu-a)];function N5(e,t,a,n,l){let r=[];for(let i=0;i<l;i+=1){let o=(i*360/l-90)*(Math.PI/180);for(let[s,c]of[[n,-15],[a,-8.5],[a,8.5],[n,15]]){let d=o+c*(Math.PI/180);r.push([e+s*Math.cos(d),t+s*Math.sin(d)])}}return Le(r)}function O5(e){let t=e.flat(),a=t.map(([i])=>i),n=t.map(([,i])=>i),l=Math.min(...a),r=Math.min(...n);return{x:l,y:r,width:Math.max(...a)-l,height:Math.max(...n)-r}}var z5=([e,t,a,n])=>({x:e,y:t,width:a,height:n}),ly=new WeakMap;function xe(e){let t=e.holes??[],a,n={kind:"drawn",name:e.name,shape:e.shape,shapes:e.shapes.map(Ww),holes:t.map(Ww),visor:z5(e.visor),notch:e.notch===void 0?null:[e.notchX??50,e.notch],get bounds(){return a??(a=O5([...Cp(n),...ry(n)]))}};return ly.set(n,{parts:e.shapes,holes:t}),n}var du=e=>ly.get(e);function Cp(e){let t=du(e);return t.silhouette??(t.silhouette=Np(t.parts))}function ry(e){let t=du(e);return t.reach??(t.reach=ty(Cp(e),ny+A5))}var Op=.095,iy=760,oy=869,zp=(e,t)=>[50+(e-iy)*Op,cu+(t-oy)*Op],C5=zp(Ap.centroid.x,Ap.centroid.y);function k5(){let{paths:e,box:t}=Ap,[a,n]=zp(t.left,t.top),[l,r]=zp(t.right,t.bottom);return{kind:"mark",name:"Crewlet",shape:"The original mark, arms raised",transform:`translate(50 ${cu}) scale(${Op}) translate(${-iy} ${-oy})`,keyline:e[0],body:[e[1],e[2]],bounds:{x:a,y:n,width:l-a,height:r-n}}}var kp={crewlet:k5(),hexlet:xe({name:"Hexlet",shape:"Hexagon with pointed flanks",shapes:[Le([[30,22],[70,22],[86,54],[70,86],[30,86],[14,54]],[5,5,4,4,4,4]),...Ge(34,56,84)],visor:[28,38,44,20],notch:22}),peaklet:xe({name:"Peaklet",shape:"Pentagon with a peaked roof",shapes:[Le([[50,12],[82,36],[82,86],[18,86],[18,36]],[6,5,4,4,5]),...Ge(28,62,84)],visor:[26,44,48,20]}),prismlet:xe({name:"Prismlet",shape:"Triangle with cut tips",shapes:[Le([[50,10],[90,86],[10,86]],[9,8,8]),...Ge(28,62,84)],visor:[31,54,38,18]}),towerlet:xe({name:"Towerlet",shape:"Tall pillar, narrow stance",shapes:[pe(32,12,36,74,[8,8,4,4]),...Ge(35,55,84)],visor:[36,24,28,16],notch:12}),bricklet:xe({name:"Bricklet",shape:"Wide, low slab",shapes:[pe(10,42,80,44,[9,9,6,6]),...Ge(22,68,84)],visor:[21,50,58,19],notch:42}),gemlet:xe({name:"Gemlet",shape:"Diamond on its point",shapes:[Le([[50,6],[90,48],[50,90],[10,48]],[7,7,16,7]),...Ge(40,52,76,8)],visor:[27,38,46,20]}),coglet:xe({name:"Coglet",shape:"Eight-tooth gear",shapes:[N5(50,52,37,31,8),...Ge(36,54,78)],visor:[30,40,40,18]}),pluslet:xe({name:"Pluslet",shape:"Cross with squared arms",shapes:[pe(34,14,32,72,[7,7,0,0]),pe(10,34,80,30,7),...Ge(37,53,84)],visor:[20,40,60,18],notch:14}),shieldlet:xe({name:"Shieldlet",shape:"Flat crown, pointed base",shapes:[Le([[16,16],[84,16],[84,54],[50,92],[16,54]],[9,9,5,14,5]),...Ge(41,51,79,8)],visor:[26,28,48,20],notch:16}),stacklet:xe({name:"Stacklet",shape:"Stepped crown, square base",shapes:[Le([[34,12],[66,12],[66,26],[82,26],[82,86],[18,86],[18,26],[34,26]],[4,4,0,5,4,4,5,0]),...Ge(28,62,84)],visor:[26,40,48,20],notch:12}),sparklet:xe({name:"Sparklet",shape:"Faceted drop",shapes:[Le([[50,8],[80,48],[78,74],[64,86],[36,86],[22,74],[20,48]],[6,4,2,2,2,2,4]),...Ge(36,54,84)],visor:[30,48,40,18]}),cloudlet:xe({name:"Cloudlet",shape:"Three-lobed cloud",shapes:[pe(14,44,72,42,[0,0,8,8]),pe(16,30,32,32,9),pe(33,18,34,34,10),pe(56,32,30,30,9),...Ge(30,60,84)],visor:[24,48,52,18],notch:18}),foxlet:xe({name:"Foxlet",shape:"Square body, pointed ears",shapes:[pe(18,34,64,52,6),Le([[20,36],[26,12],[44,36]],[0,4,0]),Le([[56,36],[74,12],[80,36]],[0,4,0]),...Ge(28,62,84)],visor:[26,46,48,20]}),rocketlet:xe({name:"Rocketlet",shape:"Nose cone and swept fins",shapes:[Le([[50,6],[66,26],[66,80],[34,80],[34,26]],[5,3,3,3,3]),Le([[34,54],[34,80],[18,90],[18,70]],[0,0,3,3]),Le([[66,54],[82,70],[82,90],[66,80]],[0,3,3,0]),...Ge(37,55,80,8)],visor:[37,32,26,16]}),crownlet:xe({name:"Crownlet",shape:"Three-point crown",shapes:[pe(18,40,64,46,[0,0,6,6]),Le([[18,44],[18,18],[34,32],[50,12],[66,32],[82,18],[82,44]],[0,3,0,3,0,3,0]),...Ge(28,62,84)],visor:[27,48,46,20]}),cactlet:xe({name:"Cactlet",shape:"Trunk with two raised arms",shapes:[pe(32,12,36,74,[10,10,0,0]),pe(16,50,18,9,[0,0,0,3]),pe(16,28,9,31,[4.5,4.5,0,3]),pe(66,58,18,9,[0,0,3,0]),pe(75,38,9,29,[4.5,4.5,3,0]),...Ge(36,54,84)],visor:[37,26,26,16],notch:12}),wisplet:xe({name:"Wisplet",shape:"Tall ghost with a zigzag hem",shapes:[Le([[16,10],[84,10],[84,92],[72.5,82],[61,92],[50,82],[39,92],[27.5,82],[16,92]],[14,14,2,0,2,0,2,0,2])],visor:[26,28,48,20],notch:10}),heartlet:xe({name:"Heartlet",shape:"Faceted heart",shapes:[Le([[50,26],[62,14],[78,14],[90,26],[90,44],[50,84],[10,44],[10,26],[22,14],[38,14]],[0,3,3,3,4,6,4,3,3,3]),...Ge(41,51,74,8)],visor:[23,30,54,18]}),flasklet:xe({name:"Flasklet",shape:"Lab flask with a narrow neck",shapes:[pe(35,6,30,7,2),pe(40,10,20,22),Le([[40,28],[60,28],[86,80],[86,86],[14,86],[14,80]],[0,0,6,3,3,6]),...Ge(26,64,84)],visor:[33,54,34,14],notch:6}),chiplet:xe({name:"Chiplet",shape:"Square chip with pins",shapes:[pe(24,20,52,60,6),...[31,47,63].map(e=>pe(e,11,6,10)),...[32,47,62].map(e=>pe(15,e,10,6)),...[32,47,62].map(e=>pe(75,e,10,6)),...[31,47,63].map(e=>pe(e,78,6,18))],holes:[pe(29,70,5,5)],visor:[31,34,38,18]}),duolet:xe({name:"Duolet",shape:"Small head on a wide body",shapes:[pe(30,10,40,34,8),pe(18,40,64,46,6),...Ge(28,62,84)],visor:[36,19,28,15],notch:10}),chatlet:xe({name:"Chatlet",shape:"Speech bubble with a tail",shapes:[pe(14,22,72,54,8),Le([[26,72],[46,72],[22,94]],[0,0,2])],visor:[24,34,52,22],notch:22}),pagelet:xe({name:"Pagelet",shape:"Page with a folded corner",shapes:[Le([[20,10],[64,10],[80,26],[80,86],[20,86]],[4,0,0,4,4]),...Ge(28,62,84)],holes:[pe(63.3,10,1.4,17.4),pe(63.3,25.3,17,1.4)],visor:[27,36,46,20],notch:10}),archlet:xe({name:"Archlet",shape:"Gate with built-in legs",shapes:[Le([[16,18],[84,18],[84,96],[64,96],[64,74],[36,74],[36,96],[16,96]],[8,8,0,0,4,4,0,0])],visor:[25,30,50,22],notch:18}),dashlet:xe({name:"Dashlet",shape:"Body leaning forward",shapes:[Le([[29,14],[87,14],[71,86],[13,86]],6),...Ge(20,48,84)],visor:[31.5,28,42,20],notch:14,notchX:58}),octlet:xe({name:"Octlet",shape:"Regular octagon",shapes:[pe(16,16,68,68,20),...Ge(35,55,81)],visor:[26,36,48,22],notch:16}),conelet:xe({name:"Conelet",shape:"Narrow crown, wide base",shapes:[Le([[30,12],[70,12],[88,84],[12,84]],[6,6,5,5]),...Ge(26,64,82)],visor:[28,40,44,20],notch:12}),hivelet:xe({name:"Hivelet",shape:"Upright honeycomb cell",shapes:[Le([[50,6],[84,24],[84,72],[50,90],[16,72],[16,24]],[6,4,4,6,4,4]),...Ge(40,52,80,8)],visor:[25,36,50,20]}),folderlet:xe({name:"Folderlet",shape:"Folder with a tab",shapes:[Le([[12,14],[38,14],[50,26],[88,26],[88,84],[12,84]],[4,0,0,6,5,5]),...Ge(26,64,82)],visor:[24,40,52,22]})},Pw=.5,Sp=(e,t,a,n)=>[[e,t],[e+a,t],[e+a,t+n],[e,t+n]];function R5(e){let t=1/0;return e.forEach((a,n)=>{let l=e[(n+1)%e.length],r=Math.hypot(l[0]-a[0],l[1]-a[1]);if(r===0)return;let i=Math.max(...e.map(o=>Math.abs((l[0]-a[0])*(o[1]-a[1])-(l[1]-a[1])*(o[0]-a[0]))/r));t=Math.min(t,i)}),t}function H5(e,t){let{visor:a,notch:n}=e,l=t==="full",r=l?Tp.full:Tp.compact,i=a.width*r.width,o=a.height*r.height,s=a.y+(a.height-o)/2,c=a.x+a.width/2,d=a.width*Tp.offset,v=[c-d,c+d].map(u=>Sp(u-i/2,s,i,o));n&&v.push([[n[0]-Ep.half,n[1]-1],[n[0]+Ep.half,n[1]-1],[n[0],n[1]+Ep.depth]]);for(let u of du(e).holes)(l||R5(u)>M5)&&v.push(u);if(l){let u=Lo/2;v.push(Sp(a.x-u,a.y-u,a.width+Lo,a.height+Lo)),v.push([...Sp(a.x+u,a.y+u,a.width-Lo,a.height-Lo)].reverse())}return v}function sy(e,t){let a=e.x+e.width/2,n=e.y+e.height/2,l=a+Pw*(t[0]-a),r=n+Pw*(t[1]-n),i=Math.max(e.width+2*Math.abs(l-a),e.height+2*Math.abs(r-n));return{x:l-i/2,y:r-i/2,width:i,height:i}}function D5(e){let{parts:t}=du(e),a=Cp(e),n={},l=i=>Jw(Np(t,H5(e,i))),r=()=>Jw(Np([...a,...ry(e)],[...a,...ty(a,ny)]));return{frame:sy(e.bounds,S5(a)),paths:i=>n[i]??(n[i]=i==="full"?[r(),l("full")]:[l("compact")])}}var ey=new Map;function G5(e){let t=ey.get(e);if(t)return t;let a=kp[e];if(a.kind==="mark"){let n=[a.keyline,...a.body];t={frame:sy(a.bounds,C5),paths:l=>l==="full"?n:a.body}}else t=D5(a);return ey.set(e,t),t}var L5=e=>Math.round(e*100)/100,U5=({character:e,detail:t="full",...a})=>{let n=kp[e],{frame:l,paths:r}=G5(e),i=r(t).map(o=>(0,su.jsx)("path",{d:o},o));return(0,su.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:[l.x,l.y,l.width,l.height].map(L5).join(" "),width:"1em",height:"1em","aria-hidden":"true",focusable:"false","data-character":e,"data-detail":t,...a,children:(0,su.jsx)("g",{fill:"currentColor",transform:n.kind==="mark"?n.transform:void 0,children:i})})},Rp=U5;var Nt=j(be(),1);var B5={working:"working",needs:"needs you",stopped:"stopped"},Hp={xs:20,sm:26,md:32,lg:40};var q5=/^agent(?:[\s._-]+)(?=\S)/i;function V5(e,t){if(e===void 0||t!=="agent")return e;let a=e.replace(q5,"");return a.trim()?a:e}var Y5=56,j5=e=>{if(!e)return"?";let t=e.trim().split(/[\s\-_.:]+/).map(r=>r.replace(/^\p{P}+|\p{P}+$/gu,"")).filter(Boolean);if(t.length===0)return"?";let a=r=>(Array.from(r)[0]??"").toUpperCase();if(t.length>=2)return t.slice(0,2).map(a).join("")||"?";let n=t[0],l=n.split(/(?<=\p{Ll})(?=\p{Lu})/u);return l.length>=2?l.slice(0,2).map(a).join(""):Array.from(n).slice(0,2).map(r=>r.toUpperCase()).join("")||"?"},K5=10,I5=e=>{let t=0;for(let a=0;a<e.length;a+=1)t=t*31+e.charCodeAt(a)>>>0;return t%K5};function X5(e){return typeof e=="number"?e:Hp[e]}var Bo=({src:e,name:t,size:a="md",kind:n="agent",tone:l="neutral",ring:r,status:i,mark:o,markLabel:s,decorative:c=!1,colorSeed:d,character:v,hue:u,icon:m,className:b,style:y,...S})=>{let[h,f]=(0,hu.useState)(!1);(0,hu.useEffect)(()=>{f(!1)},[e]);let p=typeof a=="number"?null:a,w=X5(a),T=p===null?{"--crewlet-avatar-size":`${w}px`,fontSize:Math.max(9,Math.round(w*.36))}:{},C=l==="seeded"?I5(d??t??""):null,N=i===void 0&&o!==void 0&&o!==null,O=i!==void 0||N,I=i!==void 0?B5[i]:N?s:void 0,R=t?`${t} avatar`:"Avatar",te=I?`${R}, ${I}`:R,Se=k("crewlet-avatar",`crewlet-avatar--${n}`,p===null?null:`crewlet-avatar--${p}`,O?"crewlet-avatar--notched":null,r===void 0||O?null:`crewlet-avatar--ring-${r}`,O?null:b),me=O?T:{...T,...y};function q(){return v!==void 0&&n==="agent"?(0,Nt.jsx)("span",{...S,className:k(Se,"crewlet-avatar--character",u===void 0?"crewlet-avatar--neutral":`crewlet-avatar--hue-${u}`),style:me,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:te,children:(0,Nt.jsx)(Rp,{className:"crewlet-avatar__character",character:v,detail:w>=Y5?"full":"compact"})}):e&&!h?(0,Nt.jsx)("img",{...S,className:k(Se,"crewlet-avatar--image"),style:me,src:e,alt:c?"":I?`${t??""}, ${I}`:t??"","aria-hidden":c?!0:void 0,onError:()=>f(!0)}):(0,Nt.jsx)("span",{...S,className:k(Se,"crewlet-avatar--fallback",`crewlet-avatar--${l}`,C===null?null:`crewlet-avatar--tint-${C}`,m==null?null:"crewlet-avatar--icon"),style:me,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:te,children:m==null?j5(V5(t,n)):(0,Nt.jsx)("span",{className:"crewlet-avatar__icon","aria-hidden":"true",children:m})})}let H=q();return O?(0,Nt.jsxs)("span",{className:k("crewlet-avatar-frame",b),style:{"--crewlet-avatar-size":`${w}px`,...y},children:[H,i!==void 0?(0,Nt.jsx)("span",{className:`crewlet-avatar__status crewlet-avatar__status--${i}`,"aria-hidden":"true",children:Q5[i]}):(0,Nt.jsx)("span",{className:"crewlet-avatar__status crewlet-avatar__status--mark","aria-hidden":"true",children:o})]}):H},Q5={working:(0,Nt.jsx)("svg",{viewBox:"0 0 14 14",focusable:"false",children:(0,Nt.jsx)("path",{d:"M5.4 3.9 10.2 7l-4.8 3.1z",fill:"currentColor"})}),needs:(0,Nt.jsxs)("svg",{viewBox:"0 0 14 14",focusable:"false",children:[(0,Nt.jsx)("path",{d:"M5.1 5.3a1.9 1.9 0 1 1 2.7 1.7c-.55.27-.8.62-.8 1.15v.3",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,Nt.jsx)("circle",{cx:"7",cy:"10.45",r:".85",fill:"currentColor"})]}),stopped:(0,Nt.jsx)("svg",{viewBox:"0 0 14 14",focusable:"false",children:(0,Nt.jsx)("rect",{x:"4.6",y:"4.6",width:"4.8",height:"4.8",rx:".7",fill:"currentColor"})})};var An=j(be(),1);function Dp({members:e,self:t=!0,max:a=4,size:n="sm",onSelect:l,label:r,labels:i,className:o}){if(!Number.isInteger(a)||a<1)throw new RangeError(`PresenceStack max must be a whole number of at least 1; it was ${a}`);let s=Co(i),c=Of(e);if(c.length===0&&!t)return null;let d=c.slice(0,a),v=c.slice(a),u=r??s.here(c.length,t),m=[u,...c.map(h=>s.member(h))].join(". "),b=h=>(0,An.jsx)(Bo,{name:h.name,kind:h.kind,src:h.src,character:h.character!==void 0&&Uo(h.character)?h.character:void 0,hue:h.kind==="agent"?h.hue:void 0,size:n,decorative:!0,className:k("crewlet-presence-stack__badge",h.hue!==void 0&&h.activity!=="idle"&&dl(h.hue),h.hue!==void 0&&h.activity!=="idle"&&"crewlet-presence-stack__badge--present",h.activity==="idle"&&"crewlet-presence-stack__badge--idle")}),y=v.length>0?(0,An.jsxs)("span",{className:"crewlet-avatar-stack__member crewlet-avatar-stack__more","aria-hidden":"true",children:["+",v.length]}):null,S={"--crewlet-avatar-stack-size":`${Hp[n]}px`};return l===void 0?c.length===0?null:(0,An.jsxs)("span",{className:k("crewlet-avatar-stack","crewlet-presence-stack",o),style:S,role:"img","aria-label":m,children:[d.map(h=>(0,An.jsx)("span",{className:k("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${h.kind}`),children:b(h)},h.id)),y]}):(0,An.jsxs)("div",{className:k("crewlet-avatar-stack","crewlet-presence-stack",o),style:S,role:"group","aria-label":u,children:[d.map(h=>(0,An.jsx)("button",{type:"button",className:k("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${h.kind}`),"aria-label":s.member(h),title:s.member(h),onClick:()=>l(h),children:b(h)},h.id)),y,v.length>0?(0,An.jsx)(Ht,{children:`${s.more(v.length)}: ${v.map(h=>s.member(h)).join(", ")}`}):null]})}var Gp=j(ht(),1),Z5=j(be(),1),cy={text:"",n:0},J5=new Set,F5=0;function $5(e){if(e!==""){if(F5===0){console.warn("[crewlet] announce() was called with no <Announcer> mounted, so nothing was said:",e);return}cy={text:e,n:cy.n+1};for(let t of[...J5])t()}}function uy(){return(0,Gp.useCallback)($5,[])}var Ta=j(ht(),1),hl=j(be(),1);function dy({label:e,max:t=6,overflow:a="expand",moreLabel:n=s=>`+${s} more`,countLabel:l=s=>`+${s}`,expandedMessage:r=s=>`Showing all ${s}.`,className:i,children:o}){let[s,c]=(0,Ta.useState)(!1),d=uy(),v=(0,Ta.useRef)(null),u=Ta.Children.toArray(o),m=a==="fit",b=W5(v,m,u.length),y=m?u.slice(0,b):s?u:u.slice(0,t),S=u.length-y.length;return(0,hl.jsxs)("ul",{ref:v,tabIndex:-1,className:k("crewlet-tag-group",m&&"crewlet-tag-group--fit",i),"aria-label":`${e}, ${u.length}`,children:[y.map((h,f)=>(0,hl.jsx)("li",{className:"crewlet-tag-group__item",children:h},f)),S>0&&m?(0,hl.jsx)("li",{className:"crewlet-tag-group__item","data-count":"",children:(0,hl.jsx)("span",{className:"crewlet-tag-group__count",children:l(S)})}):S>0?(0,hl.jsx)("li",{className:"crewlet-tag-group__item",children:(0,hl.jsx)("button",{type:"button",className:"crewlet-tag-group__more",onClick:()=>{c(!0),v.current?.focus(),d(r(u.length))},children:n(S)})}):null]})}function W5(e,t,a){let[n,l]=(0,Ta.useState)(a),r=(0,Ta.useRef)(null);return(0,Ta.useLayoutEffect)(()=>{t&&l(a)},[t,a]),(0,Ta.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;let o=[...i.children],s=o[0];if(!s)return;let c=s.offsetTop,d=c+s.offsetHeight,v=h=>h.offsetTop===c||h.offsetTop<d,u=o.filter(h=>!h.hasAttribute("data-count")),m=o.find(h=>h.hasAttribute("data-count")),b=u.filter(v).length,y=m&&!v(m)?b-1:b,S=Math.max(1,Math.min(y,u.length));S<u.length&&l(S)},[e,t,n,a]),(0,Ta.useLayoutEffect)(()=>{let i=e.current;if(!t||!i||typeof ResizeObserver!="function")return;let o=new ResizeObserver(([s])=>{let c=s?.contentRect.width??0;r.current!==null&&r.current!==c&&l(a),r.current=c});return o.observe(i),()=>o.disconnect()},[e,t,a]),t?n:a}var qo=j(be(),1);function hy({name:e,hue:t,kind:a="human",editing:n=!1,placement:l="top-end",className:r,...i}){let o=typeof e=="string"?e:e.join(", ");return(0,qo.jsxs)("span",{...i,"aria-hidden":"true",className:k("crewlet-cursor-flag",dl(t),`crewlet-cursor-flag--${a}`,`crewlet-cursor-flag--${l}`,r),children:[n?(0,qo.jsx)(dp,{size:"xs",className:"crewlet-cursor-flag__glyph"}):null,(0,qo.jsx)("span",{className:"crewlet-cursor-flag__name",children:o})]})}var Ke=j(ht(),1),fy=j(nr(),1);var fi=j(be(),1);function py(e){return Number.parseFloat(e)}function P5(e,t){if(typeof e=="function"){let n=e(t);return typeof n=="function"?n:()=>{e(null)}}if(!e)return()=>{};let a=e;return a.current=t,()=>{a.current=null}}var e_=py(vp.duration.slow),t_=py(vp.duration.base);function Vo({content:e,placement:t="top",align:a="center",disabled:n=!1,openDelay:l=e_,closeDelay:r=t_,className:i,children:o}){let c=`${(0,Ke.useId)()}-tooltip`,[d,v]=(0,Ke.useState)(!1),u=(0,Ke.useRef)(null),m=(0,Ke.useRef)(null),b=(0,Ke.useRef)(void 0),y=(0,Ke.useRef)({pointer:!1,focus:!1}),[S,h]=(0,Ke.useState)(null),f=sl(),p=(0,Ke.useCallback)(()=>{b.current!==void 0&&clearTimeout(b.current),b.current=void 0},[]),w=(0,Ke.useCallback)(q=>{if(p(),!n){if(q<=0){v(!0);return}b.current=setTimeout(()=>v(!0),q)}},[p,n]),T=(0,Ke.useCallback)(q=>{p();let H=()=>{y.current.pointer||y.current.focus||v(!1)};if(q<=0){H();return}b.current=setTimeout(H,q)},[p]),C=di({open:d,onDismiss:()=>{y.current={pointer:!1,focus:!1},p(),v(!1)}});(0,Ke.useEffect)(()=>p,[p]),(0,Ke.useEffect)(()=>{n&&(p(),v(!1))},[n,p]);let N=(0,Ke.useCallback)(()=>{let q=u.current,H=m.current;if(!q||!H||!f)return;let Ve=f!==document.body,z=Ve?f.getBoundingClientRect():oi(),Y=q.getBoundingClientRect(),P=H.getBoundingClientRect(),Ze=getComputedStyle(q).direction==="rtl",Dt={x:(a==="center"?Y.x+Y.width/2-P.width/2:Ze?Y.right-P.width:Y.x)-(Ve?z.x:0),y:Y.y-(Ve?z.y:0),width:Y.width,height:Y.height},st={x:ot,y:ot,width:z.width-2*ot,height:z.height-2*ot};if(si(Y,z,Ve)){v(!1);return}let G=ii(Dt,{width:P.width,height:P.height},st,ot,t==="top"?"above":"below");h(se=>se&&se.left===G.left&&se.top===G.top&&se.side===G.side?se:G)},[a,f,t]);(0,Ke.useLayoutEffect)(()=>{if(!d)return;N();let q=()=>N();f?.addEventListener(Sn,q),window.addEventListener("resize",q),window.addEventListener("scroll",q,!0);let H=typeof ResizeObserver=="function"?new ResizeObserver(q):null;return m.current&&H?.observe(m.current),()=>{f?.removeEventListener(Sn,q),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0),H?.disconnect()}},[d,f,N]),(0,Ke.useEffect)(()=>{d||h(null)},[d]);let O=o,I=O.props["aria-describedby"],R=O.props.ref,te=(0,Ke.cloneElement)(O,{ref:q=>{u.current=q,C.insideRef(q);let H=P5(R,q);return()=>{u.current=null,C.insideRef(null),H()}},"aria-describedby":d?k(I,c):I,onPointerEnter:q=>{y.current.pointer=!0,w(l),O.props.onPointerEnter?.(q)},onPointerLeave:q=>{y.current.pointer=!1,T(r),O.props.onPointerLeave?.(q)},onFocus:q=>{y.current.focus=!0,w(0),O.props.onFocus?.(q)},onBlur:q=>{y.current.focus=!1,T(0),O.props.onBlur?.(q)}}),Se=S?{left:S.left,top:S.top,zIndex:C.zIndex}:{visibility:"hidden",zIndex:C.zIndex},me=d?(0,fi.jsx)("div",{ref:q=>{m.current=q,C.panelRef(q)},id:c,role:"tooltip",className:k("crewlet-tooltip",`crewlet-tooltip--${S?.side??(t==="top"?"above":"below")}`,f!==null&&f!==document.body?"crewlet-tooltip--in-host":"crewlet-tooltip--fixed",i),style:Se,onPointerEnter:()=>{y.current.pointer=!0,p()},onPointerLeave:()=>{y.current.pointer=!1,T(r)},children:e}):null;return(0,fi.jsxs)(fi.Fragment,{children:[te,me&&f?(0,fy.createPortal)(me,f):null]})}var Lp=j(be(),1);function gy({by:e,at:t,previous:a=null,locale:n,className:l,labels:r}){let i=eu({by:e,at:t},ko(r),a,n);return(0,Lp.jsx)(Vo,{content:i,children:(0,Lp.jsx)("span",{"aria-hidden":"true",className:k("crewlet-change-mark",l)})})}var qe=j(ht(),1),my=j(nr(),1),pi=j(be(),1);function vy({trigger:e,children:t,align:a="start",side:n="bottom",width:l="auto",alignOffset:r,sideOffset:i=ot,initialFocus:o,role:s="dialog",label:c,className:d,open:v,defaultOpen:u=!1,onOpenChange:m}){let y=`${(0,qe.useId)()}-popover`,[S,h]=(0,qe.useState)(u),f=v??S,p=(0,qe.useRef)(null),w=(0,qe.useRef)(null),[T,C]=(0,qe.useState)(null),N=sl(),O=(0,qe.useRef)(v!==void 0),I=(0,qe.useRef)(m),R=(0,qe.useRef)(r),te=(0,qe.useRef)(o);O.current=v!==void 0,I.current=m,R.current=r,te.current=o;let Se=(0,qe.useCallback)((G,se)=>{O.current||h(G),I.current?.(G,se)},[]),me=(0,qe.useCallback)(G=>{let se=w.current?.contains(document.activeElement)??!1;(G==="escape"||G==="tab"||G==="content"&&se)&&ai(p.current),Se(!1,G)},[Se]),q=di({open:f,onDismiss:me}),H=(0,qe.useCallback)(()=>{let G=p.current,se=w.current;if(!G||!se||!N)return;let ct=N!==document.body,A=ct?N.getBoundingClientRect():oi(),oe=G.getBoundingClientRect();se.style.width=l==="match"?`${oe.width}px`:"";let Je=se.getBoundingClientRect(),L=R.current,X=typeof L=="function"?L(se,G):L??0,Oe={x:(a==="end"?oe.right-Je.width:oe.left)+X-(ct?A.x:0),y:oe.top-(ct?A.y:0),width:oe.width,height:oe.height},tt={x:ot,y:ot,width:A.width-2*ot,height:A.height-2*ot};if(si(oe,A,ct)){me("anchor-gone");return}let He=l==="match"?oe.width:void 0,at=ii(Oe,{width:Je.width,height:Je.height},tt,i,n==="top"?"above":"below");C(Ft=>Ft&&Ft.left===at.left&&Ft.top===at.top&&Ft.side===at.side&&Ft.width===He?Ft:{left:at.left,top:at.top,side:at.side,width:He})},[a,me,N,n,i,l]);(0,qe.useLayoutEffect)(()=>{if(!f)return;H();let G=()=>H();N?.addEventListener(Sn,G),window.addEventListener("resize",G),window.addEventListener("scroll",G,!0);let se=typeof ResizeObserver=="function"?new ResizeObserver(G):null;return w.current&&se?.observe(w.current),()=>{N?.removeEventListener(Sn,G),window.removeEventListener("resize",G),window.removeEventListener("scroll",G,!0),se?.disconnect()}},[f,N,H]),(0,qe.useEffect)(()=>{f||C(null)},[f]);let Ve=f&&T!==null;(0,qe.useEffect)(()=>{if(!Ve||s!=="dialog")return;let G=w.current;G&&!G.contains(document.activeElement)&&(te.current?.()??Xl(G)[0]??G).focus()},[Ve,s]);let z=(0,qe.useCallback)(()=>{f?me("trigger"):Se(!0,"trigger")},[me,f,Se]),Y=e(f,z),P=s==="none"?void 0:s,Ze=(0,qe.cloneElement)(Y,{ref:G=>{p.current=G,q.insideRef(G)},"aria-expanded":f,"aria-haspopup":Y.props["aria-haspopup"]??P,"aria-controls":f?y:void 0});function et(G){G.key!=="Escape"&&G.key!=="Tab"&&!G.ctrlKey&&!G.metaKey&&!G.altKey&&G.stopPropagation()}let Dt=T?{left:T.left,top:T.top,width:T.width}:{visibility:"hidden"},st=f?(0,pi.jsx)("div",{ref:G=>{w.current=G,q.panelRef(G)},id:y,className:k("crewlet-popover",`crewlet-popover--${T?.side??(n==="top"?"above":"below")}`,N!==null&&N!==document.body?"crewlet-popover--in-host":"crewlet-popover--fixed",d),style:{...Dt,zIndex:q.zIndex},role:s==="none"?void 0:s,"aria-label":s==="none"?void 0:c,"aria-modal":s==="dialog"?!1:void 0,tabIndex:s==="dialog"?-1:void 0,onKeyDown:et,onPointerDown:G=>G.stopPropagation(),onClick:G=>G.stopPropagation(),children:typeof t=="function"?t(()=>me("content")):t}):null;return(0,pi.jsxs)(pi.Fragment,{children:[Ze,st&&N?(0,my.createPortal)(st,N):null]})}var Yo=j(be(),1);function jo({tone:e="neutral",pulse:t=!1,children:a,className:n}){let l=a!=null&&a!==!1&&a!=="",r=(0,Yo.jsx)("span",{"aria-hidden":!0,className:k("crewlet-status-dot",`crewlet-status-dot--${e}`,t&&"is-pulsing",!l&&n)});return l?(0,Yo.jsxs)("span",{className:k("crewlet-status",n),children:[r," ",(0,Yo.jsx)("span",{className:"crewlet-status__label",children:a})]}):r}var Vt=j(be(),1);function fu(e){let{variant:t="neutral",hue:a,appearance:n="soft",size:l="sm",leadingIcon:r,dot:i=!1,count:o,monospace:s=!1,animateIn:c=!1,onClick:d,pressed:v,onRemove:u,removeAriaLabel:m="Remove tag",className:b,children:y,...S}=e,h=d!==void 0,f=h||u!==void 0,p=h&&u!==void 0;f&&l==="xs"&&console.warn('[crewlet] Tag size="xs" cannot act: an interactive tag starts at "sm", so its target clears 24px. Drawn at "sm".');let w=f&&l==="xs"?"sm":l,T=k("crewlet-tag",a===void 0?`crewlet-tag--${t}`:`crewlet-tag--hue-${a}`,`crewlet-tag--${n}`,`crewlet-tag--${w}`,s&&"crewlet-tag--monospace",c&&"crewlet-tag--animate-in",f&&"crewlet-tag--acts",h&&!p&&"crewlet-tag--actionable",p&&"crewlet-tag--split",p&&v===!0&&"is-pressed",b),C=(0,Vt.jsxs)(Vt.Fragment,{children:[i?(0,Vt.jsx)(jo,{tone:a===void 0?t:"neutral",className:"crewlet-tag__dot"}):null,r?(0,Vt.jsx)("span",{className:"crewlet-tag__icon","aria-hidden":!0,children:r}):null,(0,Vt.jsx)("span",{className:"crewlet-tag__label",children:y}),o===void 0?null:(0,Vt.jsx)("span",{className:"crewlet-tag__count",children:o})]}),N=u===void 0?null:(0,Vt.jsx)("button",{type:"button",className:"crewlet-tag__remove",onClick:O=>{O.stopPropagation(),u()},"aria-label":m,children:(0,Vt.jsx)(Do,{size:"xs"})});return p?(0,Vt.jsxs)("span",{...S,className:T,children:[(0,Vt.jsx)("button",{type:"button",className:"crewlet-tag__press",onClick:d,"aria-pressed":v===!0,children:C}),N]}):h?(0,Vt.jsx)("button",{...S,type:"button",className:T,onClick:d,"aria-pressed":v===!0,children:C}):(0,Vt.jsxs)("span",{...S,className:T,children:[C,N]})}var Ie=j(ht(),1),wy=j(nr(),1);var bt=j(be(),1),a_="[role='menuitem'],[role='menuitemradio']";function n_(e){let t=[];for(let a of e){if(a.kind==="separator"){t.push({kind:"separator",key:a.key});continue}let n=t[t.length-1];a.checked===void 0?t.push({kind:"action",item:a}):n?.kind==="answers"?n.items.push(a):t.push({kind:"answers",key:`${a.key}:answers`,items:[a]})}return t}function yy({label:e,items:t,icon:a,trigger:n,trailingIcon:l,triggerVariant:r="ghost",triggerTabIndex:i,open:o,onOpenChange:s,align:c="start",width:d="content",renderTrigger:v,header:u,className:m}){let b=(0,Ie.useId)(),y=`${b}-menu`,S=`${b}-header`,[h,f]=(0,Ie.useState)(!1),p=o??h,w=(0,Ie.useRef)(null),T=(0,Ie.useRef)(null),C=(0,Ie.useRef)(null),N=(0,Ie.useRef)("first"),[O,I]=(0,Ie.useState)(null),R=sl(),te=(0,Ie.useRef)(o!==void 0),Se=(0,Ie.useRef)(s);te.current=o!==void 0,Se.current=s;let me=(0,Ie.useCallback)(A=>{te.current||f(A),Se.current?.(A)},[]),q=(0,Ie.useCallback)(()=>{let A=C.current,oe=A&&A.isConnected&&A!==document.body?A:w.current;ai(oe)},[]),H=(0,Ie.useCallback)(A=>{A&&q(),me(!1)},[q,me]),Ve=di({open:p,onDismiss:A=>H(A!=="outside")}),z=()=>T.current?[...T.current.querySelectorAll(a_)]:[];(0,Ie.useLayoutEffect)(()=>{if(!p)return;let A=document.activeElement;A instanceof Node&&T.current?.contains(A)||(C.current=A instanceof HTMLElement?A:null)},[p]);let Y=(0,Ie.useCallback)(()=>{let A=w.current,oe=T.current;if(!A||!oe||!R)return;let Je=R!==document.body,L=Je?R.getBoundingClientRect():oi(),X=A.getBoundingClientRect(),Oe=oe.getBoundingClientRect(),tt=d==="trigger"?X.width:void 0,He={width:Math.max(Oe.width,tt??0),height:Oe.height},at={x:(c==="end"?X.right-He.width:X.left)-(Je?L.x:0),y:X.top-(Je?L.y:0),width:X.width,height:X.height},Ft={x:ot,y:ot,width:L.width-2*ot,height:L.height-2*ot};if(si(X,L,Je)){H(!0);return}let Mn=ii(at,{width:He.width,height:He.height},Ft,ot);I(Ot=>Ot&&Ot.left===Mn.left&&Ot.top===Mn.top&&Ot.floor===tt?Ot:{left:Mn.left,top:Mn.top,floor:tt})},[c,H,R,d]);(0,Ie.useLayoutEffect)(()=>{if(!p)return;Y();let A=()=>Y();R?.addEventListener(Sn,A),window.addEventListener("resize",A),window.addEventListener("scroll",A,!0);let oe=typeof ResizeObserver=="function"?new ResizeObserver(A):null;return T.current&&oe?.observe(T.current),()=>{R?.removeEventListener(Sn,A),window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0),oe?.disconnect()}},[p,R,Y]),(0,Ie.useEffect)(()=>{p||I(null)},[p]);let P=p&&O!==null;(0,Ie.useLayoutEffect)(()=>{if(!P)return;let A=z();(N.current==="last"?A[A.length-1]:A[0])?.focus(),N.current="first"},[P]);function Ze(A){(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),N.current=A.key==="ArrowUp"?"last":"first",me(!0))}function et(A){A.key!=="Escape"&&A.key!=="Tab"&&!A.ctrlKey&&!A.metaKey&&!A.altKey&&A.stopPropagation();let oe=z(),Je=oe.indexOf(document.activeElement),L=X=>oe[(X+oe.length)%oe.length]?.focus();switch(A.key){case"ArrowDown":A.preventDefault(),L(Je+1);return;case"ArrowUp":A.preventDefault(),L(Je-1);return;case"Home":A.preventDefault(),L(0);return;case"End":A.preventDefault(),L(oe.length-1);return;case"Tab":H(!0);return;default:if(A.key.length===1&&!A.ctrlKey&&!A.metaKey&&!A.altKey&&A.key!==" "){let X=A.key.toLocaleLowerCase();for(let Oe=1;Oe<=oe.length;Oe++){let tt=oe[(Je+Oe)%oe.length];if((tt.textContent??"").trim().toLocaleLowerCase().startsWith(X)){A.preventDefault(),tt.focus();return}}}}}function Dt(A){A.disabled||(H(!0),A.onSelect())}let st=A=>A.description!==void 0&&A.description!==null&&A.description!==!1&&A.description!=="",G=A=>(0,bt.jsxs)("button",{type:"button",role:A.checked===void 0?"menuitem":"menuitemradio","aria-checked":A.checked,tabIndex:-1,className:k("crewlet-menu__item",st(A)?"crewlet-menu__item--described":void 0,A.danger&&"is-danger",A.disabled&&"is-disabled"),"aria-disabled":A.disabled||void 0,onClick:()=>Dt(A),children:[A.checked!==void 0&&(0,bt.jsx)("span",{className:"crewlet-menu__check","aria-hidden":!0,children:A.checked&&(0,bt.jsx)(ni,{size:"sm"})}),A.icon&&(0,bt.jsx)("span",{className:"crewlet-menu__icon",children:A.icon}),(0,bt.jsxs)("span",{className:"crewlet-menu__text",children:[(0,bt.jsx)("span",{className:"crewlet-menu__label",children:A.label}),st(A)?(0,bt.jsx)("span",{className:"crewlet-menu__description",children:A.description}):null]}),A.hint&&(0,bt.jsx)("span",{className:"crewlet-menu__hint",children:A.hint})]},A.key),se=p?(0,bt.jsxs)("div",{className:k("crewlet-menu",R!==null&&R!==document.body?"crewlet-menu--in-host":null,m),id:y,role:"menu","aria-label":e,"aria-describedby":u?S:void 0,tabIndex:-1,ref:A=>{T.current=A,Ve.panelRef(A)},style:O?{left:O.left,top:O.top,zIndex:Ve.zIndex,...O.floor===void 0?null:{"--crewlet-menu-floor":`${O.floor}px`}}:{visibility:"hidden"},onKeyDown:et,onPointerDown:A=>A.stopPropagation(),onClick:A=>A.stopPropagation(),children:[u?(0,bt.jsx)("div",{role:"presentation",id:S,className:"crewlet-menu__header",children:u}):null,n_(t).map(A=>A.kind==="separator"?(0,bt.jsx)("div",{role:"separator",className:"crewlet-menu__separator"},A.key):A.kind==="answers"?(0,bt.jsx)("div",{role:"group",className:"crewlet-menu__group",children:A.items.map(G)},A.key):G(A.item))]}):null,ct={ref:A=>{w.current=A,Ve.insideRef(A)},"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?y:void 0,tabIndex:i,onClick:()=>{p?H(!0):(N.current="first",me(!0))},onKeyDown:Ze};return(0,bt.jsxs)("span",{className:"crewlet-menu-anchor",children:[v?v(ct):n===void 0?(0,bt.jsx)(ul,{...ct,label:e,icon:a??(0,bt.jsx)(cp,{}),size:"sm"}):(0,bt.jsx)(ka,{...ct,"aria-label":e,variant:r,size:"small",leadingIcon:a,trailingIcon:l,children:n}),se&&R?(0,wy.createPortal)(se,R):null]})}var M=j(ht(),1);var _=j(be(),1);function Bp({column:e,id:t,labels:a}){let n=En(e,t);if(!n)return(0,_.jsx)(fu,{size:"xs",children:t});if(n.archived)return(0,_.jsx)(fu,{size:"xs",appearance:"outline",children:a.archived(n.label)});let l=Jc(n.color);return(0,_.jsx)(fu,{size:"xs",hue:l==="neutral"?void 0:l,children:n.label})}function xy({person:e,fallback:t}){return e?(0,_.jsxs)("span",{className:"crewlet-sheet-cell__person",children:[(0,_.jsx)(Bo,{name:e.name,kind:e.kind==="human"?"human":"agent",src:e.src,character:e.character!==void 0&&Uo(e.character)?e.character:void 0,hue:e.kind==="agent"?e.hue:void 0,size:"xs",decorative:!0}),(0,_.jsx)("span",{className:"crewlet-sheet-cell__text",children:e.name})]}):(0,_.jsx)("span",{className:"crewlet-sheet-cell__muted",children:t})}function qp({column:e,value:t,context:a,onOpenLink:n}){let{labels:l}=a;if(e.type==="checkbox"){let r=t===!0;return(0,_.jsxs)("span",{className:"crewlet-sheet-cell__checkbox",children:[(0,_.jsx)("span",{className:k("crewlet-sheet-cell__check",r&&"crewlet-sheet-cell__check--on"),"aria-hidden":"true",children:r?(0,_.jsx)(ni,{size:"xs"}):null}),(0,_.jsx)(Ht,{children:r?l.checked:l.unchecked})]})}if(tn(t))return(0,_.jsx)(Ht,{children:l.empty});switch(e.type){case"select":return(0,_.jsx)(Bp,{column:e,id:String(t),labels:l});case"multiselect":return(0,_.jsx)(dy,{label:e.label,overflow:"fit",className:"crewlet-sheet-cell__chips",children:t.map(r=>(0,_.jsx)(Bp,{column:e,id:r,labels:l},r))});case"status":{let r=En(e,String(t)),i=ba(e,t,a);return(0,_.jsx)(jo,{tone:r&&!r.archived?Fc(r):"neutral",children:i})}case"person":return(0,_.jsx)(xy,{person:Pr(a.people,String(t)),fallback:l.unknownPerson});case"rating":{let r=en(e),i=Number(t);return(0,_.jsxs)("span",{className:"crewlet-sheet-cell__rating",children:[(0,_.jsx)("span",{className:"crewlet-sheet-cell__stars","aria-hidden":"true",children:Array.from({length:r},(o,s)=>(0,_.jsx)(fp,{size:"sm",filled:s<i,className:k("crewlet-sheet-cell__star",s<i&&"crewlet-sheet-cell__star--on")},s))}),(0,_.jsx)(Ht,{children:l.rating(i,r)})]})}case"url":{let r=String(t);return(0,_.jsx)("a",{className:"crewlet-sheet-cell__link",href:r,target:"_blank",rel:"noopener noreferrer",tabIndex:-1,onClick:n?i=>{i.preventDefault(),n(r)}:void 0,children:r})}case"number":return(0,_.jsx)("span",{className:"crewlet-sheet-cell__text crewlet-sheet-cell__number",children:ba(e,t,a)});default:return(0,_.jsx)("span",{className:"crewlet-sheet-cell__text",children:ba(e,t,a)})}}var l_=new Set(["text","number","url","date","rating"]),r_=new Set(["text","longtext"]),i_=6,o_=8,_y=new Set(["select","multiselect","status","person"]),s_=e=>e!=="checkbox",by=e=>l_.has(e)||_y.has(e)||e==="longtext";function Ty(e,t){if(e.key==="Tab")return e.shiftKey?"left":"right";if(e.key==="Enter")return t?e.shiftKey&&!Kl(e)?void 0:"down":e.shiftKey?"up":"down"}function Vp(e,t){e&&(e.focus({preventScroll:!0}),t&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.setSelectionRange(e.value.length,e.value.length))}function Yp(e){let t=(0,M.useRef)(!1);return{finish:()=>{t.current=!0},onBlur:a=>{if(t.current)return;let n=a.relatedTarget;n!==null&&a.currentTarget.contains(n)||(t.current=!0,e())}}}function c_(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let a=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}T${a(t.getHours())}:${a(t.getMinutes())}`}function jp({conflict:e,labels:t}){return(0,_.jsxs)("div",{className:"crewlet-sheet-editor__conflict",role:"alert",children:[(0,_.jsx)("p",{className:"crewlet-sheet-editor__conflict-text",children:t.conflict(e.writer,e.value)}),(0,_.jsxs)("div",{className:"crewlet-sheet-editor__conflict-actions",children:[(0,_.jsx)(ka,{size:"small",variant:"secondary",onClick:e.onKeepMine,children:t.keepMine}),(0,_.jsx)(ka,{size:"small",variant:"ghost",onClick:e.onUseTheirs,children:t.useTheirs(e.writer)})]})]})}function Kp({id:e,message:t}){return(0,_.jsxs)("p",{id:e,className:"crewlet-sheet-editor__error",children:[(0,_.jsx)(li,{size:"xs","aria-hidden":"true"}),(0,_.jsx)("span",{children:t})]})}function Ey(e){let{column:t}=e;return _y.has(t.type)?(0,_.jsx)(p_,{...e}):r_.has(t.type)?(0,_.jsx)(d_,{...e}):(0,_.jsx)(u_,{...e})}function u_({column:e,value:t,context:a,seed:n,label:l,onCommit:r,onCancel:i,conflict:o}){let{labels:s}=a,c=(0,M.useId)(),d=(0,M.useRef)(null),v=e.type==="date",u=(0,M.useMemo)(()=>{if(v){let p=typeof t=="string"?t:"";return e.time?c_(p):p}return n??ei(e,t,a)},[]),[m,b]=(0,M.useState)(u),[y,S]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{Vp(d.current,!v)},[v]);let h=p=>{let w=v&&e.time&&m!==""?new Date(m).toISOString():m,T=ti(e,w,a);return T.ok?(f.finish(),r(T.value,p),!0):(S(T.error),!1)},f=Yp(()=>{h(null)||i()});return(0,_.jsxs)("div",{className:"crewlet-sheet-editor crewlet-sheet-editor--line",onBlur:f.onBlur,children:[(0,_.jsx)("input",{ref:d,className:"crewlet-sheet-editor__input",type:v?e.time?"datetime-local":"date":e.type==="url"?"url":"text",inputMode:e.type==="number"?"decimal":e.type==="rating"?"numeric":void 0,"aria-label":l,"aria-invalid":y!==null,"aria-describedby":y!==null?c:void 0,maxLength:e.type==="text"?ol(e):void 0,value:m,onChange:p=>{b(p.target.value),S(null)},onKeyDown:p=>{if(ui(p))return;if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),f.finish(),i();return}if(p.key==="Tab"&&o)return;let w=Ty(p,!1);w!==void 0&&(p.preventDefault(),p.stopPropagation(),h(w))}}),y!==null||o?(0,_.jsxs)("div",{className:k("crewlet-sheet-editor__panel"),children:[y!==null?(0,_.jsx)(Kp,{id:c,message:y}):null,o?(0,_.jsx)(jp,{conflict:o,labels:s}):null]}):null]})}function d_({column:e,value:t,context:a,seed:n,label:l,onCommit:r,onCancel:i,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="longtext",v=(0,M.useId)(),u=(0,M.useRef)(null),[m,b]=(0,M.useState)(()=>n??ei(e,t,a)),[y,S]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{Vp(u.current,!0)},[]),(0,M.useLayoutEffect)(()=>{let p=u.current;!p||p.scrollHeight===0||(p.style.height="auto",p.style.height=`${p.scrollHeight}px`)},[m]);let h=p=>{let w=ti(e,m,a);return w.ok?(f.finish(),r(w.value,p),!0):(S(w.error),!1)},f=Yp(()=>{h(null)||i()});return(0,_.jsx)("div",{className:k("crewlet-sheet-editor","crewlet-sheet-editor--text",d&&"crewlet-sheet-editor--long",`crewlet-sheet-editor--${o}`),onBlur:f.onBlur,children:(0,_.jsxs)("div",{className:"crewlet-sheet-editor__overlay",children:[(0,_.jsx)("textarea",{ref:u,className:"crewlet-sheet-editor__textarea","aria-label":l,"aria-multiline":d,"aria-invalid":y!==null,"aria-describedby":y!==null?v:void 0,maxLength:ol(e),rows:1,style:{"--crewlet-sheet-editor-lines":i_},value:m,onChange:p=>{b(d?p.target.value:p.target.value.replace(/\r?\n/g," ")),S(null)},onKeyDown:p=>{if(ui(p))return;if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),f.finish(),i();return}if(p.key==="Tab"&&s)return;let w=Ty(p,d);w!==void 0&&(p.preventDefault(),p.stopPropagation(),h(w))}}),y!==null?(0,_.jsx)(Kp,{id:v,message:y}):null,s?(0,_.jsx)(jp,{conflict:s,labels:c}):null]})})}function h_(e,t){return e.type==="person"?(t.people??[]).map(a=>({id:a.id,label:a.name,person:a})):jl(e).map(a=>({id:a.id,label:a.label,option:a}))}function f_({column:e,choice:t,context:a}){return t.person?(0,_.jsx)(xy,{person:t.person,fallback:t.label}):e.type==="status"&&t.option?(0,_.jsx)(jo,{tone:Fc(t.option),children:t.label}):(0,_.jsx)(Bp,{column:e,id:t.id,labels:a.labels})}var nn="";function p_({column:e,value:t,context:a,seed:n,label:l,onCommit:r,onCancel:i,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="multiselect",v=(0,M.useId)(),u=(0,M.useId)(),m=(0,M.useRef)(null),b=(0,M.useRef)(null),y=(0,M.useMemo)(()=>h_(e,a),[e,a]),S=y.length>o_,[h,f]=(0,M.useState)(S?n??"":""),[p,w]=(0,M.useState)(()=>d?[...t??[]]:typeof t=="string"?[t]:[]),[T,C]=(0,M.useState)(null),N=!d&&!e.required,O=(0,M.useMemo)(()=>{let z=h.trim().toLowerCase(),Y=z===""?y:y.filter(P=>P.label.toLowerCase().includes(z));return N&&z===""?[...Y,{id:nn,label:c.clear}]:Y},[y,h,N,c.clear]),[I,R]=(0,M.useState)(()=>{let z=!S&&n?O.findIndex(P=>P.id!==nn&&P.label.toLowerCase().startsWith(n.toLowerCase())):-1;if(z>=0)return z;let Y=O.findIndex(P=>P.id!==nn&&p.includes(P.id));return Y>=0?Y:0});(0,M.useEffect)(()=>{R(z=>Math.min(z,Math.max(O.length-1,0)))},[O.length]),(0,M.useLayoutEffect)(()=>{Vp(S?m.current:b.current,!1)},[S]);let te=(z,Y)=>{let P=Df(e,z,a);return P!==null?(C(P),!1):(Se.finish(),r(z,Y),!0)},Se=Yp(()=>{(!d||!te(p,null))&&i()}),me=(z,Y)=>{if(z){if(!d){te(z.id===nn?null:z.id,Y);return}C(null),w(P=>P.includes(z.id)?P.filter(Ze=>Ze!==z.id):[...P,z.id])}},q=z=>`${v}-${z}`,H=O.length>0?q(I):void 0,Ve=z=>{if(!ui(z))switch(z.key){case"Escape":z.preventDefault(),z.stopPropagation(),Se.finish(),i();return;case"ArrowDown":z.preventDefault(),z.stopPropagation(),R(Y=>Math.min(Y+1,O.length-1));return;case"ArrowUp":z.preventDefault(),z.stopPropagation(),R(Y=>Math.max(Y-1,0));return;case"Home":case"End":if(h!=="")return;z.preventDefault(),z.stopPropagation(),R(z.key==="Home"?0:O.length-1);return;case"Enter":z.preventDefault(),z.stopPropagation(),d&&Kl(z)?te(p,"down"):me(O[I],z.shiftKey?"up":"down");return;case" ":if(S)return;z.preventDefault(),z.stopPropagation(),me(O[I],d?null:"down");return;case"Tab":if(s)return;z.preventDefault(),z.stopPropagation(),te(d?p:t,z.shiftKey?"left":"right");return;default:if(!S&&z.key.length===1&&!z.ctrlKey&&!z.metaKey&&!z.altKey){let Y=z.key.toLowerCase(),P=I+1,et=[...O.slice(P),...O.slice(0,P)].find(Dt=>Dt.id!==nn&&Dt.label.toLowerCase().startsWith(Y));et&&(z.preventDefault(),z.stopPropagation(),R(O.indexOf(et)))}return}};return(0,_.jsx)("div",{className:k("crewlet-sheet-editor","crewlet-sheet-editor--list",`crewlet-sheet-editor--${o}`),onBlur:Se.onBlur,children:(0,_.jsxs)("div",{className:"crewlet-sheet-editor__panel crewlet-sheet-editor__panel--list",children:[S?(0,_.jsx)("input",{ref:m,className:"crewlet-sheet-editor__filter",role:"combobox","aria-label":l,"aria-expanded":"true","aria-controls":v,"aria-autocomplete":"list","aria-activedescendant":H,"aria-invalid":T!==null,"aria-describedby":T!==null?u:void 0,placeholder:c.filter,value:h,onChange:z=>{f(z.target.value),R(0)},onKeyDown:Ve}):null,(0,_.jsx)("ul",{ref:b,className:"crewlet-sheet-editor__list",id:v,role:"listbox","aria-label":l,"aria-multiselectable":d||void 0,tabIndex:-1,"aria-activedescendant":S?void 0:H,"aria-invalid":S?void 0:T!==null,"aria-describedby":!S&&T!==null?u:void 0,onKeyDown:S?void 0:Ve,children:O.length===0?(0,_.jsx)("li",{className:"crewlet-sheet-editor__empty",role:"presentation",children:c.noOptions}):O.map((z,Y)=>{let P=z.id===nn?p.length===0:p.includes(z.id);return(0,_.jsxs)("li",{id:q(Y),role:"option","aria-selected":P,className:k("crewlet-sheet-editor__option",z.id===nn&&"crewlet-sheet-editor__option--clear",Y===I&&"crewlet-sheet-editor__option--highlight",P&&"crewlet-sheet-editor__option--selected"),onMouseDown:Ze=>Ze.preventDefault(),onMouseEnter:()=>R(Y),onClick:()=>me(z,d?null:"down"),children:[(0,_.jsx)("span",{className:"crewlet-sheet-editor__mark","aria-hidden":"true",children:P&&z.id!==nn?(0,_.jsx)(ni,{size:"xs"}):null}),z.id===nn?(0,_.jsx)("span",{className:"crewlet-sheet-cell__muted",children:z.label}):(0,_.jsx)(f_,{column:e,choice:z,context:a})]},z.id===nn?"\0clear":z.id)})}),T!==null?(0,_.jsx)(Kp,{id:u,message:T}):null,s?(0,_.jsx)(jp,{conflict:s,labels:c}):null]})})}var fl=-1,g_=.6;function Ip({label:e,columns:t,rows:a,people:n,mode:l="edit",onEdit:r,onAddRow:i,onShowHistory:o,onActiveCellChange:s,onEditingChange:c,onUndo:d,onRedo:v,onOpenLink:u,presence:m,sort:b,onSortChange:y,sync:S,onRetry:h,height:f,fit:p="container",onDeleteRow:w,onDismissRefused:T,renderColumnEditor:C,settingsColumn:N,onSettingsColumnChange:O,onAddColumn:I,locale:R,className:te,labels:Se,presenceLabels:me}){let q=(0,M.useId)(),H=(0,M.useMemo)(()=>ko(Se),[Se]),Ve=(0,M.useMemo)(()=>Co(me),[me]),z=(0,M.useMemo)(()=>({people:n,locale:R,labels:H}),[n,R,H]),Y=(0,M.useMemo)(()=>jf(t),[t]),[P,Ze]=(0,M.useState)(0),et=(0,M.useRef)(a);(0,M.useLayoutEffect)(()=>{et.current=a});let Dt=a.length>0,[st,G]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{let g=Dt?et.current:[];G(new Map(Y.filter(x=>!(x.width&&x.width>0)).map(x=>[x.field,Xf(x,g,z)])))},[Y,Dt,z]);let[se,ct]=(0,M.useState)(0);(0,M.useEffect)(()=>{let g=typeof document>"u"?void 0:document.fonts;if(!g)return;let x=!0,D=()=>{x&&ct(J=>J+1)};return g.ready.then(D),g.addEventListener("loadingdone",D),()=>{x=!1,g.removeEventListener("loadingdone",D)}},[]);let A=(0,M.useRef)(null),[oe,Je]=(0,M.useState)(new Map);(0,M.useLayoutEffect)(()=>{let g=A.current;if(!g)return;let x=new Map;for(let D of g.querySelectorAll("[data-measure]")){let J=0;for(let le of D.children)J=Math.max(J,le.getBoundingClientRect().width);x.set(D.dataset.measure??"",J)}Je(x)},[st,se]);let L=(0,M.useMemo)(()=>{let g=B=>B.width!==void 0&&B.width>0,x=Y.map(B=>g(B)?B:{...B,width:If(B.type,oe.get(B.field)??0)});if(P<=0)return x;let D=Math.floor(P*g_)-Il,J=x.filter(B=>B.frozen).reduce((B,Ae)=>B+an(Ae),0)-D,le=Y.filter(B=>B.frozen&&!g(B)).length;if(J<=0||le===0)return x;let _e=Math.ceil(J/le);return x.map((B,Ae)=>B.frozen&&!g(Y[Ae])?{...B,width:Math.max(Pc[B.type][0],an(B)-_e)}:B)},[Y,oe,P]),X=(0,M.useMemo)(()=>Wf(L,a,b,z),[L,a,b,z]),Oe=l==="edit"&&r!==void 0,tt=l==="edit"&&w!==void 0,He=l==="edit"&&C!==void 0,at=l==="edit"&&I!==void 0,[Ft,Mn]=(0,M.useState)(null),Ot=N!==void 0?N:Ft,mi=g=>{N===void 0&&Mn(g),O?.(g)},Ea=(0,M.useRef)(null),V=(0,M.useRef)(null),Q=(0,M.useRef)(null),[ut,sa]=(0,M.useState)(0),La=(0,M.useRef)(0),[ie,Ql]=(0,M.useState)(Wc),[ln,Cy]=(0,M.useState)(Wc),[vi,ky]=(0,M.useState)(0),[Ry,Hy]=(0,M.useState)(0),[Fp,$p]=(0,M.useState)(0),[Dy,Gy]=(0,M.useState)(!1),[Xo,Qo]=(0,M.useState)(null),[Wp,Zo]=(0,M.useState)(null),[$,wi]=(0,M.useState)(null),[Pp,e0]=(0,M.useState)(new Map),[t0,Ly]=(0,M.useState)({text:"",n:0}),vu=(0,M.useRef)(!1),[a0,n0]=(0,M.useState)(null),Yt=(0,M.useCallback)(g=>Ly(x=>({text:g,n:x.n+1})),[]),l0=(0,M.useRef)(new Map);(0,M.useEffect)(()=>{let g=new Map;for(let x of a)for(let[D,J]of Object.entries(x.refused??{}))g.set(xa(x.id,D),J);for(let[x,D]of g)if(l0.current.get(x)!==D){Yt(H.notSaved(D));break}l0.current=g},[a,H,Yt]),(0,M.useLayoutEffect)(()=>{let g=()=>{let D=V.current?.offsetHeight??0;D>0&&Ql(D);let J=Q.current?.querySelector(".crewlet-sheet-grid__row--head")?.offsetHeight??0;J>0&&Cy(J),ky(Ea.current?.clientHeight??0),Ze(Ea.current?.clientWidth??0);let le=Ea.current;if(le){let _e=getComputedStyle(le),B=le.offsetHeight-le.clientHeight-(parseFloat(_e.borderTopWidth)||0)-(parseFloat(_e.borderBottomWidth)||0);Hy(Math.max(0,Math.round(B)))}};if(g(),typeof ResizeObserver!="function")return;let x=new ResizeObserver(g);return Ea.current&&x.observe(Ea.current),V.current&&x.observe(V.current),()=>x.disconnect()},[]);let Zl=(0,M.useMemo)(()=>Yf(L),[L]),Uy=(0,M.useMemo)(()=>[`${Il}px`,...L.map((g,x)=>x===L.length-1?`minmax(${an(g)}px, 1fr)`:`${an(g)}px`)].join(" "),[L]),By=(0,M.useMemo)(()=>L.reduce((g,x)=>g+an(x),Il),[L]),Jo=(0,M.useMemo)(()=>L.reduce((g,x,D)=>x.frozen?D:g,-1),[L]),wu=(0,M.useMemo)(()=>{let g=Il;return L.forEach((x,D)=>{x.frozen&&(g=(Zl[D]??g)+an(x))}),g},[L,Zl]),pl=(0,M.useMemo)(()=>new Map(X.map((g,x)=>[g.id,x])),[X]),Fo=(0,M.useMemo)(()=>new Map(L.map((g,x)=>[g.field,x])),[L]),Jl=(0,M.useCallback)(g=>{if(!g)return null;let x=Fo.get(g.field);if(x===void 0)return null;if(g.rowId===null)return{row:fl,col:x};let D=pl.get(g.rowId);return D===void 0?null:{row:D,col:x}},[Fo,pl]),rn=(0,M.useCallback)(g=>{let x=L[g.col];if(!x)return null;if(g.row===fl)return{rowId:null,field:x.field};let D=X[g.row];return D?{rowId:D.id,field:x.field}:null},[L,X]),qy=X.length>0&&L.length>0?{rowId:X[0].id,field:L[0].field}:L.length>0?{rowId:null,field:L[0].field}:null,ue=Jl(Xo)??Jl(qy),dt=ue?rn(ue):null,r0=Jl(Wp)??ue,Ye=ue&&r0&&ue.row!==fl?Lf(r0,ue):null,i0=(0,M.useMemo)(()=>Pf(m),[m]),Vy=(0,M.useMemo)(()=>ep(m),[m]),Yy=(0,M.useMemo)(()=>tp(m),[m]),o0=(0,M.useRef)(null);(0,M.useEffect)(()=>{let g=dt&&dt.rowId!==null?{rowId:dt.rowId,field:dt.field}:null,x=g?xa(g.rowId,g.field):null;x!==o0.current&&(o0.current=x,s?.(g))},[dt,s]);let s0=(0,M.useRef)(null);(0,M.useEffect)(()=>{let g=$?xa($.rowId,$.field):null;g!==s0.current&&(s0.current=g,c?.($?{rowId:$.rowId,field:$.field}:null))},[$,c]);let $o=(0,M.useCallback)(g=>{g.length!==0&&(e0(x=>{let D=new Map(x);for(let J of g)D.set(xa(J.rowId,J.field),J.error);return D}),Yt(g[0].error))},[Yt]),Wo=(0,M.useCallback)(g=>{e0(x=>{if(!g.some(J=>x.has(J)))return x;let D=new Map(x);for(let J of g)D.delete(J);return D})},[]),Nn=(0,M.useCallback)(g=>{g.length===0||!r||(Wo(g.map(x=>xa(x.rowId,x.field))),r(g))},[r,Wo]),gl=(0,M.useCallback)(g=>L[Fo.get(g)??-1],[L,Fo]),ml=(0,M.useCallback)(g=>X[pl.get(g)??-1],[X,pl]),Fl=(0,M.useCallback)(g=>Oe&&g!==void 0&&!g.readOnly,[Oe]),yu=(0,M.useCallback)(()=>sa(g=>g+1),[]),$l=(0,M.useCallback)((g,x=!1)=>{g&&(Qo(g),x||Zo(g),yu())},[yu]),c0=g=>{Xo&&Xo.rowId===g.rowId&&Xo.field===g.field||(Qo(g),Zo(g))},yi=ue?.row??null,bi=ue?.col??null;(0,M.useLayoutEffect)(()=>{if(yi===null||bi===null)return;let g=Ea.current;if(g&&yi>=0){let x=qf(yi,g.scrollTop,g.clientHeight,ie,ln);x!==g.scrollTop&&(g.scrollTop=x,$p(x));let D=L[bi];if(D&&!D.frozen){let J=Zl[bi]??0,le=J+an(D);J-wu<g.scrollLeft?g.scrollLeft=Math.max(J-wu,0):le>g.scrollLeft+g.clientWidth&&(g.scrollLeft=le-g.clientWidth)}}ut===La.current||$||(La.current=ut,document.getElementById(Up(q,{row:yi,col:bi}))?.focus({preventScroll:!0}))},[yi,bi,ut,$,q,ie,ln,L,Zl,wu]);let Po=(0,M.useCallback)((g,x)=>{if(g.rowId===null)return;let D=gl(g.field),J=ml(g.rowId);if(!(!J||!D)){if(!Fl(D)){Yt(Oe?H.readOnly(D.label):H.forbidden);return}s_(D.type)&&(Wo([xa(g.rowId,g.field)]),wi({rowId:g.rowId,field:g.field,seed:x,base:Rt(D,J.values[D.field])}))}},[Fl,Wo,gl,Oe,H,ml,Yt]),bu=(0,M.useCallback)(g=>{if(g.rowId===null)return;let x=gl(g.field),D=ml(g.rowId);if(!(!D||!x||x.type!=="checkbox")){if(!Fl(x)){Yt(Oe?H.readOnly(x.label):H.forbidden);return}Nn([{rowId:D.id,field:x.field,value:Rt(x,D.values[x.field])!==!0}])}},[Fl,gl,Oe,Nn,H,ml,Yt]),u0=(0,M.useCallback)((g,x)=>{if(x===null)return rn(g);let D={down:{row:Math.min(g.row+1,X.length-1),col:g.col},up:{row:Math.max(g.row-1,0),col:g.col},right:{row:g.row,col:Math.min(g.col+1,L.length-1)},left:{row:g.row,col:Math.max(g.col-1,0)}}[x];return rn(D)},[rn,L.length,X.length]),d0=(0,M.useCallback)((g,x)=>{if(!$)return;let D=Jl({rowId:$.rowId,field:$.field}),J=gl($.field),le=ml($.rowId);wi(null),g!==void 0&&J&&le&&!Wr(g,Rt(J,le.values[J.field]))&&Nn([{rowId:le.id,field:J.field,value:g}]);let _e=document.activeElement,B=_e!==null&&_e!==document.body&&!!Q.current?.contains(_e);D&&B&&$l(u0(D,x))},[gl,$,Nn,$l,Jl,ml,u0]);(0,M.useEffect)(()=>{$&&!pl.has($.rowId)&&wi(null)},[$,pl]);let es=$?ml($.rowId):void 0,Wl=$?gl($.field):void 0,xu=$&&es&&Wl?Rt(Wl,es.values[Wl.field]):null,h0=!!($&&es&&Wl&&!Wr(xu,$.base)),jy=h0&&$?es?.changed?.[$.field]?.by??H.someone:"",ts=h0&&$&&Wl?{writer:jy,value:ba(Wl,xu,z)||H.empty,onKeepMine:()=>wi(g=>g&&{...g,base:xu}),onUseTheirs:()=>{let g=Jl({rowId:$.rowId,field:$.field});wi(null),g&&$l(rn(g))}}:null,_u=ts?H.conflict(ts.writer,ts.value):"";(0,M.useEffect)(()=>{_u&&Yt(_u)},[_u,Yt]);let f0=g=>{$||!Ye||gi(g)||(g.preventDefault(),g.clipboardData.setData("text/plain",Qf(L,X,Ye,z)))},p0=(0,M.useCallback)(()=>{if(!Ye)return;if(!Oe){Yt(H.forbidden);return}let g=Ff(L,X,Ye,z);Nn(g.edits),$o(g.refused)},[L,z,Oe,Nn,H.forbidden,Ye,$o,X,Yt]),Ky=g=>{$||!Ye||gi(g)||(f0(g),p0())},Iy=g=>{if($||!Ye||gi(g))return;if(g.preventDefault(),!Oe){Yt(H.forbidden);return}let x=Jf(L,X,Ye,Zf(g.clipboardData.getData("text/plain")),z);Nn(x.edits),$o(x.refused)},Xy=Math.max(1,Math.floor(Math.max(vi-ln,ie)/ie)-1),Qy=g=>{if($||ui(g)||!ue||!dt||gi(g)||g.target.closest(".crewlet-sheet-grid__row-actions"))return;let x=L[ue.col],D=Kl(g);if(D&&g.altKey&&g.key.toLowerCase()==="h"){o&&dt.rowId!==null&&(g.preventDefault(),o({rowId:dt.rowId,field:dt.field}));return}if(D&&!g.altKey&&g.key.toLowerCase()==="z"){let le=g.shiftKey?v:d;le&&(g.preventDefault(),le());return}if(D&&!g.altKey&&g.key.toLowerCase()==="y"){v&&(g.preventDefault(),v());return}if(D&&!g.altKey&&g.key.toLowerCase()==="a"){if(g.preventDefault(),X.length===0)return;Zo(rn({row:0,col:0})),Qo(rn({row:X.length-1,col:L.length-1})),yu();return}if(tt&&dt.rowId!==null&&(g.key==="ContextMenu"||g.shiftKey&&g.key==="F10")){g.preventDefault(),n0(dt.rowId);return}let J=Gf(ue,g,{rows:X.length,cols:L.length,page:Xy});if(J){g.preventDefault();let le=g.shiftKey&&J.row!==fl&&ue.row!==fl;$l(rn(J),le);return}if(g.key==="Tab"){let le=g.shiftKey?-1:1,_e=ue.col+le;if(_e<0||_e>=L.length)return;g.preventDefault(),$l(rn({row:ue.row,col:_e}));return}if(ue.row===fl){(g.key==="Enter"||g.key===" ")&&x&&He?(g.preventDefault(),mi(x.field)):(g.key==="Enter"||g.key===" ")&&x&&y&&(g.preventDefault(),y(au(b,x.field)));return}switch(g.key){case"Enter":case"F2":if(g.preventDefault(),g.key==="Enter"&&D&&x?.type==="url"){let le=X[ue.row],_e=le?Rt(x,le.values[x.field]):null;typeof _e=="string"&&_e&&(u?u(_e):window.open(_e,"_blank","noopener,noreferrer"));return}x?.type==="checkbox"?bu(dt):Po(dt);return;case" ":g.preventDefault(),x?.type==="checkbox"?bu(dt):x&&by(x.type)&&Po(dt," ");return;case"Delete":case"Backspace":g.preventDefault(),p0();return;case"Escape":Wp&&Ye&&(Ye.top!==Ye.bottom||Ye.left!==Ye.right)&&(g.preventDefault(),Zo(dt));return}if(Kf(g)&&x){if(x.type==="rating"&&/^\d$/.test(g.key)){if(g.preventDefault(),!Fl(x)){Yt(Oe?H.readOnly(x.label):H.forbidden);return}let le=Number(g.key),_e=X[ue.row];if(!_e)return;if(le>en(x)){$o([{rowId:_e.id,field:x.field,error:H.notARating(x.label,en(x))}]);return}Nn([{rowId:_e.id,field:x.field,value:le===0?null:le}]);return}by(x.type)&&(g.preventDefault(),Po(dt,x.type==="date"?void 0:g.key))}};(0,M.useEffect)(()=>{let g=()=>{vu.current=!1};return window.addEventListener("mouseup",g),()=>window.removeEventListener("mouseup",g)},[]);let g0=(g,x)=>{if(g.button!==0)return;let D=g.shiftKey&&x.rowId!==null&&dt?.rowId!==null;$&&$.rowId===x.rowId&&$.field===x.field||$l(x,D),vu.current=x.rowId!==null},Zy=g=>{!vu.current||g.rowId===null||Qo(g)},[m0,v0]=Bf(Math.max(Fp-ln,0),vi,ie,X.length),xi=[];for(let g=m0;g<=v0;g+=1)xi.push(g);if(ue&&ue.row>=0&&(ue.row<m0||ue.row>v0)&&xi.push(ue.row),$){let g=pl.get($.rowId);g!==void 0&&!xi.includes(g)&&xi.push(g)}let w0=`${q}-described`,y0=`${q}-help`,_i=ue?L[ue.col]:void 0,as=ue&&ue.row>=0?X[ue.row]:void 0,Jy=as&&_i?i0.get(xa(as.id,_i.field))??[]:[],Fy=as&&_i?np(_i,m_(as,Pp,_i.field),Jy,z,Ve):"",$y={"--crewlet-sheet-columns":Uy,"--crewlet-sheet-row-height":`${ie}px`,width:`${By}px`},Tu=ln+X.length*ie+2+Ry,b0=ln+X.length*ie>=vi,x0=X.length===0&&b0,Wy=p==="content"?{height:`${f!==void 0?Math.min(Tu,f):Tu}px`,"--crewlet-sheet-content-height":`${Tu}px`}:f!==void 0?{height:`${f}px`}:void 0,Py=g=>{let x=ln+g*ie-Fp,D=vi>0?vi:ie*12;return Vf(x,x+ie,ln,D,ie*8)};return(0,_.jsxs)("div",{className:k("crewlet-sheet-grid",l==="read"&&"crewlet-sheet-grid--read",p==="content"&&"crewlet-sheet-grid--fit-content",te),children:[(0,_.jsx)("div",{ref:V,className:"crewlet-sheet-grid__probe","aria-hidden":"true"}),(0,_.jsxs)("div",{ref:Ea,className:k("crewlet-sheet-grid__scroller",Dy&&"crewlet-sheet-grid__scroller--across",at&&"crewlet-sheet-grid__scroller--add-column"),style:Wy,onScroll:g=>{$p(g.currentTarget.scrollTop),Gy(g.currentTarget.scrollLeft>0)},children:[(0,_.jsxs)("div",{ref:Q,role:"grid","aria-label":e,"aria-rowcount":X.length+1,"aria-colcount":L.length+1,"aria-readonly":!Oe||void 0,"aria-multiselectable":"true","aria-describedby":y0,tabIndex:-1,className:k("crewlet-sheet-grid__grid",Ye&&(Ye.top!==Ye.bottom||Ye.left!==Ye.right)&&"crewlet-sheet-grid__grid--range"),style:$y,onKeyDown:Qy,onCopy:f0,onCut:Ky,onPaste:Iy,children:[(0,_.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__head",children:(0,_.jsxs)("div",{role:"row","aria-rowindex":1,className:k("crewlet-sheet-grid__row","crewlet-sheet-grid__row--head",x0&&"crewlet-sheet-grid__row--floor"),children:[(0,_.jsx)("div",{role:"columnheader","aria-colindex":1,className:k("crewlet-sheet-grid__corner",Jo<0&&"crewlet-sheet-grid__frozen-edge"),children:(0,_.jsx)(Ht,{children:H.rowHeader})}),L.map((g,x)=>{let D={row:fl,col:x},J=ue?.row===fl&&ue.col===x,le=b?.field===g.field?b.direction:void 0,_e=Yy.get(g.field)??[],B=(0,_.jsxs)("div",{id:Up(q,D),role:"columnheader","aria-colindex":x+2,"aria-sort":le??(y?"none":void 0),tabIndex:J?0:-1,className:k("crewlet-sheet-grid__header",`crewlet-sheet-grid__header--${g.type}`,g.frozen&&"crewlet-sheet-grid__cell--frozen",x===Jo&&"crewlet-sheet-grid__frozen-edge",J&&"crewlet-sheet-grid__header--active",He&&"crewlet-sheet-grid__header--settings",Ot===g.field&&"crewlet-sheet-grid__header--open"),style:g.frozen?{insetInlineStart:`${Zl[x]}px`}:void 0,onMouseDown:Ae=>{gi(Ae)||g0(Ae,{rowId:null,field:g.field})},onFocus:Ae=>{Ae.target===Ae.currentTarget&&c0({rowId:null,field:g.field})},onClick:Ae=>{gi(Ae)||(He?mi(Ot===g.field?null:g.field):y&&y(au(b,g.field)))},title:He?H.columnSettings(g.label):y?H.sortBy(g.label):g.label,children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:g.label}),(0,_.jsx)(Ht,{children:`, ${H.types[g.type]}`}),le?(0,_.jsx)("span",{className:"crewlet-sheet-grid__sort","aria-hidden":"true",children:le==="ascending"?(0,_.jsx)(rp,{size:"xs"}):(0,_.jsx)(ru,{size:"xs"})}):null,_e.length>0?(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-presence","aria-hidden":"true",children:_e.map(Ae=>(0,_.jsx)(Bo,{name:Ae.name,kind:Ae.kind,size:16,decorative:!0,className:k("crewlet-sheet-grid__header-badge",dl(Ae.hue))},Ae.id))}):null]},g.field);return He?(0,_.jsx)(vy,{label:H.columnSettings(g.label),open:Ot===g.field,onOpenChange:Ae=>{!Ae&&Ot===g.field&&mi(null)},trigger:()=>B,className:"crewlet-sheet-grid__column-settings",children:Ae=>C(g,Ae)},g.field):B})]})}),(0,_.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__body",style:{height:`${X.length*ie}px`},children:xi.map(g=>{let x=X[g],D=Vy.get(x.id),J=`${q}-r${g}-name`,le=Ye!==null&&g>=Ye.top&&g<=Ye.bottom,_e=H.rowActions(g+1);return(0,_.jsxs)("div",{role:"row","aria-rowindex":g+2,className:k("crewlet-sheet-grid__row",g===X.length-1&&b0&&"crewlet-sheet-grid__row--floor"),style:{top:`${g*ie}px`},"data-row-id":x.id,children:[(0,_.jsxs)("div",{role:"rowheader","aria-colindex":1,"aria-labelledby":J,className:k("crewlet-sheet-grid__rownum",Jo<0&&"crewlet-sheet-grid__frozen-edge",tt&&"crewlet-sheet-grid__rownum--actions",le&&"crewlet-sheet-grid__rownum--selected",a0===x.id&&"crewlet-sheet-grid__rownum--open",D&&"crewlet-sheet-grid__rownum--present",D&&dl(D.hue)),children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__rownum-number","aria-hidden":"true",children:g+1}),(0,_.jsx)(Ht,{id:J,children:nu(L,x,g,z)}),tt?(0,_.jsx)("span",{className:"crewlet-sheet-grid__row-actions",children:(0,_.jsx)(yy,{label:_e,triggerTabIndex:-1,open:a0===x.id,onOpenChange:B=>n0(B?x.id:null),renderTrigger:B=>(0,_.jsx)(Vo,{content:_e,align:"start",children:(0,_.jsx)(ul,{...B,label:_e,icon:(0,_.jsx)(sp,{}),size:"sm",title:""})}),items:[{key:"delete",label:H.deleteRow,icon:(0,_.jsx)(pp,{size:"sm"}),danger:!0,onSelect:()=>w?.(x.id)}]})}):null]}),L.map((B,Ae)=>{let eb={row:g,col:Ae},_0=xa(x.id,B.field),Ti=ue?.row===g&&ue.col===Ae,T0=Ye?Uf(Ye,g,Ae):!1,tb=x.pending?.includes(B.field)??!1,ns=x.refused?.[B.field]??Pp.get(_0),Ei=x.changed?.[B.field],E0=Rt(B,x.values[B.field]),ls=i0.get(_0),On=ls?.[0],Si=$?.rowId===x.id&&$.field===B.field,S0=Ti&&o!==void 0&&!Si;return(0,_.jsxs)("div",{id:Up(q,eb),role:"gridcell","aria-colindex":Ae+2,"aria-selected":T0,"aria-readonly":!Fl(B)||void 0,"aria-describedby":Ti?w0:void 0,tabIndex:Ti&&!Si?0:-1,className:k("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${B.type}`,B.frozen&&"crewlet-sheet-grid__cell--frozen",Ae===Jo&&"crewlet-sheet-grid__frozen-edge",T0&&"crewlet-sheet-grid__cell--selected",Ti&&"crewlet-sheet-grid__cell--active",tb&&"crewlet-sheet-grid__cell--pending",ns!==void 0&&"crewlet-sheet-grid__cell--refused",Si&&"crewlet-sheet-grid__cell--editing",S0&&"crewlet-sheet-grid__cell--history",On&&"crewlet-presence-ring",On&&dl(On.hue),On&&(On.idle?"crewlet-presence-ring--idle":null)),style:B.frozen?{insetInlineStart:`${Zl[Ae]}px`}:void 0,onMouseDown:ca=>g0(ca,{rowId:x.id,field:B.field}),onFocus:ca=>{ca.target===ca.currentTarget&&c0({rowId:x.id,field:B.field})},onMouseEnter:()=>Zy({rowId:x.id,field:B.field}),onDoubleClick:()=>{B.type!=="checkbox"&&Po({rowId:x.id,field:B.field})},onClick:ca=>{B.type==="checkbox"&&ca.target.closest(".crewlet-sheet-cell__check")&&bu({rowId:x.id,field:B.field})},children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,_.jsx)(qp,{column:B,value:E0,context:z,onOpenLink:u})}),ns!==void 0?(0,_.jsx)("span",{className:"crewlet-sheet-grid__refused","aria-hidden":"true",children:(0,_.jsx)(li,{size:"xs"})}):null,Ei?(0,_.jsx)(gy,{by:Ei.by,at:Ei.at,previous:tu(Ei)&&ba(B,Rt(B,Ei.previous),z)||null,locale:R,labels:H}):null,ls&&On?(0,_.jsx)(hy,{name:ap(ls),hue:On.hue,kind:On.kind,editing:ls.some(ca=>ca.editing)}):null,Ti&&ns!==void 0&&!Si?(0,_.jsx)("span",{className:"crewlet-sheet-grid__message","aria-hidden":"true",children:ns}):null,S0?(0,_.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"crewlet-sheet-grid__history",title:H.history,onMouseDown:ca=>ca.stopPropagation(),onClick:()=>o?.({rowId:x.id,field:B.field}),children:(0,_.jsx)(hp,{size:"xs"})}):null,Si?(0,_.jsx)(Ey,{column:B,value:E0,context:z,seed:$.seed,label:`${B.label}, ${nu(L,x,g,z)}`,side:Py(g),conflict:ts,onCommit:(ca,ab)=>d0(ca,ab),onCancel:()=>d0(void 0,null)}):null]},B.field)})]},x.id)})})]}),at?(0,_.jsx)("div",{className:k("crewlet-sheet-grid__add-column",x0&&"crewlet-sheet-grid__add-column--floor"),style:{height:`${ln}px`},children:(0,_.jsx)(Vo,{content:H.addColumn,children:(0,_.jsx)(ul,{label:H.addColumn,icon:(0,_.jsx)(ou,{size:"xs"}),size:"sm",title:"",onClick:I})})}):null]}),st?(0,_.jsx)("div",{ref:A,className:"crewlet-sheet-grid__measure","aria-hidden":"true",inert:!0,children:Y.filter(g=>st.has(g.field)).map(g=>(0,_.jsxs)("div",{"data-measure":g.field,children:[(0,_.jsxs)("div",{className:k("crewlet-sheet-grid__header",`crewlet-sheet-grid__header--${g.type}`),children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:g.label}),y?(0,_.jsx)("span",{className:"crewlet-sheet-grid__sort",children:(0,_.jsx)(ru,{size:"xs"})}):null]}),(st.get(g.field)??[]).map((x,D)=>(0,_.jsx)("div",{className:k("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${g.type}`),children:(0,_.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,_.jsx)(qp,{column:g,value:x,context:z})})},D))]},g.field))}):null,(0,_.jsx)(Ht,{id:w0,children:Fy}),(0,_.jsx)(Ht,{id:y0,children:[H.keyboardHelp,tt?H.rowActionsHelp:"",He?H.columnSettingsHelp:""].filter(Boolean).join(" ")}),(0,_.jsx)(Ht,{children:(0,_.jsx)("span",{role:"status","aria-live":"polite",children:(0,_.jsx)("span",{children:t0.text},t0.n)})}),i||S?(0,_.jsxs)("div",{className:"crewlet-sheet-grid__foot",children:[i&&Oe?(0,_.jsx)(ka,{size:"small",variant:"ghost",onClick:i,leadingIcon:(0,_.jsx)(ou,{size:"sm"}),children:H.addRow}):null,S?(0,_.jsxs)("span",{className:k("crewlet-sheet-grid__sync",((S.failed??0)>0||!S.offline&&(S.refused??0)>0)&&"crewlet-sheet-grid__sync--failed"),children:[(0,_.jsx)("span",{children:H.sync(S)}),(S.failed??0)>0&&h?(0,_.jsx)(ka,{size:"small",variant:"ghost",onClick:h,children:H.retry}):null,(S.failed??0)===0&&(S.refused??0)>0&&T?(0,_.jsx)(ka,{size:"small",variant:"ghost",onClick:T,children:H.dismiss}):null]}):null]}):null]})}function gi(e){return!e.currentTarget.contains(e.target)}function Up(e,t){return`${e}-r${t.row<0?"h":t.row}-c${t.col}`}function m_(e,t,a){let n=t.get(xa(e.id,a));return n===void 0||e.refused?.[a]!==void 0?e:{...e,refused:{...e.refused,[a]:n}}}var Xp="crewlet:ready";function Qp(e=window){let t=e.crewlet;return t?Ko(t):new Promise(a=>{let n=()=>{let l=e.crewlet;l&&(e.removeEventListener(Xp,n),a(Ko(l)))};e.addEventListener(Xp,n)})}function Ko(e){return e.ready.then(()=>e)}function Sy(){let e=crypto.getRandomValues(new Uint8Array(12));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}var Ga=j(be(),1),Da={noData:"This sheet cannot load, because this version of the page was published without access to its data.",noColumns:e=>`The \u201C${e}\u201D collection has no columns yet.`,loadFailed:(e,t)=>t==="forbidden"?`You do not have access to the \u201C${e}\u201D collection.`:t==="not_found"?`This page has no collection named \u201C${e}\u201D.`:`The \u201C${e}\u201D collection could not be loaded. Reload the page to try again.`,inSheet:e=>e===1?"1 other person is in this sheet":`${e} other people are in this sheet`,stepOvertaken:e=>`Somebody changed this after you, so the ${e} was skipped.`,addRowFailed:e=>`Could not add a row. ${e}`,deleteRowTitle:"Delete this row?",deleteRowMessage:"The row is removed for everyone who can open this page.",deleteRowConfirm:"Delete row",deleteRowCancel:"Cancel"};function pu(e,t){console.warn(`[crewlet artifact-kit] ${e}`,t)}function Zp(e){return e.verdict==="applied"||e.verdict==="pending"?null:Ro(e.verdict,e.reason,Yl)}function gu(e){let t=typeof e?.code=="string"?e.code:"",a=e instanceof Error?e.message:void 0;return Ro(t,a,Yl)}function Ay(e,t){let{capabilities:a}=e;return{settled:t,db:a.has("db"),presence:a.has("presence"),identity:a.has("identity")}}var v_=(e,t)=>e.settled===t.settled&&e.db===t.db&&e.presence===t.presence&&e.identity===t.identity;function w_(e){let[t,a]=(0,F.useState)(()=>Ay(e,!1));return(0,F.useEffect)(()=>{let n=!0,l=r=>{let i=Ay(e,r);a(o=>v_(o,i)?o:i)};return l(!1),e.ready.then(()=>{n&&l(!0)}),()=>{n=!1}},[e]),t}function My({runtime:e,collection:t,columns:a,sort:n,frozen:l,readOnly:r=!1,label:i,height:o}){let s=w_(e),c=s.db,d=s.presence,v=s.identity,u=(0,F.useMemo)(()=>e.data.collection(t),[e,t]),[m,b]=(0,F.useState)(null),[y,S]=(0,F.useState)(void 0),[h,f]=(0,F.useState)([]),[p,w]=(0,F.useState)(null),[T,C]=(0,F.useState)(n),[N,O]=(0,F.useState)(null),[I,R]=(0,F.useState)([]),[te,Se]=(0,F.useState)([]),[me,q]=(0,F.useState)(!1),[H,Ve]=(0,F.useState)(0),[z,Y]=(0,F.useState)({text:"",n:0}),[P,Ze]=(0,F.useState)(null),et=(0,F.useCallback)(V=>Y(Q=>({text:V,n:Q.n+1})),[]),[,Dt]=(0,F.useState)(0),st=(0,F.useRef)(new Map),G=(0,F.useMemo)(()=>new $f,[]);(0,F.useEffect)(()=>C(n),[n]),(0,F.useEffect)(()=>G.subscribe(()=>Dt(V=>V+1)),[G]),(0,F.useEffect)(()=>{if(!c)return;let V=!0;return e.data.schema().then(Q=>{if(!V)return;let ut=Q.find(sa=>sa.name===t)??null;S(ut?.title),a||b(fw(ut))}).catch(Q=>{pu(`the schema of ${t} could not be read`,Q),V&&!a&&b([])}),()=>{V=!1}},[e,a,c,t]),(0,F.useEffect)(()=>{if(c)return w(null),u.subscribe(V=>f(V.map(Q=>({id:Q.id,values:Q.data}))),V=>w(Da.loadFailed(t,V.code)))},[u,c,t]),(0,F.useEffect)(()=>{if(!v)return;let V=!0;return e.identity.me().then(Q=>{V&&O(Q)}).catch(Q=>pu("the reader could not be identified",Q)),e.identity.people().then(Q=>{V&&R(Q.map(yw))}).catch(Q=>pu("the people a person cell offers could not be listed",Q)),()=>{V=!1}},[e,v]);let se=(0,F.useMemo)(()=>vw(a??m??[],l),[a,m,l]);(0,F.useEffect)(()=>{if(d)return Se(e.presence.roster().members),e.presence.subscribe(V=>Se(V.members))},[e,d]),(0,F.useEffect)(()=>{if(e.connection)return q(e.connection.state==="offline"),e.connection.subscribe(V=>q(V==="offline"))},[e]);let ct=(0,F.useMemo)(()=>{let V=xw(te,st.current);return st.current=V,V},[te]),A=N?.seat??null,oe=(0,F.useMemo)(()=>_w(te,t,A,ct),[te,t,A,ct]),Je=(0,F.useMemo)(()=>Ew(Tw(te,t),A,ct),[te,t,A,ct]),L=(0,F.useCallback)(V=>{let Q=V.map(ie=>G.begin(ie.rowId,ie.field)),ut=ie=>{for(let Ql of Q)Ql(ie===null?{ok:!0}:{ok:!1,message:ie})},sa=ie=>({[ie.field]:ie.value}),La;if(V.length===1){let[ie]=V;La=u.merge(ie.rowId,sa(ie))}else{let ie=e.data.batch();for(let Ql of V)ie.merge(t,Ql.rowId,sa(Ql));La=ie.commit()}La.then(ie=>ut(Zp(ie)),ie=>ut(gu(ie)))},[t,G,e,u]),X=(0,F.useCallback)(()=>{u.set(Sy(),{}).then(V=>{let Q=Zp(V);Ve(ut=>Q===null?0:ut+1),Q!==null&&et(Da.addRowFailed(Q))},V=>{Ve(Q=>Q+1),et(Da.addRowFailed(gu(V)))})},[u,et]),Oe=(0,F.useCallback)(V=>{let Q=se[0],ut=Q?G.begin(V,Q.field):()=>{};u.delete(V).then(sa=>{let La=Zp(sa);if(ut(La===null?{ok:!0}:{ok:!1,message:La}),La===null)for(let ie of se)G.dismiss(V,ie.field)},sa=>ut({ok:!1,message:gu(sa)}))},[se,G,u]),tt=(0,F.useCallback)(V=>{e.data[V]().then(Q=>{Q===null||Q.verdict==="applied"||Q.verdict==="pending"||et(Q.verdict==="conflict"?Da.stepOvertaken(V):Ro(Q.verdict,Q.reason,Yl))},Q=>et(gu(Q)))},[e,et]),He=(0,F.useRef)({active:null,editing:null}),at=(0,F.useCallback)(()=>{if(!d)return;let{active:V,editing:Q}=He.current,ut=Q??V,sa=ut?{collection:t,doc:ut.rowId,field:ut.field}:{};e.presence.set({activity:Q?"editing":"viewing",focus:sa})},[e,d,t]),Ft=(0,F.useCallback)(V=>{He.current.active=V,at()},[at]),Mn=(0,F.useCallback)(V=>{He.current.editing=V,at()},[at]);if(!c)return s.settled?(0,Ga.jsx)(ri,{variant:"warning",children:Da.noData}):null;if(p!==null)return(0,Ga.jsx)(ri,{variant:"warning",children:p});if(se.length===0&&(a!==null||m!==null))return(0,Ga.jsx)(ri,{variant:"neutral",children:Da.noColumns(t)});let Ot=r||N?.role==="viewer",mi={...G.sync(me),failed:H},Ea=P===null?void 0:h.find(V=>V.id===P);return(0,Ga.jsxs)("div",{className:"crewlet-kit-sheet",children:[Je.length>0?(0,Ga.jsx)("div",{className:"crewlet-kit-sheet__presence",children:(0,Ga.jsx)(Dp,{members:Je,self:!1,size:"xs",label:Da.inSheet(Je.length)})}):null,(0,Ga.jsx)(Ip,{label:i??y??t,columns:se,rows:G.decorate(h),people:I,mode:Ot?"read":"edit",onEdit:Ot?void 0:L,onAddRow:Ot?void 0:X,onDeleteRow:Ot?void 0:Ze,onActiveCellChange:Ft,onEditingChange:Mn,onOpenLink:V=>{e.openLink(V).catch(Q=>pu("a link could not be opened",Q))},onUndo:()=>tt("undo"),onRedo:()=>tt("redo"),presence:oe,sort:T,onSortChange:C,sync:Ot?void 0:mi,onRetry:H>0?X:void 0,onDismissRefused:()=>G.dismissAll(),height:o,fit:"content"}),(0,Ga.jsx)(xp,{open:Ea!==void 0,onClose:()=>Ze(null),onConfirm:()=>{Ea&&Oe(Ea.id),Ze(null)},title:Da.deleteRowTitle,message:Da.deleteRowMessage,confirmLabel:Da.deleteRowConfirm,cancelLabel:Da.deleteRowCancel,destructive:!0}),z.text?(0,Ga.jsx)(ri,{variant:"warning",live:"polite",children:z.text},z.n):null]})}var zy=j(be(),1);function Oy(e,t){let a=e.ownerDocument.createElement("div");a.className="crewlet-kit-sheet__root",e.append(a);let n=(0,Ny.createRoot)(a),l=t,r=null,i=!1,o=()=>{i||!r||n.render((0,zy.jsx)(My,{runtime:r,collection:l.collection,columns:l.columns&&l.columns.length>0?l.columns:null,sort:l.sort??null,frozen:l.frozen,readOnly:l.readOnly,label:l.label,height:l.height}))},s=c=>{c.then(d=>{r=d,o()})};return s(t.runtime?Ko(t.runtime):Qp(e.ownerDocument.defaultView??window)),{update(c){l=c,c.runtime&&c.runtime!==r&&s(Ko(c.runtime)),o()},unmount(){i=!0,n.unmount(),a.remove()}}}var Io=class extends HTMLElement{static get observedAttributes(){return pw}attributeChangedCallback(){this.closest("crewlet-sheet")?.dispatchEvent(new Event("crewlet-columnchange"))}toColumn(){return gw(t=>this.getAttribute(t))}},y_=["collection","sort","frozen","readonly","label","height"],mu=class extends HTMLElement{constructor(){super(...arguments);on(this,"mounted",null);on(this,"observer",typeof MutationObserver=="function"?new MutationObserver(()=>this.refresh()):null);on(this,"onColumnChange",()=>this.refresh())}static get observedAttributes(){return y_}connectedCallback(){this.addEventListener("crewlet-columnchange",this.onColumnChange),this.observer?.observe(this,{childList:!0}),this.refresh()}disconnectedCallback(){this.removeEventListener("crewlet-columnchange",this.onColumnChange),this.observer?.disconnect(),this.mounted?.unmount(),this.mounted=null}attributeChangedCallback(){this.isConnected&&this.refresh()}options(){let a=this.getAttribute("collection")?.trim();if(!a)return null;let n=[...this.children].filter(s=>s instanceof Io).map(s=>s.toColumn()).filter(s=>s!==null),l=Number(this.getAttribute("frozen")),r=Number(this.getAttribute("height")),i={collection:a,columns:n,sort:mw(this.getAttribute("sort")),readOnly:this.hasAttribute("readonly")};this.hasAttribute("frozen")&&Number.isInteger(l)&&l>=0&&(i.frozen=l),this.hasAttribute("height")&&Number.isFinite(r)&&r>0&&(i.height=r);let o=this.getAttribute("label")?.trim();return o&&(i.label=o),i}refresh(){let a=this.options();if(!a){this.mounted?.unmount(),this.mounted=null;return}this.mounted?this.mounted.update(a):this.mounted=Oy(this,a)}};function Jp(e=customElements){e.get("crewlet-column")||e.define("crewlet-column",Io),e.get("crewlet-sheet")||e.define("crewlet-sheet",mu)}Jp();export{Io as CrewletColumnElement,mu as CrewletSheetElement,Xp as RUNTIME_READY_EVENT,Jp as defineElements,Oy as mountSheet,Qp as whenRuntime};
|
|
12
|
+
`?(a.push(n),t.push(a),a=[],n=""):n+=o,r+=1}return(n!==""||a.length>0)&&(a.push(n),t.push(a)),t}function Jf(e,t,a,n,l){let r={edits:[],refused:[]};if(n.length===0)return r;let i=n.length===1&&n[0].length===1,o=i?a.bottom-a.top+1:n.length,s=i?a.right-a.left+1:Math.max(...n.map(c=>c.length));for(let c=0;c<o;c+=1){let d=t[a.top+c];if(!d)break;for(let v=0;v<s;v+=1){let u=e[a.left+v];if(!u)break;if(u.readOnly)continue;let m=i?n[0][0]:n[c]?.[v];if(m===void 0)continue;let b=ti(u,m,l);if(!b.ok){r.refused.push({rowId:d.id,field:u.field,error:b.error});continue}Wr(b.value,Rt(u,d.values[u.field]))||r.edits.push({rowId:d.id,field:u.field,value:b.value})}}return r}function Ff(e,t,a,n){let l={edits:[],refused:[]};for(let r=a.top;r<=a.bottom;r+=1){let i=t[r];if(i)for(let o=a.left;o<=a.right;o+=1){let s=e[o];if(!s||s.readOnly)continue;let c=s.type==="checkbox"?!1:s.type==="multiselect"?[]:null;if(!Wr(Rt(s,i.values[s.field]),c)){if(s.required&&s.type!=="checkbox"){l.refused.push({rowId:i.id,field:s.field,error:n.labels.required(s.label)});continue}l.edits.push({rowId:i.id,field:s.field,value:c})}}}return l}function Ro(e,t,a){if(e==="forbidden"||e==="capability_not_declared")return a.forbidden;let n=t?.trim();return n||a.couldNotSave}var Qc=(e,t)=>`${e}\0${t}`,$f=class{constructor(){on(this,"waiting",new Map);on(this,"refusals",new Map);on(this,"listeners",new Set);on(this,"failed",0)}begin(e,t){let a=Qc(e,t);this.refusals.delete(a),this.waiting.set(a,(this.waiting.get(a)??0)+1),this.emit();let n=!1;return l=>{if(n)return;n=!0;let r=(this.waiting.get(a)??1)-1;r<=0?this.waiting.delete(a):this.waiting.set(a,r),l.ok||(this.refusals.set(a,l.message),this.failed+=1),this.emit()}}isPending(e,t){return this.waiting.has(Qc(e,t))}refusal(e,t){return this.refusals.get(Qc(e,t))}dismiss(e,t){this.refusals.delete(Qc(e,t))&&this.emit()}get saving(){let e=0;for(let t of this.waiting.values())e+=t;return e}dismissAll(){this.refusals.size!==0&&(this.refusals.clear(),this.emit())}sync(e=!1){return{saving:this.saving,offline:e,refused:this.refusals.size}}get failures(){return this.failed}resetFailures(){this.failed=0}decorate(e){return this.waiting.size===0&&this.refusals.size===0?[...e]:e.map(t=>{let a=[],n={};for(let l of this.waiting.keys()){let[r,i]=l.split("\0");r===t.id&&a.push(i)}for(let[l,r]of this.refusals){let[i,o]=l.split("\0");i===t.id&&(n[o]=r)}return a.length===0&&Object.keys(n).length===0?t:{...t,pending:[...t.pending??[],...a],refused:{...t.refused,...n}}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(){for(let e of this.listeners)e()}};function iw(e,t){let a=e instanceof Date?e:new Date(e);return Number.isNaN(a.getTime())?"":new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(a)}function eu(e,t,a,n){return t.changed(e.by,iw(e.at,n),a)}var tu=e=>e.previous!==void 0;function Wf(e,t,a,n){if(!a)return[...t];let l=e.find(i=>i.field===a.field);if(!l)return[...t];let r=a.direction==="descending"?-1:1;return t.map((i,o)=>({row:i,index:o,value:Rt(l,i.values[l.field])})).sort((i,o)=>{let s=c=>c===null||c===""||Array.isArray(c)&&c.length===0;return l.type!=="checkbox"&&(s(i.value)||s(o.value))?s(i.value)===s(o.value)?i.index-o.index:s(i.value)?1:-1:r*lw(l,i.value,o.value,n)||i.index-o.index}).map(({row:i})=>i)}function au(e,t){return!e||e.field!==t?{field:t,direction:"ascending"}:e.direction==="ascending"?{field:t,direction:"descending"}:null}var xa=(e,t)=>`${e}\0${t}`;function Pf(e){let t=new Map;for(let a of e??[]){let n=xa(a.rowId,a.field),l=t.get(n);l?l.push(a):t.set(n,[a])}for(let a of t.values())a.sort((n,l)=>+!!l.editing-+!!n.editing);return t}function ep(e){let t=new Map;for(let a of e??[])t.has(a.rowId)||t.set(a.rowId,a);return t}function tp(e,t=2){let a=new Map;for(let n of e??[]){let l=a.get(n.field)??[];l.length<t&&!l.some(r=>r.id===n.id)&&l.push(n),a.set(n.field,l)}return a}function ap(e){return e.map(t=>t.name).join(", ")}function np(e,t,a,n,l=zo){let{labels:r}=n,i=[`${e.label}.`];e.readOnly&&i.push(r.readOnly(e.label)),t.pending?.includes(e.field)&&i.push(`${r.saving}.`);let o=t.refused?.[e.field];o&&i.push(o);let s=a.map(d=>d.name);s.length>0&&i.push(l.alsoHere(s));let c=t.changed?.[e.field];if(c){let d=tu(c)&&ba(e,Rt(e,c.previous),n)||null;i.push(eu(c,r,d,n.locale))}return i.join(" ")}function nu(e,t,a,n){let l=e.find(r=>r.type==="text");if(l){let r=ba(l,Rt(l,t.values[l.field]),n);if(r)return r}return String(a+1)}var lp=j(ht(),1),uw=j(be(),1),W3=(0,lp.createContext)(2);function dw({level:e,children:t}){return(0,uw.jsx)(W3.Provider,{value:e,children:t})}var P3=j(ht(),1);var hw="data-crewlet-focus-returned";function ai(e,t){if(!e)return!1;let a=()=>e.removeAttribute(hw);return e.setAttribute(hw,""),e.addEventListener("blur",a,{once:!0}),e.focus(t),e.ownerDocument.activeElement===e?!0:(e.removeEventListener("blur",a),a(),!1)}function k(...e){return e.filter(Boolean).join(" ")}var e5=["todo","in_progress","done","blocked"];function t5(e){if(e.options)return e.options.map(t=>{let a={id:t.id,label:t.label};return t.color&&(a.color=t.color),t.category&&e5.includes(t.category)&&(a.category=t.category),t.archived&&(a.archived=!0),a})}function fw(e){let t=[];for(let a of e?.columns??[]){if(a.hidden)continue;let n=a.type,l=Zc(n),r={field:a.key,label:a.label||a.key,type:l?n:"text"};l||(r.readOnly=!0),a.primary&&(r.frozen=!0),a.required&&(r.required=!0),a.min!==void 0&&(r.min=a.min),a.max!==void 0&&(r.max=a.max),a.max_length!==void 0&&(r.maxLength=a.max_length),a.max_items!==void 0&&(r.maxItems=a.max_items);let i=t5(a);i&&(r.options=i),t.push(r)}return t}function a5(e,t){let a=t.trim();if(a===""||a==="plain")return;let n=/^currency:([A-Za-z]{3})$/.exec(a);if(n){e.numberStyle="currency",e.currency=n[1].toUpperCase();return}if(a==="percent"){e.numberStyle="percent";return}let l=/^0(?:\.(0+))?(%)?$/.exec(a);l&&(e.precision=l[1]?.length??0,l[2]&&(e.numberStyle="percent"))}var Ho=e=>{if(e===null||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0},pw=["field","type","label","format","options","width","readonly","required","frozen","min","max","max-length","max-items","time"];function gw(e){let t=e("field")?.trim();if(!t)return null;let a=e("type")?.trim()??"text",n=Zc(a),l={field:t,label:e("label")?.trim()||t,type:n?a:"text"};(!n||e("readonly")!==null)&&(l.readOnly=!0),e("required")!==null&&(l.required=!0),e("frozen")!==null&&(l.frozen=!0),e("time")!==null&&(l.time=!0);let r=Ho(e("width"));r!==void 0&&(l.width=r);let i=Ho(e("min"));i!==void 0&&(l.min=i);let o=Ho(e("max"));o!==void 0&&(l.max=o);let s=Ho(e("max-length"));s!==void 0&&(l.maxLength=s);let c=Ho(e("max-items"));c!==void 0&&(l.maxItems=c);let d=e("options");d&&(l.options=Hf(d));let v=e("format");return v&&l.type==="number"&&a5(l,v),l}function mw(e){let t=e?.trim();return t?t.startsWith("-")?{field:t.slice(1),direction:"descending"}:{field:t,direction:"ascending"}:null}function vw(e,t){return t===void 0?[...e]:e.map((a,n)=>n<t?{...a,frozen:!0}:a)}var ww=e=>e!==void 0&&Oo(e)?e:void 0;function yw(e){let t={id:e.seat,name:e.displayName,kind:e.kind},a=ww(e.avatar?.hue);return a&&(t.hue=a),e.avatar?.character&&(t.character=e.avatar.character),t}function bw(e,t){return e.filter(a=>a.seat!==t)}function xw(e,t){return zf(e.map(a=>({id:a.session,kind:a.kind,hue:ww(a.avatar?.hue)})),t)}function _w(e,t,a,n){let l=[];for(let r of bw(e,a)){let i=r.focus;i.collection!==t||!i.doc||!i.field||l.push({rowId:i.doc,field:i.field,id:r.session,name:r.displayName,kind:r.kind,hue:n.get(r.session)??"purple",editing:r.activity==="editing",idle:r.activity==="idle"})}return l}function Tw(e,t){return e.filter(a=>a.focus.collection===t)}function Ew(e,t,a){return bw(e,t).map(n=>{let l={id:n.session,seat:n.seat,name:n.displayName,kind:n.kind,activity:n.activity},r=a.get(n.session);return r&&(l.hue=r),n.avatar?.character&&(l.character=n.avatar.character),l})}var F=j(ht(),1);var Aw=j(be(),1),Sw={xs:12,sm:14,md:16,lg:20,xl:24},Mw=1.75,n5=`var(--crewlet-glyph-stroke, ${Mw})`;function l5(e){return e===void 0?"1em":typeof e=="number"?`${e}px`:e in Sw?`${Sw[e]}px`:e}function vt({size:e,title:t,filled:a=!1,fillable:n,className:l,style:r,children:i,...o}){let s=l5(e);return(0,Aw.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,stroke:"currentColor",...t?{role:"img","aria-label":t}:{"aria-hidden":!0,focusable:!1},className:l===void 0?"crewlet-glyph":`crewlet-glyph ${l}`,...o,viewBox:"0 0 24 24",fill:n&&a?"currentColor":"none",strokeWidth:Mw,strokeLinecap:"round",strokeLinejoin:"round",style:{...r,strokeWidth:n5},children:i})}var U=j(be(),1);function ru(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M12 5v14"}),(0,U.jsx)("path",{d:"m19 12-7 7-7-7"})]})}function rp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"m5 12 7-7 7 7"}),(0,U.jsx)("path",{d:"M12 19V5"})]})}function ni(e){return(0,U.jsx)(vt,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"M20 6 9 17l-5-5"})})}function ip(e){return(0,U.jsx)(vt,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"m15 18-6-6 6-6"})})}function li(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,U.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}function op(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("path",{d:"m16 9-5.5 5.5L8 12"})]})}function sp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"19",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"5",cy:"12",r:"1"})]})}function cp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"12",cy:"5",r:"1"}),(0,U.jsx)("circle",{cx:"12",cy:"19",r:"1"})]})}function up(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M15 3h6v6"}),(0,U.jsx)("path",{d:"M10 14 21 3"}),(0,U.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function iu(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("path",{d:"M12 16v-4"}),(0,U.jsx)("path",{d:"M12 8h.01"})]})}function dp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}),(0,U.jsx)("path",{d:"m15 5 4 4"})]})}function ou(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M5 12h14"}),(0,U.jsx)("path",{d:"M12 5v14"})]})}function hp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,U.jsx)("path",{d:"M3 3v5h5"}),(0,U.jsx)("path",{d:"M12 7v5l4 2"})]})}function fp(e){return(0,U.jsx)(vt,{...e,fillable:!0,children:(0,U.jsx)("path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"})})}function pp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M10 11v6"}),(0,U.jsx)("path",{d:"M14 11v6"}),(0,U.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),(0,U.jsx)("path",{d:"M3 6h18"}),(0,U.jsx)("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}function gp(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),(0,U.jsx)("path",{d:"M12 9v4"}),(0,U.jsx)("path",{d:"M12 17h.01"})]})}function Do(e){return(0,U.jsxs)(vt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M18 6 6 18"}),(0,U.jsx)("path",{d:"m6 6 12 12"})]})}var _a=j(be(),1),r5={neutral:(0,_a.jsx)(iu,{size:"md"}),info:(0,_a.jsx)(iu,{size:"md"}),success:(0,_a.jsx)(op,{size:"md"}),warning:(0,_a.jsx)(gp,{size:"md"}),danger:(0,_a.jsx)(li,{size:"md"})},ri=({variant:e="info",title:t,icon:a,layout:n="card",action:l,live:r,className:i,children:o,...s})=>(0,_a.jsxs)("div",{...s,"aria-live":r,className:k("crewlet-callout",`crewlet-callout--${e}`,`crewlet-callout--${n}`,i),children:[(0,_a.jsx)("span",{className:"crewlet-callout__icon","aria-hidden":!0,children:a??r5[e]}),(0,_a.jsxs)("div",{className:"crewlet-callout__content",children:[t?(0,_a.jsx)("span",{className:"crewlet-callout__title",children:t}):null,o]}),l?(0,_a.jsx)("div",{className:"crewlet-callout__action",children:l}):null]});var Nw=j(be(),1);function Ow({size:e="em",className:t,...a}){return(0,Nw.jsx)("span",{...a,"aria-hidden":"true",className:k("crewlet-spinner",`crewlet-spinner--${e}`,t)})}var zw=j(be(),1);function Ht({as:e="span",id:t,className:a,children:n}){return(0,zw.jsx)(e,{id:t,className:k("crewlet-visually-hidden",a),children:n})}var Ca=j(ht(),1);var wt=j(be(),1);function Cw({variant:e="primary",size:t="medium",shape:a="square",block:n,className:l},r){return k("crewlet-btn",`crewlet-btn--${e}`,`crewlet-btn--${t}`,`crewlet-btn--${a}`,n&&"crewlet-btn--block",r,l)}function mp({leadingIcon:e,trailingIcon:t,loading:a,children:n}){return(0,wt.jsxs)(wt.Fragment,{children:[a?(0,wt.jsx)(Ow,{className:"crewlet-btn__spinner"}):e?(0,wt.jsx)("span",{className:"crewlet-btn__icon",children:e}):null,(0,wt.jsx)("span",{className:"crewlet-btn__label",children:n}),t?(0,wt.jsx)("span",{className:"crewlet-btn__icon",children:t}):null]})}var ka=(0,Ca.forwardRef)(function({variant:t="primary",size:a="medium",shape:n="square",leadingIcon:l,trailingIcon:r,block:i,className:o,type:s="button",asChild:c=!1,loading:d=!1,pressed:v,disabledReason:u,disabled:m,onClick:b,title:y,children:S,...h},f){let p=(0,Ca.useId)(),T=Cw({variant:t,size:a,shape:n,block:i,className:o},d?"crewlet-btn--loading":void 0);if(c){let N=Ca.Children.only(S);if(!(0,Ca.isValidElement)(N))throw new Error("Button with asChild expects exactly one valid React element child.");let O=N;return(0,Ca.cloneElement)(O,{...h,title:y,className:k(O.props.className,T)},(0,wt.jsx)(mp,{leadingIcon:l,trailingIcon:r,children:O.props.children}))}let C=d||u!==void 0;return(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsx)("button",{...h,ref:f,type:s,className:T,disabled:m,title:y,"aria-label":h["aria-label"]??(S===void 0?y:void 0),"aria-pressed":v,"aria-busy":d||void 0,"aria-disabled":C||void 0,"aria-describedby":u===void 0?h["aria-describedby"]:k(h["aria-describedby"],p),onClick:N=>{if(C){N.preventDefault();return}b?.(N)},children:(0,wt.jsx)(mp,{leadingIcon:l,trailingIcon:r,loading:d,children:S})}),u===void 0?null:(0,wt.jsx)(Ht,{id:p,children:u})]})}),CS=(0,Ca.forwardRef)(function({variant:t="primary",size:a="medium",shape:n="square",leadingIcon:l,trailingIcon:r,block:i,className:o,external:s=!1,title:c,children:d,...v},u){let m=r??(s?(0,wt.jsx)(up,{size:"sm"}):void 0);return(0,wt.jsx)("a",{...v,ref:u,className:Cw({variant:t,size:a,shape:n,block:i,className:o}),title:c,"aria-label":v["aria-label"]??(d===void 0?c:void 0),target:s?"_blank":v.target,rel:s?"noreferrer":v.rel,children:(0,wt.jsx)(mp,{leadingIcon:l,trailingIcon:m,children:d})})});var Go=j(ht(),1),kw=j(be(),1),Sn="crewlet:viewchange",ot=4;function ii(e,t,a,n=ot,l="below"){let r=e.y+e.height+n,i=e.y-n-t.height,o=a.y+a.height-r,s=e.y-n-a.y,d=(l==="below"?o>=t.height||o>=s:s>=t.height||s>=o)?l:l==="below"?"above":"below",v=d==="below"?r:i,u=a.y+a.height-t.height,m=Math.max(a.y,Math.min(v,u)),b=a.x+a.width-t.width;return{left:Math.max(a.x,Math.min(e.x,b)),top:m,side:d}}function oi(){return{x:0,y:0,width:window.innerWidth,height:window.innerHeight}}function si(e,t,a){let n={x:e.left-(a?t.x:0),y:e.top-(a?t.y:0),width:e.width,height:e.height};return i5(n,{x:0,y:0,width:t.width,height:t.height})}function i5(e,t){return e.x+e.width<t.x||e.y+e.height<t.y||e.x>t.x+t.width||e.y>t.y+t.height}var o5=(0,Go.createContext)(null);function sl(){let e=(0,Go.useContext)(o5);return e||(typeof document>"u"?null:document.body)}var De=j(ht(),1);var vp={duration:{instant:"75ms",fast:"120ms",base:"150ms",moderate:"200ms",slow:"300ms",breath:"2200ms",turn:"1000ms",sweep:"1500ms",spark:"1600ms"},easing:{default:"ease",out:"ease-out",inOut:"ease-in-out",emphasized:"cubic-bezier(0.16, 1, 0.3, 1)",spring:"cubic-bezier(0.34, 1.56, 0.64, 1)"}};var wp={base:"0",raised:"1",sticky:"10",presence:"20",dropdown:"100",overlay:"200",layerBase:"9000",layerMax:"9899",modal:"9999",popover:"10000",toast:"10001"};var Rw=Symbol.for("crewlet.layer-stack");function s5(){let e=globalThis,t=e[Rw];if(t)return t;let a={entries:[],opened:0,armed:null,listeners:new Set,version:0,locks:0,restore:null};return e[Rw]=a,a}var Ee=s5();function Hw(){Ee.version+=1;for(let e of[...Ee.listeners])e()}function c5(e){return Ee.listeners.add(e),()=>Ee.listeners.delete(e)}function ci(e){let t;for(let a of Ee.entries)e&&a.kind!==e||(!t||a.order>t.order)&&(t=a);return t}var yp={base:Number(wp.layerBase),max:Number(wp.layerMax)};function u5(e){let t=0;for(let a of Ee.entries)a.order<e&&(t+=1);return t}function d5(e){return e===0?yp.base:Math.min(yp.base+u5(e),yp.max)}var h5=229;function ui(e){let t="nativeEvent"in e&&e.nativeEvent||e;return!!t.isComposing||t.keyCode===h5}function Xl(e){let t=["a[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","[contenteditable='true']","[tabindex]"].join(",");return[...e.querySelectorAll(t)].filter(a=>a.tabIndex>=0&&!a.disabled&&!a.closest("[hidden],[inert]")&&(typeof a.checkVisibility!="function"||a.checkVisibility()))}function Dw(e){if(ui(e))return;if(e.key==="Escape"){if(e.defaultPrevented)return;let c=ci();if(!c)return;e.preventDefault(),c.dismissable()&&c.dismiss("escape");return}if(e.key!=="Tab"||e.defaultPrevented)return;let t=ci("modal"),a=t?.panel();if(!t||!a)return;let n=ci("popup"),l=document.activeElement;if(n&&n.order>t.order&&l&&n.panel()?.contains(l))return;let r=Xl(a);if(r.length===0){e.preventDefault(),a.focus();return}let i=r[0],o=r[r.length-1];if(!(l instanceof Node)||!a.contains(l)){e.preventDefault(),(e.shiftKey?o:i).focus();return}let s=c=>(l.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;e.shiftKey&&!r.some(c=>c!==l&&!s(c))?(e.preventDefault(),o.focus()):!e.shiftKey&&!r.some(c=>c!==l&&s(c))&&(e.preventDefault(),i.focus())}function Gw(e){Ee.armed=null;let t=ci();if(!t||!(e.target instanceof Node))return;let a=e.target;if(t.kind==="modal"){a===t.veil()&&(Ee.armed=t);return}[t.panel(),...t.inside()].some(l=>l?.contains(a))||t.dismissable()&&t.dismiss("outside")}function Lw(e){let t=Ee.armed;Ee.armed=null,!(!t||t!==ci()||e.target!==t.veil())&&t.dismissable()&&t.dismiss("outside")}function Uw(e){return Ee.entries.length===0&&(document.addEventListener("keydown",Dw),document.addEventListener("pointerdown",Gw,!0),document.addEventListener("click",Lw,!0)),Ee.entries.push(e),Hw(),()=>{let t=Ee.entries.indexOf(e);t>=0&&Ee.entries.splice(t,1),Ee.armed===e&&(Ee.armed=null),Ee.entries.length===0&&(document.removeEventListener("keydown",Dw),document.removeEventListener("pointerdown",Gw,!0),document.removeEventListener("click",Lw,!0)),Hw()}}function Bw(e){let t=(0,De.useRef)(0);return e&&t.current===0&&(t.current=++Ee.opened),e||(t.current=0),t.current}function f5(e){if(!e)return[];let t;for(let n of Ee.entries)n.kind!=="modal"||!n.panel()?.contains(e)||(!t||n.order>t.order)&&(t=n);let a=t?.panel();return t&&a?[e,a,...t.returnTo]:[e]}function qw(e){return(0,De.useSyncExternalStore)(c5,()=>Ee.version,()=>0),{zIndex:d5(e),isTopmost:e!==0&&ci()?.order===e}}function Vw({onClose:e,dismissable:t=!0,initialFocus:a}){let n=(0,De.useRef)(null),l=(0,De.useRef)(null),r=(0,De.useRef)(e),i=(0,De.useRef)(t),o=(0,De.useRef)(a);r.current=e,i.current=t,o.current=a;let s=Bw(!0),[c]=(0,De.useState)(()=>typeof document>"u"?[]:f5(document.activeElement)),d=qw(s);(0,De.useLayoutEffect)(()=>Uw({kind:"modal",order:s,panel:()=>n.current,returnTo:c,veil:()=>l.current,inside:()=>[],dismiss:()=>r.current(),dismissable:()=>i.current}),[s,c]),(0,De.useEffect)(()=>{let m=n.current;return m&&!m.contains(document.activeElement)&&(o.current?.()??Xl(m)[0]??m).focus(),()=>{let b=document.activeElement;if(!(b&&Ee.entries.some(y=>y.panel()?.contains(b)))){for(let y of c)if(!(!(y instanceof HTMLElement)||!y.isConnected||y===document.body)&&ai(y))return}}},[c]);let v=(0,De.useCallback)(m=>{n.current=m},[]),u=(0,De.useCallback)(m=>{l.current=m},[]);return{panelRef:v,veilRef:u,...d}}function di({open:e,onDismiss:t}){let a=(0,De.useRef)(null),n=(0,De.useRef)(null),l=(0,De.useRef)(t);l.current=t;let r=Bw(e),i=qw(r);(0,De.useLayoutEffect)(()=>{if(e)return Uw({kind:"popup",order:r,panel:()=>a.current,returnTo:[],veil:()=>null,inside:()=>[n.current],dismiss:c=>l.current(c),dismissable:()=>!0})},[e,r]);let o=(0,De.useCallback)(c=>{a.current=c},[]),s=(0,De.useCallback)(c=>{n.current=c},[]);return{panelRef:o,insideRef:s,...i}}function Yw(e){(0,De.useLayoutEffect)(()=>{if(!(!e||typeof document>"u"))return Ee.locks===0&&(Ee.restore=document.body.style.overflow,document.body.style.overflow="hidden"),Ee.locks+=1,()=>{Ee.locks-=1,Ee.locks===0&&(document.body.style.overflow=Ee.restore??"",Ee.restore=null)}},[e])}var Ra=j(ht(),1),cl=j(be(),1),ul=(0,Ra.forwardRef)(function({label:t,icon:a,size:n="md",variant:l="ghost",pressed:r,disabledReason:i,className:o,type:s="button",asChild:c=!1,disabled:d,onClick:v,title:u,children:m,...b},y){let S=(0,Ra.useId)(),h=k("crewlet-icon-btn",`crewlet-icon-btn--${n}`,`crewlet-icon-btn--${l}`,o),f=a??m;if(c){let w=Ra.Children.only(m);if(!(0,Ra.isValidElement)(w))throw new Error("IconButton with asChild expects exactly one valid React element child.");let T=w;return(0,Ra.cloneElement)(T,{...b,"aria-label":t,title:u??t,className:k(T.props.className,h)})}let p=i!==void 0;return(0,cl.jsxs)(cl.Fragment,{children:[(0,cl.jsx)("button",{...b,ref:y,type:s,className:h,disabled:d,title:u??t,"aria-label":t,"aria-pressed":r,"aria-disabled":p||void 0,"aria-describedby":p?k(b["aria-describedby"],S):b["aria-describedby"],onClick:w=>{if(p){w.preventDefault();return}v?.(w)},children:f}),p?(0,cl.jsx)(Ht,{id:S,children:i}):null]})}),XS=(0,Ra.forwardRef)(function({label:t,href:a,icon:n,size:l="md",variant:r="ghost",current:i=!1,className:o,title:s,...c},d){return(0,cl.jsx)("a",{...c,ref:d,href:a,className:k("crewlet-icon-btn",`crewlet-icon-btn--${l}`,`crewlet-icon-btn--${r}`,i&&"crewlet-icon-btn--current",o),title:s??t,"aria-label":t,"aria-current":i?"page":void 0,children:n})});var Ha=j(ht(),1),Kw=j(nr(),1);var fe=j(be(),1);function Iw({open:e,...t}){let a=sl();return e&&a?(0,fe.jsx)(g5,{container:a,...t},p5(a)):null}var jw=new WeakMap,bp=0;function p5(e){let t=jw.get(e);return t!==void 0?t:(bp+=1,jw.set(e,bp),bp)}function yt(e){return e!=null&&e!==!1&&e!==""}function g5({container:e,onClose:t,title:a,subtitle:n,icon:l,footer:r,footerStart:i,headerActions:o,onBack:s,backLabel:c="Back",children:d,size:v="sm",variant:u="dialog",shape:m="framed",placement:b,phoneSheet:y=!1,role:S="dialog",dismissable:h=!0,closeOnBackdrop:f=!0,backdrop:p="veil",showCloseButton:w=!0,stackBody:T=!1,flush:C=!1,className:N,ariaLabel:O,describedBy:I,initialFocus:R,onSubmit:te,closeLabel:Se="Close",closeDisabledReason:me="Closing is unavailable until this finishes.",...q}){let H=(0,Ha.useId)(),Ve=`${H}-title`,z=`${H}-subtitle`,Y=m==="prompt"&&u==="dialog",P=!Y,Ze=u==="sheet",et=b??(Y?"center":"top"),Dt=y&&u==="dialog"&&!Y,st=(0,Ha.useRef)(null),G=(0,Ha.useRef)(null),se=(0,Ha.useRef)(null),ct=(0,Ha.useRef)(R);ct.current=R;let A=(0,Ha.useCallback)(()=>{let He=ct.current?.();if(He)return He;let at=G.current?Xl(G.current)[0]:void 0;return at||((se.current?Xl(se.current)[0]:void 0)??st.current)},[]),oe=Vw({onClose:t,dismissable:h,initialFocus:A});Yw(!0);let Je=yt(a)?Ve:void 0,L=I??(yt(n)?z:void 0),X={...q,ref:He=>{st.current=He,oe.panelRef(He)},className:k("crewlet-modal",`crewlet-modal--${u}`,u==="dialog"?`crewlet-modal--${v}`:void 0,Y?"crewlet-modal--prompt":void 0,N),role:S,"aria-modal":!0,"aria-labelledby":Je,"aria-label":Je===void 0?O:void 0,"aria-describedby":L,tabIndex:-1},Oe=P&&w,tt=(0,fe.jsxs)(fe.Fragment,{children:[P&&(yt(a)||yt(n)||yt(o)||Oe||s)?(0,fe.jsxs)("div",{className:k("crewlet-modal__header",Ze?"crewlet-modal__header--sheet":yt(n)?"crewlet-modal__header--subtitled":void 0),children:[s?(0,fe.jsx)(ul,{className:"crewlet-modal__back",label:c,icon:(0,fe.jsx)(ip,{size:"md"}),onClick:s}):null,yt(l)?(0,fe.jsx)("span",{className:"crewlet-modal__icon","aria-hidden":"true",children:l}):null,(0,fe.jsxs)("div",{className:"crewlet-modal__heading",children:[yt(a)?(0,fe.jsx)("h1",{className:k("crewlet-modal__title",Ze?"crewlet-modal__title--sheet":void 0),id:Ve,children:a}):null,yt(n)?(0,fe.jsx)("p",{className:"crewlet-modal__subtitle",id:z,children:n}):null]}),yt(o)?(0,fe.jsx)("div",{className:"crewlet-modal__actions",children:o}):null,Oe?(0,fe.jsx)(ul,{className:"crewlet-modal__close",label:Se,icon:(0,fe.jsx)(Do,{size:"md"}),onClick:t,disabledReason:h?void 0:me}):null]}):null,yt(d)||Y&&yt(a)?(0,fe.jsxs)("div",{ref:G,className:k("crewlet-modal__body",T?"crewlet-modal__body--stacked":void 0,C?"crewlet-modal__body--flush":void 0,Ze?"crewlet-modal__body--sheet":void 0),children:[Y&&yt(a)?(0,fe.jsx)("p",{className:"crewlet-modal__prompt-title",id:Ve,children:a}):null,(0,fe.jsx)(dw,{level:2,children:d})]}):null,yt(r)||yt(i)?(0,fe.jsxs)("div",{ref:se,className:k("crewlet-modal__footer",Ze?"crewlet-modal__footer--sheet":void 0),children:[yt(i)?(0,fe.jsx)("div",{className:"crewlet-modal__footer-start",children:i}):null,(0,fe.jsx)("div",{className:"crewlet-modal__footer-end",children:r})]}):null]});return(0,Kw.createPortal)((0,fe.jsx)("div",{ref:f?oe.veilRef:void 0,className:k("crewlet-modal-overlay",`crewlet-modal-overlay--${u}`,`crewlet-modal-overlay--${et}`,Dt&&"crewlet-modal-overlay--phone-sheet",p==="clear"&&"crewlet-modal-overlay--clear",e===document.body?"crewlet-modal-overlay--fixed":"crewlet-modal-overlay--in-host"),role:"presentation",style:{zIndex:oe.zIndex},children:(0,fe.jsx)("div",{...X,children:te?(0,fe.jsx)("form",{className:"crewlet-modal__form",onSubmit:He=>{He.preventDefault(),te()},children:tt}):tt})}),e)}function xp({open:e,onClose:t,onConfirm:a,title:n,message:l,children:r,confirmLabel:i="Confirm",cancelLabel:o="Cancel",destructive:s=!1,confirmVariant:c,cancelVariant:d="ghost",confirmDisabled:v=!1,confirmDisabledReason:u="Complete the confirmation above to continue.",submitting:m=!1,busyReason:b="Waiting for this to finish.",shape:y="prompt",size:S="sm"}){let h=`${(0,Ha.useId)()}-message`,f=c??(s?"danger":"primary"),p=v||m,w=(0,Ha.useCallback)(()=>{p||(async()=>{try{await a()}catch{}})()},[p,a]);return(0,fe.jsxs)(Iw,{open:e,onClose:t,title:n,shape:y,size:S,role:s?"alertdialog":"dialog",describedBy:yt(l)?h:void 0,dismissable:!m,closeDisabledReason:b,onSubmit:w,stackBody:!0,footer:(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(ka,{variant:d,onClick:t,disabledReason:m?b:void 0,children:o}),(0,fe.jsx)(ka,{type:"submit",variant:f,loading:m,disabledReason:v?u:void 0,children:i})]}),children:[yt(l)?(0,fe.jsx)("p",{className:"crewlet-modal__message",id:h,children:l}):null,r]})}var m5=j(be(),1);function dl(e){return`crewlet-presence-hue--${e}`}var hu=j(ht(),1);var su=j(be(),1),Ap={paths:["M543.42 868.92 l-34.44 -0.24 0 -58.77 0 -58.77 -28.92 0 -28.80 0 -40.20 -39.61 c-119.78 -118.25 -181.49 -179.97 -204.30 -204.30 -15.87 -16.93 -82.75 -96.74 -92.51 -110.38 l-3.76 -5.17 26.80 -18.46 c14.69 -10.11 34.09 -23.51 43.14 -29.86 55.25 -38.32 70.29 -48.43 71.12 -47.49 0.47 0.47 11.64 13.87 24.69 29.74 13.17 15.87 27.98 33.62 32.80 39.50 4.94 5.88 21.63 26.10 37.15 44.90 15.52 18.81 28.56 34.21 29.15 34.21 0.47 0.12 0.82 -30.44 0.82 -67.83 l0 -68.06 37.26 -34.56 c43.38 -40.20 61.83 -57.13 75.11 -69 l9.52 -8.46 261.78 0 261.90 0 47.14 45.73 c25.98 25.16 52.43 51.02 58.66 57.36 l11.52 11.52 0.24 67.94 0.35 67.83 31.74 -40.79 c17.51 -22.33 34.91 -45.02 38.91 -50.19 15.16 -20.34 44.32 -57.72 45.14 -58.07 0.71 -0.24 104.97 75.82 126.83 92.51 2.23 1.65 4.58 3.41 5.17 3.76 1.65 1.18 -7.99 14.22 -46.08 62.07 -35.38 44.32 -49.84 61.13 -92.39 106.97 -19.28 20.81 -38.91 41.73 -148.70 157.40 l-34.68 36.56 -26.45 0.12 c-19.04 0 -26.92 0.35 -27.98 1.41 -1.06 1.06 -1.41 15.05 -1.41 55.72 l0 54.31 -34.91 0.47 c-19.28 0.24 -53.72 0.24 -76.41 0 l-41.49 -0.47 0 -55.72 0 -55.72 -99.33 0 -99.33 0 -0.24 56.19 -0.35 56.07 -39.97 0 c-21.98 0 -55.48 -0.12 -74.29 -0.35z m94.74 -13.87 l7.17 -0.82 0 -54.89 c0 -49.02 0.24 -55.13 1.88 -55.72 1.06 -0.35 51.84 -0.71 112.85 -0.71 l110.97 0 0 55.84 0 55.84 62.89 0 62.89 0 0 -55.84 0 -55.84 31.50 0 31.50 0 14.69 -14.93 c30.80 -31.50 113.20 -118.49 144.47 -152.58 48.66 -53.01 81.34 -90.28 104.85 -119.43 22.80 -28.45 44.43 -56.42 44.43 -57.48 0 -0.59 -2 -2.47 -4.35 -4.23 -2.47 -1.76 -7.05 -5.17 -10.34 -7.64 -3.17 -2.35 -16.93 -12.34 -30.56 -22.22 -13.52 -9.87 -33.50 -24.57 -44.43 -32.68 -16.34 -12.11 -19.98 -14.34 -21.39 -13.17 -0.94 0.82 -5.88 6.82 -10.81 13.40 -4.94 6.47 -13.99 18.46 -20.10 26.57 -6.23 8.11 -26.57 34.44 -45.37 58.54 -18.81 24.10 -36.56 47.02 -39.50 50.78 -5.29 7.05 -5.29 7.05 -11.40 7.05 l-6.23 0 0 -79.58 0 -79.58 -37.85 -37.03 c-20.92 -20.45 -45.14 -44.08 -53.95 -52.66 l-15.99 -15.63 -256.84 0 -256.73 0 -47.49 44.20 c-26.21 24.33 -51.13 47.49 -55.60 51.37 l-7.88 7.05 0 79.11 0 79.23 -6.35 0 -6.35 0 -48.66 -58.54 c-26.80 -32.09 -55.95 -67.24 -64.89 -78.17 -8.93 -10.81 -16.69 -19.63 -17.16 -19.63 -0.94 0 -8.58 5.17 -34.32 22.92 -34.21 23.74 -46.08 31.86 -62.65 43.26 -10.34 7.05 -19.28 13.28 -19.87 13.87 -0.59 0.47 2.35 5.05 6.47 10.11 13.87 16.93 53.13 63.12 66.77 78.40 21.86 24.57 83.81 87.69 145.41 148.23 31.62 31.03 68.65 67.36 82.28 80.76 l24.69 24.45 33.50 0.24 33.38 0.35 0.35 59.13 0.24 59.01 53.37 0 c29.27 0 56.54 -0.35 60.54 -0.71z","M535.78 783.81 l-0.35 -59.13 -36.67 0 -36.67 0 -6.82 -6.47 c-48.78 -46.43 -176.91 -173.03 -210.41 -207.82 -24.69 -25.74 -75.70 -81.70 -93.69 -102.85 -3.29 -3.88 -5.29 -7.17 -4.70 -7.76 1.29 -1.06 58.30 -40.32 82.05 -56.42 l16.34 -11.05 3.64 4.47 c11.05 13.87 76.99 92.51 98.98 118.14 l25.74 29.97 15.63 0.35 15.52 0.35 0 -82.87 0 -82.75 50.55 -46.67 c27.86 -25.74 50.55 -47.14 50.55 -47.72 0 -0.59 46.78 -1.06 111.55 -1.06 l111.55 0 15.52 14.81 c15.28 14.58 15.52 14.69 17.98 12.58 1.29 -1.18 8.46 -7.76 15.75 -14.58 l13.40 -12.46 17.75 -0.71 c9.76 -0.47 58.77 -0.82 108.85 -0.82 l90.98 0 14.34 13.75 c7.76 7.64 24.57 23.86 37.15 36.20 12.58 12.34 29.15 28.45 36.67 35.85 l13.87 13.40 0.24 82.87 0.35 82.99 14.22 0.35 14.34 0.35 4.47 -5.64 c2.47 -3.06 11.52 -14.11 19.98 -24.45 8.46 -10.34 30.56 -38.32 49.14 -62.30 43.85 -56.42 46.20 -59.36 48.43 -59.36 2.12 0 4.82 1.88 47.96 33.27 43.02 31.27 45.37 33.03 45.37 34.09 0 0.82 -39.03 46.20 -62.42 72.53 -62.42 70.29 -106.50 117.67 -184.08 197.60 l-50.78 52.43 -13.28 0.71 c-7.29 0.47 -23.98 0.82 -37.03 0.82 l-23.86 0 0 57.01 0 57.01 -49.37 0 -49.37 0 0 -56.42 0 -56.42 -114.37 0 c-63.01 0 -120.13 0.35 -126.95 0.82 l-12.58 0.71 0 55.72 0 55.60 -47.61 0 -47.61 0 -0.24 -59.01z m443.16 -373.22 l-0.35 -119.66 -223.93 0.12 -223.93 0.12 -0.35 119.43 -0.24 119.55 224.52 0 224.52 0 -0.24 -119.55z","M546.36 516.39 c-0.24 -0.59 -0.47 -4.94 -0.35 -9.76 0 -4.82 0.12 -52.54 0.35 -106.15 l0.24 -97.21 209.59 0.24 209.47 0.35 0.35 106.73 0.24 106.62 -209.71 0 c-115.43 0 -209.94 -0.35 -210.18 -0.82z m121.07 -100.50 l-0.35 -66.18 -34.32 -0.35 -34.44 -0.24 0 66.41 0 66.41 34.68 0 34.68 0 -0.24 -66.06z m260.96 0 l-0.35 -66.18 -34.09 0 -34.09 0 0 10.93 c0 5.88 0.12 35.62 0.35 66.06 l0.24 55.25 34.09 0 34.09 0 -0.24 -66.06z"],box:{left:110.48999999999992,top:196.30999999999992,right:1389.0800000000002,bottom:869.2899999999998},centroid:{x:755.6746766446299,y:497.3295661269271}},uu=e=>e.reduce((t,a,n)=>{let l=e[(n+1)%e.length];return t+a[0]*l[1]-l[0]*a[1]},0);function Xw(e,t,a){for(let n of e)n.forEach((l,r)=>{let i=n[(r+1)%n.length];l[1]!==i[1]&&a.push(l[1]<i[1]?{x0:l[0],y0:l[1],x1:i[0],y1:i[1],wind:1,add:t}:{x0:i[0],y0:i[1],x1:l[0],y1:l[1],wind:-1,add:t})})}var hi=(e,t)=>t===e.y0?e.x0:t===e.y1?e.x1:e.x0+(t-e.y0)*(e.x1-e.x0)/(e.y1-e.y0);function v5(e){let t=new Set;for(let a of e)t.add(a.y0),t.add(a.y1);for(let a=0;a<e.length;a+=1){let n=e[a];for(let l=a+1;l<e.length&&e[l].y0<n.y1;l+=1){let r=e[l],i=Math.max(n.y0,r.y0),o=Math.min(n.y1,r.y1);if(o<=i)continue;let s=hi(n,i)-hi(r,i),c=hi(n,o)-hi(r,o);s*c<0&&t.add(i+(o-i)*s/(s-c))}}return[...t].sort((a,n)=>a-n)}var w5=1e-9;function y5(){let e=new Map;return(t,a)=>{let n=e.get(t);n||e.set(t,n=[]);for(let l of n)if(Math.abs(l-a)<=w5)return l;return n.push(a),a}}function b5(e,t,a,n){let l=e.map(d=>({e:d,a:n(t,hi(d,t)),b:n(a,hi(d,a))})).sort((d,v)=>d.a+d.b-(v.a+v.b)),r=[],i=0,o=0,s=!1,c=[0,0];for(let d=0;d<l.length;){let{a:v,b:u}=l[d];for(;d<l.length&&l[d].a===v&&l[d].b===u;d+=1){let{e:b}=l[d];b.add?i+=b.wind:o+=b.wind}let m=i!==0&&o===0;m&&!s?c=[v,u]:!m&&s&&r.push({left:c,right:[v,u]}),s=m}return r}function Qw(e,t){let a=[],n=0;for(let[l,r]of e){let i=l;for(;n<t.length&&t[n][1]<=i;)n+=1;for(let o=n;o<t.length&&t[o][0]<r&&i<r;o+=1){let[s,c]=t[o];s>i&&a.push([i,s]),i=Math.max(i,c)}i<r&&a.push([i,r])}return a}function x5(e,t){let a=[];return t.forEach((n,l)=>{let r=e[l],i=e[l+1];for(let{left:o,right:s}of n)a.push([[s[0],r],[s[1],i]]),a.push([[o[1],i],[o[0],r]])}),e.forEach((n,l)=>{let r=l>0?t[l-1].map(({left:o,right:s})=>[o[1],s[1]]):[],i=l<t.length?t[l].map(({left:o,right:s})=>[o[0],s[0]]):[];for(let[o,s]of Qw(i,r))a.push([[o,n],[s,n]]);for(let[o,s]of Qw(r,i))a.push([[s,n],[o,n]])}),a.filter(([n,l])=>n[0]!==l[0]||n[1]!==l[1])}var Mp=1e-9;function _5(e){let t=[...e],a=!0;for(;a&&t.length>=3;){a=!1;let n=[];for(let l=0;l<t.length;l+=1){let r=n.length>0?n[n.length-1]:t[t.length-1],i=t[l],o=t[(l+1)%t.length],s=i[0]-r[0],c=i[1]-r[1],d=o[0]-i[0],v=o[1]-i[1],u=Math.hypot(s,c)<Mp,m=Math.abs(s*v-c*d)<Mp;if(u||m){a=!0;continue}n.push(i)}t=n}return t}function T5(e){let t=r=>`${r[0]} ${r[1]}`,a=new Map;e.forEach(([r],i)=>{let o=a.get(t(r));o?o.push(i):a.set(t(r),[i])});let n=new Uint8Array(e.length),l=[];return e.forEach((r,i)=>{if(n[i])return;let o=[],s=i;for(;s!==void 0;){n[s]=1;let[c,d]=e[s];if(o.push(c),d[0]===r[0][0]&&d[1]===r[0][1])break;s=a.get(t(d))?.find(v=>!n[v])}l.push(o)}),l.map(_5).filter(r=>r.length>=3&&Math.abs(uu(r))>Mp)}function Np(e,t=[]){let a=[];Xw(e,!0,a),Xw(t,!1,a),a.sort((s,c)=>s.y0-c.y0);let n=v5(a),l=y5(),r=[],i=0,o=[];for(let s=0;s+1<n.length;s+=1){let c=n[s],d=n[s+1];for(;i<a.length&&a[i].y0<=c;)o.push(a[i++]);o=o.filter(v=>v.y1>c),r.push(b5(o,c,d,l))}return T5(x5(n,r))}var E5=e=>e.reduce((t,a)=>t+uu(a),0)/2;function S5(e){let t=0,a=0;for(let l of e)l.forEach((r,i)=>{let o=l[(i+1)%l.length],s=r[0]*o[1]-o[0]*r[1];t+=(r[0]+o[0])*s,a+=(r[1]+o[1])*s});let n=6*E5(e);return[t/n,a/n]}var _p=e=>uu(e)<0?e.reverse():e;function ty(e,t,a=4){let n=[];for(let l of e)l.forEach((r,i)=>{let o=l[(i+1)%l.length],s=l[(i+2)%l.length],c=Math.hypot(o[0]-r[0],o[1]-r[1]),d=(o[1]-r[1])/c,v=-(o[0]-r[0])/c,u=Math.hypot(s[0]-o[0],s[1]-o[1]),m=(s[1]-o[1])/u,b=-(s[0]-o[0])/u,y=t;n.push(_p([[r[0]+d*y,r[1]+v*y],[o[0]+d*y,o[1]+v*y],[o[0]-d*y,o[1]-v*y],[r[0]-d*y,r[1]-v*y]]));let S=(o[0]-r[0])*(s[1]-o[1])-(o[1]-r[1])*(s[0]-o[0]);if(S===0)return;let h=S>0?1:-1,f=[o[0]+h*d*y,o[1]+h*v*y],p=[o[0]+h*m*y,o[1]+h*b*y],w=d+m,T=v+b,C=w*w+T*T;if(C>0&&2/Math.sqrt(C)<=a){let N=[o[0]+h*w*2*y/C,o[1]+h*T*2*y/C];n.push(_p([o,f,N,p]))}else n.push(_p([o,f,p]))});return n}var Zw=e=>Math.round(e*100)/100;function Jw(e){return e.map(t=>`M${t.map(([n,l])=>`${Zw(n)} ${Zw(l)}`).filter((n,l,r)=>n!==r[l-1]).join("L")}Z`).join("")}var ay=["crewlet","hexlet","peaklet","prismlet","towerlet","bricklet","gemlet","coglet","pluslet","shieldlet","stacklet","sparklet","cloudlet","foxlet","rocketlet","crownlet","cactlet","wisplet","heartlet","flasklet","chiplet","duolet","chatlet","pagelet","archlet","dashlet","octlet","conelet","hivelet","folderlet"],Uo=e=>typeof e=="string"&&ay.includes(e),cu=96,A5=1.35,ny=.9,Lo=1.3,M5=2,Tp={full:{width:.164,height:.62},compact:{width:.19,height:.68},offset:.312},Ep={half:3.2,depth:2.6},Fw=e=>Math.round(e*100)/100;function $w(e,t){let a=[];return e.forEach((n,l)=>{let r=typeof t=="number"?t:t[l]??0;if(!r){a.push(n);return}let i=o=>{let s=o[0]-n[0],c=o[1]-n[1],d=Math.min(r/Math.hypot(s,c),.45);return[n[0]+s*d,n[1]+c*d]};a.push(i(e[(l-1+e.length)%e.length]),i(e[(l+1)%e.length]))}),a}var Ww=e=>`M${e.map(([t,a])=>`${Fw(t)} ${Fw(a)}`).join("L")}Z`;function Le(e,t=0){let a=typeof t=="number"?e.map(()=>t):t;return uu(e)<0?$w([...e].reverse(),[...a].reverse()):$w(e,a)}var pe=(e,t,a,n,l=0)=>Le([[e,t],[e+a,t],[e+a,t+n],[e,t+n]],l),Ge=(e,t,a,n=10)=>[pe(e,a,n,cu-a),pe(t,a,n,cu-a)];function N5(e,t,a,n,l){let r=[];for(let i=0;i<l;i+=1){let o=(i*360/l-90)*(Math.PI/180);for(let[s,c]of[[n,-15],[a,-8.5],[a,8.5],[n,15]]){let d=o+c*(Math.PI/180);r.push([e+s*Math.cos(d),t+s*Math.sin(d)])}}return Le(r)}function O5(e){let t=e.flat(),a=t.map(([i])=>i),n=t.map(([,i])=>i),l=Math.min(...a),r=Math.min(...n);return{x:l,y:r,width:Math.max(...a)-l,height:Math.max(...n)-r}}var z5=([e,t,a,n])=>({x:e,y:t,width:a,height:n}),ly=new WeakMap;function xe(e){let t=e.holes??[],a,n={kind:"drawn",name:e.name,shape:e.shape,shapes:e.shapes.map(Ww),holes:t.map(Ww),visor:z5(e.visor),notch:e.notch===void 0?null:[e.notchX??50,e.notch],get bounds(){return a??(a=O5([...Cp(n),...ry(n)]))}};return ly.set(n,{parts:e.shapes,holes:t}),n}var du=e=>ly.get(e);function Cp(e){let t=du(e);return t.silhouette??(t.silhouette=Np(t.parts))}function ry(e){let t=du(e);return t.reach??(t.reach=ty(Cp(e),ny+A5))}var Op=.095,iy=760,oy=869,zp=(e,t)=>[50+(e-iy)*Op,cu+(t-oy)*Op],C5=zp(Ap.centroid.x,Ap.centroid.y);function k5(){let{paths:e,box:t}=Ap,[a,n]=zp(t.left,t.top),[l,r]=zp(t.right,t.bottom);return{kind:"mark",name:"Crewlet",shape:"The original mark, arms raised",transform:`translate(50 ${cu}) scale(${Op}) translate(${-iy} ${-oy})`,keyline:e[0],body:[e[1],e[2]],bounds:{x:a,y:n,width:l-a,height:r-n}}}var kp={crewlet:k5(),hexlet:xe({name:"Hexlet",shape:"Hexagon with pointed flanks",shapes:[Le([[30,22],[70,22],[86,54],[70,86],[30,86],[14,54]],[5,5,4,4,4,4]),...Ge(34,56,84)],visor:[28,38,44,20],notch:22}),peaklet:xe({name:"Peaklet",shape:"Pentagon with a peaked roof",shapes:[Le([[50,12],[82,36],[82,86],[18,86],[18,36]],[6,5,4,4,5]),...Ge(28,62,84)],visor:[26,44,48,20]}),prismlet:xe({name:"Prismlet",shape:"Triangle with cut tips",shapes:[Le([[50,10],[90,86],[10,86]],[9,8,8]),...Ge(28,62,84)],visor:[31,54,38,18]}),towerlet:xe({name:"Towerlet",shape:"Tall pillar, narrow stance",shapes:[pe(32,12,36,74,[8,8,4,4]),...Ge(35,55,84)],visor:[36,24,28,16],notch:12}),bricklet:xe({name:"Bricklet",shape:"Wide, low slab",shapes:[pe(10,42,80,44,[9,9,6,6]),...Ge(22,68,84)],visor:[21,50,58,19],notch:42}),gemlet:xe({name:"Gemlet",shape:"Diamond on its point",shapes:[Le([[50,6],[90,48],[50,90],[10,48]],[7,7,16,7]),...Ge(40,52,76,8)],visor:[27,38,46,20]}),coglet:xe({name:"Coglet",shape:"Eight-tooth gear",shapes:[N5(50,52,37,31,8),...Ge(36,54,78)],visor:[30,40,40,18]}),pluslet:xe({name:"Pluslet",shape:"Cross with squared arms",shapes:[pe(34,14,32,72,[7,7,0,0]),pe(10,34,80,30,7),...Ge(37,53,84)],visor:[20,40,60,18],notch:14}),shieldlet:xe({name:"Shieldlet",shape:"Flat crown, pointed base",shapes:[Le([[16,16],[84,16],[84,54],[50,92],[16,54]],[9,9,5,14,5]),...Ge(41,51,79,8)],visor:[26,28,48,20],notch:16}),stacklet:xe({name:"Stacklet",shape:"Stepped crown, square base",shapes:[Le([[34,12],[66,12],[66,26],[82,26],[82,86],[18,86],[18,26],[34,26]],[4,4,0,5,4,4,5,0]),...Ge(28,62,84)],visor:[26,40,48,20],notch:12}),sparklet:xe({name:"Sparklet",shape:"Faceted drop",shapes:[Le([[50,8],[80,48],[78,74],[64,86],[36,86],[22,74],[20,48]],[6,4,2,2,2,2,4]),...Ge(36,54,84)],visor:[30,48,40,18]}),cloudlet:xe({name:"Cloudlet",shape:"Three-lobed cloud",shapes:[pe(14,44,72,42,[0,0,8,8]),pe(16,30,32,32,9),pe(33,18,34,34,10),pe(56,32,30,30,9),...Ge(30,60,84)],visor:[24,48,52,18],notch:18}),foxlet:xe({name:"Foxlet",shape:"Square body, pointed ears",shapes:[pe(18,34,64,52,6),Le([[20,36],[26,12],[44,36]],[0,4,0]),Le([[56,36],[74,12],[80,36]],[0,4,0]),...Ge(28,62,84)],visor:[26,46,48,20]}),rocketlet:xe({name:"Rocketlet",shape:"Nose cone and swept fins",shapes:[Le([[50,6],[66,26],[66,80],[34,80],[34,26]],[5,3,3,3,3]),Le([[34,54],[34,80],[18,90],[18,70]],[0,0,3,3]),Le([[66,54],[82,70],[82,90],[66,80]],[0,3,3,0]),...Ge(37,55,80,8)],visor:[37,32,26,16]}),crownlet:xe({name:"Crownlet",shape:"Three-point crown",shapes:[pe(18,40,64,46,[0,0,6,6]),Le([[18,44],[18,18],[34,32],[50,12],[66,32],[82,18],[82,44]],[0,3,0,3,0,3,0]),...Ge(28,62,84)],visor:[27,48,46,20]}),cactlet:xe({name:"Cactlet",shape:"Trunk with two raised arms",shapes:[pe(32,12,36,74,[10,10,0,0]),pe(16,50,18,9,[0,0,0,3]),pe(16,28,9,31,[4.5,4.5,0,3]),pe(66,58,18,9,[0,0,3,0]),pe(75,38,9,29,[4.5,4.5,3,0]),...Ge(36,54,84)],visor:[37,26,26,16],notch:12}),wisplet:xe({name:"Wisplet",shape:"Tall ghost with a zigzag hem",shapes:[Le([[16,10],[84,10],[84,92],[72.5,82],[61,92],[50,82],[39,92],[27.5,82],[16,92]],[14,14,2,0,2,0,2,0,2])],visor:[26,28,48,20],notch:10}),heartlet:xe({name:"Heartlet",shape:"Faceted heart",shapes:[Le([[50,26],[62,14],[78,14],[90,26],[90,44],[50,84],[10,44],[10,26],[22,14],[38,14]],[0,3,3,3,4,6,4,3,3,3]),...Ge(41,51,74,8)],visor:[23,30,54,18]}),flasklet:xe({name:"Flasklet",shape:"Lab flask with a narrow neck",shapes:[pe(35,6,30,7,2),pe(40,10,20,22),Le([[40,28],[60,28],[86,80],[86,86],[14,86],[14,80]],[0,0,6,3,3,6]),...Ge(26,64,84)],visor:[33,54,34,14],notch:6}),chiplet:xe({name:"Chiplet",shape:"Square chip with pins",shapes:[pe(24,20,52,60,6),...[31,47,63].map(e=>pe(e,11,6,10)),...[32,47,62].map(e=>pe(15,e,10,6)),...[32,47,62].map(e=>pe(75,e,10,6)),...[31,47,63].map(e=>pe(e,78,6,18))],holes:[pe(29,70,5,5)],visor:[31,34,38,18]}),duolet:xe({name:"Duolet",shape:"Small head on a wide body",shapes:[pe(30,10,40,34,8),pe(18,40,64,46,6),...Ge(28,62,84)],visor:[36,19,28,15],notch:10}),chatlet:xe({name:"Chatlet",shape:"Speech bubble with a tail",shapes:[pe(14,22,72,54,8),Le([[26,72],[46,72],[22,94]],[0,0,2])],visor:[24,34,52,22],notch:22}),pagelet:xe({name:"Pagelet",shape:"Page with a folded corner",shapes:[Le([[20,10],[64,10],[80,26],[80,86],[20,86]],[4,0,0,4,4]),...Ge(28,62,84)],holes:[pe(63.3,10,1.4,17.4),pe(63.3,25.3,17,1.4)],visor:[27,36,46,20],notch:10}),archlet:xe({name:"Archlet",shape:"Gate with built-in legs",shapes:[Le([[16,18],[84,18],[84,96],[64,96],[64,74],[36,74],[36,96],[16,96]],[8,8,0,0,4,4,0,0])],visor:[25,30,50,22],notch:18}),dashlet:xe({name:"Dashlet",shape:"Body leaning forward",shapes:[Le([[29,14],[87,14],[71,86],[13,86]],6),...Ge(20,48,84)],visor:[31.5,28,42,20],notch:14,notchX:58}),octlet:xe({name:"Octlet",shape:"Regular octagon",shapes:[pe(16,16,68,68,20),...Ge(35,55,81)],visor:[26,36,48,22],notch:16}),conelet:xe({name:"Conelet",shape:"Narrow crown, wide base",shapes:[Le([[30,12],[70,12],[88,84],[12,84]],[6,6,5,5]),...Ge(26,64,82)],visor:[28,40,44,20],notch:12}),hivelet:xe({name:"Hivelet",shape:"Upright honeycomb cell",shapes:[Le([[50,6],[84,24],[84,72],[50,90],[16,72],[16,24]],[6,4,4,6,4,4]),...Ge(40,52,80,8)],visor:[25,36,50,20]}),folderlet:xe({name:"Folderlet",shape:"Folder with a tab",shapes:[Le([[12,14],[38,14],[50,26],[88,26],[88,84],[12,84]],[4,0,0,6,5,5]),...Ge(26,64,82)],visor:[24,40,52,22]})},Pw=.5,Sp=(e,t,a,n)=>[[e,t],[e+a,t],[e+a,t+n],[e,t+n]];function R5(e){let t=1/0;return e.forEach((a,n)=>{let l=e[(n+1)%e.length],r=Math.hypot(l[0]-a[0],l[1]-a[1]);if(r===0)return;let i=Math.max(...e.map(o=>Math.abs((l[0]-a[0])*(o[1]-a[1])-(l[1]-a[1])*(o[0]-a[0]))/r));t=Math.min(t,i)}),t}function H5(e,t){let{visor:a,notch:n}=e,l=t==="full",r=l?Tp.full:Tp.compact,i=a.width*r.width,o=a.height*r.height,s=a.y+(a.height-o)/2,c=a.x+a.width/2,d=a.width*Tp.offset,v=[c-d,c+d].map(u=>Sp(u-i/2,s,i,o));n&&v.push([[n[0]-Ep.half,n[1]-1],[n[0]+Ep.half,n[1]-1],[n[0],n[1]+Ep.depth]]);for(let u of du(e).holes)(l||R5(u)>M5)&&v.push(u);if(l){let u=Lo/2;v.push(Sp(a.x-u,a.y-u,a.width+Lo,a.height+Lo)),v.push([...Sp(a.x+u,a.y+u,a.width-Lo,a.height-Lo)].reverse())}return v}function sy(e,t){let a=e.x+e.width/2,n=e.y+e.height/2,l=a+Pw*(t[0]-a),r=n+Pw*(t[1]-n),i=Math.max(e.width+2*Math.abs(l-a),e.height+2*Math.abs(r-n));return{x:l-i/2,y:r-i/2,width:i,height:i}}function D5(e){let{parts:t}=du(e),a=Cp(e),n={},l=i=>Jw(Np(t,H5(e,i))),r=()=>Jw(Np([...a,...ry(e)],[...a,...ty(a,ny)]));return{frame:sy(e.bounds,S5(a)),paths:i=>n[i]??(n[i]=i==="full"?[r(),l("full")]:[l("compact")])}}var ey=new Map;function G5(e){let t=ey.get(e);if(t)return t;let a=kp[e];if(a.kind==="mark"){let n=[a.keyline,...a.body];t={frame:sy(a.bounds,C5),paths:l=>l==="full"?n:a.body}}else t=D5(a);return ey.set(e,t),t}var L5=e=>Math.round(e*100)/100,U5=({character:e,detail:t="full",...a})=>{let n=kp[e],{frame:l,paths:r}=G5(e),i=r(t).map(o=>(0,su.jsx)("path",{d:o},o));return(0,su.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:[l.x,l.y,l.width,l.height].map(L5).join(" "),width:"1em",height:"1em","aria-hidden":"true",focusable:"false","data-character":e,"data-detail":t,...a,children:(0,su.jsx)("g",{fill:"currentColor",transform:n.kind==="mark"?n.transform:void 0,children:i})})},Rp=U5;var Nt=j(be(),1);var B5={working:"working",needs:"needs you",stopped:"stopped"},Hp={xs:20,sm:26,md:32,lg:40};var q5=/^agent(?:[\s._-]+)(?=\S)/i;function V5(e,t){if(e===void 0||t!=="agent")return e;let a=e.replace(q5,"");return a.trim()?a:e}var Y5=56,j5=e=>{if(!e)return"?";let t=e.trim().split(/[\s\-_.:]+/).map(r=>r.replace(/^\p{P}+|\p{P}+$/gu,"")).filter(Boolean);if(t.length===0)return"?";let a=r=>(Array.from(r)[0]??"").toUpperCase();if(t.length>=2)return t.slice(0,2).map(a).join("")||"?";let n=t[0],l=n.split(/(?<=\p{Ll})(?=\p{Lu})/u);return l.length>=2?l.slice(0,2).map(a).join(""):Array.from(n).slice(0,2).map(r=>r.toUpperCase()).join("")||"?"},K5=10,I5=e=>{let t=0;for(let a=0;a<e.length;a+=1)t=t*31+e.charCodeAt(a)>>>0;return t%K5};function X5(e){return typeof e=="number"?e:Hp[e]}var Bo=({src:e,name:t,size:a="md",kind:n="agent",tone:l="neutral",ring:r,status:i,mark:o,markLabel:s,decorative:c=!1,colorSeed:d,character:v,hue:u,icon:m,className:b,style:y,...S})=>{let[h,f]=(0,hu.useState)(!1);(0,hu.useEffect)(()=>{f(!1)},[e]);let p=typeof a=="number"?null:a,w=X5(a),T=p===null?{"--crewlet-avatar-size":`${w}px`,fontSize:Math.max(9,Math.round(w*.36))}:{},C=l==="seeded"?I5(d??t??""):null,N=i===void 0&&o!==void 0&&o!==null,O=i!==void 0||N,I=i!==void 0?B5[i]:N?s:void 0,R=t?`${t} avatar`:"Avatar",te=I?`${R}, ${I}`:R,Se=k("crewlet-avatar",`crewlet-avatar--${n}`,p===null?null:`crewlet-avatar--${p}`,O?"crewlet-avatar--notched":null,r===void 0||O?null:`crewlet-avatar--ring-${r}`,O?null:b),me=O?T:{...T,...y};function q(){return v!==void 0&&n==="agent"?(0,Nt.jsx)("span",{...S,className:k(Se,"crewlet-avatar--character",u===void 0?"crewlet-avatar--neutral":`crewlet-avatar--hue-${u}`),style:me,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:te,children:(0,Nt.jsx)(Rp,{className:"crewlet-avatar__character",character:v,detail:w>=Y5?"full":"compact"})}):e&&!h?(0,Nt.jsx)("img",{...S,className:k(Se,"crewlet-avatar--image"),style:me,src:e,alt:c?"":I?`${t??""}, ${I}`:t??"","aria-hidden":c?!0:void 0,onError:()=>f(!0)}):(0,Nt.jsx)("span",{...S,className:k(Se,"crewlet-avatar--fallback",`crewlet-avatar--${l}`,C===null?null:`crewlet-avatar--tint-${C}`,m==null?null:"crewlet-avatar--icon"),style:me,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:te,children:m==null?j5(V5(t,n)):(0,Nt.jsx)("span",{className:"crewlet-avatar__icon","aria-hidden":"true",children:m})})}let H=q();return O?(0,Nt.jsxs)("span",{className:k("crewlet-avatar-frame",b),style:{"--crewlet-avatar-size":`${w}px`,...y},children:[H,i!==void 0?(0,Nt.jsx)("span",{className:`crewlet-avatar__status crewlet-avatar__status--${i}`,"aria-hidden":"true",children:Q5[i]}):(0,Nt.jsx)("span",{className:"crewlet-avatar__status crewlet-avatar__status--mark","aria-hidden":"true",children:o})]}):H},Q5={working:(0,Nt.jsx)("svg",{viewBox:"0 0 14 14",focusable:"false",children:(0,Nt.jsx)("path",{d:"M5.4 3.9 10.2 7l-4.8 3.1z",fill:"currentColor"})}),needs:(0,Nt.jsxs)("svg",{viewBox:"0 0 14 14",focusable:"false",children:[(0,Nt.jsx)("path",{d:"M5.1 5.3a1.9 1.9 0 1 1 2.7 1.7c-.55.27-.8.62-.8 1.15v.3",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,Nt.jsx)("circle",{cx:"7",cy:"10.45",r:".85",fill:"currentColor"})]}),stopped:(0,Nt.jsx)("svg",{viewBox:"0 0 14 14",focusable:"false",children:(0,Nt.jsx)("rect",{x:"4.6",y:"4.6",width:"4.8",height:"4.8",rx:".7",fill:"currentColor"})})};var An=j(be(),1);function Dp({members:e,self:t=!0,max:a=4,size:n="sm",onSelect:l,label:r,labels:i,className:o}){if(!Number.isInteger(a)||a<1)throw new RangeError(`PresenceStack max must be a whole number of at least 1; it was ${a}`);let s=Co(i),c=Of(e);if(c.length===0&&!t)return null;let d=c.slice(0,a),v=c.slice(a),u=r??s.here(c.length,t),m=[u,...c.map(h=>s.member(h))].join(". "),b=h=>(0,An.jsx)(Bo,{name:h.name,kind:h.kind,src:h.src,character:h.character!==void 0&&Uo(h.character)?h.character:void 0,hue:h.kind==="agent"?h.hue:void 0,size:n,decorative:!0,className:k("crewlet-presence-stack__badge",h.hue!==void 0&&h.activity!=="idle"&&dl(h.hue),h.hue!==void 0&&h.activity!=="idle"&&"crewlet-presence-stack__badge--present",h.activity==="idle"&&"crewlet-presence-stack__badge--idle")}),y=v.length>0?(0,An.jsxs)("span",{className:"crewlet-avatar-stack__member crewlet-avatar-stack__more","aria-hidden":"true",children:["+",v.length]}):null,S={"--crewlet-avatar-stack-size":`${Hp[n]}px`};return l===void 0?c.length===0?null:(0,An.jsxs)("span",{className:k("crewlet-avatar-stack","crewlet-presence-stack",o),style:S,role:"img","aria-label":m,children:[d.map(h=>(0,An.jsx)("span",{className:k("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${h.kind}`),children:b(h)},h.id)),y]}):(0,An.jsxs)("div",{className:k("crewlet-avatar-stack","crewlet-presence-stack",o),style:S,role:"group","aria-label":u,children:[d.map(h=>(0,An.jsx)("button",{type:"button",className:k("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${h.kind}`),"aria-label":s.member(h),title:s.member(h),onClick:()=>l(h),children:b(h)},h.id)),y,v.length>0?(0,An.jsx)(Ht,{children:`${s.more(v.length)}: ${v.map(h=>s.member(h)).join(", ")}`}):null]})}var Gp=j(ht(),1),Z5=j(be(),1),cy={text:"",n:0},J5=new Set,F5=0;function $5(e){if(e!==""){if(F5===0){console.warn("[crewlet] announce() was called with no <Announcer> mounted, so nothing was said:",e);return}cy={text:e,n:cy.n+1};for(let t of[...J5])t()}}function uy(){return(0,Gp.useCallback)($5,[])}var Ta=j(ht(),1),hl=j(be(),1);function dy({label:e,max:t=6,overflow:a="expand",moreLabel:n=s=>`+${s} more`,countLabel:l=s=>`+${s}`,expandedMessage:r=s=>`Showing all ${s}.`,className:i,children:o}){let[s,c]=(0,Ta.useState)(!1),d=uy(),v=(0,Ta.useRef)(null),u=Ta.Children.toArray(o),m=a==="fit",b=W5(v,m,u.length),y=m?u.slice(0,b):s?u:u.slice(0,t),S=u.length-y.length;return(0,hl.jsxs)("ul",{ref:v,tabIndex:-1,className:k("crewlet-tag-group",m&&"crewlet-tag-group--fit",i),"aria-label":`${e}, ${u.length}`,children:[y.map((h,f)=>(0,hl.jsx)("li",{className:"crewlet-tag-group__item",children:h},f)),S>0&&m?(0,hl.jsx)("li",{className:"crewlet-tag-group__item","data-count":"",children:(0,hl.jsx)("span",{className:"crewlet-tag-group__count",children:l(S)})}):S>0?(0,hl.jsx)("li",{className:"crewlet-tag-group__item",children:(0,hl.jsx)("button",{type:"button",className:"crewlet-tag-group__more",onClick:()=>{c(!0),v.current?.focus(),d(r(u.length))},children:n(S)})}):null]})}function W5(e,t,a){let[n,l]=(0,Ta.useState)(a),r=(0,Ta.useRef)(null);return(0,Ta.useLayoutEffect)(()=>{t&&l(a)},[t,a]),(0,Ta.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;let o=[...i.children],s=o[0];if(!s)return;let c=s.offsetTop,d=c+s.offsetHeight,v=h=>h.offsetTop===c||h.offsetTop<d,u=o.filter(h=>!h.hasAttribute("data-count")),m=o.find(h=>h.hasAttribute("data-count")),b=u.filter(v).length,y=m&&!v(m)?b-1:b,S=Math.max(1,Math.min(y,u.length));S<u.length&&l(S)},[e,t,n,a]),(0,Ta.useLayoutEffect)(()=>{let i=e.current;if(!t||!i||typeof ResizeObserver!="function")return;let o=new ResizeObserver(([s])=>{let c=s?.contentRect.width??0;r.current!==null&&r.current!==c&&l(a),r.current=c});return o.observe(i),()=>o.disconnect()},[e,t,a]),t?n:a}var qo=j(be(),1);function hy({name:e,hue:t,kind:a="human",editing:n=!1,placement:l="top-end",className:r,...i}){let o=typeof e=="string"?e:e.join(", ");return(0,qo.jsxs)("span",{...i,"aria-hidden":"true",className:k("crewlet-cursor-flag",dl(t),`crewlet-cursor-flag--${a}`,`crewlet-cursor-flag--${l}`,r),children:[n?(0,qo.jsx)(dp,{size:"xs",className:"crewlet-cursor-flag__glyph"}):null,(0,qo.jsx)("span",{className:"crewlet-cursor-flag__name",children:o})]})}var Ke=j(ht(),1),fy=j(nr(),1);var fi=j(be(),1);function py(e){return Number.parseFloat(e)}function P5(e,t){if(typeof e=="function"){let n=e(t);return typeof n=="function"?n:()=>{e(null)}}if(!e)return()=>{};let a=e;return a.current=t,()=>{a.current=null}}var e_=py(vp.duration.slow),t_=py(vp.duration.base);function Vo({content:e,placement:t="top",align:a="center",disabled:n=!1,openDelay:l=e_,closeDelay:r=t_,className:i,children:o}){let c=`${(0,Ke.useId)()}-tooltip`,[d,v]=(0,Ke.useState)(!1),u=(0,Ke.useRef)(null),m=(0,Ke.useRef)(null),b=(0,Ke.useRef)(void 0),y=(0,Ke.useRef)({pointer:!1,focus:!1}),[S,h]=(0,Ke.useState)(null),f=sl(),p=(0,Ke.useCallback)(()=>{b.current!==void 0&&clearTimeout(b.current),b.current=void 0},[]),w=(0,Ke.useCallback)(q=>{if(p(),!n){if(q<=0){v(!0);return}b.current=setTimeout(()=>v(!0),q)}},[p,n]),T=(0,Ke.useCallback)(q=>{p();let H=()=>{y.current.pointer||y.current.focus||v(!1)};if(q<=0){H();return}b.current=setTimeout(H,q)},[p]),C=di({open:d,onDismiss:()=>{y.current={pointer:!1,focus:!1},p(),v(!1)}});(0,Ke.useEffect)(()=>p,[p]),(0,Ke.useEffect)(()=>{n&&(p(),v(!1))},[n,p]);let N=(0,Ke.useCallback)(()=>{let q=u.current,H=m.current;if(!q||!H||!f)return;let Ve=f!==document.body,z=Ve?f.getBoundingClientRect():oi(),Y=q.getBoundingClientRect(),P=H.getBoundingClientRect(),Ze=getComputedStyle(q).direction==="rtl",Dt={x:(a==="center"?Y.x+Y.width/2-P.width/2:Ze?Y.right-P.width:Y.x)-(Ve?z.x:0),y:Y.y-(Ve?z.y:0),width:Y.width,height:Y.height},st={x:ot,y:ot,width:z.width-2*ot,height:z.height-2*ot};if(si(Y,z,Ve)){v(!1);return}let G=ii(Dt,{width:P.width,height:P.height},st,ot,t==="top"?"above":"below");h(se=>se&&se.left===G.left&&se.top===G.top&&se.side===G.side?se:G)},[a,f,t]);(0,Ke.useLayoutEffect)(()=>{if(!d)return;N();let q=()=>N();f?.addEventListener(Sn,q),window.addEventListener("resize",q),window.addEventListener("scroll",q,!0);let H=typeof ResizeObserver=="function"?new ResizeObserver(q):null;return m.current&&H?.observe(m.current),()=>{f?.removeEventListener(Sn,q),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0),H?.disconnect()}},[d,f,N]),(0,Ke.useEffect)(()=>{d||h(null)},[d]);let O=o,I=O.props["aria-describedby"],R=O.props.ref,te=(0,Ke.cloneElement)(O,{ref:q=>{u.current=q,C.insideRef(q);let H=P5(R,q);return()=>{u.current=null,C.insideRef(null),H()}},"aria-describedby":d?k(I,c):I,onPointerEnter:q=>{y.current.pointer=!0,w(l),O.props.onPointerEnter?.(q)},onPointerLeave:q=>{y.current.pointer=!1,T(r),O.props.onPointerLeave?.(q)},onFocus:q=>{y.current.focus=!0,w(0),O.props.onFocus?.(q)},onBlur:q=>{y.current.focus=!1,T(0),O.props.onBlur?.(q)}}),Se=S?{left:S.left,top:S.top,zIndex:C.zIndex}:{visibility:"hidden",zIndex:C.zIndex},me=d?(0,fi.jsx)("div",{ref:q=>{m.current=q,C.panelRef(q)},id:c,role:"tooltip",className:k("crewlet-tooltip",`crewlet-tooltip--${S?.side??(t==="top"?"above":"below")}`,f!==null&&f!==document.body?"crewlet-tooltip--in-host":"crewlet-tooltip--fixed",i),style:Se,onPointerEnter:()=>{y.current.pointer=!0,p()},onPointerLeave:()=>{y.current.pointer=!1,T(r)},children:e}):null;return(0,fi.jsxs)(fi.Fragment,{children:[te,me&&f?(0,fy.createPortal)(me,f):null]})}var Lp=j(be(),1);function gy({by:e,at:t,previous:a=null,locale:n,className:l,labels:r}){let i=eu({by:e,at:t},ko(r),a,n);return(0,Lp.jsx)(Vo,{content:i,children:(0,Lp.jsx)("span",{"aria-hidden":"true",className:k("crewlet-change-mark",l)})})}var qe=j(ht(),1),my=j(nr(),1),pi=j(be(),1);function vy({trigger:e,children:t,align:a="start",side:n="bottom",width:l="auto",alignOffset:r,sideOffset:i=ot,initialFocus:o,role:s="dialog",label:c,className:d,open:v,defaultOpen:u=!1,onOpenChange:m}){let y=`${(0,qe.useId)()}-popover`,[S,h]=(0,qe.useState)(u),f=v??S,p=(0,qe.useRef)(null),w=(0,qe.useRef)(null),[T,C]=(0,qe.useState)(null),N=sl(),O=(0,qe.useRef)(v!==void 0),I=(0,qe.useRef)(m),R=(0,qe.useRef)(r),te=(0,qe.useRef)(o);O.current=v!==void 0,I.current=m,R.current=r,te.current=o;let Se=(0,qe.useCallback)((G,se)=>{O.current||h(G),I.current?.(G,se)},[]),me=(0,qe.useCallback)(G=>{let se=w.current?.contains(document.activeElement)??!1;(G==="escape"||G==="tab"||G==="content"&&se)&&ai(p.current),Se(!1,G)},[Se]),q=di({open:f,onDismiss:me}),H=(0,qe.useCallback)(()=>{let G=p.current,se=w.current;if(!G||!se||!N)return;let ct=N!==document.body,A=ct?N.getBoundingClientRect():oi(),oe=G.getBoundingClientRect();se.style.width=l==="match"?`${oe.width}px`:"";let Je=se.getBoundingClientRect(),L=R.current,X=typeof L=="function"?L(se,G):L??0,Oe={x:(a==="end"?oe.right-Je.width:oe.left)+X-(ct?A.x:0),y:oe.top-(ct?A.y:0),width:oe.width,height:oe.height},tt={x:ot,y:ot,width:A.width-2*ot,height:A.height-2*ot};if(si(oe,A,ct)){me("anchor-gone");return}let He=l==="match"?oe.width:void 0,at=ii(Oe,{width:Je.width,height:Je.height},tt,i,n==="top"?"above":"below");C(Ft=>Ft&&Ft.left===at.left&&Ft.top===at.top&&Ft.side===at.side&&Ft.width===He?Ft:{left:at.left,top:at.top,side:at.side,width:He})},[a,me,N,n,i,l]);(0,qe.useLayoutEffect)(()=>{if(!f)return;H();let G=()=>H();N?.addEventListener(Sn,G),window.addEventListener("resize",G),window.addEventListener("scroll",G,!0);let se=typeof ResizeObserver=="function"?new ResizeObserver(G):null;return w.current&&se?.observe(w.current),()=>{N?.removeEventListener(Sn,G),window.removeEventListener("resize",G),window.removeEventListener("scroll",G,!0),se?.disconnect()}},[f,N,H]),(0,qe.useEffect)(()=>{f||C(null)},[f]);let Ve=f&&T!==null;(0,qe.useEffect)(()=>{if(!Ve||s!=="dialog")return;let G=w.current;G&&!G.contains(document.activeElement)&&(te.current?.()??Xl(G)[0]??G).focus()},[Ve,s]);let z=(0,qe.useCallback)(()=>{f?me("trigger"):Se(!0,"trigger")},[me,f,Se]),Y=e(f,z),P=s==="none"?void 0:s,Ze=(0,qe.cloneElement)(Y,{ref:G=>{p.current=G,q.insideRef(G)},"aria-expanded":f,"aria-haspopup":Y.props["aria-haspopup"]??P,"aria-controls":f?y:void 0});function et(G){G.key!=="Escape"&&G.key!=="Tab"&&!G.ctrlKey&&!G.metaKey&&!G.altKey&&G.stopPropagation()}let Dt=T?{left:T.left,top:T.top,width:T.width}:{visibility:"hidden"},st=f?(0,pi.jsx)("div",{ref:G=>{w.current=G,q.panelRef(G)},id:y,className:k("crewlet-popover",`crewlet-popover--${T?.side??(n==="top"?"above":"below")}`,N!==null&&N!==document.body?"crewlet-popover--in-host":"crewlet-popover--fixed",d),style:{...Dt,zIndex:q.zIndex},role:s==="none"?void 0:s,"aria-label":s==="none"?void 0:c,"aria-modal":s==="dialog"?!1:void 0,tabIndex:s==="dialog"?-1:void 0,onKeyDown:et,onPointerDown:G=>G.stopPropagation(),onClick:G=>G.stopPropagation(),children:typeof t=="function"?t(()=>me("content")):t}):null;return(0,pi.jsxs)(pi.Fragment,{children:[Ze,st&&N?(0,my.createPortal)(st,N):null]})}var Yo=j(be(),1);function jo({tone:e="neutral",pulse:t=!1,children:a,className:n}){let l=a!=null&&a!==!1&&a!=="",r=(0,Yo.jsx)("span",{"aria-hidden":!0,className:k("crewlet-status-dot",`crewlet-status-dot--${e}`,t&&"is-pulsing",!l&&n)});return l?(0,Yo.jsxs)("span",{className:k("crewlet-status",n),children:[r," ",(0,Yo.jsx)("span",{className:"crewlet-status__label",children:a})]}):r}var Vt=j(be(),1);function fu(e){let{variant:t="neutral",hue:a,appearance:n="soft",size:l="sm",leadingIcon:r,dot:i=!1,count:o,monospace:s=!1,animateIn:c=!1,onClick:d,pressed:v,onRemove:u,removeAriaLabel:m="Remove tag",className:b,children:y,...S}=e,h=d!==void 0,f=h||u!==void 0,p=h&&u!==void 0;f&&l==="xs"&&console.warn('[crewlet] Tag size="xs" cannot act: an interactive tag starts at "sm", so its target clears 24px. Drawn at "sm".');let w=f&&l==="xs"?"sm":l,T=k("crewlet-tag",a===void 0?`crewlet-tag--${t}`:`crewlet-tag--hue-${a}`,`crewlet-tag--${n}`,`crewlet-tag--${w}`,s&&"crewlet-tag--monospace",c&&"crewlet-tag--animate-in",f&&"crewlet-tag--acts",h&&!p&&"crewlet-tag--actionable",p&&"crewlet-tag--split",p&&v===!0&&"is-pressed",b),C=(0,Vt.jsxs)(Vt.Fragment,{children:[i?(0,Vt.jsx)(jo,{tone:a===void 0?t:"neutral",className:"crewlet-tag__dot"}):null,r?(0,Vt.jsx)("span",{className:"crewlet-tag__icon","aria-hidden":!0,children:r}):null,(0,Vt.jsx)("span",{className:"crewlet-tag__label",children:y}),o===void 0?null:(0,Vt.jsx)("span",{className:"crewlet-tag__count",children:o})]}),N=u===void 0?null:(0,Vt.jsx)("button",{type:"button",className:"crewlet-tag__remove",onClick:O=>{O.stopPropagation(),u()},"aria-label":m,children:(0,Vt.jsx)(Do,{size:"xs"})});return p?(0,Vt.jsxs)("span",{...S,className:T,children:[(0,Vt.jsx)("button",{type:"button",className:"crewlet-tag__press",onClick:d,"aria-pressed":v===!0,children:C}),N]}):h?(0,Vt.jsx)("button",{...S,type:"button",className:T,onClick:d,"aria-pressed":v===!0,children:C}):(0,Vt.jsxs)("span",{...S,className:T,children:[C,N]})}var Ie=j(ht(),1),wy=j(nr(),1);var bt=j(be(),1),a_="[role='menuitem'],[role='menuitemradio']";function n_(e){let t=[];for(let a of e){if(a.kind==="separator"){t.push({kind:"separator",key:a.key});continue}let n=t[t.length-1];a.checked===void 0?t.push({kind:"action",item:a}):n?.kind==="answers"?n.items.push(a):t.push({kind:"answers",key:`${a.key}:answers`,items:[a]})}return t}function yy({label:e,items:t,icon:a,trigger:n,trailingIcon:l,triggerVariant:r="ghost",triggerTabIndex:i,open:o,onOpenChange:s,align:c="start",width:d="content",renderTrigger:v,header:u,className:m}){let b=(0,Ie.useId)(),y=`${b}-menu`,S=`${b}-header`,[h,f]=(0,Ie.useState)(!1),p=o??h,w=(0,Ie.useRef)(null),T=(0,Ie.useRef)(null),C=(0,Ie.useRef)(null),N=(0,Ie.useRef)("first"),[O,I]=(0,Ie.useState)(null),R=sl(),te=(0,Ie.useRef)(o!==void 0),Se=(0,Ie.useRef)(s);te.current=o!==void 0,Se.current=s;let me=(0,Ie.useCallback)(A=>{te.current||f(A),Se.current?.(A)},[]),q=(0,Ie.useCallback)(()=>{let A=C.current,oe=A&&A.isConnected&&A!==document.body?A:w.current;ai(oe)},[]),H=(0,Ie.useCallback)(A=>{A&&q(),me(!1)},[q,me]),Ve=di({open:p,onDismiss:A=>H(A!=="outside")}),z=()=>T.current?[...T.current.querySelectorAll(a_)]:[];(0,Ie.useLayoutEffect)(()=>{if(!p)return;let A=document.activeElement;A instanceof Node&&T.current?.contains(A)||(C.current=A instanceof HTMLElement?A:null)},[p]);let Y=(0,Ie.useCallback)(()=>{let A=w.current,oe=T.current;if(!A||!oe||!R)return;let Je=R!==document.body,L=Je?R.getBoundingClientRect():oi(),X=A.getBoundingClientRect(),Oe=oe.getBoundingClientRect(),tt=d==="trigger"?X.width:void 0,He={width:Math.max(Oe.width,tt??0),height:Oe.height},at={x:(c==="end"?X.right-He.width:X.left)-(Je?L.x:0),y:X.top-(Je?L.y:0),width:X.width,height:X.height},Ft={x:ot,y:ot,width:L.width-2*ot,height:L.height-2*ot};if(si(X,L,Je)){H(!0);return}let Mn=ii(at,{width:He.width,height:He.height},Ft,ot);I(Ot=>Ot&&Ot.left===Mn.left&&Ot.top===Mn.top&&Ot.floor===tt?Ot:{left:Mn.left,top:Mn.top,floor:tt})},[c,H,R,d]);(0,Ie.useLayoutEffect)(()=>{if(!p)return;Y();let A=()=>Y();R?.addEventListener(Sn,A),window.addEventListener("resize",A),window.addEventListener("scroll",A,!0);let oe=typeof ResizeObserver=="function"?new ResizeObserver(A):null;return T.current&&oe?.observe(T.current),()=>{R?.removeEventListener(Sn,A),window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0),oe?.disconnect()}},[p,R,Y]),(0,Ie.useEffect)(()=>{p||I(null)},[p]);let P=p&&O!==null;(0,Ie.useLayoutEffect)(()=>{if(!P)return;let A=z();(N.current==="last"?A[A.length-1]:A[0])?.focus(),N.current="first"},[P]);function Ze(A){(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),N.current=A.key==="ArrowUp"?"last":"first",me(!0))}function et(A){A.key!=="Escape"&&A.key!=="Tab"&&!A.ctrlKey&&!A.metaKey&&!A.altKey&&A.stopPropagation();let oe=z(),Je=oe.indexOf(document.activeElement),L=X=>oe[(X+oe.length)%oe.length]?.focus();switch(A.key){case"ArrowDown":A.preventDefault(),L(Je+1);return;case"ArrowUp":A.preventDefault(),L(Je-1);return;case"Home":A.preventDefault(),L(0);return;case"End":A.preventDefault(),L(oe.length-1);return;case"Tab":H(!0);return;default:if(A.key.length===1&&!A.ctrlKey&&!A.metaKey&&!A.altKey&&A.key!==" "){let X=A.key.toLocaleLowerCase();for(let Oe=1;Oe<=oe.length;Oe++){let tt=oe[(Je+Oe)%oe.length];if((tt.textContent??"").trim().toLocaleLowerCase().startsWith(X)){A.preventDefault(),tt.focus();return}}}}}function Dt(A){A.disabled||(H(!0),A.onSelect())}let st=A=>A.description!==void 0&&A.description!==null&&A.description!==!1&&A.description!=="",G=A=>(0,bt.jsxs)("button",{type:"button",role:A.checked===void 0?"menuitem":"menuitemradio","aria-checked":A.checked,tabIndex:-1,className:k("crewlet-menu__item",st(A)?"crewlet-menu__item--described":void 0,A.danger&&"is-danger",A.disabled&&"is-disabled"),"aria-disabled":A.disabled||void 0,onClick:()=>Dt(A),children:[A.checked!==void 0&&(0,bt.jsx)("span",{className:"crewlet-menu__check","aria-hidden":!0,children:A.checked&&(0,bt.jsx)(ni,{size:"sm"})}),A.icon&&(0,bt.jsx)("span",{className:"crewlet-menu__icon",children:A.icon}),(0,bt.jsxs)("span",{className:"crewlet-menu__text",children:[(0,bt.jsx)("span",{className:"crewlet-menu__label",children:A.label}),st(A)?(0,bt.jsx)("span",{className:"crewlet-menu__description",children:A.description}):null]}),A.hint&&(0,bt.jsx)("span",{className:"crewlet-menu__hint",children:A.hint})]},A.key),se=p?(0,bt.jsxs)("div",{className:k("crewlet-menu",R!==null&&R!==document.body?"crewlet-menu--in-host":null,m),id:y,role:"menu","aria-label":e,"aria-describedby":u?S:void 0,tabIndex:-1,ref:A=>{T.current=A,Ve.panelRef(A)},style:O?{left:O.left,top:O.top,zIndex:Ve.zIndex,...O.floor===void 0?null:{"--crewlet-menu-floor":`${O.floor}px`}}:{visibility:"hidden"},onKeyDown:et,onPointerDown:A=>A.stopPropagation(),onClick:A=>A.stopPropagation(),children:[u?(0,bt.jsx)("div",{role:"presentation",id:S,className:"crewlet-menu__header",children:u}):null,n_(t).map(A=>A.kind==="separator"?(0,bt.jsx)("div",{role:"separator",className:"crewlet-menu__separator"},A.key):A.kind==="answers"?(0,bt.jsx)("div",{role:"group",className:"crewlet-menu__group",children:A.items.map(G)},A.key):G(A.item))]}):null,ct={ref:A=>{w.current=A,Ve.insideRef(A)},"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?y:void 0,tabIndex:i,onClick:()=>{p?H(!0):(N.current="first",me(!0))},onKeyDown:Ze};return(0,bt.jsxs)("span",{className:"crewlet-menu-anchor",children:[v?v(ct):n===void 0?(0,bt.jsx)(ul,{...ct,label:e,icon:a??(0,bt.jsx)(cp,{}),size:"sm"}):(0,bt.jsx)(ka,{...ct,"aria-label":e,variant:r,size:"small",leadingIcon:a,trailingIcon:l,children:n}),se&&R?(0,wy.createPortal)(se,R):null]})}var M=j(ht(),1);var _=j(be(),1);function Bp({column:e,id:t,labels:a}){let n=En(e,t);if(!n)return(0,_.jsx)(fu,{size:"xs",children:t});if(n.archived)return(0,_.jsx)(fu,{size:"xs",appearance:"outline",children:a.archived(n.label)});let l=Jc(n.color);return(0,_.jsx)(fu,{size:"xs",hue:l==="neutral"?void 0:l,children:n.label})}function xy({person:e,fallback:t}){return e?(0,_.jsxs)("span",{className:"crewlet-sheet-cell__person",children:[(0,_.jsx)(Bo,{name:e.name,kind:e.kind==="human"?"human":"agent",src:e.src,character:e.character!==void 0&&Uo(e.character)?e.character:void 0,hue:e.kind==="agent"?e.hue:void 0,size:"xs",decorative:!0}),(0,_.jsx)("span",{className:"crewlet-sheet-cell__text",children:e.name})]}):(0,_.jsx)("span",{className:"crewlet-sheet-cell__muted",children:t})}function qp({column:e,value:t,context:a,onOpenLink:n}){let{labels:l}=a;if(e.type==="checkbox"){let r=t===!0;return(0,_.jsxs)("span",{className:"crewlet-sheet-cell__checkbox",children:[(0,_.jsx)("span",{className:k("crewlet-sheet-cell__check",r&&"crewlet-sheet-cell__check--on"),"aria-hidden":"true",children:r?(0,_.jsx)(ni,{size:"xs"}):null}),(0,_.jsx)(Ht,{children:r?l.checked:l.unchecked})]})}if(tn(t))return(0,_.jsx)(Ht,{children:l.empty});switch(e.type){case"select":return(0,_.jsx)(Bp,{column:e,id:String(t),labels:l});case"multiselect":return(0,_.jsx)(dy,{label:e.label,overflow:"fit",className:"crewlet-sheet-cell__chips",children:t.map(r=>(0,_.jsx)(Bp,{column:e,id:r,labels:l},r))});case"status":{let r=En(e,String(t)),i=ba(e,t,a);return(0,_.jsx)(jo,{tone:r&&!r.archived?Fc(r):"neutral",children:i})}case"person":return(0,_.jsx)(xy,{person:Pr(a.people,String(t)),fallback:l.unknownPerson});case"rating":{let r=en(e),i=Number(t);return(0,_.jsxs)("span",{className:"crewlet-sheet-cell__rating",children:[(0,_.jsx)("span",{className:"crewlet-sheet-cell__stars","aria-hidden":"true",children:Array.from({length:r},(o,s)=>(0,_.jsx)(fp,{size:"sm",filled:s<i,className:k("crewlet-sheet-cell__star",s<i&&"crewlet-sheet-cell__star--on")},s))}),(0,_.jsx)(Ht,{children:l.rating(i,r)})]})}case"url":{let r=String(t);return(0,_.jsx)("a",{className:"crewlet-sheet-cell__link",href:r,target:"_blank",rel:"noopener noreferrer",tabIndex:-1,onClick:n?i=>{i.preventDefault(),n(r)}:void 0,children:r})}case"number":return(0,_.jsx)("span",{className:"crewlet-sheet-cell__text crewlet-sheet-cell__number",children:ba(e,t,a)});default:return(0,_.jsx)("span",{className:"crewlet-sheet-cell__text",children:ba(e,t,a)})}}var l_=new Set(["text","number","url","date","rating"]),r_=new Set(["text","longtext"]),i_=6,o_=8,_y=new Set(["select","multiselect","status","person"]),s_=e=>e!=="checkbox",by=e=>l_.has(e)||_y.has(e)||e==="longtext";function Ty(e,t){if(e.key==="Tab")return e.shiftKey?"left":"right";if(e.key==="Enter")return t?e.shiftKey&&!Kl(e)?void 0:"down":e.shiftKey?"up":"down"}function Vp(e,t){e&&(e.focus({preventScroll:!0}),t&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.setSelectionRange(e.value.length,e.value.length))}function Yp(e){let t=(0,M.useRef)(!1);return{finish:()=>{t.current=!0},onBlur:a=>{if(t.current)return;let n=a.relatedTarget;n!==null&&a.currentTarget.contains(n)||(t.current=!0,e())}}}function c_(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let a=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}T${a(t.getHours())}:${a(t.getMinutes())}`}function jp({conflict:e,labels:t}){return(0,_.jsxs)("div",{className:"crewlet-sheet-editor__conflict",role:"alert",children:[(0,_.jsx)("p",{className:"crewlet-sheet-editor__conflict-text",children:t.conflict(e.writer,e.value)}),(0,_.jsxs)("div",{className:"crewlet-sheet-editor__conflict-actions",children:[(0,_.jsx)(ka,{size:"small",variant:"secondary",onClick:e.onKeepMine,children:t.keepMine}),(0,_.jsx)(ka,{size:"small",variant:"ghost",onClick:e.onUseTheirs,children:t.useTheirs(e.writer)})]})]})}function Kp({id:e,message:t}){return(0,_.jsxs)("p",{id:e,className:"crewlet-sheet-editor__error",children:[(0,_.jsx)(li,{size:"xs","aria-hidden":"true"}),(0,_.jsx)("span",{children:t})]})}function Ey(e){let{column:t}=e;return _y.has(t.type)?(0,_.jsx)(p_,{...e}):r_.has(t.type)?(0,_.jsx)(d_,{...e}):(0,_.jsx)(u_,{...e})}function u_({column:e,value:t,context:a,seed:n,label:l,onCommit:r,onCancel:i,conflict:o}){let{labels:s}=a,c=(0,M.useId)(),d=(0,M.useRef)(null),v=e.type==="date",u=(0,M.useMemo)(()=>{if(v){let p=typeof t=="string"?t:"";return e.time?c_(p):p}return n??ei(e,t,a)},[]),[m,b]=(0,M.useState)(u),[y,S]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{Vp(d.current,!v)},[v]);let h=p=>{let w=v&&e.time&&m!==""?new Date(m).toISOString():m,T=ti(e,w,a);return T.ok?(f.finish(),r(T.value,p),!0):(S(T.error),!1)},f=Yp(()=>{h(null)||i()});return(0,_.jsxs)("div",{className:"crewlet-sheet-editor crewlet-sheet-editor--line",onBlur:f.onBlur,children:[(0,_.jsx)("input",{ref:d,className:"crewlet-sheet-editor__input",type:v?e.time?"datetime-local":"date":e.type==="url"?"url":"text",inputMode:e.type==="number"?"decimal":e.type==="rating"?"numeric":void 0,"aria-label":l,"aria-invalid":y!==null,"aria-describedby":y!==null?c:void 0,maxLength:e.type==="text"?ol(e):void 0,value:m,onChange:p=>{b(p.target.value),S(null)},onKeyDown:p=>{if(ui(p))return;if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),f.finish(),i();return}if(p.key==="Tab"&&o)return;let w=Ty(p,!1);w!==void 0&&(p.preventDefault(),p.stopPropagation(),h(w))}}),y!==null||o?(0,_.jsxs)("div",{className:k("crewlet-sheet-editor__panel"),children:[y!==null?(0,_.jsx)(Kp,{id:c,message:y}):null,o?(0,_.jsx)(jp,{conflict:o,labels:s}):null]}):null]})}function d_({column:e,value:t,context:a,seed:n,label:l,onCommit:r,onCancel:i,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="longtext",v=(0,M.useId)(),u=(0,M.useRef)(null),[m,b]=(0,M.useState)(()=>n??ei(e,t,a)),[y,S]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{Vp(u.current,!0)},[]),(0,M.useLayoutEffect)(()=>{let p=u.current;!p||p.scrollHeight===0||(p.style.height="auto",p.style.height=`${p.scrollHeight}px`)},[m]);let h=p=>{let w=ti(e,m,a);return w.ok?(f.finish(),r(w.value,p),!0):(S(w.error),!1)},f=Yp(()=>{h(null)||i()});return(0,_.jsx)("div",{className:k("crewlet-sheet-editor","crewlet-sheet-editor--text",d&&"crewlet-sheet-editor--long",`crewlet-sheet-editor--${o}`),onBlur:f.onBlur,children:(0,_.jsxs)("div",{className:"crewlet-sheet-editor__overlay",children:[(0,_.jsx)("textarea",{ref:u,className:"crewlet-sheet-editor__textarea","aria-label":l,"aria-multiline":d,"aria-invalid":y!==null,"aria-describedby":y!==null?v:void 0,maxLength:ol(e),rows:1,style:{"--crewlet-sheet-editor-lines":i_},value:m,onChange:p=>{b(d?p.target.value:p.target.value.replace(/\r?\n/g," ")),S(null)},onKeyDown:p=>{if(ui(p))return;if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),f.finish(),i();return}if(p.key==="Tab"&&s)return;let w=Ty(p,d);w!==void 0&&(p.preventDefault(),p.stopPropagation(),h(w))}}),y!==null?(0,_.jsx)(Kp,{id:v,message:y}):null,s?(0,_.jsx)(jp,{conflict:s,labels:c}):null]})})}function h_(e,t){return e.type==="person"?(t.people??[]).map(a=>({id:a.id,label:a.name,person:a})):jl(e).map(a=>({id:a.id,label:a.label,option:a}))}function f_({column:e,choice:t,context:a}){return t.person?(0,_.jsx)(xy,{person:t.person,fallback:t.label}):e.type==="status"&&t.option?(0,_.jsx)(jo,{tone:Fc(t.option),children:t.label}):(0,_.jsx)(Bp,{column:e,id:t.id,labels:a.labels})}var nn="";function p_({column:e,value:t,context:a,seed:n,label:l,onCommit:r,onCancel:i,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="multiselect",v=(0,M.useId)(),u=(0,M.useId)(),m=(0,M.useRef)(null),b=(0,M.useRef)(null),y=(0,M.useMemo)(()=>h_(e,a),[e,a]),S=y.length>o_,[h,f]=(0,M.useState)(S?n??"":""),[p,w]=(0,M.useState)(()=>d?[...t??[]]:typeof t=="string"?[t]:[]),[T,C]=(0,M.useState)(null),N=!d&&!e.required,O=(0,M.useMemo)(()=>{let z=h.trim().toLowerCase(),Y=z===""?y:y.filter(P=>P.label.toLowerCase().includes(z));return N&&z===""?[...Y,{id:nn,label:c.clear}]:Y},[y,h,N,c.clear]),[I,R]=(0,M.useState)(()=>{let z=!S&&n?O.findIndex(P=>P.id!==nn&&P.label.toLowerCase().startsWith(n.toLowerCase())):-1;if(z>=0)return z;let Y=O.findIndex(P=>P.id!==nn&&p.includes(P.id));return Y>=0?Y:0});(0,M.useEffect)(()=>{R(z=>Math.min(z,Math.max(O.length-1,0)))},[O.length]),(0,M.useLayoutEffect)(()=>{Vp(S?m.current:b.current,!1)},[S]);let te=(z,Y)=>{let P=Df(e,z,a);return P!==null?(C(P),!1):(Se.finish(),r(z,Y),!0)},Se=Yp(()=>{(!d||!te(p,null))&&i()}),me=(z,Y)=>{if(z){if(!d){te(z.id===nn?null:z.id,Y);return}C(null),w(P=>P.includes(z.id)?P.filter(Ze=>Ze!==z.id):[...P,z.id])}},q=z=>`${v}-${z}`,H=O.length>0?q(I):void 0,Ve=z=>{if(!ui(z))switch(z.key){case"Escape":z.preventDefault(),z.stopPropagation(),Se.finish(),i();return;case"ArrowDown":z.preventDefault(),z.stopPropagation(),R(Y=>Math.min(Y+1,O.length-1));return;case"ArrowUp":z.preventDefault(),z.stopPropagation(),R(Y=>Math.max(Y-1,0));return;case"Home":case"End":if(h!=="")return;z.preventDefault(),z.stopPropagation(),R(z.key==="Home"?0:O.length-1);return;case"Enter":z.preventDefault(),z.stopPropagation(),d&&Kl(z)?te(p,"down"):me(O[I],z.shiftKey?"up":"down");return;case" ":if(S)return;z.preventDefault(),z.stopPropagation(),me(O[I],d?null:"down");return;case"Tab":if(s)return;z.preventDefault(),z.stopPropagation(),te(d?p:t,z.shiftKey?"left":"right");return;default:if(!S&&z.key.length===1&&!z.ctrlKey&&!z.metaKey&&!z.altKey){let Y=z.key.toLowerCase(),P=I+1,et=[...O.slice(P),...O.slice(0,P)].find(Dt=>Dt.id!==nn&&Dt.label.toLowerCase().startsWith(Y));et&&(z.preventDefault(),z.stopPropagation(),R(O.indexOf(et)))}return}};return(0,_.jsx)("div",{className:k("crewlet-sheet-editor","crewlet-sheet-editor--list",`crewlet-sheet-editor--${o}`),onBlur:Se.onBlur,children:(0,_.jsxs)("div",{className:"crewlet-sheet-editor__panel crewlet-sheet-editor__panel--list",children:[S?(0,_.jsx)("input",{ref:m,className:"crewlet-sheet-editor__filter",role:"combobox","aria-label":l,"aria-expanded":"true","aria-controls":v,"aria-autocomplete":"list","aria-activedescendant":H,"aria-invalid":T!==null,"aria-describedby":T!==null?u:void 0,placeholder:c.filter,value:h,onChange:z=>{f(z.target.value),R(0)},onKeyDown:Ve}):null,(0,_.jsx)("ul",{ref:b,className:"crewlet-sheet-editor__list",id:v,role:"listbox","aria-label":l,"aria-multiselectable":d||void 0,tabIndex:-1,"aria-activedescendant":S?void 0:H,"aria-invalid":S?void 0:T!==null,"aria-describedby":!S&&T!==null?u:void 0,onKeyDown:S?void 0:Ve,children:O.length===0?(0,_.jsx)("li",{className:"crewlet-sheet-editor__empty",role:"presentation",children:c.noOptions}):O.map((z,Y)=>{let P=z.id===nn?p.length===0:p.includes(z.id);return(0,_.jsxs)("li",{id:q(Y),role:"option","aria-selected":P,className:k("crewlet-sheet-editor__option",z.id===nn&&"crewlet-sheet-editor__option--clear",Y===I&&"crewlet-sheet-editor__option--highlight",P&&"crewlet-sheet-editor__option--selected"),onMouseDown:Ze=>Ze.preventDefault(),onMouseEnter:()=>R(Y),onClick:()=>me(z,d?null:"down"),children:[(0,_.jsx)("span",{className:"crewlet-sheet-editor__mark","aria-hidden":"true",children:P&&z.id!==nn?(0,_.jsx)(ni,{size:"xs"}):null}),z.id===nn?(0,_.jsx)("span",{className:"crewlet-sheet-cell__muted",children:z.label}):(0,_.jsx)(f_,{column:e,choice:z,context:a})]},z.id===nn?"\0clear":z.id)})}),T!==null?(0,_.jsx)(Kp,{id:u,message:T}):null,s?(0,_.jsx)(jp,{conflict:s,labels:c}):null]})})}var fl=-1,g_=.6;function Ip({label:e,columns:t,rows:a,people:n,mode:l="edit",onEdit:r,onAddRow:i,onShowHistory:o,onActiveCellChange:s,onEditingChange:c,onUndo:d,onRedo:v,onOpenLink:u,presence:m,sort:b,onSortChange:y,sync:S,onRetry:h,height:f,fit:p="container",onDeleteRow:w,onDismissRefused:T,renderColumnEditor:C,settingsColumn:N,onSettingsColumnChange:O,onAddColumn:I,locale:R,className:te,labels:Se,presenceLabels:me}){let q=(0,M.useId)(),H=(0,M.useMemo)(()=>ko(Se),[Se]),Ve=(0,M.useMemo)(()=>Co(me),[me]),z=(0,M.useMemo)(()=>({people:n,locale:R,labels:H}),[n,R,H]),Y=(0,M.useMemo)(()=>jf(t),[t]),[P,Ze]=(0,M.useState)(0),et=(0,M.useRef)(a);(0,M.useLayoutEffect)(()=>{et.current=a});let Dt=a.length>0,[st,G]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{let g=Dt?et.current:[];G(new Map(Y.filter(x=>!(x.width&&x.width>0)).map(x=>[x.field,Xf(x,g,z)])))},[Y,Dt,z]);let[se,ct]=(0,M.useState)(0);(0,M.useEffect)(()=>{let g=typeof document>"u"?void 0:document.fonts;if(!g)return;let x=!0,D=()=>{x&&ct(J=>J+1)};return g.ready.then(D),g.addEventListener("loadingdone",D),()=>{x=!1,g.removeEventListener("loadingdone",D)}},[]);let A=(0,M.useRef)(null),[oe,Je]=(0,M.useState)(new Map);(0,M.useLayoutEffect)(()=>{let g=A.current;if(!g)return;let x=new Map;for(let D of g.querySelectorAll("[data-measure]")){let J=0;for(let le of D.children)J=Math.max(J,le.getBoundingClientRect().width);x.set(D.dataset.measure??"",J)}Je(x)},[st,se]);let L=(0,M.useMemo)(()=>{let g=B=>B.width!==void 0&&B.width>0,x=Y.map(B=>g(B)?B:{...B,width:If(B.type,oe.get(B.field)??0)});if(P<=0)return x;let D=Math.floor(P*g_)-Il,J=x.filter(B=>B.frozen).reduce((B,Ae)=>B+an(Ae),0)-D,le=Y.filter(B=>B.frozen&&!g(B)).length;if(J<=0||le===0)return x;let _e=Math.ceil(J/le);return x.map((B,Ae)=>B.frozen&&!g(Y[Ae])?{...B,width:Math.max(Pc[B.type][0],an(B)-_e)}:B)},[Y,oe,P]),X=(0,M.useMemo)(()=>Wf(L,a,b,z),[L,a,b,z]),Oe=l==="edit"&&r!==void 0,tt=l==="edit"&&w!==void 0,He=l==="edit"&&C!==void 0,at=l==="edit"&&I!==void 0,[Ft,Mn]=(0,M.useState)(null),Ot=N!==void 0?N:Ft,mi=g=>{N===void 0&&Mn(g),O?.(g)},Ea=(0,M.useRef)(null),V=(0,M.useRef)(null),Q=(0,M.useRef)(null),[ut,sa]=(0,M.useState)(0),La=(0,M.useRef)(0),[ie,Ql]=(0,M.useState)(Wc),[ln,Cy]=(0,M.useState)(Wc),[vi,ky]=(0,M.useState)(0),[Ry,Hy]=(0,M.useState)(0),[Fp,$p]=(0,M.useState)(0),[Dy,Gy]=(0,M.useState)(!1),[Xo,Qo]=(0,M.useState)(null),[Wp,Zo]=(0,M.useState)(null),[$,wi]=(0,M.useState)(null),[Pp,e0]=(0,M.useState)(new Map),[t0,Ly]=(0,M.useState)({text:"",n:0}),vu=(0,M.useRef)(!1),[a0,n0]=(0,M.useState)(null),Yt=(0,M.useCallback)(g=>Ly(x=>({text:g,n:x.n+1})),[]),l0=(0,M.useRef)(new Map);(0,M.useEffect)(()=>{let g=new Map;for(let x of a)for(let[D,J]of Object.entries(x.refused??{}))g.set(xa(x.id,D),J);for(let[x,D]of g)if(l0.current.get(x)!==D){Yt(H.notSaved(D));break}l0.current=g},[a,H,Yt]),(0,M.useLayoutEffect)(()=>{let g=()=>{let D=V.current?.offsetHeight??0;D>0&&Ql(D);let J=Q.current?.querySelector(".crewlet-sheet-grid__row--head")?.offsetHeight??0;J>0&&Cy(J),ky(Ea.current?.clientHeight??0),Ze(Ea.current?.clientWidth??0);let le=Ea.current;if(le){let _e=getComputedStyle(le),B=le.offsetHeight-le.clientHeight-(parseFloat(_e.borderTopWidth)||0)-(parseFloat(_e.borderBottomWidth)||0);Hy(Math.max(0,Math.round(B)))}};if(g(),typeof ResizeObserver!="function")return;let x=new ResizeObserver(g);return Ea.current&&x.observe(Ea.current),V.current&&x.observe(V.current),()=>x.disconnect()},[]);let Zl=(0,M.useMemo)(()=>Yf(L),[L]),Uy=(0,M.useMemo)(()=>[`${Il}px`,...L.map((g,x)=>x===L.length-1?`minmax(${an(g)}px, 1fr)`:`${an(g)}px`)].join(" "),[L]),By=(0,M.useMemo)(()=>L.reduce((g,x)=>g+an(x),Il),[L]),Jo=(0,M.useMemo)(()=>L.reduce((g,x,D)=>x.frozen?D:g,-1),[L]),wu=(0,M.useMemo)(()=>{let g=Il;return L.forEach((x,D)=>{x.frozen&&(g=(Zl[D]??g)+an(x))}),g},[L,Zl]),pl=(0,M.useMemo)(()=>new Map(X.map((g,x)=>[g.id,x])),[X]),Fo=(0,M.useMemo)(()=>new Map(L.map((g,x)=>[g.field,x])),[L]),Jl=(0,M.useCallback)(g=>{if(!g)return null;let x=Fo.get(g.field);if(x===void 0)return null;if(g.rowId===null)return{row:fl,col:x};let D=pl.get(g.rowId);return D===void 0?null:{row:D,col:x}},[Fo,pl]),rn=(0,M.useCallback)(g=>{let x=L[g.col];if(!x)return null;if(g.row===fl)return{rowId:null,field:x.field};let D=X[g.row];return D?{rowId:D.id,field:x.field}:null},[L,X]),qy=X.length>0&&L.length>0?{rowId:X[0].id,field:L[0].field}:L.length>0?{rowId:null,field:L[0].field}:null,ue=Jl(Xo)??Jl(qy),dt=ue?rn(ue):null,r0=Jl(Wp)??ue,Ye=ue&&r0&&ue.row!==fl?Lf(r0,ue):null,i0=(0,M.useMemo)(()=>Pf(m),[m]),Vy=(0,M.useMemo)(()=>ep(m),[m]),Yy=(0,M.useMemo)(()=>tp(m),[m]),o0=(0,M.useRef)(null);(0,M.useEffect)(()=>{let g=dt&&dt.rowId!==null?{rowId:dt.rowId,field:dt.field}:null,x=g?xa(g.rowId,g.field):null;x!==o0.current&&(o0.current=x,s?.(g))},[dt,s]);let s0=(0,M.useRef)(null);(0,M.useEffect)(()=>{let g=$?xa($.rowId,$.field):null;g!==s0.current&&(s0.current=g,c?.($?{rowId:$.rowId,field:$.field}:null))},[$,c]);let $o=(0,M.useCallback)(g=>{g.length!==0&&(e0(x=>{let D=new Map(x);for(let J of g)D.set(xa(J.rowId,J.field),J.error);return D}),Yt(g[0].error))},[Yt]),Wo=(0,M.useCallback)(g=>{e0(x=>{if(!g.some(J=>x.has(J)))return x;let D=new Map(x);for(let J of g)D.delete(J);return D})},[]),Nn=(0,M.useCallback)(g=>{g.length===0||!r||(Wo(g.map(x=>xa(x.rowId,x.field))),r(g))},[r,Wo]),gl=(0,M.useCallback)(g=>L[Fo.get(g)??-1],[L,Fo]),ml=(0,M.useCallback)(g=>X[pl.get(g)??-1],[X,pl]),Fl=(0,M.useCallback)(g=>Oe&&g!==void 0&&!g.readOnly,[Oe]),yu=(0,M.useCallback)(()=>sa(g=>g+1),[]),$l=(0,M.useCallback)((g,x=!1)=>{g&&(Qo(g),x||Zo(g),yu())},[yu]),c0=g=>{Xo&&Xo.rowId===g.rowId&&Xo.field===g.field||(Qo(g),Zo(g))},yi=ue?.row??null,bi=ue?.col??null;(0,M.useLayoutEffect)(()=>{if(yi===null||bi===null)return;let g=Ea.current;if(g&&yi>=0){let x=qf(yi,g.scrollTop,g.clientHeight,ie,ln);x!==g.scrollTop&&(g.scrollTop=x,$p(x));let D=L[bi];if(D&&!D.frozen){let J=Zl[bi]??0,le=J+an(D);J-wu<g.scrollLeft?g.scrollLeft=Math.max(J-wu,0):le>g.scrollLeft+g.clientWidth&&(g.scrollLeft=le-g.clientWidth)}}ut===La.current||$||(La.current=ut,document.getElementById(Up(q,{row:yi,col:bi}))?.focus({preventScroll:!0}))},[yi,bi,ut,$,q,ie,ln,L,Zl,wu]);let Po=(0,M.useCallback)((g,x)=>{if(g.rowId===null)return;let D=gl(g.field),J=ml(g.rowId);if(!(!J||!D)){if(!Fl(D)){Yt(Oe?H.readOnly(D.label):H.forbidden);return}s_(D.type)&&(Wo([xa(g.rowId,g.field)]),wi({rowId:g.rowId,field:g.field,seed:x,base:Rt(D,J.values[D.field])}))}},[Fl,Wo,gl,Oe,H,ml,Yt]),bu=(0,M.useCallback)(g=>{if(g.rowId===null)return;let x=gl(g.field),D=ml(g.rowId);if(!(!D||!x||x.type!=="checkbox")){if(!Fl(x)){Yt(Oe?H.readOnly(x.label):H.forbidden);return}Nn([{rowId:D.id,field:x.field,value:Rt(x,D.values[x.field])!==!0}])}},[Fl,gl,Oe,Nn,H,ml,Yt]),u0=(0,M.useCallback)((g,x)=>{if(x===null)return rn(g);let D={down:{row:Math.min(g.row+1,X.length-1),col:g.col},up:{row:Math.max(g.row-1,0),col:g.col},right:{row:g.row,col:Math.min(g.col+1,L.length-1)},left:{row:g.row,col:Math.max(g.col-1,0)}}[x];return rn(D)},[rn,L.length,X.length]),d0=(0,M.useCallback)((g,x)=>{if(!$)return;let D=Jl({rowId:$.rowId,field:$.field}),J=gl($.field),le=ml($.rowId);wi(null),g!==void 0&&J&&le&&!Wr(g,Rt(J,le.values[J.field]))&&Nn([{rowId:le.id,field:J.field,value:g}]);let _e=document.activeElement,B=_e!==null&&_e!==document.body&&!!Q.current?.contains(_e);D&&B&&$l(u0(D,x))},[gl,$,Nn,$l,Jl,ml,u0]);(0,M.useEffect)(()=>{$&&!pl.has($.rowId)&&wi(null)},[$,pl]);let es=$?ml($.rowId):void 0,Wl=$?gl($.field):void 0,xu=$&&es&&Wl?Rt(Wl,es.values[Wl.field]):null,h0=!!($&&es&&Wl&&!Wr(xu,$.base)),jy=h0&&$?es?.changed?.[$.field]?.by??H.someone:"",ts=h0&&$&&Wl?{writer:jy,value:ba(Wl,xu,z)||H.empty,onKeepMine:()=>wi(g=>g&&{...g,base:xu}),onUseTheirs:()=>{let g=Jl({rowId:$.rowId,field:$.field});wi(null),g&&$l(rn(g))}}:null,_u=ts?H.conflict(ts.writer,ts.value):"";(0,M.useEffect)(()=>{_u&&Yt(_u)},[_u,Yt]);let f0=g=>{$||!Ye||gi(g)||(g.preventDefault(),g.clipboardData.setData("text/plain",Qf(L,X,Ye,z)))},p0=(0,M.useCallback)(()=>{if(!Ye)return;if(!Oe){Yt(H.forbidden);return}let g=Ff(L,X,Ye,z);Nn(g.edits),$o(g.refused)},[L,z,Oe,Nn,H.forbidden,Ye,$o,X,Yt]),Ky=g=>{$||!Ye||gi(g)||(f0(g),p0())},Iy=g=>{if($||!Ye||gi(g))return;if(g.preventDefault(),!Oe){Yt(H.forbidden);return}let x=Jf(L,X,Ye,Zf(g.clipboardData.getData("text/plain")),z);Nn(x.edits),$o(x.refused)},Xy=Math.max(1,Math.floor(Math.max(vi-ln,ie)/ie)-1),Qy=g=>{if($||ui(g)||!ue||!dt||gi(g)||g.target.closest(".crewlet-sheet-grid__row-actions"))return;let x=L[ue.col],D=Kl(g);if(D&&g.altKey&&g.key.toLowerCase()==="h"){o&&dt.rowId!==null&&(g.preventDefault(),o({rowId:dt.rowId,field:dt.field}));return}if(D&&!g.altKey&&g.key.toLowerCase()==="z"){let le=g.shiftKey?v:d;le&&(g.preventDefault(),le());return}if(D&&!g.altKey&&g.key.toLowerCase()==="y"){v&&(g.preventDefault(),v());return}if(D&&!g.altKey&&g.key.toLowerCase()==="a"){if(g.preventDefault(),X.length===0)return;Zo(rn({row:0,col:0})),Qo(rn({row:X.length-1,col:L.length-1})),yu();return}if(tt&&dt.rowId!==null&&(g.key==="ContextMenu"||g.shiftKey&&g.key==="F10")){g.preventDefault(),n0(dt.rowId);return}let J=Gf(ue,g,{rows:X.length,cols:L.length,page:Xy});if(J){g.preventDefault();let le=g.shiftKey&&J.row!==fl&&ue.row!==fl;$l(rn(J),le);return}if(g.key==="Tab"){let le=g.shiftKey?-1:1,_e=ue.col+le;if(_e<0||_e>=L.length)return;g.preventDefault(),$l(rn({row:ue.row,col:_e}));return}if(ue.row===fl){(g.key==="Enter"||g.key===" ")&&x&&He?(g.preventDefault(),mi(x.field)):(g.key==="Enter"||g.key===" ")&&x&&y&&(g.preventDefault(),y(au(b,x.field)));return}switch(g.key){case"Enter":case"F2":if(g.preventDefault(),g.key==="Enter"&&D&&x?.type==="url"){let le=X[ue.row],_e=le?Rt(x,le.values[x.field]):null;typeof _e=="string"&&_e&&(u?u(_e):window.open(_e,"_blank","noopener,noreferrer"));return}x?.type==="checkbox"?bu(dt):Po(dt);return;case" ":g.preventDefault(),x?.type==="checkbox"?bu(dt):x&&by(x.type)&&Po(dt," ");return;case"Delete":case"Backspace":g.preventDefault(),p0();return;case"Escape":Wp&&Ye&&(Ye.top!==Ye.bottom||Ye.left!==Ye.right)&&(g.preventDefault(),Zo(dt));return}if(Kf(g)&&x){if(x.type==="rating"&&/^\d$/.test(g.key)){if(g.preventDefault(),!Fl(x)){Yt(Oe?H.readOnly(x.label):H.forbidden);return}let le=Number(g.key),_e=X[ue.row];if(!_e)return;if(le>en(x)){$o([{rowId:_e.id,field:x.field,error:H.notARating(x.label,en(x))}]);return}Nn([{rowId:_e.id,field:x.field,value:le===0?null:le}]);return}by(x.type)&&(g.preventDefault(),Po(dt,x.type==="date"?void 0:g.key))}};(0,M.useEffect)(()=>{let g=()=>{vu.current=!1};return window.addEventListener("mouseup",g),()=>window.removeEventListener("mouseup",g)},[]);let g0=(g,x)=>{if(g.button!==0)return;let D=g.shiftKey&&x.rowId!==null&&dt?.rowId!==null;$&&$.rowId===x.rowId&&$.field===x.field||$l(x,D),vu.current=x.rowId!==null},Zy=g=>{!vu.current||g.rowId===null||Qo(g)},[m0,v0]=Bf(Math.max(Fp-ln,0),vi,ie,X.length),xi=[];for(let g=m0;g<=v0;g+=1)xi.push(g);if(ue&&ue.row>=0&&(ue.row<m0||ue.row>v0)&&xi.push(ue.row),$){let g=pl.get($.rowId);g!==void 0&&!xi.includes(g)&&xi.push(g)}let w0=`${q}-described`,y0=`${q}-help`,_i=ue?L[ue.col]:void 0,as=ue&&ue.row>=0?X[ue.row]:void 0,Jy=as&&_i?i0.get(xa(as.id,_i.field))??[]:[],Fy=as&&_i?np(_i,m_(as,Pp,_i.field),Jy,z,Ve):"",$y={"--crewlet-sheet-columns":Uy,"--crewlet-sheet-row-height":`${ie}px`,width:`${By}px`},Tu=ln+X.length*ie+2+Ry,b0=ln+X.length*ie>=vi,x0=X.length===0&&b0,Wy=p==="content"?{height:`${f!==void 0?Math.min(Tu,f):Tu}px`,"--crewlet-sheet-content-height":`${Tu}px`}:f!==void 0?{height:`${f}px`}:void 0,Py=g=>{let x=ln+g*ie-Fp,D=vi>0?vi:ie*12;return Vf(x,x+ie,ln,D,ie*8)};return(0,_.jsxs)("div",{className:k("crewlet-sheet-grid",l==="read"&&"crewlet-sheet-grid--read",p==="content"&&"crewlet-sheet-grid--fit-content",te),children:[(0,_.jsx)("div",{ref:V,className:"crewlet-sheet-grid__probe","aria-hidden":"true"}),(0,_.jsxs)("div",{ref:Ea,className:k("crewlet-sheet-grid__scroller",Dy&&"crewlet-sheet-grid__scroller--across",at&&"crewlet-sheet-grid__scroller--add-column"),style:Wy,onScroll:g=>{$p(g.currentTarget.scrollTop),Gy(g.currentTarget.scrollLeft>0)},children:[(0,_.jsxs)("div",{ref:Q,role:"grid","aria-label":e,"aria-rowcount":X.length+1,"aria-colcount":L.length+1,"aria-readonly":!Oe||void 0,"aria-multiselectable":"true","aria-describedby":y0,tabIndex:-1,className:k("crewlet-sheet-grid__grid",Ye&&(Ye.top!==Ye.bottom||Ye.left!==Ye.right)&&"crewlet-sheet-grid__grid--range"),style:$y,onKeyDown:Qy,onCopy:f0,onCut:Ky,onPaste:Iy,children:[(0,_.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__head",children:(0,_.jsxs)("div",{role:"row","aria-rowindex":1,className:k("crewlet-sheet-grid__row","crewlet-sheet-grid__row--head",x0&&"crewlet-sheet-grid__row--floor"),children:[(0,_.jsx)("div",{role:"columnheader","aria-colindex":1,className:k("crewlet-sheet-grid__corner",Jo<0&&"crewlet-sheet-grid__frozen-edge"),children:(0,_.jsx)(Ht,{children:H.rowHeader})}),L.map((g,x)=>{let D={row:fl,col:x},J=ue?.row===fl&&ue.col===x,le=b?.field===g.field?b.direction:void 0,_e=Yy.get(g.field)??[],B=(0,_.jsxs)("div",{id:Up(q,D),role:"columnheader","aria-colindex":x+2,"aria-sort":le??(y?"none":void 0),tabIndex:J?0:-1,className:k("crewlet-sheet-grid__header",`crewlet-sheet-grid__header--${g.type}`,g.frozen&&"crewlet-sheet-grid__cell--frozen",x===Jo&&"crewlet-sheet-grid__frozen-edge",J&&"crewlet-sheet-grid__header--active",He&&"crewlet-sheet-grid__header--settings",Ot===g.field&&"crewlet-sheet-grid__header--open"),style:g.frozen?{insetInlineStart:`${Zl[x]}px`}:void 0,onMouseDown:Ae=>{gi(Ae)||g0(Ae,{rowId:null,field:g.field})},onFocus:Ae=>{Ae.target===Ae.currentTarget&&c0({rowId:null,field:g.field})},onClick:Ae=>{gi(Ae)||(He?mi(Ot===g.field?null:g.field):y&&y(au(b,g.field)))},title:He?H.columnSettings(g.label):y?H.sortBy(g.label):g.label,children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:g.label}),(0,_.jsx)(Ht,{children:`, ${H.types[g.type]}`}),le?(0,_.jsx)("span",{className:"crewlet-sheet-grid__sort","aria-hidden":"true",children:le==="ascending"?(0,_.jsx)(rp,{size:"xs"}):(0,_.jsx)(ru,{size:"xs"})}):null,_e.length>0?(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-presence","aria-hidden":"true",children:_e.map(Ae=>(0,_.jsx)(Bo,{name:Ae.name,kind:Ae.kind,size:16,decorative:!0,className:k("crewlet-sheet-grid__header-badge",dl(Ae.hue))},Ae.id))}):null]},g.field);return He?(0,_.jsx)(vy,{label:H.columnSettings(g.label),open:Ot===g.field,onOpenChange:Ae=>{!Ae&&Ot===g.field&&mi(null)},trigger:()=>B,className:"crewlet-sheet-grid__column-settings",children:Ae=>C(g,Ae)},g.field):B})]})}),(0,_.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__body",style:{height:`${X.length*ie}px`},children:xi.map(g=>{let x=X[g],D=Vy.get(x.id),J=`${q}-r${g}-name`,le=Ye!==null&&g>=Ye.top&&g<=Ye.bottom,_e=H.rowActions(g+1);return(0,_.jsxs)("div",{role:"row","aria-rowindex":g+2,className:k("crewlet-sheet-grid__row",g===X.length-1&&b0&&"crewlet-sheet-grid__row--floor"),style:{top:`${g*ie}px`},"data-row-id":x.id,children:[(0,_.jsxs)("div",{role:"rowheader","aria-colindex":1,"aria-labelledby":J,className:k("crewlet-sheet-grid__rownum",Jo<0&&"crewlet-sheet-grid__frozen-edge",tt&&"crewlet-sheet-grid__rownum--actions",le&&"crewlet-sheet-grid__rownum--selected",a0===x.id&&"crewlet-sheet-grid__rownum--open",D&&"crewlet-sheet-grid__rownum--present",D&&dl(D.hue)),children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__rownum-number","aria-hidden":"true",children:g+1}),(0,_.jsx)(Ht,{id:J,children:nu(L,x,g,z)}),tt?(0,_.jsx)("span",{className:"crewlet-sheet-grid__row-actions",children:(0,_.jsx)(yy,{label:_e,triggerTabIndex:-1,open:a0===x.id,onOpenChange:B=>n0(B?x.id:null),renderTrigger:B=>(0,_.jsx)(Vo,{content:_e,align:"start",children:(0,_.jsx)(ul,{...B,label:_e,icon:(0,_.jsx)(sp,{}),size:"sm",title:""})}),items:[{key:"delete",label:H.deleteRow,icon:(0,_.jsx)(pp,{size:"sm"}),danger:!0,onSelect:()=>w?.(x.id)}]})}):null]}),L.map((B,Ae)=>{let eb={row:g,col:Ae},_0=xa(x.id,B.field),Ti=ue?.row===g&&ue.col===Ae,T0=Ye?Uf(Ye,g,Ae):!1,tb=x.pending?.includes(B.field)??!1,ns=x.refused?.[B.field]??Pp.get(_0),Ei=x.changed?.[B.field],E0=Rt(B,x.values[B.field]),ls=i0.get(_0),On=ls?.[0],Si=$?.rowId===x.id&&$.field===B.field,S0=Ti&&o!==void 0&&!Si;return(0,_.jsxs)("div",{id:Up(q,eb),role:"gridcell","aria-colindex":Ae+2,"aria-selected":T0,"aria-readonly":!Fl(B)||void 0,"aria-describedby":Ti?w0:void 0,tabIndex:Ti&&!Si?0:-1,className:k("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${B.type}`,B.frozen&&"crewlet-sheet-grid__cell--frozen",Ae===Jo&&"crewlet-sheet-grid__frozen-edge",T0&&"crewlet-sheet-grid__cell--selected",Ti&&"crewlet-sheet-grid__cell--active",tb&&"crewlet-sheet-grid__cell--pending",ns!==void 0&&"crewlet-sheet-grid__cell--refused",Si&&"crewlet-sheet-grid__cell--editing",S0&&"crewlet-sheet-grid__cell--history",On&&"crewlet-presence-ring",On&&dl(On.hue),On&&(On.idle?"crewlet-presence-ring--idle":null)),style:B.frozen?{insetInlineStart:`${Zl[Ae]}px`}:void 0,onMouseDown:ca=>g0(ca,{rowId:x.id,field:B.field}),onFocus:ca=>{ca.target===ca.currentTarget&&c0({rowId:x.id,field:B.field})},onMouseEnter:()=>Zy({rowId:x.id,field:B.field}),onDoubleClick:()=>{B.type!=="checkbox"&&Po({rowId:x.id,field:B.field})},onClick:ca=>{B.type==="checkbox"&&ca.target.closest(".crewlet-sheet-cell__check")&&bu({rowId:x.id,field:B.field})},children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,_.jsx)(qp,{column:B,value:E0,context:z,onOpenLink:u})}),ns!==void 0?(0,_.jsx)("span",{className:"crewlet-sheet-grid__refused","aria-hidden":"true",children:(0,_.jsx)(li,{size:"xs"})}):null,Ei?(0,_.jsx)(gy,{by:Ei.by,at:Ei.at,previous:tu(Ei)&&ba(B,Rt(B,Ei.previous),z)||null,locale:R,labels:H}):null,ls&&On?(0,_.jsx)(hy,{name:ap(ls),hue:On.hue,kind:On.kind,editing:ls.some(ca=>ca.editing)}):null,Ti&&ns!==void 0&&!Si?(0,_.jsx)("span",{className:"crewlet-sheet-grid__message","aria-hidden":"true",children:ns}):null,S0?(0,_.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"crewlet-sheet-grid__history",title:H.history,onMouseDown:ca=>ca.stopPropagation(),onClick:()=>o?.({rowId:x.id,field:B.field}),children:(0,_.jsx)(hp,{size:"xs"})}):null,Si?(0,_.jsx)(Ey,{column:B,value:E0,context:z,seed:$.seed,label:`${B.label}, ${nu(L,x,g,z)}`,side:Py(g),conflict:ts,onCommit:(ca,ab)=>d0(ca,ab),onCancel:()=>d0(void 0,null)}):null]},B.field)})]},x.id)})})]}),at?(0,_.jsx)("div",{className:k("crewlet-sheet-grid__add-column",x0&&"crewlet-sheet-grid__add-column--floor"),style:{height:`${ln}px`},children:(0,_.jsx)(Vo,{content:H.addColumn,children:(0,_.jsx)(ul,{label:H.addColumn,icon:(0,_.jsx)(ou,{size:"xs"}),size:"sm",title:"",onClick:I})})}):null]}),st?(0,_.jsx)("div",{ref:A,className:"crewlet-sheet-grid__measure","aria-hidden":"true",inert:!0,children:Y.filter(g=>st.has(g.field)).map(g=>(0,_.jsxs)("div",{"data-measure":g.field,children:[(0,_.jsxs)("div",{className:k("crewlet-sheet-grid__header",`crewlet-sheet-grid__header--${g.type}`),children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:g.label}),y?(0,_.jsx)("span",{className:"crewlet-sheet-grid__sort",children:(0,_.jsx)(ru,{size:"xs"})}):null]}),(st.get(g.field)??[]).map((x,D)=>(0,_.jsx)("div",{className:k("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${g.type}`),children:(0,_.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,_.jsx)(qp,{column:g,value:x,context:z})})},D))]},g.field))}):null,(0,_.jsx)(Ht,{id:w0,children:Fy}),(0,_.jsx)(Ht,{id:y0,children:[H.keyboardHelp,tt?H.rowActionsHelp:"",He?H.columnSettingsHelp:""].filter(Boolean).join(" ")}),(0,_.jsx)(Ht,{children:(0,_.jsx)("span",{role:"status","aria-live":"polite",children:(0,_.jsx)("span",{children:t0.text},t0.n)})}),i||S?(0,_.jsxs)("div",{className:"crewlet-sheet-grid__foot",children:[i&&Oe?(0,_.jsx)(ka,{size:"small",variant:"ghost",onClick:i,leadingIcon:(0,_.jsx)(ou,{size:"sm"}),children:H.addRow}):null,S?(0,_.jsxs)("span",{className:k("crewlet-sheet-grid__sync",((S.failed??0)>0||!S.offline&&(S.refused??0)>0)&&"crewlet-sheet-grid__sync--failed"),children:[(0,_.jsx)("span",{children:H.sync(S)}),(S.failed??0)>0&&h?(0,_.jsx)(ka,{size:"small",variant:"ghost",onClick:h,children:H.retry}):null,(S.failed??0)===0&&(S.refused??0)>0&&T?(0,_.jsx)(ka,{size:"small",variant:"ghost",onClick:T,children:H.dismiss}):null]}):null]}):null]})}function gi(e){return!e.currentTarget.contains(e.target)}function Up(e,t){return`${e}-r${t.row<0?"h":t.row}-c${t.col}`}function m_(e,t,a){let n=t.get(xa(e.id,a));return n===void 0||e.refused?.[a]!==void 0?e:{...e,refused:{...e.refused,[a]:n}}}var Xp="crewlet:ready";function Qp(e=window){let t=e.crewlet;return t?Ko(t):new Promise(a=>{let n=()=>{let l=e.crewlet;l&&(e.removeEventListener(Xp,n),a(Ko(l)))};e.addEventListener(Xp,n)})}function Ko(e){return e.ready.then(()=>e)}function Sy(){let e=crypto.getRandomValues(new Uint8Array(12));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}var Ga=j(be(),1),Da={noData:"This sheet cannot load, because this version of the page was published without access to its data.",noColumns:e=>`The \u201C${e}\u201D collection has no columns yet.`,loadFailed:(e,t)=>t==="forbidden"?`You do not have access to the \u201C${e}\u201D collection.`:t==="not_found"?`This page has no collection named \u201C${e}\u201D.`:`The \u201C${e}\u201D collection could not be loaded. Reload the page to try again.`,inSheet:e=>e===1?"1 other person is in this sheet":`${e} other people are in this sheet`,stepOvertaken:e=>`Somebody changed this after you, so the ${e} was skipped.`,addRowFailed:e=>`Could not add a row. ${e}`,deleteRowTitle:"Delete this row?",deleteRowMessage:"The row is removed for everyone who can open this page.",deleteRowConfirm:"Delete row",deleteRowCancel:"Cancel"};function pu(e,t){console.warn(`[crewlet artifact-kit] ${e}`,t)}function Zp(e){return e.verdict==="applied"||e.verdict==="pending"?null:Ro(e.verdict,e.reason,Yl)}function gu(e){let t=typeof e?.code=="string"?e.code:"",a=e instanceof Error?e.message:void 0;return Ro(t,a,Yl)}function Ay(e,t){let{capabilities:a}=e;return{settled:t,db:a.has("db"),presence:a.has("presence"),identity:a.has("identity")}}var v_=(e,t)=>e.settled===t.settled&&e.db===t.db&&e.presence===t.presence&&e.identity===t.identity;function w_(e){let[t,a]=(0,F.useState)(()=>Ay(e,!1));return(0,F.useEffect)(()=>{let n=!0,l=r=>{let i=Ay(e,r);a(o=>v_(o,i)?o:i)};return l(!1),e.ready.then(()=>{n&&l(!0)}),()=>{n=!1}},[e]),t}function My({runtime:e,collection:t,columns:a,sort:n,frozen:l,readOnly:r=!1,label:i,height:o}){let s=w_(e),c=s.db,d=s.presence,v=s.identity,u=(0,F.useMemo)(()=>e.data.collection(t),[e,t]),[m,b]=(0,F.useState)(null),[y,S]=(0,F.useState)(void 0),[h,f]=(0,F.useState)([]),[p,w]=(0,F.useState)(null),[T,C]=(0,F.useState)(n),[N,O]=(0,F.useState)(null),[I,R]=(0,F.useState)([]),[te,Se]=(0,F.useState)([]),[me,q]=(0,F.useState)(!1),[H,Ve]=(0,F.useState)(0),[z,Y]=(0,F.useState)({text:"",n:0}),[P,Ze]=(0,F.useState)(null),et=(0,F.useCallback)(V=>Y(Q=>({text:V,n:Q.n+1})),[]),[,Dt]=(0,F.useState)(0),st=(0,F.useRef)(new Map),G=(0,F.useMemo)(()=>new $f,[]);(0,F.useEffect)(()=>C(n),[n]),(0,F.useEffect)(()=>G.subscribe(()=>Dt(V=>V+1)),[G]),(0,F.useEffect)(()=>{if(!c)return;let V=!0;return e.data.schema().then(Q=>{if(!V)return;let ut=Q.find(sa=>sa.name===t)??null;S(ut?.title),a||b(fw(ut))}).catch(Q=>{pu(`the schema of ${t} could not be read`,Q),V&&!a&&b([])}),()=>{V=!1}},[e,a,c,t]),(0,F.useEffect)(()=>{if(c)return w(null),u.subscribe(V=>f(V.map(Q=>({id:Q.id,values:Q.data}))),V=>w(Da.loadFailed(t,V.code)))},[u,c,t]),(0,F.useEffect)(()=>{if(!v)return;let V=!0;return e.identity.me().then(Q=>{V&&O(Q)}).catch(Q=>pu("the reader could not be identified",Q)),e.identity.people().then(Q=>{V&&R(Q.map(yw))}).catch(Q=>pu("the people a person cell offers could not be listed",Q)),()=>{V=!1}},[e,v]);let se=(0,F.useMemo)(()=>vw(a??m??[],l),[a,m,l]);(0,F.useEffect)(()=>{if(d)return Se(e.presence.roster().members),e.presence.subscribe(V=>Se(V.members))},[e,d]),(0,F.useEffect)(()=>{if(e.connection)return q(e.connection.state==="offline"),e.connection.subscribe(V=>q(V==="offline"))},[e]);let ct=(0,F.useMemo)(()=>{let V=xw(te,st.current);return st.current=V,V},[te]),A=N?.seat??null,oe=(0,F.useMemo)(()=>_w(te,t,A,ct),[te,t,A,ct]),Je=(0,F.useMemo)(()=>Ew(Tw(te,t),A,ct),[te,t,A,ct]),L=(0,F.useCallback)(V=>{let Q=V.map(ie=>G.begin(ie.rowId,ie.field)),ut=ie=>{for(let Ql of Q)Ql(ie===null?{ok:!0}:{ok:!1,message:ie})},sa=ie=>({[ie.field]:ie.value}),La;if(V.length===1){let[ie]=V;La=u.merge(ie.rowId,sa(ie))}else{let ie=e.data.batch();for(let Ql of V)ie.merge(t,Ql.rowId,sa(Ql));La=ie.commit()}La.then(ie=>ut(Zp(ie)),ie=>ut(gu(ie)))},[t,G,e,u]),X=(0,F.useCallback)(()=>{u.set(Sy(),{}).then(V=>{let Q=Zp(V);Ve(ut=>Q===null?0:ut+1),Q!==null&&et(Da.addRowFailed(Q))},V=>{Ve(Q=>Q+1),et(Da.addRowFailed(gu(V)))})},[u,et]),Oe=(0,F.useCallback)(V=>{let Q=se[0],ut=Q?G.begin(V,Q.field):()=>{};u.delete(V).then(sa=>{let La=Zp(sa);if(ut(La===null?{ok:!0}:{ok:!1,message:La}),La===null)for(let ie of se)G.dismiss(V,ie.field)},sa=>ut({ok:!1,message:gu(sa)}))},[se,G,u]),tt=(0,F.useCallback)(V=>{e.data[V]().then(Q=>{Q===null||Q.verdict==="applied"||Q.verdict==="pending"||et(Q.verdict==="conflict"?Da.stepOvertaken(V):Ro(Q.verdict,Q.reason,Yl))},Q=>et(gu(Q)))},[e,et]),He=(0,F.useRef)({active:null,editing:null}),at=(0,F.useCallback)(()=>{if(!d)return;let{active:V,editing:Q}=He.current,ut=Q??V,sa=ut?{collection:t,doc:ut.rowId,field:ut.field}:{};e.presence.set({activity:Q?"editing":"viewing",focus:sa})},[e,d,t]),Ft=(0,F.useCallback)(V=>{He.current.active=V,at()},[at]),Mn=(0,F.useCallback)(V=>{He.current.editing=V,at()},[at]);if(!c)return s.settled?(0,Ga.jsx)(ri,{variant:"warning",children:Da.noData}):null;if(p!==null)return(0,Ga.jsx)(ri,{variant:"warning",children:p});if(se.length===0&&(a!==null||m!==null))return(0,Ga.jsx)(ri,{variant:"neutral",children:Da.noColumns(t)});let Ot=r||N?.role==="viewer",mi={...G.sync(me),failed:H},Ea=P===null?void 0:h.find(V=>V.id===P);return(0,Ga.jsxs)("div",{className:"crewlet-kit-sheet",children:[Je.length>0?(0,Ga.jsx)("div",{className:"crewlet-kit-sheet__presence",children:(0,Ga.jsx)(Dp,{members:Je,self:!1,size:"xs",label:Da.inSheet(Je.length)})}):null,(0,Ga.jsx)(Ip,{label:i??y??t,columns:se,rows:G.decorate(h),people:I,mode:Ot?"read":"edit",onEdit:Ot?void 0:L,onAddRow:Ot?void 0:X,onDeleteRow:Ot?void 0:Ze,onActiveCellChange:Ft,onEditingChange:Mn,onOpenLink:V=>{e.openLink(V).catch(Q=>pu("a link could not be opened",Q))},onUndo:()=>tt("undo"),onRedo:()=>tt("redo"),presence:oe,sort:T,onSortChange:C,sync:Ot?void 0:mi,onRetry:H>0?X:void 0,onDismissRefused:()=>G.dismissAll(),height:o,fit:"content"}),(0,Ga.jsx)(xp,{open:Ea!==void 0,onClose:()=>Ze(null),onConfirm:()=>{Ea&&Oe(Ea.id),Ze(null)},title:Da.deleteRowTitle,message:Da.deleteRowMessage,confirmLabel:Da.deleteRowConfirm,cancelLabel:Da.deleteRowCancel,destructive:!0}),z.text?(0,Ga.jsx)(ri,{variant:"warning",live:"polite",children:z.text},z.n):null]})}var zy=j(be(),1);function Oy(e,t){let a=e.ownerDocument.createElement("div");a.className="crewlet-kit-sheet__root",e.append(a);let n=(0,Ny.createRoot)(a),l=t,r=null,i=!1,o=()=>{i||!r||n.render((0,zy.jsx)(My,{runtime:r,collection:l.collection,columns:l.columns&&l.columns.length>0?l.columns:null,sort:l.sort??null,frozen:l.frozen,readOnly:l.readOnly,label:l.label,height:l.height}))},s=c=>{c.then(d=>{r=d,o()})};return s(t.runtime?Ko(t.runtime):Qp(e.ownerDocument.defaultView??window)),{update(c){l=c,c.runtime&&c.runtime!==r&&s(Ko(c.runtime)),o()},unmount(){i=!0,n.unmount(),a.remove()}}}var Io=class extends HTMLElement{static get observedAttributes(){return pw}attributeChangedCallback(){this.closest("crewlet-sheet")?.dispatchEvent(new Event("crewlet-columnchange"))}toColumn(){return gw(t=>this.getAttribute(t))}},y_=["collection","sort","frozen","readonly","label","height"],mu=class extends HTMLElement{constructor(){super(...arguments);on(this,"mounted",null);on(this,"observer",typeof MutationObserver=="function"?new MutationObserver(()=>this.refresh()):null);on(this,"onColumnChange",()=>this.refresh())}static get observedAttributes(){return y_}connectedCallback(){this.addEventListener("crewlet-columnchange",this.onColumnChange),this.observer?.observe(this,{childList:!0}),this.refresh()}disconnectedCallback(){this.removeEventListener("crewlet-columnchange",this.onColumnChange),this.observer?.disconnect(),this.mounted?.unmount(),this.mounted=null}attributeChangedCallback(){this.isConnected&&this.refresh()}options(){let a=this.getAttribute("collection")?.trim();if(!a)return null;let n=[...this.children].filter(s=>s instanceof Io).map(s=>s.toColumn()).filter(s=>s!==null),l=Number(this.getAttribute("frozen")),r=Number(this.getAttribute("height")),i={collection:a,columns:n,sort:mw(this.getAttribute("sort")),readOnly:this.hasAttribute("readonly")};this.hasAttribute("frozen")&&Number.isInteger(l)&&l>=0&&(i.frozen=l),this.hasAttribute("height")&&Number.isFinite(r)&&r>0&&(i.height=r);let o=this.getAttribute("label")?.trim();return o&&(i.label=o),i}refresh(){let a=this.options();if(!a){this.mounted?.unmount(),this.mounted=null;return}this.mounted?this.mounted.update(a):this.mounted=Oy(this,a)}};function Jp(e=customElements){e.get("crewlet-column")||e.define("crewlet-column",Io),e.get("crewlet-sheet")||e.define("crewlet-sheet",mu)}Jp();export{Io as CrewletColumnElement,mu as CrewletSheetElement,Xp as RUNTIME_READY_EVENT,Jp as defineElements,Oy as mountSheet,Qp as whenRuntime};
|