@crewlethq/artifact-kit 0.42.0 → 0.43.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/package.json +4 -4
package/dist/kit.js
CHANGED
|
@@ -9,4 +9,4 @@ Error generating stack: `+n.message+`
|
|
|
9
9
|
`).replace(H4,"")}function pv(e,t){return t=g2(t),g2(e)===t}function be(e,t,a,n,l,i){switch(a){case"children":if(typeof n=="string")t==="body"||t==="textarea"&&n===""||Ri(e,n);else if(typeof n=="number"||typeof n=="bigint")t!=="body"&&Ri(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":dm(e,n,i);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=Ds(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 i=="function"&&(a==="formAction"?(t!=="input"&&be(e,t,"name",l.name,l,null),be(e,t,"formEncType",l.formEncType,l,null),be(e,t,"formMethod",l.formMethod,l,null),be(e,t,"formTarget",l.formTarget,l,null)):(be(e,t,"encType",l.encType,l,null),be(e,t,"method",l.method,l,null),be(e,t,"target",l.target,l,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=Ds(n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=Ia);return;case"onScroll":n!=null&&te("scroll",e);return;case"onScrollEnd":n!=null&&te("scrollend",e);return;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(T(61));if(a=n.__html,a!=null){if(l.children!=null)throw Error(T(60));i?.__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=Ds(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":te("beforetoggle",e),te("toggle",e),Os(e,"popover",n);break;case"xlinkActuate":sn(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":sn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":sn(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":sn(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":sn(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":sn(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":sn(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":sn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":sn(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Os(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=a3.get(a)||a,Os(e,a,n);else return}se=!0}function vh(e,t,a,n,l,i){switch(a){case"style":dm(e,n,i);return;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(T(61));if(a=n.__html,a!=null){if(l.children!=null)throw Error(T(60));i?.__html!==a&&(e.innerHTML=a)}}break;case"children":if(typeof n=="string")Ri(e,n);else if(typeof n=="number"||typeof n=="bigint")Ri(e,""+n);else return;break;case"onScroll":n!=null&&te("scroll",e);return;case"onScrollEnd":n!=null&&te("scrollend",e);return;case"onClick":n!=null&&(e.onclick=Ia);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!im.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(l=a.endsWith("Capture"),i=a.slice(2,l?a.length-7:void 0),t=e[Jt]||null,t=t!=null?t[a]:null,typeof t=="function"&&e.removeEventListener(i,t,l),typeof n=="function")){typeof t!="function"&&t!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(i,n,l);break e}se=!0,a in e?e[a]=n:n===!0?e.setAttribute(a,""):Os(e,a,n)}return}se=!0}function Mt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":te("error",e),te("load",e);var n=!1,l=!1,i;for(i in a)if(a.hasOwnProperty(i)){var r=a[i];if(r!=null)switch(i){case"src":n=!0;break;case"srcSet":l=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(T(137,t));default:be(e,t,i,r,a,null)}}l&&be(e,t,"srcSet",a.srcSet,a,null),n&&be(e,t,"src",a.src,a,null);return;case"input":te("invalid",e);var o=i=r=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":r=d;break;case"checked":s=d;break;case"defaultChecked":c=d;break;case"value":i=d;break;case"defaultValue":o=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(T(137,t));break;default:be(e,t,n,d,a,null)}}sm(e,i,o,s,c,r,l,!1);return;case"select":te("invalid",e),n=r=i=null;for(l in a)if(a.hasOwnProperty(l)&&(o=a[l],o!=null))switch(l){case"value":i=o;break;case"defaultValue":r=o;break;case"multiple":n=o;default:be(e,t,l,o,a,null)}t=i,a=r,e.multiple=!!n,t!=null?Ei(e,!!n,t,!1):a!=null&&Ei(e,!!n,a,!0);return;case"textarea":te("invalid",e),i=l=n=null;for(r in a)if(a.hasOwnProperty(r)&&(o=a[r],o!=null))switch(r){case"value":n=o;break;case"defaultValue":l=o;break;case"children":i=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(T(91));break;default:be(e,t,r,o,a,null)}um(e,n,l,i);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":be(e,t,s,n,a,null));return;case"dialog":te("beforetoggle",e),te("toggle",e),te("cancel",e),te("close",e);break;case"iframe":case"object":te("load",e);break;case"video":case"audio":for(n=0;n<so.length;n++)te(so[n],e);break;case"image":te("error",e),te("load",e);break;case"details":te("toggle",e);break;case"embed":case"source":case"link":te("error",e),te("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(T(137,t));default:be(e,t,c,n,a,null)}return;default:if(kh(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&&be(e,t,o,n,a,null))}var G4={};function L4(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,i=null,r=null,o=null,s=null,c=null,d=null;for(g in a){var v=a[g];if(a.hasOwnProperty(g)&&v!=null)switch(g){case"checked":break;case"value":break;case"defaultValue":s=v;default:n.hasOwnProperty(g)||be(e,t,g,null,n,v)}}for(var u in n){var g=n[u];if(v=a[u],n.hasOwnProperty(u)&&(g!=null||v!=null))switch(u){case"type":g!==v&&(se=!0),i=g;break;case"name":g!==v&&(se=!0),l=g;break;case"checked":g!==v&&(se=!0),c=g;break;case"defaultChecked":g!==v&&(se=!0),d=g;break;case"value":g!==v&&(se=!0),r=g;break;case"defaultValue":g!==v&&(se=!0),o=g;break;case"children":case"dangerouslySetInnerHTML":if(g!=null)throw Error(T(137,t));break;default:g!==v&&be(e,t,u,g,n,v)}}Cd(e,r,o,s,c,d,i,l);return;case"select":g=r=o=u=null;for(i in a)if(s=a[i],a.hasOwnProperty(i)&&s!=null)switch(i){case"value":break;case"multiple":g=s;default:n.hasOwnProperty(i)||be(e,t,i,null,n,s)}for(l in n)if(i=n[l],s=a[l],n.hasOwnProperty(l)&&(i!=null||s!=null))switch(l){case"value":i!==s&&(se=!0),u=i;break;case"defaultValue":i!==s&&(se=!0),o=i;break;case"multiple":i!==s&&(se=!0),r=i;default:i!==s&&be(e,t,l,i,n,s)}t=o,a=r,n=g,u!=null?Ei(e,!!a,u,!1):!!n!=!!a&&(t!=null?Ei(e,!!a,t,!0):Ei(e,!!a,a?[]:"",!1));return;case"textarea":g=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:be(e,t,o,null,n,l)}for(r in n)if(l=n[r],i=a[r],n.hasOwnProperty(r)&&(l!=null||i!=null))switch(r){case"value":l!==i&&(se=!0),u=l;break;case"defaultValue":l!==i&&(se=!0),g=l;break;case"children":break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(T(91));break;default:l!==i&&be(e,t,r,l,n,i)}cm(e,u,g);return;case"option":for(var w in a)u=a[w],a.hasOwnProperty(w)&&u!=null&&!n.hasOwnProperty(w)&&(w==="selected"?e.selected=!1:be(e,t,w,null,n,u));for(s in n)u=n[s],g=a[s],n.hasOwnProperty(s)&&u!==g&&(u!=null||g!=null)&&(s==="selected"?(u!==g&&(se=!0),e.selected=u&&typeof u!="function"&&typeof u!="symbol"):be(e,t,s,u,n,g));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 b in a)u=a[b],a.hasOwnProperty(b)&&u!=null&&!n.hasOwnProperty(b)&&be(e,t,b,null,n,u);for(c in n)if(u=n[c],g=a[c],n.hasOwnProperty(c)&&u!==g&&(u!=null||g!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(T(137,t));break;default:be(e,t,c,u,n,g)}return;default:if(kh(t)){for(var M in a)u=a[M],a.hasOwnProperty(M)&&u!==void 0&&!n.hasOwnProperty(M)&&vh(e,t,M,void 0,n,u);for(d in n)u=n[d],g=a[d],!n.hasOwnProperty(d)||u===g||u===void 0&&g===void 0||vh(e,t,d,u,n,g);return}}for(var p in a)u=a[p],a.hasOwnProperty(p)&&u!=null&&!n.hasOwnProperty(p)&&be(e,t,p,null,n,u);for(v in n)u=n[v],g=a[v],!n.hasOwnProperty(v)||u===g||u==null&&g==null||be(e,t,v,u,n,g)}function v2(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function U4(){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],i=l.transferSize,r=l.initiatorType,o=l.duration;if(i&&o&&v2(r)){for(r=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&&v2(v)&&(s=s.responseEnd,r+=d*(s<o?1:(o-c)/(s-c)))}if(--n,t+=8*(i+r)/(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 yh=null,bh=null;function uo(e){return e.nodeType===9?e:e.ownerDocument}function y2(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 mv(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 gv(e,t,a,n){return a=uo(a).createElement(e),a[_t]=n,a[Jt]=t,Mt(a,e,t),pt(a),a}function wh(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 B4(){var e=window.event;return e&&e.type==="popstate"?e===pd?!1:(pd=e,!0):(pd=null,!1)}var wf=typeof setTimeout=="function"?setTimeout:void 0,V4=typeof clearTimeout=="function"?clearTimeout:void 0,b2=typeof Promise=="function"?Promise:void 0,w2=typeof requestAnimationFrame=="function"?requestAnimationFrame:wf,q4=typeof queueMicrotask=="function"?queueMicrotask:typeof b2<"u"?function(e){return b2.resolve(null).then(e).catch(Y4)}:wf;function Y4(e){setTimeout(function(){throw e})}function rl(e){return e==="head"}function x2(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),Ki(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")gd(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,gd(a);for(var i=a.firstChild;i;){var r=i.nextSibling,o=i.nodeName;i[wo]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&i.rel.toLowerCase()==="stylesheet"||a.removeChild(i),i=r}}else a==="body"&&gd(e.ownerDocument.body);a=l}while(a);Ki(t)}function _2(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 vv(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 i=t[l];0<i.width&&0<i.height&&n++}n===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+a.paddingTop,e.marginBottom="-"+a.paddingBottom)}}function yv(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 bv(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 bv(t,a,e)}function j4(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var a=getComputedStyle(e);return bv(t,a,e)}function K4(e){return e.documentElement.clientHeight}function X4(e){this.addEventListener("load",e),this.addEventListener("error",e)}function I4(e,t,a,n,l,i,r,o,s){var c=t.nodeType===9?t:t.ownerDocument;try{var d=c.startViewTransition({update:function(){var u=c.defaultView,g=u.navigation&&u.navigation.transition,w=c.fonts.status;n();var b=[];if(w==="loaded"&&(K4(c),c.fonts.status==="loading"&&b.push(c.fonts.ready)),w=b.length,e!==null)for(var M=e.suspenseyImages,p=0,h=0;h<M.length;h++){var f=M[h];if(!f.complete){var y=f.getBoundingClientRect();if(0<y.bottom&&0<y.right&&y.top<u.innerHeight&&y.left<u.innerWidth){if(p+=Ov(f),p>Qs){b.length=w;break}f=new Promise(X4.bind(f)),b.push(f)}}}if(0<b.length)return u=Promise.race([Promise.all(b),new Promise(function(E){return setTimeout(E,500)})]).then(l,l),(g?Promise.allSettled([g.finished,u]):u).then(i,i);if(l(),g)return g.finished.then(i,i);i()},types:a});c.__reactViewTransition=d;var v=[];return d.ready.then(function(){for(var u=c.documentElement.getAnimations({subtree:!0}),g=0;g<u.length;g++){var w=u[g],b=w.effect,M=b.pseudoElement;if(M!=null&&M.startsWith("::view-transition")){v.push(w),w=b.getKeyframes();for(var p=M=void 0,h=!0,f=0;f<w.length;f++){var y=w[f],E=y.width;if(M===void 0)M=E;else if(M!==E){h=!1;break}if(E=y.height,p===void 0)p=E;else if(p!==E){h=!1;break}delete y.width,delete y.height,y.transform==="none"&&delete y.transform}h&&M!==void 0&&p!==void 0&&(b.setKeyframes(w),h=getComputedStyle(b.target,b.pseudoElement),h.width!==M||h.height!==p)&&(h=w[0],h.width=M,h.height=p,h=w[w.length-1],h.width=M,h.height=p,b.setKeyframes(w))}}r()},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(),r()}}),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(),r(),null}}function El(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}El.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:Ce({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)};El.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,a=e.getAnimations({subtree:!0}),n=[],l=0;l<a.length;l++){var i=a[l].effect;i!==null&&i.target===e&&i.pseudoElement===t&&n.push(a[l])}return n};El.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function wv(e){return{name:e,group:new El("group",e),imagePair:new El("image-pair",e),old:new El("old",e),new:new El("new",e)}}function ra(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}ra.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 i=this._eventListeners;if(xv(i,e,t,a)===-1){var r=this,o=t;a!=null&&typeof a!="boolean"&&a.once===!0&&(o=function(s){r.removeEventListener(e,t,a),typeof t=="function"?t.call(this,s):t.handleEvent(s)}),n!==null&&(l=r.removeEventListener.bind(r,e,t,a),n.addEventListener("abort",l,{once:!0}),l=n.removeEventListener.bind(n,"abort",l)),n=Vi(a),i.push({type:e,listener:t,optionsOrUseCapture:a,attachedListener:o,cleanup:l}),Zt(this._fragmentFiber.child,!1,Q4,e,o,n)}this._eventListeners=i}};function Q4(e,t,a,n){return nt(e).addEventListener(t,a,n),!1}ra.prototype.removeEventListener=function(e,t,a){var n=this._eventListeners;if(n!==null&&(t=xv(n,e,t,a),t!==-1)){var l=n[t];a=l.attachedListener;var i=l.cleanup;l=Vi(l.optionsOrUseCapture),Zt(this._fragmentFiber.child,!1,Z4,e,a,l),n.splice(t,1),i!==null&&i()}};function Z4(e,t,a,n){return nt(e).removeEventListener(t,a,n),!1}function Vi(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function E2(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function xv(e,t,a,n){if(e.length===0)return-1;n=E2(n);for(var l=0;l<e.length;l++){var i=e[l];if(i.type===t&&i.listener===a&&E2(i.optionsOrUseCapture)===n)return l}return-1}ra.prototype.dispatchEvent=function(e){var t=Ll(this._fragmentFiber);if(t===null)return!0;t=nt(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 i=a[l];n.addEventListener(i.type,i.attachedListener,Vi(i.optionsOrUseCapture))}if(t.appendChild(n),e=n.dispatchEvent(e),a)for(l=0;l<a.length;l++)i=a[l],n.removeEventListener(i.type,i.attachedListener,Vi(i.optionsOrUseCapture));return t.removeChild(n),e}return t.dispatchEvent(e)};ra.prototype.focus=function(e){Zt(this._fragmentFiber.child,!0,_v,e,void 0,void 0)};function _v(e,t){return e.tag===6?!1:(e=nt(e),rx(e,t))}ra.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&&!_v(t[a],e);a--);};function xf(e,t){return t.push(e),!1}ra.prototype.blur=function(){var e=Ll(this._fragmentFiber);e!==null&&(e=nt(e),e=uo(e).activeElement,e!==null&&Zt(this._fragmentFiber.child,!1,J4,e,void 0,void 0))};function J4(e,t){return e.tag===6?!1:(e=nt(e),e===t||e.contains(t)?(t.blur(),!0):!1)}ra.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),Zt(this._fragmentFiber.child,!1,F4,e,void 0,void 0)};function F4(e,t){return e.tag===6||(e=nt(e),t.observe(e)),!1}ra.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),Zt(this._fragmentFiber.child,!1,$4,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 $4(e,t){return e.tag===6||(e=nt(e),t.unobserve(e)),!1}var Na=[],md=!1;function W4(e,t,a){Na.push({fragmentInstance:e,observer:t,instance:a}),md||(md=!0,ox(function(){md=!1;var n=Na;Na=[];for(var l=0;l<n.length;l++){var i=n[l];i.observer.unobserve(i.instance)}}))}ra.prototype.getClientRects=function(){var e=[];return Zt(this._fragmentFiber.child,!1,P4,e,void 0,void 0),e};function P4(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=nt(e),t.push.apply(t,e.getClientRects());return!1}ra.prototype.getRootNode=function(e){var t=Ll(this._fragmentFiber);return t===null?this:nt(t).getRootNode(e)};ra.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=nt(t);if(a.length===0){if(a=n,a1(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=K2(t)[1],a===null?l=Node.DOCUMENT_POSITION_PRECEDING:(e=nt(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=nt(a[0]),l=nt(a[a.length-1]);var i=a1(this._fragmentFiber)?t.parentElement:n;if(i==null)return Node.DOCUMENT_POSITION_DISCONNECTED;n=i.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,i=i.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_CONTAINED_BY;var r=t.compareDocumentPosition(e),o=l.compareDocumentPosition(e),s=r&Node.DOCUMENT_POSITION_CONTAINED_BY||o&Node.DOCUMENT_POSITION_CONTAINED_BY;return o=n&&i&&r&Node.DOCUMENT_POSITION_FOLLOWING&&o&Node.DOCUMENT_POSITION_PRECEDING,t=n&&t===e||i&&l===e||s||o?Node.DOCUMENT_POSITION_CONTAINED_BY:!n&&t===e||!i&&l===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:r,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||ex(t,this._fragmentFiber,a[0],a[a.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function ex(e,t,a,n,l){var i=_l(l);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!i)e:{for(;i!==null;){if(i.tag===7&&(i===t||i.alternate===t)){a=!0;break e}i=i.return}a=!1}return a}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(i===null)return i=l.ownerDocument,l===i||l===i.documentElement||l===i.body;e:{for(i=t,t=Ll(t);i!==null;){if(!(i.tag!==5&&i.tag!==3&&i.tag!==27||i!==t&&i.alternate!==t)){i=!0;break e}i=i.return}i=!1}return i}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!i)&&!(t=i===a)&&(t=yd(a,i,n1),t===null?t=!1:(Zt(t,!0,zw,i,a),i=ui,ui=null,t=i!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!i)&&!(t=i===n)&&(t=yd(n,i,n1),t===null?t=!1:(Zt(t,!0,Ow,i,n),i=ui,vd=ui=null,t=i!==null)),t):!1}function T2(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)}ra.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(T(566));var t=[];Zt(this._fragmentFiber.child,!1,xf,t,void 0,void 0);var a=e!==!1;if(t.length===0){var n=K2(this._fragmentFiber);if(n=a?n[1]||n[0]||Ll(this._fragmentFiber):n[0]||n[1],n===null)return;if(n.tag===6){e=nt(n),T2(e,a);return}if(n=nt(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=nt(l),T2(l,a)):nt(l).scrollIntoView(e),n+=a?-1:1}};function tx(e,t){return e=nt(e),Ev(e,t),!1}function Ev(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Tv(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,Vi(l.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(i){for(var r=0,o=0;o<Na.length;o++){var s=Na[o];(s.fragmentInstance!==t||s.observer!==i||s.instance!==e)&&(Na[r++]=s)}Na.length=r,i.observe(e)}),Ev(e,t))}function ax(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,Vi(l.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(i){typeof i.rootMargin=="string"?W4(t,i,e):i.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),Mc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function nx(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[wo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==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(i=e.getAttribute("src"),(i!==(l.src==null?null:l.src)||e.getAttribute("type")!==(l.type==null?null:l.type)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=l.name==null?null:""+l.name;if(l.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=ya(e.nextSibling),e===null)break}return null}function lx(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=ya(e.nextSibling),e===null))return null;return e}function Sv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ya(e.nextSibling),e===null))return null;return e}function Eh(e){return e.data==="$?"||e.data==="$~"}function _f(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ix(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 ya(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 Th=null;function S2(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return ya(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function M2(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 rx(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 ox(e){w2(function(){w2(function(t){return e(t)})})}function Mv(e,t,a){switch(t=uo(a),e){case"html":if(e=t.documentElement,!e)throw Error(T(452));return e;case"head":if(e=t.head,!e)throw Error(T(453));return e;case"body":if(e=t.body,!e)throw Error(T(454));return e;default:throw Error(T(451))}}function Av(e,t,a){for(var n in a){var l=a[n];a.hasOwnProperty(n)&&l!=null&&be(e,t,n,null,G4,l)}a.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Ia&&(e.onclick=null),Mc(e)}function gd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Mc(e)}var ba=new Map,A2=new Set;function ho(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 _n=he.d;he.d={f:sx,r:cx,D:ux,C:dx,L:hx,m:fx,X:mx,S:px,M:gx};function sx(){var e=_n.f(),t=Vc();return e||t}function cx(e){var t=Ii(e);t!==null&&t.tag===5&&t.type==="form"?dg(t):_n.r(e)}var Fi=typeof document>"u"?null:document;function Nv(e,t,a){var n=Fi;if(n&&typeof t=="string"&&t){var l=ma(t);l='link[rel="'+e+'"][href="'+l+'"]',typeof a=="string"&&(l+='[crossorigin="'+a+'"]'),A2.has(l)||(A2.add(l),e={rel:e,crossOrigin:a,href:t},n.querySelector(l)===null&&(t=n.createElement("link"),Mt(t,"link",e),pt(t),n.head.appendChild(t)))}}function ux(e){_n.D(e),Nv("dns-prefetch",e,null)}function dx(e,t){_n.C(e,t),Nv("preconnect",e,t)}function hx(e,t,a){_n.L(e,t,a);var n=Fi;if(n&&e&&t){var l='link[rel="preload"][as="'+ma(t)+'"]';t==="image"&&a&&a.imageSrcSet?(l+='[imagesrcset="'+ma(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(l+='[imagesizes="'+ma(a.imageSizes)+'"]')):l+='[href="'+ma(e)+'"]';var i=l;switch(t){case"style":i=qi(e);break;case"script":i=$i(e)}if(!(ba.has(i)||(e=Ce({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ba.set(i,e),n.querySelector(l)!==null||t==="style"&&n.querySelector(Mo(i))||t==="script"&&n.querySelector(Ao(i))))){var r=n.createElement("link");Mt(r,"link",e),t==="style"&&(r[ec]=!0,r.onload=r.onerror=function(){nm(r)}),pt(r),n.head.appendChild(r)}}}function fx(e,t){_n.m(e,t);var a=Fi;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",l='link[rel="modulepreload"][as="'+ma(n)+'"][href="'+ma(e)+'"]',i=l;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=$i(e)}if(!ba.has(i)&&(e=Ce({rel:"modulepreload",href:e},t),ba.set(i,e),a.querySelector(l)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ao(i)))return}n=a.createElement("link"),Mt(n,"link",e),pt(n),a.head.appendChild(n)}}}function px(e,t,a){_n.S(e,t,a);var n=Fi;if(n&&e){var l=_i(n).hoistableStyles,i=qi(e);t=t||"default";var r=l.get(i);if(!r){var o={loading:0,preload:null};if(r=n.querySelector(Mo(i)))o.loading=5;else{e=Ce({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ba.get(i))&&Ef(e,a);var s=r=n.createElement("link");pt(s),Mt(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,Xs(r,t,n)}r={type:"stylesheet",instance:r,count:1,state:o},l.set(i,r)}}}function mx(e,t){_n.X(e,t);var a=Fi;if(a&&e){var n=_i(a).hoistableScripts,l=$i(e),i=n.get(l);i||(i=a.querySelector(Ao(l)),i||(e=Ce({src:e,async:!0},t),(t=ba.get(l))&&Tf(e,t),i=a.createElement("script"),pt(i),Mt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(l,i))}}function gx(e,t){_n.M(e,t);var a=Fi;if(a&&e){var n=_i(a).hoistableScripts,l=$i(e),i=n.get(l);i||(i=a.querySelector(Ao(l)),i||(e=Ce({src:e,async:!0,type:"module"},t),(t=ba.get(l))&&Tf(e,t),i=a.createElement("script"),pt(i),Mt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(l,i))}}function N2(e,t,a,n){var l=(l=Kn.current)?ho(l):null;if(!l)throw Error(T(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=qi(a.href),t=_i(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=qi(a.href);var i=_i(l).hoistableStyles,r=i.get(e);if(r||(l=l.ownerDocument||l,r={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,r),(i=l.querySelector(Mo(e)))?i._p||(r.instance=i,r.state.loading=5):(i=ba.get(e),i||(i={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ba.set(e,i)),vx(l,e,i,r.state))),t&&n===null)throw Error(T(528,""));return r}if(t&&n!==null)throw Error(T(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(a=$i(a),t=_i(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(T(444,e))}}function qi(e){return'href="'+ma(e)+'"'}function Mo(e){return'link[rel="stylesheet"]['+e+"]"}function Cv(e){return Ce({},e,{"data-precedence":e.precedence,precedence:null})}function vx(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=nm.bind(null,t),Mt(t,"link",a),pt(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 $i(e){return'[src="'+ma(e)+'"]'}function Ao(e){return"script[async]"+e}function C2(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+ma(a.href)+'"]');if(n)return t.instance=n,pt(n),n;var l=Ce({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),pt(n),Mt(n,"style",l),Xs(n,a.precedence,e),t.instance=n;case"stylesheet":l=qi(a.href);var i=e.querySelector(Mo(l));if(i)return t.state.loading|=4,t.instance=i,pt(i),i;n=Cv(a),(l=ba.get(l))&&Ef(n,l),i=(e.ownerDocument||e).createElement("link"),pt(i);var r=i;return r._p=new Promise(function(o,s){r.onload=o,r.onerror=s}),Mt(i,"link",n),t.state.loading|=4,Xs(i,a.precedence,e),t.instance=i;case"script":return i=$i(a.src),(l=e.querySelector(Ao(i)))?(t.instance=l,pt(l),l):(n=a,(l=ba.get(i))&&(n=Ce({},a),Tf(n,l)),e=e.ownerDocument||e,l=e.createElement("script"),pt(l),Mt(l,"link",n),e.head.appendChild(l),t.instance=l);case"void":return null;default:throw Error(T(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,Xs(n,a.precedence,e));return t.instance}function Xs(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),l=n.length?n[n.length-1]:null,i=l,r=0;r<n.length;r++){var o=n[r];if(o.dataset.precedence===t)i=o;else if(i!==l)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Ef(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Tf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Is=null;function z2(e,t,a){if(Is===null){var n=new Map,l=Is=new Map;l.set(a,n)}else l=Is,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 i=a[l];if(!(i[wo]||i[_t]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var r=i.getAttribute(t)||"";r=e+r;var o=n.get(r);o?o.push(i):n.set(r,[i])}}return n}function Sh(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function yx(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 O2(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function zv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ov(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function D2(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Ov(t),e.suspenseyImages.push(t)),e=xx.bind(e),t.decode().then(e,e))}function bx(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=qi(n.href),i=t.querySelector(Mo(l));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=i,pt(i);return}i=t.ownerDocument||t,n=Cv(n),(l=ba.get(l))&&Ef(n,l),i=i.createElement("link"),pt(i);var r=i;r._p=new Promise(function(o,s){r.onload=o,r.onerror=s}),Mt(i,"link",n),a.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=fo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Qs=0;function wx(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 i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Qs===0&&(Qs=62500*U4());var l=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Zs(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Qs?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(l)}}:null}function Dv(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 fo(){this.count--,Dv(this)}function xx(){this.imgCount--,Dv(this)}var Ec=null;function Zs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ec=new Map,t.forEach(_x,e),Ec=null,fo.call(e))}function _x(e,t){if(!(t.state.loading&4)){var a=Ec.get(e);if(a)var n=a.get(null);else{a=new Map,Ec.set(e,a);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<l.length;i++){var r=l[i];(r.nodeName==="LINK"||r.getAttribute("media")!=="not all")&&(a.set(r.dataset.precedence,r),n=r)}n&&a.set(null,n)}l=t.instance,r=l.getAttribute("data-precedence"),i=a.get(r)||n,i===n&&a.set(null,l),a.set(r,l),this.count++,n=fo.bind(this),l.addEventListener("load",n),l.addEventListener("error",n),i?i.parentNode.insertBefore(l,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(l,e.firstChild)),t.state.loading|=4}}var Yi={$$typeof:Xa,Provider:null,Consumer:null,_currentValue:Tl,_currentValue2:Tl,_threadCount:0};function Ex(e,t,a,n,l,i,r,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=i,this.onRecoverableError=r,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.transitionTypes=null,this.incompleteTransitions=new Map}function kv(e,t,a,n,l,i,r,o,s,c,d,v){return e=new Ex(e,t,a,r,s,c,d,v,o),t=1,i===!0&&(t|=24),i=It(3,null,null,t),e.current=i,i.stateNode=e,t=jh(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:n,isDehydrated:a,cache:t},Ih(i),e}function Rv(e){return e?(e=yi,e):yi}function Hv(e,t,a,n,l,i){l=Rv(l),n.context===null?n.context=l:n.pendingContext=l,n=In(t),n.payload={element:a},i=i===void 0?null:i,i!==null&&(n.callback=i),a=Qn(e,n,t),a!==null&&(Qt(a,e,t),Kr(a,e,t))}function k2(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){k2(e,t),(e=e.alternate)&&k2(e,t)}function Gv(e){if(e.tag===13||e.tag===31){var t=Vl(e,67108864);t!==null&&Qt(t,e,67108864),Sf(e,67108864)}}function R2(e){if(e.tag===13||e.tag===31){var t=la();t=Oh(t);var a=Vl(e,t);a!==null&&Qt(a,e,t),Sf(e,t)}}var ji=!0;function Tx(e,t,a,n){var l=K.T;K.T=null;var i=he.p;try{he.p=2,Mf(e,t,a,n)}finally{he.p=i,K.T=l}}function Sx(e,t,a,n){var l=K.T;K.T=null;var i=he.p;try{he.p=8,Mf(e,t,a,n)}finally{he.p=i,K.T=l}}function Mf(e,t,a,n){if(ji){var l=Mh(n);if(l===null)fd(e,t,n,Tc,a),H2(e,n);else if(Ax(l,e,t,a,n))n.stopPropagation();else if(H2(e,n),t&4&&-1<Mx.indexOf(e)){for(;l!==null;){var i=Ii(l);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var r=bl(i.pendingLanes);if(r!==0){var o=i;for(o.pendingLanes|=2,o.entangledLanes|=2;r;){var s=1<<31-na(r);o.entanglements[1]|=s,r&=~s}Pa(i),(de&6)===0&&(yc=ta()+500,So(0,!1))}}break;case 31:case 13:o=Vl(i,2),o!==null&&Qt(o,i,2),Vc(),Sf(i,2)}if(i=Mh(n),i===null&&fd(e,t,n,Tc,a),i===l)break;l=i}l!==null&&n.stopPropagation()}else fd(e,t,n,null,a)}}function Mh(e){return e=Rh(e),Af(e)}var Tc=null;function Af(e){if(Tc=null,e=_l(e),e!==null){var t=go(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=q2(t),e!==null)return e;e=null}else if(a===31){if(e=Y2(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 Tc=e,null}function Lv(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(Vw()){case Z2:return 2;case J2:return 8;case Ps:case qw:return 32;case F2:return 268435456;default:return 32}default:return 32}}var Ah=!1,$n=null,Wn=null,Pn=null,po=new Map,mo=new Map,Ln=[],Mx="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 H2(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":po.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":mo.delete(t.pointerId)}}function kr(e,t,a,n,l,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:i,targetContainers:[l]},t!==null&&(t=Ii(t),t!==null&&Gv(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function Ax(e,t,a,n,l){switch(t){case"focusin":return $n=kr($n,e,t,a,n,l),!0;case"dragenter":return Wn=kr(Wn,e,t,a,n,l),!0;case"mouseover":return Pn=kr(Pn,e,t,a,n,l),!0;case"pointerover":var i=l.pointerId;return po.set(i,kr(po.get(i)||null,e,t,a,n,l)),!0;case"gotpointercapture":return i=l.pointerId,mo.set(i,kr(mo.get(i)||null,e,t,a,n,l)),!0}return!1}function Uv(e){var t=_l(e.target);if(t!==null){var a=go(t);if(a!==null){if(t=a.tag,t===13){if(t=q2(a),t!==null){e.blockedOn=t,o1(e.priority,function(){R2(a)});return}}else if(t===31){if(t=Y2(a),t!==null){e.blockedOn=t,o1(e.priority,function(){R2(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=Mh(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=Ii(a),t!==null&&Gv(t),e.blockedOn=a,!1;t.shift()}return!0}function G2(e,t,a){Js(e)&&a.delete(t)}function Nx(){Ah=!1,$n!==null&&Js($n)&&($n=null),Wn!==null&&Js(Wn)&&(Wn=null),Pn!==null&&Js(Pn)&&(Pn=null),po.forEach(G2),mo.forEach(G2)}function Cs(e,t){e.blockedOn===t&&(e.blockedOn=null,Ah||(Ah=!0,lt.unstable_scheduleCallback(lt.unstable_NormalPriority,Nx)))}var zs=null;function L2(e){zs!==e&&(zs=e,lt.unstable_scheduleCallback(lt.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(Af(n||a)===null)continue;break}var i=Ii(a);i!==null&&(e.splice(t,3),t-=3,Id(i,{pending:!0,data:l,method:a.method,action:n},n,l))}}))}function Ki(e){function t(s){return Cs(s,e)}$n!==null&&Cs($n,e),Wn!==null&&Cs(Wn,e),Pn!==null&&Cs(Pn,e),po.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);)Uv(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],i=a[n+1],r=l[Jt]||null;if(typeof i=="function")r||L2(a);else if(r){var o=null;if(i&&i.hasAttribute("formAction")){if(l=i,r=i[Jt]||null)o=r.formAction;else if(Af(l)!==null)continue}else o=r.action;typeof o=="function"?a[n+1]=o:(a.splice(n,3),n-=3),L2(a)}}}function Bv(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(r){return l=r})},focusReset:"manual",scroll:"manual"})}function t(){l!==null&&(l(),l=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.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(T(409));var a=t.current,n=la();Hv(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;Hv(e.current,2,null,e,null,null),Vc(),t[Xi]=null}};function jc(e){this._internalRoot=e}jc.prototype.unstable_scheduleHydration=function(e){if(e){var t=am();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&&Uv(e)}};var U2=B2.version;if(U2!=="19.3.1")throw Error(T(527,U2,"19.3.1"));he.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(T(188)):(e=Object.keys(e).join(","),Error(T(268,e)));return e=Cw(t),e=e!==null?j2(e):null,e=e===null?null:e.stateNode,e};var Cx={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:K,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Rr=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Rr.isDisabled&&Rr.supportsFiber))try{vo=Rr.inject(Cx),aa=Rr}catch{}var Rr;Kc.createRoot=function(e,t){if(!V2(e))throw Error(T(299));var a=!1,n="",l=bg,i=wg,r=xg;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&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=kv(e,1,!1,null,null,a,n,null,l,i,r,Bv),e[Xi]=t.current,bf(e),new Nf(t)};Kc.hydrateRoot=function(e,t,a){if(!V2(e))throw Error(T(299));var n=!1,l="",i=bg,r=wg,o=xg,s=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(l=a.identifierPrefix),a.onUncaughtError!==void 0&&(i=a.onUncaughtError),a.onCaughtError!==void 0&&(r=a.onCaughtError),a.onRecoverableError!==void 0&&(o=a.onRecoverableError),a.formState!==void 0&&(s=a.formState)),t=kv(e,1,!0,t,a??null,n,l,s,i,r,o,Bv),t.context=Rv(null),a=t.current,n=la(),n=Oh(n),l=In(n),l.callback=null,Qn(a,l,n),a=n,t.current.lanes=a,bo(t,a),Pa(t),e[Xi]=t.current,bf(e),new jc(t)};Kc.version="19.3.1"});var jv=Ua((M_,Yv)=>{"use strict";function qv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qv)}catch(e){console.error(e)}}qv(),Yv.exports=Vv()});var ry=Ua(lu=>{"use strict";var Ix=Symbol.for("react.transitional.element"),Qx=Symbol.for("react.fragment");function iy(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:Ix,type:e,key:n,ref:t!==void 0?t:null,props:a}}lu.Fragment=Qx;lu.jsx=iy;lu.jsxs=iy});var Te=Ua((X_,oy)=>{"use strict";oy.exports=ry()});var Tb=X(jv(),1);var Xc=["purple","cyan","green","amber","rose","blue"];var No=e=>typeof e=="string"&&Xc.includes(e);var Kv={editing:{human:0,agent:1},viewing:{human:2,agent:3},idle:{human:4,agent:5}};function Cf(e){return e.map((t,a)=>({member:t,index:a})).sort((t,a)=>Kv[t.member.activity][t.member.kind]-Kv[a.member.activity][a.member.kind]||t.index-a.index).map(({member:t})=>t)}var Ic=Xc.filter(e=>e!=="purple");function zf(e,t=new Map){let a=new Map,n=new Map(Ic.map(i=>[i,0])),l=(i,r)=>{a.set(i,r),n.set(r,(n.get(r)??0)+1)};for(let i of e)i.kind==="agent"&&i.hue!==void 0&&l(i.id,i.hue);for(let i of e){if(a.has(i.id))continue;let r=t.get(i.id);r!==void 0&&l(i.id,r)}for(let i of e){if(a.has(i.id))continue;let r=Ic[0];for(let o of Ic)(n.get(o)??0)<(n.get(r)??0)&&(r=o);l(i.id,r)}return a}function Xv(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 Co={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}, ${Co.activity(e.activity,e.kind).toLowerCase()}`,more:e=>`${e} more`,editing:e=>`${e} is editing`,alsoHere:e=>e.length===0?"":`${Xv(e)} ${e.length===1?"is":"are"} also here.`};function zo(e){return{...Co,...e}}var Zv=["text","longtext","number","checkbox","select","multiselect","status","person","date","url","rating"],Zc=e=>typeof e=="string"&&Zv.includes(e);var zx={text:"Text",longtext:"Long text",number:"Number",checkbox:"Checkbox",select:"Select",multiselect:"Multi-select",status:"Status",person:"Person",date:"Date",url:"URL",rating:"Rating"},Of=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:zx,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. ${Of(e.saving)} will sync when you reconnect.`:e.failed!==void 0&&e.failed>0?"Could not save.":e.refused!==void 0&&e.refused>0?`${Of(e.refused)} not saved`:e.saving>0?`Saving ${Of(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 Oo(e){return{...Yl,...e,types:{...Yl.types,...e?.types}}}var Ox={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 No(t)?t:Ox[t]??"neutral"}var Dx=["neutral","info","success","warning","danger"],kx={green:"success",amber:"warning",rose:"danger",blue:"info",cyan:"info",purple:"neutral"},Rx={todo:"neutral",in_progress:"info",done:"success",blocked:"danger"};function Fc(e){let t=e.color?.trim().toLowerCase();if(t!==void 0&&Dx.includes(t))return t;if(t!==void 0){let a=Jc(t);if(a!=="neutral")return kx[a]}return e.category?Rx[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 Rf(e){let t=new Set,a=[];for(let n of e.split(",")){let[l="",i]=n.split(":"),r=l.trim();if(r==="")continue;let o=r.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=i?.trim();a.push(s?{id:o,label:r,color:s}:{id:o,label:r})}return a}var Jv=1e3,Fv=2e4,$v=2048,Df=5,Wv=10,Pv=1900,ey=2200;function en(e){let t=e.max??Df;return Number.isInteger(t)&&t>=1?Math.min(t,Wv):Df}function ol(e){return e.maxLength??(e.type==="longtext"?Fv:Jv)}var Hx=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 Hx(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 Wi(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((a,n)=>a===t[n]):e===t}function Pi(e,t){return e?.find(a=>a.id===t)}function Gx(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 Lx=/^(\d{4})-(\d{2})-(\d{2})$/;function ty(e){let t=Lx.exec(e);if(!t)return null;let a=Number(t[1]),n=Number(t[2]),l=Number(t[3]),i=new Date(Date.UTC(a,n-1,l));return i.getUTCFullYear()!==a||i.getUTCMonth()!==n-1||i.getUTCDate()!==l||a<Pv||a>ey?null:{year:a,month:n,day:l}}function wa(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"?Gx(e,l).format(t):"";case"rating":return typeof t=="number"?n.rating(t,en(e)):"";case"select":case"status":{let i=En(e,String(t));return i?i.archived?n.archived(i.label):i.label:String(t)}case"multiselect":return t.map(i=>{let r=En(e,i);return r?r.archived?n.archived(r.label):r.label:i}).join(", ");case"person":return Pi(a.people,String(t))?.name??n.unknownPerson;case"date":{let i=String(t);if(ty(i))return new Intl.DateTimeFormat(l,{dateStyle:"medium",timeZone:"UTC"}).format(new Date(`${i}T00:00:00Z`));let r=Date.parse(i);return Number.isNaN(r)?i:new Intl.DateTimeFormat(l,{dateStyle:"medium",timeStyle:"short"}).format(r)}default:return String(t)}}function er(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"?`${kf(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 Pi(a.people,String(t))?.name??String(t);default:return String(t)}}function kf(e,t){let a=10**t;return Math.round(e*a)/a}var it=e=>({ok:!1,error:e});function Iv(e,t){let a=t.trim().toLowerCase(),n=jl(e),l=n.find(i=>i.id===t.trim())??n.find(i=>i.label.toLowerCase()===a);return l?l.id:null}function Ux(e,t){let a=t.trim().toLowerCase();if(!e||a==="")return null;let n=e.find(i=>i.id===t.trim()||i.name.toLowerCase()===a);if(n)return n.id;let l=e.filter(i=>i.name.toLowerCase().startsWith(a));return l.length===1?l[0].id:null}var Bx=new Set(["true","yes","y","1","x","checked","on","\u2713","\u2714"]),Vx=new Set(["false","no","n","0","","unchecked","off"]);function qx(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 i=Number(n);if((l||e.numberStyle==="percent")&&(i/=100),!Number.isFinite(i))return it(a.notANumber(e.label));e.precision!==void 0&&(i=kf(i,e.precision));let r=o=>e.numberStyle==="percent"?`${kf(o*100,10)}%`:String(o);return e.min!==void 0&&i<e.min?it(a.belowMin(e.label,r(e.min))):e.max!==void 0&&i>e.max?it(a.aboveMax(e.label,r(e.max))):{ok:!0,value:i}}function Yx(e,t,a){let n=t.trim();if(!e.time)return ty(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 i=new Date(l).getUTCFullYear();return i<Pv||i>ey?it(a.notADate(e.label)):{ok:!0,value:new Date(l).toISOString().replace(/\.000Z$/,"Z")}}function jx(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>$v||l.host===""?it(a.notAUrl(e.label)):{ok:!0,value:n}}function tr(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 i=t.trim().toLowerCase();return Bx.has(i)?{ok:!0,value:!0}:Vx.has(i)?{ok:!0,value:!1}:it(n.notABoolean(e.label))}case"number":return qx(e,t,n);case"rating":{let i=en(e),r=t.trim(),o=/^★+$/.test(r)?r.length:Number(r);return o===0?e.required?it(n.required(e.label)):{ok:!0,value:null}:!Number.isInteger(o)||o<1||o>i?it(n.notARating(e.label,i)):{ok:!0,value:o}}case"text":{let i=t.replace(/\s*[\r\n]+\s*/g," ");return i.length>ol(e)?it(n.tooLong(e.label,ol(e))):{ok:!0,value:i}}case"longtext":return t.length>ol(e)?it(n.tooLong(e.label,ol(e))):{ok:!0,value:t};case"select":case"status":{let i=Iv(e,t);return i===null?it(n.notAnOption(e.label)):{ok:!0,value:i}}case"multiselect":{let i=[];for(let r of t.split(/[,;\n]/)){if(r.trim()==="")continue;let o=Iv(e,r);if(o===null)return it(n.notAnOption(e.label));i.includes(o)||i.push(o)}return e.maxItems!==void 0&&i.length>e.maxItems?it(n.tooManyItems(e.label,e.maxItems)):{ok:!0,value:i}}case"person":{let i=Ux(a.people,t);return i===null?it(n.notAPerson(e.label)):{ok:!0,value:i}}case"date":return Yx(e,t,n);case"url":return jx(e,t,n)}}function Hf(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(i=>i.id));return t.every(i=>l.has(i)||En(e,i)?.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"&&Pi(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=tr(e,er(e,t,a),a);return l.ok?null:l.error}}}function ay(e,t,a,n){let l=e.type!=="checkbox"&&tn(t),i=e.type!=="checkbox"&&tn(a);if(l||i)return l===i?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 r=o=>(e.options??[]).findIndex(s=>s.id===o);return r(t)-r(a)}default:return wa(e,t,n).localeCompare(wa(e,a,n),n.locale,{numeric:!0})}}var Kl=e=>!!(e.ctrlKey||e.metaKey),Qv=(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 i=Kl(t);switch(t.key){case"ArrowUp":return{row:i?e.row<0?-1:0:Math.max(e.row-1,-1),col:e.col};case"ArrowDown":return n<0?e:{row:i?n:Qv(e.row+1,-1,n),col:e.col};case"ArrowLeft":return{row:e.row,col:i?0:Math.max(e.col-1,0)};case"ArrowRight":return{row:e.row,col:i?l:Math.min(e.col+1,l)};case"Home":return i?{row:n<0?-1:0,col:0}:{row:e.row,col:0};case"End":return i?{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:Qv(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 i=t>0?t:a*40,r=Math.max(0,Math.floor(e/a)-l),o=Math.min(n-1,Math.ceil((e+i)/a)+l);return[r,o]}function Vf(e,t,a,n,l){let i=e*n,r=i+n,o=t,s=t+Math.max(a-l,n);return i<o?i:r>s?r-Math.max(a-l,n):t}function qf(e,t,a,n,l){let i=n-t,r=e-a;return i>=l||i>=r?"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},Xl=52,Wc=32,an=e=>e.width!==void 0&&e.width>0?e.width:$c[e.type];function Yf(e){let t=[],a=Xl;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]},ny=8;function Xf(e,t){if(!(t>0))return $c[e];let[a,n]=Pc[e];return Math.min(n,Math.max(a,Math.ceil(t)))}function If(e,t,a,n=ny){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 i of t){let r=Rt(e,i.values[e.field]);if(tn(r))continue;let o=wa(e,r,a).length;l.length===n&&o<=l[n-1].length||(l.push({value:r,length:o}),l.sort((s,c)=>c.length-s.length),l.length>n&&l.pop())}return l.map(i=>i.value)}}}function Kx(e){return/[\t\n\r"]/.test(e)?`"${e.replaceAll('"','""')}"`:e}function Qf(e,t,a,n){let l=[];for(let i=a.top;i<=a.bottom;i+=1){let r=t[i];if(!r)continue;let o=[];for(let s=a.left;s<=a.right;s+=1){let c=e[s];c&&o.push(Kx(er(c,Rt(c,r.values[c.field]),n)))}l.push(o.join(" "))}return l.join(`
|
|
10
10
|
`)}function Zf(e){let t=[],a=[],n="",l=!1,i=0,r=e.replace(/\r\n?/g,`
|
|
11
11
|
`);for(;i<r.length;){let o=r[i];if(l){if(o==='"'&&r[i+1]==='"'){n+='"',i+=2;continue}if(o==='"'){l=!1,i+=1;continue}n+=o,i+=1;continue}o==='"'&&n===""?l=!0:o===" "?(a.push(n),n=""):o===`
|
|
12
|
-
`?(a.push(n),t.push(a),a=[],n=""):n+=o,i+=1}return(n!==""||a.length>0)&&(a.push(n),t.push(a)),t}function Jf(e,t,a,n,l){let i={edits:[],refused:[]};if(n.length===0)return i;let r=n.length===1&&n[0].length===1,o=r?a.bottom-a.top+1:n.length,s=r?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 g=r?n[0][0]:n[c]?.[v];if(g===void 0)continue;let w=tr(u,g,l);if(!w.ok){i.refused.push({rowId:d.id,field:u.field,error:w.error});continue}Wi(w.value,Rt(u,d.values[u.field]))||i.edits.push({rowId:d.id,field:u.field,value:w.value})}}return i}function Ff(e,t,a,n){let l={edits:[],refused:[]};for(let i=a.top;i<=a.bottom;i+=1){let r=t[i];if(r)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(!Wi(Rt(s,r.values[s.field]),c)){if(s.required&&s.type!=="checkbox"){l.refused.push({rowId:r.id,field:s.field,error:n.labels.required(s.label)});continue}l.edits.push({rowId:r.id,field:s.field,value:c})}}}return l}function Do(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(){rn(this,"waiting",new Map);rn(this,"refusals",new Map);rn(this,"listeners",new Set);rn(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 i=(this.waiting.get(a)??1)-1;i<=0?this.waiting.delete(a):this.waiting.set(a,i),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[i,r]=l.split("\0");i===t.id&&a.push(r)}for(let[l,i]of this.refusals){let[r,o]=l.split("\0");r===t.id&&(n[o]=i)}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 ly(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,ly(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(r=>r.field===a.field);if(!l)return[...t];let i=a.direction==="descending"?-1:1;return t.map((r,o)=>({row:r,index:o,value:Rt(l,r.values[l.field])})).sort((r,o)=>{let s=c=>c===null||c===""||Array.isArray(c)&&c.length===0;return l.type!=="checkbox"&&(s(r.value)||s(o.value))?s(r.value)===s(o.value)?r.index-o.index:s(r.value)?1:-1:i*ay(l,r.value,o.value,n)||r.index-o.index}).map(({row:r})=>r)}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 e0(e){let t=new Map;for(let a of e??[])t.has(a.rowId)||t.set(a.rowId,a);return t}function t0(e,t=2){let a=new Map;for(let n of e??[]){let l=a.get(n.field)??[];l.length<t&&!l.some(i=>i.id===n.id)&&l.push(n),a.set(n.field,l)}return a}function a0(e){return e.map(t=>t.name).join(", ")}function n0(e,t,a,n,l=Co){let{labels:i}=n,r=[`${e.label}.`];e.readOnly&&r.push(i.readOnly(e.label)),t.pending?.includes(e.field)&&r.push(`${i.saving}.`);let o=t.refused?.[e.field];o&&r.push(o);let s=a.map(d=>d.name);s.length>0&&r.push(l.alsoHere(s));let c=t.changed?.[e.field];if(c){let d=tu(c)&&wa(e,Rt(e,c.previous),n)||null;r.push(eu(c,i,d,n.locale))}return r.join(" ")}function nu(e,t,a,n){let l=e.find(i=>i.type==="text");if(l){let i=wa(l,Rt(l,t.values[l.field]),n);if(i)return i}return String(a+1)}var l0=X(dt(),1),sy=X(Te(),1),Zx=(0,l0.createContext)(2);function cy({level:e,children:t}){return(0,sy.jsx)(Zx.Provider,{value:e,children:t})}var Jx=X(dt(),1);var uy="data-crewlet-focus-returned";function ar(e,t){if(!e)return!1;let a=()=>e.removeAttribute(uy);return e.setAttribute(uy,""),e.addEventListener("blur",a,{once:!0}),e.focus(t),e.ownerDocument.activeElement===e?!0:(e.removeEventListener("blur",a),a(),!1)}function H(...e){return e.filter(Boolean).join(" ")}var Fx=["todo","in_progress","done","blocked"];function $x(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&&Fx.includes(t.category)&&(a.category=t.category),t.archived&&(a.archived=!0),a})}function dy(e){let t=[];for(let a of e?.columns??[]){if(a.hidden)continue;let n=a.type,l=Zc(n),i={field:a.key,label:a.label||a.key,type:l?n:"text"};l||(i.readOnly=!0),a.primary&&(i.frozen=!0),a.required&&(i.required=!0),a.min!==void 0&&(i.min=a.min),a.max!==void 0&&(i.max=a.max),a.max_length!==void 0&&(i.maxLength=a.max_length),a.max_items!==void 0&&(i.maxItems=a.max_items);let r=$x(a);r&&(i.options=r),t.push(i)}return t}function Wx(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 ko=e=>{if(e===null||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0},hy=["field","type","label","format","options","width","readonly","required","frozen","min","max","max-length","max-items","time"];function fy(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 i=ko(e("width"));i!==void 0&&(l.width=i);let r=ko(e("min"));r!==void 0&&(l.min=r);let o=ko(e("max"));o!==void 0&&(l.max=o);let s=ko(e("max-length"));s!==void 0&&(l.maxLength=s);let c=ko(e("max-items"));c!==void 0&&(l.maxItems=c);let d=e("options");d&&(l.options=Rf(d));let v=e("format");return v&&l.type==="number"&&Wx(l,v),l}function py(e){let t=e?.trim();return t?t.startsWith("-")?{field:t.slice(1),direction:"descending"}:{field:t,direction:"ascending"}:null}function my(e,t){return t===void 0?[...e]:e.map((a,n)=>n<t?{...a,frozen:!0}:a)}var gy=e=>e!==void 0&&No(e)?e:void 0;function vy(e){let t={id:e.seat,name:e.displayName,kind:e.kind},a=gy(e.avatar?.hue);return a&&(t.hue=a),e.avatar?.character&&(t.character=e.avatar.character),t}function yy(e,t){return e.filter(a=>a.seat!==t)}function by(e,t){return zf(e.map(a=>({id:a.session,kind:a.kind,hue:gy(a.avatar?.hue)})),t)}function wy(e,t,a,n){let l=[];for(let i of yy(e,a)){let r=i.focus;r.collection!==t||!r.doc||!r.field||l.push({rowId:r.doc,field:r.field,id:i.session,name:i.displayName,kind:i.kind,hue:n.get(i.session)??"purple",editing:i.activity==="editing",idle:i.activity==="idle"})}return l}function xy(e,t){return e.filter(a=>a.focus.collection===t)}function _y(e,t,a){return yy(e,t).map(n=>{let l={id:n.session,seat:n.seat,name:n.displayName,kind:n.kind,activity:n.activity},i=a.get(n.session);return i&&(l.hue=i),n.avatar?.character&&(l.character=n.avatar.character),l})}var $=X(dt(),1);var Ty=X(Te(),1),Ey={xs:12,sm:14,md:16,lg:20,xl:24},Sy=1.75,Px=`var(--crewlet-glyph-stroke, ${Sy})`;function e5(e){return e===void 0?"1em":typeof e=="number"?`${e}px`:e in Ey?`${Ey[e]}px`:e}function gt({size:e,title:t,filled:a=!1,fillable:n,className:l,style:i,children:r,...o}){let s=e5(e);return(0,Ty.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:Sy,strokeLinecap:"round",strokeLinejoin:"round",style:{...i,strokeWidth:Px},children:r})}var U=X(Te(),1);function iu(e){return(0,U.jsxs)(gt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M12 5v14"}),(0,U.jsx)("path",{d:"m19 12-7 7-7-7"})]})}function i0(e){return(0,U.jsxs)(gt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"m5 12 7-7 7 7"}),(0,U.jsx)("path",{d:"M12 19V5"})]})}function nr(e){return(0,U.jsx)(gt,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"M20 6 9 17l-5-5"})})}function r0(e){return(0,U.jsx)(gt,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"m15 18-6-6 6-6"})})}function lr(e){return(0,U.jsxs)(gt,{...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 o0(e){return(0,U.jsxs)(gt,{...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 s0(e){return(0,U.jsxs)(gt,{...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 c0(e){return(0,U.jsxs)(gt,{...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 u0(e){return(0,U.jsxs)(gt,{...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 ru(e){return(0,U.jsxs)(gt,{...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 d0(e){return(0,U.jsxs)(gt,{...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)(gt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M5 12h14"}),(0,U.jsx)("path",{d:"M12 5v14"})]})}function h0(e){return(0,U.jsxs)(gt,{...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 f0(e){return(0,U.jsx)(gt,{...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 p0(e){return(0,U.jsxs)(gt,{...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 m0(e){return(0,U.jsxs)(gt,{...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 Ro(e){return(0,U.jsxs)(gt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M18 6 6 18"}),(0,U.jsx)("path",{d:"m6 6 12 12"})]})}var _a=X(Te(),1),t5={neutral:(0,_a.jsx)(ru,{size:"md"}),info:(0,_a.jsx)(ru,{size:"md"}),success:(0,_a.jsx)(o0,{size:"md"}),warning:(0,_a.jsx)(m0,{size:"md"}),danger:(0,_a.jsx)(lr,{size:"md"})},ir=({variant:e="info",title:t,icon:a,layout:n="card",action:l,live:i,className:r,children:o,...s})=>(0,_a.jsxs)("div",{...s,"aria-live":i,className:H("crewlet-callout",`crewlet-callout--${e}`,`crewlet-callout--${n}`,r),children:[(0,_a.jsx)("span",{className:"crewlet-callout__icon","aria-hidden":!0,children:a??t5[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 Ho=X(dt(),1),My=X(Te(),1),Tn="crewlet:viewchange",rt=4;function rr(e,t,a,n=rt,l="below"){let i=e.y+e.height+n,r=e.y-n-t.height,o=a.y+a.height-i,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"?i:r,u=a.y+a.height-t.height,g=Math.max(a.y,Math.min(v,u)),w=a.x+a.width-t.width;return{left:Math.max(a.x,Math.min(e.x,w)),top:g,side:d}}function or(){return{x:0,y:0,width:window.innerWidth,height:window.innerHeight}}function sr(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 a5(n,{x:0,y:0,width:t.width,height:t.height})}function a5(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 n5=(0,Ho.createContext)(null);function sl(){let e=(0,Ho.useContext)(n5);return e||(typeof document>"u"?null:document.body)}var Re=X(dt(),1);var g0={duration:{instant:"75ms",fast:"120ms",base:"150ms",moderate:"200ms",slow:"300ms",breath:"2200ms"},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 v0={base:"0",raised:"1",sticky:"10",presence:"20",dropdown:"100",overlay:"200",layerBase:"9000",layerMax:"9899",modal:"9999",popover:"10000",toast:"10001"};var Ay=Symbol.for("crewlet.layer-stack");function l5(){let e=globalThis,t=e[Ay];if(t)return t;let a={entries:[],opened:0,armed:null,listeners:new Set,version:0,locks:0,restore:null};return e[Ay]=a,a}var Se=l5();function Ny(){Se.version+=1;for(let e of[...Se.listeners])e()}function i5(e){return Se.listeners.add(e),()=>Se.listeners.delete(e)}function cr(e){let t;for(let a of Se.entries)e&&a.kind!==e||(!t||a.order>t.order)&&(t=a);return t}var y0={base:Number(v0.layerBase),max:Number(v0.layerMax)};function r5(e){let t=0;for(let a of Se.entries)a.order<e&&(t+=1);return t}function o5(e){return e===0?y0.base:Math.min(y0.base+r5(e),y0.max)}var s5=229;function ur(e){let t="nativeEvent"in e&&e.nativeEvent||e;return!!t.isComposing||t.keyCode===s5}function Il(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 Cy(e){if(ur(e))return;if(e.key==="Escape"){if(e.defaultPrevented)return;let c=cr();if(!c)return;e.preventDefault(),c.dismissable()&&c.dismiss("escape");return}if(e.key!=="Tab"||e.defaultPrevented)return;let t=cr("modal"),a=t?.panel();if(!t||!a)return;let n=cr("popup"),l=document.activeElement;if(n&&n.order>t.order&&l&&n.panel()?.contains(l))return;let i=Il(a);if(i.length===0){e.preventDefault(),a.focus();return}let r=i[0],o=i[i.length-1];if(!(l instanceof Node)||!a.contains(l)){e.preventDefault(),(e.shiftKey?o:r).focus();return}let s=c=>(l.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;e.shiftKey&&!i.some(c=>c!==l&&!s(c))?(e.preventDefault(),o.focus()):!e.shiftKey&&!i.some(c=>c!==l&&s(c))&&(e.preventDefault(),r.focus())}function zy(e){Se.armed=null;let t=cr();if(!t||!(e.target instanceof Node))return;let a=e.target;if(t.kind==="modal"){a===t.veil()&&(Se.armed=t);return}[t.panel(),...t.inside()].some(l=>l?.contains(a))||t.dismissable()&&t.dismiss("outside")}function Oy(e){let t=Se.armed;Se.armed=null,!(!t||t!==cr()||e.target!==t.veil())&&t.dismissable()&&t.dismiss("outside")}function Dy(e){return Se.entries.length===0&&(document.addEventListener("keydown",Cy),document.addEventListener("pointerdown",zy,!0),document.addEventListener("click",Oy,!0)),Se.entries.push(e),Ny(),()=>{let t=Se.entries.indexOf(e);t>=0&&Se.entries.splice(t,1),Se.armed===e&&(Se.armed=null),Se.entries.length===0&&(document.removeEventListener("keydown",Cy),document.removeEventListener("pointerdown",zy,!0),document.removeEventListener("click",Oy,!0)),Ny()}}function ky(e){let t=(0,Re.useRef)(0);return e&&t.current===0&&(t.current=++Se.opened),e||(t.current=0),t.current}function c5(e){if(!e)return[];let t;for(let n of Se.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 Ry(e){return(0,Re.useSyncExternalStore)(i5,()=>Se.version,()=>0),{zIndex:o5(e),isTopmost:e!==0&&cr()?.order===e}}function Hy({onClose:e,dismissable:t=!0,initialFocus:a}){let n=(0,Re.useRef)(null),l=(0,Re.useRef)(null),i=(0,Re.useRef)(e),r=(0,Re.useRef)(t),o=(0,Re.useRef)(a);i.current=e,r.current=t,o.current=a;let s=ky(!0),[c]=(0,Re.useState)(()=>typeof document>"u"?[]:c5(document.activeElement)),d=Ry(s);(0,Re.useLayoutEffect)(()=>Dy({kind:"modal",order:s,panel:()=>n.current,returnTo:c,veil:()=>l.current,inside:()=>[],dismiss:()=>i.current(),dismissable:()=>r.current}),[s,c]),(0,Re.useEffect)(()=>{let g=n.current;return g&&!g.contains(document.activeElement)&&(o.current?.()??Il(g)[0]??g).focus(),()=>{let w=document.activeElement;if(!(w&&Se.entries.some(b=>b.panel()?.contains(w)))){for(let b of c)if(!(!(b instanceof HTMLElement)||!b.isConnected||b===document.body)&&ar(b))return}}},[c]);let v=(0,Re.useCallback)(g=>{n.current=g},[]),u=(0,Re.useCallback)(g=>{l.current=g},[]);return{panelRef:v,veilRef:u,...d}}function dr({open:e,onDismiss:t}){let a=(0,Re.useRef)(null),n=(0,Re.useRef)(null),l=(0,Re.useRef)(t);l.current=t;let i=ky(e),r=Ry(i);(0,Re.useLayoutEffect)(()=>{if(e)return Dy({kind:"popup",order:i,panel:()=>a.current,returnTo:[],veil:()=>null,inside:()=>[n.current],dismiss:c=>l.current(c),dismissable:()=>!0})},[e,i]);let o=(0,Re.useCallback)(c=>{a.current=c},[]),s=(0,Re.useCallback)(c=>{n.current=c},[]);return{panelRef:o,insideRef:s,...r}}function Gy(e){(0,Re.useLayoutEffect)(()=>{if(!(!e||typeof document>"u"))return Se.locks===0&&(Se.restore=document.body.style.overflow,document.body.style.overflow="hidden"),Se.locks+=1,()=>{Se.locks-=1,Se.locks===0&&(document.body.style.overflow=Se.restore??"",Se.restore=null)}},[e])}var Ly=X(Te(),1);function Ht({as:e="span",id:t,className:a,children:n}){return(0,Ly.jsx)(e,{id:t,className:H("crewlet-visually-hidden",a),children:n})}var Oa=X(dt(),1);var vt=X(Te(),1);function Uy({variant:e="primary",size:t="medium",shape:a="square",block:n,className:l},i){return H("crewlet-btn",`crewlet-btn--${e}`,`crewlet-btn--${t}`,`crewlet-btn--${a}`,n&&"crewlet-btn--block",i,l)}function b0({leadingIcon:e,trailingIcon:t,loading:a,children:n}){return(0,vt.jsxs)(vt.Fragment,{children:[a?(0,vt.jsx)("span",{className:"crewlet-btn__spinner","aria-hidden":!0}):e?(0,vt.jsx)("span",{className:"crewlet-btn__icon",children:e}):null,(0,vt.jsx)("span",{className:"crewlet-btn__label",children:n}),t?(0,vt.jsx)("span",{className:"crewlet-btn__icon",children:t}):null]})}var Da=(0,Oa.forwardRef)(function({variant:t="primary",size:a="medium",shape:n="square",leadingIcon:l,trailingIcon:i,block:r,className:o,type:s="button",asChild:c=!1,loading:d=!1,pressed:v,disabledReason:u,disabled:g,onClick:w,title:b,children:M,...p},h){let f=(0,Oa.useId)(),E=Uy({variant:t,size:a,shape:n,block:r,className:o},d?"crewlet-btn--loading":void 0);if(c){let N=Oa.Children.only(M);if(!(0,Oa.isValidElement)(N))throw new Error("Button with asChild expects exactly one valid React element child.");let C=N;return(0,Oa.cloneElement)(C,{...p,title:b,className:H(C.props.className,E)},(0,vt.jsx)(b0,{leadingIcon:l,trailingIcon:i,children:C.props.children}))}let O=d||u!==void 0;return(0,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)("button",{...p,ref:h,type:s,className:E,disabled:g,title:b,"aria-label":p["aria-label"]??(M===void 0?b:void 0),"aria-pressed":v,"aria-busy":d||void 0,"aria-disabled":O||void 0,"aria-describedby":u===void 0?p["aria-describedby"]:H(p["aria-describedby"],f),onClick:N=>{if(O){N.preventDefault();return}w?.(N)},children:(0,vt.jsx)(b0,{leadingIcon:l,trailingIcon:i,loading:d,children:M})}),u===void 0?null:(0,vt.jsx)(Ht,{id:f,children:u})]})}),wT=(0,Oa.forwardRef)(function({variant:t="primary",size:a="medium",shape:n="square",leadingIcon:l,trailingIcon:i,block:r,className:o,external:s=!1,title:c,children:d,...v},u){let g=i??(s?(0,vt.jsx)(u0,{size:"sm"}):void 0);return(0,vt.jsx)("a",{...v,ref:u,className:Uy({variant:t,size:a,shape:n,block:r,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,vt.jsx)(b0,{leadingIcon:l,trailingIcon:g,children:d})})});var ka=X(dt(),1),cl=X(Te(),1),ul=(0,ka.forwardRef)(function({label:t,icon:a,size:n="md",variant:l="ghost",pressed:i,disabledReason:r,className:o,type:s="button",asChild:c=!1,disabled:d,onClick:v,title:u,children:g,...w},b){let M=(0,ka.useId)(),p=H("crewlet-icon-btn",`crewlet-icon-btn--${n}`,`crewlet-icon-btn--${l}`,o),h=a??g;if(c){let y=ka.Children.only(g);if(!(0,ka.isValidElement)(y))throw new Error("IconButton with asChild expects exactly one valid React element child.");let E=y;return(0,ka.cloneElement)(E,{...w,"aria-label":t,title:u??t,className:H(E.props.className,p)})}let f=r!==void 0;return(0,cl.jsxs)(cl.Fragment,{children:[(0,cl.jsx)("button",{...w,ref:b,type:s,className:p,disabled:d,title:u??t,"aria-label":t,"aria-pressed":i,"aria-disabled":f||void 0,"aria-describedby":f?H(w["aria-describedby"],M):w["aria-describedby"],onClick:y=>{if(f){y.preventDefault();return}v?.(y)},children:h}),f?(0,cl.jsx)(Ht,{id:M,children:r}):null]})}),AT=(0,ka.forwardRef)(function({label:t,href:a,icon:n,size:l="md",variant:i="ghost",current:r=!1,className:o,title:s,...c},d){return(0,cl.jsx)("a",{...c,ref:d,href:a,className:H("crewlet-icon-btn",`crewlet-icon-btn--${l}`,`crewlet-icon-btn--${i}`,r&&"crewlet-icon-btn--current",o),title:s??t,"aria-label":t,"aria-current":r?"page":void 0,children:n})});var Ra=X(dt(),1),Vy=X(ni(),1);var fe=X(Te(),1);function qy({open:e,...t}){let a=sl();return e&&a?(0,fe.jsx)(d5,{container:a,...t},u5(a)):null}var By=new WeakMap,w0=0;function u5(e){let t=By.get(e);return t!==void 0?t:(w0+=1,By.set(e,w0),w0)}function yt(e){return e!=null&&e!==!1&&e!==""}function d5({container:e,onClose:t,title:a,subtitle:n,icon:l,footer:i,footerStart:r,headerActions:o,onBack:s,backLabel:c="Back",children:d,size:v="sm",variant:u="dialog",shape:g="framed",placement:w,role:b="dialog",dismissable:M=!0,closeOnBackdrop:p=!0,backdrop:h="veil",showCloseButton:f=!0,stackBody:y=!1,flush:E=!1,className:O,ariaLabel:N,describedBy:C,initialFocus:Y,onSubmit:k,closeLabel:ne="Close",closeDisabledReason:Me="Closing is unavailable until this finishes.",...ve}){let B=(0,Ra.useId)(),D=`${B}-title`,Ke=`${B}-subtitle`,z=g==="prompt"&&u==="dialog",j=!z,J=u==="sheet",ot=w??(z?"center":"top"),Ze=(0,Ra.useRef)(null),wt=(0,Ra.useRef)(null),Pe=(0,Ra.useRef)(null),G=(0,Ra.useRef)(Y);G.current=Y;let me=(0,Ra.useCallback)(()=>{let ce=G.current?.();if(ce)return ce;let tt=wt.current?Il(wt.current)[0]:void 0;return tt||((Pe.current?Il(Pe.current)[0]:void 0)??Ze.current)},[]),et=Hy({onClose:t,dismissable:M,initialFocus:me});Gy(!0);let S=yt(a)?D:void 0,oe=C??(yt(n)?Ke:void 0),Je={...ve,ref:ce=>{Ze.current=ce,et.panelRef(ce)},className:H("crewlet-modal",`crewlet-modal--${u}`,u==="dialog"?`crewlet-modal--${v}`:void 0,z?"crewlet-modal--prompt":void 0,O),role:b,"aria-modal":!0,"aria-labelledby":S,"aria-label":S===void 0?N:void 0,"aria-describedby":oe,tabIndex:-1},L=j&&f,I=(0,fe.jsxs)(fe.Fragment,{children:[j&&(yt(a)||yt(n)||yt(o)||L||s)?(0,fe.jsxs)("div",{className:H("crewlet-modal__header",J?"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)(r0,{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:H("crewlet-modal__title",J?"crewlet-modal__title--sheet":void 0),id:D,children:a}):null,yt(n)?(0,fe.jsx)("p",{className:"crewlet-modal__subtitle",id:Ke,children:n}):null]}),yt(o)?(0,fe.jsx)("div",{className:"crewlet-modal__actions",children:o}):null,L?(0,fe.jsx)(ul,{className:"crewlet-modal__close",label:ne,icon:(0,fe.jsx)(Ro,{size:"md"}),onClick:t,disabledReason:M?void 0:Me}):null]}):null,yt(d)||z&&yt(a)?(0,fe.jsxs)("div",{ref:wt,className:H("crewlet-modal__body",y?"crewlet-modal__body--stacked":void 0,E?"crewlet-modal__body--flush":void 0,J?"crewlet-modal__body--sheet":void 0),children:[z&&yt(a)?(0,fe.jsx)("p",{className:"crewlet-modal__prompt-title",id:D,children:a}):null,(0,fe.jsx)(cy,{level:2,children:d})]}):null,yt(i)||yt(r)?(0,fe.jsxs)("div",{ref:Pe,className:H("crewlet-modal__footer",J?"crewlet-modal__footer--sheet":void 0),children:[yt(r)?(0,fe.jsx)("div",{className:"crewlet-modal__footer-start",children:r}):null,(0,fe.jsx)("div",{className:"crewlet-modal__footer-end",children:i})]}):null]});return(0,Vy.createPortal)((0,fe.jsx)("div",{ref:p?et.veilRef:void 0,className:H("crewlet-modal-overlay",`crewlet-modal-overlay--${u}`,`crewlet-modal-overlay--${ot}`,h==="clear"&&"crewlet-modal-overlay--clear",e===document.body?"crewlet-modal-overlay--fixed":"crewlet-modal-overlay--in-host"),role:"presentation",style:{zIndex:et.zIndex},children:(0,fe.jsx)("div",{...Je,children:k?(0,fe.jsx)("form",{className:"crewlet-modal__form",onSubmit:ce=>{ce.preventDefault(),k()},children:I}):I})}),e)}function x0({open:e,onClose:t,onConfirm:a,title:n,message:l,children:i,confirmLabel:r="Confirm",cancelLabel:o="Cancel",destructive:s=!1,confirmVariant:c,cancelVariant:d="ghost",confirmDisabled:v=!1,confirmDisabledReason:u="Complete the confirmation above to continue.",submitting:g=!1,busyReason:w="Waiting for this to finish.",shape:b="prompt",size:M="sm"}){let p=`${(0,Ra.useId)()}-message`,h=c??(s?"danger":"primary"),f=v||g,y=(0,Ra.useCallback)(()=>{f||(async()=>{try{await a()}catch{}})()},[f,a]);return(0,fe.jsxs)(qy,{open:e,onClose:t,title:n,shape:b,size:M,role:s?"alertdialog":"dialog",describedBy:yt(l)?p:void 0,dismissable:!g,closeDisabledReason:w,onSubmit:y,stackBody:!0,footer:(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(Da,{variant:d,onClick:t,disabledReason:g?w:void 0,children:o}),(0,fe.jsx)(Da,{type:"submit",variant:h,loading:g,disabledReason:v?u:void 0,children:r})]}),children:[yt(l)?(0,fe.jsx)("p",{className:"crewlet-modal__message",id:p,children:l}):null,i]})}var h5=X(Te(),1);function dl(e){return`crewlet-presence-hue--${e}`}var hu=X(dt(),1);var su=X(Te(),1),M0={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 Yy(e,t,a){for(let n of e)n.forEach((l,i)=>{let r=n[(i+1)%n.length];l[1]!==r[1]&&a.push(l[1]<r[1]?{x0:l[0],y0:l[1],x1:r[0],y1:r[1],wind:1,add:t}:{x0:r[0],y0:r[1],x1:l[0],y1:l[1],wind:-1,add:t})})}var hr=(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 f5(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 i=e[l],r=Math.max(n.y0,i.y0),o=Math.min(n.y1,i.y1);if(o<=r)continue;let s=hr(n,r)-hr(i,r),c=hr(n,o)-hr(i,o);s*c<0&&t.add(r+(o-r)*s/(s-c))}}return[...t].sort((a,n)=>a-n)}var p5=1e-9;function m5(){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)<=p5)return l;return n.push(a),a}}function g5(e,t,a,n){let l=e.map(d=>({e:d,a:n(t,hr(d,t)),b:n(a,hr(d,a))})).sort((d,v)=>d.a+d.b-(v.a+v.b)),i=[],r=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:w}=l[d];w.add?r+=w.wind:o+=w.wind}let g=r!==0&&o===0;g&&!s?c=[v,u]:!g&&s&&i.push({left:c,right:[v,u]}),s=g}return i}function jy(e,t){let a=[],n=0;for(let[l,i]of e){let r=l;for(;n<t.length&&t[n][1]<=r;)n+=1;for(let o=n;o<t.length&&t[o][0]<i&&r<i;o+=1){let[s,c]=t[o];s>r&&a.push([r,s]),r=Math.max(r,c)}r<i&&a.push([r,i])}return a}function v5(e,t){let a=[];return t.forEach((n,l)=>{let i=e[l],r=e[l+1];for(let{left:o,right:s}of n)a.push([[s[0],i],[s[1],r]]),a.push([[o[1],r],[o[0],i]])}),e.forEach((n,l)=>{let i=l>0?t[l-1].map(({left:o,right:s})=>[o[1],s[1]]):[],r=l<t.length?t[l].map(({left:o,right:s})=>[o[0],s[0]]):[];for(let[o,s]of jy(r,i))a.push([[o,n],[s,n]]);for(let[o,s]of jy(i,r))a.push([[s,n],[o,n]])}),a.filter(([n,l])=>n[0]!==l[0]||n[1]!==l[1])}var A0=1e-9;function y5(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 i=n.length>0?n[n.length-1]:t[t.length-1],r=t[l],o=t[(l+1)%t.length],s=r[0]-i[0],c=r[1]-i[1],d=o[0]-r[0],v=o[1]-r[1],u=Math.hypot(s,c)<A0,g=Math.abs(s*v-c*d)<A0;if(u||g){a=!0;continue}n.push(r)}t=n}return t}function b5(e){let t=i=>`${i[0]} ${i[1]}`,a=new Map;e.forEach(([i],r)=>{let o=a.get(t(i));o?o.push(r):a.set(t(i),[r])});let n=new Uint8Array(e.length),l=[];return e.forEach((i,r)=>{if(n[r])return;let o=[],s=r;for(;s!==void 0;){n[s]=1;let[c,d]=e[s];if(o.push(c),d[0]===i[0][0]&&d[1]===i[0][1])break;s=a.get(t(d))?.find(v=>!n[v])}l.push(o)}),l.map(y5).filter(i=>i.length>=3&&Math.abs(uu(i))>A0)}function N0(e,t=[]){let a=[];Yy(e,!0,a),Yy(t,!1,a),a.sort((s,c)=>s.y0-c.y0);let n=f5(a),l=m5(),i=[],r=0,o=[];for(let s=0;s+1<n.length;s+=1){let c=n[s],d=n[s+1];for(;r<a.length&&a[r].y0<=c;)o.push(a[r++]);o=o.filter(v=>v.y1>c),i.push(g5(o,c,d,l))}return b5(v5(n,i))}var w5=e=>e.reduce((t,a)=>t+uu(a),0)/2;function x5(e){let t=0,a=0;for(let l of e)l.forEach((i,r)=>{let o=l[(r+1)%l.length],s=i[0]*o[1]-o[0]*i[1];t+=(i[0]+o[0])*s,a+=(i[1]+o[1])*s});let n=6*w5(e);return[t/n,a/n]}var _0=e=>uu(e)<0?e.reverse():e;function $y(e,t,a=4){let n=[];for(let l of e)l.forEach((i,r)=>{let o=l[(r+1)%l.length],s=l[(r+2)%l.length],c=Math.hypot(o[0]-i[0],o[1]-i[1]),d=(o[1]-i[1])/c,v=-(o[0]-i[0])/c,u=Math.hypot(s[0]-o[0],s[1]-o[1]),g=(s[1]-o[1])/u,w=-(s[0]-o[0])/u,b=t;n.push(_0([[i[0]+d*b,i[1]+v*b],[o[0]+d*b,o[1]+v*b],[o[0]-d*b,o[1]-v*b],[i[0]-d*b,i[1]-v*b]]));let M=(o[0]-i[0])*(s[1]-o[1])-(o[1]-i[1])*(s[0]-o[0]);if(M===0)return;let p=M>0?1:-1,h=[o[0]+p*d*b,o[1]+p*v*b],f=[o[0]+p*g*b,o[1]+p*w*b],y=d+g,E=v+w,O=y*y+E*E;if(O>0&&2/Math.sqrt(O)<=a){let N=[o[0]+p*y*2*b/O,o[1]+p*E*2*b/O];n.push(_0([o,h,N,f]))}else n.push(_0([o,h,f]))});return n}var Ky=e=>Math.round(e*100)/100;function Xy(e){return e.map(t=>`M${t.map(([n,l])=>`${Ky(n)} ${Ky(l)}`).filter((n,l,i)=>n!==i[l-1]).join("L")}Z`).join("")}var Wy=["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"],Lo=e=>typeof e=="string"&&Wy.includes(e),cu=96,_5=1.35,Py=.9,Go=1.3,E5=2,E0={full:{width:.164,height:.62},compact:{width:.19,height:.68},offset:.312},T0={half:3.2,depth:2.6},Iy=e=>Math.round(e*100)/100;function Qy(e,t){let a=[];return e.forEach((n,l)=>{let i=typeof t=="number"?t:t[l]??0;if(!i){a.push(n);return}let r=o=>{let s=o[0]-n[0],c=o[1]-n[1],d=Math.min(i/Math.hypot(s,c),.45);return[n[0]+s*d,n[1]+c*d]};a.push(r(e[(l-1+e.length)%e.length]),r(e[(l+1)%e.length]))}),a}var Zy=e=>`M${e.map(([t,a])=>`${Iy(t)} ${Iy(a)}`).join("L")}Z`;function Ge(e,t=0){let a=typeof t=="number"?e.map(()=>t):t;return uu(e)<0?Qy([...e].reverse(),[...a].reverse()):Qy(e,a)}var pe=(e,t,a,n,l=0)=>Ge([[e,t],[e+a,t],[e+a,t+n],[e,t+n]],l),He=(e,t,a,n=10)=>[pe(e,a,n,cu-a),pe(t,a,n,cu-a)];function T5(e,t,a,n,l){let i=[];for(let r=0;r<l;r+=1){let o=(r*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);i.push([e+s*Math.cos(d),t+s*Math.sin(d)])}}return Ge(i)}function S5(e){let t=e.flat(),a=t.map(([r])=>r),n=t.map(([,r])=>r),l=Math.min(...a),i=Math.min(...n);return{x:l,y:i,width:Math.max(...a)-l,height:Math.max(...n)-i}}var M5=([e,t,a,n])=>({x:e,y:t,width:a,height:n}),eb=new WeakMap;function xe(e){let t=e.holes??[],a,n={kind:"drawn",name:e.name,shape:e.shape,shapes:e.shapes.map(Zy),holes:t.map(Zy),visor:M5(e.visor),notch:e.notch===void 0?null:[e.notchX??50,e.notch],get bounds(){return a??(a=S5([...O0(n),...tb(n)]))}};return eb.set(n,{parts:e.shapes,holes:t}),n}var du=e=>eb.get(e);function O0(e){let t=du(e);return t.silhouette??(t.silhouette=N0(t.parts))}function tb(e){let t=du(e);return t.reach??(t.reach=$y(O0(e),Py+_5))}var C0=.095,ab=760,nb=869,z0=(e,t)=>[50+(e-ab)*C0,cu+(t-nb)*C0],A5=z0(M0.centroid.x,M0.centroid.y);function N5(){let{paths:e,box:t}=M0,[a,n]=z0(t.left,t.top),[l,i]=z0(t.right,t.bottom);return{kind:"mark",name:"Crewlet",shape:"The original mark, arms raised",transform:`translate(50 ${cu}) scale(${C0}) translate(${-ab} ${-nb})`,keyline:e[0],body:[e[1],e[2]],bounds:{x:a,y:n,width:l-a,height:i-n}}}var D0={crewlet:N5(),hexlet:xe({name:"Hexlet",shape:"Hexagon with pointed flanks",shapes:[Ge([[30,22],[70,22],[86,54],[70,86],[30,86],[14,54]],[5,5,4,4,4,4]),...He(34,56,84)],visor:[28,38,44,20],notch:22}),peaklet:xe({name:"Peaklet",shape:"Pentagon with a peaked roof",shapes:[Ge([[50,12],[82,36],[82,86],[18,86],[18,36]],[6,5,4,4,5]),...He(28,62,84)],visor:[26,44,48,20]}),prismlet:xe({name:"Prismlet",shape:"Triangle with cut tips",shapes:[Ge([[50,10],[90,86],[10,86]],[9,8,8]),...He(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]),...He(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]),...He(22,68,84)],visor:[21,50,58,19],notch:42}),gemlet:xe({name:"Gemlet",shape:"Diamond on its point",shapes:[Ge([[50,6],[90,48],[50,90],[10,48]],[7,7,16,7]),...He(40,52,76,8)],visor:[27,38,46,20]}),coglet:xe({name:"Coglet",shape:"Eight-tooth gear",shapes:[T5(50,52,37,31,8),...He(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),...He(37,53,84)],visor:[20,40,60,18],notch:14}),shieldlet:xe({name:"Shieldlet",shape:"Flat crown, pointed base",shapes:[Ge([[16,16],[84,16],[84,54],[50,92],[16,54]],[9,9,5,14,5]),...He(41,51,79,8)],visor:[26,28,48,20],notch:16}),stacklet:xe({name:"Stacklet",shape:"Stepped crown, square base",shapes:[Ge([[34,12],[66,12],[66,26],[82,26],[82,86],[18,86],[18,26],[34,26]],[4,4,0,5,4,4,5,0]),...He(28,62,84)],visor:[26,40,48,20],notch:12}),sparklet:xe({name:"Sparklet",shape:"Faceted drop",shapes:[Ge([[50,8],[80,48],[78,74],[64,86],[36,86],[22,74],[20,48]],[6,4,2,2,2,2,4]),...He(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),...He(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),Ge([[20,36],[26,12],[44,36]],[0,4,0]),Ge([[56,36],[74,12],[80,36]],[0,4,0]),...He(28,62,84)],visor:[26,46,48,20]}),rocketlet:xe({name:"Rocketlet",shape:"Nose cone and swept fins",shapes:[Ge([[50,6],[66,26],[66,80],[34,80],[34,26]],[5,3,3,3,3]),Ge([[34,54],[34,80],[18,90],[18,70]],[0,0,3,3]),Ge([[66,54],[82,70],[82,90],[66,80]],[0,3,3,0]),...He(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]),Ge([[18,44],[18,18],[34,32],[50,12],[66,32],[82,18],[82,44]],[0,3,0,3,0,3,0]),...He(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]),...He(36,54,84)],visor:[37,26,26,16],notch:12}),wisplet:xe({name:"Wisplet",shape:"Tall ghost with a zigzag hem",shapes:[Ge([[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:[Ge([[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]),...He(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),Ge([[40,28],[60,28],[86,80],[86,86],[14,86],[14,80]],[0,0,6,3,3,6]),...He(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),...He(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),Ge([[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:[Ge([[20,10],[64,10],[80,26],[80,86],[20,86]],[4,0,0,4,4]),...He(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:[Ge([[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:[Ge([[29,14],[87,14],[71,86],[13,86]],6),...He(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),...He(35,55,81)],visor:[26,36,48,22],notch:16}),conelet:xe({name:"Conelet",shape:"Narrow crown, wide base",shapes:[Ge([[30,12],[70,12],[88,84],[12,84]],[6,6,5,5]),...He(26,64,82)],visor:[28,40,44,20],notch:12}),hivelet:xe({name:"Hivelet",shape:"Upright honeycomb cell",shapes:[Ge([[50,6],[84,24],[84,72],[50,90],[16,72],[16,24]],[6,4,4,6,4,4]),...He(40,52,80,8)],visor:[25,36,50,20]}),folderlet:xe({name:"Folderlet",shape:"Folder with a tab",shapes:[Ge([[12,14],[38,14],[50,26],[88,26],[88,84],[12,84]],[4,0,0,6,5,5]),...He(26,64,82)],visor:[24,40,52,22]})},Jy=.5,S0=(e,t,a,n)=>[[e,t],[e+a,t],[e+a,t+n],[e,t+n]];function C5(e){let t=1/0;return e.forEach((a,n)=>{let l=e[(n+1)%e.length],i=Math.hypot(l[0]-a[0],l[1]-a[1]);if(i===0)return;let r=Math.max(...e.map(o=>Math.abs((l[0]-a[0])*(o[1]-a[1])-(l[1]-a[1])*(o[0]-a[0]))/i));t=Math.min(t,r)}),t}function z5(e,t){let{visor:a,notch:n}=e,l=t==="full",i=l?E0.full:E0.compact,r=a.width*i.width,o=a.height*i.height,s=a.y+(a.height-o)/2,c=a.x+a.width/2,d=a.width*E0.offset,v=[c-d,c+d].map(u=>S0(u-r/2,s,r,o));n&&v.push([[n[0]-T0.half,n[1]-1],[n[0]+T0.half,n[1]-1],[n[0],n[1]+T0.depth]]);for(let u of du(e).holes)(l||C5(u)>E5)&&v.push(u);if(l){let u=Go/2;v.push(S0(a.x-u,a.y-u,a.width+Go,a.height+Go)),v.push([...S0(a.x+u,a.y+u,a.width-Go,a.height-Go)].reverse())}return v}function lb(e,t){let a=e.x+e.width/2,n=e.y+e.height/2,l=a+Jy*(t[0]-a),i=n+Jy*(t[1]-n),r=Math.max(e.width+2*Math.abs(l-a),e.height+2*Math.abs(i-n));return{x:l-r/2,y:i-r/2,width:r,height:r}}function O5(e){let{parts:t}=du(e),a=O0(e),n={},l=r=>Xy(N0(t,z5(e,r))),i=()=>Xy(N0([...a,...tb(e)],[...a,...$y(a,Py)]));return{frame:lb(e.bounds,x5(a)),paths:r=>n[r]??(n[r]=r==="full"?[i(),l("full")]:[l("compact")])}}var Fy=new Map;function D5(e){let t=Fy.get(e);if(t)return t;let a=D0[e];if(a.kind==="mark"){let n=[a.keyline,...a.body];t={frame:lb(a.bounds,A5),paths:l=>l==="full"?n:a.body}}else t=O5(a);return Fy.set(e,t),t}var k5=e=>Math.round(e*100)/100,R5=({character:e,detail:t="full",...a})=>{let n=D0[e],{frame:l,paths:i}=D5(e),r=i(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(k5).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:r})})},k0=R5;var Nt=X(Te(),1);var H5={working:"working",needs:"needs you",stopped:"stopped"},R0={xs:20,sm:26,md:32,lg:40};var G5=/^agent(?:[\s._-]+)(?=\S)/i;function L5(e,t){if(e===void 0||t!=="agent")return e;let a=e.replace(G5,"");return a.trim()?a:e}var U5=56,B5=e=>{if(!e)return"?";let t=e.trim().split(/[\s\-_.:]+/).map(i=>i.replace(/^\p{P}+|\p{P}+$/gu,"")).filter(Boolean);if(t.length===0)return"?";let a=i=>(Array.from(i)[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(i=>i.toUpperCase()).join("")||"?"},V5=10,q5=e=>{let t=0;for(let a=0;a<e.length;a+=1)t=t*31+e.charCodeAt(a)>>>0;return t%V5};function Y5(e){return typeof e=="number"?e:R0[e]}var Uo=({src:e,name:t,size:a="md",kind:n="agent",tone:l="neutral",ring:i,status:r,mark:o,markLabel:s,decorative:c=!1,colorSeed:d,character:v,hue:u,icon:g,className:w,style:b,...M})=>{let[p,h]=(0,hu.useState)(!1);(0,hu.useEffect)(()=>{h(!1)},[e]);let f=typeof a=="number"?null:a,y=Y5(a),E=f===null?{"--crewlet-avatar-size":`${y}px`,fontSize:Math.max(9,Math.round(y*.36))}:{},O=l==="seeded"?q5(d??t??""):null,N=r===void 0&&o!==void 0&&o!==null,C=r!==void 0||N,Y=r!==void 0?H5[r]:N?s:void 0,k=t?`${t} avatar`:"Avatar",ne=Y?`${k}, ${Y}`:k,Me=H("crewlet-avatar",`crewlet-avatar--${n}`,f===null?null:`crewlet-avatar--${f}`,C?"crewlet-avatar--notched":null,i===void 0||C?null:`crewlet-avatar--ring-${i}`,C?null:w),ve=C?E:{...E,...b};function B(){return v!==void 0&&n==="agent"?(0,Nt.jsx)("span",{...M,className:H(Me,"crewlet-avatar--character",u===void 0?"crewlet-avatar--neutral":`crewlet-avatar--hue-${u}`),style:ve,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:ne,children:(0,Nt.jsx)(k0,{className:"crewlet-avatar__character",character:v,detail:y>=U5?"full":"compact"})}):e&&!p?(0,Nt.jsx)("img",{...M,className:H(Me,"crewlet-avatar--image"),style:ve,src:e,alt:c?"":Y?`${t??""}, ${Y}`:t??"","aria-hidden":c?!0:void 0,onError:()=>h(!0)}):(0,Nt.jsx)("span",{...M,className:H(Me,"crewlet-avatar--fallback",`crewlet-avatar--${l}`,O===null?null:`crewlet-avatar--tint-${O}`,g==null?null:"crewlet-avatar--icon"),style:ve,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:ne,children:g==null?B5(L5(t,n)):(0,Nt.jsx)("span",{className:"crewlet-avatar__icon","aria-hidden":"true",children:g})})}let D=B();return C?(0,Nt.jsxs)("span",{className:H("crewlet-avatar-frame",w),style:{"--crewlet-avatar-size":`${y}px`,...b},children:[D,r!==void 0?(0,Nt.jsx)("span",{className:`crewlet-avatar__status crewlet-avatar__status--${r}`,"aria-hidden":"true",children:j5[r]}):(0,Nt.jsx)("span",{className:"crewlet-avatar__status crewlet-avatar__status--mark","aria-hidden":"true",children:o})]}):D},j5={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 Sn=X(Te(),1);function H0({members:e,self:t=!0,max:a=4,size:n="sm",onSelect:l,label:i,labels:r,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=zo(r),c=Cf(e);if(c.length===0&&!t)return null;let d=c.slice(0,a),v=c.slice(a),u=i??s.here(c.length,t),g=[u,...c.map(p=>s.member(p))].join(". "),w=p=>(0,Sn.jsx)(Uo,{name:p.name,kind:p.kind,src:p.src,character:p.character!==void 0&&Lo(p.character)?p.character:void 0,hue:p.kind==="agent"?p.hue:void 0,size:n,decorative:!0,className:H("crewlet-presence-stack__badge",p.hue!==void 0&&p.activity!=="idle"&&dl(p.hue),p.hue!==void 0&&p.activity!=="idle"&&"crewlet-presence-stack__badge--present",p.activity==="idle"&&"crewlet-presence-stack__badge--idle")}),b=v.length>0?(0,Sn.jsxs)("span",{className:"crewlet-avatar-stack__member crewlet-avatar-stack__more","aria-hidden":"true",children:["+",v.length]}):null,M={"--crewlet-avatar-stack-size":`${R0[n]}px`};return l===void 0?c.length===0?null:(0,Sn.jsxs)("span",{className:H("crewlet-avatar-stack","crewlet-presence-stack",o),style:M,role:"img","aria-label":g,children:[d.map(p=>(0,Sn.jsx)("span",{className:H("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${p.kind}`),children:w(p)},p.id)),b]}):(0,Sn.jsxs)("div",{className:H("crewlet-avatar-stack","crewlet-presence-stack",o),style:M,role:"group","aria-label":u,children:[d.map(p=>(0,Sn.jsx)("button",{type:"button",className:H("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${p.kind}`),"aria-label":s.member(p),title:s.member(p),onClick:()=>l(p),children:w(p)},p.id)),b,v.length>0?(0,Sn.jsx)(Ht,{children:`${s.more(v.length)}: ${v.map(p=>s.member(p)).join(", ")}`}):null]})}var G0=X(dt(),1),K5=X(Te(),1),ib={text:"",n:0},X5=new Set,I5=0;function Q5(e){if(e!==""){if(I5===0){console.warn("[crewlet] announce() was called with no <Announcer> mounted, so nothing was said:",e);return}ib={text:e,n:ib.n+1};for(let t of[...X5])t()}}function rb(){return(0,G0.useCallback)(Q5,[])}var Ea=X(dt(),1),hl=X(Te(),1);function ob({label:e,max:t=6,overflow:a="expand",moreLabel:n=s=>`+${s} more`,countLabel:l=s=>`+${s}`,expandedMessage:i=s=>`Showing all ${s}.`,className:r,children:o}){let[s,c]=(0,Ea.useState)(!1),d=rb(),v=(0,Ea.useRef)(null),u=Ea.Children.toArray(o),g=a==="fit",w=Z5(v,g,u.length),b=g?u.slice(0,w):s?u:u.slice(0,t),M=u.length-b.length;return(0,hl.jsxs)("ul",{ref:v,tabIndex:-1,className:H("crewlet-tag-group",g&&"crewlet-tag-group--fit",r),"aria-label":`${e}, ${u.length}`,children:[b.map((p,h)=>(0,hl.jsx)("li",{className:"crewlet-tag-group__item",children:p},h)),M>0&&g?(0,hl.jsx)("li",{className:"crewlet-tag-group__item","data-count":"",children:(0,hl.jsx)("span",{className:"crewlet-tag-group__count",children:l(M)})}):M>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(i(u.length))},children:n(M)})}):null]})}function Z5(e,t,a){let[n,l]=(0,Ea.useState)(a),i=(0,Ea.useRef)(null);return(0,Ea.useLayoutEffect)(()=>{t&&l(a)},[t,a]),(0,Ea.useLayoutEffect)(()=>{let r=e.current;if(!t||!r)return;let o=[...r.children],s=o[0];if(!s)return;let c=s.offsetTop,d=o.filter(b=>!b.hasAttribute("data-count")),v=o.find(b=>b.hasAttribute("data-count")),u=d.filter(b=>b.offsetTop===c).length,g=v&&v.offsetTop!==c?u-1:u,w=Math.max(1,Math.min(g,d.length));w<d.length&&l(w)},[e,t,n,a]),(0,Ea.useLayoutEffect)(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver!="function")return;let o=new ResizeObserver(([s])=>{let c=s?.contentRect.width??0;i.current!==null&&i.current!==c&&l(a),i.current=c});return o.observe(r),()=>o.disconnect()},[e,t,a]),t?n:a}var Bo=X(Te(),1);function Vo({tone:e="neutral",pulse:t=!1,children:a,className:n}){let l=a!=null&&a!==!1&&a!=="",i=(0,Bo.jsx)("span",{"aria-hidden":!0,className:H("crewlet-status-dot",`crewlet-status-dot--${e}`,t&&"is-pulsing",!l&&n)});return l?(0,Bo.jsxs)("span",{className:H("crewlet-status",n),children:[i," ",(0,Bo.jsx)("span",{className:"crewlet-status__label",children:a})]}):i}var qt=X(Te(),1);function fu(e){let{variant:t="neutral",hue:a,appearance:n="soft",size:l="sm",leadingIcon:i,dot:r=!1,count:o,monospace:s=!1,animateIn:c=!1,onClick:d,pressed:v,onRemove:u,removeAriaLabel:g="Remove tag",className:w,children:b,...M}=e,p=d!==void 0,h=p||u!==void 0,f=p&&u!==void 0;h&&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 y=h&&l==="xs"?"sm":l,E=H("crewlet-tag",a===void 0?`crewlet-tag--${t}`:`crewlet-tag--hue-${a}`,`crewlet-tag--${n}`,`crewlet-tag--${y}`,s&&"crewlet-tag--monospace",c&&"crewlet-tag--animate-in",h&&"crewlet-tag--acts",p&&!f&&"crewlet-tag--actionable",f&&"crewlet-tag--split",f&&v===!0&&"is-pressed",w),O=(0,qt.jsxs)(qt.Fragment,{children:[r?(0,qt.jsx)(Vo,{tone:a===void 0?t:"neutral",className:"crewlet-tag__dot"}):null,i?(0,qt.jsx)("span",{className:"crewlet-tag__icon","aria-hidden":!0,children:i}):null,(0,qt.jsx)("span",{className:"crewlet-tag__label",children:b}),o===void 0?null:(0,qt.jsx)("span",{className:"crewlet-tag__count",children:o})]}),N=u===void 0?null:(0,qt.jsx)("button",{type:"button",className:"crewlet-tag__remove",onClick:C=>{C.stopPropagation(),u()},"aria-label":g,children:(0,qt.jsx)(Ro,{size:"xs"})});return f?(0,qt.jsxs)("span",{...M,className:E,children:[(0,qt.jsx)("button",{type:"button",className:"crewlet-tag__press",onClick:d,"aria-pressed":v===!0,children:O}),N]}):p?(0,qt.jsx)("button",{...M,type:"button",className:E,onClick:d,"aria-pressed":v===!0,children:O}):(0,qt.jsxs)("span",{...M,className:E,children:[O,N]})}var qo=X(Te(),1);function sb({name:e,hue:t,kind:a="human",editing:n=!1,placement:l="top-end",className:i,...r}){let o=typeof e=="string"?e:e.join(", ");return(0,qo.jsxs)("span",{...r,"aria-hidden":"true",className:H("crewlet-cursor-flag",dl(t),`crewlet-cursor-flag--${a}`,`crewlet-cursor-flag--${l}`,i),children:[n?(0,qo.jsx)(d0,{size:"xs",className:"crewlet-cursor-flag__glyph"}):null,(0,qo.jsx)("span",{className:"crewlet-cursor-flag__name",children:o})]})}var Ye=X(dt(),1),cb=X(ni(),1);var fr=X(Te(),1);function ub(e){return Number.parseFloat(e)}function J5(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 F5=ub(g0.duration.slow),$5=ub(g0.duration.base);function Yo({content:e,placement:t="top",align:a="center",disabled:n=!1,openDelay:l=F5,closeDelay:i=$5,className:r,children:o}){let c=`${(0,Ye.useId)()}-tooltip`,[d,v]=(0,Ye.useState)(!1),u=(0,Ye.useRef)(null),g=(0,Ye.useRef)(null),w=(0,Ye.useRef)(void 0),b=(0,Ye.useRef)({pointer:!1,focus:!1}),[M,p]=(0,Ye.useState)(null),h=sl(),f=(0,Ye.useCallback)(()=>{w.current!==void 0&&clearTimeout(w.current),w.current=void 0},[]),y=(0,Ye.useCallback)(B=>{if(f(),!n){if(B<=0){v(!0);return}w.current=setTimeout(()=>v(!0),B)}},[f,n]),E=(0,Ye.useCallback)(B=>{f();let D=()=>{b.current.pointer||b.current.focus||v(!1)};if(B<=0){D();return}w.current=setTimeout(D,B)},[f]),O=dr({open:d,onDismiss:()=>{b.current={pointer:!1,focus:!1},f(),v(!1)}});(0,Ye.useEffect)(()=>f,[f]),(0,Ye.useEffect)(()=>{n&&(f(),v(!1))},[n,f]);let N=(0,Ye.useCallback)(()=>{let B=u.current,D=g.current;if(!B||!D||!h)return;let Ke=h!==document.body,z=Ke?h.getBoundingClientRect():or(),j=B.getBoundingClientRect(),J=D.getBoundingClientRect(),ot=getComputedStyle(B).direction==="rtl",wt={x:(a==="center"?j.x+j.width/2-J.width/2:ot?j.right-J.width:j.x)-(Ke?z.x:0),y:j.y-(Ke?z.y:0),width:j.width,height:j.height},Pe={x:rt,y:rt,width:z.width-2*rt,height:z.height-2*rt};if(sr(j,z,Ke)){v(!1);return}let G=rr(wt,{width:J.width,height:J.height},Pe,rt,t==="top"?"above":"below");p(me=>me&&me.left===G.left&&me.top===G.top&&me.side===G.side?me:G)},[a,h,t]);(0,Ye.useLayoutEffect)(()=>{if(!d)return;N();let B=()=>N();h?.addEventListener(Tn,B),window.addEventListener("resize",B),window.addEventListener("scroll",B,!0);let D=typeof ResizeObserver=="function"?new ResizeObserver(B):null;return g.current&&D?.observe(g.current),()=>{h?.removeEventListener(Tn,B),window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0),D?.disconnect()}},[d,h,N]),(0,Ye.useEffect)(()=>{d||p(null)},[d]);let C=o,Y=C.props["aria-describedby"],k=C.props.ref,ne=(0,Ye.cloneElement)(C,{ref:B=>{u.current=B,O.insideRef(B);let D=J5(k,B);return()=>{u.current=null,O.insideRef(null),D()}},"aria-describedby":d?H(Y,c):Y,onPointerEnter:B=>{b.current.pointer=!0,y(l),C.props.onPointerEnter?.(B)},onPointerLeave:B=>{b.current.pointer=!1,E(i),C.props.onPointerLeave?.(B)},onFocus:B=>{b.current.focus=!0,y(0),C.props.onFocus?.(B)},onBlur:B=>{b.current.focus=!1,E(0),C.props.onBlur?.(B)}}),Me=M?{left:M.left,top:M.top,zIndex:O.zIndex}:{visibility:"hidden",zIndex:O.zIndex},ve=d?(0,fr.jsx)("div",{ref:B=>{g.current=B,O.panelRef(B)},id:c,role:"tooltip",className:H("crewlet-tooltip",`crewlet-tooltip--${M?.side??(t==="top"?"above":"below")}`,h!==null&&h!==document.body?"crewlet-tooltip--in-host":"crewlet-tooltip--fixed",r),style:Me,onPointerEnter:()=>{b.current.pointer=!0,f()},onPointerLeave:()=>{b.current.pointer=!1,E(i)},children:e}):null;return(0,fr.jsxs)(fr.Fragment,{children:[ne,ve&&h?(0,cb.createPortal)(ve,h):null]})}var L0=X(Te(),1);function db({by:e,at:t,previous:a=null,locale:n,className:l,labels:i}){let r=eu({by:e,at:t},Oo(i),a,n);return(0,L0.jsx)(Yo,{content:r,children:(0,L0.jsx)("span",{"aria-hidden":"true",className:H("crewlet-change-mark",l)})})}var Be=X(dt(),1),hb=X(ni(),1),pr=X(Te(),1);function fb({trigger:e,children:t,align:a="start",side:n="bottom",width:l="auto",alignOffset:i,sideOffset:r=rt,initialFocus:o,role:s="dialog",label:c,className:d,open:v,defaultOpen:u=!1,onOpenChange:g}){let b=`${(0,Be.useId)()}-popover`,[M,p]=(0,Be.useState)(u),h=v??M,f=(0,Be.useRef)(null),y=(0,Be.useRef)(null),[E,O]=(0,Be.useState)(null),N=sl(),C=(0,Be.useRef)(v!==void 0),Y=(0,Be.useRef)(g),k=(0,Be.useRef)(i),ne=(0,Be.useRef)(o);C.current=v!==void 0,Y.current=g,k.current=i,ne.current=o;let Me=(0,Be.useCallback)((G,me)=>{C.current||p(G),Y.current?.(G,me)},[]),ve=(0,Be.useCallback)(G=>{let me=y.current?.contains(document.activeElement)??!1;(G==="escape"||G==="tab"||G==="content"&&me)&&ar(f.current),Me(!1,G)},[Me]),B=dr({open:h,onDismiss:ve}),D=(0,Be.useCallback)(()=>{let G=f.current,me=y.current;if(!G||!me||!N)return;let et=N!==document.body,S=et?N.getBoundingClientRect():or(),oe=G.getBoundingClientRect();me.style.width=l==="match"?`${oe.width}px`:"";let Je=me.getBoundingClientRect(),L=k.current,I=typeof L=="function"?L(me,G):L??0,ce={x:(a==="end"?oe.right-Je.width:oe.left)+I-(et?S.x:0),y:oe.top-(et?S.y:0),width:oe.width,height:oe.height},tt={x:rt,y:rt,width:S.width-2*rt,height:S.height-2*rt};if(sr(oe,S,et)){ve("anchor-gone");return}let st=l==="match"?oe.width:void 0,Ct=rr(ce,{width:Je.width,height:Je.height},tt,r,n==="top"?"above":"below");O(oa=>oa&&oa.left===Ct.left&&oa.top===Ct.top&&oa.side===Ct.side&&oa.width===st?oa:{left:Ct.left,top:Ct.top,side:Ct.side,width:st})},[a,ve,N,n,r,l]);(0,Be.useLayoutEffect)(()=>{if(!h)return;D();let G=()=>D();N?.addEventListener(Tn,G),window.addEventListener("resize",G),window.addEventListener("scroll",G,!0);let me=typeof ResizeObserver=="function"?new ResizeObserver(G):null;return y.current&&me?.observe(y.current),()=>{N?.removeEventListener(Tn,G),window.removeEventListener("resize",G),window.removeEventListener("scroll",G,!0),me?.disconnect()}},[h,N,D]),(0,Be.useEffect)(()=>{h||O(null)},[h]);let Ke=h&&E!==null;(0,Be.useEffect)(()=>{if(!Ke||s!=="dialog")return;let G=y.current;G&&!G.contains(document.activeElement)&&(ne.current?.()??Il(G)[0]??G).focus()},[Ke,s]);let z=(0,Be.useCallback)(()=>{h?ve("trigger"):Me(!0,"trigger")},[ve,h,Me]),j=e(h,z),J=s==="none"?void 0:s,ot=(0,Be.cloneElement)(j,{ref:G=>{f.current=G,B.insideRef(G)},"aria-expanded":h,"aria-haspopup":j.props["aria-haspopup"]??J,"aria-controls":h?b:void 0});function Ze(G){G.key!=="Escape"&&G.key!=="Tab"&&!G.ctrlKey&&!G.metaKey&&!G.altKey&&G.stopPropagation()}let wt=E?{left:E.left,top:E.top,width:E.width}:{visibility:"hidden"},Pe=h?(0,pr.jsx)("div",{ref:G=>{y.current=G,B.panelRef(G)},id:b,className:H("crewlet-popover",`crewlet-popover--${E?.side??(n==="top"?"above":"below")}`,N!==null&&N!==document.body?"crewlet-popover--in-host":"crewlet-popover--fixed",d),style:{...wt,zIndex:B.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:Ze,onPointerDown:G=>G.stopPropagation(),onClick:G=>G.stopPropagation(),children:typeof t=="function"?t(()=>ve("content")):t}):null;return(0,pr.jsxs)(pr.Fragment,{children:[ot,Pe&&N?(0,hb.createPortal)(Pe,N):null]})}var je=X(dt(),1),pb=X(ni(),1);var bt=X(Te(),1),W5="[role='menuitem'],[role='menuitemradio']";function P5(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 mb({label:e,items:t,icon:a,trigger:n,trailingIcon:l,triggerVariant:i="ghost",triggerTabIndex:r,open:o,onOpenChange:s,align:c="start",width:d="content",renderTrigger:v,header:u,className:g}){let w=(0,je.useId)(),b=`${w}-menu`,M=`${w}-header`,[p,h]=(0,je.useState)(!1),f=o??p,y=(0,je.useRef)(null),E=(0,je.useRef)(null),O=(0,je.useRef)(null),N=(0,je.useRef)("first"),[C,Y]=(0,je.useState)(null),k=sl(),ne=(0,je.useRef)(o!==void 0),Me=(0,je.useRef)(s);ne.current=o!==void 0,Me.current=s;let ve=(0,je.useCallback)(S=>{ne.current||h(S),Me.current?.(S)},[]),B=(0,je.useCallback)(()=>{let S=O.current,oe=S&&S.isConnected&&S!==document.body?S:y.current;ar(oe)},[]),D=(0,je.useCallback)(S=>{S&&B(),ve(!1)},[B,ve]),Ke=dr({open:f,onDismiss:S=>D(S!=="outside")}),z=()=>E.current?[...E.current.querySelectorAll(W5)]:[];(0,je.useLayoutEffect)(()=>{if(!f)return;let S=document.activeElement;S instanceof Node&&E.current?.contains(S)||(O.current=S instanceof HTMLElement?S:null)},[f]);let j=(0,je.useCallback)(()=>{let S=y.current,oe=E.current;if(!S||!oe||!k)return;let Je=k!==document.body,L=Je?k.getBoundingClientRect():or(),I=S.getBoundingClientRect(),ce=oe.getBoundingClientRect(),tt=d==="trigger"?I.width:void 0,st={width:Math.max(ce.width,tt??0),height:ce.height},Ct={x:(c==="end"?I.right-st.width:I.left)-(Je?L.x:0),y:I.top-(Je?L.y:0),width:I.width,height:I.height},oa={x:rt,y:rt,width:L.width-2*rt,height:L.height-2*rt};if(sr(I,L,Je)){D(!0);return}let Mn=rr(Ct,{width:st.width,height:st.height},oa,rt);Y(zt=>zt&&zt.left===Mn.left&&zt.top===Mn.top&&zt.floor===tt?zt:{left:Mn.left,top:Mn.top,floor:tt})},[c,D,k,d]);(0,je.useLayoutEffect)(()=>{if(!f)return;j();let S=()=>j();k?.addEventListener(Tn,S),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0);let oe=typeof ResizeObserver=="function"?new ResizeObserver(S):null;return E.current&&oe?.observe(E.current),()=>{k?.removeEventListener(Tn,S),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),oe?.disconnect()}},[f,k,j]),(0,je.useEffect)(()=>{f||Y(null)},[f]);let J=f&&C!==null;(0,je.useLayoutEffect)(()=>{if(!J)return;let S=z();(N.current==="last"?S[S.length-1]:S[0])?.focus(),N.current="first"},[J]);function ot(S){(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),N.current=S.key==="ArrowUp"?"last":"first",ve(!0))}function Ze(S){S.key!=="Escape"&&S.key!=="Tab"&&!S.ctrlKey&&!S.metaKey&&!S.altKey&&S.stopPropagation();let oe=z(),Je=oe.indexOf(document.activeElement),L=I=>oe[(I+oe.length)%oe.length]?.focus();switch(S.key){case"ArrowDown":S.preventDefault(),L(Je+1);return;case"ArrowUp":S.preventDefault(),L(Je-1);return;case"Home":S.preventDefault(),L(0);return;case"End":S.preventDefault(),L(oe.length-1);return;case"Tab":D(!0);return;default:if(S.key.length===1&&!S.ctrlKey&&!S.metaKey&&!S.altKey&&S.key!==" "){let I=S.key.toLocaleLowerCase();for(let ce=1;ce<=oe.length;ce++){let tt=oe[(Je+ce)%oe.length];if((tt.textContent??"").trim().toLocaleLowerCase().startsWith(I)){S.preventDefault(),tt.focus();return}}}}}function wt(S){S.disabled||(D(!0),S.onSelect())}let Pe=S=>S.description!==void 0&&S.description!==null&&S.description!==!1&&S.description!=="",G=S=>(0,bt.jsxs)("button",{type:"button",role:S.checked===void 0?"menuitem":"menuitemradio","aria-checked":S.checked,tabIndex:-1,className:H("crewlet-menu__item",Pe(S)?"crewlet-menu__item--described":void 0,S.danger&&"is-danger",S.disabled&&"is-disabled"),"aria-disabled":S.disabled||void 0,onClick:()=>wt(S),children:[S.checked!==void 0&&(0,bt.jsx)("span",{className:"crewlet-menu__check","aria-hidden":!0,children:S.checked&&(0,bt.jsx)(nr,{size:"sm"})}),S.icon&&(0,bt.jsx)("span",{className:"crewlet-menu__icon",children:S.icon}),(0,bt.jsxs)("span",{className:"crewlet-menu__text",children:[(0,bt.jsx)("span",{className:"crewlet-menu__label",children:S.label}),Pe(S)?(0,bt.jsx)("span",{className:"crewlet-menu__description",children:S.description}):null]}),S.hint&&(0,bt.jsx)("span",{className:"crewlet-menu__hint",children:S.hint})]},S.key),me=f?(0,bt.jsxs)("div",{className:H("crewlet-menu",k!==null&&k!==document.body?"crewlet-menu--in-host":null,g),id:b,role:"menu","aria-label":e,"aria-describedby":u?M:void 0,tabIndex:-1,ref:S=>{E.current=S,Ke.panelRef(S)},style:C?{left:C.left,top:C.top,zIndex:Ke.zIndex,...C.floor===void 0?null:{"--crewlet-menu-floor":`${C.floor}px`}}:{visibility:"hidden"},onKeyDown:Ze,onPointerDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),children:[u?(0,bt.jsx)("div",{role:"presentation",id:M,className:"crewlet-menu__header",children:u}):null,P5(t).map(S=>S.kind==="separator"?(0,bt.jsx)("div",{role:"separator",className:"crewlet-menu__separator"},S.key):S.kind==="answers"?(0,bt.jsx)("div",{role:"group",className:"crewlet-menu__group",children:S.items.map(G)},S.key):G(S.item))]}):null,et={ref:S=>{y.current=S,Ke.insideRef(S)},"aria-haspopup":"menu","aria-expanded":f,"aria-controls":f?b:void 0,tabIndex:r,onClick:()=>{f?D(!0):(N.current="first",ve(!0))},onKeyDown:ot};return(0,bt.jsxs)("span",{className:"crewlet-menu-anchor",children:[v?v(et):n===void 0?(0,bt.jsx)(ul,{...et,label:e,icon:a??(0,bt.jsx)(c0,{}),size:"sm"}):(0,bt.jsx)(Da,{...et,"aria-label":e,variant:i,size:"small",leadingIcon:a,trailingIcon:l,children:n}),me&&k?(0,pb.createPortal)(me,k):null]})}var A=X(dt(),1);var _=X(Te(),1);function B0({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 vb({person:e,fallback:t}){return e?(0,_.jsxs)("span",{className:"crewlet-sheet-cell__person",children:[(0,_.jsx)(Uo,{name:e.name,kind:e.kind==="human"?"human":"agent",src:e.src,character:e.character!==void 0&&Lo(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 V0({column:e,value:t,context:a,onOpenLink:n}){let{labels:l}=a;if(e.type==="checkbox"){let i=t===!0;return(0,_.jsxs)("span",{className:"crewlet-sheet-cell__checkbox",children:[(0,_.jsx)("span",{className:H("crewlet-sheet-cell__check",i&&"crewlet-sheet-cell__check--on"),"aria-hidden":"true",children:i?(0,_.jsx)(nr,{size:"xs"}):null}),(0,_.jsx)(Ht,{children:i?l.checked:l.unchecked})]})}if(tn(t))return(0,_.jsx)(Ht,{children:l.empty});switch(e.type){case"select":return(0,_.jsx)(B0,{column:e,id:String(t),labels:l});case"multiselect":return(0,_.jsx)(ob,{label:e.label,overflow:"fit",className:"crewlet-sheet-cell__chips",children:t.map(i=>(0,_.jsx)(B0,{column:e,id:i,labels:l},i))});case"status":{let i=En(e,String(t)),r=wa(e,t,a);return(0,_.jsx)(Vo,{tone:i&&!i.archived?Fc(i):"neutral",children:r})}case"person":return(0,_.jsx)(vb,{person:Pi(a.people,String(t)),fallback:l.unknownPerson});case"rating":{let i=en(e),r=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:i},(o,s)=>(0,_.jsx)(f0,{size:"sm",filled:s<r,className:H("crewlet-sheet-cell__star",s<r&&"crewlet-sheet-cell__star--on")},s))}),(0,_.jsx)(Ht,{children:l.rating(r,i)})]})}case"url":{let i=String(t);return(0,_.jsx)("a",{className:"crewlet-sheet-cell__link",href:i,target:"_blank",rel:"noopener noreferrer",tabIndex:-1,onClick:n?r=>{r.preventDefault(),n(i)}:void 0,children:i})}case"number":return(0,_.jsx)("span",{className:"crewlet-sheet-cell__text crewlet-sheet-cell__number",children:wa(e,t,a)});default:return(0,_.jsx)("span",{className:"crewlet-sheet-cell__text",children:wa(e,t,a)})}}var e_=new Set(["text","number","url","date","rating"]),t_=new Set(["text","longtext"]),a_=6,n_=8,yb=new Set(["select","multiselect","status","person"]),l_=e=>e!=="checkbox",gb=e=>e_.has(e)||yb.has(e)||e==="longtext";function bb(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 q0(e,t){e&&(e.focus({preventScroll:!0}),t&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.setSelectionRange(e.value.length,e.value.length))}function Y0(e){let t=(0,A.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 i_(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 j0({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)(Da,{size:"small",variant:"secondary",onClick:e.onKeepMine,children:t.keepMine}),(0,_.jsx)(Da,{size:"small",variant:"ghost",onClick:e.onUseTheirs,children:t.useTheirs(e.writer)})]})]})}function K0({id:e,message:t}){return(0,_.jsxs)("p",{id:e,className:"crewlet-sheet-editor__error",children:[(0,_.jsx)(lr,{size:"xs","aria-hidden":"true"}),(0,_.jsx)("span",{children:t})]})}function wb(e){let{column:t}=e;return yb.has(t.type)?(0,_.jsx)(u_,{...e}):t_.has(t.type)?(0,_.jsx)(o_,{...e}):(0,_.jsx)(r_,{...e})}function r_({column:e,value:t,context:a,seed:n,label:l,onCommit:i,onCancel:r,conflict:o}){let{labels:s}=a,c=(0,A.useId)(),d=(0,A.useRef)(null),v=e.type==="date",u=(0,A.useMemo)(()=>{if(v){let f=typeof t=="string"?t:"";return e.time?i_(f):f}return n??er(e,t,a)},[]),[g,w]=(0,A.useState)(u),[b,M]=(0,A.useState)(null);(0,A.useLayoutEffect)(()=>{q0(d.current,!v)},[v]);let p=f=>{let y=v&&e.time&&g!==""?new Date(g).toISOString():g,E=tr(e,y,a);return E.ok?(h.finish(),i(E.value,f),!0):(M(E.error),!1)},h=Y0(()=>{p(null)||r()});return(0,_.jsxs)("div",{className:"crewlet-sheet-editor crewlet-sheet-editor--line",onBlur:h.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":b!==null,"aria-describedby":b!==null?c:void 0,maxLength:e.type==="text"?ol(e):void 0,value:g,onChange:f=>{w(f.target.value),M(null)},onKeyDown:f=>{if(ur(f))return;if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),h.finish(),r();return}if(f.key==="Tab"&&o)return;let y=bb(f,!1);y!==void 0&&(f.preventDefault(),f.stopPropagation(),p(y))}}),b!==null||o?(0,_.jsxs)("div",{className:H("crewlet-sheet-editor__panel"),children:[b!==null?(0,_.jsx)(K0,{id:c,message:b}):null,o?(0,_.jsx)(j0,{conflict:o,labels:s}):null]}):null]})}function o_({column:e,value:t,context:a,seed:n,label:l,onCommit:i,onCancel:r,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="longtext",v=(0,A.useId)(),u=(0,A.useRef)(null),[g,w]=(0,A.useState)(()=>n??er(e,t,a)),[b,M]=(0,A.useState)(null);(0,A.useLayoutEffect)(()=>{q0(u.current,!0)},[]),(0,A.useLayoutEffect)(()=>{let f=u.current;!f||f.scrollHeight===0||(f.style.height="auto",f.style.height=`${f.scrollHeight}px`)},[g]);let p=f=>{let y=tr(e,g,a);return y.ok?(h.finish(),i(y.value,f),!0):(M(y.error),!1)},h=Y0(()=>{p(null)||r()});return(0,_.jsx)("div",{className:H("crewlet-sheet-editor","crewlet-sheet-editor--text",d&&"crewlet-sheet-editor--long",`crewlet-sheet-editor--${o}`),onBlur:h.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":b!==null,"aria-describedby":b!==null?v:void 0,maxLength:ol(e),rows:1,style:{"--crewlet-sheet-editor-lines":a_},value:g,onChange:f=>{w(d?f.target.value:f.target.value.replace(/\r?\n/g," ")),M(null)},onKeyDown:f=>{if(ur(f))return;if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),h.finish(),r();return}if(f.key==="Tab"&&s)return;let y=bb(f,d);y!==void 0&&(f.preventDefault(),f.stopPropagation(),p(y))}}),b!==null?(0,_.jsx)(K0,{id:v,message:b}):null,s?(0,_.jsx)(j0,{conflict:s,labels:c}):null]})})}function s_(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 c_({column:e,choice:t,context:a}){return t.person?(0,_.jsx)(vb,{person:t.person,fallback:t.label}):e.type==="status"&&t.option?(0,_.jsx)(Vo,{tone:Fc(t.option),children:t.label}):(0,_.jsx)(B0,{column:e,id:t.id,labels:a.labels})}var nn="";function u_({column:e,value:t,context:a,seed:n,label:l,onCommit:i,onCancel:r,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="multiselect",v=(0,A.useId)(),u=(0,A.useId)(),g=(0,A.useRef)(null),w=(0,A.useRef)(null),b=(0,A.useMemo)(()=>s_(e,a),[e,a]),M=b.length>n_,[p,h]=(0,A.useState)(M?n??"":""),[f,y]=(0,A.useState)(()=>d?[...t??[]]:typeof t=="string"?[t]:[]),[E,O]=(0,A.useState)(null),N=!d&&!e.required,C=(0,A.useMemo)(()=>{let z=p.trim().toLowerCase(),j=z===""?b:b.filter(J=>J.label.toLowerCase().includes(z));return N&&z===""?[...j,{id:nn,label:c.clear}]:j},[b,p,N,c.clear]),[Y,k]=(0,A.useState)(()=>{let z=!M&&n?C.findIndex(J=>J.id!==nn&&J.label.toLowerCase().startsWith(n.toLowerCase())):-1;if(z>=0)return z;let j=C.findIndex(J=>J.id!==nn&&f.includes(J.id));return j>=0?j:0});(0,A.useEffect)(()=>{k(z=>Math.min(z,Math.max(C.length-1,0)))},[C.length]),(0,A.useLayoutEffect)(()=>{q0(M?g.current:w.current,!1)},[M]);let ne=(z,j)=>{let J=Hf(e,z,a);return J!==null?(O(J),!1):(Me.finish(),i(z,j),!0)},Me=Y0(()=>{(!d||!ne(f,null))&&r()}),ve=(z,j)=>{if(z){if(!d){ne(z.id===nn?null:z.id,j);return}O(null),y(J=>J.includes(z.id)?J.filter(ot=>ot!==z.id):[...J,z.id])}},B=z=>`${v}-${z}`,D=C.length>0?B(Y):void 0,Ke=z=>{if(!ur(z))switch(z.key){case"Escape":z.preventDefault(),z.stopPropagation(),Me.finish(),r();return;case"ArrowDown":z.preventDefault(),z.stopPropagation(),k(j=>Math.min(j+1,C.length-1));return;case"ArrowUp":z.preventDefault(),z.stopPropagation(),k(j=>Math.max(j-1,0));return;case"Home":case"End":if(p!=="")return;z.preventDefault(),z.stopPropagation(),k(z.key==="Home"?0:C.length-1);return;case"Enter":z.preventDefault(),z.stopPropagation(),d&&Kl(z)?ne(f,"down"):ve(C[Y],z.shiftKey?"up":"down");return;case" ":if(M)return;z.preventDefault(),z.stopPropagation(),ve(C[Y],d?null:"down");return;case"Tab":if(s)return;z.preventDefault(),z.stopPropagation(),ne(d?f:t,z.shiftKey?"left":"right");return;default:if(!M&&z.key.length===1&&!z.ctrlKey&&!z.metaKey&&!z.altKey){let j=z.key.toLowerCase(),J=Y+1,Ze=[...C.slice(J),...C.slice(0,J)].find(wt=>wt.id!==nn&&wt.label.toLowerCase().startsWith(j));Ze&&(z.preventDefault(),z.stopPropagation(),k(C.indexOf(Ze)))}return}};return(0,_.jsx)("div",{className:H("crewlet-sheet-editor","crewlet-sheet-editor--list",`crewlet-sheet-editor--${o}`),onBlur:Me.onBlur,children:(0,_.jsxs)("div",{className:"crewlet-sheet-editor__panel crewlet-sheet-editor__panel--list",children:[M?(0,_.jsx)("input",{ref:g,className:"crewlet-sheet-editor__filter",role:"combobox","aria-label":l,"aria-expanded":"true","aria-controls":v,"aria-autocomplete":"list","aria-activedescendant":D,"aria-invalid":E!==null,"aria-describedby":E!==null?u:void 0,placeholder:c.filter,value:p,onChange:z=>{h(z.target.value),k(0)},onKeyDown:Ke}):null,(0,_.jsx)("ul",{ref:w,className:"crewlet-sheet-editor__list",id:v,role:"listbox","aria-label":l,"aria-multiselectable":d||void 0,tabIndex:-1,"aria-activedescendant":M?void 0:D,"aria-invalid":M?void 0:E!==null,"aria-describedby":!M&&E!==null?u:void 0,onKeyDown:M?void 0:Ke,children:C.length===0?(0,_.jsx)("li",{className:"crewlet-sheet-editor__empty",role:"presentation",children:c.noOptions}):C.map((z,j)=>{let J=z.id===nn?f.length===0:f.includes(z.id);return(0,_.jsxs)("li",{id:B(j),role:"option","aria-selected":J,className:H("crewlet-sheet-editor__option",z.id===nn&&"crewlet-sheet-editor__option--clear",j===Y&&"crewlet-sheet-editor__option--highlight",J&&"crewlet-sheet-editor__option--selected"),onMouseDown:ot=>ot.preventDefault(),onMouseEnter:()=>k(j),onClick:()=>ve(z,d?null:"down"),children:[(0,_.jsx)("span",{className:"crewlet-sheet-editor__mark","aria-hidden":"true",children:J&&z.id!==nn?(0,_.jsx)(nr,{size:"xs"}):null}),z.id===nn?(0,_.jsx)("span",{className:"crewlet-sheet-cell__muted",children:z.label}):(0,_.jsx)(c_,{column:e,choice:z,context:a})]},z.id===nn?"\0clear":z.id)})}),E!==null?(0,_.jsx)(K0,{id:u,message:E}):null,s?(0,_.jsx)(j0,{conflict:s,labels:c}):null]})})}var fl=-1,d_=.6;function X0({label:e,columns:t,rows:a,people:n,mode:l="edit",onEdit:i,onAddRow:r,onShowHistory:o,onActiveCellChange:s,onEditingChange:c,onUndo:d,onRedo:v,onOpenLink:u,presence:g,sort:w,onSortChange:b,sync:M,onRetry:p,height:h,fit:f="container",onDeleteRow:y,onDismissRefused:E,renderColumnEditor:O,settingsColumn:N,onSettingsColumnChange:C,onAddColumn:Y,locale:k,className:ne,labels:Me,presenceLabels:ve}){let B=(0,A.useId)(),D=(0,A.useMemo)(()=>Oo(Me),[Me]),Ke=(0,A.useMemo)(()=>zo(ve),[ve]),z=(0,A.useMemo)(()=>({people:n,locale:k,labels:D}),[n,k,D]),j=(0,A.useMemo)(()=>jf(t),[t]),[J,ot]=(0,A.useState)(0),Ze=(0,A.useRef)(a);(0,A.useLayoutEffect)(()=>{Ze.current=a});let wt=a.length>0,[Pe,G]=(0,A.useState)(null);(0,A.useLayoutEffect)(()=>{let m=wt?Ze.current:[];G(new Map(j.filter(x=>!(x.width&&x.width>0)).map(x=>[x.field,If(x,m,z)])))},[j,wt,z]);let[me,et]=(0,A.useState)(0);(0,A.useEffect)(()=>{let m=typeof document>"u"?void 0:document.fonts;if(!m)return;let x=!0,R=()=>{x&&et(F=>F+1)};return m.ready.then(R),m.addEventListener("loadingdone",R),()=>{x=!1,m.removeEventListener("loadingdone",R)}},[]);let S=(0,A.useRef)(null),[oe,Je]=(0,A.useState)(new Map);(0,A.useLayoutEffect)(()=>{let m=S.current;if(!m)return;let x=new Map;for(let R of m.querySelectorAll("[data-measure]")){let F=0;for(let le of R.children)F=Math.max(F,le.getBoundingClientRect().width);x.set(R.dataset.measure??"",F)}Je(x)},[Pe,me]);let L=(0,A.useMemo)(()=>{let m=V=>V.width!==void 0&&V.width>0,x=j.map(V=>m(V)?V:{...V,width:Xf(V.type,oe.get(V.field)??0)});if(J<=0)return x;let R=Math.floor(J*d_)-Xl,F=x.filter(V=>V.frozen).reduce((V,Ae)=>V+an(Ae),0)-R,le=j.filter(V=>V.frozen&&!m(V)).length;if(F<=0||le===0)return x;let _e=Math.ceil(F/le);return x.map((V,Ae)=>V.frozen&&!m(j[Ae])?{...V,width:Math.max(Pc[V.type][0],an(V)-_e)}:V)},[j,oe,J]),I=(0,A.useMemo)(()=>Wf(L,a,w,z),[L,a,w,z]),ce=l==="edit"&&i!==void 0,tt=l==="edit"&&y!==void 0,st=l==="edit"&&O!==void 0,Ct=l==="edit"&&Y!==void 0,[oa,Mn]=(0,A.useState)(null),zt=N!==void 0?N:oa,gr=m=>{N===void 0&&Mn(m),C?.(m)},Ta=(0,A.useRef)(null),q=(0,A.useRef)(null),Q=(0,A.useRef)(null),[ct,sa]=(0,A.useState)(0),La=(0,A.useRef)(0),[re,Ql]=(0,A.useState)(Wc),[An,Ab]=(0,A.useState)(Wc),[Xo,Nb]=(0,A.useState)(0),[Cb,zb]=(0,A.useState)(0),[F0,$0]=(0,A.useState)(0),[Ob,Db]=(0,A.useState)(!1),[Io,Qo]=(0,A.useState)(null),[W0,Zo]=(0,A.useState)(null),[W,vr]=(0,A.useState)(null),[P0,ep]=(0,A.useState)(new Map),[tp,kb]=(0,A.useState)({text:"",n:0}),vu=(0,A.useRef)(!1),[ap,np]=(0,A.useState)(null),Yt=(0,A.useCallback)(m=>kb(x=>({text:m,n:x.n+1})),[]),lp=(0,A.useRef)(new Map);(0,A.useEffect)(()=>{let m=new Map;for(let x of a)for(let[R,F]of Object.entries(x.refused??{}))m.set(xa(x.id,R),F);for(let[x,R]of m)if(lp.current.get(x)!==R){Yt(D.notSaved(R));break}lp.current=m},[a,D,Yt]),(0,A.useLayoutEffect)(()=>{let m=()=>{let R=q.current?.offsetHeight??0;R>0&&Ql(R);let F=Q.current?.querySelector(".crewlet-sheet-grid__row--head")?.offsetHeight??0;F>0&&Ab(F),Nb(Ta.current?.clientHeight??0),ot(Ta.current?.clientWidth??0);let le=Ta.current;if(le){let _e=getComputedStyle(le),V=le.offsetHeight-le.clientHeight-(parseFloat(_e.borderTopWidth)||0)-(parseFloat(_e.borderBottomWidth)||0);zb(Math.max(0,Math.round(V)))}};if(m(),typeof ResizeObserver!="function")return;let x=new ResizeObserver(m);return Ta.current&&x.observe(Ta.current),q.current&&x.observe(q.current),()=>x.disconnect()},[]);let Zl=(0,A.useMemo)(()=>Yf(L),[L]),Rb=(0,A.useMemo)(()=>[`${Xl}px`,...L.map((m,x)=>x===L.length-1?`minmax(${an(m)}px, 1fr)`:`${an(m)}px`)].join(" "),[L]),Hb=(0,A.useMemo)(()=>L.reduce((m,x)=>m+an(x),Xl),[L]),Jo=(0,A.useMemo)(()=>L.reduce((m,x,R)=>x.frozen?R:m,-1),[L]),yu=(0,A.useMemo)(()=>{let m=Xl;return L.forEach((x,R)=>{x.frozen&&(m=(Zl[R]??m)+an(x))}),m},[L,Zl]),pl=(0,A.useMemo)(()=>new Map(I.map((m,x)=>[m.id,x])),[I]),Fo=(0,A.useMemo)(()=>new Map(L.map((m,x)=>[m.field,x])),[L]),Jl=(0,A.useCallback)(m=>{if(!m)return null;let x=Fo.get(m.field);if(x===void 0)return null;if(m.rowId===null)return{row:fl,col:x};let R=pl.get(m.rowId);return R===void 0?null:{row:R,col:x}},[Fo,pl]),ln=(0,A.useCallback)(m=>{let x=L[m.col];if(!x)return null;if(m.row===fl)return{rowId:null,field:x.field};let R=I[m.row];return R?{rowId:R.id,field:x.field}:null},[L,I]),Gb=I.length>0&&L.length>0?{rowId:I[0].id,field:L[0].field}:L.length>0?{rowId:null,field:L[0].field}:null,ue=Jl(Io)??Jl(Gb),ut=ue?ln(ue):null,ip=Jl(W0)??ue,Ve=ue&&ip&&ue.row!==fl?Lf(ip,ue):null,rp=(0,A.useMemo)(()=>Pf(g),[g]),Lb=(0,A.useMemo)(()=>e0(g),[g]),Ub=(0,A.useMemo)(()=>t0(g),[g]),op=(0,A.useRef)(null);(0,A.useEffect)(()=>{let m=ut&&ut.rowId!==null?{rowId:ut.rowId,field:ut.field}:null,x=m?xa(m.rowId,m.field):null;x!==op.current&&(op.current=x,s?.(m))},[ut,s]);let sp=(0,A.useRef)(null);(0,A.useEffect)(()=>{let m=W?xa(W.rowId,W.field):null;m!==sp.current&&(sp.current=m,c?.(W?{rowId:W.rowId,field:W.field}:null))},[W,c]);let $o=(0,A.useCallback)(m=>{m.length!==0&&(ep(x=>{let R=new Map(x);for(let F of m)R.set(xa(F.rowId,F.field),F.error);return R}),Yt(m[0].error))},[Yt]),Wo=(0,A.useCallback)(m=>{ep(x=>{if(!m.some(F=>x.has(F)))return x;let R=new Map(x);for(let F of m)R.delete(F);return R})},[]),Nn=(0,A.useCallback)(m=>{m.length===0||!i||(Wo(m.map(x=>xa(x.rowId,x.field))),i(m))},[i,Wo]),ml=(0,A.useCallback)(m=>L[Fo.get(m)??-1],[L,Fo]),gl=(0,A.useCallback)(m=>I[pl.get(m)??-1],[I,pl]),Fl=(0,A.useCallback)(m=>ce&&m!==void 0&&!m.readOnly,[ce]),bu=(0,A.useCallback)(()=>sa(m=>m+1),[]),$l=(0,A.useCallback)((m,x=!1)=>{m&&(Qo(m),x||Zo(m),bu())},[bu]),cp=m=>{Io&&Io.rowId===m.rowId&&Io.field===m.field||(Qo(m),Zo(m))},yr=ue?.row??null,br=ue?.col??null;(0,A.useLayoutEffect)(()=>{if(yr===null||br===null)return;let m=Ta.current;if(m&&yr>=0){let x=Vf(yr,m.scrollTop,m.clientHeight,re,An);x!==m.scrollTop&&(m.scrollTop=x,$0(x));let R=L[br];if(R&&!R.frozen){let F=Zl[br]??0,le=F+an(R);F-yu<m.scrollLeft?m.scrollLeft=Math.max(F-yu,0):le>m.scrollLeft+m.clientWidth&&(m.scrollLeft=le-m.clientWidth)}}ct===La.current||W||(La.current=ct,document.getElementById(U0(B,{row:yr,col:br}))?.focus({preventScroll:!0}))},[yr,br,ct,W,B,re,An,L,Zl,yu]);let Po=(0,A.useCallback)((m,x)=>{if(m.rowId===null)return;let R=ml(m.field),F=gl(m.rowId);if(!(!F||!R)){if(!Fl(R)){Yt(ce?D.readOnly(R.label):D.forbidden);return}l_(R.type)&&(Wo([xa(m.rowId,m.field)]),vr({rowId:m.rowId,field:m.field,seed:x,base:Rt(R,F.values[R.field])}))}},[Fl,Wo,ml,ce,D,gl,Yt]),wu=(0,A.useCallback)(m=>{if(m.rowId===null)return;let x=ml(m.field),R=gl(m.rowId);if(!(!R||!x||x.type!=="checkbox")){if(!Fl(x)){Yt(ce?D.readOnly(x.label):D.forbidden);return}Nn([{rowId:R.id,field:x.field,value:Rt(x,R.values[x.field])!==!0}])}},[Fl,ml,ce,Nn,D,gl,Yt]),up=(0,A.useCallback)((m,x)=>{if(x===null)return ln(m);let R={down:{row:Math.min(m.row+1,I.length-1),col:m.col},up:{row:Math.max(m.row-1,0),col:m.col},right:{row:m.row,col:Math.min(m.col+1,L.length-1)},left:{row:m.row,col:Math.max(m.col-1,0)}}[x];return ln(R)},[ln,L.length,I.length]),dp=(0,A.useCallback)((m,x)=>{if(!W)return;let R=Jl({rowId:W.rowId,field:W.field}),F=ml(W.field),le=gl(W.rowId);vr(null),m!==void 0&&F&&le&&!Wi(m,Rt(F,le.values[F.field]))&&Nn([{rowId:le.id,field:F.field,value:m}]);let _e=document.activeElement,V=_e!==null&&_e!==document.body&&!!Q.current?.contains(_e);R&&V&&$l(up(R,x))},[ml,W,Nn,$l,Jl,gl,up]);(0,A.useEffect)(()=>{W&&!pl.has(W.rowId)&&vr(null)},[W,pl]);let es=W?gl(W.rowId):void 0,Wl=W?ml(W.field):void 0,xu=W&&es&&Wl?Rt(Wl,es.values[Wl.field]):null,hp=!!(W&&es&&Wl&&!Wi(xu,W.base)),Bb=hp&&W?es?.changed?.[W.field]?.by??D.someone:"",ts=hp&&W&&Wl?{writer:Bb,value:wa(Wl,xu,z)||D.empty,onKeepMine:()=>vr(m=>m&&{...m,base:xu}),onUseTheirs:()=>{let m=Jl({rowId:W.rowId,field:W.field});vr(null),m&&$l(ln(m))}}:null,_u=ts?D.conflict(ts.writer,ts.value):"";(0,A.useEffect)(()=>{_u&&Yt(_u)},[_u,Yt]);let fp=m=>{W||!Ve||mr(m)||(m.preventDefault(),m.clipboardData.setData("text/plain",Qf(L,I,Ve,z)))},pp=(0,A.useCallback)(()=>{if(!Ve)return;if(!ce){Yt(D.forbidden);return}let m=Ff(L,I,Ve,z);Nn(m.edits),$o(m.refused)},[L,z,ce,Nn,D.forbidden,Ve,$o,I,Yt]),Vb=m=>{W||!Ve||mr(m)||(fp(m),pp())},qb=m=>{if(W||!Ve||mr(m))return;if(m.preventDefault(),!ce){Yt(D.forbidden);return}let x=Jf(L,I,Ve,Zf(m.clipboardData.getData("text/plain")),z);Nn(x.edits),$o(x.refused)},Yb=Math.max(1,Math.floor(Math.max(Xo-An,re)/re)-1),jb=m=>{if(W||ur(m)||!ue||!ut||mr(m)||m.target.closest(".crewlet-sheet-grid__row-actions"))return;let x=L[ue.col],R=Kl(m);if(R&&m.altKey&&m.key.toLowerCase()==="h"){o&&ut.rowId!==null&&(m.preventDefault(),o({rowId:ut.rowId,field:ut.field}));return}if(R&&!m.altKey&&m.key.toLowerCase()==="z"){let le=m.shiftKey?v:d;le&&(m.preventDefault(),le());return}if(R&&!m.altKey&&m.key.toLowerCase()==="y"){v&&(m.preventDefault(),v());return}if(R&&!m.altKey&&m.key.toLowerCase()==="a"){if(m.preventDefault(),I.length===0)return;Zo(ln({row:0,col:0})),Qo(ln({row:I.length-1,col:L.length-1})),bu();return}if(tt&&ut.rowId!==null&&(m.key==="ContextMenu"||m.shiftKey&&m.key==="F10")){m.preventDefault(),np(ut.rowId);return}let F=Gf(ue,m,{rows:I.length,cols:L.length,page:Yb});if(F){m.preventDefault();let le=m.shiftKey&&F.row!==fl&&ue.row!==fl;$l(ln(F),le);return}if(m.key==="Tab"){let le=m.shiftKey?-1:1,_e=ue.col+le;if(_e<0||_e>=L.length)return;m.preventDefault(),$l(ln({row:ue.row,col:_e}));return}if(ue.row===fl){(m.key==="Enter"||m.key===" ")&&x&&st?(m.preventDefault(),gr(x.field)):(m.key==="Enter"||m.key===" ")&&x&&b&&(m.preventDefault(),b(au(w,x.field)));return}switch(m.key){case"Enter":case"F2":if(m.preventDefault(),m.key==="Enter"&&R&&x?.type==="url"){let le=I[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"?wu(ut):Po(ut);return;case" ":m.preventDefault(),x?.type==="checkbox"?wu(ut):x&&gb(x.type)&&Po(ut," ");return;case"Delete":case"Backspace":m.preventDefault(),pp();return;case"Escape":W0&&Ve&&(Ve.top!==Ve.bottom||Ve.left!==Ve.right)&&(m.preventDefault(),Zo(ut));return}if(Kf(m)&&x){if(x.type==="rating"&&/^\d$/.test(m.key)){if(m.preventDefault(),!Fl(x)){Yt(ce?D.readOnly(x.label):D.forbidden);return}let le=Number(m.key),_e=I[ue.row];if(!_e)return;if(le>en(x)){$o([{rowId:_e.id,field:x.field,error:D.notARating(x.label,en(x))}]);return}Nn([{rowId:_e.id,field:x.field,value:le===0?null:le}]);return}gb(x.type)&&(m.preventDefault(),Po(ut,x.type==="date"?void 0:m.key))}};(0,A.useEffect)(()=>{let m=()=>{vu.current=!1};return window.addEventListener("mouseup",m),()=>window.removeEventListener("mouseup",m)},[]);let mp=(m,x)=>{if(m.button!==0)return;let R=m.shiftKey&&x.rowId!==null&&ut?.rowId!==null;W&&W.rowId===x.rowId&&W.field===x.field||$l(x,R),vu.current=x.rowId!==null},Kb=m=>{!vu.current||m.rowId===null||Qo(m)},[gp,vp]=Bf(Math.max(F0-An,0),Xo,re,I.length),wr=[];for(let m=gp;m<=vp;m+=1)wr.push(m);if(ue&&ue.row>=0&&(ue.row<gp||ue.row>vp)&&wr.push(ue.row),W){let m=pl.get(W.rowId);m!==void 0&&!wr.includes(m)&&wr.push(m)}let yp=`${B}-described`,bp=`${B}-help`,xr=ue?L[ue.col]:void 0,as=ue&&ue.row>=0?I[ue.row]:void 0,Xb=as&&xr?rp.get(xa(as.id,xr.field))??[]:[],Ib=as&&xr?n0(xr,h_(as,P0,xr.field),Xb,z,Ke):"",Qb={"--crewlet-sheet-columns":Rb,"--crewlet-sheet-row-height":`${re}px`,width:`${Hb}px`},Eu=An+I.length*re+2+Cb,Zb=f==="content"?{height:`${h!==void 0?Math.min(Eu,h):Eu}px`,"--crewlet-sheet-content-height":`${Eu}px`}:h!==void 0?{height:`${h}px`}:void 0,Jb=m=>{let x=An+m*re-F0,R=Xo>0?Xo:re*12;return qf(x,x+re,An,R,re*8)};return(0,_.jsxs)("div",{className:H("crewlet-sheet-grid",l==="read"&&"crewlet-sheet-grid--read",f==="content"&&"crewlet-sheet-grid--fit-content",ne),children:[(0,_.jsx)("div",{ref:q,className:"crewlet-sheet-grid__probe","aria-hidden":"true"}),(0,_.jsxs)("div",{ref:Ta,className:H("crewlet-sheet-grid__scroller",Ob&&"crewlet-sheet-grid__scroller--across",Ct&&"crewlet-sheet-grid__scroller--add-column"),style:Zb,onScroll:m=>{$0(m.currentTarget.scrollTop),Db(m.currentTarget.scrollLeft>0)},children:[(0,_.jsxs)("div",{ref:Q,role:"grid","aria-label":e,"aria-rowcount":I.length+1,"aria-colcount":L.length+1,"aria-readonly":!ce||void 0,"aria-multiselectable":"true","aria-describedby":bp,tabIndex:-1,className:H("crewlet-sheet-grid__grid",Ve&&(Ve.top!==Ve.bottom||Ve.left!==Ve.right)&&"crewlet-sheet-grid__grid--range"),style:Qb,onKeyDown:jb,onCopy:fp,onCut:Vb,onPaste:qb,children:[(0,_.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__head",children:(0,_.jsxs)("div",{role:"row","aria-rowindex":1,className:"crewlet-sheet-grid__row crewlet-sheet-grid__row--head",children:[(0,_.jsx)("div",{role:"columnheader","aria-colindex":1,className:H("crewlet-sheet-grid__corner",Jo<0&&"crewlet-sheet-grid__frozen-edge"),children:(0,_.jsx)(Ht,{children:D.rowHeader})}),L.map((m,x)=>{let R={row:fl,col:x},F=ue?.row===fl&&ue.col===x,le=w?.field===m.field?w.direction:void 0,_e=Ub.get(m.field)??[],V=(0,_.jsxs)("div",{id:U0(B,R),role:"columnheader","aria-colindex":x+2,"aria-sort":le??(b?"none":void 0),tabIndex:F?0:-1,className:H("crewlet-sheet-grid__header",`crewlet-sheet-grid__header--${m.type}`,m.frozen&&"crewlet-sheet-grid__cell--frozen",x===Jo&&"crewlet-sheet-grid__frozen-edge",F&&"crewlet-sheet-grid__header--active",st&&"crewlet-sheet-grid__header--settings",zt===m.field&&"crewlet-sheet-grid__header--open"),style:m.frozen?{insetInlineStart:`${Zl[x]}px`}:void 0,onMouseDown:Ae=>{mr(Ae)||mp(Ae,{rowId:null,field:m.field})},onFocus:Ae=>{Ae.target===Ae.currentTarget&&cp({rowId:null,field:m.field})},onClick:Ae=>{mr(Ae)||(st?gr(zt===m.field?null:m.field):b&&b(au(w,m.field)))},title:st?D.columnSettings(m.label):b?D.sortBy(m.label):m.label,children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:m.label}),(0,_.jsx)(Ht,{children:`, ${D.types[m.type]}`}),le?(0,_.jsx)("span",{className:"crewlet-sheet-grid__sort","aria-hidden":"true",children:le==="ascending"?(0,_.jsx)(i0,{size:"xs"}):(0,_.jsx)(iu,{size:"xs"})}):null,_e.length>0?(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-presence","aria-hidden":"true",children:_e.map(Ae=>(0,_.jsx)(Uo,{name:Ae.name,kind:Ae.kind,size:16,decorative:!0,className:H("crewlet-sheet-grid__header-badge",dl(Ae.hue))},Ae.id))}):null]},m.field);return st?(0,_.jsx)(fb,{label:D.columnSettings(m.label),open:zt===m.field,onOpenChange:Ae=>{!Ae&&zt===m.field&&gr(null)},trigger:()=>V,className:"crewlet-sheet-grid__column-settings",children:Ae=>O(m,Ae)},m.field):V})]})}),(0,_.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__body",style:{height:`${I.length*re}px`},children:wr.map(m=>{let x=I[m],R=Lb.get(x.id),F=`${B}-r${m}-name`,le=Ve!==null&&m>=Ve.top&&m<=Ve.bottom,_e=D.rowActions(m+1);return(0,_.jsxs)("div",{role:"row","aria-rowindex":m+2,className:"crewlet-sheet-grid__row",style:{top:`${m*re}px`},"data-row-id":x.id,children:[(0,_.jsxs)("div",{role:"rowheader","aria-colindex":1,"aria-labelledby":F,className:H("crewlet-sheet-grid__rownum",Jo<0&&"crewlet-sheet-grid__frozen-edge",tt&&"crewlet-sheet-grid__rownum--actions",le&&"crewlet-sheet-grid__rownum--selected",ap===x.id&&"crewlet-sheet-grid__rownum--open",R&&"crewlet-sheet-grid__rownum--present",R&&dl(R.hue)),children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__rownum-number","aria-hidden":"true",children:m+1}),(0,_.jsx)(Ht,{id:F,children:nu(L,x,m,z)}),tt?(0,_.jsx)("span",{className:"crewlet-sheet-grid__row-actions",children:(0,_.jsx)(mb,{label:_e,triggerTabIndex:-1,open:ap===x.id,onOpenChange:V=>np(V?x.id:null),renderTrigger:V=>(0,_.jsx)(Yo,{content:_e,align:"start",children:(0,_.jsx)(ul,{...V,label:_e,icon:(0,_.jsx)(s0,{}),size:"sm",title:""})}),items:[{key:"delete",label:D.deleteRow,icon:(0,_.jsx)(p0,{size:"sm"}),danger:!0,onSelect:()=>y?.(x.id)}]})}):null]}),L.map((V,Ae)=>{let Fb={row:m,col:Ae},wp=xa(x.id,V.field),_r=ue?.row===m&&ue.col===Ae,xp=Ve?Uf(Ve,m,Ae):!1,$b=x.pending?.includes(V.field)??!1,ns=x.refused?.[V.field]??P0.get(wp),Er=x.changed?.[V.field],_p=Rt(V,x.values[V.field]),ls=rp.get(wp),Cn=ls?.[0],Tr=W?.rowId===x.id&&W.field===V.field,Ep=_r&&o!==void 0&&!Tr;return(0,_.jsxs)("div",{id:U0(B,Fb),role:"gridcell","aria-colindex":Ae+2,"aria-selected":xp,"aria-readonly":!Fl(V)||void 0,"aria-describedby":_r?yp:void 0,tabIndex:_r&&!Tr?0:-1,className:H("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${V.type}`,V.frozen&&"crewlet-sheet-grid__cell--frozen",Ae===Jo&&"crewlet-sheet-grid__frozen-edge",xp&&"crewlet-sheet-grid__cell--selected",_r&&"crewlet-sheet-grid__cell--active",$b&&"crewlet-sheet-grid__cell--pending",ns!==void 0&&"crewlet-sheet-grid__cell--refused",Tr&&"crewlet-sheet-grid__cell--editing",Ep&&"crewlet-sheet-grid__cell--history",Cn&&"crewlet-presence-ring",Cn&&dl(Cn.hue),Cn&&(Cn.idle?"crewlet-presence-ring--idle":null)),style:V.frozen?{insetInlineStart:`${Zl[Ae]}px`}:void 0,onMouseDown:ca=>mp(ca,{rowId:x.id,field:V.field}),onFocus:ca=>{ca.target===ca.currentTarget&&cp({rowId:x.id,field:V.field})},onMouseEnter:()=>Kb({rowId:x.id,field:V.field}),onDoubleClick:()=>{V.type!=="checkbox"&&Po({rowId:x.id,field:V.field})},onClick:ca=>{V.type==="checkbox"&&ca.target.closest(".crewlet-sheet-cell__check")&&wu({rowId:x.id,field:V.field})},children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,_.jsx)(V0,{column:V,value:_p,context:z,onOpenLink:u})}),ns!==void 0?(0,_.jsx)("span",{className:"crewlet-sheet-grid__refused","aria-hidden":"true",children:(0,_.jsx)(lr,{size:"xs"})}):null,Er?(0,_.jsx)(db,{by:Er.by,at:Er.at,previous:tu(Er)&&wa(V,Rt(V,Er.previous),z)||null,locale:k,labels:D}):null,ls&&Cn?(0,_.jsx)(sb,{name:a0(ls),hue:Cn.hue,kind:Cn.kind,editing:ls.some(ca=>ca.editing)}):null,_r&&ns!==void 0&&!Tr?(0,_.jsx)("span",{className:"crewlet-sheet-grid__message","aria-hidden":"true",children:ns}):null,Ep?(0,_.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"crewlet-sheet-grid__history",title:D.history,onMouseDown:ca=>ca.stopPropagation(),onClick:()=>o?.({rowId:x.id,field:V.field}),children:(0,_.jsx)(h0,{size:"xs"})}):null,Tr?(0,_.jsx)(wb,{column:V,value:_p,context:z,seed:W.seed,label:`${V.label}, ${nu(L,x,m,z)}`,side:Jb(m),conflict:ts,onCommit:(ca,Wb)=>dp(ca,Wb),onCancel:()=>dp(void 0,null)}):null]},V.field)})]},x.id)})})]}),Ct?(0,_.jsx)("div",{className:"crewlet-sheet-grid__add-column",style:{height:`${An}px`},children:(0,_.jsx)(Yo,{content:D.addColumn,children:(0,_.jsx)(ul,{label:D.addColumn,icon:(0,_.jsx)(ou,{size:"xs"}),size:"sm",title:"",onClick:Y})})}):null]}),Pe?(0,_.jsx)("div",{ref:S,className:"crewlet-sheet-grid__measure","aria-hidden":"true",inert:!0,children:j.filter(m=>Pe.has(m.field)).map(m=>(0,_.jsxs)("div",{"data-measure":m.field,children:[(0,_.jsxs)("div",{className:H("crewlet-sheet-grid__header",`crewlet-sheet-grid__header--${m.type}`),children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:m.label}),b?(0,_.jsx)("span",{className:"crewlet-sheet-grid__sort",children:(0,_.jsx)(iu,{size:"xs"})}):null]}),(Pe.get(m.field)??[]).map((x,R)=>(0,_.jsx)("div",{className:H("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${m.type}`),children:(0,_.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,_.jsx)(V0,{column:m,value:x,context:z})})},R))]},m.field))}):null,(0,_.jsx)(Ht,{id:yp,children:Ib}),(0,_.jsx)(Ht,{id:bp,children:[D.keyboardHelp,tt?D.rowActionsHelp:"",st?D.columnSettingsHelp:""].filter(Boolean).join(" ")}),(0,_.jsx)(Ht,{children:(0,_.jsx)("span",{role:"status","aria-live":"polite",children:(0,_.jsx)("span",{children:tp.text},tp.n)})}),r||M?(0,_.jsxs)("div",{className:"crewlet-sheet-grid__foot",children:[r&&ce?(0,_.jsx)(Da,{size:"small",variant:"ghost",onClick:r,leadingIcon:(0,_.jsx)(ou,{size:"sm"}),children:D.addRow}):null,M?(0,_.jsxs)("span",{className:H("crewlet-sheet-grid__sync",((M.failed??0)>0||!M.offline&&(M.refused??0)>0)&&"crewlet-sheet-grid__sync--failed"),children:[(0,_.jsx)("span",{children:D.sync(M)}),(M.failed??0)>0&&p?(0,_.jsx)(Da,{size:"small",variant:"ghost",onClick:p,children:D.retry}):null,(M.failed??0)===0&&(M.refused??0)>0&&E?(0,_.jsx)(Da,{size:"small",variant:"ghost",onClick:E,children:D.dismiss}):null]}):null]}):null]})}function mr(e){return!e.currentTarget.contains(e.target)}function U0(e,t){return`${e}-r${t.row<0?"h":t.row}-c${t.col}`}function h_(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 I0="crewlet:ready";function Q0(e=window){let t=e.crewlet;return t?jo(t):new Promise(a=>{let n=()=>{let l=e.crewlet;l&&(e.removeEventListener(I0,n),a(jo(l)))};e.addEventListener(I0,n)})}function jo(e){return e.ready.then(()=>e)}function xb(){let e=crypto.getRandomValues(new Uint8Array(12));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}var Ga=X(Te(),1),Ha={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 Z0(e){return e.verdict==="applied"||e.verdict==="pending"?null:Do(e.verdict,e.reason,Yl)}function mu(e){let t=typeof e?.code=="string"?e.code:"",a=e instanceof Error?e.message:void 0;return Do(t,a,Yl)}function _b(e,t){let{capabilities:a}=e;return{settled:t,db:a.has("db"),presence:a.has("presence"),identity:a.has("identity")}}var f_=(e,t)=>e.settled===t.settled&&e.db===t.db&&e.presence===t.presence&&e.identity===t.identity;function p_(e){let[t,a]=(0,$.useState)(()=>_b(e,!1));return(0,$.useEffect)(()=>{let n=!0,l=i=>{let r=_b(e,i);a(o=>f_(o,r)?o:r)};return l(!1),e.ready.then(()=>{n&&l(!0)}),()=>{n=!1}},[e]),t}function Eb({runtime:e,collection:t,columns:a,sort:n,frozen:l,readOnly:i=!1,label:r,height:o}){let s=p_(e),c=s.db,d=s.presence,v=s.identity,u=(0,$.useMemo)(()=>e.data.collection(t),[e,t]),[g,w]=(0,$.useState)(null),[b,M]=(0,$.useState)(void 0),[p,h]=(0,$.useState)([]),[f,y]=(0,$.useState)(null),[E,O]=(0,$.useState)(n),[N,C]=(0,$.useState)(null),[Y,k]=(0,$.useState)([]),[ne,Me]=(0,$.useState)([]),[ve,B]=(0,$.useState)(!1),[D,Ke]=(0,$.useState)(0),[z,j]=(0,$.useState)({text:"",n:0}),[J,ot]=(0,$.useState)(null),Ze=(0,$.useCallback)(q=>j(Q=>({text:q,n:Q.n+1})),[]),[,wt]=(0,$.useState)(0),Pe=(0,$.useRef)(new Map),G=(0,$.useMemo)(()=>new $f,[]);(0,$.useEffect)(()=>O(n),[n]),(0,$.useEffect)(()=>G.subscribe(()=>wt(q=>q+1)),[G]),(0,$.useEffect)(()=>{if(!c)return;let q=!0;return e.data.schema().then(Q=>{if(!q)return;let ct=Q.find(sa=>sa.name===t)??null;M(ct?.title),a||w(dy(ct))}).catch(Q=>{pu(`the schema of ${t} could not be read`,Q),q&&!a&&w([])}),()=>{q=!1}},[e,a,c,t]),(0,$.useEffect)(()=>{if(c)return y(null),u.subscribe(q=>h(q.map(Q=>({id:Q.id,values:Q.data}))),q=>y(Ha.loadFailed(t,q.code)))},[u,c,t]),(0,$.useEffect)(()=>{if(!v)return;let q=!0;return e.identity.me().then(Q=>{q&&C(Q)}).catch(Q=>pu("the reader could not be identified",Q)),e.identity.people().then(Q=>{q&&k(Q.map(vy))}).catch(Q=>pu("the people a person cell offers could not be listed",Q)),()=>{q=!1}},[e,v]);let me=(0,$.useMemo)(()=>my(a??g??[],l),[a,g,l]);(0,$.useEffect)(()=>{if(d)return Me(e.presence.roster().members),e.presence.subscribe(q=>Me(q.members))},[e,d]),(0,$.useEffect)(()=>{if(e.connection)return B(e.connection.state==="offline"),e.connection.subscribe(q=>B(q==="offline"))},[e]);let et=(0,$.useMemo)(()=>{let q=by(ne,Pe.current);return Pe.current=q,q},[ne]),S=N?.seat??null,oe=(0,$.useMemo)(()=>wy(ne,t,S,et),[ne,t,S,et]),Je=(0,$.useMemo)(()=>_y(xy(ne,t),S,et),[ne,t,S,et]),L=(0,$.useCallback)(q=>{let Q=q.map(re=>G.begin(re.rowId,re.field)),ct=re=>{for(let Ql of Q)Ql(re===null?{ok:!0}:{ok:!1,message:re})},sa=re=>({[re.field]:re.value}),La;if(q.length===1){let[re]=q;La=u.merge(re.rowId,sa(re))}else{let re=e.data.batch();for(let Ql of q)re.merge(t,Ql.rowId,sa(Ql));La=re.commit()}La.then(re=>ct(Z0(re)),re=>ct(mu(re)))},[t,G,e,u]),I=(0,$.useCallback)(()=>{u.set(xb(),{}).then(q=>{let Q=Z0(q);Ke(ct=>Q===null?0:ct+1),Q!==null&&Ze(Ha.addRowFailed(Q))},q=>{Ke(Q=>Q+1),Ze(Ha.addRowFailed(mu(q)))})},[u,Ze]),ce=(0,$.useCallback)(q=>{let Q=me[0],ct=Q?G.begin(q,Q.field):()=>{};u.delete(q).then(sa=>{let La=Z0(sa);if(ct(La===null?{ok:!0}:{ok:!1,message:La}),La===null)for(let re of me)G.dismiss(q,re.field)},sa=>ct({ok:!1,message:mu(sa)}))},[me,G,u]),tt=(0,$.useCallback)(q=>{e.data[q]().then(Q=>{Q===null||Q.verdict==="applied"||Q.verdict==="pending"||Ze(Q.verdict==="conflict"?Ha.stepOvertaken(q):Do(Q.verdict,Q.reason,Yl))},Q=>Ze(mu(Q)))},[e,Ze]),st=(0,$.useRef)({active:null,editing:null}),Ct=(0,$.useCallback)(()=>{if(!d)return;let{active:q,editing:Q}=st.current,ct=Q??q,sa=ct?{collection:t,doc:ct.rowId,field:ct.field}:{};e.presence.set({activity:Q?"editing":"viewing",focus:sa})},[e,d,t]),oa=(0,$.useCallback)(q=>{st.current.active=q,Ct()},[Ct]),Mn=(0,$.useCallback)(q=>{st.current.editing=q,Ct()},[Ct]);if(!c)return s.settled?(0,Ga.jsx)(ir,{variant:"warning",children:Ha.noData}):null;if(f!==null)return(0,Ga.jsx)(ir,{variant:"warning",children:f});if(me.length===0&&(a!==null||g!==null))return(0,Ga.jsx)(ir,{variant:"neutral",children:Ha.noColumns(t)});let zt=i||N?.role==="viewer",gr={...G.sync(ve),failed:D},Ta=J===null?void 0:p.find(q=>q.id===J);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)(H0,{members:Je,self:!1,size:"xs",label:Ha.inSheet(Je.length)})}):null,(0,Ga.jsx)(X0,{label:r??b??t,columns:me,rows:G.decorate(p),people:Y,mode:zt?"read":"edit",onEdit:zt?void 0:L,onAddRow:zt?void 0:I,onDeleteRow:zt?void 0:ot,onActiveCellChange:oa,onEditingChange:Mn,onOpenLink:q=>{e.openLink(q).catch(Q=>pu("a link could not be opened",Q))},onUndo:()=>tt("undo"),onRedo:()=>tt("redo"),presence:oe,sort:E,onSortChange:O,sync:zt?void 0:gr,onRetry:D>0?I:void 0,onDismissRefused:()=>G.dismissAll(),height:o,fit:"content"}),(0,Ga.jsx)(x0,{open:Ta!==void 0,onClose:()=>ot(null),onConfirm:()=>{Ta&&ce(Ta.id),ot(null)},title:Ha.deleteRowTitle,message:Ha.deleteRowMessage,confirmLabel:Ha.deleteRowConfirm,cancelLabel:Ha.deleteRowCancel,destructive:!0}),z.text?(0,Ga.jsx)(ir,{variant:"warning",live:"polite",children:z.text},z.n):null]})}var Mb=X(Te(),1);function Sb(e,t){let a=e.ownerDocument.createElement("div");a.className="crewlet-kit-sheet__root",e.append(a);let n=(0,Tb.createRoot)(a),l=t,i=null,r=!1,o=()=>{r||!i||n.render((0,Mb.jsx)(Eb,{runtime:i,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=>{i=d,o()})};return s(t.runtime?jo(t.runtime):Q0(e.ownerDocument.defaultView??window)),{update(c){l=c,c.runtime&&c.runtime!==i&&s(jo(c.runtime)),o()},unmount(){r=!0,n.unmount(),a.remove()}}}var Ko=class extends HTMLElement{static get observedAttributes(){return hy}attributeChangedCallback(){this.closest("crewlet-sheet")?.dispatchEvent(new Event("crewlet-columnchange"))}toColumn(){return fy(t=>this.getAttribute(t))}},m_=["collection","sort","frozen","readonly","label","height"],gu=class extends HTMLElement{constructor(){super(...arguments);rn(this,"mounted",null);rn(this,"observer",typeof MutationObserver=="function"?new MutationObserver(()=>this.refresh()):null);rn(this,"onColumnChange",()=>this.refresh())}static get observedAttributes(){return m_}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 Ko).map(s=>s.toColumn()).filter(s=>s!==null),l=Number(this.getAttribute("frozen")),i=Number(this.getAttribute("height")),r={collection:a,columns:n,sort:py(this.getAttribute("sort")),readOnly:this.hasAttribute("readonly")};this.hasAttribute("frozen")&&Number.isInteger(l)&&l>=0&&(r.frozen=l),this.hasAttribute("height")&&Number.isFinite(i)&&i>0&&(r.height=i);let o=this.getAttribute("label")?.trim();return o&&(r.label=o),r}refresh(){let a=this.options();if(!a){this.mounted?.unmount(),this.mounted=null;return}this.mounted?this.mounted.update(a):this.mounted=Sb(this,a)}};function J0(e=customElements){e.get("crewlet-column")||e.define("crewlet-column",Ko),e.get("crewlet-sheet")||e.define("crewlet-sheet",gu)}J0();export{Ko as CrewletColumnElement,gu as CrewletSheetElement,I0 as RUNTIME_READY_EVENT,J0 as defineElements,Sb as mountSheet,Q0 as whenRuntime};
|
|
12
|
+
`?(a.push(n),t.push(a),a=[],n=""):n+=o,i+=1}return(n!==""||a.length>0)&&(a.push(n),t.push(a)),t}function Jf(e,t,a,n,l){let i={edits:[],refused:[]};if(n.length===0)return i;let r=n.length===1&&n[0].length===1,o=r?a.bottom-a.top+1:n.length,s=r?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 g=r?n[0][0]:n[c]?.[v];if(g===void 0)continue;let w=tr(u,g,l);if(!w.ok){i.refused.push({rowId:d.id,field:u.field,error:w.error});continue}Wi(w.value,Rt(u,d.values[u.field]))||i.edits.push({rowId:d.id,field:u.field,value:w.value})}}return i}function Ff(e,t,a,n){let l={edits:[],refused:[]};for(let i=a.top;i<=a.bottom;i+=1){let r=t[i];if(r)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(!Wi(Rt(s,r.values[s.field]),c)){if(s.required&&s.type!=="checkbox"){l.refused.push({rowId:r.id,field:s.field,error:n.labels.required(s.label)});continue}l.edits.push({rowId:r.id,field:s.field,value:c})}}}return l}function Do(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(){rn(this,"waiting",new Map);rn(this,"refusals",new Map);rn(this,"listeners",new Set);rn(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 i=(this.waiting.get(a)??1)-1;i<=0?this.waiting.delete(a):this.waiting.set(a,i),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[i,r]=l.split("\0");i===t.id&&a.push(r)}for(let[l,i]of this.refusals){let[r,o]=l.split("\0");r===t.id&&(n[o]=i)}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 ly(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,ly(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(r=>r.field===a.field);if(!l)return[...t];let i=a.direction==="descending"?-1:1;return t.map((r,o)=>({row:r,index:o,value:Rt(l,r.values[l.field])})).sort((r,o)=>{let s=c=>c===null||c===""||Array.isArray(c)&&c.length===0;return l.type!=="checkbox"&&(s(r.value)||s(o.value))?s(r.value)===s(o.value)?r.index-o.index:s(r.value)?1:-1:i*ay(l,r.value,o.value,n)||r.index-o.index}).map(({row:r})=>r)}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 e0(e){let t=new Map;for(let a of e??[])t.has(a.rowId)||t.set(a.rowId,a);return t}function t0(e,t=2){let a=new Map;for(let n of e??[]){let l=a.get(n.field)??[];l.length<t&&!l.some(i=>i.id===n.id)&&l.push(n),a.set(n.field,l)}return a}function a0(e){return e.map(t=>t.name).join(", ")}function n0(e,t,a,n,l=Co){let{labels:i}=n,r=[`${e.label}.`];e.readOnly&&r.push(i.readOnly(e.label)),t.pending?.includes(e.field)&&r.push(`${i.saving}.`);let o=t.refused?.[e.field];o&&r.push(o);let s=a.map(d=>d.name);s.length>0&&r.push(l.alsoHere(s));let c=t.changed?.[e.field];if(c){let d=tu(c)&&wa(e,Rt(e,c.previous),n)||null;r.push(eu(c,i,d,n.locale))}return r.join(" ")}function nu(e,t,a,n){let l=e.find(i=>i.type==="text");if(l){let i=wa(l,Rt(l,t.values[l.field]),n);if(i)return i}return String(a+1)}var l0=X(dt(),1),sy=X(Te(),1),Zx=(0,l0.createContext)(2);function cy({level:e,children:t}){return(0,sy.jsx)(Zx.Provider,{value:e,children:t})}var Jx=X(dt(),1);var uy="data-crewlet-focus-returned";function ar(e,t){if(!e)return!1;let a=()=>e.removeAttribute(uy);return e.setAttribute(uy,""),e.addEventListener("blur",a,{once:!0}),e.focus(t),e.ownerDocument.activeElement===e?!0:(e.removeEventListener("blur",a),a(),!1)}function H(...e){return e.filter(Boolean).join(" ")}var Fx=["todo","in_progress","done","blocked"];function $x(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&&Fx.includes(t.category)&&(a.category=t.category),t.archived&&(a.archived=!0),a})}function dy(e){let t=[];for(let a of e?.columns??[]){if(a.hidden)continue;let n=a.type,l=Zc(n),i={field:a.key,label:a.label||a.key,type:l?n:"text"};l||(i.readOnly=!0),a.primary&&(i.frozen=!0),a.required&&(i.required=!0),a.min!==void 0&&(i.min=a.min),a.max!==void 0&&(i.max=a.max),a.max_length!==void 0&&(i.maxLength=a.max_length),a.max_items!==void 0&&(i.maxItems=a.max_items);let r=$x(a);r&&(i.options=r),t.push(i)}return t}function Wx(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 ko=e=>{if(e===null||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0},hy=["field","type","label","format","options","width","readonly","required","frozen","min","max","max-length","max-items","time"];function fy(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 i=ko(e("width"));i!==void 0&&(l.width=i);let r=ko(e("min"));r!==void 0&&(l.min=r);let o=ko(e("max"));o!==void 0&&(l.max=o);let s=ko(e("max-length"));s!==void 0&&(l.maxLength=s);let c=ko(e("max-items"));c!==void 0&&(l.maxItems=c);let d=e("options");d&&(l.options=Rf(d));let v=e("format");return v&&l.type==="number"&&Wx(l,v),l}function py(e){let t=e?.trim();return t?t.startsWith("-")?{field:t.slice(1),direction:"descending"}:{field:t,direction:"ascending"}:null}function my(e,t){return t===void 0?[...e]:e.map((a,n)=>n<t?{...a,frozen:!0}:a)}var gy=e=>e!==void 0&&No(e)?e:void 0;function vy(e){let t={id:e.seat,name:e.displayName,kind:e.kind},a=gy(e.avatar?.hue);return a&&(t.hue=a),e.avatar?.character&&(t.character=e.avatar.character),t}function yy(e,t){return e.filter(a=>a.seat!==t)}function by(e,t){return zf(e.map(a=>({id:a.session,kind:a.kind,hue:gy(a.avatar?.hue)})),t)}function wy(e,t,a,n){let l=[];for(let i of yy(e,a)){let r=i.focus;r.collection!==t||!r.doc||!r.field||l.push({rowId:r.doc,field:r.field,id:i.session,name:i.displayName,kind:i.kind,hue:n.get(i.session)??"purple",editing:i.activity==="editing",idle:i.activity==="idle"})}return l}function xy(e,t){return e.filter(a=>a.focus.collection===t)}function _y(e,t,a){return yy(e,t).map(n=>{let l={id:n.session,seat:n.seat,name:n.displayName,kind:n.kind,activity:n.activity},i=a.get(n.session);return i&&(l.hue=i),n.avatar?.character&&(l.character=n.avatar.character),l})}var $=X(dt(),1);var Ty=X(Te(),1),Ey={xs:12,sm:14,md:16,lg:20,xl:24},Sy=1.75,Px=`var(--crewlet-glyph-stroke, ${Sy})`;function e5(e){return e===void 0?"1em":typeof e=="number"?`${e}px`:e in Ey?`${Ey[e]}px`:e}function gt({size:e,title:t,filled:a=!1,fillable:n,className:l,style:i,children:r,...o}){let s=e5(e);return(0,Ty.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:Sy,strokeLinecap:"round",strokeLinejoin:"round",style:{...i,strokeWidth:Px},children:r})}var U=X(Te(),1);function iu(e){return(0,U.jsxs)(gt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M12 5v14"}),(0,U.jsx)("path",{d:"m19 12-7 7-7-7"})]})}function i0(e){return(0,U.jsxs)(gt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"m5 12 7-7 7 7"}),(0,U.jsx)("path",{d:"M12 19V5"})]})}function nr(e){return(0,U.jsx)(gt,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"M20 6 9 17l-5-5"})})}function r0(e){return(0,U.jsx)(gt,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"m15 18-6-6 6-6"})})}function lr(e){return(0,U.jsxs)(gt,{...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 o0(e){return(0,U.jsxs)(gt,{...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 s0(e){return(0,U.jsxs)(gt,{...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 c0(e){return(0,U.jsxs)(gt,{...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 u0(e){return(0,U.jsxs)(gt,{...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 ru(e){return(0,U.jsxs)(gt,{...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 d0(e){return(0,U.jsxs)(gt,{...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)(gt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M5 12h14"}),(0,U.jsx)("path",{d:"M12 5v14"})]})}function h0(e){return(0,U.jsxs)(gt,{...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 f0(e){return(0,U.jsx)(gt,{...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 p0(e){return(0,U.jsxs)(gt,{...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 m0(e){return(0,U.jsxs)(gt,{...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 Ro(e){return(0,U.jsxs)(gt,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M18 6 6 18"}),(0,U.jsx)("path",{d:"m6 6 12 12"})]})}var _a=X(Te(),1),t5={neutral:(0,_a.jsx)(ru,{size:"md"}),info:(0,_a.jsx)(ru,{size:"md"}),success:(0,_a.jsx)(o0,{size:"md"}),warning:(0,_a.jsx)(m0,{size:"md"}),danger:(0,_a.jsx)(lr,{size:"md"})},ir=({variant:e="info",title:t,icon:a,layout:n="card",action:l,live:i,className:r,children:o,...s})=>(0,_a.jsxs)("div",{...s,"aria-live":i,className:H("crewlet-callout",`crewlet-callout--${e}`,`crewlet-callout--${n}`,r),children:[(0,_a.jsx)("span",{className:"crewlet-callout__icon","aria-hidden":!0,children:a??t5[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 Ho=X(dt(),1),My=X(Te(),1),Tn="crewlet:viewchange",rt=4;function rr(e,t,a,n=rt,l="below"){let i=e.y+e.height+n,r=e.y-n-t.height,o=a.y+a.height-i,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"?i:r,u=a.y+a.height-t.height,g=Math.max(a.y,Math.min(v,u)),w=a.x+a.width-t.width;return{left:Math.max(a.x,Math.min(e.x,w)),top:g,side:d}}function or(){return{x:0,y:0,width:window.innerWidth,height:window.innerHeight}}function sr(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 a5(n,{x:0,y:0,width:t.width,height:t.height})}function a5(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 n5=(0,Ho.createContext)(null);function sl(){let e=(0,Ho.useContext)(n5);return e||(typeof document>"u"?null:document.body)}var Re=X(dt(),1);var g0={duration:{instant:"75ms",fast:"120ms",base:"150ms",moderate:"200ms",slow:"300ms",breath:"2200ms"},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 v0={base:"0",raised:"1",sticky:"10",presence:"20",dropdown:"100",overlay:"200",layerBase:"9000",layerMax:"9899",modal:"9999",popover:"10000",toast:"10001"};var Ay=Symbol.for("crewlet.layer-stack");function l5(){let e=globalThis,t=e[Ay];if(t)return t;let a={entries:[],opened:0,armed:null,listeners:new Set,version:0,locks:0,restore:null};return e[Ay]=a,a}var Se=l5();function Ny(){Se.version+=1;for(let e of[...Se.listeners])e()}function i5(e){return Se.listeners.add(e),()=>Se.listeners.delete(e)}function cr(e){let t;for(let a of Se.entries)e&&a.kind!==e||(!t||a.order>t.order)&&(t=a);return t}var y0={base:Number(v0.layerBase),max:Number(v0.layerMax)};function r5(e){let t=0;for(let a of Se.entries)a.order<e&&(t+=1);return t}function o5(e){return e===0?y0.base:Math.min(y0.base+r5(e),y0.max)}var s5=229;function ur(e){let t="nativeEvent"in e&&e.nativeEvent||e;return!!t.isComposing||t.keyCode===s5}function Il(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 Cy(e){if(ur(e))return;if(e.key==="Escape"){if(e.defaultPrevented)return;let c=cr();if(!c)return;e.preventDefault(),c.dismissable()&&c.dismiss("escape");return}if(e.key!=="Tab"||e.defaultPrevented)return;let t=cr("modal"),a=t?.panel();if(!t||!a)return;let n=cr("popup"),l=document.activeElement;if(n&&n.order>t.order&&l&&n.panel()?.contains(l))return;let i=Il(a);if(i.length===0){e.preventDefault(),a.focus();return}let r=i[0],o=i[i.length-1];if(!(l instanceof Node)||!a.contains(l)){e.preventDefault(),(e.shiftKey?o:r).focus();return}let s=c=>(l.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;e.shiftKey&&!i.some(c=>c!==l&&!s(c))?(e.preventDefault(),o.focus()):!e.shiftKey&&!i.some(c=>c!==l&&s(c))&&(e.preventDefault(),r.focus())}function zy(e){Se.armed=null;let t=cr();if(!t||!(e.target instanceof Node))return;let a=e.target;if(t.kind==="modal"){a===t.veil()&&(Se.armed=t);return}[t.panel(),...t.inside()].some(l=>l?.contains(a))||t.dismissable()&&t.dismiss("outside")}function Oy(e){let t=Se.armed;Se.armed=null,!(!t||t!==cr()||e.target!==t.veil())&&t.dismissable()&&t.dismiss("outside")}function Dy(e){return Se.entries.length===0&&(document.addEventListener("keydown",Cy),document.addEventListener("pointerdown",zy,!0),document.addEventListener("click",Oy,!0)),Se.entries.push(e),Ny(),()=>{let t=Se.entries.indexOf(e);t>=0&&Se.entries.splice(t,1),Se.armed===e&&(Se.armed=null),Se.entries.length===0&&(document.removeEventListener("keydown",Cy),document.removeEventListener("pointerdown",zy,!0),document.removeEventListener("click",Oy,!0)),Ny()}}function ky(e){let t=(0,Re.useRef)(0);return e&&t.current===0&&(t.current=++Se.opened),e||(t.current=0),t.current}function c5(e){if(!e)return[];let t;for(let n of Se.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 Ry(e){return(0,Re.useSyncExternalStore)(i5,()=>Se.version,()=>0),{zIndex:o5(e),isTopmost:e!==0&&cr()?.order===e}}function Hy({onClose:e,dismissable:t=!0,initialFocus:a}){let n=(0,Re.useRef)(null),l=(0,Re.useRef)(null),i=(0,Re.useRef)(e),r=(0,Re.useRef)(t),o=(0,Re.useRef)(a);i.current=e,r.current=t,o.current=a;let s=ky(!0),[c]=(0,Re.useState)(()=>typeof document>"u"?[]:c5(document.activeElement)),d=Ry(s);(0,Re.useLayoutEffect)(()=>Dy({kind:"modal",order:s,panel:()=>n.current,returnTo:c,veil:()=>l.current,inside:()=>[],dismiss:()=>i.current(),dismissable:()=>r.current}),[s,c]),(0,Re.useEffect)(()=>{let g=n.current;return g&&!g.contains(document.activeElement)&&(o.current?.()??Il(g)[0]??g).focus(),()=>{let w=document.activeElement;if(!(w&&Se.entries.some(b=>b.panel()?.contains(w)))){for(let b of c)if(!(!(b instanceof HTMLElement)||!b.isConnected||b===document.body)&&ar(b))return}}},[c]);let v=(0,Re.useCallback)(g=>{n.current=g},[]),u=(0,Re.useCallback)(g=>{l.current=g},[]);return{panelRef:v,veilRef:u,...d}}function dr({open:e,onDismiss:t}){let a=(0,Re.useRef)(null),n=(0,Re.useRef)(null),l=(0,Re.useRef)(t);l.current=t;let i=ky(e),r=Ry(i);(0,Re.useLayoutEffect)(()=>{if(e)return Dy({kind:"popup",order:i,panel:()=>a.current,returnTo:[],veil:()=>null,inside:()=>[n.current],dismiss:c=>l.current(c),dismissable:()=>!0})},[e,i]);let o=(0,Re.useCallback)(c=>{a.current=c},[]),s=(0,Re.useCallback)(c=>{n.current=c},[]);return{panelRef:o,insideRef:s,...r}}function Gy(e){(0,Re.useLayoutEffect)(()=>{if(!(!e||typeof document>"u"))return Se.locks===0&&(Se.restore=document.body.style.overflow,document.body.style.overflow="hidden"),Se.locks+=1,()=>{Se.locks-=1,Se.locks===0&&(document.body.style.overflow=Se.restore??"",Se.restore=null)}},[e])}var Ly=X(Te(),1);function Ht({as:e="span",id:t,className:a,children:n}){return(0,Ly.jsx)(e,{id:t,className:H("crewlet-visually-hidden",a),children:n})}var Oa=X(dt(),1);var vt=X(Te(),1);function Uy({variant:e="primary",size:t="medium",shape:a="square",block:n,className:l},i){return H("crewlet-btn",`crewlet-btn--${e}`,`crewlet-btn--${t}`,`crewlet-btn--${a}`,n&&"crewlet-btn--block",i,l)}function b0({leadingIcon:e,trailingIcon:t,loading:a,children:n}){return(0,vt.jsxs)(vt.Fragment,{children:[a?(0,vt.jsx)("span",{className:"crewlet-btn__spinner","aria-hidden":!0}):e?(0,vt.jsx)("span",{className:"crewlet-btn__icon",children:e}):null,(0,vt.jsx)("span",{className:"crewlet-btn__label",children:n}),t?(0,vt.jsx)("span",{className:"crewlet-btn__icon",children:t}):null]})}var Da=(0,Oa.forwardRef)(function({variant:t="primary",size:a="medium",shape:n="square",leadingIcon:l,trailingIcon:i,block:r,className:o,type:s="button",asChild:c=!1,loading:d=!1,pressed:v,disabledReason:u,disabled:g,onClick:w,title:b,children:M,...p},h){let f=(0,Oa.useId)(),E=Uy({variant:t,size:a,shape:n,block:r,className:o},d?"crewlet-btn--loading":void 0);if(c){let N=Oa.Children.only(M);if(!(0,Oa.isValidElement)(N))throw new Error("Button with asChild expects exactly one valid React element child.");let C=N;return(0,Oa.cloneElement)(C,{...p,title:b,className:H(C.props.className,E)},(0,vt.jsx)(b0,{leadingIcon:l,trailingIcon:i,children:C.props.children}))}let O=d||u!==void 0;return(0,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)("button",{...p,ref:h,type:s,className:E,disabled:g,title:b,"aria-label":p["aria-label"]??(M===void 0?b:void 0),"aria-pressed":v,"aria-busy":d||void 0,"aria-disabled":O||void 0,"aria-describedby":u===void 0?p["aria-describedby"]:H(p["aria-describedby"],f),onClick:N=>{if(O){N.preventDefault();return}w?.(N)},children:(0,vt.jsx)(b0,{leadingIcon:l,trailingIcon:i,loading:d,children:M})}),u===void 0?null:(0,vt.jsx)(Ht,{id:f,children:u})]})}),wT=(0,Oa.forwardRef)(function({variant:t="primary",size:a="medium",shape:n="square",leadingIcon:l,trailingIcon:i,block:r,className:o,external:s=!1,title:c,children:d,...v},u){let g=i??(s?(0,vt.jsx)(u0,{size:"sm"}):void 0);return(0,vt.jsx)("a",{...v,ref:u,className:Uy({variant:t,size:a,shape:n,block:r,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,vt.jsx)(b0,{leadingIcon:l,trailingIcon:g,children:d})})});var ka=X(dt(),1),cl=X(Te(),1),ul=(0,ka.forwardRef)(function({label:t,icon:a,size:n="md",variant:l="ghost",pressed:i,disabledReason:r,className:o,type:s="button",asChild:c=!1,disabled:d,onClick:v,title:u,children:g,...w},b){let M=(0,ka.useId)(),p=H("crewlet-icon-btn",`crewlet-icon-btn--${n}`,`crewlet-icon-btn--${l}`,o),h=a??g;if(c){let y=ka.Children.only(g);if(!(0,ka.isValidElement)(y))throw new Error("IconButton with asChild expects exactly one valid React element child.");let E=y;return(0,ka.cloneElement)(E,{...w,"aria-label":t,title:u??t,className:H(E.props.className,p)})}let f=r!==void 0;return(0,cl.jsxs)(cl.Fragment,{children:[(0,cl.jsx)("button",{...w,ref:b,type:s,className:p,disabled:d,title:u??t,"aria-label":t,"aria-pressed":i,"aria-disabled":f||void 0,"aria-describedby":f?H(w["aria-describedby"],M):w["aria-describedby"],onClick:y=>{if(f){y.preventDefault();return}v?.(y)},children:h}),f?(0,cl.jsx)(Ht,{id:M,children:r}):null]})}),AT=(0,ka.forwardRef)(function({label:t,href:a,icon:n,size:l="md",variant:i="ghost",current:r=!1,className:o,title:s,...c},d){return(0,cl.jsx)("a",{...c,ref:d,href:a,className:H("crewlet-icon-btn",`crewlet-icon-btn--${l}`,`crewlet-icon-btn--${i}`,r&&"crewlet-icon-btn--current",o),title:s??t,"aria-label":t,"aria-current":r?"page":void 0,children:n})});var Ra=X(dt(),1),Vy=X(ni(),1);var fe=X(Te(),1);function qy({open:e,...t}){let a=sl();return e&&a?(0,fe.jsx)(d5,{container:a,...t},u5(a)):null}var By=new WeakMap,w0=0;function u5(e){let t=By.get(e);return t!==void 0?t:(w0+=1,By.set(e,w0),w0)}function yt(e){return e!=null&&e!==!1&&e!==""}function d5({container:e,onClose:t,title:a,subtitle:n,icon:l,footer:i,footerStart:r,headerActions:o,onBack:s,backLabel:c="Back",children:d,size:v="sm",variant:u="dialog",shape:g="framed",placement:w,role:b="dialog",dismissable:M=!0,closeOnBackdrop:p=!0,backdrop:h="veil",showCloseButton:f=!0,stackBody:y=!1,flush:E=!1,className:O,ariaLabel:N,describedBy:C,initialFocus:Y,onSubmit:k,closeLabel:ne="Close",closeDisabledReason:Me="Closing is unavailable until this finishes.",...ve}){let B=(0,Ra.useId)(),D=`${B}-title`,Ke=`${B}-subtitle`,z=g==="prompt"&&u==="dialog",j=!z,J=u==="sheet",ot=w??(z?"center":"top"),Ze=(0,Ra.useRef)(null),wt=(0,Ra.useRef)(null),Pe=(0,Ra.useRef)(null),G=(0,Ra.useRef)(Y);G.current=Y;let me=(0,Ra.useCallback)(()=>{let ce=G.current?.();if(ce)return ce;let tt=wt.current?Il(wt.current)[0]:void 0;return tt||((Pe.current?Il(Pe.current)[0]:void 0)??Ze.current)},[]),et=Hy({onClose:t,dismissable:M,initialFocus:me});Gy(!0);let S=yt(a)?D:void 0,oe=C??(yt(n)?Ke:void 0),Je={...ve,ref:ce=>{Ze.current=ce,et.panelRef(ce)},className:H("crewlet-modal",`crewlet-modal--${u}`,u==="dialog"?`crewlet-modal--${v}`:void 0,z?"crewlet-modal--prompt":void 0,O),role:b,"aria-modal":!0,"aria-labelledby":S,"aria-label":S===void 0?N:void 0,"aria-describedby":oe,tabIndex:-1},L=j&&f,I=(0,fe.jsxs)(fe.Fragment,{children:[j&&(yt(a)||yt(n)||yt(o)||L||s)?(0,fe.jsxs)("div",{className:H("crewlet-modal__header",J?"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)(r0,{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:H("crewlet-modal__title",J?"crewlet-modal__title--sheet":void 0),id:D,children:a}):null,yt(n)?(0,fe.jsx)("p",{className:"crewlet-modal__subtitle",id:Ke,children:n}):null]}),yt(o)?(0,fe.jsx)("div",{className:"crewlet-modal__actions",children:o}):null,L?(0,fe.jsx)(ul,{className:"crewlet-modal__close",label:ne,icon:(0,fe.jsx)(Ro,{size:"md"}),onClick:t,disabledReason:M?void 0:Me}):null]}):null,yt(d)||z&&yt(a)?(0,fe.jsxs)("div",{ref:wt,className:H("crewlet-modal__body",y?"crewlet-modal__body--stacked":void 0,E?"crewlet-modal__body--flush":void 0,J?"crewlet-modal__body--sheet":void 0),children:[z&&yt(a)?(0,fe.jsx)("p",{className:"crewlet-modal__prompt-title",id:D,children:a}):null,(0,fe.jsx)(cy,{level:2,children:d})]}):null,yt(i)||yt(r)?(0,fe.jsxs)("div",{ref:Pe,className:H("crewlet-modal__footer",J?"crewlet-modal__footer--sheet":void 0),children:[yt(r)?(0,fe.jsx)("div",{className:"crewlet-modal__footer-start",children:r}):null,(0,fe.jsx)("div",{className:"crewlet-modal__footer-end",children:i})]}):null]});return(0,Vy.createPortal)((0,fe.jsx)("div",{ref:p?et.veilRef:void 0,className:H("crewlet-modal-overlay",`crewlet-modal-overlay--${u}`,`crewlet-modal-overlay--${ot}`,h==="clear"&&"crewlet-modal-overlay--clear",e===document.body?"crewlet-modal-overlay--fixed":"crewlet-modal-overlay--in-host"),role:"presentation",style:{zIndex:et.zIndex},children:(0,fe.jsx)("div",{...Je,children:k?(0,fe.jsx)("form",{className:"crewlet-modal__form",onSubmit:ce=>{ce.preventDefault(),k()},children:I}):I})}),e)}function x0({open:e,onClose:t,onConfirm:a,title:n,message:l,children:i,confirmLabel:r="Confirm",cancelLabel:o="Cancel",destructive:s=!1,confirmVariant:c,cancelVariant:d="ghost",confirmDisabled:v=!1,confirmDisabledReason:u="Complete the confirmation above to continue.",submitting:g=!1,busyReason:w="Waiting for this to finish.",shape:b="prompt",size:M="sm"}){let p=`${(0,Ra.useId)()}-message`,h=c??(s?"danger":"primary"),f=v||g,y=(0,Ra.useCallback)(()=>{f||(async()=>{try{await a()}catch{}})()},[f,a]);return(0,fe.jsxs)(qy,{open:e,onClose:t,title:n,shape:b,size:M,role:s?"alertdialog":"dialog",describedBy:yt(l)?p:void 0,dismissable:!g,closeDisabledReason:w,onSubmit:y,stackBody:!0,footer:(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(Da,{variant:d,onClick:t,disabledReason:g?w:void 0,children:o}),(0,fe.jsx)(Da,{type:"submit",variant:h,loading:g,disabledReason:v?u:void 0,children:r})]}),children:[yt(l)?(0,fe.jsx)("p",{className:"crewlet-modal__message",id:p,children:l}):null,i]})}var h5=X(Te(),1);function dl(e){return`crewlet-presence-hue--${e}`}var hu=X(dt(),1);var su=X(Te(),1),M0={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 Yy(e,t,a){for(let n of e)n.forEach((l,i)=>{let r=n[(i+1)%n.length];l[1]!==r[1]&&a.push(l[1]<r[1]?{x0:l[0],y0:l[1],x1:r[0],y1:r[1],wind:1,add:t}:{x0:r[0],y0:r[1],x1:l[0],y1:l[1],wind:-1,add:t})})}var hr=(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 f5(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 i=e[l],r=Math.max(n.y0,i.y0),o=Math.min(n.y1,i.y1);if(o<=r)continue;let s=hr(n,r)-hr(i,r),c=hr(n,o)-hr(i,o);s*c<0&&t.add(r+(o-r)*s/(s-c))}}return[...t].sort((a,n)=>a-n)}var p5=1e-9;function m5(){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)<=p5)return l;return n.push(a),a}}function g5(e,t,a,n){let l=e.map(d=>({e:d,a:n(t,hr(d,t)),b:n(a,hr(d,a))})).sort((d,v)=>d.a+d.b-(v.a+v.b)),i=[],r=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:w}=l[d];w.add?r+=w.wind:o+=w.wind}let g=r!==0&&o===0;g&&!s?c=[v,u]:!g&&s&&i.push({left:c,right:[v,u]}),s=g}return i}function jy(e,t){let a=[],n=0;for(let[l,i]of e){let r=l;for(;n<t.length&&t[n][1]<=r;)n+=1;for(let o=n;o<t.length&&t[o][0]<i&&r<i;o+=1){let[s,c]=t[o];s>r&&a.push([r,s]),r=Math.max(r,c)}r<i&&a.push([r,i])}return a}function v5(e,t){let a=[];return t.forEach((n,l)=>{let i=e[l],r=e[l+1];for(let{left:o,right:s}of n)a.push([[s[0],i],[s[1],r]]),a.push([[o[1],r],[o[0],i]])}),e.forEach((n,l)=>{let i=l>0?t[l-1].map(({left:o,right:s})=>[o[1],s[1]]):[],r=l<t.length?t[l].map(({left:o,right:s})=>[o[0],s[0]]):[];for(let[o,s]of jy(r,i))a.push([[o,n],[s,n]]);for(let[o,s]of jy(i,r))a.push([[s,n],[o,n]])}),a.filter(([n,l])=>n[0]!==l[0]||n[1]!==l[1])}var A0=1e-9;function y5(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 i=n.length>0?n[n.length-1]:t[t.length-1],r=t[l],o=t[(l+1)%t.length],s=r[0]-i[0],c=r[1]-i[1],d=o[0]-r[0],v=o[1]-r[1],u=Math.hypot(s,c)<A0,g=Math.abs(s*v-c*d)<A0;if(u||g){a=!0;continue}n.push(r)}t=n}return t}function b5(e){let t=i=>`${i[0]} ${i[1]}`,a=new Map;e.forEach(([i],r)=>{let o=a.get(t(i));o?o.push(r):a.set(t(i),[r])});let n=new Uint8Array(e.length),l=[];return e.forEach((i,r)=>{if(n[r])return;let o=[],s=r;for(;s!==void 0;){n[s]=1;let[c,d]=e[s];if(o.push(c),d[0]===i[0][0]&&d[1]===i[0][1])break;s=a.get(t(d))?.find(v=>!n[v])}l.push(o)}),l.map(y5).filter(i=>i.length>=3&&Math.abs(uu(i))>A0)}function N0(e,t=[]){let a=[];Yy(e,!0,a),Yy(t,!1,a),a.sort((s,c)=>s.y0-c.y0);let n=f5(a),l=m5(),i=[],r=0,o=[];for(let s=0;s+1<n.length;s+=1){let c=n[s],d=n[s+1];for(;r<a.length&&a[r].y0<=c;)o.push(a[r++]);o=o.filter(v=>v.y1>c),i.push(g5(o,c,d,l))}return b5(v5(n,i))}var w5=e=>e.reduce((t,a)=>t+uu(a),0)/2;function x5(e){let t=0,a=0;for(let l of e)l.forEach((i,r)=>{let o=l[(r+1)%l.length],s=i[0]*o[1]-o[0]*i[1];t+=(i[0]+o[0])*s,a+=(i[1]+o[1])*s});let n=6*w5(e);return[t/n,a/n]}var _0=e=>uu(e)<0?e.reverse():e;function $y(e,t,a=4){let n=[];for(let l of e)l.forEach((i,r)=>{let o=l[(r+1)%l.length],s=l[(r+2)%l.length],c=Math.hypot(o[0]-i[0],o[1]-i[1]),d=(o[1]-i[1])/c,v=-(o[0]-i[0])/c,u=Math.hypot(s[0]-o[0],s[1]-o[1]),g=(s[1]-o[1])/u,w=-(s[0]-o[0])/u,b=t;n.push(_0([[i[0]+d*b,i[1]+v*b],[o[0]+d*b,o[1]+v*b],[o[0]-d*b,o[1]-v*b],[i[0]-d*b,i[1]-v*b]]));let M=(o[0]-i[0])*(s[1]-o[1])-(o[1]-i[1])*(s[0]-o[0]);if(M===0)return;let p=M>0?1:-1,h=[o[0]+p*d*b,o[1]+p*v*b],f=[o[0]+p*g*b,o[1]+p*w*b],y=d+g,E=v+w,O=y*y+E*E;if(O>0&&2/Math.sqrt(O)<=a){let N=[o[0]+p*y*2*b/O,o[1]+p*E*2*b/O];n.push(_0([o,h,N,f]))}else n.push(_0([o,h,f]))});return n}var Ky=e=>Math.round(e*100)/100;function Xy(e){return e.map(t=>`M${t.map(([n,l])=>`${Ky(n)} ${Ky(l)}`).filter((n,l,i)=>n!==i[l-1]).join("L")}Z`).join("")}var Wy=["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"],Lo=e=>typeof e=="string"&&Wy.includes(e),cu=96,_5=1.35,Py=.9,Go=1.3,E5=2,E0={full:{width:.164,height:.62},compact:{width:.19,height:.68},offset:.312},T0={half:3.2,depth:2.6},Iy=e=>Math.round(e*100)/100;function Qy(e,t){let a=[];return e.forEach((n,l)=>{let i=typeof t=="number"?t:t[l]??0;if(!i){a.push(n);return}let r=o=>{let s=o[0]-n[0],c=o[1]-n[1],d=Math.min(i/Math.hypot(s,c),.45);return[n[0]+s*d,n[1]+c*d]};a.push(r(e[(l-1+e.length)%e.length]),r(e[(l+1)%e.length]))}),a}var Zy=e=>`M${e.map(([t,a])=>`${Iy(t)} ${Iy(a)}`).join("L")}Z`;function Ge(e,t=0){let a=typeof t=="number"?e.map(()=>t):t;return uu(e)<0?Qy([...e].reverse(),[...a].reverse()):Qy(e,a)}var pe=(e,t,a,n,l=0)=>Ge([[e,t],[e+a,t],[e+a,t+n],[e,t+n]],l),He=(e,t,a,n=10)=>[pe(e,a,n,cu-a),pe(t,a,n,cu-a)];function T5(e,t,a,n,l){let i=[];for(let r=0;r<l;r+=1){let o=(r*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);i.push([e+s*Math.cos(d),t+s*Math.sin(d)])}}return Ge(i)}function S5(e){let t=e.flat(),a=t.map(([r])=>r),n=t.map(([,r])=>r),l=Math.min(...a),i=Math.min(...n);return{x:l,y:i,width:Math.max(...a)-l,height:Math.max(...n)-i}}var M5=([e,t,a,n])=>({x:e,y:t,width:a,height:n}),eb=new WeakMap;function xe(e){let t=e.holes??[],a,n={kind:"drawn",name:e.name,shape:e.shape,shapes:e.shapes.map(Zy),holes:t.map(Zy),visor:M5(e.visor),notch:e.notch===void 0?null:[e.notchX??50,e.notch],get bounds(){return a??(a=S5([...O0(n),...tb(n)]))}};return eb.set(n,{parts:e.shapes,holes:t}),n}var du=e=>eb.get(e);function O0(e){let t=du(e);return t.silhouette??(t.silhouette=N0(t.parts))}function tb(e){let t=du(e);return t.reach??(t.reach=$y(O0(e),Py+_5))}var C0=.095,ab=760,nb=869,z0=(e,t)=>[50+(e-ab)*C0,cu+(t-nb)*C0],A5=z0(M0.centroid.x,M0.centroid.y);function N5(){let{paths:e,box:t}=M0,[a,n]=z0(t.left,t.top),[l,i]=z0(t.right,t.bottom);return{kind:"mark",name:"Crewlet",shape:"The original mark, arms raised",transform:`translate(50 ${cu}) scale(${C0}) translate(${-ab} ${-nb})`,keyline:e[0],body:[e[1],e[2]],bounds:{x:a,y:n,width:l-a,height:i-n}}}var D0={crewlet:N5(),hexlet:xe({name:"Hexlet",shape:"Hexagon with pointed flanks",shapes:[Ge([[30,22],[70,22],[86,54],[70,86],[30,86],[14,54]],[5,5,4,4,4,4]),...He(34,56,84)],visor:[28,38,44,20],notch:22}),peaklet:xe({name:"Peaklet",shape:"Pentagon with a peaked roof",shapes:[Ge([[50,12],[82,36],[82,86],[18,86],[18,36]],[6,5,4,4,5]),...He(28,62,84)],visor:[26,44,48,20]}),prismlet:xe({name:"Prismlet",shape:"Triangle with cut tips",shapes:[Ge([[50,10],[90,86],[10,86]],[9,8,8]),...He(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]),...He(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]),...He(22,68,84)],visor:[21,50,58,19],notch:42}),gemlet:xe({name:"Gemlet",shape:"Diamond on its point",shapes:[Ge([[50,6],[90,48],[50,90],[10,48]],[7,7,16,7]),...He(40,52,76,8)],visor:[27,38,46,20]}),coglet:xe({name:"Coglet",shape:"Eight-tooth gear",shapes:[T5(50,52,37,31,8),...He(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),...He(37,53,84)],visor:[20,40,60,18],notch:14}),shieldlet:xe({name:"Shieldlet",shape:"Flat crown, pointed base",shapes:[Ge([[16,16],[84,16],[84,54],[50,92],[16,54]],[9,9,5,14,5]),...He(41,51,79,8)],visor:[26,28,48,20],notch:16}),stacklet:xe({name:"Stacklet",shape:"Stepped crown, square base",shapes:[Ge([[34,12],[66,12],[66,26],[82,26],[82,86],[18,86],[18,26],[34,26]],[4,4,0,5,4,4,5,0]),...He(28,62,84)],visor:[26,40,48,20],notch:12}),sparklet:xe({name:"Sparklet",shape:"Faceted drop",shapes:[Ge([[50,8],[80,48],[78,74],[64,86],[36,86],[22,74],[20,48]],[6,4,2,2,2,2,4]),...He(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),...He(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),Ge([[20,36],[26,12],[44,36]],[0,4,0]),Ge([[56,36],[74,12],[80,36]],[0,4,0]),...He(28,62,84)],visor:[26,46,48,20]}),rocketlet:xe({name:"Rocketlet",shape:"Nose cone and swept fins",shapes:[Ge([[50,6],[66,26],[66,80],[34,80],[34,26]],[5,3,3,3,3]),Ge([[34,54],[34,80],[18,90],[18,70]],[0,0,3,3]),Ge([[66,54],[82,70],[82,90],[66,80]],[0,3,3,0]),...He(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]),Ge([[18,44],[18,18],[34,32],[50,12],[66,32],[82,18],[82,44]],[0,3,0,3,0,3,0]),...He(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]),...He(36,54,84)],visor:[37,26,26,16],notch:12}),wisplet:xe({name:"Wisplet",shape:"Tall ghost with a zigzag hem",shapes:[Ge([[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:[Ge([[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]),...He(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),Ge([[40,28],[60,28],[86,80],[86,86],[14,86],[14,80]],[0,0,6,3,3,6]),...He(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),...He(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),Ge([[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:[Ge([[20,10],[64,10],[80,26],[80,86],[20,86]],[4,0,0,4,4]),...He(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:[Ge([[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:[Ge([[29,14],[87,14],[71,86],[13,86]],6),...He(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),...He(35,55,81)],visor:[26,36,48,22],notch:16}),conelet:xe({name:"Conelet",shape:"Narrow crown, wide base",shapes:[Ge([[30,12],[70,12],[88,84],[12,84]],[6,6,5,5]),...He(26,64,82)],visor:[28,40,44,20],notch:12}),hivelet:xe({name:"Hivelet",shape:"Upright honeycomb cell",shapes:[Ge([[50,6],[84,24],[84,72],[50,90],[16,72],[16,24]],[6,4,4,6,4,4]),...He(40,52,80,8)],visor:[25,36,50,20]}),folderlet:xe({name:"Folderlet",shape:"Folder with a tab",shapes:[Ge([[12,14],[38,14],[50,26],[88,26],[88,84],[12,84]],[4,0,0,6,5,5]),...He(26,64,82)],visor:[24,40,52,22]})},Jy=.5,S0=(e,t,a,n)=>[[e,t],[e+a,t],[e+a,t+n],[e,t+n]];function C5(e){let t=1/0;return e.forEach((a,n)=>{let l=e[(n+1)%e.length],i=Math.hypot(l[0]-a[0],l[1]-a[1]);if(i===0)return;let r=Math.max(...e.map(o=>Math.abs((l[0]-a[0])*(o[1]-a[1])-(l[1]-a[1])*(o[0]-a[0]))/i));t=Math.min(t,r)}),t}function z5(e,t){let{visor:a,notch:n}=e,l=t==="full",i=l?E0.full:E0.compact,r=a.width*i.width,o=a.height*i.height,s=a.y+(a.height-o)/2,c=a.x+a.width/2,d=a.width*E0.offset,v=[c-d,c+d].map(u=>S0(u-r/2,s,r,o));n&&v.push([[n[0]-T0.half,n[1]-1],[n[0]+T0.half,n[1]-1],[n[0],n[1]+T0.depth]]);for(let u of du(e).holes)(l||C5(u)>E5)&&v.push(u);if(l){let u=Go/2;v.push(S0(a.x-u,a.y-u,a.width+Go,a.height+Go)),v.push([...S0(a.x+u,a.y+u,a.width-Go,a.height-Go)].reverse())}return v}function lb(e,t){let a=e.x+e.width/2,n=e.y+e.height/2,l=a+Jy*(t[0]-a),i=n+Jy*(t[1]-n),r=Math.max(e.width+2*Math.abs(l-a),e.height+2*Math.abs(i-n));return{x:l-r/2,y:i-r/2,width:r,height:r}}function O5(e){let{parts:t}=du(e),a=O0(e),n={},l=r=>Xy(N0(t,z5(e,r))),i=()=>Xy(N0([...a,...tb(e)],[...a,...$y(a,Py)]));return{frame:lb(e.bounds,x5(a)),paths:r=>n[r]??(n[r]=r==="full"?[i(),l("full")]:[l("compact")])}}var Fy=new Map;function D5(e){let t=Fy.get(e);if(t)return t;let a=D0[e];if(a.kind==="mark"){let n=[a.keyline,...a.body];t={frame:lb(a.bounds,A5),paths:l=>l==="full"?n:a.body}}else t=O5(a);return Fy.set(e,t),t}var k5=e=>Math.round(e*100)/100,R5=({character:e,detail:t="full",...a})=>{let n=D0[e],{frame:l,paths:i}=D5(e),r=i(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(k5).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:r})})},k0=R5;var Nt=X(Te(),1);var H5={working:"working",needs:"needs you",stopped:"stopped"},R0={xs:20,sm:26,md:32,lg:40};var G5=/^agent(?:[\s._-]+)(?=\S)/i;function L5(e,t){if(e===void 0||t!=="agent")return e;let a=e.replace(G5,"");return a.trim()?a:e}var U5=56,B5=e=>{if(!e)return"?";let t=e.trim().split(/[\s\-_.:]+/).map(i=>i.replace(/^\p{P}+|\p{P}+$/gu,"")).filter(Boolean);if(t.length===0)return"?";let a=i=>(Array.from(i)[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(i=>i.toUpperCase()).join("")||"?"},V5=10,q5=e=>{let t=0;for(let a=0;a<e.length;a+=1)t=t*31+e.charCodeAt(a)>>>0;return t%V5};function Y5(e){return typeof e=="number"?e:R0[e]}var Uo=({src:e,name:t,size:a="md",kind:n="agent",tone:l="neutral",ring:i,status:r,mark:o,markLabel:s,decorative:c=!1,colorSeed:d,character:v,hue:u,icon:g,className:w,style:b,...M})=>{let[p,h]=(0,hu.useState)(!1);(0,hu.useEffect)(()=>{h(!1)},[e]);let f=typeof a=="number"?null:a,y=Y5(a),E=f===null?{"--crewlet-avatar-size":`${y}px`,fontSize:Math.max(9,Math.round(y*.36))}:{},O=l==="seeded"?q5(d??t??""):null,N=r===void 0&&o!==void 0&&o!==null,C=r!==void 0||N,Y=r!==void 0?H5[r]:N?s:void 0,k=t?`${t} avatar`:"Avatar",ne=Y?`${k}, ${Y}`:k,Me=H("crewlet-avatar",`crewlet-avatar--${n}`,f===null?null:`crewlet-avatar--${f}`,C?"crewlet-avatar--notched":null,i===void 0||C?null:`crewlet-avatar--ring-${i}`,C?null:w),ve=C?E:{...E,...b};function B(){return v!==void 0&&n==="agent"?(0,Nt.jsx)("span",{...M,className:H(Me,"crewlet-avatar--character",u===void 0?"crewlet-avatar--neutral":`crewlet-avatar--hue-${u}`),style:ve,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:ne,children:(0,Nt.jsx)(k0,{className:"crewlet-avatar__character",character:v,detail:y>=U5?"full":"compact"})}):e&&!p?(0,Nt.jsx)("img",{...M,className:H(Me,"crewlet-avatar--image"),style:ve,src:e,alt:c?"":Y?`${t??""}, ${Y}`:t??"","aria-hidden":c?!0:void 0,onError:()=>h(!0)}):(0,Nt.jsx)("span",{...M,className:H(Me,"crewlet-avatar--fallback",`crewlet-avatar--${l}`,O===null?null:`crewlet-avatar--tint-${O}`,g==null?null:"crewlet-avatar--icon"),style:ve,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:ne,children:g==null?B5(L5(t,n)):(0,Nt.jsx)("span",{className:"crewlet-avatar__icon","aria-hidden":"true",children:g})})}let D=B();return C?(0,Nt.jsxs)("span",{className:H("crewlet-avatar-frame",w),style:{"--crewlet-avatar-size":`${y}px`,...b},children:[D,r!==void 0?(0,Nt.jsx)("span",{className:`crewlet-avatar__status crewlet-avatar__status--${r}`,"aria-hidden":"true",children:j5[r]}):(0,Nt.jsx)("span",{className:"crewlet-avatar__status crewlet-avatar__status--mark","aria-hidden":"true",children:o})]}):D},j5={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 Sn=X(Te(),1);function H0({members:e,self:t=!0,max:a=4,size:n="sm",onSelect:l,label:i,labels:r,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=zo(r),c=Cf(e);if(c.length===0&&!t)return null;let d=c.slice(0,a),v=c.slice(a),u=i??s.here(c.length,t),g=[u,...c.map(p=>s.member(p))].join(". "),w=p=>(0,Sn.jsx)(Uo,{name:p.name,kind:p.kind,src:p.src,character:p.character!==void 0&&Lo(p.character)?p.character:void 0,hue:p.kind==="agent"?p.hue:void 0,size:n,decorative:!0,className:H("crewlet-presence-stack__badge",p.hue!==void 0&&p.activity!=="idle"&&dl(p.hue),p.hue!==void 0&&p.activity!=="idle"&&"crewlet-presence-stack__badge--present",p.activity==="idle"&&"crewlet-presence-stack__badge--idle")}),b=v.length>0?(0,Sn.jsxs)("span",{className:"crewlet-avatar-stack__member crewlet-avatar-stack__more","aria-hidden":"true",children:["+",v.length]}):null,M={"--crewlet-avatar-stack-size":`${R0[n]}px`};return l===void 0?c.length===0?null:(0,Sn.jsxs)("span",{className:H("crewlet-avatar-stack","crewlet-presence-stack",o),style:M,role:"img","aria-label":g,children:[d.map(p=>(0,Sn.jsx)("span",{className:H("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${p.kind}`),children:w(p)},p.id)),b]}):(0,Sn.jsxs)("div",{className:H("crewlet-avatar-stack","crewlet-presence-stack",o),style:M,role:"group","aria-label":u,children:[d.map(p=>(0,Sn.jsx)("button",{type:"button",className:H("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${p.kind}`),"aria-label":s.member(p),title:s.member(p),onClick:()=>l(p),children:w(p)},p.id)),b,v.length>0?(0,Sn.jsx)(Ht,{children:`${s.more(v.length)}: ${v.map(p=>s.member(p)).join(", ")}`}):null]})}var G0=X(dt(),1),K5=X(Te(),1),ib={text:"",n:0},X5=new Set,I5=0;function Q5(e){if(e!==""){if(I5===0){console.warn("[crewlet] announce() was called with no <Announcer> mounted, so nothing was said:",e);return}ib={text:e,n:ib.n+1};for(let t of[...X5])t()}}function rb(){return(0,G0.useCallback)(Q5,[])}var Ea=X(dt(),1),hl=X(Te(),1);function ob({label:e,max:t=6,overflow:a="expand",moreLabel:n=s=>`+${s} more`,countLabel:l=s=>`+${s}`,expandedMessage:i=s=>`Showing all ${s}.`,className:r,children:o}){let[s,c]=(0,Ea.useState)(!1),d=rb(),v=(0,Ea.useRef)(null),u=Ea.Children.toArray(o),g=a==="fit",w=Z5(v,g,u.length),b=g?u.slice(0,w):s?u:u.slice(0,t),M=u.length-b.length;return(0,hl.jsxs)("ul",{ref:v,tabIndex:-1,className:H("crewlet-tag-group",g&&"crewlet-tag-group--fit",r),"aria-label":`${e}, ${u.length}`,children:[b.map((p,h)=>(0,hl.jsx)("li",{className:"crewlet-tag-group__item",children:p},h)),M>0&&g?(0,hl.jsx)("li",{className:"crewlet-tag-group__item","data-count":"",children:(0,hl.jsx)("span",{className:"crewlet-tag-group__count",children:l(M)})}):M>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(i(u.length))},children:n(M)})}):null]})}function Z5(e,t,a){let[n,l]=(0,Ea.useState)(a),i=(0,Ea.useRef)(null);return(0,Ea.useLayoutEffect)(()=>{t&&l(a)},[t,a]),(0,Ea.useLayoutEffect)(()=>{let r=e.current;if(!t||!r)return;let o=[...r.children],s=o[0];if(!s)return;let c=s.offsetTop,d=o.filter(b=>!b.hasAttribute("data-count")),v=o.find(b=>b.hasAttribute("data-count")),u=d.filter(b=>b.offsetTop===c).length,g=v&&v.offsetTop!==c?u-1:u,w=Math.max(1,Math.min(g,d.length));w<d.length&&l(w)},[e,t,n,a]),(0,Ea.useLayoutEffect)(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver!="function")return;let o=new ResizeObserver(([s])=>{let c=s?.contentRect.width??0;i.current!==null&&i.current!==c&&l(a),i.current=c});return o.observe(r),()=>o.disconnect()},[e,t,a]),t?n:a}var Bo=X(Te(),1);function sb({name:e,hue:t,kind:a="human",editing:n=!1,placement:l="top-end",className:i,...r}){let o=typeof e=="string"?e:e.join(", ");return(0,Bo.jsxs)("span",{...r,"aria-hidden":"true",className:H("crewlet-cursor-flag",dl(t),`crewlet-cursor-flag--${a}`,`crewlet-cursor-flag--${l}`,i),children:[n?(0,Bo.jsx)(d0,{size:"xs",className:"crewlet-cursor-flag__glyph"}):null,(0,Bo.jsx)("span",{className:"crewlet-cursor-flag__name",children:o})]})}var Vo=X(Te(),1);function qo({tone:e="neutral",pulse:t=!1,children:a,className:n}){let l=a!=null&&a!==!1&&a!=="",i=(0,Vo.jsx)("span",{"aria-hidden":!0,className:H("crewlet-status-dot",`crewlet-status-dot--${e}`,t&&"is-pulsing",!l&&n)});return l?(0,Vo.jsxs)("span",{className:H("crewlet-status",n),children:[i," ",(0,Vo.jsx)("span",{className:"crewlet-status__label",children:a})]}):i}var qt=X(Te(),1);function fu(e){let{variant:t="neutral",hue:a,appearance:n="soft",size:l="sm",leadingIcon:i,dot:r=!1,count:o,monospace:s=!1,animateIn:c=!1,onClick:d,pressed:v,onRemove:u,removeAriaLabel:g="Remove tag",className:w,children:b,...M}=e,p=d!==void 0,h=p||u!==void 0,f=p&&u!==void 0;h&&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 y=h&&l==="xs"?"sm":l,E=H("crewlet-tag",a===void 0?`crewlet-tag--${t}`:`crewlet-tag--hue-${a}`,`crewlet-tag--${n}`,`crewlet-tag--${y}`,s&&"crewlet-tag--monospace",c&&"crewlet-tag--animate-in",h&&"crewlet-tag--acts",p&&!f&&"crewlet-tag--actionable",f&&"crewlet-tag--split",f&&v===!0&&"is-pressed",w),O=(0,qt.jsxs)(qt.Fragment,{children:[r?(0,qt.jsx)(qo,{tone:a===void 0?t:"neutral",className:"crewlet-tag__dot"}):null,i?(0,qt.jsx)("span",{className:"crewlet-tag__icon","aria-hidden":!0,children:i}):null,(0,qt.jsx)("span",{className:"crewlet-tag__label",children:b}),o===void 0?null:(0,qt.jsx)("span",{className:"crewlet-tag__count",children:o})]}),N=u===void 0?null:(0,qt.jsx)("button",{type:"button",className:"crewlet-tag__remove",onClick:C=>{C.stopPropagation(),u()},"aria-label":g,children:(0,qt.jsx)(Ro,{size:"xs"})});return f?(0,qt.jsxs)("span",{...M,className:E,children:[(0,qt.jsx)("button",{type:"button",className:"crewlet-tag__press",onClick:d,"aria-pressed":v===!0,children:O}),N]}):p?(0,qt.jsx)("button",{...M,type:"button",className:E,onClick:d,"aria-pressed":v===!0,children:O}):(0,qt.jsxs)("span",{...M,className:E,children:[O,N]})}var Ye=X(dt(),1),cb=X(ni(),1);var fr=X(Te(),1);function ub(e){return Number.parseFloat(e)}function J5(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 F5=ub(g0.duration.slow),$5=ub(g0.duration.base);function Yo({content:e,placement:t="top",align:a="center",disabled:n=!1,openDelay:l=F5,closeDelay:i=$5,className:r,children:o}){let c=`${(0,Ye.useId)()}-tooltip`,[d,v]=(0,Ye.useState)(!1),u=(0,Ye.useRef)(null),g=(0,Ye.useRef)(null),w=(0,Ye.useRef)(void 0),b=(0,Ye.useRef)({pointer:!1,focus:!1}),[M,p]=(0,Ye.useState)(null),h=sl(),f=(0,Ye.useCallback)(()=>{w.current!==void 0&&clearTimeout(w.current),w.current=void 0},[]),y=(0,Ye.useCallback)(B=>{if(f(),!n){if(B<=0){v(!0);return}w.current=setTimeout(()=>v(!0),B)}},[f,n]),E=(0,Ye.useCallback)(B=>{f();let D=()=>{b.current.pointer||b.current.focus||v(!1)};if(B<=0){D();return}w.current=setTimeout(D,B)},[f]),O=dr({open:d,onDismiss:()=>{b.current={pointer:!1,focus:!1},f(),v(!1)}});(0,Ye.useEffect)(()=>f,[f]),(0,Ye.useEffect)(()=>{n&&(f(),v(!1))},[n,f]);let N=(0,Ye.useCallback)(()=>{let B=u.current,D=g.current;if(!B||!D||!h)return;let Ke=h!==document.body,z=Ke?h.getBoundingClientRect():or(),j=B.getBoundingClientRect(),J=D.getBoundingClientRect(),ot=getComputedStyle(B).direction==="rtl",wt={x:(a==="center"?j.x+j.width/2-J.width/2:ot?j.right-J.width:j.x)-(Ke?z.x:0),y:j.y-(Ke?z.y:0),width:j.width,height:j.height},Pe={x:rt,y:rt,width:z.width-2*rt,height:z.height-2*rt};if(sr(j,z,Ke)){v(!1);return}let G=rr(wt,{width:J.width,height:J.height},Pe,rt,t==="top"?"above":"below");p(me=>me&&me.left===G.left&&me.top===G.top&&me.side===G.side?me:G)},[a,h,t]);(0,Ye.useLayoutEffect)(()=>{if(!d)return;N();let B=()=>N();h?.addEventListener(Tn,B),window.addEventListener("resize",B),window.addEventListener("scroll",B,!0);let D=typeof ResizeObserver=="function"?new ResizeObserver(B):null;return g.current&&D?.observe(g.current),()=>{h?.removeEventListener(Tn,B),window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0),D?.disconnect()}},[d,h,N]),(0,Ye.useEffect)(()=>{d||p(null)},[d]);let C=o,Y=C.props["aria-describedby"],k=C.props.ref,ne=(0,Ye.cloneElement)(C,{ref:B=>{u.current=B,O.insideRef(B);let D=J5(k,B);return()=>{u.current=null,O.insideRef(null),D()}},"aria-describedby":d?H(Y,c):Y,onPointerEnter:B=>{b.current.pointer=!0,y(l),C.props.onPointerEnter?.(B)},onPointerLeave:B=>{b.current.pointer=!1,E(i),C.props.onPointerLeave?.(B)},onFocus:B=>{b.current.focus=!0,y(0),C.props.onFocus?.(B)},onBlur:B=>{b.current.focus=!1,E(0),C.props.onBlur?.(B)}}),Me=M?{left:M.left,top:M.top,zIndex:O.zIndex}:{visibility:"hidden",zIndex:O.zIndex},ve=d?(0,fr.jsx)("div",{ref:B=>{g.current=B,O.panelRef(B)},id:c,role:"tooltip",className:H("crewlet-tooltip",`crewlet-tooltip--${M?.side??(t==="top"?"above":"below")}`,h!==null&&h!==document.body?"crewlet-tooltip--in-host":"crewlet-tooltip--fixed",r),style:Me,onPointerEnter:()=>{b.current.pointer=!0,f()},onPointerLeave:()=>{b.current.pointer=!1,E(i)},children:e}):null;return(0,fr.jsxs)(fr.Fragment,{children:[ne,ve&&h?(0,cb.createPortal)(ve,h):null]})}var L0=X(Te(),1);function db({by:e,at:t,previous:a=null,locale:n,className:l,labels:i}){let r=eu({by:e,at:t},Oo(i),a,n);return(0,L0.jsx)(Yo,{content:r,children:(0,L0.jsx)("span",{"aria-hidden":"true",className:H("crewlet-change-mark",l)})})}var Be=X(dt(),1),hb=X(ni(),1),pr=X(Te(),1);function fb({trigger:e,children:t,align:a="start",side:n="bottom",width:l="auto",alignOffset:i,sideOffset:r=rt,initialFocus:o,role:s="dialog",label:c,className:d,open:v,defaultOpen:u=!1,onOpenChange:g}){let b=`${(0,Be.useId)()}-popover`,[M,p]=(0,Be.useState)(u),h=v??M,f=(0,Be.useRef)(null),y=(0,Be.useRef)(null),[E,O]=(0,Be.useState)(null),N=sl(),C=(0,Be.useRef)(v!==void 0),Y=(0,Be.useRef)(g),k=(0,Be.useRef)(i),ne=(0,Be.useRef)(o);C.current=v!==void 0,Y.current=g,k.current=i,ne.current=o;let Me=(0,Be.useCallback)((G,me)=>{C.current||p(G),Y.current?.(G,me)},[]),ve=(0,Be.useCallback)(G=>{let me=y.current?.contains(document.activeElement)??!1;(G==="escape"||G==="tab"||G==="content"&&me)&&ar(f.current),Me(!1,G)},[Me]),B=dr({open:h,onDismiss:ve}),D=(0,Be.useCallback)(()=>{let G=f.current,me=y.current;if(!G||!me||!N)return;let et=N!==document.body,S=et?N.getBoundingClientRect():or(),oe=G.getBoundingClientRect();me.style.width=l==="match"?`${oe.width}px`:"";let Je=me.getBoundingClientRect(),L=k.current,I=typeof L=="function"?L(me,G):L??0,ce={x:(a==="end"?oe.right-Je.width:oe.left)+I-(et?S.x:0),y:oe.top-(et?S.y:0),width:oe.width,height:oe.height},tt={x:rt,y:rt,width:S.width-2*rt,height:S.height-2*rt};if(sr(oe,S,et)){ve("anchor-gone");return}let st=l==="match"?oe.width:void 0,Ct=rr(ce,{width:Je.width,height:Je.height},tt,r,n==="top"?"above":"below");O(oa=>oa&&oa.left===Ct.left&&oa.top===Ct.top&&oa.side===Ct.side&&oa.width===st?oa:{left:Ct.left,top:Ct.top,side:Ct.side,width:st})},[a,ve,N,n,r,l]);(0,Be.useLayoutEffect)(()=>{if(!h)return;D();let G=()=>D();N?.addEventListener(Tn,G),window.addEventListener("resize",G),window.addEventListener("scroll",G,!0);let me=typeof ResizeObserver=="function"?new ResizeObserver(G):null;return y.current&&me?.observe(y.current),()=>{N?.removeEventListener(Tn,G),window.removeEventListener("resize",G),window.removeEventListener("scroll",G,!0),me?.disconnect()}},[h,N,D]),(0,Be.useEffect)(()=>{h||O(null)},[h]);let Ke=h&&E!==null;(0,Be.useEffect)(()=>{if(!Ke||s!=="dialog")return;let G=y.current;G&&!G.contains(document.activeElement)&&(ne.current?.()??Il(G)[0]??G).focus()},[Ke,s]);let z=(0,Be.useCallback)(()=>{h?ve("trigger"):Me(!0,"trigger")},[ve,h,Me]),j=e(h,z),J=s==="none"?void 0:s,ot=(0,Be.cloneElement)(j,{ref:G=>{f.current=G,B.insideRef(G)},"aria-expanded":h,"aria-haspopup":j.props["aria-haspopup"]??J,"aria-controls":h?b:void 0});function Ze(G){G.key!=="Escape"&&G.key!=="Tab"&&!G.ctrlKey&&!G.metaKey&&!G.altKey&&G.stopPropagation()}let wt=E?{left:E.left,top:E.top,width:E.width}:{visibility:"hidden"},Pe=h?(0,pr.jsx)("div",{ref:G=>{y.current=G,B.panelRef(G)},id:b,className:H("crewlet-popover",`crewlet-popover--${E?.side??(n==="top"?"above":"below")}`,N!==null&&N!==document.body?"crewlet-popover--in-host":"crewlet-popover--fixed",d),style:{...wt,zIndex:B.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:Ze,onPointerDown:G=>G.stopPropagation(),onClick:G=>G.stopPropagation(),children:typeof t=="function"?t(()=>ve("content")):t}):null;return(0,pr.jsxs)(pr.Fragment,{children:[ot,Pe&&N?(0,hb.createPortal)(Pe,N):null]})}var je=X(dt(),1),pb=X(ni(),1);var bt=X(Te(),1),W5="[role='menuitem'],[role='menuitemradio']";function P5(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 mb({label:e,items:t,icon:a,trigger:n,trailingIcon:l,triggerVariant:i="ghost",triggerTabIndex:r,open:o,onOpenChange:s,align:c="start",width:d="content",renderTrigger:v,header:u,className:g}){let w=(0,je.useId)(),b=`${w}-menu`,M=`${w}-header`,[p,h]=(0,je.useState)(!1),f=o??p,y=(0,je.useRef)(null),E=(0,je.useRef)(null),O=(0,je.useRef)(null),N=(0,je.useRef)("first"),[C,Y]=(0,je.useState)(null),k=sl(),ne=(0,je.useRef)(o!==void 0),Me=(0,je.useRef)(s);ne.current=o!==void 0,Me.current=s;let ve=(0,je.useCallback)(S=>{ne.current||h(S),Me.current?.(S)},[]),B=(0,je.useCallback)(()=>{let S=O.current,oe=S&&S.isConnected&&S!==document.body?S:y.current;ar(oe)},[]),D=(0,je.useCallback)(S=>{S&&B(),ve(!1)},[B,ve]),Ke=dr({open:f,onDismiss:S=>D(S!=="outside")}),z=()=>E.current?[...E.current.querySelectorAll(W5)]:[];(0,je.useLayoutEffect)(()=>{if(!f)return;let S=document.activeElement;S instanceof Node&&E.current?.contains(S)||(O.current=S instanceof HTMLElement?S:null)},[f]);let j=(0,je.useCallback)(()=>{let S=y.current,oe=E.current;if(!S||!oe||!k)return;let Je=k!==document.body,L=Je?k.getBoundingClientRect():or(),I=S.getBoundingClientRect(),ce=oe.getBoundingClientRect(),tt=d==="trigger"?I.width:void 0,st={width:Math.max(ce.width,tt??0),height:ce.height},Ct={x:(c==="end"?I.right-st.width:I.left)-(Je?L.x:0),y:I.top-(Je?L.y:0),width:I.width,height:I.height},oa={x:rt,y:rt,width:L.width-2*rt,height:L.height-2*rt};if(sr(I,L,Je)){D(!0);return}let Mn=rr(Ct,{width:st.width,height:st.height},oa,rt);Y(zt=>zt&&zt.left===Mn.left&&zt.top===Mn.top&&zt.floor===tt?zt:{left:Mn.left,top:Mn.top,floor:tt})},[c,D,k,d]);(0,je.useLayoutEffect)(()=>{if(!f)return;j();let S=()=>j();k?.addEventListener(Tn,S),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0);let oe=typeof ResizeObserver=="function"?new ResizeObserver(S):null;return E.current&&oe?.observe(E.current),()=>{k?.removeEventListener(Tn,S),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),oe?.disconnect()}},[f,k,j]),(0,je.useEffect)(()=>{f||Y(null)},[f]);let J=f&&C!==null;(0,je.useLayoutEffect)(()=>{if(!J)return;let S=z();(N.current==="last"?S[S.length-1]:S[0])?.focus(),N.current="first"},[J]);function ot(S){(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),N.current=S.key==="ArrowUp"?"last":"first",ve(!0))}function Ze(S){S.key!=="Escape"&&S.key!=="Tab"&&!S.ctrlKey&&!S.metaKey&&!S.altKey&&S.stopPropagation();let oe=z(),Je=oe.indexOf(document.activeElement),L=I=>oe[(I+oe.length)%oe.length]?.focus();switch(S.key){case"ArrowDown":S.preventDefault(),L(Je+1);return;case"ArrowUp":S.preventDefault(),L(Je-1);return;case"Home":S.preventDefault(),L(0);return;case"End":S.preventDefault(),L(oe.length-1);return;case"Tab":D(!0);return;default:if(S.key.length===1&&!S.ctrlKey&&!S.metaKey&&!S.altKey&&S.key!==" "){let I=S.key.toLocaleLowerCase();for(let ce=1;ce<=oe.length;ce++){let tt=oe[(Je+ce)%oe.length];if((tt.textContent??"").trim().toLocaleLowerCase().startsWith(I)){S.preventDefault(),tt.focus();return}}}}}function wt(S){S.disabled||(D(!0),S.onSelect())}let Pe=S=>S.description!==void 0&&S.description!==null&&S.description!==!1&&S.description!=="",G=S=>(0,bt.jsxs)("button",{type:"button",role:S.checked===void 0?"menuitem":"menuitemradio","aria-checked":S.checked,tabIndex:-1,className:H("crewlet-menu__item",Pe(S)?"crewlet-menu__item--described":void 0,S.danger&&"is-danger",S.disabled&&"is-disabled"),"aria-disabled":S.disabled||void 0,onClick:()=>wt(S),children:[S.checked!==void 0&&(0,bt.jsx)("span",{className:"crewlet-menu__check","aria-hidden":!0,children:S.checked&&(0,bt.jsx)(nr,{size:"sm"})}),S.icon&&(0,bt.jsx)("span",{className:"crewlet-menu__icon",children:S.icon}),(0,bt.jsxs)("span",{className:"crewlet-menu__text",children:[(0,bt.jsx)("span",{className:"crewlet-menu__label",children:S.label}),Pe(S)?(0,bt.jsx)("span",{className:"crewlet-menu__description",children:S.description}):null]}),S.hint&&(0,bt.jsx)("span",{className:"crewlet-menu__hint",children:S.hint})]},S.key),me=f?(0,bt.jsxs)("div",{className:H("crewlet-menu",k!==null&&k!==document.body?"crewlet-menu--in-host":null,g),id:b,role:"menu","aria-label":e,"aria-describedby":u?M:void 0,tabIndex:-1,ref:S=>{E.current=S,Ke.panelRef(S)},style:C?{left:C.left,top:C.top,zIndex:Ke.zIndex,...C.floor===void 0?null:{"--crewlet-menu-floor":`${C.floor}px`}}:{visibility:"hidden"},onKeyDown:Ze,onPointerDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),children:[u?(0,bt.jsx)("div",{role:"presentation",id:M,className:"crewlet-menu__header",children:u}):null,P5(t).map(S=>S.kind==="separator"?(0,bt.jsx)("div",{role:"separator",className:"crewlet-menu__separator"},S.key):S.kind==="answers"?(0,bt.jsx)("div",{role:"group",className:"crewlet-menu__group",children:S.items.map(G)},S.key):G(S.item))]}):null,et={ref:S=>{y.current=S,Ke.insideRef(S)},"aria-haspopup":"menu","aria-expanded":f,"aria-controls":f?b:void 0,tabIndex:r,onClick:()=>{f?D(!0):(N.current="first",ve(!0))},onKeyDown:ot};return(0,bt.jsxs)("span",{className:"crewlet-menu-anchor",children:[v?v(et):n===void 0?(0,bt.jsx)(ul,{...et,label:e,icon:a??(0,bt.jsx)(c0,{}),size:"sm"}):(0,bt.jsx)(Da,{...et,"aria-label":e,variant:i,size:"small",leadingIcon:a,trailingIcon:l,children:n}),me&&k?(0,pb.createPortal)(me,k):null]})}var A=X(dt(),1);var _=X(Te(),1);function B0({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 vb({person:e,fallback:t}){return e?(0,_.jsxs)("span",{className:"crewlet-sheet-cell__person",children:[(0,_.jsx)(Uo,{name:e.name,kind:e.kind==="human"?"human":"agent",src:e.src,character:e.character!==void 0&&Lo(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 V0({column:e,value:t,context:a,onOpenLink:n}){let{labels:l}=a;if(e.type==="checkbox"){let i=t===!0;return(0,_.jsxs)("span",{className:"crewlet-sheet-cell__checkbox",children:[(0,_.jsx)("span",{className:H("crewlet-sheet-cell__check",i&&"crewlet-sheet-cell__check--on"),"aria-hidden":"true",children:i?(0,_.jsx)(nr,{size:"xs"}):null}),(0,_.jsx)(Ht,{children:i?l.checked:l.unchecked})]})}if(tn(t))return(0,_.jsx)(Ht,{children:l.empty});switch(e.type){case"select":return(0,_.jsx)(B0,{column:e,id:String(t),labels:l});case"multiselect":return(0,_.jsx)(ob,{label:e.label,overflow:"fit",className:"crewlet-sheet-cell__chips",children:t.map(i=>(0,_.jsx)(B0,{column:e,id:i,labels:l},i))});case"status":{let i=En(e,String(t)),r=wa(e,t,a);return(0,_.jsx)(qo,{tone:i&&!i.archived?Fc(i):"neutral",children:r})}case"person":return(0,_.jsx)(vb,{person:Pi(a.people,String(t)),fallback:l.unknownPerson});case"rating":{let i=en(e),r=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:i},(o,s)=>(0,_.jsx)(f0,{size:"sm",filled:s<r,className:H("crewlet-sheet-cell__star",s<r&&"crewlet-sheet-cell__star--on")},s))}),(0,_.jsx)(Ht,{children:l.rating(r,i)})]})}case"url":{let i=String(t);return(0,_.jsx)("a",{className:"crewlet-sheet-cell__link",href:i,target:"_blank",rel:"noopener noreferrer",tabIndex:-1,onClick:n?r=>{r.preventDefault(),n(i)}:void 0,children:i})}case"number":return(0,_.jsx)("span",{className:"crewlet-sheet-cell__text crewlet-sheet-cell__number",children:wa(e,t,a)});default:return(0,_.jsx)("span",{className:"crewlet-sheet-cell__text",children:wa(e,t,a)})}}var e_=new Set(["text","number","url","date","rating"]),t_=new Set(["text","longtext"]),a_=6,n_=8,yb=new Set(["select","multiselect","status","person"]),l_=e=>e!=="checkbox",gb=e=>e_.has(e)||yb.has(e)||e==="longtext";function bb(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 q0(e,t){e&&(e.focus({preventScroll:!0}),t&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.setSelectionRange(e.value.length,e.value.length))}function Y0(e){let t=(0,A.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 i_(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 j0({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)(Da,{size:"small",variant:"secondary",onClick:e.onKeepMine,children:t.keepMine}),(0,_.jsx)(Da,{size:"small",variant:"ghost",onClick:e.onUseTheirs,children:t.useTheirs(e.writer)})]})]})}function K0({id:e,message:t}){return(0,_.jsxs)("p",{id:e,className:"crewlet-sheet-editor__error",children:[(0,_.jsx)(lr,{size:"xs","aria-hidden":"true"}),(0,_.jsx)("span",{children:t})]})}function wb(e){let{column:t}=e;return yb.has(t.type)?(0,_.jsx)(u_,{...e}):t_.has(t.type)?(0,_.jsx)(o_,{...e}):(0,_.jsx)(r_,{...e})}function r_({column:e,value:t,context:a,seed:n,label:l,onCommit:i,onCancel:r,conflict:o}){let{labels:s}=a,c=(0,A.useId)(),d=(0,A.useRef)(null),v=e.type==="date",u=(0,A.useMemo)(()=>{if(v){let f=typeof t=="string"?t:"";return e.time?i_(f):f}return n??er(e,t,a)},[]),[g,w]=(0,A.useState)(u),[b,M]=(0,A.useState)(null);(0,A.useLayoutEffect)(()=>{q0(d.current,!v)},[v]);let p=f=>{let y=v&&e.time&&g!==""?new Date(g).toISOString():g,E=tr(e,y,a);return E.ok?(h.finish(),i(E.value,f),!0):(M(E.error),!1)},h=Y0(()=>{p(null)||r()});return(0,_.jsxs)("div",{className:"crewlet-sheet-editor crewlet-sheet-editor--line",onBlur:h.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":b!==null,"aria-describedby":b!==null?c:void 0,maxLength:e.type==="text"?ol(e):void 0,value:g,onChange:f=>{w(f.target.value),M(null)},onKeyDown:f=>{if(ur(f))return;if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),h.finish(),r();return}if(f.key==="Tab"&&o)return;let y=bb(f,!1);y!==void 0&&(f.preventDefault(),f.stopPropagation(),p(y))}}),b!==null||o?(0,_.jsxs)("div",{className:H("crewlet-sheet-editor__panel"),children:[b!==null?(0,_.jsx)(K0,{id:c,message:b}):null,o?(0,_.jsx)(j0,{conflict:o,labels:s}):null]}):null]})}function o_({column:e,value:t,context:a,seed:n,label:l,onCommit:i,onCancel:r,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="longtext",v=(0,A.useId)(),u=(0,A.useRef)(null),[g,w]=(0,A.useState)(()=>n??er(e,t,a)),[b,M]=(0,A.useState)(null);(0,A.useLayoutEffect)(()=>{q0(u.current,!0)},[]),(0,A.useLayoutEffect)(()=>{let f=u.current;!f||f.scrollHeight===0||(f.style.height="auto",f.style.height=`${f.scrollHeight}px`)},[g]);let p=f=>{let y=tr(e,g,a);return y.ok?(h.finish(),i(y.value,f),!0):(M(y.error),!1)},h=Y0(()=>{p(null)||r()});return(0,_.jsx)("div",{className:H("crewlet-sheet-editor","crewlet-sheet-editor--text",d&&"crewlet-sheet-editor--long",`crewlet-sheet-editor--${o}`),onBlur:h.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":b!==null,"aria-describedby":b!==null?v:void 0,maxLength:ol(e),rows:1,style:{"--crewlet-sheet-editor-lines":a_},value:g,onChange:f=>{w(d?f.target.value:f.target.value.replace(/\r?\n/g," ")),M(null)},onKeyDown:f=>{if(ur(f))return;if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),h.finish(),r();return}if(f.key==="Tab"&&s)return;let y=bb(f,d);y!==void 0&&(f.preventDefault(),f.stopPropagation(),p(y))}}),b!==null?(0,_.jsx)(K0,{id:v,message:b}):null,s?(0,_.jsx)(j0,{conflict:s,labels:c}):null]})})}function s_(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 c_({column:e,choice:t,context:a}){return t.person?(0,_.jsx)(vb,{person:t.person,fallback:t.label}):e.type==="status"&&t.option?(0,_.jsx)(qo,{tone:Fc(t.option),children:t.label}):(0,_.jsx)(B0,{column:e,id:t.id,labels:a.labels})}var nn="";function u_({column:e,value:t,context:a,seed:n,label:l,onCommit:i,onCancel:r,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="multiselect",v=(0,A.useId)(),u=(0,A.useId)(),g=(0,A.useRef)(null),w=(0,A.useRef)(null),b=(0,A.useMemo)(()=>s_(e,a),[e,a]),M=b.length>n_,[p,h]=(0,A.useState)(M?n??"":""),[f,y]=(0,A.useState)(()=>d?[...t??[]]:typeof t=="string"?[t]:[]),[E,O]=(0,A.useState)(null),N=!d&&!e.required,C=(0,A.useMemo)(()=>{let z=p.trim().toLowerCase(),j=z===""?b:b.filter(J=>J.label.toLowerCase().includes(z));return N&&z===""?[...j,{id:nn,label:c.clear}]:j},[b,p,N,c.clear]),[Y,k]=(0,A.useState)(()=>{let z=!M&&n?C.findIndex(J=>J.id!==nn&&J.label.toLowerCase().startsWith(n.toLowerCase())):-1;if(z>=0)return z;let j=C.findIndex(J=>J.id!==nn&&f.includes(J.id));return j>=0?j:0});(0,A.useEffect)(()=>{k(z=>Math.min(z,Math.max(C.length-1,0)))},[C.length]),(0,A.useLayoutEffect)(()=>{q0(M?g.current:w.current,!1)},[M]);let ne=(z,j)=>{let J=Hf(e,z,a);return J!==null?(O(J),!1):(Me.finish(),i(z,j),!0)},Me=Y0(()=>{(!d||!ne(f,null))&&r()}),ve=(z,j)=>{if(z){if(!d){ne(z.id===nn?null:z.id,j);return}O(null),y(J=>J.includes(z.id)?J.filter(ot=>ot!==z.id):[...J,z.id])}},B=z=>`${v}-${z}`,D=C.length>0?B(Y):void 0,Ke=z=>{if(!ur(z))switch(z.key){case"Escape":z.preventDefault(),z.stopPropagation(),Me.finish(),r();return;case"ArrowDown":z.preventDefault(),z.stopPropagation(),k(j=>Math.min(j+1,C.length-1));return;case"ArrowUp":z.preventDefault(),z.stopPropagation(),k(j=>Math.max(j-1,0));return;case"Home":case"End":if(p!=="")return;z.preventDefault(),z.stopPropagation(),k(z.key==="Home"?0:C.length-1);return;case"Enter":z.preventDefault(),z.stopPropagation(),d&&Kl(z)?ne(f,"down"):ve(C[Y],z.shiftKey?"up":"down");return;case" ":if(M)return;z.preventDefault(),z.stopPropagation(),ve(C[Y],d?null:"down");return;case"Tab":if(s)return;z.preventDefault(),z.stopPropagation(),ne(d?f:t,z.shiftKey?"left":"right");return;default:if(!M&&z.key.length===1&&!z.ctrlKey&&!z.metaKey&&!z.altKey){let j=z.key.toLowerCase(),J=Y+1,Ze=[...C.slice(J),...C.slice(0,J)].find(wt=>wt.id!==nn&&wt.label.toLowerCase().startsWith(j));Ze&&(z.preventDefault(),z.stopPropagation(),k(C.indexOf(Ze)))}return}};return(0,_.jsx)("div",{className:H("crewlet-sheet-editor","crewlet-sheet-editor--list",`crewlet-sheet-editor--${o}`),onBlur:Me.onBlur,children:(0,_.jsxs)("div",{className:"crewlet-sheet-editor__panel crewlet-sheet-editor__panel--list",children:[M?(0,_.jsx)("input",{ref:g,className:"crewlet-sheet-editor__filter",role:"combobox","aria-label":l,"aria-expanded":"true","aria-controls":v,"aria-autocomplete":"list","aria-activedescendant":D,"aria-invalid":E!==null,"aria-describedby":E!==null?u:void 0,placeholder:c.filter,value:p,onChange:z=>{h(z.target.value),k(0)},onKeyDown:Ke}):null,(0,_.jsx)("ul",{ref:w,className:"crewlet-sheet-editor__list",id:v,role:"listbox","aria-label":l,"aria-multiselectable":d||void 0,tabIndex:-1,"aria-activedescendant":M?void 0:D,"aria-invalid":M?void 0:E!==null,"aria-describedby":!M&&E!==null?u:void 0,onKeyDown:M?void 0:Ke,children:C.length===0?(0,_.jsx)("li",{className:"crewlet-sheet-editor__empty",role:"presentation",children:c.noOptions}):C.map((z,j)=>{let J=z.id===nn?f.length===0:f.includes(z.id);return(0,_.jsxs)("li",{id:B(j),role:"option","aria-selected":J,className:H("crewlet-sheet-editor__option",z.id===nn&&"crewlet-sheet-editor__option--clear",j===Y&&"crewlet-sheet-editor__option--highlight",J&&"crewlet-sheet-editor__option--selected"),onMouseDown:ot=>ot.preventDefault(),onMouseEnter:()=>k(j),onClick:()=>ve(z,d?null:"down"),children:[(0,_.jsx)("span",{className:"crewlet-sheet-editor__mark","aria-hidden":"true",children:J&&z.id!==nn?(0,_.jsx)(nr,{size:"xs"}):null}),z.id===nn?(0,_.jsx)("span",{className:"crewlet-sheet-cell__muted",children:z.label}):(0,_.jsx)(c_,{column:e,choice:z,context:a})]},z.id===nn?"\0clear":z.id)})}),E!==null?(0,_.jsx)(K0,{id:u,message:E}):null,s?(0,_.jsx)(j0,{conflict:s,labels:c}):null]})})}var fl=-1,d_=.6;function X0({label:e,columns:t,rows:a,people:n,mode:l="edit",onEdit:i,onAddRow:r,onShowHistory:o,onActiveCellChange:s,onEditingChange:c,onUndo:d,onRedo:v,onOpenLink:u,presence:g,sort:w,onSortChange:b,sync:M,onRetry:p,height:h,fit:f="container",onDeleteRow:y,onDismissRefused:E,renderColumnEditor:O,settingsColumn:N,onSettingsColumnChange:C,onAddColumn:Y,locale:k,className:ne,labels:Me,presenceLabels:ve}){let B=(0,A.useId)(),D=(0,A.useMemo)(()=>Oo(Me),[Me]),Ke=(0,A.useMemo)(()=>zo(ve),[ve]),z=(0,A.useMemo)(()=>({people:n,locale:k,labels:D}),[n,k,D]),j=(0,A.useMemo)(()=>jf(t),[t]),[J,ot]=(0,A.useState)(0),Ze=(0,A.useRef)(a);(0,A.useLayoutEffect)(()=>{Ze.current=a});let wt=a.length>0,[Pe,G]=(0,A.useState)(null);(0,A.useLayoutEffect)(()=>{let m=wt?Ze.current:[];G(new Map(j.filter(x=>!(x.width&&x.width>0)).map(x=>[x.field,If(x,m,z)])))},[j,wt,z]);let[me,et]=(0,A.useState)(0);(0,A.useEffect)(()=>{let m=typeof document>"u"?void 0:document.fonts;if(!m)return;let x=!0,R=()=>{x&&et(F=>F+1)};return m.ready.then(R),m.addEventListener("loadingdone",R),()=>{x=!1,m.removeEventListener("loadingdone",R)}},[]);let S=(0,A.useRef)(null),[oe,Je]=(0,A.useState)(new Map);(0,A.useLayoutEffect)(()=>{let m=S.current;if(!m)return;let x=new Map;for(let R of m.querySelectorAll("[data-measure]")){let F=0;for(let le of R.children)F=Math.max(F,le.getBoundingClientRect().width);x.set(R.dataset.measure??"",F)}Je(x)},[Pe,me]);let L=(0,A.useMemo)(()=>{let m=V=>V.width!==void 0&&V.width>0,x=j.map(V=>m(V)?V:{...V,width:Xf(V.type,oe.get(V.field)??0)});if(J<=0)return x;let R=Math.floor(J*d_)-Xl,F=x.filter(V=>V.frozen).reduce((V,Ae)=>V+an(Ae),0)-R,le=j.filter(V=>V.frozen&&!m(V)).length;if(F<=0||le===0)return x;let _e=Math.ceil(F/le);return x.map((V,Ae)=>V.frozen&&!m(j[Ae])?{...V,width:Math.max(Pc[V.type][0],an(V)-_e)}:V)},[j,oe,J]),I=(0,A.useMemo)(()=>Wf(L,a,w,z),[L,a,w,z]),ce=l==="edit"&&i!==void 0,tt=l==="edit"&&y!==void 0,st=l==="edit"&&O!==void 0,Ct=l==="edit"&&Y!==void 0,[oa,Mn]=(0,A.useState)(null),zt=N!==void 0?N:oa,gr=m=>{N===void 0&&Mn(m),C?.(m)},Ta=(0,A.useRef)(null),q=(0,A.useRef)(null),Q=(0,A.useRef)(null),[ct,sa]=(0,A.useState)(0),La=(0,A.useRef)(0),[re,Ql]=(0,A.useState)(Wc),[An,Ab]=(0,A.useState)(Wc),[Xo,Nb]=(0,A.useState)(0),[Cb,zb]=(0,A.useState)(0),[F0,$0]=(0,A.useState)(0),[Ob,Db]=(0,A.useState)(!1),[Io,Qo]=(0,A.useState)(null),[W0,Zo]=(0,A.useState)(null),[W,vr]=(0,A.useState)(null),[P0,ep]=(0,A.useState)(new Map),[tp,kb]=(0,A.useState)({text:"",n:0}),vu=(0,A.useRef)(!1),[ap,np]=(0,A.useState)(null),Yt=(0,A.useCallback)(m=>kb(x=>({text:m,n:x.n+1})),[]),lp=(0,A.useRef)(new Map);(0,A.useEffect)(()=>{let m=new Map;for(let x of a)for(let[R,F]of Object.entries(x.refused??{}))m.set(xa(x.id,R),F);for(let[x,R]of m)if(lp.current.get(x)!==R){Yt(D.notSaved(R));break}lp.current=m},[a,D,Yt]),(0,A.useLayoutEffect)(()=>{let m=()=>{let R=q.current?.offsetHeight??0;R>0&&Ql(R);let F=Q.current?.querySelector(".crewlet-sheet-grid__row--head")?.offsetHeight??0;F>0&&Ab(F),Nb(Ta.current?.clientHeight??0),ot(Ta.current?.clientWidth??0);let le=Ta.current;if(le){let _e=getComputedStyle(le),V=le.offsetHeight-le.clientHeight-(parseFloat(_e.borderTopWidth)||0)-(parseFloat(_e.borderBottomWidth)||0);zb(Math.max(0,Math.round(V)))}};if(m(),typeof ResizeObserver!="function")return;let x=new ResizeObserver(m);return Ta.current&&x.observe(Ta.current),q.current&&x.observe(q.current),()=>x.disconnect()},[]);let Zl=(0,A.useMemo)(()=>Yf(L),[L]),Rb=(0,A.useMemo)(()=>[`${Xl}px`,...L.map((m,x)=>x===L.length-1?`minmax(${an(m)}px, 1fr)`:`${an(m)}px`)].join(" "),[L]),Hb=(0,A.useMemo)(()=>L.reduce((m,x)=>m+an(x),Xl),[L]),Jo=(0,A.useMemo)(()=>L.reduce((m,x,R)=>x.frozen?R:m,-1),[L]),yu=(0,A.useMemo)(()=>{let m=Xl;return L.forEach((x,R)=>{x.frozen&&(m=(Zl[R]??m)+an(x))}),m},[L,Zl]),pl=(0,A.useMemo)(()=>new Map(I.map((m,x)=>[m.id,x])),[I]),Fo=(0,A.useMemo)(()=>new Map(L.map((m,x)=>[m.field,x])),[L]),Jl=(0,A.useCallback)(m=>{if(!m)return null;let x=Fo.get(m.field);if(x===void 0)return null;if(m.rowId===null)return{row:fl,col:x};let R=pl.get(m.rowId);return R===void 0?null:{row:R,col:x}},[Fo,pl]),ln=(0,A.useCallback)(m=>{let x=L[m.col];if(!x)return null;if(m.row===fl)return{rowId:null,field:x.field};let R=I[m.row];return R?{rowId:R.id,field:x.field}:null},[L,I]),Gb=I.length>0&&L.length>0?{rowId:I[0].id,field:L[0].field}:L.length>0?{rowId:null,field:L[0].field}:null,ue=Jl(Io)??Jl(Gb),ut=ue?ln(ue):null,ip=Jl(W0)??ue,Ve=ue&&ip&&ue.row!==fl?Lf(ip,ue):null,rp=(0,A.useMemo)(()=>Pf(g),[g]),Lb=(0,A.useMemo)(()=>e0(g),[g]),Ub=(0,A.useMemo)(()=>t0(g),[g]),op=(0,A.useRef)(null);(0,A.useEffect)(()=>{let m=ut&&ut.rowId!==null?{rowId:ut.rowId,field:ut.field}:null,x=m?xa(m.rowId,m.field):null;x!==op.current&&(op.current=x,s?.(m))},[ut,s]);let sp=(0,A.useRef)(null);(0,A.useEffect)(()=>{let m=W?xa(W.rowId,W.field):null;m!==sp.current&&(sp.current=m,c?.(W?{rowId:W.rowId,field:W.field}:null))},[W,c]);let $o=(0,A.useCallback)(m=>{m.length!==0&&(ep(x=>{let R=new Map(x);for(let F of m)R.set(xa(F.rowId,F.field),F.error);return R}),Yt(m[0].error))},[Yt]),Wo=(0,A.useCallback)(m=>{ep(x=>{if(!m.some(F=>x.has(F)))return x;let R=new Map(x);for(let F of m)R.delete(F);return R})},[]),Nn=(0,A.useCallback)(m=>{m.length===0||!i||(Wo(m.map(x=>xa(x.rowId,x.field))),i(m))},[i,Wo]),ml=(0,A.useCallback)(m=>L[Fo.get(m)??-1],[L,Fo]),gl=(0,A.useCallback)(m=>I[pl.get(m)??-1],[I,pl]),Fl=(0,A.useCallback)(m=>ce&&m!==void 0&&!m.readOnly,[ce]),bu=(0,A.useCallback)(()=>sa(m=>m+1),[]),$l=(0,A.useCallback)((m,x=!1)=>{m&&(Qo(m),x||Zo(m),bu())},[bu]),cp=m=>{Io&&Io.rowId===m.rowId&&Io.field===m.field||(Qo(m),Zo(m))},yr=ue?.row??null,br=ue?.col??null;(0,A.useLayoutEffect)(()=>{if(yr===null||br===null)return;let m=Ta.current;if(m&&yr>=0){let x=Vf(yr,m.scrollTop,m.clientHeight,re,An);x!==m.scrollTop&&(m.scrollTop=x,$0(x));let R=L[br];if(R&&!R.frozen){let F=Zl[br]??0,le=F+an(R);F-yu<m.scrollLeft?m.scrollLeft=Math.max(F-yu,0):le>m.scrollLeft+m.clientWidth&&(m.scrollLeft=le-m.clientWidth)}}ct===La.current||W||(La.current=ct,document.getElementById(U0(B,{row:yr,col:br}))?.focus({preventScroll:!0}))},[yr,br,ct,W,B,re,An,L,Zl,yu]);let Po=(0,A.useCallback)((m,x)=>{if(m.rowId===null)return;let R=ml(m.field),F=gl(m.rowId);if(!(!F||!R)){if(!Fl(R)){Yt(ce?D.readOnly(R.label):D.forbidden);return}l_(R.type)&&(Wo([xa(m.rowId,m.field)]),vr({rowId:m.rowId,field:m.field,seed:x,base:Rt(R,F.values[R.field])}))}},[Fl,Wo,ml,ce,D,gl,Yt]),wu=(0,A.useCallback)(m=>{if(m.rowId===null)return;let x=ml(m.field),R=gl(m.rowId);if(!(!R||!x||x.type!=="checkbox")){if(!Fl(x)){Yt(ce?D.readOnly(x.label):D.forbidden);return}Nn([{rowId:R.id,field:x.field,value:Rt(x,R.values[x.field])!==!0}])}},[Fl,ml,ce,Nn,D,gl,Yt]),up=(0,A.useCallback)((m,x)=>{if(x===null)return ln(m);let R={down:{row:Math.min(m.row+1,I.length-1),col:m.col},up:{row:Math.max(m.row-1,0),col:m.col},right:{row:m.row,col:Math.min(m.col+1,L.length-1)},left:{row:m.row,col:Math.max(m.col-1,0)}}[x];return ln(R)},[ln,L.length,I.length]),dp=(0,A.useCallback)((m,x)=>{if(!W)return;let R=Jl({rowId:W.rowId,field:W.field}),F=ml(W.field),le=gl(W.rowId);vr(null),m!==void 0&&F&&le&&!Wi(m,Rt(F,le.values[F.field]))&&Nn([{rowId:le.id,field:F.field,value:m}]);let _e=document.activeElement,V=_e!==null&&_e!==document.body&&!!Q.current?.contains(_e);R&&V&&$l(up(R,x))},[ml,W,Nn,$l,Jl,gl,up]);(0,A.useEffect)(()=>{W&&!pl.has(W.rowId)&&vr(null)},[W,pl]);let es=W?gl(W.rowId):void 0,Wl=W?ml(W.field):void 0,xu=W&&es&&Wl?Rt(Wl,es.values[Wl.field]):null,hp=!!(W&&es&&Wl&&!Wi(xu,W.base)),Bb=hp&&W?es?.changed?.[W.field]?.by??D.someone:"",ts=hp&&W&&Wl?{writer:Bb,value:wa(Wl,xu,z)||D.empty,onKeepMine:()=>vr(m=>m&&{...m,base:xu}),onUseTheirs:()=>{let m=Jl({rowId:W.rowId,field:W.field});vr(null),m&&$l(ln(m))}}:null,_u=ts?D.conflict(ts.writer,ts.value):"";(0,A.useEffect)(()=>{_u&&Yt(_u)},[_u,Yt]);let fp=m=>{W||!Ve||mr(m)||(m.preventDefault(),m.clipboardData.setData("text/plain",Qf(L,I,Ve,z)))},pp=(0,A.useCallback)(()=>{if(!Ve)return;if(!ce){Yt(D.forbidden);return}let m=Ff(L,I,Ve,z);Nn(m.edits),$o(m.refused)},[L,z,ce,Nn,D.forbidden,Ve,$o,I,Yt]),Vb=m=>{W||!Ve||mr(m)||(fp(m),pp())},qb=m=>{if(W||!Ve||mr(m))return;if(m.preventDefault(),!ce){Yt(D.forbidden);return}let x=Jf(L,I,Ve,Zf(m.clipboardData.getData("text/plain")),z);Nn(x.edits),$o(x.refused)},Yb=Math.max(1,Math.floor(Math.max(Xo-An,re)/re)-1),jb=m=>{if(W||ur(m)||!ue||!ut||mr(m)||m.target.closest(".crewlet-sheet-grid__row-actions"))return;let x=L[ue.col],R=Kl(m);if(R&&m.altKey&&m.key.toLowerCase()==="h"){o&&ut.rowId!==null&&(m.preventDefault(),o({rowId:ut.rowId,field:ut.field}));return}if(R&&!m.altKey&&m.key.toLowerCase()==="z"){let le=m.shiftKey?v:d;le&&(m.preventDefault(),le());return}if(R&&!m.altKey&&m.key.toLowerCase()==="y"){v&&(m.preventDefault(),v());return}if(R&&!m.altKey&&m.key.toLowerCase()==="a"){if(m.preventDefault(),I.length===0)return;Zo(ln({row:0,col:0})),Qo(ln({row:I.length-1,col:L.length-1})),bu();return}if(tt&&ut.rowId!==null&&(m.key==="ContextMenu"||m.shiftKey&&m.key==="F10")){m.preventDefault(),np(ut.rowId);return}let F=Gf(ue,m,{rows:I.length,cols:L.length,page:Yb});if(F){m.preventDefault();let le=m.shiftKey&&F.row!==fl&&ue.row!==fl;$l(ln(F),le);return}if(m.key==="Tab"){let le=m.shiftKey?-1:1,_e=ue.col+le;if(_e<0||_e>=L.length)return;m.preventDefault(),$l(ln({row:ue.row,col:_e}));return}if(ue.row===fl){(m.key==="Enter"||m.key===" ")&&x&&st?(m.preventDefault(),gr(x.field)):(m.key==="Enter"||m.key===" ")&&x&&b&&(m.preventDefault(),b(au(w,x.field)));return}switch(m.key){case"Enter":case"F2":if(m.preventDefault(),m.key==="Enter"&&R&&x?.type==="url"){let le=I[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"?wu(ut):Po(ut);return;case" ":m.preventDefault(),x?.type==="checkbox"?wu(ut):x&&gb(x.type)&&Po(ut," ");return;case"Delete":case"Backspace":m.preventDefault(),pp();return;case"Escape":W0&&Ve&&(Ve.top!==Ve.bottom||Ve.left!==Ve.right)&&(m.preventDefault(),Zo(ut));return}if(Kf(m)&&x){if(x.type==="rating"&&/^\d$/.test(m.key)){if(m.preventDefault(),!Fl(x)){Yt(ce?D.readOnly(x.label):D.forbidden);return}let le=Number(m.key),_e=I[ue.row];if(!_e)return;if(le>en(x)){$o([{rowId:_e.id,field:x.field,error:D.notARating(x.label,en(x))}]);return}Nn([{rowId:_e.id,field:x.field,value:le===0?null:le}]);return}gb(x.type)&&(m.preventDefault(),Po(ut,x.type==="date"?void 0:m.key))}};(0,A.useEffect)(()=>{let m=()=>{vu.current=!1};return window.addEventListener("mouseup",m),()=>window.removeEventListener("mouseup",m)},[]);let mp=(m,x)=>{if(m.button!==0)return;let R=m.shiftKey&&x.rowId!==null&&ut?.rowId!==null;W&&W.rowId===x.rowId&&W.field===x.field||$l(x,R),vu.current=x.rowId!==null},Kb=m=>{!vu.current||m.rowId===null||Qo(m)},[gp,vp]=Bf(Math.max(F0-An,0),Xo,re,I.length),wr=[];for(let m=gp;m<=vp;m+=1)wr.push(m);if(ue&&ue.row>=0&&(ue.row<gp||ue.row>vp)&&wr.push(ue.row),W){let m=pl.get(W.rowId);m!==void 0&&!wr.includes(m)&&wr.push(m)}let yp=`${B}-described`,bp=`${B}-help`,xr=ue?L[ue.col]:void 0,as=ue&&ue.row>=0?I[ue.row]:void 0,Xb=as&&xr?rp.get(xa(as.id,xr.field))??[]:[],Ib=as&&xr?n0(xr,h_(as,P0,xr.field),Xb,z,Ke):"",Qb={"--crewlet-sheet-columns":Rb,"--crewlet-sheet-row-height":`${re}px`,width:`${Hb}px`},Eu=An+I.length*re+2+Cb,Zb=f==="content"?{height:`${h!==void 0?Math.min(Eu,h):Eu}px`,"--crewlet-sheet-content-height":`${Eu}px`}:h!==void 0?{height:`${h}px`}:void 0,Jb=m=>{let x=An+m*re-F0,R=Xo>0?Xo:re*12;return qf(x,x+re,An,R,re*8)};return(0,_.jsxs)("div",{className:H("crewlet-sheet-grid",l==="read"&&"crewlet-sheet-grid--read",f==="content"&&"crewlet-sheet-grid--fit-content",ne),children:[(0,_.jsx)("div",{ref:q,className:"crewlet-sheet-grid__probe","aria-hidden":"true"}),(0,_.jsxs)("div",{ref:Ta,className:H("crewlet-sheet-grid__scroller",Ob&&"crewlet-sheet-grid__scroller--across",Ct&&"crewlet-sheet-grid__scroller--add-column"),style:Zb,onScroll:m=>{$0(m.currentTarget.scrollTop),Db(m.currentTarget.scrollLeft>0)},children:[(0,_.jsxs)("div",{ref:Q,role:"grid","aria-label":e,"aria-rowcount":I.length+1,"aria-colcount":L.length+1,"aria-readonly":!ce||void 0,"aria-multiselectable":"true","aria-describedby":bp,tabIndex:-1,className:H("crewlet-sheet-grid__grid",Ve&&(Ve.top!==Ve.bottom||Ve.left!==Ve.right)&&"crewlet-sheet-grid__grid--range"),style:Qb,onKeyDown:jb,onCopy:fp,onCut:Vb,onPaste:qb,children:[(0,_.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__head",children:(0,_.jsxs)("div",{role:"row","aria-rowindex":1,className:"crewlet-sheet-grid__row crewlet-sheet-grid__row--head",children:[(0,_.jsx)("div",{role:"columnheader","aria-colindex":1,className:H("crewlet-sheet-grid__corner",Jo<0&&"crewlet-sheet-grid__frozen-edge"),children:(0,_.jsx)(Ht,{children:D.rowHeader})}),L.map((m,x)=>{let R={row:fl,col:x},F=ue?.row===fl&&ue.col===x,le=w?.field===m.field?w.direction:void 0,_e=Ub.get(m.field)??[],V=(0,_.jsxs)("div",{id:U0(B,R),role:"columnheader","aria-colindex":x+2,"aria-sort":le??(b?"none":void 0),tabIndex:F?0:-1,className:H("crewlet-sheet-grid__header",`crewlet-sheet-grid__header--${m.type}`,m.frozen&&"crewlet-sheet-grid__cell--frozen",x===Jo&&"crewlet-sheet-grid__frozen-edge",F&&"crewlet-sheet-grid__header--active",st&&"crewlet-sheet-grid__header--settings",zt===m.field&&"crewlet-sheet-grid__header--open"),style:m.frozen?{insetInlineStart:`${Zl[x]}px`}:void 0,onMouseDown:Ae=>{mr(Ae)||mp(Ae,{rowId:null,field:m.field})},onFocus:Ae=>{Ae.target===Ae.currentTarget&&cp({rowId:null,field:m.field})},onClick:Ae=>{mr(Ae)||(st?gr(zt===m.field?null:m.field):b&&b(au(w,m.field)))},title:st?D.columnSettings(m.label):b?D.sortBy(m.label):m.label,children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:m.label}),(0,_.jsx)(Ht,{children:`, ${D.types[m.type]}`}),le?(0,_.jsx)("span",{className:"crewlet-sheet-grid__sort","aria-hidden":"true",children:le==="ascending"?(0,_.jsx)(i0,{size:"xs"}):(0,_.jsx)(iu,{size:"xs"})}):null,_e.length>0?(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-presence","aria-hidden":"true",children:_e.map(Ae=>(0,_.jsx)(Uo,{name:Ae.name,kind:Ae.kind,size:16,decorative:!0,className:H("crewlet-sheet-grid__header-badge",dl(Ae.hue))},Ae.id))}):null]},m.field);return st?(0,_.jsx)(fb,{label:D.columnSettings(m.label),open:zt===m.field,onOpenChange:Ae=>{!Ae&&zt===m.field&&gr(null)},trigger:()=>V,className:"crewlet-sheet-grid__column-settings",children:Ae=>O(m,Ae)},m.field):V})]})}),(0,_.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__body",style:{height:`${I.length*re}px`},children:wr.map(m=>{let x=I[m],R=Lb.get(x.id),F=`${B}-r${m}-name`,le=Ve!==null&&m>=Ve.top&&m<=Ve.bottom,_e=D.rowActions(m+1);return(0,_.jsxs)("div",{role:"row","aria-rowindex":m+2,className:"crewlet-sheet-grid__row",style:{top:`${m*re}px`},"data-row-id":x.id,children:[(0,_.jsxs)("div",{role:"rowheader","aria-colindex":1,"aria-labelledby":F,className:H("crewlet-sheet-grid__rownum",Jo<0&&"crewlet-sheet-grid__frozen-edge",tt&&"crewlet-sheet-grid__rownum--actions",le&&"crewlet-sheet-grid__rownum--selected",ap===x.id&&"crewlet-sheet-grid__rownum--open",R&&"crewlet-sheet-grid__rownum--present",R&&dl(R.hue)),children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__rownum-number","aria-hidden":"true",children:m+1}),(0,_.jsx)(Ht,{id:F,children:nu(L,x,m,z)}),tt?(0,_.jsx)("span",{className:"crewlet-sheet-grid__row-actions",children:(0,_.jsx)(mb,{label:_e,triggerTabIndex:-1,open:ap===x.id,onOpenChange:V=>np(V?x.id:null),renderTrigger:V=>(0,_.jsx)(Yo,{content:_e,align:"start",children:(0,_.jsx)(ul,{...V,label:_e,icon:(0,_.jsx)(s0,{}),size:"sm",title:""})}),items:[{key:"delete",label:D.deleteRow,icon:(0,_.jsx)(p0,{size:"sm"}),danger:!0,onSelect:()=>y?.(x.id)}]})}):null]}),L.map((V,Ae)=>{let Fb={row:m,col:Ae},wp=xa(x.id,V.field),_r=ue?.row===m&&ue.col===Ae,xp=Ve?Uf(Ve,m,Ae):!1,$b=x.pending?.includes(V.field)??!1,ns=x.refused?.[V.field]??P0.get(wp),Er=x.changed?.[V.field],_p=Rt(V,x.values[V.field]),ls=rp.get(wp),Cn=ls?.[0],Tr=W?.rowId===x.id&&W.field===V.field,Ep=_r&&o!==void 0&&!Tr;return(0,_.jsxs)("div",{id:U0(B,Fb),role:"gridcell","aria-colindex":Ae+2,"aria-selected":xp,"aria-readonly":!Fl(V)||void 0,"aria-describedby":_r?yp:void 0,tabIndex:_r&&!Tr?0:-1,className:H("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${V.type}`,V.frozen&&"crewlet-sheet-grid__cell--frozen",Ae===Jo&&"crewlet-sheet-grid__frozen-edge",xp&&"crewlet-sheet-grid__cell--selected",_r&&"crewlet-sheet-grid__cell--active",$b&&"crewlet-sheet-grid__cell--pending",ns!==void 0&&"crewlet-sheet-grid__cell--refused",Tr&&"crewlet-sheet-grid__cell--editing",Ep&&"crewlet-sheet-grid__cell--history",Cn&&"crewlet-presence-ring",Cn&&dl(Cn.hue),Cn&&(Cn.idle?"crewlet-presence-ring--idle":null)),style:V.frozen?{insetInlineStart:`${Zl[Ae]}px`}:void 0,onMouseDown:ca=>mp(ca,{rowId:x.id,field:V.field}),onFocus:ca=>{ca.target===ca.currentTarget&&cp({rowId:x.id,field:V.field})},onMouseEnter:()=>Kb({rowId:x.id,field:V.field}),onDoubleClick:()=>{V.type!=="checkbox"&&Po({rowId:x.id,field:V.field})},onClick:ca=>{V.type==="checkbox"&&ca.target.closest(".crewlet-sheet-cell__check")&&wu({rowId:x.id,field:V.field})},children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,_.jsx)(V0,{column:V,value:_p,context:z,onOpenLink:u})}),ns!==void 0?(0,_.jsx)("span",{className:"crewlet-sheet-grid__refused","aria-hidden":"true",children:(0,_.jsx)(lr,{size:"xs"})}):null,Er?(0,_.jsx)(db,{by:Er.by,at:Er.at,previous:tu(Er)&&wa(V,Rt(V,Er.previous),z)||null,locale:k,labels:D}):null,ls&&Cn?(0,_.jsx)(sb,{name:a0(ls),hue:Cn.hue,kind:Cn.kind,editing:ls.some(ca=>ca.editing)}):null,_r&&ns!==void 0&&!Tr?(0,_.jsx)("span",{className:"crewlet-sheet-grid__message","aria-hidden":"true",children:ns}):null,Ep?(0,_.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"crewlet-sheet-grid__history",title:D.history,onMouseDown:ca=>ca.stopPropagation(),onClick:()=>o?.({rowId:x.id,field:V.field}),children:(0,_.jsx)(h0,{size:"xs"})}):null,Tr?(0,_.jsx)(wb,{column:V,value:_p,context:z,seed:W.seed,label:`${V.label}, ${nu(L,x,m,z)}`,side:Jb(m),conflict:ts,onCommit:(ca,Wb)=>dp(ca,Wb),onCancel:()=>dp(void 0,null)}):null]},V.field)})]},x.id)})})]}),Ct?(0,_.jsx)("div",{className:"crewlet-sheet-grid__add-column",style:{height:`${An}px`},children:(0,_.jsx)(Yo,{content:D.addColumn,children:(0,_.jsx)(ul,{label:D.addColumn,icon:(0,_.jsx)(ou,{size:"xs"}),size:"sm",title:"",onClick:Y})})}):null]}),Pe?(0,_.jsx)("div",{ref:S,className:"crewlet-sheet-grid__measure","aria-hidden":"true",inert:!0,children:j.filter(m=>Pe.has(m.field)).map(m=>(0,_.jsxs)("div",{"data-measure":m.field,children:[(0,_.jsxs)("div",{className:H("crewlet-sheet-grid__header",`crewlet-sheet-grid__header--${m.type}`),children:[(0,_.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:m.label}),b?(0,_.jsx)("span",{className:"crewlet-sheet-grid__sort",children:(0,_.jsx)(iu,{size:"xs"})}):null]}),(Pe.get(m.field)??[]).map((x,R)=>(0,_.jsx)("div",{className:H("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${m.type}`),children:(0,_.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,_.jsx)(V0,{column:m,value:x,context:z})})},R))]},m.field))}):null,(0,_.jsx)(Ht,{id:yp,children:Ib}),(0,_.jsx)(Ht,{id:bp,children:[D.keyboardHelp,tt?D.rowActionsHelp:"",st?D.columnSettingsHelp:""].filter(Boolean).join(" ")}),(0,_.jsx)(Ht,{children:(0,_.jsx)("span",{role:"status","aria-live":"polite",children:(0,_.jsx)("span",{children:tp.text},tp.n)})}),r||M?(0,_.jsxs)("div",{className:"crewlet-sheet-grid__foot",children:[r&&ce?(0,_.jsx)(Da,{size:"small",variant:"ghost",onClick:r,leadingIcon:(0,_.jsx)(ou,{size:"sm"}),children:D.addRow}):null,M?(0,_.jsxs)("span",{className:H("crewlet-sheet-grid__sync",((M.failed??0)>0||!M.offline&&(M.refused??0)>0)&&"crewlet-sheet-grid__sync--failed"),children:[(0,_.jsx)("span",{children:D.sync(M)}),(M.failed??0)>0&&p?(0,_.jsx)(Da,{size:"small",variant:"ghost",onClick:p,children:D.retry}):null,(M.failed??0)===0&&(M.refused??0)>0&&E?(0,_.jsx)(Da,{size:"small",variant:"ghost",onClick:E,children:D.dismiss}):null]}):null]}):null]})}function mr(e){return!e.currentTarget.contains(e.target)}function U0(e,t){return`${e}-r${t.row<0?"h":t.row}-c${t.col}`}function h_(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 I0="crewlet:ready";function Q0(e=window){let t=e.crewlet;return t?jo(t):new Promise(a=>{let n=()=>{let l=e.crewlet;l&&(e.removeEventListener(I0,n),a(jo(l)))};e.addEventListener(I0,n)})}function jo(e){return e.ready.then(()=>e)}function xb(){let e=crypto.getRandomValues(new Uint8Array(12));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}var Ga=X(Te(),1),Ha={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 Z0(e){return e.verdict==="applied"||e.verdict==="pending"?null:Do(e.verdict,e.reason,Yl)}function mu(e){let t=typeof e?.code=="string"?e.code:"",a=e instanceof Error?e.message:void 0;return Do(t,a,Yl)}function _b(e,t){let{capabilities:a}=e;return{settled:t,db:a.has("db"),presence:a.has("presence"),identity:a.has("identity")}}var f_=(e,t)=>e.settled===t.settled&&e.db===t.db&&e.presence===t.presence&&e.identity===t.identity;function p_(e){let[t,a]=(0,$.useState)(()=>_b(e,!1));return(0,$.useEffect)(()=>{let n=!0,l=i=>{let r=_b(e,i);a(o=>f_(o,r)?o:r)};return l(!1),e.ready.then(()=>{n&&l(!0)}),()=>{n=!1}},[e]),t}function Eb({runtime:e,collection:t,columns:a,sort:n,frozen:l,readOnly:i=!1,label:r,height:o}){let s=p_(e),c=s.db,d=s.presence,v=s.identity,u=(0,$.useMemo)(()=>e.data.collection(t),[e,t]),[g,w]=(0,$.useState)(null),[b,M]=(0,$.useState)(void 0),[p,h]=(0,$.useState)([]),[f,y]=(0,$.useState)(null),[E,O]=(0,$.useState)(n),[N,C]=(0,$.useState)(null),[Y,k]=(0,$.useState)([]),[ne,Me]=(0,$.useState)([]),[ve,B]=(0,$.useState)(!1),[D,Ke]=(0,$.useState)(0),[z,j]=(0,$.useState)({text:"",n:0}),[J,ot]=(0,$.useState)(null),Ze=(0,$.useCallback)(q=>j(Q=>({text:q,n:Q.n+1})),[]),[,wt]=(0,$.useState)(0),Pe=(0,$.useRef)(new Map),G=(0,$.useMemo)(()=>new $f,[]);(0,$.useEffect)(()=>O(n),[n]),(0,$.useEffect)(()=>G.subscribe(()=>wt(q=>q+1)),[G]),(0,$.useEffect)(()=>{if(!c)return;let q=!0;return e.data.schema().then(Q=>{if(!q)return;let ct=Q.find(sa=>sa.name===t)??null;M(ct?.title),a||w(dy(ct))}).catch(Q=>{pu(`the schema of ${t} could not be read`,Q),q&&!a&&w([])}),()=>{q=!1}},[e,a,c,t]),(0,$.useEffect)(()=>{if(c)return y(null),u.subscribe(q=>h(q.map(Q=>({id:Q.id,values:Q.data}))),q=>y(Ha.loadFailed(t,q.code)))},[u,c,t]),(0,$.useEffect)(()=>{if(!v)return;let q=!0;return e.identity.me().then(Q=>{q&&C(Q)}).catch(Q=>pu("the reader could not be identified",Q)),e.identity.people().then(Q=>{q&&k(Q.map(vy))}).catch(Q=>pu("the people a person cell offers could not be listed",Q)),()=>{q=!1}},[e,v]);let me=(0,$.useMemo)(()=>my(a??g??[],l),[a,g,l]);(0,$.useEffect)(()=>{if(d)return Me(e.presence.roster().members),e.presence.subscribe(q=>Me(q.members))},[e,d]),(0,$.useEffect)(()=>{if(e.connection)return B(e.connection.state==="offline"),e.connection.subscribe(q=>B(q==="offline"))},[e]);let et=(0,$.useMemo)(()=>{let q=by(ne,Pe.current);return Pe.current=q,q},[ne]),S=N?.seat??null,oe=(0,$.useMemo)(()=>wy(ne,t,S,et),[ne,t,S,et]),Je=(0,$.useMemo)(()=>_y(xy(ne,t),S,et),[ne,t,S,et]),L=(0,$.useCallback)(q=>{let Q=q.map(re=>G.begin(re.rowId,re.field)),ct=re=>{for(let Ql of Q)Ql(re===null?{ok:!0}:{ok:!1,message:re})},sa=re=>({[re.field]:re.value}),La;if(q.length===1){let[re]=q;La=u.merge(re.rowId,sa(re))}else{let re=e.data.batch();for(let Ql of q)re.merge(t,Ql.rowId,sa(Ql));La=re.commit()}La.then(re=>ct(Z0(re)),re=>ct(mu(re)))},[t,G,e,u]),I=(0,$.useCallback)(()=>{u.set(xb(),{}).then(q=>{let Q=Z0(q);Ke(ct=>Q===null?0:ct+1),Q!==null&&Ze(Ha.addRowFailed(Q))},q=>{Ke(Q=>Q+1),Ze(Ha.addRowFailed(mu(q)))})},[u,Ze]),ce=(0,$.useCallback)(q=>{let Q=me[0],ct=Q?G.begin(q,Q.field):()=>{};u.delete(q).then(sa=>{let La=Z0(sa);if(ct(La===null?{ok:!0}:{ok:!1,message:La}),La===null)for(let re of me)G.dismiss(q,re.field)},sa=>ct({ok:!1,message:mu(sa)}))},[me,G,u]),tt=(0,$.useCallback)(q=>{e.data[q]().then(Q=>{Q===null||Q.verdict==="applied"||Q.verdict==="pending"||Ze(Q.verdict==="conflict"?Ha.stepOvertaken(q):Do(Q.verdict,Q.reason,Yl))},Q=>Ze(mu(Q)))},[e,Ze]),st=(0,$.useRef)({active:null,editing:null}),Ct=(0,$.useCallback)(()=>{if(!d)return;let{active:q,editing:Q}=st.current,ct=Q??q,sa=ct?{collection:t,doc:ct.rowId,field:ct.field}:{};e.presence.set({activity:Q?"editing":"viewing",focus:sa})},[e,d,t]),oa=(0,$.useCallback)(q=>{st.current.active=q,Ct()},[Ct]),Mn=(0,$.useCallback)(q=>{st.current.editing=q,Ct()},[Ct]);if(!c)return s.settled?(0,Ga.jsx)(ir,{variant:"warning",children:Ha.noData}):null;if(f!==null)return(0,Ga.jsx)(ir,{variant:"warning",children:f});if(me.length===0&&(a!==null||g!==null))return(0,Ga.jsx)(ir,{variant:"neutral",children:Ha.noColumns(t)});let zt=i||N?.role==="viewer",gr={...G.sync(ve),failed:D},Ta=J===null?void 0:p.find(q=>q.id===J);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)(H0,{members:Je,self:!1,size:"xs",label:Ha.inSheet(Je.length)})}):null,(0,Ga.jsx)(X0,{label:r??b??t,columns:me,rows:G.decorate(p),people:Y,mode:zt?"read":"edit",onEdit:zt?void 0:L,onAddRow:zt?void 0:I,onDeleteRow:zt?void 0:ot,onActiveCellChange:oa,onEditingChange:Mn,onOpenLink:q=>{e.openLink(q).catch(Q=>pu("a link could not be opened",Q))},onUndo:()=>tt("undo"),onRedo:()=>tt("redo"),presence:oe,sort:E,onSortChange:O,sync:zt?void 0:gr,onRetry:D>0?I:void 0,onDismissRefused:()=>G.dismissAll(),height:o,fit:"content"}),(0,Ga.jsx)(x0,{open:Ta!==void 0,onClose:()=>ot(null),onConfirm:()=>{Ta&&ce(Ta.id),ot(null)},title:Ha.deleteRowTitle,message:Ha.deleteRowMessage,confirmLabel:Ha.deleteRowConfirm,cancelLabel:Ha.deleteRowCancel,destructive:!0}),z.text?(0,Ga.jsx)(ir,{variant:"warning",live:"polite",children:z.text},z.n):null]})}var Mb=X(Te(),1);function Sb(e,t){let a=e.ownerDocument.createElement("div");a.className="crewlet-kit-sheet__root",e.append(a);let n=(0,Tb.createRoot)(a),l=t,i=null,r=!1,o=()=>{r||!i||n.render((0,Mb.jsx)(Eb,{runtime:i,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=>{i=d,o()})};return s(t.runtime?jo(t.runtime):Q0(e.ownerDocument.defaultView??window)),{update(c){l=c,c.runtime&&c.runtime!==i&&s(jo(c.runtime)),o()},unmount(){r=!0,n.unmount(),a.remove()}}}var Ko=class extends HTMLElement{static get observedAttributes(){return hy}attributeChangedCallback(){this.closest("crewlet-sheet")?.dispatchEvent(new Event("crewlet-columnchange"))}toColumn(){return fy(t=>this.getAttribute(t))}},m_=["collection","sort","frozen","readonly","label","height"],gu=class extends HTMLElement{constructor(){super(...arguments);rn(this,"mounted",null);rn(this,"observer",typeof MutationObserver=="function"?new MutationObserver(()=>this.refresh()):null);rn(this,"onColumnChange",()=>this.refresh())}static get observedAttributes(){return m_}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 Ko).map(s=>s.toColumn()).filter(s=>s!==null),l=Number(this.getAttribute("frozen")),i=Number(this.getAttribute("height")),r={collection:a,columns:n,sort:py(this.getAttribute("sort")),readOnly:this.hasAttribute("readonly")};this.hasAttribute("frozen")&&Number.isInteger(l)&&l>=0&&(r.frozen=l),this.hasAttribute("height")&&Number.isFinite(i)&&i>0&&(r.height=i);let o=this.getAttribute("label")?.trim();return o&&(r.label=o),r}refresh(){let a=this.options();if(!a){this.mounted?.unmount(),this.mounted=null;return}this.mounted?this.mounted.update(a):this.mounted=Sb(this,a)}};function J0(e=customElements){e.get("crewlet-column")||e.define("crewlet-column",Ko),e.get("crewlet-sheet")||e.define("crewlet-sheet",gu)}J0();export{Ko as CrewletColumnElement,gu as CrewletSheetElement,I0 as RUNTIME_READY_EVENT,J0 as defineElements,Sb as mountSheet,Q0 as whenRuntime};
|