efficient-shell 7.64.0 → 7.65.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/{Browser-DEK65GGL.js → Browser-LJYNAN55.js} +12 -12
- package/dist/Calculator-2F664I3G.js +29 -0
- package/dist/ConfirmDialog-EORVHGKM.js +1 -0
- package/dist/{CurrencyConverter-N237EF2N.js → CurrencyConverter-Z45C4SNW.js} +9 -9
- package/dist/{Documents-T6L323BV.js → Documents-H2L7GKM7.js} +27 -27
- package/dist/Files-VNNIH6KD.js +87 -0
- package/dist/Notepad-4YMVON4T.js +25 -0
- package/dist/PdfViewer-X4337266.js +1 -0
- package/dist/{PomodoroTimer-DMP6EY5F.js → PomodoroTimer-SSNVNS25.js} +52 -52
- package/dist/{Preview-RKQVILVT.js → Preview-GO4GYEQI.js} +52 -52
- package/dist/Sidebar-GZ73VXN7.js +43 -0
- package/dist/{Spreadsheet-RN6ROHUK.js → Spreadsheet-KBN7SHI7.js} +14 -14
- package/dist/{Stock-MC3S66WG.js → Stock-A2ANAULX.js} +3 -3
- package/dist/{Weather-UKY7EJO2.js → Weather-56JGRYFP.js} +17 -17
- package/dist/{WorldClock-R7MIP7F6.js → WorldClock-ZH5TZEMM.js} +4 -4
- package/dist/ai/index.js +21 -21
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-35UBO4T7.js → chunk-5DTPO25W.js} +3 -3
- package/dist/{chunk-R2FANVKE.js → chunk-5S6Y2M26.js} +16 -16
- package/dist/{chunk-LW5XF5JD.js → chunk-5SXGTGQE.js} +1 -1
- package/dist/chunk-6VMVPEYG.js +1 -0
- package/dist/{chunk-JQ2345TZ.js → chunk-AWT4Z7PI.js} +1 -1
- package/dist/{chunk-AAHMUDUP.js → chunk-BE6F2GAI.js} +2 -2
- package/dist/{chunk-4TJ6N5QS.js → chunk-BEBIR37J.js} +1 -1
- package/dist/{chunk-OF7EOZVS.js → chunk-BF6PTZ6R.js} +6 -6
- package/dist/chunk-CSZF4UIL.js +14 -0
- package/dist/{chunk-LPGG6DRT.js → chunk-DI5PZENO.js} +69 -69
- package/dist/{chunk-BJ4APV4M.js → chunk-DXCKYXRV.js} +1 -1
- package/dist/chunk-ENVRURGD.js +2 -0
- package/dist/chunk-FZQ4UFRE.js +27 -0
- package/dist/{chunk-4RUTVPTH.js → chunk-GGDCR6GM.js} +1 -1
- package/dist/chunk-HWH4UHIU.js +2 -0
- package/dist/{chunk-2YLR3CWQ.js → chunk-HWNAQ5MF.js} +14 -14
- package/dist/{chunk-T5J7AFTD.js → chunk-JNNGFK5N.js} +1 -1
- package/dist/{chunk-KOBUXTHU.js → chunk-KIOZ54V3.js} +20 -20
- package/dist/chunk-M4RQIHBG.js +2 -0
- package/dist/{chunk-BRK2GETX.js → chunk-MSH7WWFL.js} +12 -12
- package/dist/{chunk-GMZ2J6XQ.js → chunk-OLTYKIFI.js} +1 -1
- package/dist/{chunk-RFANAC7P.js → chunk-Q4VC5ZVW.js} +16 -16
- package/dist/{chunk-BVFQGLAJ.js → chunk-RJKDF5LT.js} +2 -2
- package/dist/{chunk-5BFEZCIV.js → chunk-RQPZ4YYJ.js} +368 -368
- package/dist/{chunk-7KBOLC6O.js → chunk-S3IYYSTT.js} +1 -1
- package/dist/chunk-SB5KBKVJ.js +1 -0
- package/dist/{chunk-R4XNK5UJ.js → chunk-UHTNN7UK.js} +9 -9
- package/dist/{chunk-4A4GD2NL.js → chunk-WA3MF5IV.js} +5 -5
- package/dist/{chunk-BHKRSEVI.js → chunk-XUOJSJR3.js} +1 -1
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/{index-D6mP2zYB.d.ts → index-Do4cL9nW.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +688 -688
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +8 -8
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{strings-BYsxAKI5.d.ts → strings-BXfu1R53.d.ts} +4 -0
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-2TQXXQTL.js +0 -29
- package/dist/ConfirmDialog-BSUSUHKJ.js +0 -1
- package/dist/Files-HNE3DY3I.js +0 -87
- package/dist/Notepad-TLPBE3NP.js +0 -25
- package/dist/PdfViewer-NT3MMNPO.js +0 -1
- package/dist/Sidebar-75YOMDJZ.js +0 -44
- package/dist/chunk-3IML3Y3Y.js +0 -1
- package/dist/chunk-HQJSOBDE.js +0 -15
- package/dist/chunk-LHHIRTEG.js +0 -2
- package/dist/chunk-QXAPPMUE.js +0 -1
- package/dist/chunk-TT6QOFWA.js +0 -2
- package/dist/chunk-ZOJJB5BQ.js +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buttonClasses as t}from"./chunk-K7PQXJO7.js";import{currentShellStrings as e}from"./chunk-
|
|
1
|
+
import{buttonClasses as t}from"./chunk-K7PQXJO7.js";import{currentShellStrings as e}from"./chunk-SB5KBKVJ.js";import{SPINNER_RING as n}from"./chunk-2J6F4EE7.js";var o="http://www.w3.org/2000/svg",s={},r=/* @__PURE__ */new Map;function i(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 a={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",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 c(t,e){const n=document.createElementNS(o,"svg");n.setAttribute("class",e),n.setAttribute("fill","none"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","2");const s=document.createElementNS(o,"path");return s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("d",a[t]),n.appendChild(s),n}function l(t,e){const n=document.createElement("div");return n.className=t,void 0!==e&&(n.textContent=e),n}function d(e,o,a){const d={...s,...a},u=d.placement??"top",m=d.sticky??!1,p=`${u}|${e}|${o}`;if(d.dedupe){const t=r.get(p);if(t)return t.restart(),{dismiss:t.dismiss}}"loading"!==e&&!1!==d.sound&&import("./sounds-E5OTSJLX.js").then(t=>{"success"===e?t.playSuccess():"error"===e?t.playError():t.playNotification()}).catch(()=>{});const f="bottom"===u?i("toast-container-bottom","fixed bottom-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col-reverse gap-2 items-center pointer-events-none"):i("toast-container","fixed top-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col gap-2 items-center pointer-events-none"),h="bottom"===u?"translateY(10px)":"translateY(-10px)",y=l("pointer-events-auto cursor-pointer rosh-toast");if(y.style.opacity="0",y.style.transform=`${h} scale(0.95)`,y.setAttribute("role","error"===e?"alert":"status"),y.setAttribute("aria-atomic","true"),"loading"===e){const t=document.createElement("span");t.setAttribute("aria-hidden","true"),t.className=`${n} h-4 w-4 rosh-tone-loading`,y.appendChild(t)}else y.appendChild(c(e,`h-4 w-4 rosh-tone-${e}`));const v=document.createElement("span");if(v.textContent=o,y.appendChild(v),d.action){const{label:e,onClick:n}=d.action,o=document.createElement("button");o.type="button",o.className=t({variant:"link",size:"sm"}),o.textContent=e,o.addEventListener("click",t=>{t.stopPropagation(),g||(n(),x("action"))}),y.appendChild(o)}let b;f.appendChild(y),requestAnimationFrame(()=>{y.style.opacity="1",y.style.transform="translateY(0) scale(1)"});let g=!1;const x=t=>{g||(g=!0,b&&clearTimeout(b),r.delete(p),y.style.opacity="0",y.style.transform=`${h} scale(0.95)`,setTimeout(()=>y.remove(),300),d.onClose?.(t))},E=()=>x("dismissed"),w=d.duration??("info"===e?4500:3e3),C=()=>{b&&clearTimeout(b),m||(b=setTimeout(()=>x("timeout"),w))};return C(),y.addEventListener("mouseenter",()=>{b&&clearTimeout(b)}),y.addEventListener("mouseleave",()=>{g||C()}),y.addEventListener("click",E),r.set(p,{el:y,restart:C,dismiss:E}),{dismiss:E}}var u=8e3,m=/* @__PURE__ */new Map,p=!1;var f={success:(t,e)=>d("success",t,e),error:(t,e)=>d("error",t,e),warning:(t,e)=>d("warning",t,e),info:(t,e)=>d("info",t,e),notify:(t,n)=>function(t,n){!1!==(n?.sound??s.sound)&&import("./sounds-E5OTSJLX.js").then(t=>t.playNotification()).catch(()=>{});const o=i("notif-container","fixed top-4 right-4 z-(--z-toast) flex flex-col gap-3 items-end pointer-events-none"),r=l("pointer-events-auto cursor-pointer rosh-notif");r.style.opacity="0",r.style.transform="translateX(30px) scale(0.95)";const a=l("rosh-notif-badge");a.appendChild(c("bell","h-5 w-5"));const d=l("rosh-notif-body");d.append(l("rosh-notif-title",e().toast.notification),l("notif-msg rosh-notif-msg",t));const u=document.createElement("button");u.className="rosh-notif-close",u.textContent="×",r.append(a,d,u);const m=()=>{r.style.opacity="0",r.style.transform="translateX(30px) scale(0.95)",setTimeout(()=>r.remove(),300)};u.addEventListener("click",t=>{t.stopPropagation(),m()}),r.addEventListener("click",m),o.appendChild(r),requestAnimationFrame(()=>{r.style.opacity="1",r.style.transform="translateX(0) scale(1)"}),setTimeout(m,n?.duration??1e4)}(t,n),promise:(t,e,n)=>{const o=d("loading",e.loading,{...n,sticky:!0});return t.then(t=>{o.dismiss(),d("success","function"==typeof e.success?e.success(t):e.success,n)},t=>{o.dismiss(),d("error","function"==typeof e.error?e.error(t):e.error,n)}),t},configure:t=>{s={...t}},undoable:function(t,n){p||"undefined"==typeof window||(p=!0,window.addEventListener("pagehide",()=>{const t=[...m.values()];m.clear();for(const e of t)e.run({keepalive:!0})}));const o=/* @__PURE__ */Symbol("undoable");let s=!1,r=null;const i=async t=>{if(!s){s=!0,m.delete(o);try{await(t?n.commit(t):n.commit())}catch(t){n.onFail?.(t)}}},a=()=>!s&&(s=!0,m.delete(o),n.undo(),!0);return m.set(o,{run:i}),r=d("success",t,{sound:!1,placement:n.placement,duration:n.duration??8e3,action:{label:n.actionLabel??e().toast.undo,onClick:()=>{a()}},onClose:t=>{"action"!==t&&i()}}),{undo:()=>{const t=a();return t&&r?.dismiss(),t},commit:async()=>{if(s)return;const t=i();r?.dismiss(),await t}}}};export{u as UNDOABLE_MS,f as toast_default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Tooltip as e}from"./chunk-RDLWLATO.js";import{useBrowserLayoutEffect as r}from"./chunk-D65T4H6J.js";import{useShellStrings as t}from"./chunk-SB5KBKVJ.js";import{useRef as o,useEffect as n,useCallback as i}from"react";import{jsx as s}from"react/jsx-runtime";var a=(e,r,t)=>Math.min(t,Math.max(r,e));function l(e,r,t,o,n){return Math.round(a("left"===t||"top"===t?e+r:e-r,o,n))}function u(e,r,t){let o=null;try{o=window.localStorage.getItem(e)}catch{return null}const n=o?parseInt(o,10):NaN;return Number.isNaN(n)?null:a(n,r,t)}function c({width:c,onResize:d,orientation:h="vertical",side:m,min:f,max:p,defaultWidth:v=f,step:g=16,storageKey:b,label:w,hint:z,controls:y,className:x=""}){const P="horizontal"===h,k=t().resizeHandle,N=o(null),D=o({onResize:d,min:f,max:p,side:m});D.current={onResize:d,min:f,max:p,side:m},r(()=>{if(!b)return;const e=u(b,f,p);null!==e&&e!==c&&d(e)},[b]),n(()=>{if(!b)return;const e=window.setTimeout(()=>{try{window.localStorage.setItem(b,String(Math.round(c)))}catch{}},200);return()=>window.clearTimeout(e)},[c,b]);const M=i(()=>{N.current=null,document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")},[]);n(()=>M,[M]);const T=e=>{N.current&&(e.currentTarget.hasPointerCapture?.(N.current.pointer)&&e.currentTarget.releasePointerCapture(N.current.pointer),M())},C="left"===m?"right-0":"right"===m?"left-0":"top"===m?"bottom-0":"top-0",I="left"===m?"right":"right"===m?"left":"top"===m?"bottom":"top",R=P?`absolute inset-x-0 ${C} z-10 flex h-2`:`absolute inset-y-0 ${C} z-10 flex w-2`;/* @__PURE__ */
|
|
2
|
+
return s(e,{content:z??k.hint,side:I,delay:600,className:`${R} ${x}`.trim(),children:/* @__PURE__ */s("div",{role:"separator",tabIndex:0,"aria-orientation":h,"aria-label":w??k.label,"aria-valuenow":Math.round(c),"aria-valuemin":f,"aria-valuemax":p,"aria-controls":y,"data-resize-handle":m,onPointerDown:e=>{0===e.button&&(e.preventDefault(),N.current={x:P?e.clientY:e.clientX,width:c,moved:!1,pointer:e.pointerId},e.currentTarget.setPointerCapture?.(e.pointerId),document.body.style.cursor=P?"row-resize":"col-resize",document.body.style.userSelect="none")},onPointerMove:e=>{const r=N.current;if(!r)return;if(0===e.buttons)return void M();const t=(P?e.clientY:e.clientX)-r.x;if(!r.moved){if(Math.abs(t)<3)return;r.moved=!0}const{onResize:o,min:n,max:i,side:s}=D.current;o(l(r.width,t,s,n,i))},onPointerUp:T,onPointerCancel:T,onLostPointerCapture:()=>{N.current&&M()},onDoubleClick:()=>d(a(v,f,p)),onKeyDown:e=>{const r=P?"ArrowDown":"ArrowRight",t=P?"ArrowUp":"ArrowLeft",o=e.key===r?g:e.key===t?-g:null,n=null!==o?l(c,o,m,f,p):"Home"===e.key?f:"End"===e.key?p:"Enter"===e.key?a(v,f,p):null;null!==n&&(e.preventDefault(),n!==c&&d(n))},className:P?"group/resize relative h-full w-full cursor-row-resize touch-none rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"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__ */s("div",{"aria-hidden":"true",className:P?`absolute inset-x-0 ${C} h-px bg-transparent transition-colors group-hover/resize:bg-[var(--accent-500,var(--rosh-resize-handle))] group-focus-visible/resize:h-0.5 group-focus-visible/resize:bg-[var(--accent-500,var(--rosh-resize-handle))]`:`absolute inset-y-0 ${C} 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))]`})})})}export{c as ResizeHandle,u as readStoredWidth};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{navVisible as e,isReachable as t,visibleChildren as n,isSection as r}from"./chunk-5A7MWTXX.js";import{useDismissPopupsOnOpen as a}from"./chunk-UVBK6YSR.js";import{glassStyle as l}from"./chunk-7IQ3B77H.js";import{Z_LAYERS as s}from"./chunk-FIEA5CGB.js";import{useShellStrings as o}from"./chunk-SB5KBKVJ.js";import{SpinnerRing as i,LoadingSpinner as c}from"./chunk-2J6F4EE7.js";import{useState as u,useEffect as d,useRef as p,useMemo as y,useId as f,useCallback as h}from"react";import{jsx as m,jsxs as b}from"react/jsx-runtime";import{createPortal as g}from"react-dom";var k={favicon:"h-8 w-8",compact:"h-10 w-10",wordmark:"h-10 w-40"};function x(e){return e.trim().charAt(0).toLocaleUpperCase()||"·"}function v(e,t,n){return!1===e?"framed":null==e||null==t?"plate-light":t?"light"===n?"plate-dark":"bare":"dark"===n?"plate-light":"bare"}var w={"plate-light":"bg-white shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]","plate-dark":"bg-neutral-900 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow-strong)]",framed:"border border-black/10 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]",bare:""};function N(e,t,n){return"bare"===e?{}:"framed"===e?{borderRadius:t}:{borderRadius:t,padding:n}}function _({src:e,fallbackSrc:t,fallbackHasAlpha:n=null,fallbackIsLight:r=null,fallbackAdaptive:a,alt:l,slot:s="compact",surface:o="light",size:i,width:c,height:p,decorative:y=!1,fallbackMode:f="monogram",adaptive:h=!1,hasAlpha:b=null,isLight:g=null,treatmentPadding:_=4,treatmentRadius:L=8,className:A="",style:C}){const[E,$]=u(e||t||"");d(()=>{$(e||t||"")},[e,t]);const I=Boolean(t&&E===t&&E!==e),T=(I?a??h:h)?v(I?n:b,I?r:g,o):"bare",j=["inline-flex shrink-0 items-center justify-center overflow-hidden",null==i&&null==c&&null==p?k[s]:"","dark"===o?"text-white":"text-gray-700",w[T],A].filter(Boolean).join(" "),S={...N(T,L,_),...null==i?{width:c,height:p}:{width:i,height:i},...C};return E?/* @__PURE__ */m("span",{className:j,"data-brand-treatment":T,style:S,children:/* @__PURE__ */m("img",{src:E,alt:y?"":l,"data-brand-slot":s,className:"block max-h-full max-w-full",style:{objectFit:"contain"},onError:()=>$(e=>t&&e!==t?t:"")})}):"none"===f?null:/* @__PURE__ */m("span",{"data-brand-fallback":!0,"data-brand-slot":s,"aria-label":y?void 0:l,"aria-hidden":y||void 0,role:y?void 0:"img",className:`${j} rounded-md bg-gray-100 font-semibold`,style:S,children:y?null:x(l)})}function L(n,r){return e(n,r)?n.items.filter(n=>e(n,r)&&t(n,r)):[]}function A(e,r){return n(e,r).filter(e=>t(e,r))}function C(n,a,l){const s=new Set(a.erp),o=new Set(a.system),i=new Set(a.footer??[]),c=n.filter(r),u=e=>c.filter(t=>e.has(t.label)&&L(t,l).length>0);return{topItems:n.filter(e=>!r(e)).filter(n=>e(n,l)&&t(n,l)),erpSections:u(s),systemSections:u(o),virtualSections:(a.virtual??[]).filter(e=>e.items.length>0),footerSections:u(i),footerItems:(a.footerItems??[]).filter(n=>e(n,l)&&t(n,l))}}function E(e,t){const n=e=>{const r=A(e,t);return 0===r.length?[e]:r.flatMap(n)},r=[];let a=null;for(const l of e){const e=A(l,t);e.length>0?(a&&r.push(a),a=null,r.push({heading:l,items:e.flatMap(n)})):(a||(a={heading:null,items:[]}),a.items.push(l),l.dividerAfter&&(r.push(a),a=null))}return a&&r.push(a),r}function $(e,t,n){return!!t&&e.some(e=>e.to===t||$(A(e,n),t,n))}var I="__page__";function T(e){const t=e.indexOf("?");if(t<0)return{path:e,search:""};const n=new URLSearchParams(e.slice(t+1));return{path:e.slice(0,t),search:n.get("search")??""}}function j(e,t,n){const r=function(e,t){const n=[],r=e=>{const a=A(e,t);0===a.length?n.push(e):a.forEach(r)};e.topItems.forEach(r);for(const n of[...e.erpSections,...e.systemSections,...e.footerSections])L(n,t).forEach(r);for(const t of e.virtualSections)t.items.forEach(r);return e.footerItems.forEach(r),n}(e,t);return Object.assign(async e=>{const t=e.trim().toLowerCase();if(!t)return[];const a=/* @__PURE__ */new Set,l=[];for(const e of r){const r=e.menuLabel??e.label;a.has(e.to)||!e.label.toLowerCase().includes(t)&&!r.toLowerCase().includes(t)||(a.add(e.to),l.push({type:n,label:e.label,entity_type:I,entity_id:e.to}))}return l.slice(0,8)},{destinations:r})}function S(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||"string"!=typeof r.entityType||"string"!=typeof r.entityId||"string"!=typeof r.label)continue;if("preview-file"===r.entityType)continue;const e="page"===r.entityType;n.push({type:e?t:"",label:r.label,entity_type:e?I:r.entityType,entity_id:r.entityId})}return n}var M="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z";function K(e){return e.typeKey??e.type}function R(e,t){return t?.[K(e)]??e.type}function B(e,t,n){return 0===n.length?null:{key:e,title:t,rows:n.map((e,t)=>({kind:"action",key:`action:${t}:${e.label}`,label:e.label,icon:e.icon,action:e})),count:n.length}}function D(e,t,n,r){return{type:e,label:t,entity_type:I,entity_id:`${n}?search=${encodeURIComponent(r.trim())}`}}function P(e,t,n,r,a){const l=function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=K(n),r=t.get(e);r?r.results.push(n):t.set(e,{type:n.type,results:[n]})}return Array.from(t,([e,t])=>({key:e,...t}))}(e).map(e=>{const t=e.results.map((t,n)=>({kind:"result",key:`result:${e.key}:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,result:t})),r=!!a?.truncatedTypes?.includes(e.key),l=r?a?.listRoutes?.[e.key]:void 0,s=a?.typeLabels?.[e.key]??e.type;if(a&&l){const r=a.seeAllLabel(l.label);t.push({kind:"seeAll",key:`seeall:${e.key}`,label:r,result:D(s,r,l.path,n)})}return{key:`type:${e.key}`,title:s,rows:t,count:e.results.length,truncated:r}}),s=B("actions",r,function(e,t){const n=t.trim().toLowerCase();return e&&n?e.filter(e=>e.label.toLowerCase().includes(n)||(e.keywords??[]).some(e=>e.toLowerCase().includes(n))):[]}(t,n));return s?[...l,s]:l}function z(e,t,n){return 0===n?0:Math.min(Math.max(e+t,0),n-1)}var F=(e,t)=>e.entity_type===t.entity_type&&e.entity_id===t.entity_id;function H(e,t,n=8){return[t,...e.filter(e=>!F(e,t))].slice(0,n)}function U(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||"object"!=typeof n)continue;const e=n;if("string"!=typeof e.type||"string"!=typeof e.label||"string"!=typeof e.entity_type||"string"!=typeof e.entity_id)continue;const r={type:e.type,label:e.label,entity_type:e.entity_type,entity_id:e.entity_id};"string"==typeof e.sub&&(r.sub=e.sub),"string"==typeof e.typeKey&&(r.typeKey=e.typeKey),t.some(e=>F(e,r))||t.push(r)}return t.slice(0,8)}function V(e){if(Array.isArray(e))return{results:e,truncatedTypes:[]};if(e&&"object"==typeof e&&Array.isArray(e.results)){const{results:t,truncatedTypes:n}=e;return{results:t,truncatedTypes:Array.isArray(n)?n:[]}}return{results:[],truncatedTypes:[]}}var W=[];function G(e,t,n){const[r,a]=u([]),[l,s]=u(W),[o,i]=u(!1),[c,y]=u("none"),f=p(function(){let e=0,t=null;const n=()=>{e+=1,t?.abort(),t=null};return{begin:()=>{n();const r=e,a=new AbortController;return t=a,{signal:a.signal,isCurrent:()=>r===e}},cancel:n}}());d(()=>{const r=f.current;if(e.length<n||!t||0===t.length)return r.cancel(),a(e=>0===e.length?e:[]),s(W),y("none"),void i(!1);i(!0);const l=setTimeout(async()=>{const n=r.begin(),l=await async function(e,t,n){const r=await Promise.all(e.map(async e=>{try{return{failed:!1,...V(await e(t,{signal:n}))}}catch(e){const t=n.aborted||function(e){if(!e||"object"!=typeof e)return!1;const{name:t,code:n}=e;return"AbortError"===t||"CanceledError"===t||"ERR_CANCELED"===n}(e);return{failed:!t,results:[],truncatedTypes:[]}}}));return{results:r.flatMap(e=>e.results),truncatedTypes:Array.from(new Set(r.flatMap(e=>e.truncatedTypes))),failed:r.filter(e=>e.failed).length}}(t,e,n.signal);n.isCurrent()&&(a(l.results),s(l.truncatedTypes),y(0===l.failed?"none":l.failed>=t.length?"all":"some"),i(!1))},250);return()=>{clearTimeout(l),r.cancel()}},[e,t,n]);return{results:r,truncatedTypes:l,loading:o,failure:c,reset:h(()=>{f.current.cancel(),a(e=>0===e.length?e:[]),s(W),y("none"),i(!1)},[])}}var J=(e,t)=>`${e}-opt-${t}`;function O(e,t){if("seeAll"===e.kind)return"M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3";if("action"===e.kind)return e.icon??M;if(e.icon)return e.icon;const n=t?.[K(e.result)];return n||M}function X({sections:e,activeIdx:t,listId:n,label:r,typeIcons:a,groupCount:l,groupLabel:s,onHover:o,onPick:i}){let c=0;/* @__PURE__ */
|
|
2
|
+
return m("div",{id:n,role:"listbox","aria-label":r,className:"py-1",children:e.map(e=>/* @__PURE__ */b("div",{role:"group","aria-label":s(e.title,e.count,!!e.truncated),children:[
|
|
3
|
+
/* @__PURE__ */b("div",{"aria-hidden":"true",className:"flex items-center justify-between px-4 pt-2 pb-1 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:[
|
|
4
|
+
/* @__PURE__ */m("span",{children:e.title}),
|
|
5
|
+
/* @__PURE__ */m("span",{className:"font-medium normal-case tracking-normal",children:l(e.count,!!e.truncated)})]}),e.rows.map(e=>{const r=c++,l=r===t,s="action"===e.kind||"seeAll"===e.kind?void 0:e.badge,u="action"===e.kind||"seeAll"===e.kind?void 0:e.sub,d="seeAll"===e.kind;/* @__PURE__ */
|
|
6
|
+
return b("div",{id:J(n,r),role:"option","aria-selected":l,className:"flex items-center gap-3 w-full px-4 py-3 text-left cursor-pointer transition-colors "+(l?"bg-blue-50":"hover:bg-gray-50"),onMouseDown:e=>e.preventDefault(),onClick:()=>i(e),onMouseEnter:()=>o(r),children:[
|
|
7
|
+
/* @__PURE__ */m("svg",{className:"h-4 w-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */m("path",{strokeLinecap:"round",strokeLinejoin:"round",d:O(e,a)})}),
|
|
8
|
+
/* @__PURE__ */b("div",{className:"flex-1 min-w-0",children:[
|
|
9
|
+
/* @__PURE__ */m("p",{className:"text-sm font-medium truncate "+(d?"text-blue-600":"text-gray-900"),children:e.label}),u&&/* @__PURE__ */m("p",{className:"text-xs text-gray-400 truncate",children:u})]}),s&&/* @__PURE__ */m("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-3xs font-medium text-gray-500",children:s})]},e.key)})]},e.key))})}var q="react-os-shell:open-global-search";function Q(){"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(q))}function Y({providers:e,typeIcons:t,typeLabels:n,listRoutes:r,placeholder:k,quickActions:x,onSelect:v,recent:w,onRecord:N,favorites:_,hotkey:L=!0}={}){const A=o().search,C=k??A.placeholder,[E,$]=u(!1),[I,T]=u(""),[j,S]=u(0),K=p(null),{results:D,truncatedTypes:F,loading:H,failure:U,reset:V}=G(I,e,2);d(()=>{const e=e=>{L&&!e.defaultPrevented&&(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),$(e=>!e)),"Escape"===e.key&&E&&$(!1)},t=()=>$(!0);return window.addEventListener("keydown",e),window.addEventListener(q,t),()=>{window.removeEventListener("keydown",e),window.removeEventListener(q,t)}},[E,L]),a(E);const[W,O]=u(!1);E!==W&&(O(E),E&&(T(""),S(0),V())),d(()=>{E?setTimeout(()=>K.current?.focus(),50):T("")},[E]),d(()=>{S(0)},[D]);const Q=I.length>=2,Y=y(()=>Q?P(D,x,I,A.actions,{truncatedTypes:F,listRoutes:r,typeLabels:n,seeAllLabel:A.seeAll}):function(e,t){const n=[];e.recent?.length&&n.push({key:"recent",title:t.recent,rows:e.recent.map((t,n)=>({kind:"recent",key:`recent:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,badge:R(t,e.typeLabels),result:t})),count:e.recent.length}),e.favorites?.length&&n.push({key:"favorites",title:t.favorites,rows:e.favorites.map((t,n)=>({kind:"favorite",key:`favorite:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,badge:R(t,e.typeLabels)||void 0,icon:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z",result:t})),count:e.favorites.length});const r=B("actions",t.actions,e.actions??[]);return r&&n.push(r),n}({recent:w,favorites:_,actions:x,typeLabels:n},A),[Q,D,F,r,n,x,I,w,_,A]),Z=y(()=>function(e){return e.flatMap(e=>e.rows)}(Y),[Y]),ee=Math.min(j,Math.max(Z.length-1,0)),te=f(),ne=Z.length>0;d(()=>{E&&0!==Z.length&&document.getElementById(J(te,ee))?.scrollIntoView?.({block:"nearest"})},[E,ee,Z.length,te]);const re=h(e=>{$(!1),"action"!==e.kind?("result"!==e.kind&&"recent"!==e.kind||N?.(e.result),v?.(e.result)):e.action.onSelect()},[v,N]);return E?g(
|
|
10
|
+
/* @__PURE__ */b("div",{"data-global-search":"",className:"fixed inset-0 flex items-start justify-center pt-[15vh]",style:{zIndex:s.overlay},onClick:()=>$(!1),children:[
|
|
11
|
+
/* @__PURE__ */m("div",{"data-global-search-backdrop":"",className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),
|
|
12
|
+
/* @__PURE__ */b("div",{className:"relative z-10 w-full max-w-xl rounded-(--radius-popup) overflow-hidden",onClick:e=>e.stopPropagation(),style:l(),children:[
|
|
13
|
+
/* @__PURE__ */b("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200",children:[
|
|
14
|
+
/* @__PURE__ */m("svg",{className:"h-5 w-5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */m("path",{strokeLinecap:"round",strokeLinejoin:"round",d:M})}),
|
|
15
|
+
/* @__PURE__ */m("input",{ref:K,type:"text",value:I,onChange:e=>{T(e.target.value),S(0)},onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),S(z(ee,1,Z.length))):"ArrowUp"===e.key?(e.preventDefault(),S(z(ee,-1,Z.length))):"Tab"===e.key&&Z.length>0?(e.preventDefault(),S(function(e,t,n){const r=e.length;if(0===r)return 0;const a=[];let l=0;for(const t of e)a.push(l),l+=t;let s=0;for(let e=0;e<r;e++)t>=a[e]&&(s=e);return a[(s+n+r)%r]}(Y.map(e=>e.rows.length),ee,e.shiftKey?-1:1))):"Enter"===e.key&&Z[ee]&&re(Z[ee])},placeholder:C,role:"combobox","aria-expanded":ne,"aria-controls":ne?te:void 0,"aria-activedescendant":ne?J(te,ee):void 0,"aria-autocomplete":"list",className:"flex-1 text-sm bg-transparent border-0 rosh-focus-ring placeholder-gray-400"}),H&&/* @__PURE__ */m("span",{"data-global-search-spinner":"",role:"status","aria-label":A.searching,className:"flex shrink-0",children:/* @__PURE__ */m(i,{className:"h-4 w-4",ink:"text-gray-500"})}),
|
|
16
|
+
/* @__PURE__ */m("kbd",{className:"hidden sm:inline-flex items-center rounded border border-gray-300 px-2 py-0.5 text-2xs font-medium text-gray-400",children:A.escBadge})]}),
|
|
17
|
+
/* @__PURE__ */b("div",{className:"max-h-[50vh] overflow-y-auto",children:[H&&0===Z.length&&/* @__PURE__ */m(c,{size:"sm",padding:"py-6",label:A.searching}),!H&&"all"===U&&Q&&/* @__PURE__ */m("div",{role:"alert",className:"px-4 py-3 text-center text-sm text-red-600",children:A.searchFailed}),!H&&Q&&0===Z.length&&"all"!==U&&/* @__PURE__ */m("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:A.noResults}),ne&&/* @__PURE__ */m(X,{sections:Y,activeIdx:ee,listId:te,label:A.listLabel,typeIcons:t,groupCount:A.groupCount,groupLabel:A.groupLabel,onHover:S,onPick:re}),!H&&"some"===U&&Q&&/* @__PURE__ */m("div",{role:"status",className:"px-4 py-2 text-xs text-amber-600",children:A.partialFailure}),!H&&!Q&&0===Z.length&&/* @__PURE__ */m("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:A.minChars(2)})]}),
|
|
18
|
+
/* @__PURE__ */b("div",{className:"flex items-center justify-between px-4 py-2 border-t border-gray-100 bg-gray-50 text-2xs text-gray-400",children:[
|
|
19
|
+
/* @__PURE__ */b("div",{className:"flex items-center gap-3",children:[
|
|
20
|
+
/* @__PURE__ */b("span",{className:"flex items-center gap-1",children:[
|
|
21
|
+
/* @__PURE__ */m("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:"↑"}),
|
|
22
|
+
/* @__PURE__ */m("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:"↓"}),` ${A.navigate}`]}),
|
|
23
|
+
/* @__PURE__ */b("span",{className:"flex items-center gap-1",children:[
|
|
24
|
+
/* @__PURE__ */m("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:A.enterKey}),` ${A.open}`]}),Y.length>1&&/* @__PURE__ */b("span",{className:"flex items-center gap-1",children:[
|
|
25
|
+
/* @__PURE__ */m("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:A.tabKey}),` ${A.nextGroup}`]})]}),
|
|
26
|
+
/* @__PURE__ */b("span",{className:"flex items-center gap-1",children:[
|
|
27
|
+
/* @__PURE__ */m("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:A.escKey}),` ${A.close}`]})]})]})]}),document.body):null}export{_ as BrandMark,Y as GlobalSearch,I as PAGE_RESULT_ENTITY,S as favoritesToResults,E as flyoutGroups,j as navPagesProvider,Q as openGlobalSearch,T as parsePageResultTarget,C as partitionNav,H as pushRecent,v as resolveBrandMarkTreatment,$ as rowsContainRoute,U as sanitizeRecent,A as visibleNavChildren,L as visibleSectionItems};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ShellStringsProvider as t}from"./chunk-
|
|
1
|
+
import{ShellStringsProvider as t}from"./chunk-SB5KBKVJ.js";import{createContext as e,useEffect as a,useCallback as n,useMemo as r,useContext as l}from"react";import{jsx as o}from"react/jsx-runtime";var g={tag:"en",name:"English",locale:null},c="react-os-shell:language",u=t=>"string"==typeof t?t:t.tag;function i(t){try{const e=new Intl.Locale(t).maximize();return{language:e.language,script:e.script}}catch{return null}}function s(t,e){const a=e.map(u),n=t.toLowerCase(),r=a.find(t=>t.toLowerCase()===n);if(r)return r;const l=i(t);if(!l)return;const o=a.map(t=>({tag:t,parts:i(t)})).filter(t=>t.parts?.language===l.language);return(o.find(t=>t.parts?.script===l.script)??o[0])?.tag}function f(){try{return globalThis.localStorage?.getItem(c)??null}catch{return null}}function m(t){try{return globalThis.localStorage?.setItem(c,t),globalThis.localStorage?.getItem(c)===t}catch{return!1}}function h({offered:t,fallback:e,saved:a=f(),preferred:n=globalThis.navigator?.languages??[]}){const r=e??(t.length>0?u(t[0]):g.tag);if(a){const e=s(a,t);if(e)return e}for(const e of n){const a=s(e,t);if(a)return a}return r}var d=e({language:g.tag,languages:[g],setLanguage:async()=>{}}),p=()=>globalThis.location?.reload();function b({languages:e,language:l,strings:g,onChange:c,reload:u=p,children:i}){const s=e.find(t=>t.tag===l),f=s?void 0===s.locale?s.tag:s.locale??void 0:void 0;a(()=>{const t=globalThis.document?.documentElement;if(!t)return;const e=t.getAttribute("lang");return t.setAttribute("lang",l),()=>{null===e?t.removeAttribute("lang"):t.setAttribute("lang",e)}},[l]);const h=n(async t=>{if(t!==l&&e.some(e=>e.tag===t)){m(t);try{await(c?.(t))}catch{}u&&u()}},[l,e,c,u]),b=r(()=>({language:l,languages:e,setLanguage:h}),[l,e,h]);/* @__PURE__ */
|
|
2
2
|
return o(d.Provider,{value:b,children:/* @__PURE__ */o(t,{value:g,locale:f,children:i})})}function v(){return l(d)}export{g as ENGLISH,c as SHELL_LANGUAGE_STORAGE_KEY,b as ShellLanguageProvider,s as matchShellLanguage,f as readSavedShellLanguage,h as resolveShellLanguage,m as saveShellLanguage,v as useShellLanguage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createContext as t,useContext as e}from"react";import{jsx as r}from"react/jsx-runtime";var n={},o=new Proxy(n,{get:(t,e)=>n[e],has:(t,e)=>e in n,ownKeys:()=>Object.keys(n),getOwnPropertyDescriptor(t,e){if(e in n)return{configurable:!0,enumerable:!0,value:n[e]}}});function a(t){for(const t of Object.keys(n))delete n[t];Object.assign(n,t)}var u={},i=[],c={erp:[],system:[],virtual:[],footer:[]},s=t({hasAnyPerm:()=>!0});function d({value:t,children:e}){/* @__PURE__ */
|
|
2
|
+
return r(s.Provider,{value:t,children:e})}function m(){return e(s)}var l=40,h=240,f=40,p=200,w=420,y="react-os-shell:work-area-changed";function g(){const t=getComputedStyle(document.documentElement),e=parseInt(t.getPropertyValue("--taskbar-height"))||0,r=parseInt(t.getPropertyValue("--taskbar-width"))||0,n=t.getPropertyValue("--taskbar-position")?.trim()||"bottom",o=parseInt(t.getPropertyValue("--sidebar-width"))||0;return{x:("left"===n?r:0)+o,y:"top"===n?e:0,w:window.innerWidth-("left"===n||"right"===n?r:0)-o,h:window.innerHeight-("top"===n||"bottom"===n?e:0)}}function b(t,e,r){const n=r?e.w+280:e.w-280,o=Math.abs(t.w-e.w)<=4||Math.abs(t.w-n)<=4;return Math.abs(t.h-e.h)<=4&&o}function v({over:t,residual:e},r){return e<=1||t-e>=r-2}function x(t,e,r){let n=t;for(const o of r)v(o,e)&&(n=Math.max(n,t+o.over));return Math.ceil(n)}function M(t,e,r,n){const o=Math.min(e,r.w-2*n);if(o<=t.w+1)return t;const a=r.x+n,u=r.x+r.w-n-o,i=Math.min(Math.max(t.x-(o-t.w)/2,a),u);return{...t,x:Math.round(i),w:Math.round(o)}}function P(){return(parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width"))||0)>0}function k(){return"undefined"!=typeof document&&"sidebar"===getComputedStyle(document.documentElement).getPropertyValue("--layout-mode")?.trim()}export{f as RAIL_COLLAPSED_W,w as RAIL_MAX_W,p as RAIL_MIN_W,h as RAIL_W,d as ShellAuthProvider,l as TAB_STRIP_H,y as WORK_AREA_CHANGED_EVENT,b as boxFillsWorkArea,g as computeMaximizedBox,M as growBoxToWidth,P as isSidebarStripReserved,o as navIcons,i as navSections,k as readAlwaysMaximizedFlag,v as scrollerIsFluid,u as sectionIcons,a as setShellNavIcons,c as startMenuCategories,m as useShellAuth,x as widthToFit};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{useCopyText as e,CopyGlyph as n}from"./chunk-
|
|
2
|
-
return p(
|
|
3
|
-
return p("button",{type:"button",tabIndex:-1,"aria-label":i?l:r,title:i?l:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */p(n,{copied:i,className:"size-3.5"})})}function x({node:e}){const n=d(null);return m(()=>{const t=n.current;if(t)return t.appendChild(e),()=>{e.parentNode===t&&t.removeChild(e)}},[e]),/* @__PURE__ */p("span",{ref:n,className:"ml-1 flex shrink-0 items-center"})}function g({tabs:e,activeKey:n,idFor:
|
|
1
|
+
import{useCopyText as e,CopyGlyph as n}from"./chunk-5DTPO25W.js";import{PopupMenu as t,PopupMenuItem as r,PopupMenuDivider as l}from"./chunk-YJIG2KT3.js";import{Icon as i}from"./chunk-76DRQSJM.js";import{useShellStrings as a}from"./chunk-SB5KBKVJ.js";import{useState as o,useEffect as s,Fragment as c,useRef as d,useLayoutEffect as m}from"react";import{jsxs as u,jsx as p,Fragment as y}from"react/jsx-runtime";var h="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500";function f(){/* @__PURE__ */
|
|
2
|
+
return p(i,{name:"close",look:"mini","aria-hidden":"true",className:"size-3.5"})}function b({text:t,label:r,copiedLabel:l}){const{copied:i,copy:a}=e(t);/* @__PURE__ */
|
|
3
|
+
return p("button",{type:"button",tabIndex:-1,"aria-label":i?l:r,title:i?l:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */p(n,{copied:i,className:"size-3.5"})})}function x({node:e}){const n=d(null);return m(()=>{const t=n.current;if(t)return t.appendChild(e),()=>{e.parentNode===t&&t.removeChild(e)}},[e]),/* @__PURE__ */p("span",{ref:n,className:"ml-1 flex shrink-0 items-center"})}function g({tabs:e,activeKey:n,idFor:i,panelMounted:d,onActivate:m,onClose:g,onCloseMany:k,label:v,className:w,activeClassName:N,end:C,onIconMenu:$,menuItems:j,sizing:z="even"}){const I=a().pageTabs,[D,M]=o(null),_=e.length;s(()=>{if(!n)return;const e=document.getElementById(i(n,"tab"));e?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[i,n,_]);const B=e.some(e=>e.key===n)?n:e[0]?.key,A=n=>{const t=e[(n+e.length)%e.length];t&&document.getElementById(i(t.key,"tab"))?.focus()},K=D?e.find(e=>e.key===D.key):void 0,T=K&&j?j(K.key):[],E=K?e.indexOf(K):-1,R=e=>e.some(e=>!e.pinned),J=e=>()=>{M(null),e()};/* @__PURE__ */
|
|
4
4
|
return u("div",{className:w??"relative flex h-10 shrink-0 items-end gap-3 bg-gray-100 px-3",children:[
|
|
5
5
|
/* @__PURE__ */p("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-px bg-gray-200"}),
|
|
6
|
-
/* @__PURE__ */p("div",{role:"tablist","aria-label":v,onKeyDown:n=>{const t=e.findIndex(e=>document.getElementById(
|
|
7
|
-
/* @__PURE__ */u("span",{className:"relative flex size-4 shrink-0 items-center justify-center text-gray-500 [&>svg]:size-4","aria-hidden":"true",children:[o,
|
|
6
|
+
/* @__PURE__ */p("div",{role:"tablist","aria-label":v,onKeyDown:n=>{const t=e.findIndex(e=>document.getElementById(i(e.key,"tab"))===n.target);if(!(t<0)){if("ArrowRight"===n.key)A(t+1);else if("ArrowLeft"===n.key)A(t-1);else if("Home"===n.key)A(0);else if("End"===n.key)A(e.length-1);else{if("Delete"!==n.key||e[t].pinned)return;g(e[t].key)}n.preventDefault()}},className:"flex min-w-0 flex-1 items-end overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.map((t,r)=>{const l=t.key===n,a=!!t.dirty,o=t.icon,s=l?N??"z-[1] border-gray-200 bg-gray-50 text-gray-900":"border-transparent text-gray-600 hover:bg-gray-200/70 hover:text-gray-900",y=r>0&&!l&&e[r-1].key!==n,k={type:"button",role:"tab",id:i(t.key,"tab"),"aria-selected":l,"aria-controls":d?.(t.key)?i(t.key,"panel"):void 0,tabIndex:t.key===B?0:-1,title:t.title,onClick:()=>m(t.key)},v={onContextMenu:e=>((e,n)=>{e.preventDefault(),M({x:e.clientX,y:e.clientY,key:n.key})})(e,t),onAuxClick:e=>((e,n)=>{1!==e.button||n.pinned||(e.preventDefault(),g(n.key))})(e,t),onMouseDown:e=>{1===e.button&&e.preventDefault()}},w=o&&
|
|
7
|
+
/* @__PURE__ */u("span",{className:"relative flex size-4 shrink-0 items-center justify-center text-gray-500 [&>svg]:size-4","aria-hidden":"true",children:[o,a&&!l&&!t.pinned&&
|
|
8
8
|
/* @__PURE__ */p("span",{className:"absolute -right-1 -top-1 hidden size-2 rounded-full bg-gray-500 ring-2 ring-gray-100 @max-[6.5rem]:block @max-[6.5rem]:group-hover:hidden"})]}),C=l&&!!$&&!!o;return t.pinned?/* @__PURE__ */p("div",{role:"presentation",className:`group relative flex h-8 flex-none items-center justify-center rounded-t-md border border-b-0 transition-colors ${o?"w-10":""} ${s}`,...v,children:/* @__PURE__ */u("button",{...k,className:`flex h-full items-center justify-center rounded-t-md ${o?"w-full":"px-3"} ${h}`,children:[w,
|
|
9
9
|
/* @__PURE__ */p("span",{className:o?"sr-only":"whitespace-nowrap text-sm",children:t.title})]})},t.key):/* @__PURE__ */u(c,{children:[y&&/* @__PURE__ */p("span",{"aria-hidden":"true",className:"mb-3 h-4 w-px shrink-0 self-end border-l border-gray-300"}),
|
|
10
|
-
/* @__PURE__ */u("div",{role:"presentation",className:`group relative flex h-8 items-center rounded-t-md border border-b-0 text-sm transition-colors ${"active-full"===
|
|
11
|
-
/* @__PURE__ */p("button",{type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-label":
|
|
10
|
+
/* @__PURE__ */u("div",{role:"presentation",className:`group relative flex h-8 items-center rounded-t-md border border-b-0 text-sm transition-colors ${"active-full"===z&&l?"":"@container"} ${"active-full"===z?l?"flex-none min-w-[12rem] max-w-[40rem]":"flex-[0_1_8rem]":l&&(t.copy||C)?"flex-[0_1_20rem]":"flex-[0_1_15rem]"} ${l?"active-full"===z?"":"min-w-[4.25rem]":"min-w-[2.75rem]"} ${s}`,...v,children:[C&&
|
|
11
|
+
/* @__PURE__ */p("button",{type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-label":I.tabMenu,title:I.tabMenu,onClick:e=>{const n=e.currentTarget.getBoundingClientRect();$?.(t.key,n.left,n.bottom+4)},className:`ml-2 flex size-6 shrink-0 items-center justify-center rounded hover:bg-gray-200 @max-[5rem]:ml-2 ${h}`,children:w}),
|
|
12
12
|
/* @__PURE__ */u("button",{...k,className:`flex h-full min-w-0 flex-1 items-center gap-2 rounded-t-md pr-1 text-left ${C?"pl-2":"pl-3"} ${h} ${l?C?"":"@max-[5rem]:pl-3":"@max-[6.5rem]:pr-3 @max-[6.5rem]:group-hover:pr-1 @max-[4.5rem]:justify-center @max-[4.5rem]:px-0 @max-[4.5rem]:group-hover:pl-2"}`,children:[!C&&w,
|
|
13
|
-
/* @__PURE__ */p("span",{className:`min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] ${"active-full"===
|
|
14
|
-
/* @__PURE__ */u("span",{className:"mr-2 flex size-5 shrink-0 items-center justify-center "+(l?"":"@max-[6.5rem]:hidden @max-[6.5rem]:group-hover:flex"),children:[
|
|
15
|
-
/* @__PURE__ */p("button",{type:"button",tabIndex:-1,"aria-label":
|
|
13
|
+
/* @__PURE__ */p("span",{className:`min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] ${"active-full"===z&&l?"pr-4":""} ${o?l?"@max-[5rem]:sr-only":"@max-[4.5rem]:sr-only":""}`,children:t.title})]}),l&&t.actions&&/* @__PURE__ */p(x,{node:t.actions}),l&&t.copy&&/* @__PURE__ */p(b,{text:t.copy,label:I.copy(t.copy),copiedLabel:I.copied}),
|
|
14
|
+
/* @__PURE__ */u("span",{className:"mr-2 flex size-5 shrink-0 items-center justify-center "+(l?"":"@max-[6.5rem]:hidden @max-[6.5rem]:group-hover:flex"),children:[a&&/* @__PURE__ */p("span",{role:"img","aria-label":I.unsaved,className:"size-2 rounded-full bg-gray-500 group-hover:hidden"}),
|
|
15
|
+
/* @__PURE__ */p("button",{type:"button",tabIndex:-1,"aria-label":I.closeTab?.(t.title)??`${I.close} ${t.title}`,onClick:()=>g(t.key),className:"size-5 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 "+(a?"hidden group-hover:flex":l?"flex":"flex opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),children:/* @__PURE__ */p(f,{})})]})]})]},t.key)})}),C&&/* @__PURE__ */p("div",{className:"flex shrink-0 items-center gap-2 self-center",children:C}),D&&K&&/* @__PURE__ */u(t,{portal:!0,style:{left:D.x,top:D.y},onClose:()=>M(null),children:[T.length>0&&/* @__PURE__ */u(y,{children:[T.map((e,n)=>/* @__PURE__ */u(r,{onClick:J(e.onSelect),children:[e.icon,e.label]},n)),
|
|
16
16
|
/* @__PURE__ */p(l,{})]}),
|
|
17
|
-
/* @__PURE__ */p(r,{disabled:
|
|
17
|
+
/* @__PURE__ */p(r,{disabled:K.pinned,onClick:J(()=>g(K.key)),children:I.close}),
|
|
18
18
|
/* @__PURE__ */p(l,{}),
|
|
19
|
-
/* @__PURE__ */p(r,{disabled:!R(e.filter(e=>e.key!==
|
|
20
|
-
/* @__PURE__ */p(r,{disabled:!R(e.slice(
|
|
21
|
-
/* @__PURE__ */p(r,{disabled:!R(e),onClick:
|
|
19
|
+
/* @__PURE__ */p(r,{disabled:!R(e.filter(e=>e.key!==K.key)),onClick:J(()=>k("others",K.key)),children:I.closeOthers}),
|
|
20
|
+
/* @__PURE__ */p(r,{disabled:!R(e.slice(E+1)),onClick:J(()=>k("right",K.key)),children:I.closeRight}),
|
|
21
|
+
/* @__PURE__ */p(r,{disabled:!R(e),onClick:J(()=>k("all",null)),children:I.closeAll})]})]})}export{g as TabStrip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_SHELL_STRINGS as e,useShellStrings as t}from"./chunk-
|
|
1
|
+
import{DEFAULT_SHELL_STRINGS as e,useShellStrings as t}from"./chunk-SB5KBKVJ.js";import{useRef as r,useState as n,useCallback as s}from"react";import{jsx as a}from"react/jsx-runtime";function o(e,t){const r=(t??"").split(",").map(e=>e.trim().toLocaleLowerCase()).filter(Boolean);if(0===r.length||r.includes("*")||r.includes("*/*"))return!0;const n=e.name.toLocaleLowerCase(),s=e.type.toLocaleLowerCase();return r.some(e=>e.startsWith(".")?n.endsWith(e):e.endsWith("/*")?s.startsWith(e.slice(0,-1)):s===e)}var l=(t,r=e.files)=>t<1024?r.bytes(t):t<1048576?r.kilobytes(Math.round(t/1024)):r.megabytes(t/1048576),i=e=>Array.from(e.dataTransfer?.types??[]).includes("Files");function c({onAccept:e,accept:a,maxSizeBytes:c,maxFiles:u,multiple:f=!0,currentCount:p=0,acceptHint:m,disabled:d=!1}){const h=t().files,g=r(null),[y,x]=n(!1),[v,D]=n([]),L=r(0),b="string"==typeof m?m:"",A=s(t=>{if(d||!t)return;const r=Array.from(t);if(0===r.length)return;const n=[],s=[];for(const e of f?r:r.slice(0,1))o(e,a)?null!=c&&e.size>c?s.push({file:e,reason:"size",message:h.tooLarge(e.name,l(e.size,h),l(c,h))}):f&&null!=u&&p+n.length>=u?s.push({file:e,reason:"count",message:h.tooMany(e.name,u)}):n.push(e):s.push({file:e,reason:"type",message:h.notAccepted(e.name,b)});D(s),n.length&&e(n),g.current&&(g.current.value="")},[d,f,a,b,c,u,p,e,h]),j=s(()=>{d||g.current?.click()},[d]),k=s(()=>D([]),[]);return{inputRef:g,inputProps:{ref:g,type:"file",accept:a||void 0,multiple:f,disabled:d,tabIndex:-1,"aria-hidden":!0,className:"hidden",onChange:e=>A(e.target.files)},zoneProps:d?{}:{onDragEnter:e=>{i(e)&&(e.preventDefault(),L.current+=1,x(!0))},onDragOver:e=>{i(e)&&(e.preventDefault(),y||x(!0))},onDragLeave:e=>{i(e)&&(L.current=Math.max(0,L.current-1),0===L.current&&x(!1))},onDrop:e=>{i(e)&&(e.preventDefault(),L.current=0,x(!1),A(e.dataTransfer.files))}},pasteProps:d?{}:{onPaste:e=>{const t=function(e){const t=e.clipboardData;if(!t)return[];if(t.files&&t.files.length>0)return Array.from(t.files);const r=[];for(const e of Array.from(t.items??[]))if("file"===e.kind){const t=e.getAsFile();t&&r.push(t)}return r}(e);0!==t.length&&(e.preventDefault(),A(t))}},open:j,take:A,dragOver:y,rejections:v,clearRejections:k}}function u({rejections:e,className:t="mt-2"}){return 0===e.length?null:/* @__PURE__ */a("ul",{role:"alert",className:`${t} flex flex-col gap-0.5`,children:e.map(({file:e,message:t},r)=>/* @__PURE__ */a("li",{className:"text-xs text-red-600",children:t},`${e.name}-${r}`))})}export{u as FileIntakeAlert,o as acceptsFile,l as humanSize,c as useFileIntake};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import{inputClasses as e}from"./chunk-CU3GY5Y2.js";import{isSafeLinkHref as t}from"./chunk-PJPK2ADX.js";import{
|
|
1
|
+
import{inputClasses as e}from"./chunk-CU3GY5Y2.js";import{isSafeLinkHref as t}from"./chunk-PJPK2ADX.js";import{Icon as r}from"./chunk-76DRQSJM.js";import{useShellStrings as n}from"./chunk-SB5KBKVJ.js";import{SpinnerRing as a}from"./chunk-2J6F4EE7.js";import{forwardRef as s,useCallback as i,useState as l,useId as o}from"react";import{jsx as c,jsxs as d,Fragment as m}from"react/jsx-runtime";var u=s(function({invalid:t,autoGrow:r,className:n="",onInput:a,rows:s=3,size:l,readOnly:o,...d},m){const u=i(e=>{if(r){const t=e.currentTarget;t.style.height="auto",t.style.height=`${t.scrollHeight}px`}a?.(e)},[r,a]);/* @__PURE__ */
|
|
2
2
|
return c("textarea",{ref:m,"aria-invalid":t||void 0,rows:s,onInput:u,readOnly:o,className:e({invalid:t,size:l,readOnly:o,multiline:!0,className:`${r?"resize-none overflow-hidden":""} ${n}`.trim()}),...d})}),h={info:{box:"bg-blue-50 border-blue-200",icon:"text-blue-600"},success:{box:"bg-green-50 border-green-200",icon:"text-green-600"},warning:{box:"bg-amber-50 border-amber-200",icon:"text-amber-600"},danger:{box:"bg-red-50 border-red-200",icon:"text-red-600"},neutral:{box:"bg-[var(--status-neutral-soft)] border-[color:var(--line)]",icon:"text-[color:var(--status-neutral-soft-ink)]"}},p={info:"bg-blue-700 border-blue-700 text-white",success:"bg-green-700 border-green-700 text-white",warning:"bg-amber-700 border-amber-700 text-white",danger:"bg-red-700 border-red-700 text-white",neutral:"bg-[var(--status-neutral-solid)] border-[color:var(--status-neutral-solid)] text-[color:var(--status-on-solid)]"};function g({tone:e}){const t={className:"h-5 w-5","aria-hidden":!0};switch(e){case"success":/* @__PURE__ */
|
|
3
|
-
return c(
|
|
4
|
-
return c(
|
|
5
|
-
return c(
|
|
6
|
-
return c(
|
|
3
|
+
return c(r,{name:"check-circle",look:"mini",...t});case"warning":/* @__PURE__ */
|
|
4
|
+
return c(r,{name:"warning",look:"mini",...t});case"danger":/* @__PURE__ */
|
|
5
|
+
return c(r,{name:"close-circle",look:"mini",...t});default:/* @__PURE__ */
|
|
6
|
+
return c(r,{name:"info",look:"mini",...t})}}function x({tone:e="info",emphasis:t="subtle",title:a,children:s,icon:i,action:l,onDismiss:o,sticky:u=!1,className:x=""}){const b=h[e],f="solid"===t,y=n().banner,v=f?p[e]:b.box,N=u?"sticky top-0 z-30":"",k=/* @__PURE__ */d(m,{children:[a&&/* @__PURE__ */c("div",{className:("font-semibold "+(f?"":"text-gray-900")).trim(),children:a}),s&&/* @__PURE__ */c("div",{className:`${f?"":"text-gray-700"} ${a?"mt-0.5":""}`.trim(),children:s})]});/* @__PURE__ */
|
|
7
7
|
return d("div",{role:"danger"===e?"alert":"status",className:`${N} flex items-start gap-3 rounded-lg border px-4 py-3 ${v} ${x}`.trim(),children:[
|
|
8
8
|
/* @__PURE__ */c("span",{className:`mt-0.5 shrink-0 ${f?"":b.icon}`.trim(),children:i??/* @__PURE__ */c(g,{tone:e})}),null==l?/* @__PURE__ */c("div",{className:"min-w-0 flex-1 text-sm",children:k}):
|
|
9
9
|
/* @__PURE__ */d("div",{className:"flex min-w-0 flex-1 flex-wrap items-start gap-x-3 gap-y-2",children:[
|
|
10
10
|
/* @__PURE__ */c("div",{className:"min-w-0 grow basis-48 text-sm",children:k}),
|
|
11
|
-
/* @__PURE__ */c("div",{className:"shrink-0 self-center",children:l})]}),o&&/* @__PURE__ */c("button",{type:"button",onClick:o,"aria-label":y.dismiss,className:"shrink-0 "+(f?"opacity-80 hover:opacity-100":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */c(
|
|
11
|
+
/* @__PURE__ */c("div",{className:"shrink-0 self-center",children:l})]}),o&&/* @__PURE__ */c("button",{type:"button",onClick:o,"aria-label":y.dismiss,className:"shrink-0 "+(f?"opacity-80 hover:opacity-100":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */c(r,{name:"close",className:"h-4 w-4",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})}function b({summary:e,busy:t=!1,open:n,onOpenChange:a,label:s="Steps",className:i="",children:m}){const[u,h]=l(null),p=o(),g=n??u??t;/* @__PURE__ */
|
|
12
12
|
return d("div",{className:`text-xs text-gray-500 ${i}`.trim(),children:[
|
|
13
|
-
/* @__PURE__ */d("button",{type:"button",onClick:()=>{h(!g),
|
|
14
|
-
/* @__PURE__ */c(
|
|
13
|
+
/* @__PURE__ */d("button",{type:"button",onClick:()=>{h(!g),a?.(!g)},"aria-expanded":g,"aria-controls":g?p:void 0,className:"flex w-full items-center gap-2 rounded text-left hover:text-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-600",children:[
|
|
14
|
+
/* @__PURE__ */c(r,{name:"chevron-right",size:12,className:"shrink-0 motion-safe:transition-transform "+(g?"rotate-90":"")}),
|
|
15
15
|
/* @__PURE__ */c("span",{"aria-live":"polite",className:"min-w-0 flex-1 truncate",children:e})]}),g&&/* @__PURE__ */c("ol",{id:p,"aria-label":s,className:"mt-2 ml-2 space-y-2 border-l border-gray-200 pl-3",children:m})]})}var f={pending:"text-gray-400",active:"text-gray-800",complete:"text-gray-600",failed:"text-red-600",stopped:"text-gray-500",waiting:"text-amber-700",skipped:"text-gray-400"},y={pending:"Pending",active:"In progress",complete:"Done",failed:"Failed",stopped:"Stopped",waiting:"Waiting for you",skipped:"Skipped"};function v({status:e}){switch(e){case"active":/* @__PURE__ */
|
|
16
|
-
return c(
|
|
17
|
-
return c(
|
|
18
|
-
return c(
|
|
19
|
-
return c(
|
|
20
|
-
return c(
|
|
21
|
-
return c(
|
|
16
|
+
return c(a,{className:"size-3 motion-reduce:animate-none"});case"complete":/* @__PURE__ */
|
|
17
|
+
return c(r,{name:"check-circle",size:14,tone:"success"});case"failed":/* @__PURE__ */
|
|
18
|
+
return c(r,{name:"close-circle",size:14,tone:"danger"});case"stopped":/* @__PURE__ */
|
|
19
|
+
return c(r,{name:"no-symbol",size:14,tone:"muted"});case"waiting":/* @__PURE__ */
|
|
20
|
+
return c(r,{name:"pause",size:14,tone:"warning"});case"skipped":/* @__PURE__ */
|
|
21
|
+
return c(r,{name:"remove",size:14,tone:"muted"});default:/* @__PURE__ */
|
|
22
22
|
return c("span",{className:"block size-3 rounded-full border border-gray-300"})}}function N({label:e,description:t,status:r="complete",statusWord:n,icon:a,children:s}){/* @__PURE__ */
|
|
23
23
|
return d("li",{className:`flex items-start gap-2 ${f[r]}`,"data-status":r,children:[
|
|
24
24
|
/* @__PURE__ */c("span",{"aria-hidden":"true",className:"mt-1 flex size-3.5 shrink-0 items-center justify-center",children:a??/* @__PURE__ */c(v,{status:r})}),
|
|
@@ -28,11 +28,11 @@ return d("li",{className:`flex items-start gap-2 ${f[r]}`,"data-status":r,childr
|
|
|
28
28
|
/* @__PURE__ */d("span",{className:"text-gray-400",children:["[",r[1],"]"]},a++)):void 0!==r[3]?t.push(
|
|
29
29
|
/* @__PURE__ */c("a",{href:w(r[4])?r[4]:void 0,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:r[3]},a++)):void 0!==r[5]?t.push(
|
|
30
30
|
/* @__PURE__ */c("strong",{className:"font-semibold text-gray-900",children:r[5]},a++)):void 0!==r[6]?t.push(
|
|
31
|
-
/* @__PURE__ */c("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",children:r[6]},a++)):void 0!==r[7]&&t.push(/* @__PURE__ */c("em",{children:r[7]},a++)),n=k.lastIndex;return n<e.length&&t.push(e.slice(n)),t}function z({alt:e}){const t=e.replace(/^screenshot:\s*/i,""),n
|
|
31
|
+
/* @__PURE__ */c("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",children:r[6]},a++)):void 0!==r[7]&&t.push(/* @__PURE__ */c("em",{children:r[7]},a++)),n=k.lastIndex;return n<e.length&&t.push(e.slice(n)),t}function z({alt:e}){const t=e.replace(/^screenshot:\s*/i,""),a=n().markdown;/* @__PURE__ */
|
|
32
32
|
return d("div",{className:"my-1 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-3 text-gray-500",children:[
|
|
33
|
-
/* @__PURE__ */c(
|
|
33
|
+
/* @__PURE__ */c(r,{name:"camera",look:"mini",className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),
|
|
34
34
|
/* @__PURE__ */d("span",{className:"text-xs",children:[
|
|
35
|
-
/* @__PURE__ */c("span",{className:"font-medium text-gray-600",children:`${
|
|
35
|
+
/* @__PURE__ */c("span",{className:"font-medium text-gray-600",children:`${a.screenshot} — `}),t]})]})}function j(e,t){const r=[];for(const n of e){const e=t.exec(n);e?r.push(e[1]):r.length&&(r[r.length-1]+=" "+n.trim())}return r}var I=e=>e.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(e=>e.trim());function S(e,t){const r=e.split("\n"),n=r[0],a=/^(#{2,4})\s+(.*)$/.exec(n);if(a&&1===r.length){const e=a[1].length;/* @__PURE__ */
|
|
36
36
|
return c(`h${e}`,{className:2===e?"mt-2 text-sm font-semibold uppercase tracking-wide text-gray-500":3===e?"mt-1 text-base font-semibold text-gray-900":"mt-1 text-sm font-semibold text-gray-900",children:$(a[2])},t)}if(1===r.length&&/^---+$/.test(n))/* @__PURE__ */
|
|
37
37
|
return c("hr",{className:"border-gray-200"},t);if(function(e){return e.length>=2&&e[0].includes("|")&&/^\s*\|?[\s:|-]*-[\s:|-]*\|?\s*$/.test(e[1])&&e[1].includes("-")}(r))return function(e,t){const r=I(e[0]),n=e.slice(2).map(I);/* @__PURE__ */
|
|
38
38
|
return c("div",{className:"my-1 overflow-x-auto rounded-lg border border-gray-200",children:/* @__PURE__ */d("table",{className:"w-full border-collapse text-sm",children:[
|
|
@@ -42,6 +42,6 @@ return c("div",{className:"my-1 rounded-r-lg border-l-4 border-blue-300 bg-blue-
|
|
|
42
42
|
return c(z,{alt:s[1]},t);if(/^[-*]\s+/.test(n)){const e=j(r,/^[-*]\s+(.*)$/);/* @__PURE__ */
|
|
43
43
|
return c("ul",{className:"list-disc space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */c("li",{children:$(e)},t))},t)}const i=/^(\d+)\.\s+/.exec(n);if(i){const e=j(r,/^\d+\.\s+(.*)$/);/* @__PURE__ */
|
|
44
44
|
return c("ol",{start:Number(i[1]),className:"list-decimal space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */c("li",{className:"pl-1",children:$(e)},t))},t)}/* @__PURE__ */
|
|
45
|
-
return c("p",{children:$(r.join(" "))},t)}var
|
|
46
|
-
return c("div",{className:`space-y-3 text-sm leading-relaxed text-gray-700 ${t??""}`.trim(),children:
|
|
47
|
-
return c("pre",{"data-language":e||void 0,className:"my-1 overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 p-3 font-mono text-xs text-gray-800",children:/* @__PURE__ */c("code",{children:t})},r)}(e.fence,t):
|
|
45
|
+
return c("p",{children:$(r.join(" "))},t)}var C=/^( {0,3})(`{3,}|~{3,})[ \t]*(.*?)[ \t]*$/;function D(e){const t=e.replace(/\r\n/g,"\n").split("\n"),r=[];let n=[];const a=()=>{for(const e of n.join("\n").split(/\n{2,}/)){const t=e.replace(/\s+$/,"");""!==t.trim()&&r.push({text:t})}n=[]};for(let e=0;e<t.length;e+=1){const s=C.exec(t[e]);if(!(null!==s&&!("`"===s[2][0]&&s[3].includes("`")))){n.push(t[e]);continue}a();const[,i,l,o]=s,c=[];for(e+=1;e<t.length;e+=1){const r=C.exec(t[e]);if(null!==r&&r[2][0]===l[0]&&r[2].length>=l.length&&""===r[3])break;c.push(i?t[e].replace(new RegExp(`^ {0,${i.length}}`),""):t[e])}r.push({fence:{lang:o.split(/[ \t]/)[0],code:c.join("\n")}})}return a(),r}function J({children:e,className:t}){/* @__PURE__ */
|
|
46
|
+
return c("div",{className:`space-y-3 text-sm leading-relaxed text-gray-700 ${t??""}`.trim(),children:D(e??"").map((e,t)=>"fence"in e?function({lang:e,code:t},r){/* @__PURE__ */
|
|
47
|
+
return c("pre",{"data-language":e||void 0,className:"my-1 overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 p-3 font-mono text-xs text-gray-800",children:/* @__PURE__ */c("code",{children:t})},r)}(e.fence,t):S(e.text,t))})}export{x as Banner,J as Markdown,b as StepChain,N as StepChainItem,u as Textarea_default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useShellAuth as e}from"./chunk-HWH4UHIU.js";var t={};function r(e){t=e}function n(){const{hasAnyPerm:r}=e();return{user:t.user,logout:t.logout??(()=>{}),hasAnyPerm:r}}var o="react-os-shell:sidebar-collapsed",s="react-os-shell:sidebar-open-sections",a="react-os-shell:sidebar-width";function c(e,t){return"true"===e||"false"!==e&&t<1024}function u(e){if(!e)/* @__PURE__ */return new Set;try{const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e))return new Set(t)}catch{}/* @__PURE__ */
|
|
2
|
+
return new Set}function l(e,t){const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}function i(e){try{return localStorage.getItem(e)}catch{return null}}function f(e,t){try{localStorage.setItem(e,t)}catch{}}export{o as RAIL_COLLAPSED_KEY,s as RAIL_OPEN_SECTIONS_KEY,a as RAIL_WIDTH_KEY,c as initialRailCollapsed,u as parseOpenSections,i as readStored,r as setShellAuthBridge,l as toggleOpenSection,n as useAuth,f as writeStored};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{useInsideTooltip as t,Tooltip as e}from"./chunk-RDLWLATO.js";import{useHydrated as r,useBrowserState as n}from"./chunk-D65T4H6J.js";import{
|
|
2
|
-
return m(A.Provider,{value:t,children:/* @__PURE__ */m(
|
|
3
|
-
return m("span",{className:`${
|
|
4
|
-
return m(
|
|
5
|
-
return m(
|
|
6
|
-
return m(
|
|
7
|
-
return m(
|
|
1
|
+
import{useInsideTooltip as t,Tooltip as e}from"./chunk-RDLWLATO.js";import{useHydrated as r,useBrowserState as n}from"./chunk-D65T4H6J.js";import{Icon as o}from"./chunk-76DRQSJM.js";import{useShellStrings as s}from"./chunk-SB5KBKVJ.js";import{createContext as a,useSyncExternalStore as i,useRef as l,useState as c,useContext as u,useCallback as d,useMemo as f}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";var v="(max-width: 767px), (pointer: coarse)",g="(max-width: 767px)";function p(t){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(t).matches}var w=()=>p(v),x=()=>p(g);function b(){return!1}var y=t=>_(v,t),C=t=>_(g,t);function _(t,e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const r=window.matchMedia(t);return r.addEventListener?(r.addEventListener("change",e),()=>r.removeEventListener("change",e)):(r.addListener(e),()=>r.removeListener(e))}function k(){return i(y,w,b)}function N(){return i(C,x,b)}var S="whitespace-nowrap";function D({children:r}){const n=t(),o=l(null),[s,a]=c(!1),i=/* @__PURE__ */m("span",{ref:o,className:"min-w-0 truncate",onMouseEnter:()=>{const t=o.current;a(!!t&&t.scrollWidth>t.clientWidth+1)},children:r});return n?i:/* @__PURE__ */m(e,{content:s?r:null,describe:!1,className:"relative inline-flex min-w-0 max-w-full",children:i})}var L="inline-flex max-w-full items-center whitespace-nowrap rounded-full",E={success:"bg-[var(--status-success-soft)] text-[color:var(--status-success-soft-ink)]",active:"bg-[var(--status-active-soft)] text-[color:var(--status-active-soft-ink)]",queued:"bg-[var(--status-queued-soft)] text-[color:var(--status-queued-soft-ink)]",info:"bg-[var(--status-info-soft)] text-[color:var(--status-info-soft-ink)]",pending:"bg-[var(--status-pending-soft)] text-[color:var(--status-pending-soft-ink)]",warning:"bg-[var(--status-warning-soft)] text-[color:var(--status-warning-soft-ink)]",danger:"bg-[var(--status-danger-soft)] text-[color:var(--status-danger-soft-ink)]",draft:"bg-[var(--status-draft-soft)] text-[color:var(--status-draft-soft-ink)]",neutral:"bg-[var(--status-neutral-soft)] text-[color:var(--status-neutral-soft-ink)]"},M={success:"bg-[var(--status-success-solid)] text-[color:var(--status-on-solid)]",active:"bg-[var(--status-active-solid)] text-[color:var(--status-on-solid)]",queued:"bg-[var(--status-queued-solid)] text-[color:var(--status-on-solid)]",info:"bg-[var(--status-info-solid)] text-[color:var(--status-on-solid)]",pending:"bg-[var(--status-pending-solid)] text-[color:var(--status-on-solid)]",warning:"bg-[var(--status-warning-solid)] text-[color:var(--status-on-solid)]",danger:"bg-[var(--status-danger-solid)] text-[color:var(--status-on-solid)]",draft:"bg-[var(--status-draft-solid)] text-[color:var(--status-on-solid)]",neutral:"bg-[var(--status-neutral-solid)] text-[color:var(--status-on-solid)]"};function T(t,e="subtle"){return"solid"===e?M[t]:E[t]}var A=a({}),j=a(void 0);function I(t){return t.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function F({groups:t,labelFor:e,children:r}){/* @__PURE__ */
|
|
2
|
+
return m(A.Provider,{value:t,children:/* @__PURE__ */m(j.Provider,{value:e,children:r})})}function H(){const t=u(j);return d(e=>t?.(e)??I(e),[t])}function P({status:t,label:e,emphasis:r="subtle"}){const n=T(u(A)[t]??"neutral",r),o=u(j),s=e??o?.(t)??I(t);/* @__PURE__ */
|
|
3
|
+
return m("span",{className:`${L} px-3 py-0.5 text-xs font-medium ${n}`,children:/* @__PURE__ */m(D,{children:s})})}var O={success:"success",error:"error",warning:"warning",info:"info",404:"info",403:"warning",500:"error"},Z={success:"text-green-600 bg-green-100",error:"text-red-600 bg-red-100",warning:"text-amber-600 bg-amber-100",info:"text-blue-600 bg-blue-100"},z={404:t=>t.notFound,403:t=>t.noAccess,500:t=>t.serverError};function K({tone:t}){const e={className:"h-6 w-6",strokeWidth:1.5,"aria-hidden":!0};switch(t){case"success":/* @__PURE__ */
|
|
4
|
+
return m(o,{name:"check",...e});case"error":/* @__PURE__ */
|
|
5
|
+
return m(o,{name:"close",...e});case"warning":/* @__PURE__ */
|
|
6
|
+
return m(o,{name:"error",...e});default:/* @__PURE__ */
|
|
7
|
+
return m(o,{name:"info",...e})}}function R({status:t="info",title:e,subTitle:r,extra:n,icon:o,children:a,className:i=""}){const l=O[t],c=s().errors;/* @__PURE__ */
|
|
8
8
|
return h("div",{role:"error"===l?"alert":void 0,className:`flex flex-col items-center justify-center px-6 py-12 text-center ${i}`.trim(),children:[
|
|
9
|
-
/* @__PURE__ */m("div",{className:`flex h-14 w-14 items-center justify-center rounded-full ${Z[l]}`,children:
|
|
10
|
-
/* @__PURE__ */m("h2",{className:"mt-4 text-lg font-semibold text-gray-900",children:e??z[t]?.(c)??""}),r&&/* @__PURE__ */m("p",{className:"mt-1 max-w-md text-sm text-gray-500",children:r}),a&&/* @__PURE__ */m("div",{className:"mt-4 w-full max-w-md text-left",children:a}),n&&/* @__PURE__ */m("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:n})]})}function
|
|
11
|
-
return h("span",{className:[
|
|
12
|
-
/* @__PURE__ */m(D,{children:r}),i&&/* @__PURE__ */m("button",{type:"button",onClick:l,"aria-label":p,className:"-mr-0.5 ml-1 inline-flex shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",children:/* @__PURE__ */m(
|
|
9
|
+
/* @__PURE__ */m("div",{className:`flex h-14 w-14 items-center justify-center rounded-full ${Z[l]}`,children:o??/* @__PURE__ */m(K,{tone:l})}),
|
|
10
|
+
/* @__PURE__ */m("h2",{className:"mt-4 text-lg font-semibold text-gray-900",children:e??z[t]?.(c)??""}),r&&/* @__PURE__ */m("p",{className:"mt-1 max-w-md text-sm text-gray-500",children:r}),a&&/* @__PURE__ */m("div",{className:"mt-4 w-full max-w-md text-left",children:a}),n&&/* @__PURE__ */m("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:n})]})}function q({colorClass:t,tone:e,children:r,size:n="sm",capitalize:a=!1,closable:i=!1,onClose:l,closeLabel:c,className:u=""}){const d=t??E[e??"neutral"],f="xs"===n?"px-2 py-0.5 text-3xs":"md"===n?"px-3 py-0.5 text-xs":"px-2 py-0.5 text-xs",v=a?"capitalize":"",g=s().badge,p=c??("string"==typeof r?g.removeItem(r):g.remove),w="xs"===n?"h-2.5 w-2.5":"h-3 w-3";/* @__PURE__ */
|
|
11
|
+
return h("span",{className:[L,"font-medium",f,v,d,u].filter(Boolean).join(" "),children:[
|
|
12
|
+
/* @__PURE__ */m(D,{children:r}),i&&/* @__PURE__ */m("button",{type:"button",onClick:l,"aria-label":p,className:"-mr-0.5 ml-1 inline-flex shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",children:/* @__PURE__ */m(o,{name:"close",look:"mini",className:w,"aria-hidden":"true"})})]})}var J="undefined"!=typeof window&&"undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),W={MOD:["⌘","Ctrl"],ALT:["⌥","Alt"],CMD_ENTER:["⌘⏎","Ctrl⏎"],CMD_S:["⌘S","Ctrl+S"],CMD_K:["⌘K","Ctrl+K"],CMD_DOT:["⌘.","Ctrl+."],CMD_A:["⌘A","Ctrl+A"],CMD_Z:["⌘Z","Ctrl+Z"],CMD_SHIFT_Z:["⌘⇧Z","Ctrl+Shift+Z"],ALT_SHIFT_D:["⌥⇧D","Alt+Shift+D"],ALT_SHIFT_E:["⌥⇧E","Alt+Shift+E"],ALT_SHIFT_N:["⌥⇧N","Alt+Shift+N"]},B=J?0:1,U=W.MOD[B],$=W.ALT[B],Q="⇧",V="⏎",G=W.CMD_ENTER[B],X=W.CMD_S[B],Y=W.CMD_K[B],tt=W.CMD_DOT[B],et=W.CMD_A[B],rt=W.CMD_Z[B],nt=W.CMD_SHIFT_Z[B],ot=W.ALT_SHIFT_D[B],st=W.ALT_SHIFT_E[B],at=W.ALT_SHIFT_N[B],it=new Map(J?Object.values(W).map(([t,e])=>[t,e]):[]);function lt(t){return r()?t:it.get(t)??t}var ct={neutral:"inline-flex items-center justify-center rounded border border-gray-200 bg-gray-50 font-medium text-gray-500",accent:"inline-flex items-center justify-center rounded border kbd-submit font-medium",warning:"inline-flex items-center justify-center rounded border border-amber-300 bg-amber-100 font-medium"},ut={sm:"px-1 py-0.5 text-2xs",md:"px-2 py-0.5 text-2xs"};function dt({keys:t,size:e="md",tone:r="neutral",className:n=""}){const o=lt(t);/* @__PURE__ */
|
|
13
13
|
return m("kbd",{className:[ct[r],ut[e],n].filter(Boolean).join(" "),children:o})}var ft=a(null);function mt({value:t,children:e}){/* @__PURE__ */
|
|
14
|
-
return m(ft.Provider,{value:t,children:e})}function ht(t="react-os-shell:prefs",e){const[r,o]=n(()=>{try{const r=JSON.parse(localStorage.getItem(t)||"{}");return{...e??{},...r}}catch{return{...e??{}}}},{...e??{}});return{prefs:r,save:d(e=>{o(r=>{const n={...r,...e};try{localStorage.setItem(t,JSON.stringify(n))}catch{}return n})},[t])}}var vt={prefs:{},save:()=>{}};function gt(){return u(ft)??vt}function pt(){const{prefs:t,save:e}=gt(),r=d(t=>{const r=e(t);return r&&"function"==typeof r.then?r.catch(()=>{}):r},[e]);return f(()=>({prefs:t,save:r}),[t,r])}var wt="react-os-shell:stale-chunk-reload-at",xt=3e4,bt="vite:preloadError",yt="/_next/static/",Ct=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed|Unable to preload CSS/i;function _t(t){if(t instanceof Error&&"ChunkLoadError"===t.name)return!0;const e=t instanceof Error?t.message:"string"==typeof t?t:"";return Ct.test(e)}function kt(t={}){if("undefined"==typeof window)return()=>{};const e=t.cooldownMs??3e4,r=t.reload??(()=>window.location.reload()),n=t.now??Date.now,o=void 0===t.storage?function(){try{const t=window.sessionStorage;return t.getItem(wt),t}catch{return null}}():t.storage,s=void 0===t.chunkPathPrefix?yt:t.chunkPathPrefix,a=t=>{const r=n(),s=function(t){if(!t)return null;try{const e=t.getItem(wt),r=null===e?NaN:Number(e);return Number.isFinite(r)?r:null}catch{return null}}(o);return null!==s&&r-s<e?(console.error("[efficient-shell] a lazy chunk is still missing after a reload; letting the failure through:",t),!1):(function(t,e){if(t)try{t.setItem(wt,String(e))}catch{}}(o,r),console.warn("[efficient-shell] a lazy chunk is no longer on the server (new deploy?); reloading onto the current build:",t),!0)},i=t=>{const e=t.payload;_t(e)&&a(e)&&(t.preventDefault(),r())};let l=!0,c=!1;const u=/* @__PURE__ */new Set,d=null===s?null:t=>{const e=function(t,e){const r=t.target;let n="";if(r instanceof window.HTMLScriptElement?n=r.src:r instanceof window.HTMLLinkElement&&function(t){const e=t.rel.toLowerCase().split(/\s+/);if(e.includes("stylesheet")||e.includes("modulepreload"))return!0;const r=(t.getAttribute("as")??"").toLowerCase();return e.includes("preload")&&("script"===r||"style"===r)}(r)?n=r.href:t instanceof window.ErrorEvent&&"SyntaxError"===t.error?.name&&(n=t.filename),!n)return null;try{const t=new URL(e,window.location.origin).href,r=new URL(n,window.location.href).href;return r.startsWith(t)?r:null}catch{return null}}(t,s);!e||c||u.has(e)||(u.add(e),async function(t){try{const e=await fetch(t,{method:"HEAD",cache:"no-store"});return 404===e.status||410===e.status||e.ok&&/\btext\/html\b/i.test(e.headers.get("content-type")??"")}catch{return!1}}(e).then(t=>{u.delete(e),t&&l&&!c&&a(e)&&(c=!0,r())}))};return window.addEventListener(bt,i),d&&window.addEventListener("error",d,!0),()=>{l=!1,window.removeEventListener(bt,i),d&&window.removeEventListener("error",d,!0)}}export{
|
|
14
|
+
return m(ft.Provider,{value:t,children:e})}function ht(t="react-os-shell:prefs",e){const[r,o]=n(()=>{try{const r=JSON.parse(localStorage.getItem(t)||"{}");return{...e??{},...r}}catch{return{...e??{}}}},{...e??{}});return{prefs:r,save:d(e=>{o(r=>{const n={...r,...e};try{localStorage.setItem(t,JSON.stringify(n))}catch{}return n})},[t])}}var vt={prefs:{},save:()=>{}};function gt(){return u(ft)??vt}function pt(){const{prefs:t,save:e}=gt(),r=d(t=>{const r=e(t);return r&&"function"==typeof r.then?r.catch(()=>{}):r},[e]);return f(()=>({prefs:t,save:r}),[t,r])}var wt="react-os-shell:stale-chunk-reload-at",xt=3e4,bt="vite:preloadError",yt="/_next/static/",Ct=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed|Unable to preload CSS/i;function _t(t){if(t instanceof Error&&"ChunkLoadError"===t.name)return!0;const e=t instanceof Error?t.message:"string"==typeof t?t:"";return Ct.test(e)}function kt(t={}){if("undefined"==typeof window)return()=>{};const e=t.cooldownMs??3e4,r=t.reload??(()=>window.location.reload()),n=t.now??Date.now,o=void 0===t.storage?function(){try{const t=window.sessionStorage;return t.getItem(wt),t}catch{return null}}():t.storage,s=void 0===t.chunkPathPrefix?yt:t.chunkPathPrefix,a=t=>{const r=n(),s=function(t){if(!t)return null;try{const e=t.getItem(wt),r=null===e?NaN:Number(e);return Number.isFinite(r)?r:null}catch{return null}}(o);return null!==s&&r-s<e?(console.error("[efficient-shell] a lazy chunk is still missing after a reload; letting the failure through:",t),!1):(function(t,e){if(t)try{t.setItem(wt,String(e))}catch{}}(o,r),console.warn("[efficient-shell] a lazy chunk is no longer on the server (new deploy?); reloading onto the current build:",t),!0)},i=t=>{const e=t.payload;_t(e)&&a(e)&&(t.preventDefault(),r())};let l=!0,c=!1;const u=/* @__PURE__ */new Set,d=null===s?null:t=>{const e=function(t,e){const r=t.target;let n="";if(r instanceof window.HTMLScriptElement?n=r.src:r instanceof window.HTMLLinkElement&&function(t){const e=t.rel.toLowerCase().split(/\s+/);if(e.includes("stylesheet")||e.includes("modulepreload"))return!0;const r=(t.getAttribute("as")??"").toLowerCase();return e.includes("preload")&&("script"===r||"style"===r)}(r)?n=r.href:t instanceof window.ErrorEvent&&"SyntaxError"===t.error?.name&&(n=t.filename),!n)return null;try{const t=new URL(e,window.location.origin).href,r=new URL(n,window.location.href).href;return r.startsWith(t)?r:null}catch{return null}}(t,s);!e||c||u.has(e)||(u.add(e),async function(t){try{const e=await fetch(t,{method:"HEAD",cache:"no-store"});return 404===e.status||410===e.status||e.ok&&/\btext\/html\b/i.test(e.headers.get("content-type")??"")}catch{return!1}}(e).then(t=>{u.delete(e),t&&l&&!c&&a(e)&&(c=!0,r())}))};return window.addEventListener(bt,i),d&&window.addEventListener("error",d,!0),()=>{l=!1,window.removeEventListener(bt,i),d&&window.removeEventListener("error",d,!0)}}export{$ as ALT,ot as ALT_SHIFT_D,st as ALT_SHIFT_E,at as ALT_SHIFT_N,et as CMD_A,tt as CMD_DOT,G as CMD_ENTER,Y as CMD_K,X as CMD_S,nt as CMD_SHIFT_Z,rt as CMD_Z,q as ColoredBadge,V as ENTER,E as GROUP_COLORS,M as GROUP_COLORS_SOLID,dt as Kbd,U as MOD,yt as NEXT_CHUNK_PATH_PREFIX,D as OneLineLabel,R as Result,Q as SHIFT,xt as STALE_CHUNK_RELOAD_COOLDOWN_MS,wt as STALE_CHUNK_RELOAD_KEY,mt as ShellPrefsProvider,P as StatusBadge,F as StatusBadgeProvider,S as TH_ONE_LINE,bt as VITE_PRELOAD_ERROR_EVENT,T as groupColors,kt as installStaleChunkReload,J as isMac,_t as isStaleChunkError,k as useIsMobile,N as useIsPhone,ht as useLocalStoragePrefs,pt as useShellPrefs,gt as useShellPrefsAdapter,lt as useShortcutLabel,H as useStatusLabel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Modal as e}from"./chunk-
|
|
1
|
+
import{Modal as e}from"./chunk-DI5PZENO.js";import{keepsNativeMenu as a}from"./chunk-YJIG2KT3.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"}),
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{useDismissPopupsOnOpen as e}from"./chunk-UVBK6YSR.js";import{registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-FIEA5CGB.js";import{buttonClasses as r}from"./chunk-K7PQXJO7.js";import{
|
|
1
|
+
import{useDismissPopupsOnOpen as e}from"./chunk-UVBK6YSR.js";import{registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-FIEA5CGB.js";import{buttonClasses as r}from"./chunk-K7PQXJO7.js";import{Icon as l}from"./chunk-76DRQSJM.js";import{useShellStrings as o,splitAround as i}from"./chunk-SB5KBKVJ.js";import{createContext as a,useEffect as s,useRef as c,useId as d,useContext as u,useState as m,useCallback as f}from"react";import{jsxs as h,jsx as b,Fragment as g}from"react/jsx-runtime";var v=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function p(e){return Array.from(e.querySelectorAll(v)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var y=[];function x(e){const t=y.findIndex(t=>t!==e&&e.contains(t));-1===t?y.push(e):y.splice(t,0,e)}function w(e){const t=y.lastIndexOf(e);-1!==t&&y.splice(t,1)}var N=/* @__PURE__ */new WeakSet;function k(e){return p(e)}function C(e,t){s(()=>{if(!t)return;const n=e.current;return n?(N.add(n),x(n),()=>{w(n),N.delete(n)}):void 0},[e,t])}function E(e,t){const n=y.lastIndexOf(t),r=n>0?y[n-1]:-1===n?y[y.length-1]??null:null,l=p(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),o=l.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return o||(r&&!N.has(r)?l[0]??null:null)}function L(e,t,n){s(()=>{if(!t)return;const r=e.current;if(!r)return;const l=document.activeElement,o=n?.current??p(r)[0]??r;o!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),o.focus();const i=e=>{if("Tab"!==e.key)return;if(y[y.length-1]!==r)return;const t=p(r);if(0===t.length)return void e.preventDefault();const n=t[0],l=t[t.length-1],o=document.activeElement;!e.shiftKey||o!==n&&r.contains(o)?e.shiftKey||o!==l&&r.contains(o)||(e.preventDefault(),n.focus()):(e.preventDefault(),l.focus())};return x(r),document.addEventListener("keydown",i,!0),()=>{w(r),document.removeEventListener("keydown",i,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&l?.focus?.()}},[e,t,n])}var P=0,j=null;function I(e){s(()=>{if(!e)return;const t=document.body;if(0===P){j={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 P+=1,()=>{0===(P-=1)&&j&&(t.style.overflow=j.overflow,t.style.paddingRight=j.paddingRight,j=null)}},[e])}function D({role:e="dialog",modal:t,titleId:n,labelledBy:r,label:l}){const o=n??r;return{role:e,"aria-modal":!!t||void 0,"aria-labelledby":o,"aria-label":o?void 0:l}}var F={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function K({open:r,onClose:i,title:a,description:u,role:m="dialog",children:f,footer:g,blocking:v=!1,size:p="md",initialFocus:y,"aria-label":x,"aria-labelledby":w,"aria-describedby":N,className:k=""}){const C=c(null),E=d(),P=d(),j=!v&&!g,K=d(),O=o().dialog;return e(r),L(C,r,y),I(r),s(()=>{if(r)return t(()=>(v||i(),!0),()=>C.current)},[r,v,i]),r?/* @__PURE__ */h("div",{className:"fixed inset-0",style:{zIndex:n.overlay},role:"presentation",children:[
|
|
2
2
|
/* @__PURE__ */b("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
|
|
3
|
-
/* @__PURE__ */b("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:v?void 0:e=>{e.target===e.currentTarget&&
|
|
4
|
-
return b(
|
|
5
|
-
return b(
|
|
6
|
-
return h(
|
|
7
|
-
/* @__PURE__ */b(
|
|
8
|
-
/* @__PURE__ */b("button",{ref:x,type:"button",onClick:()=>
|
|
9
|
-
/* @__PURE__ */b("button",{type:"button",onClick:()=>
|
|
10
|
-
/* @__PURE__ */b("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */b(
|
|
3
|
+
/* @__PURE__ */b("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:v?void 0:e=>{e.target===e.currentTarget&&i()},children:/* @__PURE__ */h("div",{ref:C,...D({role:m,modal:!0,titleId:a?K:void 0,labelledBy:w,label:x}),"aria-describedby":N??(u?P:f?E:void 0),className:`relative max-h-full w-full ${F[p]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl ${k}`.trim(),children:[a&&/* @__PURE__ */b("h2",{id:K,className:(j?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:a}),u&&/* @__PURE__ */b("p",{id:P,className:((a?"mt-1":j?"pr-8":"")+" text-sm text-gray-500").trim(),children:u}),f&&/* @__PURE__ */b("div",{id:E,className:"mt-2 text-sm text-gray-600",children:f}),g&&/* @__PURE__ */b("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:g}),j&&/* @__PURE__ */b("button",{type:"button",onClick:i,"aria-label":O.close,className:"absolute right-3 top-3 rounded-(--radius-control) 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__ */b(l,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})})]}):null}var O=a(()=>Promise.resolve(!1)),T=()=>u(O),W=()=>Promise.resolve(!1),R=e=>W(e),$=()=>Promise.resolve(!1),B=e=>$(e),S=()=>Promise.resolve(null),A=e=>S(e),J={danger:{icon:"text-red-600 bg-red-100",button:r({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:r({variant:"warning"})},info:{icon:"text-blue-600 bg-blue-100",button:r({variant:"primary"})}},V=r({variant:"secondary"}),z=r({variant:"primary"}),G="w-full rounded-md border border-gray-300 h-8 px-3 text-sm";function M(){/* @__PURE__ */
|
|
4
|
+
return b(l,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function Q(){/* @__PURE__ */
|
|
5
|
+
return b(l,{name:"close",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function U({children:e}){const[t,n]=m(!1),[r,l]=m({message:""}),[a,d]=m(0),u=c(),v=c(null),p=c(0),y=c([]),x=c(null),w=c(null),N=f(e=>{v.current=e.id,u.current=e.resolve,d(e.id),l(e.options),n(!0)},[]),k=f(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++p.current,options:t,resolve:e};null===v.current?N(n):y.current.push(n)})},[N]),[C,E]=m(!1),[L,P]=m({message:""}),[j,I]=m(""),D=c(),F=f(e=>(P(e),I(""),E(!0),new Promise(e=>{D.current=e})),[]),[T,R]=m(!1),[B,A]=m({}),[U,_]=m(""),q=c(),X=f(e=>{const t="string"==typeof e?{message:e}:e;return A(t),_(t.defaultValue??""),R(!0),new Promise(e=>{q.current=e})},[]);s(()=>{W=k,$=F,S=X},[k,F,X]);const Y=(e,t)=>{if(v.current!==e)return;const r=u.current,l=y.current.shift();l?N(l):(v.current=null,u.current=void 0,n(!1)),r?.(t)},H=e=>{E(!1),I(""),D.current?.(e)},Z=e=>{if(e){const e=U.trim();if(!e&&!B.allowEmpty)return R(!1),void q.current?.(null);R(!1),q.current?.(e)}else R(!1),q.current?.(null)},ee=r.variant||(r.confirmLabel?.toLowerCase().includes("delete")||r.message.toLowerCase().includes("delete")?"danger":"info"),te=J[ee],ne=J["warning"===L.variant?"warning":"danger"],re=L.confirmWord,le=null==re||j===re,oe=o().dialog,[ie,ae]=i(oe.typeToConfirm);/* @__PURE__ */
|
|
6
|
+
return h(O.Provider,{value:k,children:[e,
|
|
7
|
+
/* @__PURE__ */b(K,{open:t,onClose:()=>Y(a,!1),initialFocus:x,footer:/* @__PURE__ */h(g,{children:[
|
|
8
|
+
/* @__PURE__ */b("button",{ref:x,type:"button",onClick:()=>Y(a,!1),className:V,children:r.cancelLabel||oe.cancel}),
|
|
9
|
+
/* @__PURE__ */b("button",{type:"button",onClick:()=>Y(a,!0),className:te.button,children:r.confirmLabel||oe.ok})]}),children:/* @__PURE__ */h("div",{className:"flex gap-4",children:[
|
|
10
|
+
/* @__PURE__ */b("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */b(M,{})}),
|
|
11
11
|
/* @__PURE__ */h("div",{className:"flex-1",children:[
|
|
12
12
|
/* @__PURE__ */b("h2",{className:"text-base font-semibold text-gray-900",children:r.title||oe.confirmTitle}),
|
|
13
13
|
/* @__PURE__ */b("p",{className:"mt-2 text-sm text-gray-600",children:r.message})]})]})}),
|
|
14
|
-
/* @__PURE__ */h(
|
|
15
|
-
/* @__PURE__ */b("button",{ref:w,type:"button",onClick:()=>H(!1),className:
|
|
14
|
+
/* @__PURE__ */h(K,{open:C,onClose:()=>H(!1),initialFocus:null!=re?void 0:w,footer:/* @__PURE__ */h(g,{children:[
|
|
15
|
+
/* @__PURE__ */b("button",{ref:w,type:"button",onClick:()=>H(!1),className:V,children:L.cancelLabel||oe.destructiveCancel}),
|
|
16
16
|
/* @__PURE__ */b("button",{type:"button",onClick:()=>H(!0),disabled:!le,className:ne.button,children:re??L.confirmLabel??oe.destructiveConfirm})]}),children:[
|
|
17
17
|
/* @__PURE__ */b("button",{type:"button",onClick:()=>H(!1),"aria-label":oe.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */b(Q,{})}),
|
|
18
18
|
/* @__PURE__ */h("div",{className:"flex gap-4",children:[
|
|
19
|
-
/* @__PURE__ */b("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ne.icon}`,children:/* @__PURE__ */b(
|
|
19
|
+
/* @__PURE__ */b("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ne.icon}`,children:/* @__PURE__ */b(M,{})}),
|
|
20
20
|
/* @__PURE__ */h("div",{className:"flex-1",children:[
|
|
21
21
|
/* @__PURE__ */b("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:L.title||oe.destructiveTitle}),
|
|
22
22
|
/* @__PURE__ */b("p",{className:"mt-2 text-sm text-gray-600",children:L.message}),null!=re&&/* @__PURE__ */h(g,{children:[
|
|
23
23
|
/* @__PURE__ */h("p",{className:"mt-3 text-sm text-gray-700",children:[ie,
|
|
24
24
|
/* @__PURE__ */b("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-2 py-0.5 text-xs font-bold text-red-600 font-mono",children:re}),ae]}),
|
|
25
25
|
/* @__PURE__ */b("input",{autoFocus:!0,type:"text",value:j,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===re&&H(!0)},placeholder:re,className:`mt-2 ${G} focus:border-red-500`})]})]})]})]}),
|
|
26
|
-
/* @__PURE__ */h(
|
|
27
|
-
/* @__PURE__ */b("button",{type:"button",onClick:()=>Z(!1),className:
|
|
28
|
-
/* @__PURE__ */b("button",{type:"button",onClick:()=>Z(!0),disabled:!
|
|
29
|
-
/* @__PURE__ */b("input",{autoFocus:!0,type:"text",value:U,onChange:e=>
|
|
26
|
+
/* @__PURE__ */h(K,{open:T,onClose:()=>Z(!1),title:B.title||oe.promptTitle,footer:/* @__PURE__ */h(g,{children:[
|
|
27
|
+
/* @__PURE__ */b("button",{type:"button",onClick:()=>Z(!1),className:V,children:B.cancelLabel||oe.cancel}),
|
|
28
|
+
/* @__PURE__ */b("button",{type:"button",onClick:()=>Z(!0),disabled:!B.allowEmpty&&!U.trim(),className:z,children:B.confirmLabel||oe.ok})]}),children:[B.message&&/* @__PURE__ */b("p",{className:"text-sm text-gray-600",children:B.message}),
|
|
29
|
+
/* @__PURE__ */b("input",{autoFocus:!0,type:"text",value:U,onChange:e=>_(e.target.value),onKeyDown:e=>{"Enter"===e.key?Z(!0):"Escape"===e.key&&Z(!1)},onFocus:e=>e.target.select(),placeholder:B.placeholder,className:`mt-3 ${G} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{U as ConfirmProvider,K as Dialog,R as confirm,B as confirmDestructive,D as dialogA11y,k as focusableIn,A as prompt,E as stopAfter,T as useConfirm,L as useFocusTrap,I as useScrollLock,C as useTabLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{toast_default as t}from"./chunk-
|
|
2
|
-
return(new Date).toISOString()}var
|
|
1
|
+
import{toast_default as t}from"./chunk-DXCKYXRV.js";import{useShellPrefs as e}from"./chunk-MSH7WWFL.js";import{useSyncExternalStore as n,useCallback as o,useMemo as a}from"react";var r=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],i=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}],c=()=>`pomodoro-${/* @__PURE__ */(new Date).toISOString().slice(0,10)}`,l={focus:1500,short:300,long:900},s="bell",u=100,d=1,f="none",m=50,h={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},g={running:!1,remaining:l.focus,mode:"focus",total:l.focus,streak:0,count:"undefined"!=typeof localStorage?(()=>{try{return parseInt(localStorage.getItem(c())||"0",10)||0}catch{return 0}})():0},p=null,k=/* @__PURE__ */new Set,w=t=>{g={...g,...t},k.forEach(t=>t())};function M(){return g}function S(t){return k.add(t),()=>{k.delete(t)}}function b(t){l=t,g.running||g.remaining!==g.total||w({remaining:t[g.mode],total:t[g.mode]})}function y(t){s=t}function v(t,e){u=Math.max(0,Math.min(100,Math.round(t))),d=Math.max(1,Math.min(5,Math.round(e)))}function T(t){h={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function A(t,e){f=t,m=Math.max(0,Math.min(100,Math.round(e))),g.running&&"focus"===g.mode?(F(),R()):"none"!==t&&0!==m||F()}function I(){g.running||(w({running:!0}),p=setInterval(C,1e3),"focus"===g.mode&&R())}function x(){(g.running||null!==p)&&(null!==p&&(clearInterval(p),p=null),w({running:!1}),F())}function B(t){x(),w({mode:t,remaining:l[t],total:l[t]})}function C(){g.remaining<=1?function(){null!==p&&(clearInterval(p),p=null);F(),N(s,{volume:u,repeat:d});const e="focus"===g.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(e)}catch{}try{t.info(e)}catch{}if("focus"===g.mode){const t=g.streak+1,e=g.count+1;(t=>{try{localStorage.setItem(c(),String(t))}catch{}})(e);const n=t%h.longBreakInterval===0?"long":"short";w({running:!1,streak:t,count:e,mode:n,remaining:l[n],total:l[n]}),h.autoStartBreaks&&setTimeout(()=>I(),50)}else w({running:!1,mode:"focus",remaining:l.focus,total:l.focus}),h.autoStartPomodoros&&setTimeout(()=>I(),50)}():w({remaining:g.remaining-1})}function N(t=s,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>P(t,n),2500*e)}function P(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var D=null,_={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function O(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function R(){if(!D&&"none"!==f&&0!==m)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=O(e,f);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=m/100*_[f],o.connect(a).connect(e.destination),o.start(),D={ctx:e,src:o,gain:a}}catch{}}function F(){if(D){try{D.src.stop()}catch{}try{D.ctx.close()}catch{}D=null}}function V(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=O(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*_[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var W="pomodoro_tasks",G="pomodoro_tasks_migrated";function j(){return Math.random().toString(36).slice(2,11)}function L(){/* @__PURE__ */
|
|
2
|
+
return(new Date).toISOString()}var X=null,q=[],E=!1,H=null,J=/* @__PURE__ */new Set;function K(){for(const t of J)t()}function Y(t){q=t,K()}function $(){const t=X;return t?H=t.list().then(e=>{X===t&&(q=e,E=!0,K())}).catch(()=>{X===t&&(E=!0,K())}).finally(()=>{H=null}):(q=[],E=!0,K(),Promise.resolve())}function z(t){X=t,q=[],E=!1,t?$():K()}function Q(t){return J.add(t),!X||E||H||$(),()=>{J.delete(t)}}function U(){return q}function Z(){const t=function(){const{prefs:t,save:n}=e(),r=a(()=>{const e=t.todo_tasks;return Array.isArray(e)?e:[]},[t.todo_tasks]),i=o(t=>{n({todo_tasks:t})},[n]),c=o(t=>{const e=j(),n=L(),o={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...r,o]),e},[r,i]),l=o((t,e)=>{i(r.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:L()}:n))},[r,i]),s=o(t=>{i(r.filter(e=>e.id!==t))},[r,i]),u=o(t=>{const e=r.find(e=>e.id===t);e&&l(t,{done:!e.done})},[r,l]);return{tasks:r,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),r=n(Q,U,U),i=o(e=>{const n=X;if(!n)return t.addTask(e);const o="tmp-"+j(),a=L(),r={done:!1,...e,name:e.name.trim(),id:o,createdAt:a,updatedAt:a};return Y([...q,r]),n.create({...e,name:e.name.trim()}).then(t=>Y(q.map(e=>e.id===o?{...r,...t}:e))).catch(()=>Y(q.filter(t=>t.id!==o))),o},[t]),c=o((e,n)=>{const o=X;if(!o)return t.updateTask(e,n);Y(q.map(t=>t.id===e?{...t,...n,id:e,updatedAt:L()}:t)),o.update(e,n).catch(()=>{$()})},[t]),l=o(e=>{const n=X;if(!n)return t.removeTask(e);const o=q;Y(q.filter(t=>t.id!==e)),n.remove(e).catch(()=>Y(o))},[t]),s=o(e=>{if(!X)return t.toggleDone(e);const n=q.find(t=>t.id===e);n&&c(e,{done:!n.done})},[t,c]),u=o(e=>{X||t.setAllTasks(e)},[t]);return null===X?t:{tasks:r,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function tt(t,e){try{if(localStorage.getItem(G))return;const n=localStorage.getItem(W);if(!n)return void localStorage.setItem(G,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(W),void localStorage.setItem(G,"1");const a=L(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||j(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(W),localStorage.setItem(G,"1")}catch{try{localStorage.setItem(G,"1")}catch{}}}export{r as ALARM_OPTIONS,i as FOCUS_SOUND_OPTIONS,M as getPomoSnapshot,tt as migratePomodoroTasksOnce,N as playAlarm,x as pomoPause,I as pomoStart,B as pomoSwitchMode,V as previewFocusSound,y as setPomoAlarm,v as setPomoAlarmConfig,T as setPomoBehaviour,b as setPomoDurations,A as setPomoFocusSound,z as setShellTodoProvider,S as subscribePomo,Z as useTodoTasks};
|