efficient-shell 4.163.0 → 4.165.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/README.md +115 -6
- package/dist/{Browser-2I27OQFE.js → Browser-ZX5GWPSM.js} +12 -12
- package/dist/{Calculator-2EB2RAT7.js → Calculator-NZH4FVRW.js} +23 -23
- package/dist/ConfirmDialog-WEVZTFLU.js +1 -0
- package/dist/{CurrencyConverter-4EEIPAVX.js → CurrencyConverter-7OPRFA5D.js} +7 -7
- package/dist/{Documents-24YAA5UU.js → Documents-QV63346J.js} +15 -15
- package/dist/{Files-BU7FY2VD.js → Files-BU5V56YF.js} +24 -24
- package/dist/{Notepad-3D4L3K5W.js → Notepad-KZIJ5ZTF.js} +10 -10
- package/dist/PdfViewer-S2B2DZYB.js +1 -0
- package/dist/{PomodoroTimer-B4OPUTJL.js → PomodoroTimer-FJV6MGE3.js} +25 -25
- package/dist/{Preview-VZSNH76G.js → Preview-PMQKG6FH.js} +13 -13
- package/dist/{Sidebar-7AY5WJZC.js → Sidebar-E6GLVCJL.js} +26 -26
- package/dist/{Spreadsheet-TAJ24BQS.js → Spreadsheet-DE5HPVE2.js} +14 -14
- package/dist/{Stock-VEPDDIMJ.js → Stock-SSNUY34E.js} +4 -4
- package/dist/{Weather-KGZF4DDW.js → Weather-T5WM66B2.js} +21 -21
- package/dist/{WorldClock-UGADOCFW.js → WorldClock-C3GT27AV.js} +7 -7
- package/dist/apps/index.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-J5HNLMGZ.js → chunk-3U47BTEV.js} +9 -9
- package/dist/{chunk-GSBX7KIS.js → chunk-4P3IWZUC.js} +13 -13
- package/dist/{chunk-PH3PRIFP.js → chunk-4UCRT4ST.js} +5 -5
- package/dist/{chunk-WURTAA2S.js → chunk-5J2TKKGH.js} +1 -1
- package/dist/{chunk-6A7BN7EN.js → chunk-A7Q4BCPI.js} +4 -4
- package/dist/{chunk-4GOHPACN.js → chunk-D7EJSASN.js} +1 -1
- package/dist/{chunk-2FZGALCU.js → chunk-DJ6UVHAZ.js} +8 -8
- package/dist/chunk-ELSUXC3N.js +1 -0
- package/dist/{chunk-TZ2EFTST.js → chunk-FGPWGHNT.js} +9 -9
- package/dist/{chunk-UMOVLVTC.js → chunk-FZRQBHTK.js} +1 -1
- package/dist/{chunk-E4JWTNG5.js → chunk-KRTZFHYW.js} +15 -15
- package/dist/{chunk-NLASNJNY.js → chunk-KSSAVLO7.js} +1 -1
- package/dist/chunk-NCQLGQYR.js +1 -0
- package/dist/{chunk-IJ3V2YOS.js → chunk-PLX2N4N6.js} +9 -9
- package/dist/{chunk-MAMJHPFN.js → chunk-QTPVA26D.js} +1 -1
- package/dist/{chunk-ZAJPQAGP.js → chunk-QZG72OVX.js} +1 -1
- package/dist/{chunk-PX435JG4.js → chunk-RKEHUV7U.js} +1 -1
- package/dist/chunk-SHVGZW2J.js +1 -0
- package/dist/chunk-SQ7BPUZG.js +9 -0
- package/dist/chunk-VDL2RLZG.js +10 -0
- package/dist/chunk-XYITV4EC.js +983 -0
- package/dist/{chunk-FWY5IRGL.js → chunk-YWXYBJ5Y.js} +2 -2
- package/dist/{chunk-TBM3ZIAN.js → chunk-ZLJCWBDF.js} +61 -61
- package/dist/file-intake/index.js +1 -1
- package/dist/{index-JQXMH_km.d.ts → index-DRkpyISn.d.ts} +239 -16
- package/dist/index.d.ts +11 -4
- package/dist/index.js +92 -92
- package/dist/map/index.js +4 -4
- package/dist/page-tabs/index.js +4 -4
- package/dist/pdf/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/ConfirmDialog-4LZXI6FM.js +0 -1
- package/dist/PdfViewer-5VBKCPCM.js +0 -1
- package/dist/chunk-A6O4Y63A.js +0 -1
- package/dist/chunk-L7ZMDZAB.js +0 -9
- package/dist/chunk-OSJ3ADF2.js +0 -1
- package/dist/chunk-QRJ2ERKR.js +0 -9
- package/dist/chunk-VWTYRICQ.js +0 -963
- package/dist/chunk-YJX2IWHB.js +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{useDismissPopupsOnOpen as e,registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-
|
|
1
|
+
import{useDismissPopupsOnOpen as e,registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-ELSUXC3N.js";import{useShellStrings as r,splitAround as o}from"./chunk-NCQLGQYR.js";import{createContext as l,useEffect as i,useRef as a,useId as s,useContext as c,useState as d,useCallback as u}from"react";import{jsxs as m,jsx as f,Fragment as h}from"react/jsx-runtime";var b=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function g(e){return Array.from(e.querySelectorAll(b)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var p=[];function v(e){const t=p.findIndex(t=>t!==e&&e.contains(t));-1===t?p.push(e):p.splice(t,0,e)}function x(e){const t=p.lastIndexOf(e);-1!==t&&p.splice(t,1)}var y=/* @__PURE__ */new WeakSet;function w(e){return g(e)}function N(e,t){i(()=>{if(!t)return;const n=e.current;return n?(y.add(n),v(n),()=>{x(n),y.delete(n)}):void 0},[e,t])}function k(e,t){const n=p.lastIndexOf(t),r=n>0?p[n-1]:-1===n?p[p.length-1]??null:null,o=g(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),l=o.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return l||(r&&!y.has(r)?o[0]??null:null)}function C(e,t,n){i(()=>{if(!t)return;const r=e.current;if(!r)return;const o=document.activeElement,l=n?.current??g(r)[0]??r;l!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),l.focus();const i=e=>{if("Tab"!==e.key)return;if(p[p.length-1]!==r)return;const t=g(r);if(0===t.length)return void e.preventDefault();const n=t[0],o=t[t.length-1],l=document.activeElement;!e.shiftKey||l!==n&&r.contains(l)?e.shiftKey||l!==o&&r.contains(l)||(e.preventDefault(),n.focus()):(e.preventDefault(),o.focus())};return v(r),document.addEventListener("keydown",i,!0),()=>{x(r),document.removeEventListener("keydown",i,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&o?.focus?.()}},[e,t,n])}var L=0,E=null;function P(e){i(()=>{if(!e)return;const t=document.body;if(0===L){E={overflow:t.style.overflow,paddingRight:t.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;t.style.overflow="hidden",e>0&&(t.style.paddingRight=`${e}px`)}return L+=1,()=>{0===(L-=1)&&E&&(t.style.overflow=E.overflow,t.style.paddingRight=E.paddingRight,E=null)}},[e])}var j={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function D({open:o,onClose:l,title:c,description:d,role:u="dialog",children:h,footer:b,blocking:g=!1,size:p="md",initialFocus:v,"aria-label":x,"aria-labelledby":y,"aria-describedby":w,className:N=""}){const k=a(null),L=s(),E=s(),D=!g&&!b,T=s(),W=r().dialog;return e(o),C(k,o,v),P(o),i(()=>{if(o)return t(()=>(g||l(),!0),()=>k.current)},[o,g,l]),o?/* @__PURE__ */m("div",{className:"fixed inset-0",style:{zIndex:n.overlay},role:"presentation",children:[
|
|
2
2
|
/* @__PURE__ */f("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
|
|
3
|
-
/* @__PURE__ */f("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:g?void 0:e=>{e.target===e.currentTarget&&l()},children:/* @__PURE__ */m("div",{ref:k,role:u,"aria-modal":"true","aria-labelledby":c?
|
|
4
|
-
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})}function
|
|
5
|
-
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function
|
|
6
|
-
return m(
|
|
3
|
+
/* @__PURE__ */f("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:g?void 0:e=>{e.target===e.currentTarget&&l()},children:/* @__PURE__ */m("div",{ref:k,role:u,"aria-modal":"true","aria-labelledby":c?T:y,"aria-label":c||y?void 0:x,"aria-describedby":w??(d?E:h?L:void 0),className:`relative max-h-full w-full ${j[p]} overflow-y-auto overscroll-contain rounded-lg bg-white p-6 shadow-xl ${N}`.trim(),children:[c&&/* @__PURE__ */f("h2",{id:T,className:(D?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:c}),d&&/* @__PURE__ */f("p",{id:E,className:((c?"mt-1":D?"pr-8":"")+" text-sm text-gray-500").trim(),children:d}),h&&/* @__PURE__ */f("div",{id:L,className:"mt-2 text-sm text-gray-600",children:h}),b&&/* @__PURE__ */f("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:b}),D&&/* @__PURE__ */f("button",{type:"button",onClick:l,"aria-label":W.close,className:"absolute right-3 top-3 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */f("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:/* @__PURE__ */f("path",{d:"M6 6l8 8M14 6l-8 8"})})})]})})]}):null}var T=l(()=>Promise.resolve(!1)),W=()=>c(T),F=()=>Promise.resolve(!1),I=e=>F(e),M=()=>Promise.resolve(!1),O=e=>M(e),$=()=>Promise.resolve(null),R=e=>$(e),z={danger:{icon:"text-red-600 bg-red-100",button:"bg-red-600 hover:bg-red-700 text-white"},warning:{icon:"text-yellow-600 bg-yellow-100",button:"bg-yellow-600 hover:bg-yellow-700 text-white"},info:{icon:"text-blue-600 bg-blue-100",button:"bg-blue-600 hover:bg-blue-700 text-white"}},A="bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50";function K(){/* @__PURE__ */
|
|
4
|
+
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})}function S(){/* @__PURE__ */
|
|
5
|
+
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function B({children:e}){const[t,n]=d(!1),[l,s]=d({message:""}),[c,b]=d(0),g=a(),p=a(null),v=a(0),x=a([]),y=a(null),w=a(null),N=u(e=>{p.current=e.id,g.current=e.resolve,b(e.id),s(e.options),n(!0)},[]),k=u(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++v.current,options:t,resolve:e};null===p.current?N(n):x.current.push(n)})},[N]),[C,L]=d(!1),[E,P]=d({message:""}),[j,W]=d(""),I=a(),O=u(e=>(P(e),W(""),L(!0),new Promise(e=>{I.current=e})),[]),[R,B]=d(!1),[G,Q]=d({}),[U,_]=d(""),q=a(),H=u(e=>{const t="string"==typeof e?{message:e}:e;return Q(t),_(t.defaultValue??""),B(!0),new Promise(e=>{q.current=e})},[]);i(()=>{F=k,M=O,$=H},[k,O,H]);const V=(e,t)=>{if(p.current!==e)return;const r=g.current,o=x.current.shift();o?N(o):(p.current=null,g.current=void 0,n(!1)),r?.(t)},X=e=>{L(!1),W(""),I.current?.(e)},Y=e=>{if(e){const e=U.trim();if(!e&&!G.allowEmpty)return B(!1),void q.current?.(null);B(!1),q.current?.(e)}else B(!1),q.current?.(null)},J=l.variant||(l.confirmLabel?.toLowerCase().includes("delete")||l.message.toLowerCase().includes("delete")?"danger":"info"),Z=z[J],ee=z["warning"===E.variant?"warning":"danger"],te=E.confirmWord,ne=null==te||j===te,re=r().dialog,[oe,le]=o(re.typeToConfirm);/* @__PURE__ */
|
|
6
|
+
return m(T.Provider,{value:k,children:[e,
|
|
7
7
|
/* @__PURE__ */f(D,{open:t,onClose:()=>V(c,!1),initialFocus:y,footer:/* @__PURE__ */m(h,{children:[
|
|
8
|
-
/* @__PURE__ */f("button",{ref:y,type:"button",onClick:()=>V(c,!1),className:
|
|
8
|
+
/* @__PURE__ */f("button",{ref:y,type:"button",onClick:()=>V(c,!1),className:A,children:l.cancelLabel||re.cancel}),
|
|
9
9
|
/* @__PURE__ */f("button",{type:"button",onClick:()=>V(c,!0),className:`px-4 py-2 text-sm font-medium rounded-lg ${Z.button}`,children:l.confirmLabel||re.ok})]}),children:/* @__PURE__ */m("div",{className:"flex gap-4",children:[
|
|
10
|
-
/* @__PURE__ */f("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${Z.icon}`,children:/* @__PURE__ */f(
|
|
10
|
+
/* @__PURE__ */f("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${Z.icon}`,children:/* @__PURE__ */f(K,{})}),
|
|
11
11
|
/* @__PURE__ */m("div",{className:"flex-1",children:[
|
|
12
12
|
/* @__PURE__ */f("h2",{className:"text-base font-semibold text-gray-900",children:l.title||re.confirmTitle}),
|
|
13
13
|
/* @__PURE__ */f("p",{className:"mt-2 text-sm text-gray-600",children:l.message})]})]})}),
|
|
14
14
|
/* @__PURE__ */m(D,{open:C,onClose:()=>X(!1),initialFocus:null!=te?void 0:w,footer:/* @__PURE__ */m(h,{children:[
|
|
15
|
-
/* @__PURE__ */f("button",{ref:w,type:"button",onClick:()=>X(!1),className:
|
|
15
|
+
/* @__PURE__ */f("button",{ref:w,type:"button",onClick:()=>X(!1),className:A,children:E.cancelLabel||re.destructiveCancel}),
|
|
16
16
|
/* @__PURE__ */f("button",{type:"button",onClick:()=>X(!0),disabled:!ne,className:`px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40 ${ee.button}`,children:te??E.confirmLabel??re.destructiveConfirm})]}),children:[
|
|
17
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>X(!1),"aria-label":re.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */f(
|
|
17
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>X(!1),"aria-label":re.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */f(S,{})}),
|
|
18
18
|
/* @__PURE__ */m("div",{className:"flex gap-4",children:[
|
|
19
|
-
/* @__PURE__ */f("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ee.icon}`,children:/* @__PURE__ */f(
|
|
19
|
+
/* @__PURE__ */f("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ee.icon}`,children:/* @__PURE__ */f(K,{})}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"flex-1",children:[
|
|
21
21
|
/* @__PURE__ */f("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:E.title||re.destructiveTitle}),
|
|
22
22
|
/* @__PURE__ */f("p",{className:"mt-2 text-sm text-gray-600",children:E.message}),null!=te&&/* @__PURE__ */m(h,{children:[
|
|
23
23
|
/* @__PURE__ */m("p",{className:"mt-3 text-sm text-gray-700",children:[oe,
|
|
24
24
|
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-1.5 py-0.5 text-xs font-bold text-red-600 font-mono",children:te}),le]}),
|
|
25
|
-
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:j,onChange:e=>
|
|
26
|
-
/* @__PURE__ */m(D,{open:
|
|
27
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>Y(!1),className:
|
|
28
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>Y(!0),disabled:!
|
|
29
|
-
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:
|
|
25
|
+
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:j,onChange:e=>W(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===te&&X(!0)},placeholder:te,className:"mt-2 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-red-500"})]})]})]})]}),
|
|
26
|
+
/* @__PURE__ */m(D,{open:R,onClose:()=>Y(!1),title:G.title||re.promptTitle,footer:/* @__PURE__ */m(h,{children:[
|
|
27
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>Y(!1),className:A,children:G.cancelLabel||re.cancel}),
|
|
28
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>Y(!0),disabled:!G.allowEmpty&&!U.trim(),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40",children:G.confirmLabel||re.ok})]}),children:[G.message&&/* @__PURE__ */f("p",{className:"text-sm text-gray-600",children:G.message}),
|
|
29
|
+
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:U,onChange:e=>_(e.target.value),onKeyDown:e=>{"Enter"===e.key?Y(!0):"Escape"===e.key&&Y(!1)},onFocus:e=>e.target.select(),placeholder:G.placeholder,className:"mt-3 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})]})}export{B as ConfirmProvider,D as Dialog,I as confirm,O as confirmDestructive,w as focusableIn,R as prompt,k as stopAfter,W as useConfirm,C as useFocusTrap,P as useScrollLock,N as useTabLayer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{currentShellStrings as t}from"./chunk-
|
|
1
|
+
import{currentShellStrings as t}from"./chunk-NCQLGQYR.js";var e="http://www.w3.org/2000/svg",n={},o=/* @__PURE__ */new Map;function s(t,e){let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.className=e,document.body.appendChild(n)),n}var r={success:"M5 13l4 4L19 7",error:"M6 18L18 6M6 6l12 12",warning:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",loading:"M12 3a9 9 0 019 9",bell:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"};function i(t,n){const o=document.createElementNS(e,"svg");o.setAttribute("class",n),o.setAttribute("fill","none"),o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","2");const s=document.createElementNS(e,"path");return s.setAttribute("stroke-linecap","round"),"loading"!==t&&s.setAttribute("stroke-linejoin","round"),s.setAttribute("d",r[t]),o.appendChild(s),o}function a(t,e){const n=document.createElement("div");return n.className=t,void 0!==e&&(n.textContent=e),n}function c(t,e,r){const c={...n,...r},l=c.placement??"top",d=c.sticky??!1,u=`${l}|${t}|${e}`;if(c.dedupe){const t=o.get(u);if(t)return t.restart(),{dismiss:t.dismiss}}"loading"!==t&&!1!==c.sound&&import("./sounds-OMHXVVQ4.js").then(e=>{"success"===t?e.playSuccess():"error"===t?e.playError():e.playNotification()}).catch(()=>{});const m="bottom"===l?s("toast-container-bottom","fixed bottom-4 left-1/2 -translate-x-1/2 z-[9999] flex flex-col-reverse gap-2 items-center pointer-events-none"):s("toast-container","fixed top-4 left-1/2 -translate-x-1/2 z-[9999] flex flex-col gap-2 items-center pointer-events-none"),p="bottom"===l?"translateY(10px)":"translateY(-10px)",f=a("pointer-events-auto cursor-pointer rosh-toast");f.style.opacity="0",f.style.transform=`${p} scale(0.95)`,f.setAttribute("role","error"===t?"alert":"status"),f.setAttribute("aria-atomic","true"),f.appendChild(i(t,`h-4 w-4 rosh-tone-${t}${"loading"===t?" animate-spin":""}`));const h=document.createElement("span");let y;h.textContent=e,f.appendChild(h),m.appendChild(f),requestAnimationFrame(()=>{f.style.opacity="1",f.style.transform="translateY(0) scale(1)"});let v=!1;const g=()=>{v||(v=!0,y&&clearTimeout(y),o.delete(u),f.style.opacity="0",f.style.transform=`${p} scale(0.95)`,setTimeout(()=>f.remove(),300))},b=c.duration??("info"===t?4500:3e3),x=()=>{y&&clearTimeout(y),d||(y=setTimeout(g,b))};return x(),f.addEventListener("mouseenter",()=>{y&&clearTimeout(y)}),f.addEventListener("mouseleave",()=>{v||x()}),f.addEventListener("click",g),o.set(u,{el:f,restart:x,dismiss:g}),{dismiss:g}}var l={success:(t,e)=>c("success",t,e),error:(t,e)=>c("error",t,e),warning:(t,e)=>c("warning",t,e),info:(t,e)=>c("info",t,e),notify:(e,o)=>function(e,o){!1!==(o?.sound??n.sound)&&import("./sounds-OMHXVVQ4.js").then(t=>t.playNotification()).catch(()=>{});const r=s("notif-container","fixed top-4 right-4 z-[9999] flex flex-col gap-3 items-end pointer-events-none"),c=a("pointer-events-auto cursor-pointer rosh-notif");c.style.opacity="0",c.style.transform="translateX(30px) scale(0.95)";const l=a("rosh-notif-badge");l.appendChild(i("bell","h-5 w-5"));const d=a("rosh-notif-body");d.append(a("rosh-notif-title",t().toast.notification),a("notif-msg rosh-notif-msg",e));const u=document.createElement("button");u.className="rosh-notif-close",u.textContent="×",c.append(l,d,u);const m=()=>{c.style.opacity="0",c.style.transform="translateX(30px) scale(0.95)",setTimeout(()=>c.remove(),300)};u.addEventListener("click",t=>{t.stopPropagation(),m()}),c.addEventListener("click",m),r.appendChild(c),requestAnimationFrame(()=>{c.style.opacity="1",c.style.transform="translateX(0) scale(1)"}),setTimeout(m,o?.duration??1e4)}(e,o),promise:(t,e,n)=>{const o=c("loading",e.loading,{...n,sticky:!0});return t.then(t=>{o.dismiss(),c("success","function"==typeof e.success?e.success(t):e.success,n)},t=>{o.dismiss(),c("error","function"==typeof e.error?e.error(t):e.error,n)}),t},configure:t=>{n={...t}}};export{l as toast_default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as e,useContext as o,useMemo as t,useEffect as a}from"react";import{jsx as n}from"react/jsx-runtime";var i=/* @__PURE__ */new Map;function r(e,o){const t=`${e}|${JSON.stringify(o)}`;let a=i.get(t);return a||(a=new Intl.NumberFormat(e,o),i.set(t,a)),a}function s(e,o){return o?r(o,{maximumFractionDigits:20}).format(e):String(e)}function l(e,o,t){return t?r(t,{minimumFractionDigits:o,maximumFractionDigits:o}).format(e):e.toFixed(o)}function d(e,o,t){return t?r(t,{style:"percent",minimumFractionDigits:o,maximumFractionDigits:o}).format(e/100):`${e.toFixed(o)}%`}function c(e){const o=o=>s(o,e),t=o=>function(e,o){return o?r(o,{}).format(e):e.toLocaleString()}(o,e),a=(o,t)=>l(o,t,e),n=(o,t)=>d(o,t,e);return{window:{minimize:"Minimize",restore:"Restore",maximize:"Maximize",windowed:"Windowed",pinOnTop:"Pin on top",unpin:"Unpin from top",close:"Close",windowSuffix:"window",prev:"Prev",next:"Next",snapLayouts:"Snap layouts",snapLeft:"Snap left half",snapRight:"Snap right half",snapTopLeft:"Snap top-left quarter",snapTopRight:"Snap top-right quarter",snapBottomLeft:"Snap bottom-left quarter",snapBottomRight:"Snap bottom-right quarter"},taskbar:{closeWindow:"Close window",offscreenHint:"This window is off screen — click to bring it back",offscreenDot:"Off screen — click to bring this window back",expose:"Exposé — show all open windows as thumbnails",addToDesktop:"Add to desktop",removeFromDesktop:"Remove from desktop",minimizeAllWindows:"Minimize all",restoreAllWindows:"Restore all",closeAllWindows:"Close all"},logout:{goodbye:"Goodbye",seeYou:"See you next time"},about:{aboutPrefix:"About",thisApp:"this app",openSourceLicenses:"Open Source Licenses",whatsNew:"What's New",noChangelog:"No changelog available."},table:{empty:"Nothing to show",loading:"Loading",selectAll:"Select all rows",selectRow:"Select row"},select:{none:"— None —",noMatches:"No matches",allSelected:"All options selected",clear:"Clear selection",remove:"Remove"},notifications:{title:"Notifications",markAllRead:"Mark all read",dnd:"Do not disturb",dndOn:"Do not disturb is on",caughtUp:"All caught up",empty:"No notifications yet",viewAll:"View all notifications",cardLabel:"Notification",dismiss:"Dismiss notification"},form:{errorSummaryTitle:"There is a problem"},help:{title:"Help",searchPlaceholder:"Search help…",empty:"No help articles yet.",noResults:"No articles match your search.",loading:"Loading…",pickArticle:"Pick a help article from the left.",noBody:"This article has no body yet.",draft:"Draft",newArticle:"+ New",edit:"Edit"},update:{available:"A new version is available.",refreshNow:"Refresh now"},pageTabs:{label:"Open pages",close:"Close",closeOthers:"Close other tabs",closeRight:"Close tabs to the right",closeAll:"Close all tabs",unsaved:"Unsaved changes",copy:e=>`Copy ${e}`,copied:"Copied",tabMenu:"Window menu",discardTitle:"Discard unsaved changes?",discardOne:"This page has changes that have not been saved. Close it anyway?",discardMany:"pages have changes that have not been saved. Close them anyway?",discardConfirm:"Discard and close",keepEditing:"Keep editing"},dialog:{close:"Close",cancel:"Cancel",ok:"OK",confirmTitle:"Confirm",destructiveTitle:"Confirm Action",destructiveCancel:"Dismiss",destructiveConfirm:"Delete",typeToConfirm:e=>`Type ${e} to confirm:`,promptTitle:"Enter a value"},calendar:{previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",monthPanel:"Choose a month",yearPanel:"Choose a year",chooseMonth:e=>`Choose a month, currently ${e}`,chooseYear:e=>`Choose a year, currently ${e}`},datePicker:{placeholder:"Select a date",dialog:"Choose a date",clear:"Clear",today:"Today",required:"Required"},dateRange:{placeholder:"Date Range",clearRange:"Clear date range",dialog:"Date range",from:"From",to:"To",start:"Start",end:"End",fromOnly:e=>`From ${e}`,toOnly:e=>`To ${e}`,range:(e,o)=>`${e} to ${o}`,required:"Required",last2Weeks:"Last 2 Weeks",lastMonth:"Last Month",last3Months:"Last 3 Months",last6Months:"Last 6 Months",last12Months:"Last 12 Months",custom:"Custom",clear:"Clear",cancel:"Cancel",apply:"Apply"},pagination:{label:"Pagination",first:"First page",previous:"Previous page",next:"Next page",last:"Last page"},list:{selected:e=>`${o(e)} selected`,selectedNotShown:(e,t)=>`${o(e)} selected, ${o(t)} not shown`,allLoaded:(e,o)=>`All ${t(e)} ${o} loaded`,count:(e,o)=>`${t(e)} ${o}`,loadedOf:(e,o,a)=>`${t(e)} of ${t(o)} ${a}`,loadingMore:"Loading more...",loadError:"Couldn't load this list",loadErrorMessage:"Something went wrong fetching these records. Check your connection and try again.",retry:"Try again"},kanban:{loading:"Loading…",empty:"No items.",dropHere:"Drop here",addItem:"Add item"},files:{attach:"Attach files",drop:"Drop files to attach",remove:e=>`Remove ${e}`,chooseMany:"Choose files",chooseOne:"Choose a file",dragMany:"or drag them here",dragOne:"or drag it here",notAccepted:(e,o)=>`${e} is not an accepted file type${o?` (${o})`:""}`,tooLarge:(e,o,t)=>`${e} is ${o} — the limit is ${t}`,tooMany:(e,t)=>`${e} was not added — ${o(t)} ${1===t?"file":"files"} is the limit`,bytes:e=>`${o(e)} B`,kilobytes:e=>`${o(e)} KB`,megabytes:e=>`${a(e,1)} MB`},media:{uploadImage:"Upload an image",uploadVideo:"Upload a video",uploadFile:"Upload a file",upload:"Upload media",cta:"Choose from library or upload",replace:"Replace",remove:"Remove",uploading:"Uploading…",cover:"Cover",add:"Add",addMedia:"Add media",empty:"No media.",removeItem:e=>`Remove ${e}`,reorder:(e,t,a)=>`${e}, item ${o(t)} of ${o(a)}. Use arrow keys to reorder.`},brandAsset:{save:e=>`Save ${e}`,remove:e=>`Remove ${e}`,discard:"Discard change",saveFailed:e=>`Could not save ${e}.`,removeFailed:e=>`Could not remove ${e}.`,region:(e,o)=>`${e} for ${o}`,usedFor:e=>`Used for ${e}.`,previews:e=>`${e} previews`,preview:"Preview",alt:(e,o)=>`${e} ${o}`},copy:{copy:"Copy",copyLabel:e=>`Copy ${e}`,copied:"Copied",copiedLabel:e=>`${e} copied`,failed:"Could not copy to the clipboard"},keypad:{backspace:"Backspace",enter:"Enter"},banner:{dismiss:"Dismiss"},badge:{remove:"Remove",removeItem:e=>`Remove ${e}`},breadcrumbs:{label:"Breadcrumb",hidden:"Hidden crumbs"},emptyState:{message:"Nothing here yet."},errors:{notFound:"Page not found",notFoundBody:"The page you're looking for doesn't exist or was moved.",forbidden:"Access denied",forbiddenBody:"You don't have permission to view this page.",noAccess:"You don't have access to this",serverError:"Something went wrong",serverErrorBody:"An unexpected error occurred. Please try again.",retry:"Try again",details:"Error details"},search:{placeholder:"Search...",escBadge:"ESC",searching:"Searching...",noResults:"No results found.",minChars:e=>`Type at least ${o(e)} characters to search...`,navigate:"navigate",open:"open",close:"close",enterKey:"Enter",escKey:"Esc",recent:"Recent",favorites:"Favorites",actions:"Actions",listLabel:"Search results",groupCount:(e,t)=>`${o(e)}${t?"+":""}`,groupLabel:(e,t,a)=>`${e}, ${o(t)}${a?"+":""}`,seeAll:e=>`See all ${e}`,searchFailed:"Search failed — check your connection and try again.",partialFailure:"Some results could not be loaded.",tabKey:"Tab",nextGroup:"next group"},grid:{selectAll:"Select all",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:e=>`Delete row ${e}`,insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteColumn:e=>`Delete column ${e}`,resize:"Drag to resize · double-click to auto-fit",fill:"Drag to fill"},sidebar:{resize:"Drag to resize · double-click to reset"},resizeHandle:{label:"Resize panel",hint:"Drag to resize · double-click to reset"},number:{increase:"Increase",decrease:"Decrease"},slider:{value:e=>`${e} value`},color:{swatch:(e,o)=>`${e}: ${o}`,none:"None",panel:e=>`${e} picker`,square:"Saturation and brightness",squareValue:(e,o)=>`Saturation ${n(e,0)}, brightness ${n(o,0)}`,hue:"Hue",hex:e=>`${e} hex code`,presets:"Presets",clear:"No color"},tree:{empty:"Nothing here yet",dropHere:"Drop here",dragHint:"Drag to move",moveHint:"Alt+Arrow Up or Alt+Arrow Down moves it",insertHere:"Insert here"},layout:{desktop:"Desktop",sidebar:"Sidebar",switchToDesktop:"Switch to Desktop",switchToSidebar:"Switch to Sidebar",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",search:"Search…",navLabel:"Main menu",openWindows:"Open windows",pageResult:"Page",accountMenu:e=>`Account menu for ${e}`,profile:"My Profile",notifications:"Notifications",reportIssue:"Suggestion or Bug",signOut:"Sign Out",signOutTitle:"Sign Out",signOutMessage:"Do you want to log out? All windows will reopen when you log back in."},markdown:{screenshot:"Screenshot"},severity:{success:"ok",warning:"warning",danger:"critical",unrecognised:e=>`unrecognised severity ${e}`},meter:{noData:"no data",warningAt:e=>`warning ≥ ${o(e)}`,criticalAt:e=>`critical ≥ ${o(e)}`,noReading:"no reading",noBudget:"no budget",ofBudget:e=>`${e} of budget`,budget:"budget",hoursMinutes:(e,t)=>`${o(e)}h ${o(t)}m`,minutesSeconds:(e,t)=>`${o(e)}m ${o(t)}s`,seconds:e=>`${o(e)}s`},charts:{showTable:"Show the data as a table",loading:"Loading chart data",noData:"No data in this window.",windowStart:"Window start",windowEnd:"Window end",window:(e,t,a)=>`Time window — showing ${e} to ${t} of ${o(a)} intervals`,overIntervals:(e,t)=>`${e.join(", ")} over ${o(t)} intervals`,acrossCategories:(e,t)=>`${e.join(", ")} across ${o(t)} categories`,acrossMeasures:(e,t)=>`${e.join(", ")} across ${o(t)} measures`,breakdown:(e,t)=>`Breakdown of ${e} across ${o(t)} segments`,funnel:(e,t,a)=>`Funnel of ${o(e)} stages, ${t} down to ${a}`,radialTrack:e=>`${o(e)} categories, as concentric proportions`,radialCycle:e=>`${o(e)} categories, around a cycle`,tableFrom:"From",tableTo:"To",tableItem:"Item",tableLevel:"Level",tableSeries:"Series",inBucket:e=>`${e} in this bucket`,inCategory:e=>`${e} in this category`,value:"Value",share:"Share",count:"Count",flow:"Flow",totalFlow:"Total flow",throughput:"Throughput",open:"Open",high:"High",low:"Low",close:"Close",maximum:"Maximum",q3:"Q3",median:"Median",q1:"Q1",minimum:"Minimum",distribution:"Distribution",fiveNumber:(e,t)=>`${e}: five-number summary for ${o(t)} categories`,outliers:e=>`${o(e)} outlier${e>1?"s":""} beyond the whiskers`,price:"Price",ohlc:(e,t)=>`${e}: open, high, low and close across ${o(t)} periods`,closedAbove:"Closed above its open",closedBelow:"Closed below its open",noFlows:"No flows to chart.",chord:e=>`Flows between ${o(e)} participants`,noStages:"No stages to chart.",ofFirstStage:"Of first stage",droppedHere:"Dropped here",intensity:"Intensity",noActivity:"No activity in this window.",heatmap:(e,t,a)=>`${e} across ${o(t)} rows and ${o(a)} columns`,countAxis:"count",histogram:(e,t,a)=>`${e}: ${o(t)} bins over ${o(a)} observations`,observations:"Observations",notEnough:"Not enough eligible requests to judge.",objectiveMet:e=>`objective ${e} met`,objectiveMissed:e=>`objective ${e} missed`,nothingToPlot:"Nothing to plot.",nothingToCompare:"Nothing to compare.",other:"Other",nothingToBreakDown:"Nothing to break down.",range:"Range",rangeLabel:(e,t)=>`${e}: low and high across ${o(t)} categories`,nothingToRank:"Nothing to rank in this window.",emphasised:"(emphasised)",sankey:(e,t)=>`Flow between ${o(e)} nodes over ${o(t)} links`,noObservations:"No observations in this window.",xAxis:"x",yAxis:"y",size:"Size",scatter:(e,o,t)=>`${e.join(", ")}: ${o} against ${t}`,outsideRange:e=>`${o(e)} ${1===e?"point":"points"} outside the shown range`,waterfall:(e,t,a)=>`Waterfall of ${o(e)} steps from ${t} to ${a}`,balance:"Balance",increase:"Increase",decrease:"Decrease",runningTotal:"Running total",sunburst:(e,t)=>`Hierarchy of ${e} across ${o(t)} levels`,treemap:e=>`Treemap of ${o(e)} items`,trendUp:"up",trendDown:"down",trendFlat:"flat"},timeline:{days:e=>`${t(e)} days`,daysToToday:e=>`${t(e)} days to today`,notReached:"Not yet reached",next:"Next",more:e=>`+${o(e)} more`,today:"Today",todayTitle:e=>`Today — ${e}`,open:e=>`Open ${e}`,openButton:"Open",scrub:"Scrub the timeline",alsoToCome:e=>`Also to come: ${e.join(", ")}`,start:e=>`Start · ${e}`,events:(e,t)=>`${o(e)} events · ${t.join(", ")}`,started:e=>`started ${e}`,duration:e=>`${t(e)} day${1===e?"":"s"}`,reached:(e,t)=>`${o(e)} of ${o(t)} milestones`,milestones:e=>`${e} milestones`},production:{heading:"Production progress",start:"Start",estimated:"Estimated",estimatedCompletion:"Estimated completion",estDone:"Est. done",play:"Play",pause:"Pause",playTitle:"Play the timeline, report by report",backTo:e=>`Back to ${e}`,showing:e=>`Showing ${e}`,overall:e=>`${n(e,0)} overall`,inStock:e=>`${t(e)} pc in stock`,noReport:"No production report filed yet",leadTime:e=>`${t(e)} day${1===e?"":"s"} lead time`,report:"Production report",shipment:"Shipment",inspection:"Inspection",invoice:"Invoice",scrub:"Scrub the production timeline",label:(e,o)=>`Production reports and events, ${e} to ${o}`},containers:{items:e=>`${o(e)} items`,pieces:e=>`${o(e)} pcs`,split:(e,t)=>`(${o(e)} instr / ${o(t)} loaded)`,added:(e,t)=>`${o(e)} new (${o(t)} pcs)`,fill:(e,t)=>`${a(e,1)} / ${o(t)} m³`,total:"Total:",instructed:e=>`${a(e,2)} m³ instruction`,loaded:e=>`${a(e,2)} m³ loaded`,volume:e=>`${a(e,2)} m³`,noVolume:"Volume: N/A (no volume data for these part numbers)"},toast:{notification:"Notification"},map:{failed:"The map could not be drawn here. The list has everything it shows.",approximate:e=>`${e}, approximate location`,approximateTitle:e=>`${e} (approximate)`,places:e=>1===e?"place":"places",group:(e,t)=>`${o(e)} ${t} here`,stops:e=>`Stops ${e}`,closeBy:(e,t)=>`${o(e)} more ${t} close by, drawn when the map is closer`,spread:"Press to see them apart",cycle:"They stand on one spot: press for the next of them",fullScreen:"Full screen",leaveFullScreen:"Leave full screen",chosen:e=>`${e}, chosen on the map`,closeCard:"Close",openRecord:"Open"},pdf:{previousPage:"Previous page",nextPage:"Next page",pageOf:(e,t)=>`${o(e)} / ${o(t)}`,zoomOut:"Zoom out",zoomIn:"Zoom in",zoom:"Zoom",fitWidth:"Fit width",fitPage:"Fit page",fit:"Fit",fitHint:"Fit to the pane: follows its size until you zoom by hand",print:"Print",download:"Download",email:"Email",loading:"Loading PDF…",loadFailed:"Failed to load PDF",allowPopups:"Allow popups to print"}}}var p=c(),u=/* @__PURE__ */new Map;var h=e(p),m=e(null),g=/* @__PURE__ */new Set;var $=p,f={};function w(){return $}function b({value:e=f,locale:i,children:r}){const s=o(m),l=t(()=>function(e){if(e)try{return Intl.getCanonicalLocales(e)[0]}catch{return void(g.has(e)||(g.add(e),console.error(`[efficient-shell] ShellStringsProvider: locale="${e}" is not a BCP 47 language tag, so it is ignored and numbers and dates keep their default formatting. Pass a tag such as "de-DE" or "ja".`)))}}(i),[i]),d=void 0===i?s?.locale:l,w=t(()=>{const o=function(e){if(!e)return p;let o=u.get(e);return o||(o=c(e),u.set(e,o)),o}(d),t={};for(const a of Object.keys(o))t[a]={...o[a],...e[a]??{}};return t},[e,d]),b=t(()=>({locale:d}),[d]),v=null!==s;return a(()=>{if(!v)return $=w,()=>{$===w&&($=p)}},[w,v]),/* @__PURE__ */n(m.Provider,{value:b,children:/* @__PURE__ */n(h.Provider,{value:w,children:r})})}function v(){return o(h)}function y(){return o(m)?.locale}function S(e){const[o="",...t]=e("\0").split("\0");return[o,t.join("")]}export{p as DEFAULT_SHELL_STRINGS,b as ShellStringsProvider,w as currentShellStrings,l as formatFixed,d as formatPercent,s as formatPlain,S as splitAround,y as useShellLocale,v as useShellStrings};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{useShellStrings as t}from"./chunk-
|
|
2
|
-
return u("div",{...n,dangerouslySetInnerHTML:r})}function g({columns:e,data:g,onChange:m,onColumnsChange:f,fixedRows:p=!1,minRows:y=15,maxHeight:b="260px",cellStyles:v,onFocusChange:x,onSelectionChange:M}){const D=r(null),k=t().grid,[C,E]=o(null);l(()=>{x?.(C)},[C,x]);const[L,S]=o({}),$=r(null),[N,A]=o({}),z=r(null),[O,
|
|
1
|
+
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{useShellStrings as t}from"./chunk-NCQLGQYR.js";import{useBrowserLayoutEffect as n}from"./chunk-D65T4H6J.js";import{useRef as r,useState as o,useEffect as l,useCallback as c,useMemo as a}from"react";import{createPortal as s}from"react-dom";import{jsxs as i,jsx as u,Fragment as d}from"react/jsx-runtime";function h(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function w({text:t,...n}){const r=a(()=>({__html:e(t)}),[t]);/* @__PURE__ */
|
|
2
|
+
return u("div",{...n,dangerouslySetInnerHTML:r})}function g({columns:e,data:g,onChange:m,onColumnsChange:f,fixedRows:p=!1,minRows:y=15,maxHeight:b="260px",cellStyles:v,onFocusChange:x,onSelectionChange:M}){const D=r(null),k=t().grid,[C,E]=o(null);l(()=>{x?.(C)},[C,x]);const[L,S]=o({}),$=r(null),[N,A]=o({}),z=r(null),[O,R]=o(null),[T,K]=o(null),[P,F]=o(null),[I,X]=o(null),[Y,H]=o(null),j=r(null);n(()=>{const e=j.current;if(!e||e.row!==Y?.row||e.col!==Y?.col)return;j.current=null;const t=D.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[Y]);const[q,B]=o(null),[W,Q]=o(null);l(()=>{M?.(q&&W?{anchor:q,end:W}:null)},[q,W,M]);const _=r(!1),[G,J]=o(null),U=r(!1),V=r({a:null,e:null});V.current={a:q,e:W};const Z=q&&W&&(q.row!==W.row||q.col!==W.col),ee=[...g];if(!p)for(;ee.length<y;)ee.push(Array(e.length).fill(""));const te=c((t,n,r)=>{const o=ee.map(e=>[...e]);for(;o.length<=t;)o.push(Array(e.length).fill(""));for(;o[t].length<e.length;)o[t].push("");o[t][n]=r,m(o)},[ee,e.length,m]),ne=c((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(ee[e]?.[t]||"")){const r=ee.map(e=>[...e]);r[e]&&(r[e][t]=n,m(r))}}_.current=!0,e.shiftKey&&q||B({row:t,col:n}),Q({row:t,col:n})},[ee,m,q]),re=c((e,t)=>{_.current&&Q({row:e,col:t})},[]);l(()=>{const e=()=>{_.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),l(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!q||!W)return;const t=window.getSelection();if(t&&t.toString().length>0&&!Z)return;const n=Math.min(q.row,W.row),r=Math.max(q.row,W.row),o=Math.min(q.col,W.col),l=Math.max(q.col,W.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(ee[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q,W,ee,Z]),l(()=>{const t=t=>{if(!C)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!D.current?.contains(n))return;const r=t.clipboardData?.getData("text/plain");if(!r)return;t.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=ee.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=C.row+t;for(;l.length<=n;)l.push(Array(e.length).fill(""));for(;l[n].length<e.length;)l[n].push("");for(let r=0;r<o[t].length;r++){const c=C.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}m(p?l:h(l,e.length)),B({row:C.row,col:C.col}),Q({row:Math.min(C.row+o.length-1,l.length-1),col:Math.min(C.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[C,ee,e,m,p]);const oe=c((t,n,r)=>{const o=t.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;t.preventDefault();const c=ee.map(e=>[...e]);for(let t=0;t<l.length;t++){const o=n+t;for(;c.length<=o;)c.push(Array(e.length).fill(""));for(;c[o].length<e.length;)c[o].push("");for(let n=0;n<l[t].length;n++){const a=r+n;if(a>=e.length)break;e[a].readOnly||(c[o][a]=l[t][n].trim())}}m(p?c:h(c,e.length))},[ee,e,m,p]),le=c((t,n,r)=>{let o=n,l=r;if("Tab"===t.key)t.preventDefault(),l=t.shiftKey?r-1:r+1,l>=e.length&&(l=0,o=n+1),l<0&&(l=e.length-1,o=n-1);else if("Enter"===t.key)t.preventDefault(),o=t.shiftKey?n-1:n+1;else if("ArrowDown"===t.key)t.preventDefault(),o=n+1;else if("ArrowUp"===t.key)t.preventDefault(),o=n-1;else if("ArrowLeft"===t.key)t.preventDefault(),l=r-1;else{if("ArrowRight"!==t.key){if("Delete"===t.key||"Backspace"===t.key){const o=t.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(t.preventDefault(),te(n,r,"")));if(t.preventDefault(),q&&W){const t=Math.min(q.row,W.row),n=Math.max(q.row,W.row),r=Math.min(q.col,W.col),o=Math.max(q.col,W.col),l=ee.map(e=>[...e]);for(let c=t;c<=n;c++)for(let t=r;t<=o;t++)l[c]&&!e[t]?.readOnly&&(l[c][t]="");m(l)}else te(n,r,"");return}return}t.preventDefault(),l=r+1}for(;l>=0&&l<e.length&&e[l].readOnly;)l+="Tab"===t.key&&t.shiftKey?-1:1;if(o>=0&&o<ee.length&&l>=0&&l<e.length){const e=D.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),E({row:o,col:l}),H(null),B({row:o,col:l}),Q({row:o,col:l}))}},[e,ee,ee.length,te,q,W,m]),ce=c(t=>{if(!p&&t>=ee.length-2){const t=ee.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));m(t)}},[p,ee,e.length,m]),[ae,se]=o(null);l(()=>{if(!ae)return;const e=()=>se(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[ae]);const ie=c(t=>{const n=ee.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),m(n)},[ee,e.length,m]),ue=c(e=>{if(ee.length<=1)return;const t=ee.filter((t,n)=>n!==e);m(t)},[ee,m]),de=c(e=>{const t=ee.map(t=>{const n=[...t];return n.splice(e,0,""),n});m(t)},[ee,m]),he=c(t=>{if(e.length<=1)return;const n=ee.map(e=>{const n=[...e];return n.splice(t,1),n});m(n)},[ee,e.length,m]),we=c((e,t)=>{e.preventDefault(),p||se({x:e.clientX,y:e.clientY,items:[{label:k.insertRowAbove,onClick:()=>{ie(t),se(null)}},{label:k.insertRowBelow,onClick:()=>{ie(t+1),se(null)}},{label:k.deleteRow(t+1),onClick:()=>{ue(t),se(null)}}]})},[p,ie,ue,k]),ge=c((t,n)=>{t.preventDefault(),p||se({x:t.clientX,y:t.clientY,items:[{label:k.insertColumnLeft,onClick:()=>{de(n),se(null)}},{label:k.insertColumnRight,onClick:()=>{de(n+1),se(null)}},{label:k.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{he(n),se(null)}}]})},[p,e,de,he,k]),me=t=>L[t]??e[t]?.width??150;l(()=>{const t=e=>{if(!$.current)return;const t=e.clientX-$.current.startX,n=Math.max(40,$.current.startW+t);S(e=>({...e,[$.current.col]:n}))},n=()=>{if($.current&&f){const t=e.map((e,t)=>({...e,width:L[t]??e.width}));t[$.current.col]={...t[$.current.col],width:L[$.current.col]??e[$.current.col].width},f(t)}$.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)}},[e,L,f]);const fe=e=>N[e]??28;l(()=>{const e=e=>{if(!z.current)return;const t=e.clientY-z.current.startY,n=Math.max(20,z.current.startH+t);A(e=>({...e,[z.current.row]:n}))},t=()=>{z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const pe=c(t=>{const n=document.createElement("canvas").getContext("2d");if(!n)return;n.font="12px ui-monospace, SFMono-Regular, Menlo, monospace";let r=0;for(const e of ee){const o=String(e[t]??"").replace(/<[^>]*>/g,""),l=n.measureText(o).width;l>r&&(r=l)}const o=n.measureText(e[t]?.title??"").width;o>r&&(r=o);const l=Math.max(40,Math.ceil(r+24));if(S(e=>({...e,[t]:l})),f){const n=e.map((e,n)=>({...e,width:n===t?l:L[n]??e.width}));f(n)}},[ee,e,L,f]),ye=c(e=>{A(t=>{const n={...t};return delete n[e],n})},[]),be=c(t=>{const{a:n,e:r}=V.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,d=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?d=t.col:t.col<c&&(u=t.col);const h=l-o+1,w=a-c+1,g=ee.map(e=>[...e]);for(;g.length<=i;)g.push(Array(e.length).fill(""));for(const e of g)for(;e.length<=d;)e.push("");function f(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=d;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&d===a){const r=f(Array.from({length:h},(e,n)=>g[o+n]?.[t]??""));if(r){const c=parseFloat(g[l]?.[t]??"0"),a=parseFloat(g[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%h+h)%h;n=g[o+r]?.[t]??""}}else if(1===h&&s===o&&i===l){const r=f(Array.from({length:w},(t,n)=>g[e]?.[c+n]??""));if(r){const o=parseFloat(g[e]?.[a]??"0"),l=parseFloat(g[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=g[e]?.[c+r]??""}}else{const r=((e-o)%h+h)%h,l=((t-c)%w+w)%w;n=g[o+r]?.[c+l]??""}g[e][t]=n}m(g),B({row:s,col:u}),Q({row:i,col:d})},[ee,e.length,m]);l(()=>{const e=e=>{if(!U.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);J({row:r,col:o})},t=()=>{U.current&&G&&be(G),U.current=!1,J(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[G,be]);const ve=e=>{e.preventDefault(),e.stopPropagation(),U.current=!0,document.body.style.cursor="crosshair"},xe=r(null),[Me,De]=o(0),[ke,Ce]=o(800);l(()=>{const e=xe.current;if(!e)return;const t=()=>Ce(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Ee=ee.length>100,Le=Ee?Math.max(0,Math.floor(Me/28)-20):0,Se=Ee?Math.min(ee.length,Math.ceil((Me+ke)/28)+20):ee.length,$e=a(()=>ee.slice(Le,Se),[ee,Le,Se]),Ne=28*Le,Ae=28*(ee.length-Se),ze="px-2 py-1.5 text-left text-xs font-medium text-gray-500 uppercase bg-gray-100 border-b border-r border-gray-200 select-none";/* @__PURE__ */
|
|
3
3
|
return i("div",{ref:xe,className:"border border-gray-300 rounded overflow-scroll grid-scroll",style:{maxHeight:b,height:b},onScroll:e=>De(e.target.scrollTop),children:[
|
|
4
4
|
/* @__PURE__ */i("table",{ref:D,className:"border-collapse select-none",style:{tableLayout:"fixed",minWidth:36+e.reduce((t,n)=>t+me(e.indexOf(n)),0)},children:[
|
|
5
5
|
/* @__PURE__ */i("colgroup",{children:[
|
|
6
6
|
/* @__PURE__ */u("col",{style:{width:36}}),e.map((e,t)=>/* @__PURE__ */u("col",{style:{width:me(t)}},e.key))]}),
|
|
7
7
|
/* @__PURE__ */u("thead",{className:"sticky top-0 z-10",children:/* @__PURE__ */i("tr",{children:[
|
|
8
|
-
/* @__PURE__ */u("th",{className:ze+" text-center w-9 cursor-pointer hover:bg-gray-200",onClick:()=>{
|
|
9
|
-
return i("th",{className:`${ze} cursor-pointer hover:bg-gray-200 relative${r?" !bg-blue-200":""}${I===n?" !bg-blue-100":""}`,style:{width:me(n)},draggable:!0,onDragStart:()=>(e=>F(e))(n),onDragOver:e=>((e,t)=>{e.preventDefault(),X(t)})(e,n),onDrop:()=>(t=>{if(null===P||P===t)return F(null),void X(null);const n=ee.map(e=>{const n=[...e],[r]=n.splice(P,1);return n.splice(t,0,r),n});if(m(n),f){const n=[...e],[r]=n.splice(P,1);n.splice(t,0,r),f(n)}F(null),X(null)})(n),onDragEnd:()=>{F(null),X(null)},onClick:e=>{e.shiftKey&&B
|
|
8
|
+
/* @__PURE__ */u("th",{className:ze+" text-center w-9 cursor-pointer hover:bg-gray-200",onClick:()=>{B({row:0,col:0}),Q({row:ee.length-1,col:e.length-1})},title:k.selectAll,children:"#"}),e.map((t,n)=>{const r=q&&W&&Math.min(q.col,W.col)<=n&&n<=Math.max(q.col,W.col)&&0===Math.min(q.row,W.row)&&Math.max(q.row,W.row)===ee.length-1;/* @__PURE__ */
|
|
9
|
+
return i("th",{className:`${ze} cursor-pointer hover:bg-gray-200 relative${r?" !bg-blue-200":""}${I===n?" !bg-blue-100":""}`,style:{width:me(n)},draggable:!0,onDragStart:()=>(e=>F(e))(n),onDragOver:e=>((e,t)=>{e.preventDefault(),X(t)})(e,n),onDrop:()=>(t=>{if(null===P||P===t)return F(null),void X(null);const n=ee.map(e=>{const n=[...e],[r]=n.splice(P,1);return n.splice(t,0,r),n});if(m(n),f){const n=[...e],[r]=n.splice(P,1);n.splice(t,0,r),f(n)}F(null),X(null)})(n),onDragEnd:()=>{F(null),X(null)},onClick:e=>{e.shiftKey&&q||B({row:0,col:n}),Q({row:ee.length-1,col:n})},onContextMenu:e=>ge(e,n),children:[t.title,
|
|
10
10
|
/* @__PURE__ */u("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),$.current={col:t,startX:e.clientX,startW:me(t)},document.body.style.cursor="col-resize"})(e,n),onDoubleClick:e=>{e.stopPropagation(),pe(n)},title:k.resize})]},t.key)})]})}),
|
|
11
|
-
/* @__PURE__ */i("tbody",{children:[Ne>0&&/* @__PURE__ */u("tr",{style:{height:Ne}}),$e.map((t,n)=>{const r=Le+n,o=
|
|
11
|
+
/* @__PURE__ */i("tbody",{children:[Ne>0&&/* @__PURE__ */u("tr",{style:{height:Ne}}),$e.map((t,n)=>{const r=Le+n,o=q&&W&&Math.min(q.row,W.row)<=r&&r<=Math.max(q.row,W.row)&&0===Math.min(q.col,W.col)&&Math.max(q.col,W.col)===e.length-1;/* @__PURE__ */
|
|
12
12
|
return i("tr",{style:{height:fe(r)},children:[
|
|
13
|
-
/* @__PURE__ */i("td",{className:`relative px-1 py-1 text-center text-[10px] text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${
|
|
14
|
-
/* @__PURE__ */u("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),z.current={row:t,startY:e.clientY,startH:fe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:k.resize})]}),e.map((e,n)=>{const o=
|
|
15
|
-
return i("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${e.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${g?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){ne(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>re(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:t=>{t.target!==t.currentTarget||e.readOnly||
|
|
16
|
-
/* @__PURE__ */u(w,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${f}`,onMouseDown:e=>ne(e,r,n),onMouseEnter:()=>re(r,n),onDoubleClick:()=>{e.readOnly||
|
|
13
|
+
/* @__PURE__ */i("td",{className:`relative px-1 py-1 text-center text-[10px] text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${T===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>R(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),K(t)})(e,r),onDrop:()=>(e=>{if(null===O||O===e)return R(null),void K(null);const t=ee.map(e=>[...e]),[n]=t.splice(O,1);t.splice(e,0,n),m(t),R(null),K(null)})(r),onDragEnd:()=>{R(null),K(null)},onClick:t=>{t.shiftKey&&q||B({row:r,col:0}),Q({row:r,col:e.length-1})},onContextMenu:e=>we(e,r),children:[r+1,
|
|
14
|
+
/* @__PURE__ */u("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),z.current={row:t,startY:e.clientY,startH:fe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:k.resize})]}),e.map((e,n)=>{const o=q&&W&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(q,W,r,n),l=Y?.row===r&&Y?.col===n&&!e.readOnly,c=C?.row===r&&C?.col===n,a=v?.[`${r}:${n}`],s=q&&W?Math.max(q.row,W.row):-1,d=q&&W?Math.max(q.col,W.col):-1,h=q&&W&&r===s&&n===d,g=U.current&&G&&q&&W&&(()=>{const e=Math.min(q.row,W.row),t=Math.max(q.row,W.row),o=Math.min(q.col,W.col),l=Math.max(q.col,W.col);let c=e,a=t,s=o,i=l;return G.row>t?a=G.row:G.row<e&&(c=G.row),G.col>l?i=G.col:G.col<o&&(s=G.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-[11px]":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",f=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
|
|
15
|
+
return i("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${e.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${g?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){ne(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>re(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:t=>{t.target!==t.currentTarget||e.readOnly||H({row:r,col:n})},children:[
|
|
16
|
+
/* @__PURE__ */u(w,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${f}`,onMouseDown:e=>ne(e,r,n),onMouseEnter:()=>re(r,n),onDoubleClick:()=>{e.readOnly||H({row:r,col:n})},onFocus:()=>{E({row:r,col:n}),_.current||(B({row:r,col:n}),Q({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&te(r,n,o),H(null)},onInput:()=>ce(r),onPaste:e=>oe(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),te(r,n,t.key),j.current={row:r,col:n},void H({row:r,col:n});le(t,r,n)},text:t[n]||""}),h&&/* @__PURE__ */u("div",{onMouseDown:ve,title:k.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Ae>0&&/* @__PURE__ */u("tr",{style:{height:Ae}})]})]}),ae&&s(
|
|
17
17
|
/* @__PURE__ */i(d,{children:[
|
|
18
18
|
/* @__PURE__ */u("div",{className:"fixed inset-0 z-[200]",onPointerDown:()=>se(null)}),
|
|
19
19
|
/* @__PURE__ */u("div",{className:"fixed z-[201] bg-white rounded-lg shadow-lg border border-gray-200 py-1 min-w-[160px]",style:{left:ae.x,top:ae.y},children:ae.items.map((e,t)=>/* @__PURE__ */u("button",{onPointerDown:t=>{t.stopPropagation(),e.onClick()},className:"w-full text-left px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",children:e.label},t))})]}),document.body)]})}export{g as EditableGrid,h as withSpareRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{client_default as a}from"./chunk-
|
|
1
|
+
import{client_default as a}from"./chunk-ZLJCWBDF.js";var e=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),t="uploaded:wallpaper";function r(a,e){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===t?e||"":a}var p=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=e=>{const t=new FormData;return t.append("wallpaper",e),a.post("/auth/me/wallpaper/",t).then(a=>a.data)},l=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function s(a){const e=a?.response?.status,t=a?.response?.data,r=Array.isArray(t?.wallpaper)?t.wallpaper[0]:void 0;return r||(413===e?"That picture is too large to use as a wallpaper.":415===e?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{t as WALLPAPER_PREF_TOKEN,l as deleteWallpaper,e as getNumberingConfigs,p as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,s as wallpaperUploadError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setPdfPreview as e}from"./chunk-ESL5TDNA.js";import{toast_default as t}from"./chunk-
|
|
1
|
+
import{setPdfPreview as e}from"./chunk-ESL5TDNA.js";import{toast_default as t}from"./chunk-KSSAVLO7.js";import{setSpreadsheetPreview as n}from"./chunk-VTVSMRFX.js";var i="react-os-shell:preview-opened";async function o(o){const{filePath:a,filename:r,kind:c,onStaged:s}=o;try{const o=await fetch(`${("undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000").replace(/\/$/,"")}/api/file?path=${encodeURIComponent(a)}`,{credentials:"include"});if(!o.ok)return t.error(`Download failed (${o.status})`),!1;const d=await o.blob();if("csv"===c){const e=await d.text();n({csv:e,filename:r}),s?.("/spreadsheet")}else{const t=URL.createObjectURL(d);e({url:t,filename:r,kind:c}),s?.("/preview")}return"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(i,{detail:{filePath:a,filename:r,kind:c}})),!0}catch(e){return t.error(e?.message||"Open failed"),!1}}export{i as PREVIEW_OPENED_EVENT,o as openPreviewFile};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Modal as e}from"./chunk-
|
|
1
|
+
import{Modal as e}from"./chunk-ZLJCWBDF.js";import{keepsNativeMenu as a}from"./chunk-VDL2RLZG.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
|
|
2
2
|
return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
|
|
3
3
|
/* @__PURE__ */n("div",{children:[
|
|
4
4
|
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="4.165.0",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{glassStyle as t,glassFill as e}from"./chunk-VDL2RLZG.js";import{registerModalEscapeInterceptor as o,escapeSurfaceAbove as r,onOverlayOpen as i,Z_LAYERS as n}from"./chunk-ELSUXC3N.js";import{useShellStrings as a}from"./chunk-NCQLGQYR.js";import{useBrowserLayoutEffect as l,useBrowserState as h}from"./chunk-D65T4H6J.js";import{useState as s,useRef as d,useId as c,useEffect as m,isValidElement as u,cloneElement as f,useCallback as g}from"react";import{createPortal as p}from"react-dom";import{jsxs as b,jsx as x,Fragment as w}from"react/jsx-runtime";var v=448,y=240,M=8,N=()=>({left:0,right:window.innerWidth,top:0,bottom:window.innerHeight});function W(t){const e=N(),o=t?.closest?.("[data-modal-panel]");if(!o)return e;const r=o.getBoundingClientRect();return r.width<=0||r.height<=0?e:{left:Math.max(e.left,r.left),right:Math.min(e.right,r.right),top:Math.max(e.top,r.top),bottom:Math.min(e.bottom,r.bottom)}}var z=/* @__PURE__ */new Set(["hidden","clip","auto","scroll"]);var k={top:"bottom",bottom:"top",left:"right",right:"left"},C={top:["right","left"],bottom:["right","left"],left:["top","bottom"],right:["top","bottom"]};function R(t,e,o){return{top:t.top-o-(e.top+8),bottom:e.bottom-8-(t.bottom+o),left:t.left-o-(e.left+8),right:e.right-8-(t.right+o)}}var H=(t,e,o)=>Math.max(e,Math.min(t,o));function E(t,e,o){let r=NaN,i=NaN,n=NaN,a=NaN,l=NaN;const h=()=>{const e=t()?.getBoundingClientRect();if(!e)return!1;const h=o?o():NaN,s=e.left!==r||e.top!==i||e.right!==n||e.bottom!==a||h!==l&&!(Number.isNaN(h)&&Number.isNaN(l));return r=e.left,i=e.top,n=e.right,a=e.bottom,l=h,s};h();const s=()=>{h(),e()};let d=requestAnimationFrame(function t(){h()&&e(),d=requestAnimationFrame(t)});return window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{cancelAnimationFrame(d),window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s)}}function T({trigger:t,menu:e,bounds:o,align:r,side:i}){const n=R(t,o,4),a="bottom"===i?"top":"bottom",l=e.height>n[i]&&(e.height<=n[a]||n[a]>n[i])?a:i,h=Math.max(Math.min(e.height,96),n[l]),s=Math.min(e.height,h),d=H("bottom"===l?t.bottom+4:t.top-4-s,o.top+8,o.bottom-8-s),c=Math.max(0,o.right-o.left-16),m=Math.min(e.width,c);return{left:H("start"===r?t.left:t.right-m,o.left+8,o.right-8-m),top:d,side:l,maxHeight:h,maxWidth:c}}function L(t,e,o={}){const{matchTriggerWidth:r=!1,preferredMaxWidth:i=v,preferredMaxHeight:n=y,popupRef:a}=o,[h,d]=s(null);return l(()=>{if(!e)return void d(null);const o=()=>{const e=t.current,o=e?.getBoundingClientRect();if(!o)return;const l=W(e),h=l.bottom-o.bottom-4-8,s=o.top-l.top-4-8,c=h<Math.min(n,160)&&s>h,m=Math.max(96,Math.min(n,c?s:h)),u=Math.max(0,l.right-l.left-16),f={minWidth:o.width,maxWidth:Math.min(i,u),maxHeight:m};if(r){const t=Math.min(o.width,u);f.width=t,f.maxWidth=t,f.left=Math.min(Math.max(l.left+8,o.left),l.right-8-t)}else if(a&&l.right-8-o.left<f.maxWidth&&Math.min(o.right,l.right-8)-l.left-8<f.maxWidth){const t=a.current?.offsetWidth??0,e=t>0?Math.min(t,f.maxWidth):f.maxWidth;f.left=Math.max(l.left+8,Math.min(o.left,l.right-8-e))}else if(l.right-8-o.left<f.maxWidth){const t=Math.min(o.right,l.right-8);f.right=window.innerWidth-t,f.maxWidth=Math.min(f.maxWidth,Math.max(0,t-l.left-8))}else f.left=Math.max(l.left+8,o.left);c?f.bottom=window.innerHeight-o.top+4:f.top=o.bottom+4,d(f)};return o(),E(()=>t.current,o,a?()=>a.current?.offsetWidth??NaN:void 0)},[e,t,r,i,n,a]),h}function P({point:t,menu:e,bounds:o}){const r={left:t.x,right:t.x,top:t.y,bottom:t.y},i=o.right-8-t.x,n=t.x-(o.left+8);return T({trigger:r,menu:e,bounds:o,align:e.width<=i||i>=n?"start":"end",side:"bottom"})}var B={top:"bottom-full left-1/2 -translate-x-1/2 mb-3",bottom:"top-full left-1/2 -translate-x-1/2 mt-3",left:"right-full top-1/2 -translate-y-1/2 mr-3",right:"left-full top-1/2 -translate-y-1/2 ml-3"};function $({content:a,side:h="top",delay:g=200,children:w,className:v="relative inline-flex"}){const[y,M]=s(!1),[T,L]=s(null),P=d(void 0),$=d(null),D=d(null),S=c(),I=d(!1),j=()=>{window.clearTimeout(P.current),I.current||(P.current=window.setTimeout(()=>M(!0),g))},A=()=>{window.clearTimeout(P.current),M(!1)},F=()=>{I.current=!0,A()},K=()=>{I.current=!1,A()};m(()=>()=>window.clearTimeout(P.current),[]),l(()=>{if(!y)return void L(null);const t=()=>{const t=$.current,e=D.current;if(!t||!e)return;const o=W(t),r=Math.max(0,o.right-o.left-16),i=Math.max(0,o.bottom-o.top-16);e.style.maxWidth=`${r}px`,e.style.maxHeight=`${i}px`;const n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return;const a=t.getBoundingClientRect();if(!function(t){const e=t.getBoundingClientRect();if(e.width<=0&&e.height<=0&&0===e.left&&0===e.top)return null;const o=N(),r={left:Math.max(o.left,e.left),right:Math.min(o.right,e.right),top:Math.max(o.top,e.top),bottom:Math.min(o.bottom,e.bottom)};let i=getComputedStyle(t).position;for(let e=t.parentElement;e&&e!==document.documentElement&&"fixed"!==i;e=e.parentElement){const t=getComputedStyle(e);if("absolute"===i&&"static"===t.position)continue;i=t.position;const o=z.has(t.overflowX),n=z.has(t.overflowY);if(!o&&!n)continue;const a=e.getBoundingClientRect();a.width<=0&&a.height<=0||(o&&(r.left=Math.max(r.left,a.left),r.right=Math.min(r.right,a.right)),n&&(r.top=Math.max(r.top,a.top),r.bottom=Math.min(r.bottom,a.bottom)))}return r.right>=r.left&&r.bottom>=r.top?r:null}(t))return void A();const l=function(t,e,o,r,i){const n=R(t,r,i),a=t=>n[t]-("top"===t||"bottom"===t?e.height:e.width),l=[o,k[o],...C[o]],h=l.find(t=>a(t)>=0)??l.reduce((t,e)=>a(e)>a(t)?e:t),s=(t.left+t.right)/2,d=(t.top+t.bottom)/2;let c,m;switch(h){case"top":c=s-e.width/2,m=t.top-i-e.height;break;case"bottom":c=s-e.width/2,m=t.bottom+i;break;case"left":c=t.left-i-e.width,m=d-e.height/2;break;case"right":c=t.right+i,m=d-e.height/2}return{side:h,left:H(c,r.left+8,r.right-8-e.width),top:H(m,r.top+8,r.bottom-8-e.height)}}(a,n,h,o,12),s=function(t,e,o,r,i){const{side:n,left:a,top:l}=e,h=a+o.width,s=l+o.height;if({top:t.top-s,bottom:l-t.bottom,left:t.left-h,right:a-t.right}[n]<i)return null;const d=(t,e,o)=>o<2*r?e+o/2:Math.max(e+r,Math.min(t,e+o-r)),c=(t.left+t.right)/2,m=(t.top+t.bottom)/2;switch(n){case"top":return{side:n,x:d(c,a,o.width),y:s};case"bottom":return{side:n,x:d(c,a,o.width),y:l};case"left":return{side:n,x:h,y:d(m,l,o.height)};case"right":return{side:n,x:a,y:d(m,l,o.height)}}}(a,l,n,16,6),d={anchor:{left:a.left,top:a.top,width:a.width,height:a.height},left:l.left-a.left,top:l.top-a.top,maxWidth:r,maxHeight:i,side:l.side,arrow:s&&{left:s.x-a.left,top:s.y-a.top}};L(t=>{return t&&(o=d,(e=t).anchor.left===o.anchor.left&&e.anchor.top===o.anchor.top&&e.anchor.width===o.anchor.width&&e.anchor.height===o.anchor.height&&e.left===o.left&&e.top===o.top&&e.maxWidth===o.maxWidth&&e.maxHeight===o.maxHeight&&e.side===o.side&&e.arrow?.left===o.arrow?.left&&e.arrow?.top===o.arrow?.top)?t:d;var e,o})};return t(),E(()=>$.current,t)},[y,h,a]),m(()=>{if(!y)return;const t=o(t=>"Escape"===t.key&&(A(),!r($.current))),e=i(A);return()=>{t(),e()}},[y]);const X=y?S:void 0,q=u(w)?f(w,{"aria-describedby":[w.props["aria-describedby"],X].filter(Boolean).join(" ")||void 0}):w,G=y?t():void 0,Q=y?e():void 0;/* @__PURE__ */
|
|
2
|
+
return b("span",{ref:$,className:v,"aria-describedby":u(w)?void 0:X,onMouseEnter:j,onMouseLeave:K,onFocus:j,onBlur:K,onPointerDown:F,onClick:F,children:[q,y&&p(
|
|
3
|
+
/* @__PURE__ */b("span",{className:"pointer-events-none fixed left-0 top-0",style:{zIndex:n.popup,...T?.anchor},children:[
|
|
4
|
+
/* @__PURE__ */x("span",{ref:D,id:S,role:"tooltip",className:`pointer-events-none absolute z-[300] box-border w-max overflow-hidden whitespace-normal break-words text-start rounded-md px-2 py-1 text-xs text-gray-800 ${T?"":B[h]}`,style:{...G,...T&&{left:T.left,top:T.top,maxWidth:T.maxWidth,maxHeight:T.maxHeight}},children:a}),(!T||T.arrow)&&
|
|
5
|
+
/* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tooltip-arrow","data-side":T?.side??h,style:{background:Q,"--rosh-tooltip-edge":G?.border,...T?.arrow&&{left:T.arrow.left,top:T.arrow.top}}})]}),document.body)]})}var D=(t,e,o)=>Math.min(o,Math.max(e,t));function S(t,e,o,r,i){return Math.round(D("left"===o?t+e:t-e,r,i))}function I(t,e,o){let r=null;try{r=window.localStorage.getItem(t)}catch{return null}const i=r?parseInt(r,10):NaN;return Number.isNaN(i)?null:D(i,e,o)}function j({width:t,onResize:e,side:o,min:r,max:i,defaultWidth:n=r,step:h=16,storageKey:s,label:c,hint:u,controls:f,className:p=""}){const b=a().resizeHandle,w=d(null),v=d({onResize:e,min:r,max:i,side:o});v.current={onResize:e,min:r,max:i,side:o},l(()=>{if(!s)return;const o=I(s,r,i);null!==o&&o!==t&&e(o)},[s]),m(()=>{if(!s)return;const e=window.setTimeout(()=>{try{window.localStorage.setItem(s,String(Math.round(t)))}catch{}},200);return()=>window.clearTimeout(e)},[t,s]);const y=g(()=>{w.current=null,document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")},[]);m(()=>y,[y]);const M=t=>{w.current&&(t.currentTarget.hasPointerCapture?.(w.current.pointer)&&t.currentTarget.releasePointerCapture(w.current.pointer),y())},N="left"===o?"right-0":"left-0";/* @__PURE__ */
|
|
6
|
+
return x($,{content:u??b.hint,side:"left"===o?"right":"left",delay:600,className:`absolute inset-y-0 ${N} z-10 flex w-2 ${p}`.trim(),children:/* @__PURE__ */x("div",{role:"separator",tabIndex:0,"aria-orientation":"vertical","aria-label":c??b.label,"aria-valuenow":Math.round(t),"aria-valuemin":r,"aria-valuemax":i,"aria-controls":f,"data-resize-handle":o,onPointerDown:e=>{0===e.button&&(e.preventDefault(),w.current={x:e.clientX,width:t,moved:!1,pointer:e.pointerId},e.currentTarget.setPointerCapture?.(e.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},onPointerMove:t=>{const e=w.current;if(!e)return;if(0===t.buttons)return void y();const o=t.clientX-e.x;if(!e.moved){if(Math.abs(o)<3)return;e.moved=!0}const{onResize:r,min:i,max:n,side:a}=v.current;r(S(e.width,o,a,i,n))},onPointerUp:M,onPointerCancel:M,onLostPointerCapture:()=>{w.current&&y()},onDoubleClick:()=>e(D(n,r,i)),onKeyDown:a=>{const l="ArrowRight"===a.key?h:"ArrowLeft"===a.key?-h:null,s=null!==l?S(t,l,o,r,i):"Home"===a.key?r:"End"===a.key?i:"Enter"===a.key?D(n,r,i):null;null!==s&&(a.preventDefault(),s!==t&&e(s))},className:"group/resize relative h-full w-full cursor-col-resize touch-none rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */x("div",{"aria-hidden":"true",className:`absolute inset-y-0 ${N} w-px bg-transparent transition-colors group-hover/resize:bg-[var(--accent-500,var(--rosh-resize-handle))] group-focus-visible/resize:w-0.5 group-focus-visible/resize:bg-[var(--accent-500,var(--rosh-resize-handle))]`})})})}var A=(t,e,o)=>Math.min(Math.max(t,e),o);function F({sidebar:t,sidebarTop:e,sidebarBottom:o,children:r,side:i="left",storageKey:n,defaultWidth:l=256,minWidth:s=180,maxWidth:d=480,className:c="",sidebarClassName:m=("right"===i?"border-l border-gray-200 bg-gray-50":"border-r border-gray-200 bg-gray-50"),contentClassName:u="bg-white"}){const f="right"===i,g=a().sidebar,[p,v]=h(()=>(n?I(n,s,d):null)??A(l,s,d),A(l,s,d)),y=null!=e||null!=o,M=/* @__PURE__ */b("div",{className:"relative flex h-full shrink-0 flex-col",style:{width:p},children:[
|
|
7
|
+
/* @__PURE__ */b("div",{className:`flex h-full flex-col ${y?"overflow-hidden":"overflow-y-auto"} ${m}`,children:[null!=e&&/* @__PURE__ */x("div",{className:"flex shrink-0 flex-col gap-2 px-2 pt-3 pb-2",children:e}),y?/* @__PURE__ */x("div",{className:"min-h-0 flex-1 overflow-y-auto",children:t}):t,null!=o&&/* @__PURE__ */x("div",{className:"mt-auto flex shrink-0 flex-col gap-2 border-t border-gray-200 px-2 py-3",children:o})]}),
|
|
8
|
+
/* @__PURE__ */x(j,{side:i,width:p,onResize:v,min:s,max:d,defaultWidth:A(l,s,d),storageKey:n,hint:g.resize})]}),N=/* @__PURE__ */x("div",{className:`flex min-w-0 flex-1 flex-col ${u}`,children:r});/* @__PURE__ */
|
|
9
|
+
return x("div",{className:`flex h-full w-full overflow-hidden ${c}`,children:/* @__PURE__ */b(w,f?{children:[N,M]}:{children:[M,N]})})}export{y as MENU_MAX_HEIGHT,v as POPUP_MAX_WIDTH,j as ResizeHandle,F as SidebarLayout,$ as Tooltip,M as VIEWPORT_MARGIN,E as followAnchor,P as placeAtPoint,T as placeMenu,W as popupBounds,L as useDropdownPosition};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{onOverlayOpen as e,registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-ELSUXC3N.js";import{rootIsDark as r}from"./chunk-MAIHBBWT.js";import{useHydrated as o,useBrowserLayoutEffect as i}from"./chunk-D65T4H6J.js";import{createContext as a,forwardRef as s,useContext as l,useRef as u,useId as c,useState as d,useEffect as p,useMemo as m,useCallback as h}from"react";import{createPortal as f}from"react-dom";import{jsxs as g,jsx as y,Fragment as b}from"react/jsx-runtime";function x(){try{const e=getComputedStyle(document.documentElement).getPropertyValue("--menu-opacity")?.trim();if(e)return parseFloat(e)}catch{}return.95}var w=r;function v(){try{return document.documentElement.classList.contains("rosh-reduce-transparency")}catch{return!1}}function k(e,t){return`color-mix(in srgb, ${e} ${+(Math.round(255*Math.min(1,Math.max(0,t)))/255*100).toFixed(4)}%, transparent)`}function C(e,t={}){const n=e??x();if(v()&&"light"===t.ink)return{background:"var(--rosh-glass-light-ink-surface)",border:"1px solid var(--rosh-glass-light-ink-solid-border)",boxShadow:"var(--rosh-glass-solid-shadow)"};if(v())return{background:"var(--rosh-glass-surface)",border:"1px solid var(--rosh-glass-solid-border)",boxShadow:"var(--rosh-glass-solid-shadow)"};const r="var(--rosh-glass-surface)",o="var(--rosh-glass-surface-mid)";return w()?{background:`linear-gradient(135deg in srgb, ${k(r,.85*n)} 0%, ${k(o,.75*n)} 50%, ${k(r,.85*n)} 100%)`,backdropFilter:"blur(40px) saturate(1.6)",WebkitBackdropFilter:"blur(40px) saturate(1.6)",border:"1px solid var(--rosh-glass-border)",boxShadow:"var(--rosh-glass-shadow)"}:{background:`linear-gradient(135deg in srgb, ${k(r,.85*n)} 0%, ${k(o,.65*n)} 50%, ${k(r,.75*n)} 100%)`,backdropFilter:"blur(40px) saturate(1.8)",WebkitBackdropFilter:"blur(40px) saturate(1.8)",border:"1px solid var(--rosh-glass-border)",boxShadow:"var(--rosh-glass-shadow)"}}function N(e){return v()?"var(--rosh-glass-surface)":k("var(--rosh-glass-surface)",.85*(e??x()))}var $="border-white/20",L="glass-input-bg",M=/* @__PURE__ */new Set(["text","search","url","tel","email","password","number","date","datetime-local","month","week","time"]),B="data-native-context-menu";function E(e,t){return e&&"function"==typeof e.closest?e.closest(t):null}function T(e){const t=e;if(!t||"function"!=typeof t.closest)return!1;if(E(t,`[${B}]`))return!0;if(E(t,"textarea"))return!0;if(E(t,"img, picture, canvas, video, audio"))return!0;const n=E(t,"input");if(n){const e=(n.type||"text").toLowerCase();if(M.has(e))return!0}const r=E(t,"[contenteditable]");if(r){const e=(r.getAttribute("contenteditable")||"").toLowerCase();if(""===e||"true"===e||"plaintext-only"===e)return!0}return!1}var W=/* @__PURE__ */new Set(["http:","https:","mailto:","tel:","blob:"]);function S(e,t,n){const r=E(e,"a[href]"),o=(t||"").trim(),i=function(e,t){if(e&&"#"!==e)try{const n=new URL(e,t??("undefined"!=typeof document?document.baseURI:void 0));return W.has(n.protocol)?n.href:void 0}catch{return}}(r?.getAttribute("href"),n);return{kind:o?"selection":i?"link":"default",...o?{selectionText:o}:{},...i?{linkUrl:i}:{}}}function A(e){if(e.defaultPrevented)return!0;if(e.shiftKey)return!0;if("touch"===e.pointerType)return!0;return T(("function"==typeof e.composedPath?e.composedPath()[0]:void 0)??e.target)}function F(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function P(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function R(e,t,n){if(0===t.length||0===e.length)return[];const r=[e];for(let e=1;e<t.length;e++){const o=r[e-1].find(n=>n.to===t[e].key),i=o?n(o):[];if(0===i.length)break;r.push(i)}return r}function H(e,t,n,r){const o=Math.max(0,r-n),i=Math.min(t,o),a=e-i/2;return a<n?n:a+i>r?Math.max(n,r-i):a}function j(e,t,n,r,o,i=!1,a=8){const s=t+o,l=e-o-n,u=l>=a;return i&&u?{left:l,flipped:!0}:s+n<=r-a?{left:s,flipped:!1}:u?{left:l,flipped:!0}:i?{left:a,flipped:!0}:{left:Math.max(a,r-a-n),flipped:!1}}function D(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var I=a(null),z=a(!1);function U({children:r,style:i,className:a="",onClose:s,minWidth:l=180,portal:h=!1}){const g=u(null),b=c(),[x,w]=d([]),v=u();p(()=>()=>clearTimeout(v.current),[]);const k=o(),N=m(()=>{const e=()=>clearTimeout(v.current);return{id:b,depth:0,path:x,open:(t,n)=>{e(),w(e=>F(e,t,n))},scheduleClose:t=>{e(),v.current=setTimeout(()=>w(e=>P(e,t)),200)},closeBelow:t=>{e(),w(e=>P(e,t))},cancelClose:e,closeTree:()=>{e(),w([]),s?.()},root:g}},[b,x,s]);p(()=>{if(!s)return;const n=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${b}"]`)||g.current&&!g.current.contains(e.target)&&s()},r=e=>{"Escape"===e.key&&s()};window.addEventListener("pointerdown",n),window.addEventListener("keydown",r);const o=e(s),i=t(()=>!1,()=>g.current);return()=>{window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",r),o(),i()}},[s,b]),p(()=>{const e=g.current;e&&requestAnimationFrame(()=>{const t=e.getBoundingClientRect();if(t.right>window.innerWidth-8){const n=t.right-window.innerWidth+8;e.style.left?e.style.left=parseFloat(e.style.left)-n+"px":e.style.right||(e.style.left=t.left-n+"px")}if(t.left<8&&(e.style.left?e.style.left="8px":e.style.right&&(e.style.right=window.innerWidth-t.width-8+"px")),t.bottom>window.innerHeight-8){const n=t.bottom-window.innerHeight+8;e.style.top?e.style.top=parseFloat(e.style.top)-n+"px":e.style.bottom?e.style.bottom="8px":e.style.top=t.top-n+"px"}t.top<8&&(e.style.top?e.style.top="8px":e.style.bottom&&(e.style.bottom=window.innerHeight-t.height-8+"px"))})});const $=D(),L=/(^|[\s:])!?z-/.test(a),M=/* @__PURE__ */y("div",{ref:g,"data-popup-menu-tree":b,className:`fixed rounded-2xl ${"tight"===$?"py-1":"large"===$?"py-2":"py-1.5"} ${a}`,onContextMenu:e=>{T(e.target)||e.preventDefault()},style:{...L?{}:{zIndex:n.menu},minWidth:l,animation:"popup-in 0.12s ease-out",...C(),...i},children:/* @__PURE__ */y(I.Provider,{value:N,children:r})});return h?k?f(M,document.body):null:M}function q(e,t,n,r=!1){const o=D(),i="tight"===o?"0.25rem":"large"===o?"0.6rem":"max(0.25rem, calc(var(--menu-padding-y, 0.5rem) - 0.1rem))";return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${e?"text-red-600 hover:bg-red-50":r?"bg-blue-50 text-blue-700":"text-gray-700 hover:bg-blue-50 hover:text-blue-700"}\n ${t?"opacity-40 cursor-not-allowed":""}\n ${n}`,style:{width:"calc(100% - 8px)",marginLeft:4,marginRight:4,fontSize:"var(--menu-font-size, 14px)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:i,paddingBottom:i}}}var K=/* @__PURE__ */y("svg",{"aria-hidden":!0,className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});function V({kind:e,checked:t}){/* @__PURE__ */
|
|
2
|
+
return y("span","checkbox"===e?{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border "+(t?"border-blue-600 bg-blue-600 text-white":"border-gray-400"),children:t&&K}:{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:t&&K})}var J=s(function({onClick:e,children:t,className:n="",danger:r,disabled:o,role:i,checked:a,tabIndex:s,id:u,onMouseEnter:c},d){const p=l(I),m=l(z),h=q(r,o,n),f=void 0===a?null:"menuitemradio"===i?"radio":"checkbox";/* @__PURE__ */
|
|
3
|
+
return g("button",{ref:d,id:u,role:"radio"===f?"menuitemradio":"checkbox"===f?"menuitemcheckbox":i??(m?"menuitem":void 0),"aria-checked":f?a:void 0,tabIndex:s,onClick:()=>{e?.(),p&&p.depth>0&&"checkbox"!==f&&p.closeTree()},onMouseEnter:()=>{p?.scheduleClose(p.depth),c?.()},disabled:o,className:h.className,style:h.style,children:[f&&/* @__PURE__ */y(V,{kind:f,checked:!!a}),t]})}),O=/* @__PURE__ */y("svg",{"aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})});function X(e){let t=n.menu;for(let n=e;n&&n!==document.body;n=n.parentElement){const e=parseInt(getComputedStyle(n).zIndex,10);Number.isNaN(e)||(t=e)}return t}function G(e){return e?[...e.querySelectorAll("button:not([disabled])")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function Q({label:e,icon:n,children:r,disabled:o,className:a="",minWidth:s=180,maxHeight:d}){const x=l(I),w=c(),v=u(null),k=u(null),N=u(),$=u(!1),L=`${w}-menu`;p(()=>()=>clearTimeout(N.current),[]);const M=x?.depth??0,B=x?.path[M],E=!!B&&B.key===w&&!o,W=h(e=>{if(!x||o||!v.current)return;clearTimeout(N.current),$.current=e;const t=v.current.getBoundingClientRect(),n=v.current.closest("[data-popup-submenu-panel]")??v.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,i=M>0&&(x.path[M-1]?.flipped??!1),a=j(r.left,r.right,s,window.innerWidth,4,i);x.open(M,{key:w,y:t.top,...a})},[x,o,M,w,s]),S=e=>{x?.closeBelow(M),v.current?.focus()};p(()=>{if(E)return t(e=>"Escape"===e.key&&(!(x&&x.path.length>M+1)&&(S(),!0)),()=>k.current)}),i(()=>{if(!E||!B)return;const e=()=>{const e=k.current;if(!e||!v.current)return;const t=v.current.closest("[data-popup-submenu-panel]")??v.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??v.current.getBoundingClientRect(),r=M>0&&(x?.path[M-1]?.flipped??!1),o=e.offsetWidth||s,i=j(n.left,n.right,o,window.innerWidth,4,r,8),a=e.offsetHeight,l=H(v.current.getBoundingClientRect().top+a/2,a,8,window.innerHeight-8);e.style.left=`${i.left}px`,e.style.top=`${l}px`,e.dataset.flipped=String(i.flipped)};e();let t=0;const n=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}}),p(()=>{E&&$.current&&($.current=!1,G(k.current)[0]?.focus())},[E]);const A=m(()=>x&&{...x,depth:M+1},[x,M]);if(!x)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const F=q(!1,o,a,E),P=D();/* @__PURE__ */
|
|
4
|
+
return g(b,{children:[
|
|
5
|
+
/* @__PURE__ */g("button",{ref:v,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":E,"aria-controls":E?L:void 0,disabled:o,"data-popup-submenu-row":!0,className:F.className,style:F.style,onClick:e=>{const t=0===e.detail;E?t&&G(k.current)[0]?.focus():W(t)},onKeyDown:e=>{"ArrowRight"===e.key&&(e.preventDefault(),e.stopPropagation(),W(!0))},onMouseEnter:()=>{o||(x.cancelClose(),E?x.closeBelow(M+1):(clearTimeout(N.current),N.current=setTimeout(()=>W(!1),120)))},onMouseLeave:()=>{clearTimeout(N.current),x.scheduleClose(M)},children:[n,
|
|
6
|
+
/* @__PURE__ */y("span",{className:"min-w-0 flex-1 truncate",children:e}),O]}),E&&f(
|
|
7
|
+
/* @__PURE__ */y("div",{ref:k,id:L,role:"menu","data-popup-menu-tree":x.id,"data-popup-submenu-panel":!0,className:"fixed rounded-2xl overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===P?"py-1":"large"===P?"py-2":"py-1.5"),style:{left:B.left,top:B.y,minWidth:s,maxHeight:void 0===d?"calc(100vh - 16px)":`min(${"number"==typeof d?`${d}px`:d}, calc(100vh - 16px))`,zIndex:X(x.root.current)+M+1,animation:(B.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...C()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=G(k.current),n=t.indexOf(document.activeElement),r=n=>{e.preventDefault(),e.stopPropagation(),t[(n+t.length)%t.length]?.focus()};"ArrowDown"===e.key?r(n+1):"ArrowUp"===e.key?r(n<0?t.length-1:n-1):"Home"===e.key?r(0):"End"===e.key?r(t.length-1):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),S())},onMouseEnter:()=>{x.cancelClose(),clearTimeout(N.current)},onMouseLeave:()=>x.scheduleClose(M+1),onContextMenu:e=>{T(e.target)||e.preventDefault()},children:/* @__PURE__ */y(I.Provider,{value:A,children:r})}),document.body)]})}function Y(){const e=D();/* @__PURE__ */
|
|
8
|
+
return y("div",{className:`border-t ${$} ${"tight"===e?"my-0.5":"large"===e?"my-1.5":"my-1"} mx-3`})}function Z({children:e}){const t=D(),n="tight"===t?"0.125rem":"large"===t?"0.375rem":"0.25rem";/* @__PURE__ */
|
|
9
|
+
return y("div",{className:"text-xs font-medium uppercase tracking-wide",style:{color:"var(--ink-muted)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:n,paddingBottom:n},children:e})}function _({d:e,className:t="h-4 w-4 text-gray-400"}){/* @__PURE__ */
|
|
10
|
+
return y("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{$ as GLASS_DIVIDER,L as GLASS_INPUT_BG,V as MenuCheckMark,_ as MenuIcon,z as MenuSemanticsContext,B as NATIVE_MENU_ATTR,U as PopupMenu,Y as PopupMenuDivider,J as PopupMenuItem,Z as PopupMenuLabel,Q as PopupSubmenu,H as clampMenuTop,P as closeMenuBelow,S as describeContextTarget,N as glassFill,C as glassStyle,q as itemLook,T as keepsNativeMenu,A as leavesContextMenuAlone,j as menuPanelLeft,F as openMenuLevel,R as resolveMenuLevels};
|