super-time-tracker-ui 0.1.29 → 0.1.30
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/standalone/next-output/BUILD_ID +1 -1
- package/dist/standalone/next-output/build-manifest.json +3 -3
- package/dist/standalone/next-output/server/app/_global-error.html +1 -1
- package/dist/standalone/next-output/server/app/_global-error.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/login/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/login/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/offline/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/offline/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/pomodoro/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/pomodoro/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/register/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/register/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/reporting/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/reporting/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/ai-suggestions/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/ai-suggestions/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/cloud-sync/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/cloud-sync/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/data/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/data/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/display/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/display/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/goals/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/goals/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/notifications/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/notifications/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/pomodoro/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/pomodoro/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/tags/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/tags/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/sheets/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/sheets/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/today/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/today/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/{_0r_7~d.._.js → _10n~~xo._.js} +2 -2
- package/dist/standalone/next-output/server/chunks/ssr/components_tracker-app_tsx_0qs9.7y._.js +1 -1
- package/dist/standalone/next-output/server/middleware-build-manifest.js +3 -3
- package/dist/standalone/next-output/server/middleware-manifest.json +1 -1
- package/dist/standalone/next-output/server/pages/500.html +1 -1
- package/dist/standalone/next-output/static/chunks/{0d1dhitpe0ieo.js → 0znvz4n7decra.js} +1 -1
- package/dist/standalone/next-output/static/chunks/{0y8q3nm-aw7vw.js → 15ixzo9s2kj_o.js} +1 -1
- package/dist/standalone/package.json +1 -1
- package/package.json +1 -1
- /package/dist/standalone/next-output/static/{diBBBwr7OTHBo2aEw-WYC → Ohbr2ePvonj7GxdJPkXBY}/_buildManifest.js +0 -0
- /package/dist/standalone/next-output/static/{diBBBwr7OTHBo2aEw-WYC → Ohbr2ePvonj7GxdJPkXBY}/_clientMiddlewareManifest.js +0 -0
- /package/dist/standalone/next-output/static/{diBBBwr7OTHBo2aEw-WYC → Ohbr2ePvonj7GxdJPkXBY}/_ssgManifest.js +0 -0
|
@@ -56,4 +56,4 @@ ${m}`}({domain:y.host,address:w,statement:_,uri:y.href,version:"1",chainId:v,non
|
|
|
56
56
|
|
|
57
57
|
Check your Supabase project's API settings to find these values
|
|
58
58
|
|
|
59
|
-
https://supabase.com/dashboard/project/_/settings/api`);let{storage:i}=function(e,t){let r,s,i=e.cookies??null,n=e.cookieEncoding,a={},o={},l=()=>{let e=(0,rY.parse)(document.cookie);return Object.keys(e).map(t=>({name:t,value:e[t]??""}))},u=e=>{e.forEach(({name:e,value:t,options:r})=>{document.cookie=(0,rY.serialize)(e,t,r)})};if(i)if("get"in i){let e=async e=>{let t=e.flatMap(e=>[e,...Array.from({length:5}).map((t,r)=>`${e}.${r}`)]),r=[];for(let e=0;e<t.length;e+=1){let s=await i.get(t[e]);(s||"string"==typeof s)&&r.push({name:t[e],value:s})}return r};if(r=async t=>await e(t),"set"in i&&"remove"in i)s=async e=>{for(let t=0;t<e.length;t+=1){let{name:r,value:s,options:n}=e[t];s?await i.set(r,s,n):await i.remove(r,n)}};else if(t)s=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in i)if(r=async()=>await i.getAll(),"setAll"in i)s=i.setAll;else if(t)s=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else if(!t&&rJ())r=()=>l(),s=u;else throw Error(`@supabase/ssr: ${t?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).${rJ()?" As this is called in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""}`);else if(!t&&rJ())r=()=>l(),s=u;else if(t)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else r=()=>[],s=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};return t?{getAll:r,setAll:s,setItems:a,removedItems:o,storage:{isServer:!0,getItem:async e=>{if("string"==typeof a[e])return a[e];if(o[e])return null;let t=await r([e]),s=await rZ(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return s?"string"!=typeof s?s:r5(s):null},setItem:async(t,i)=>{t.endsWith("-code-verifier")&&await r3({getAll:r,setAll:s,setItems:{[t]:i},removedItems:{}},{cookieOptions:e?.cookieOptions??null,cookieEncoding:n}),a[t]=i,delete o[t]},removeItem:async e=>{delete a[e],o[e]=!0}}}:{getAll:r,setAll:s,setItems:a,removedItems:o,storage:{isServer:!1,getItem:async e=>{let t=await r([e]),s=await rZ(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return s?r5(s):null},setItem:async(t,i)=>{let a=await r([t]),o=new Set((a?.map(({name:e})=>e)||[]).filter(e=>rX(e,t))),l=i;"base64url"===n&&(l=r8+r6(i));let u=rQ(t,l);u.forEach(({name:e})=>{o.delete(e)});let c={...rz,...e?.cookieOptions,maxAge:0},h={...rz,...e?.cookieOptions,maxAge:rz.maxAge};delete c.name,delete h.name;let d=[...[...o].map(e=>({name:e,value:"",options:c})),...u.map(({name:e,value:t})=>({name:e,value:t,options:h}))];d.length>0&&await s(d,{})},removeItem:async t=>{let i=await r([t]),n=(i?.map(({name:e})=>e)||[]).filter(e=>rX(e,t)),a={...rz,...e?.cookieOptions,maxAge:0};delete a.name,n.length>0&&await s(n.map(e=>({name:e,value:"",options:a})),{})}}}}({...void 0,cookieEncoding:(void 0)??"base64url"},!1),n=new rW(e,t,{...void 0,global:{...void 0,headers:{...void 0,"X-Client-Info":"supabase-ssr/0.10.3 createBrowserClient"}},auth:{...void 0,...null,flowType:"pkce",autoRefreshToken:(void 0)??rJ(),detectSessionInUrl:(void 0)??rJ(),persistSession:(void 0)??!0,storage:i,...null}});return r&&(s=n),n}(t,e)}],83105)},95427,e=>{"use strict";e.s(["apply_color_palette",0,function(e){"u">typeof document&&document.documentElement.setAttribute("data-palette",e)}])},39411,e=>{"use strict";e.s(["apply_compact_lists",0,function(e){document.documentElement.setAttribute("data-compact-lists",e?"true":"false")}])},17798,e=>{"use strict";e.s(["apply_theme",0,function(e){document.documentElement.setAttribute("data-theme",e)}])},92629,26740,e=>{"use strict";e.s(["ACCENT_COLOR_DEFAULT",0,"teal","ACCENT_COLOR_STORAGE_KEY",0,"super-time-tracker-accent-color","ACCENT_COLOR_VALUES",0,["teal","blue","violet","rose","amber","emerald"],"CHECK_IN_FORM_COLLAPSED_DEFAULT",0,"false","CHECK_IN_FORM_COLLAPSED_STORAGE_KEY",0,"super-time-tracker-check-in-form-collapsed","CLAUDE_API_KEY_DEFAULT",0,"","CLAUDE_API_KEY_STORAGE_KEY",0,"super-time-tracker-claude-api-key","CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_DEFAULT",0,"false","CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_STORAGE_KEY",0,"super-time-tracker-clear-tag-filters-on-sheet-change","CLOUD_SYNC_ENABLED_DEFAULT",0,"true","CLOUD_SYNC_ENABLED_STORAGE_KEY",0,"super-time-tracker-cloud-sync-enabled","COLOR_PALETTE_DEFAULT",0,"default","COLOR_PALETTE_STORAGE_KEY",0,"super-time-tracker-color-palette","COLOR_PALETTE_VALUES",0,["default","midnight","warm","ocean","forest","contrast","sunset","lavender","rose","slate","nord","dracula"],"CONFIRM_BEFORE_CHECKOUT_DEFAULT",0,"false","CONFIRM_BEFORE_CHECKOUT_STORAGE_KEY",0,"super-time-tracker-confirm-before-checkout","CONFIRM_DESTRUCTIVE_ACTIONS_DEFAULT",0,"true","CONFIRM_DESTRUCTIVE_ACTIONS_STORAGE_KEY",0,"super-time-tracker-confirm-destructive-actions","DAILY_FOCUS_TARGET_MINUTES_DEFAULT",0,"240","DAILY_FOCUS_TARGET_MINUTES_STORAGE_KEY",0,"super-time-tracker-daily-focus-target-minutes","DEBUG_LOGGING_DEFAULT",0,"false","DEBUG_LOGGING_STORAGE_KEY",0,"super-time-tracker-debug-logging","DEFAULT_REPORTING_RANGE_DEFAULT",0,"none","DEFAULT_REPORTING_RANGE_STORAGE_KEY",0,"super-time-tracker-default-reporting-range","DEFAULT_REPORTING_SORT_DEFAULT",0,"duration","DEFAULT_REPORTING_SORT_STORAGE_KEY",0,"super-time-tracker-default-reporting-sort","DESKTOP_NOTIFICATIONS_DEFAULT",0,"false","DESKTOP_NOTIFICATIONS_STORAGE_KEY",0,"super-time-tracker-desktop-notifications","DURATION_FORMAT_DEFAULT",0,"humanized","DURATION_FORMAT_STORAGE_KEY",0,"super-time-tracker-duration-format","ENTRY_LIST_SORT_DEFAULT",0,"newest","ENTRY_LIST_SORT_STORAGE_KEY",0,"super-time-tracker-entry-list-sort","ENTRY_SUGGESTION_PROVIDER_DEFAULT",0,"none","ENTRY_SUGGESTION_PROVIDER_STORAGE_KEY",0,"super-time-tracker-entry-suggestion-provider","FOCUS_GOALS_PER_SHEET_DEFAULT",0,"{}","FOCUS_GOALS_PER_SHEET_STORAGE_KEY",0,"super-time-tracker-focus-goals-per-sheet","FOCUS_GOALS_PER_TAG_DEFAULT",0,"{}","FOCUS_GOALS_PER_TAG_STORAGE_KEY",0,"super-time-tracker-focus-goals-per-tag","FOCUS_GOAL_SCOPE_DEFAULT",0,"global","FOCUS_GOAL_SCOPE_STORAGE_KEY",0,"super-time-tracker-focus-goal-scope","FOCUS_GOAL_SHEET_NAME_DEFAULT",0,"","FOCUS_GOAL_SHEET_NAME_STORAGE_KEY",0,"super-time-tracker-focus-goal-sheet-name","FOCUS_GOAL_TAG_NAME_DEFAULT",0,"","FOCUS_GOAL_TAG_NAME_STORAGE_KEY",0,"super-time-tracker-focus-goal-tag-name","FOCUS_NUDGES_ENABLED_DEFAULT",0,"true","FOCUS_NUDGES_ENABLED_STORAGE_KEY",0,"super-time-tracker-focus-nudges-enabled","GOOGLE_AI_API_KEY_DEFAULT",0,"","GOOGLE_AI_API_KEY_STORAGE_KEY",0,"super-time-tracker-google-ai-api-key","GREEDY_CLOUD_SYNC_DEFAULT",0,"true","GREEDY_CLOUD_SYNC_STORAGE_KEY",0,"super-time-tracker-greedy-cloud-sync","NO_LOG_REMINDER_MINUTES_DEFAULT",0,"45","NO_LOG_REMINDER_MINUTES_STORAGE_KEY",0,"super-time-tracker-no-log-reminder-minutes","OPENAI_API_KEY_DEFAULT",0,"","OPENAI_API_KEY_STORAGE_KEY",0,"super-time-tracker-openai-api-key","OVERWORK_ALERT_HOURS_DEFAULT",0,"8","OVERWORK_ALERT_HOURS_STORAGE_KEY",0,"super-time-tracker-overwork-alert-hours","TAG_FILTER_MODE_DEFAULT",0,"all","TAG_FILTER_MODE_STORAGE_KEY",0,"super-time-tracker-tag-filter-mode","THEME_MODE_DEFAULT",0,"system","THEME_MODE_STORAGE_KEY",0,"super-time-tracker-theme-mode","TIMER_IN_TITLE_DEFAULT",0,"true","TIMER_IN_TITLE_STORAGE_KEY",0,"super-time-tracker-timer-in-title","TIMER_SHOW_SECONDS_DEFAULT",0,"false","TIMER_SHOW_SECONDS_STORAGE_KEY",0,"super-time-tracker-timer-show-seconds","TIME_FORMAT_DEFAULT",0,"12h","TIME_FORMAT_STORAGE_KEY",0,"super-time-tracker-time-format","WEEKLY_FOCUS_TARGET_MINUTES_DEFAULT",0,"1200","WEEKLY_FOCUS_TARGET_MINUTES_STORAGE_KEY",0,"super-time-tracker-weekly-focus-target-minutes","WEEK_STARTS_ON_DEFAULT",0,"monday","WEEK_STARTS_ON_STORAGE_KEY",0,"super-time-tracker-week-starts-on","WORK_HOURS_END_DEFAULT",0,"17:00","WORK_HOURS_END_STORAGE_KEY",0,"super-time-tracker-work-hours-end","WORK_HOURS_START_DEFAULT",0,"09:00","WORK_HOURS_START_STORAGE_KEY",0,"super-time-tracker-work-hours-start"],92629),e.s(["POMODORO_DEFAULT_SETTINGS",0,{work_minutes:25,short_break_minutes:5,long_break_minutes:15,rounds_before_long_break:4,auto_start_next_phase:!0,check_in_on_work_start:!0,work_entry_description:"Pomodoro focus"},"POMODORO_DEFAULT_STATE",0,{phase:"work",status:"idle",completed_work_sessions:0,deadline_at_ms:null,paused_remaining_ms:null},"POMODORO_STORAGE_KEY",0,"super-time-tracker-pomodoro"],26740)},72550,e=>{"use strict";e.s(["ACTIVE_SHEET_COOKIE_NAME",0,"stt-active-sheet","ACTIVE_SHEET_STORAGE_KEY",0,"super-time-tracker-active-sheet","COMPACT_LISTS_STORAGE_KEY",0,"super-time-tracker-compact-lists","DEFAULT_SHEET_FIXED_NAME_COOKIE_NAME",0,"stt-default-sheet-fixed-name","DEFAULT_SHEET_FIXED_NAME_STORAGE_KEY",0,"super-time-tracker-default-sheet-fixed-name","DEFAULT_SHEET_SESSION_MODE_COOKIE_NAME",0,"stt-default-sheet-session-mode","DEFAULT_SHEET_SESSION_MODE_DEFAULT",0,"last_viewed","DEFAULT_SHEET_SESSION_MODE_STORAGE_KEY",0,"super-time-tracker-default-sheet-session-mode","SHEET_TAG_FILTERS_STORAGE_KEY",0,"super-time-tracker-sheet-tag-filters"])},89497,38633,e=>{"use strict";var t=e.i(92629),r=e.i(26740),s=e.i(72550);let i="super-time-tracker-theme";e.s(["THEME_STORAGE_KEY",0,i],38633),e.s(["collect_ui_preferences_from_window",0,function(){let e={};for(let n of[t.ACCENT_COLOR_STORAGE_KEY,s.ACTIVE_SHEET_STORAGE_KEY,t.CHECK_IN_FORM_COLLAPSED_STORAGE_KEY,t.CLOUD_SYNC_ENABLED_STORAGE_KEY,t.CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_STORAGE_KEY,t.COLOR_PALETTE_STORAGE_KEY,s.COMPACT_LISTS_STORAGE_KEY,t.CONFIRM_BEFORE_CHECKOUT_STORAGE_KEY,t.CONFIRM_DESTRUCTIVE_ACTIONS_STORAGE_KEY,t.DEFAULT_REPORTING_RANGE_STORAGE_KEY,t.DEFAULT_REPORTING_SORT_STORAGE_KEY,t.DEBUG_LOGGING_STORAGE_KEY,s.DEFAULT_SHEET_FIXED_NAME_STORAGE_KEY,s.DEFAULT_SHEET_SESSION_MODE_STORAGE_KEY,t.DAILY_FOCUS_TARGET_MINUTES_STORAGE_KEY,t.DURATION_FORMAT_STORAGE_KEY,t.ENTRY_LIST_SORT_STORAGE_KEY,t.ENTRY_SUGGESTION_PROVIDER_STORAGE_KEY,t.FOCUS_GOAL_SCOPE_STORAGE_KEY,t.FOCUS_GOAL_SHEET_NAME_STORAGE_KEY,t.FOCUS_GOAL_TAG_NAME_STORAGE_KEY,t.FOCUS_GOALS_PER_SHEET_STORAGE_KEY,t.FOCUS_GOALS_PER_TAG_STORAGE_KEY,t.FOCUS_NUDGES_ENABLED_STORAGE_KEY,t.GREEDY_CLOUD_SYNC_STORAGE_KEY,t.NO_LOG_REMINDER_MINUTES_STORAGE_KEY,t.OVERWORK_ALERT_HOURS_STORAGE_KEY,r.POMODORO_STORAGE_KEY,s.SHEET_TAG_FILTERS_STORAGE_KEY,t.TAG_FILTER_MODE_STORAGE_KEY,t.THEME_MODE_STORAGE_KEY,i,t.TIME_FORMAT_STORAGE_KEY,t.TIMER_IN_TITLE_STORAGE_KEY,t.TIMER_SHOW_SECONDS_STORAGE_KEY,t.WEEKLY_FOCUS_TARGET_MINUTES_STORAGE_KEY,t.WEEK_STARTS_ON_STORAGE_KEY,t.WORK_HOURS_END_STORAGE_KEY,t.WORK_HOURS_START_STORAGE_KEY])try{let t=window.localStorage.getItem(n);null!==t&&(e[n]=t)}catch{}return e}],89497)},47149,e=>{"use strict";let t=new Set;e.s(["notify_cloud_db_sync",0,function(e){t.forEach(t=>{t(e)})},"subscribe_cloud_db_sync",0,function(e){return t.add(e),()=>{t.delete(e)}}])},27850,44171,13582,e=>{"use strict";var t=e.i(92629);function r(){try{let e=window.localStorage.getItem(t.CLOUD_SYNC_ENABLED_STORAGE_KEY);return null===e?"true"===t.CLOUD_SYNC_ENABLED_DEFAULT:"true"===e}catch{return!0}}e.s(["is_cloud_sync_enabled",0,r],44171);var s=e.i(32417);let i=!1;var n=e.i(89497),a=e.i(47149);function o(){if(!(0,s.is_supabase_configured)()||!r())return;let e=(0,n.collect_ui_preferences_from_window)();0!==Object.keys(e).length&&((0,a.notify_cloud_db_sync)({phase:"syncing",message:"Syncing settings to cloud…"}),fetch("/api/ui-preferences",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({preferences:e})}).then(async e=>{if(!e.ok)throw Error((await e.json().catch(()=>({}))).error??"Settings sync failed");(0,a.notify_cloud_db_sync)({phase:"success",message:"Settings synced"})}).catch(e=>{(0,a.notify_cloud_db_sync)({phase:"error",message:e instanceof Error?e.message:"Settings sync failed"})}))}let l=0;function u(){return l>0}async function c(e){l+=1;try{return await e()}finally{0==(l-=1)&&i&&(i=!1,1)&&o()}}e.s(["is_ui_preferences_merge_in_progress",0,u,"with_ui_preferences_merge_guard",0,c],13582);let h=null;e.s(["schedule_ui_preferences_cloud_sync",0,function(){if((0,s.is_supabase_configured)()&&r()){if(u())return void(i=!0);null!==h&&clearTimeout(h),h=setTimeout(()=>{h=null,o()},800)}}],27850)},34869,e=>{"use strict";var t=e.i(27850);e.s(["create_ui_preference_store",0,function(e){let{default_value:r,is_valid:s,storage_key:i}=e,n=new Set,a=()=>{try{let e=window.localStorage.getItem(i);if(null!==e&&s(e))return e}catch{}return r};return{storage_key:i,default_value:r,is_valid:s,read:a,write:e=>{try{window.localStorage.setItem(i,e),(0,t.schedule_ui_preferences_cloud_sync)()}catch{}},subscribe:e=>(n.add(e),()=>{n.delete(e)}),notify:()=>{n.forEach(e=>{e()})},get_snapshot:a,get_server_snapshot:()=>r}}])},10464,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.THEME_MODE_STORAGE_KEY,default_value:r.THEME_MODE_DEFAULT,is_valid:e=>"light"===e||"dark"===e||"system"===e});e.s(["theme_mode_preference",0,s])},70223,e=>{"use strict";e.s(["resolve_theme_mode_to_theme",0,function(e){return"light"===e||"dark"===e?e:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}])},61834,e=>{"use strict";e.s(["write_document_preference_cookies",0,function(e){if("u"<typeof document)return;let t="path=/; max-age=31536000; SameSite=Lax";void 0!==e.theme_mode&&(document.cookie=`stt-theme-mode=${e.theme_mode}; ${t}`),void 0!==e.theme&&(document.cookie=`stt-theme=${e.theme}; ${t}`),void 0!==e.palette&&(document.cookie=`stt-palette=${e.palette}; ${t}`),void 0!==e.compact_lists&&(document.cookie=`stt-compact-lists=${e.compact_lists?"true":"false"}; ${t}`)}],61834)},53602,32418,e=>{"use strict";var t=e.i(95427),r=e.i(39411),s=e.i(17798),i=e.i(10464),n=e.i(92629);let a={teal:"default",blue:"ocean",violet:"midnight",rose:"warm",amber:"warm",emerald:"forest"};function o(e,t){if(void 0!==e&&n.COLOR_PALETTE_VALUES.includes(e))return e;if(void 0!==t){let e=a[t];if(void 0!==e)return e}return n.COLOR_PALETTE_DEFAULT}function l(){try{return o(window.localStorage.getItem(n.COLOR_PALETTE_STORAGE_KEY)??void 0,window.localStorage.getItem(n.ACCENT_COLOR_STORAGE_KEY)??void 0)}catch{return n.COLOR_PALETTE_DEFAULT}}e.s(["read_stored_color_palette_from_window",0,l,"resolve_stored_color_palette",0,o],32418);var u=e.i(70223),c=e.i(61834),h=e.i(72550),d=e.i(38633);e.s(["apply_ui_preferences_dom_from_window",0,function(){let e,a;try{let e=window.localStorage.getItem(h.COMPACT_LISTS_STORAGE_KEY);("true"===e||"false"===e)&&(0,r.apply_compact_lists)("true"===e)}catch{}try{let e=window.localStorage.getItem(n.THEME_MODE_STORAGE_KEY);if(null!==e&&i.theme_mode_preference.is_valid(e))(0,s.apply_theme)((0,u.resolve_theme_mode_to_theme)(e));else{let e=window.localStorage.getItem(d.THEME_STORAGE_KEY);("light"===e||"dark"===e)&&(0,s.apply_theme)(e)}}catch{}(0,t.apply_color_palette)(l()),e=i.theme_mode_preference.read(),a="true"===window.localStorage.getItem(h.COMPACT_LISTS_STORAGE_KEY),(0,c.write_document_preference_cookies)({theme_mode:e,theme:(0,u.resolve_theme_mode_to_theme)(e),palette:l(),compact_lists:a})}],53602)},8307,11184,e=>{"use strict";e.s(["apply_ui_preferences_record",0,function(e){for(let[t,r]of Object.entries(e))try{window.localStorage.setItem(t,r)}catch{}}],8307);var t=e.i(34869),r=e.i(92629);let s=new Set(r.ACCENT_COLOR_VALUES),i=(0,t.create_ui_preference_store)({storage_key:r.ACCENT_COLOR_STORAGE_KEY,default_value:r.ACCENT_COLOR_DEFAULT,is_valid:e=>s.has(e)});e.s(["accent_color_preference",0,i],11184)},50994,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.CHECK_IN_FORM_COLLAPSED_STORAGE_KEY,default_value:r.CHECK_IN_FORM_COLLAPSED_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["check_in_form_collapsed_preference",0,s])},65742,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_STORAGE_KEY,default_value:r.CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["clear_tag_filters_on_sheet_change_preference",0,s])},2540,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=new Set(r.COLOR_PALETTE_VALUES),i=(0,t.create_ui_preference_store)({storage_key:r.COLOR_PALETTE_STORAGE_KEY,default_value:r.COLOR_PALETTE_DEFAULT,is_valid:e=>s.has(e)});e.s(["color_palette_preference",0,i])},97026,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.CONFIRM_BEFORE_CHECKOUT_STORAGE_KEY,default_value:r.CONFIRM_BEFORE_CHECKOUT_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["confirm_before_checkout_preference",0,s])},36405,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.CONFIRM_DESTRUCTIVE_ACTIONS_STORAGE_KEY,default_value:r.CONFIRM_DESTRUCTIVE_ACTIONS_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["confirm_destructive_actions_preference",0,s])},68462,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.DEFAULT_REPORTING_RANGE_STORAGE_KEY,default_value:r.DEFAULT_REPORTING_RANGE_DEFAULT,is_valid:e=>"none"===e||"today"===e||"week"===e});e.s(["default_reporting_range_preference",0,s])},1997,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.DEFAULT_REPORTING_SORT_STORAGE_KEY,default_value:r.DEFAULT_REPORTING_SORT_DEFAULT,is_valid:e=>"duration"===e||"name"===e||"entry_count"===e||"active_first"===e});e.s(["default_reporting_sort_preference",0,s])},8492,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.DURATION_FORMAT_STORAGE_KEY,default_value:r.DURATION_FORMAT_DEFAULT,is_valid:e=>"humanized"===e||"clock"===e||"decimal"===e});e.s(["duration_format_preference",0,s])},4874,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.ENTRY_LIST_SORT_STORAGE_KEY,default_value:r.ENTRY_LIST_SORT_DEFAULT,is_valid:e=>"newest"===e||"oldest"===e||"duration"===e||"description"===e});e.s(["entry_list_sort_preference",0,s])},410,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.GREEDY_CLOUD_SYNC_STORAGE_KEY,default_value:r.GREEDY_CLOUD_SYNC_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["greedy_cloud_sync_preference",0,s])},62796,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.TAG_FILTER_MODE_STORAGE_KEY,default_value:r.TAG_FILTER_MODE_DEFAULT,is_valid:e=>"all"===e||"any"===e});e.s(["tag_filter_mode_preference",0,s])},56716,e=>{"use strict";var t=e.i(34869);let r=["all","pinned"],s=(0,t.create_ui_preference_store)({storage_key:"super-time-tracker-today-focus-scope",default_value:"all",is_valid:e=>r.includes(e)});e.s(["today_scope_preference",0,s],56716)},97891,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.TIME_FORMAT_STORAGE_KEY,default_value:r.TIME_FORMAT_DEFAULT,is_valid:e=>"12h"===e||"24h"===e});e.s(["time_format_preference",0,s])},16967,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.TIMER_IN_TITLE_STORAGE_KEY,default_value:r.TIMER_IN_TITLE_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["timer_in_title_preference",0,s])},60935,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.TIMER_SHOW_SECONDS_STORAGE_KEY,default_value:r.TIMER_SHOW_SECONDS_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["timer_show_seconds_preference",0,s])},57853,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.WEEK_STARTS_ON_STORAGE_KEY,default_value:r.WEEK_STARTS_ON_DEFAULT,is_valid:e=>"monday"===e||"sunday"===e});e.s(["week_starts_on_preference",0,s])},78539,e=>{"use strict";let t=new Set;e.s(["notify_compact_lists_subscribers",0,function(){t.forEach(e=>{e()})},"subscribe_compact_lists",0,function(e){return t.add(e),()=>{t.delete(e)}}])},98425,86580,e=>{"use strict";let t=[],r=null;function s(){r=null}e.s(["EMPTY_SHEET_TAG_FILTER",0,t,"get_stable_sheet_tag_filter_snapshot",0,function(e,s){let i=s.join("\0");if(null!==r&&r.sheet_name===e&&r.tags_key===i)return r.snapshot;let n=0===s.length?t:Object.freeze([...s]);return r={sheet_name:e,tags_key:i,snapshot:n},n},"reset_sheet_tag_filter_snapshot_cache",0,s],86580);let i=new Set;e.s(["notify_sheet_tag_filters_subscribers",0,function(){s(),i.forEach(e=>{e()})},"subscribe_sheet_tag_filters",0,function(e){return i.add(e),()=>{i.delete(e)}}],98425)},35434,e=>{"use strict";let t=new Set;e.s(["notify_theme_subscribers",0,function(){t.forEach(e=>{e()})},"subscribe_theme",0,function(e){return t.add(e),()=>{t.delete(e)}}])},60609,e=>{"use strict";let t="stt-ui-preferences-applied";e.s(["UI_PREFERENCES_APPLIED_EVENT",0,t,"dispatch_ui_preferences_applied_event",0,function(){window.dispatchEvent(new Event(t))}])},28274,18324,76670,e=>{"use strict";var t=e.i(53602),r=e.i(8307),s=e.i(11184),i=e.i(50994),n=e.i(65742),a=e.i(2540),o=e.i(97026),l=e.i(36405),u=e.i(68462),c=e.i(1997),h=e.i(8492),d=e.i(4874),f=e.i(410),p=e.i(62796),g=e.i(56716),_=e.i(10464),m=e.i(97891),y=e.i(16967),b=e.i(60935),w=e.i(57853),v=e.i(78539),E=e.i(98425),T=e.i(35434),k=e.i(32418),S=e.i(60609),A=e.i(92629);function O(e){(0,r.apply_ui_preferences_record)(e);let O=(0,k.resolve_stored_color_palette)(e[A.COLOR_PALETTE_STORAGE_KEY],e[A.ACCENT_COLOR_STORAGE_KEY]);try{window.localStorage.setItem(A.COLOR_PALETTE_STORAGE_KEY,O),void 0!==e[A.COLOR_PALETTE_STORAGE_KEY]&&(window.localStorage.removeItem(A.ACCENT_COLOR_STORAGE_KEY),document.documentElement.removeAttribute("data-accent"))}catch{}(0,t.apply_ui_preferences_dom_from_window)(),s.accent_color_preference.notify(),i.check_in_form_collapsed_preference.notify(),n.clear_tag_filters_on_sheet_change_preference.notify(),a.color_palette_preference.notify(),o.confirm_before_checkout_preference.notify(),l.confirm_destructive_actions_preference.notify(),u.default_reporting_range_preference.notify(),c.default_reporting_sort_preference.notify(),h.duration_format_preference.notify(),d.entry_list_sort_preference.notify(),f.greedy_cloud_sync_preference.notify(),p.tag_filter_mode_preference.notify(),g.today_scope_preference.notify(),_.theme_mode_preference.notify(),m.time_format_preference.notify(),y.timer_in_title_preference.notify(),b.timer_show_seconds_preference.notify(),w.week_starts_on_preference.notify(),(0,v.notify_compact_lists_subscribers)(),(0,T.notify_theme_subscribers)(),(0,E.notify_sheet_tag_filters_subscribers)(),(0,S.dispatch_ui_preferences_applied_event)()}e.s(["apply_ui_preferences_from_record",0,O],18324);var R=e.i(89497),C=e.i(44171);let I="super-time-tracker-db-merged-session";function P(){try{sessionStorage.setItem(I,"1")}catch{}}e.s(["clear_tracker_db_merged_this_browser_session",0,function(){try{sessionStorage.removeItem(I)}catch{}},"has_tracker_db_merged_this_browser_session",0,function(){try{return"1"===sessionStorage.getItem(I)}catch{return!1}},"mark_tracker_db_merged_this_browser_session",0,P],76670);var L=e.i(47149),j=e.i(13582);async function U(e={}){if(!(0,C.is_cloud_sync_enabled)())return;let r=e.action??"push";(0,L.notify_cloud_db_sync)({phase:"syncing",message:"pull"===r?"Pulling from cloud…":"Syncing to cloud…"});try{!0===e.merge_on_load&&await (0,j.with_ui_preferences_merge_guard)(async()=>{let e=(0,R.collect_ui_preferences_from_window)(),t=await fetch("/api/sync/merge-on-load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({preferences:e})});if(!t.ok){let e=await t.json();throw Error(e.error??"Merge on load failed")}let r=await t.json();O(r.preferences??{})});let s=!0===e.merge_on_load&&"push"===r?"/api/sync/push?verbatim=true":`/api/sync/${r}`,i=await fetch(s,{method:"POST"});if(!i.ok){let e=await i.json();throw Error(e.error??`${r} failed`)}!0===e.merge_on_load&&P(),(0,L.notify_cloud_db_sync)({phase:"success",message:"pull"===r?"Cloud pull complete":"Cloud sync complete"}),!0===e.merge_on_load?(e.on_complete?.(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{(0,t.apply_ui_preferences_dom_from_window)()})})):e.on_complete?.()}catch(t){let e=t instanceof Error?t.message:String(t);throw(0,L.notify_cloud_db_sync)({phase:"error",message:e}),t}}e.s(["run_tracker_db_cloud_sync",0,U],28274)},46549,e=>{"use strict";let t=new Set,r="Settings saved",s=null,i=r;e.s(["SETTINGS_SAVED_DEFAULT_MESSAGE",0,r,"notify_settings_saved",0,function(e=r){i=e,null!==s&&clearTimeout(s),s=setTimeout(()=>{s=null;let e=i;t.forEach(t=>{t(e)})},200)},"subscribe_settings_saved",0,function(e){return t.add(e),()=>{t.delete(e)}}])},81553,e=>{"use strict";var t=e.i(27850),r=e.i(38633);e.s(["write_stored_theme",0,function(e){try{window.localStorage.setItem(r.THEME_STORAGE_KEY,e),(0,t.schedule_ui_preferences_cloud_sync)()}catch{}}])}]);
|
|
59
|
+
https://supabase.com/dashboard/project/_/settings/api`);let{storage:i}=function(e,t){let r,s,i=e.cookies??null,n=e.cookieEncoding,a={},o={},l=()=>{let e=(0,rY.parse)(document.cookie);return Object.keys(e).map(t=>({name:t,value:e[t]??""}))},u=e=>{e.forEach(({name:e,value:t,options:r})=>{document.cookie=(0,rY.serialize)(e,t,r)})};if(i)if("get"in i){let e=async e=>{let t=e.flatMap(e=>[e,...Array.from({length:5}).map((t,r)=>`${e}.${r}`)]),r=[];for(let e=0;e<t.length;e+=1){let s=await i.get(t[e]);(s||"string"==typeof s)&&r.push({name:t[e],value:s})}return r};if(r=async t=>await e(t),"set"in i&&"remove"in i)s=async e=>{for(let t=0;t<e.length;t+=1){let{name:r,value:s,options:n}=e[t];s?await i.set(r,s,n):await i.remove(r,n)}};else if(t)s=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in i)if(r=async()=>await i.getAll(),"setAll"in i)s=i.setAll;else if(t)s=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else if(!t&&rJ())r=()=>l(),s=u;else throw Error(`@supabase/ssr: ${t?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).${rJ()?" As this is called in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""}`);else if(!t&&rJ())r=()=>l(),s=u;else if(t)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else r=()=>[],s=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};return t?{getAll:r,setAll:s,setItems:a,removedItems:o,storage:{isServer:!0,getItem:async e=>{if("string"==typeof a[e])return a[e];if(o[e])return null;let t=await r([e]),s=await rZ(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return s?"string"!=typeof s?s:r5(s):null},setItem:async(t,i)=>{t.endsWith("-code-verifier")&&await r3({getAll:r,setAll:s,setItems:{[t]:i},removedItems:{}},{cookieOptions:e?.cookieOptions??null,cookieEncoding:n}),a[t]=i,delete o[t]},removeItem:async e=>{delete a[e],o[e]=!0}}}:{getAll:r,setAll:s,setItems:a,removedItems:o,storage:{isServer:!1,getItem:async e=>{let t=await r([e]),s=await rZ(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return s?r5(s):null},setItem:async(t,i)=>{let a=await r([t]),o=new Set((a?.map(({name:e})=>e)||[]).filter(e=>rX(e,t))),l=i;"base64url"===n&&(l=r8+r6(i));let u=rQ(t,l);u.forEach(({name:e})=>{o.delete(e)});let c={...rz,...e?.cookieOptions,maxAge:0},h={...rz,...e?.cookieOptions,maxAge:rz.maxAge};delete c.name,delete h.name;let d=[...[...o].map(e=>({name:e,value:"",options:c})),...u.map(({name:e,value:t})=>({name:e,value:t,options:h}))];d.length>0&&await s(d,{})},removeItem:async t=>{let i=await r([t]),n=(i?.map(({name:e})=>e)||[]).filter(e=>rX(e,t)),a={...rz,...e?.cookieOptions,maxAge:0};delete a.name,n.length>0&&await s(n.map(e=>({name:e,value:"",options:a})),{})}}}}({...void 0,cookieEncoding:(void 0)??"base64url"},!1),n=new rW(e,t,{...void 0,global:{...void 0,headers:{...void 0,"X-Client-Info":"supabase-ssr/0.10.3 createBrowserClient"}},auth:{...void 0,...null,flowType:"pkce",autoRefreshToken:(void 0)??rJ(),detectSessionInUrl:(void 0)??rJ(),persistSession:(void 0)??!0,storage:i,...null}});return r&&(s=n),n}(t,e)}],83105)},95427,e=>{"use strict";e.s(["apply_color_palette",0,function(e){"u">typeof document&&document.documentElement.setAttribute("data-palette",e)}])},39411,e=>{"use strict";e.s(["apply_compact_lists",0,function(e){document.documentElement.setAttribute("data-compact-lists",e?"true":"false")}])},17798,e=>{"use strict";e.s(["apply_theme",0,function(e){document.documentElement.setAttribute("data-theme",e)}])},92629,26740,e=>{"use strict";e.s(["ACCENT_COLOR_DEFAULT",0,"teal","ACCENT_COLOR_STORAGE_KEY",0,"super-time-tracker-accent-color","ACCENT_COLOR_VALUES",0,["teal","blue","violet","rose","amber","emerald"],"CHECK_IN_FORM_COLLAPSED_DEFAULT",0,"false","CHECK_IN_FORM_COLLAPSED_STORAGE_KEY",0,"super-time-tracker-check-in-form-collapsed","CLAUDE_API_KEY_DEFAULT",0,"","CLAUDE_API_KEY_STORAGE_KEY",0,"super-time-tracker-claude-api-key","CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_DEFAULT",0,"false","CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_STORAGE_KEY",0,"super-time-tracker-clear-tag-filters-on-sheet-change","CLOUD_SYNC_ENABLED_DEFAULT",0,"true","CLOUD_SYNC_ENABLED_STORAGE_KEY",0,"super-time-tracker-cloud-sync-enabled","COLOR_PALETTE_DEFAULT",0,"default","COLOR_PALETTE_STORAGE_KEY",0,"super-time-tracker-color-palette","COLOR_PALETTE_VALUES",0,["default","midnight","warm","ocean","forest","contrast","sunset","lavender","rose","slate","nord","dracula"],"CONFIRM_BEFORE_CHECKOUT_DEFAULT",0,"false","CONFIRM_BEFORE_CHECKOUT_STORAGE_KEY",0,"super-time-tracker-confirm-before-checkout","CONFIRM_DESTRUCTIVE_ACTIONS_DEFAULT",0,"true","CONFIRM_DESTRUCTIVE_ACTIONS_STORAGE_KEY",0,"super-time-tracker-confirm-destructive-actions","DAILY_FOCUS_TARGET_MINUTES_DEFAULT",0,"240","DAILY_FOCUS_TARGET_MINUTES_STORAGE_KEY",0,"super-time-tracker-daily-focus-target-minutes","DEBUG_LOGGING_DEFAULT",0,"false","DEBUG_LOGGING_STORAGE_KEY",0,"super-time-tracker-debug-logging","DEFAULT_REPORTING_RANGE_DEFAULT",0,"none","DEFAULT_REPORTING_RANGE_STORAGE_KEY",0,"super-time-tracker-default-reporting-range","DEFAULT_REPORTING_SORT_DEFAULT",0,"duration","DEFAULT_REPORTING_SORT_STORAGE_KEY",0,"super-time-tracker-default-reporting-sort","DESKTOP_NOTIFICATIONS_DEFAULT",0,"false","DESKTOP_NOTIFICATIONS_STORAGE_KEY",0,"super-time-tracker-desktop-notifications","DURATION_FORMAT_DEFAULT",0,"humanized","DURATION_FORMAT_STORAGE_KEY",0,"super-time-tracker-duration-format","ENTRY_LIST_SORT_DEFAULT",0,"newest","ENTRY_LIST_SORT_STORAGE_KEY",0,"super-time-tracker-entry-list-sort","ENTRY_SUGGESTION_PROVIDER_DEFAULT",0,"none","ENTRY_SUGGESTION_PROVIDER_STORAGE_KEY",0,"super-time-tracker-entry-suggestion-provider","FOCUS_GOALS_PER_SHEET_DEFAULT",0,"{}","FOCUS_GOALS_PER_SHEET_STORAGE_KEY",0,"super-time-tracker-focus-goals-per-sheet","FOCUS_GOALS_PER_TAG_DEFAULT",0,"{}","FOCUS_GOALS_PER_TAG_STORAGE_KEY",0,"super-time-tracker-focus-goals-per-tag","FOCUS_GOAL_SCOPE_DEFAULT",0,"global","FOCUS_GOAL_SCOPE_STORAGE_KEY",0,"super-time-tracker-focus-goal-scope","FOCUS_GOAL_SHEET_NAME_DEFAULT",0,"","FOCUS_GOAL_SHEET_NAME_STORAGE_KEY",0,"super-time-tracker-focus-goal-sheet-name","FOCUS_GOAL_TAG_NAME_DEFAULT",0,"","FOCUS_GOAL_TAG_NAME_STORAGE_KEY",0,"super-time-tracker-focus-goal-tag-name","FOCUS_NUDGES_ENABLED_DEFAULT",0,"true","FOCUS_NUDGES_ENABLED_STORAGE_KEY",0,"super-time-tracker-focus-nudges-enabled","GOOGLE_AI_API_KEY_DEFAULT",0,"","GOOGLE_AI_API_KEY_STORAGE_KEY",0,"super-time-tracker-google-ai-api-key","GREEDY_CLOUD_SYNC_DEFAULT",0,"true","GREEDY_CLOUD_SYNC_STORAGE_KEY",0,"super-time-tracker-greedy-cloud-sync","NO_LOG_REMINDER_MINUTES_DEFAULT",0,"45","NO_LOG_REMINDER_MINUTES_STORAGE_KEY",0,"super-time-tracker-no-log-reminder-minutes","OPENAI_API_KEY_DEFAULT",0,"","OPENAI_API_KEY_STORAGE_KEY",0,"super-time-tracker-openai-api-key","OVERWORK_ALERT_HOURS_DEFAULT",0,"8","OVERWORK_ALERT_HOURS_STORAGE_KEY",0,"super-time-tracker-overwork-alert-hours","TAG_FILTER_MODE_DEFAULT",0,"all","TAG_FILTER_MODE_STORAGE_KEY",0,"super-time-tracker-tag-filter-mode","THEME_MODE_DEFAULT",0,"system","THEME_MODE_STORAGE_KEY",0,"super-time-tracker-theme-mode","TIMER_IN_TITLE_DEFAULT",0,"true","TIMER_IN_TITLE_STORAGE_KEY",0,"super-time-tracker-timer-in-title","TIMER_SHOW_SECONDS_DEFAULT",0,"false","TIMER_SHOW_SECONDS_STORAGE_KEY",0,"super-time-tracker-timer-show-seconds","TIME_FORMAT_DEFAULT",0,"12h","TIME_FORMAT_STORAGE_KEY",0,"super-time-tracker-time-format","WEEKLY_FOCUS_TARGET_MINUTES_DEFAULT",0,"1200","WEEKLY_FOCUS_TARGET_MINUTES_STORAGE_KEY",0,"super-time-tracker-weekly-focus-target-minutes","WEEK_STARTS_ON_DEFAULT",0,"monday","WEEK_STARTS_ON_STORAGE_KEY",0,"super-time-tracker-week-starts-on","WORK_HOURS_END_DEFAULT",0,"17:00","WORK_HOURS_END_STORAGE_KEY",0,"super-time-tracker-work-hours-end","WORK_HOURS_START_DEFAULT",0,"09:00","WORK_HOURS_START_STORAGE_KEY",0,"super-time-tracker-work-hours-start"],92629),e.s(["POMODORO_DEFAULT_SETTINGS",0,{work_minutes:25,short_break_minutes:5,long_break_minutes:15,rounds_before_long_break:4,auto_start_next_phase:!0,check_in_on_work_start:!0,work_entry_description:"Pomodoro focus"},"POMODORO_DEFAULT_STATE",0,{phase:"work",status:"idle",completed_work_sessions:0,deadline_at_ms:null,paused_remaining_ms:null},"POMODORO_STORAGE_KEY",0,"super-time-tracker-pomodoro"],26740)},72550,e=>{"use strict";e.s(["ACTIVE_SHEET_COOKIE_NAME",0,"stt-active-sheet","ACTIVE_SHEET_STORAGE_KEY",0,"super-time-tracker-active-sheet","COMPACT_LISTS_STORAGE_KEY",0,"super-time-tracker-compact-lists","DEFAULT_SHEET_FIXED_NAME_COOKIE_NAME",0,"stt-default-sheet-fixed-name","DEFAULT_SHEET_FIXED_NAME_STORAGE_KEY",0,"super-time-tracker-default-sheet-fixed-name","DEFAULT_SHEET_SESSION_MODE_COOKIE_NAME",0,"stt-default-sheet-session-mode","DEFAULT_SHEET_SESSION_MODE_DEFAULT",0,"last_viewed","DEFAULT_SHEET_SESSION_MODE_STORAGE_KEY",0,"super-time-tracker-default-sheet-session-mode","SHEET_TAG_FILTERS_STORAGE_KEY",0,"super-time-tracker-sheet-tag-filters"])},89497,38633,e=>{"use strict";var t=e.i(92629),r=e.i(26740),s=e.i(72550);let i="super-time-tracker-theme";e.s(["THEME_STORAGE_KEY",0,i],38633),e.s(["collect_ui_preferences_from_window",0,function(){let e={};for(let n of[t.ACCENT_COLOR_STORAGE_KEY,s.ACTIVE_SHEET_STORAGE_KEY,t.CHECK_IN_FORM_COLLAPSED_STORAGE_KEY,t.CLOUD_SYNC_ENABLED_STORAGE_KEY,t.CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_STORAGE_KEY,t.COLOR_PALETTE_STORAGE_KEY,s.COMPACT_LISTS_STORAGE_KEY,t.CONFIRM_BEFORE_CHECKOUT_STORAGE_KEY,t.CONFIRM_DESTRUCTIVE_ACTIONS_STORAGE_KEY,t.DEFAULT_REPORTING_RANGE_STORAGE_KEY,t.DEFAULT_REPORTING_SORT_STORAGE_KEY,t.DEBUG_LOGGING_STORAGE_KEY,s.DEFAULT_SHEET_FIXED_NAME_STORAGE_KEY,s.DEFAULT_SHEET_SESSION_MODE_STORAGE_KEY,t.DAILY_FOCUS_TARGET_MINUTES_STORAGE_KEY,t.DURATION_FORMAT_STORAGE_KEY,t.ENTRY_LIST_SORT_STORAGE_KEY,t.ENTRY_SUGGESTION_PROVIDER_STORAGE_KEY,t.FOCUS_GOAL_SCOPE_STORAGE_KEY,t.FOCUS_GOAL_SHEET_NAME_STORAGE_KEY,t.FOCUS_GOAL_TAG_NAME_STORAGE_KEY,t.FOCUS_GOALS_PER_SHEET_STORAGE_KEY,t.FOCUS_GOALS_PER_TAG_STORAGE_KEY,t.FOCUS_NUDGES_ENABLED_STORAGE_KEY,t.GREEDY_CLOUD_SYNC_STORAGE_KEY,t.NO_LOG_REMINDER_MINUTES_STORAGE_KEY,t.OVERWORK_ALERT_HOURS_STORAGE_KEY,r.POMODORO_STORAGE_KEY,s.SHEET_TAG_FILTERS_STORAGE_KEY,t.TAG_FILTER_MODE_STORAGE_KEY,t.THEME_MODE_STORAGE_KEY,i,t.TIME_FORMAT_STORAGE_KEY,t.TIMER_IN_TITLE_STORAGE_KEY,t.TIMER_SHOW_SECONDS_STORAGE_KEY,t.WEEKLY_FOCUS_TARGET_MINUTES_STORAGE_KEY,t.WEEK_STARTS_ON_STORAGE_KEY,t.WORK_HOURS_END_STORAGE_KEY,t.WORK_HOURS_START_STORAGE_KEY])try{let t=window.localStorage.getItem(n);null!==t&&(e[n]=t)}catch{}return e}],89497)},47149,e=>{"use strict";let t=new Set;e.s(["notify_cloud_db_sync",0,function(e){t.forEach(t=>{t(e)})},"subscribe_cloud_db_sync",0,function(e){return t.add(e),()=>{t.delete(e)}}])},27850,44171,13582,e=>{"use strict";var t=e.i(92629);function r(){try{let e=window.localStorage.getItem(t.CLOUD_SYNC_ENABLED_STORAGE_KEY);return null===e?"true"===t.CLOUD_SYNC_ENABLED_DEFAULT:"true"===e}catch{return!0}}e.s(["is_cloud_sync_enabled",0,r],44171);var s=e.i(32417);let i=!1;var n=e.i(89497),a=e.i(47149);function o(){if(!(0,s.is_supabase_configured)()||!r())return;let e=(0,n.collect_ui_preferences_from_window)();0!==Object.keys(e).length&&((0,a.notify_cloud_db_sync)({phase:"syncing",message:"Syncing settings to cloud…"}),fetch("/api/ui-preferences",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({preferences:e})}).then(async e=>{if(!e.ok)throw Error((await e.json().catch(()=>({}))).error??"Settings sync failed");(0,a.notify_cloud_db_sync)({phase:"success",message:"Settings synced"})}).catch(e=>{(0,a.notify_cloud_db_sync)({phase:"error",message:e instanceof Error?e.message:"Settings sync failed"})}))}let l=0;function u(){return l>0}async function c(e){l+=1;try{return await e()}finally{0==(l-=1)&&i&&(i=!1,1)&&o()}}e.s(["is_ui_preferences_merge_in_progress",0,u,"with_ui_preferences_merge_guard",0,c],13582);let h=null;e.s(["schedule_ui_preferences_cloud_sync",0,function(){if((0,s.is_supabase_configured)()&&r()){if(u())return void(i=!0);null!==h&&clearTimeout(h),h=setTimeout(()=>{h=null,o()},800)}}],27850)},34869,e=>{"use strict";var t=e.i(27850);e.s(["create_ui_preference_store",0,function(e){let{default_value:r,is_valid:s,storage_key:i}=e,n=new Set,a=()=>{try{let e=window.localStorage.getItem(i);if(null!==e&&s(e))return e}catch{}return r};return{storage_key:i,default_value:r,is_valid:s,read:a,write:e=>{try{window.localStorage.setItem(i,e),(0,t.schedule_ui_preferences_cloud_sync)()}catch{}},subscribe:e=>(n.add(e),()=>{n.delete(e)}),notify:()=>{n.forEach(e=>{e()})},get_snapshot:a,get_server_snapshot:()=>r}}])},10464,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.THEME_MODE_STORAGE_KEY,default_value:r.THEME_MODE_DEFAULT,is_valid:e=>"light"===e||"dark"===e||"system"===e});e.s(["theme_mode_preference",0,s])},70223,e=>{"use strict";e.s(["resolve_theme_mode_to_theme",0,function(e){return"light"===e||"dark"===e?e:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}])},61834,e=>{"use strict";e.s(["write_document_preference_cookies",0,function(e){if("u"<typeof document)return;let t="path=/; max-age=31536000; SameSite=Lax";void 0!==e.theme_mode&&(document.cookie=`stt-theme-mode=${e.theme_mode}; ${t}`),void 0!==e.theme&&(document.cookie=`stt-theme=${e.theme}; ${t}`),void 0!==e.palette&&(document.cookie=`stt-palette=${e.palette}; ${t}`),void 0!==e.compact_lists&&(document.cookie=`stt-compact-lists=${e.compact_lists?"true":"false"}; ${t}`)}],61834)},53602,32418,e=>{"use strict";var t=e.i(95427),r=e.i(39411),s=e.i(17798),i=e.i(10464),n=e.i(92629);let a={teal:"default",blue:"ocean",violet:"midnight",rose:"warm",amber:"warm",emerald:"forest"};function o(e,t){if(void 0!==e&&n.COLOR_PALETTE_VALUES.includes(e))return e;if(void 0!==t){let e=a[t];if(void 0!==e)return e}return n.COLOR_PALETTE_DEFAULT}function l(){try{return o(window.localStorage.getItem(n.COLOR_PALETTE_STORAGE_KEY)??void 0,window.localStorage.getItem(n.ACCENT_COLOR_STORAGE_KEY)??void 0)}catch{return n.COLOR_PALETTE_DEFAULT}}e.s(["read_stored_color_palette_from_window",0,l,"resolve_stored_color_palette",0,o],32418);var u=e.i(70223),c=e.i(61834),h=e.i(72550),d=e.i(38633);e.s(["apply_ui_preferences_dom_from_window",0,function(){let e,a;try{let e=window.localStorage.getItem(h.COMPACT_LISTS_STORAGE_KEY);("true"===e||"false"===e)&&(0,r.apply_compact_lists)("true"===e)}catch{}try{let e=window.localStorage.getItem(n.THEME_MODE_STORAGE_KEY);if(null!==e&&i.theme_mode_preference.is_valid(e))(0,s.apply_theme)((0,u.resolve_theme_mode_to_theme)(e));else{let e=window.localStorage.getItem(d.THEME_STORAGE_KEY);("light"===e||"dark"===e)&&(0,s.apply_theme)(e)}}catch{}(0,t.apply_color_palette)(l()),e=i.theme_mode_preference.read(),a="true"===window.localStorage.getItem(h.COMPACT_LISTS_STORAGE_KEY),(0,c.write_document_preference_cookies)({theme_mode:e,theme:(0,u.resolve_theme_mode_to_theme)(e),palette:l(),compact_lists:a})}],53602)},8307,11184,e=>{"use strict";e.s(["apply_ui_preferences_record",0,function(e){for(let[t,r]of Object.entries(e))try{window.localStorage.setItem(t,r)}catch{}}],8307);var t=e.i(34869),r=e.i(92629);let s=new Set(r.ACCENT_COLOR_VALUES),i=(0,t.create_ui_preference_store)({storage_key:r.ACCENT_COLOR_STORAGE_KEY,default_value:r.ACCENT_COLOR_DEFAULT,is_valid:e=>s.has(e)});e.s(["accent_color_preference",0,i],11184)},50994,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.CHECK_IN_FORM_COLLAPSED_STORAGE_KEY,default_value:r.CHECK_IN_FORM_COLLAPSED_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["check_in_form_collapsed_preference",0,s])},65742,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_STORAGE_KEY,default_value:r.CLEAR_TAG_FILTERS_ON_SHEET_CHANGE_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["clear_tag_filters_on_sheet_change_preference",0,s])},2540,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=new Set(r.COLOR_PALETTE_VALUES),i=(0,t.create_ui_preference_store)({storage_key:r.COLOR_PALETTE_STORAGE_KEY,default_value:r.COLOR_PALETTE_DEFAULT,is_valid:e=>s.has(e)});e.s(["color_palette_preference",0,i])},97026,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.CONFIRM_BEFORE_CHECKOUT_STORAGE_KEY,default_value:r.CONFIRM_BEFORE_CHECKOUT_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["confirm_before_checkout_preference",0,s])},36405,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.CONFIRM_DESTRUCTIVE_ACTIONS_STORAGE_KEY,default_value:r.CONFIRM_DESTRUCTIVE_ACTIONS_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["confirm_destructive_actions_preference",0,s])},68462,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.DEFAULT_REPORTING_RANGE_STORAGE_KEY,default_value:r.DEFAULT_REPORTING_RANGE_DEFAULT,is_valid:e=>"none"===e||"today"===e||"week"===e});e.s(["default_reporting_range_preference",0,s])},1997,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.DEFAULT_REPORTING_SORT_STORAGE_KEY,default_value:r.DEFAULT_REPORTING_SORT_DEFAULT,is_valid:e=>"duration"===e||"name"===e||"entry_count"===e||"active_first"===e});e.s(["default_reporting_sort_preference",0,s])},8492,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.DURATION_FORMAT_STORAGE_KEY,default_value:r.DURATION_FORMAT_DEFAULT,is_valid:e=>"humanized"===e||"clock"===e||"decimal"===e});e.s(["duration_format_preference",0,s])},4874,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.ENTRY_LIST_SORT_STORAGE_KEY,default_value:r.ENTRY_LIST_SORT_DEFAULT,is_valid:e=>"newest"===e||"oldest"===e||"duration"===e||"description"===e});e.s(["entry_list_sort_preference",0,s])},410,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.GREEDY_CLOUD_SYNC_STORAGE_KEY,default_value:r.GREEDY_CLOUD_SYNC_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["greedy_cloud_sync_preference",0,s])},62796,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.TAG_FILTER_MODE_STORAGE_KEY,default_value:r.TAG_FILTER_MODE_DEFAULT,is_valid:e=>"all"===e||"any"===e});e.s(["tag_filter_mode_preference",0,s])},56716,e=>{"use strict";var t=e.i(34869);let r=["all","pinned"],s=(0,t.create_ui_preference_store)({storage_key:"super-time-tracker-today-focus-scope",default_value:"all",is_valid:e=>r.includes(e)});e.s(["today_scope_preference",0,s],56716)},97891,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.TIME_FORMAT_STORAGE_KEY,default_value:r.TIME_FORMAT_DEFAULT,is_valid:e=>"12h"===e||"24h"===e});e.s(["time_format_preference",0,s])},16967,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.TIMER_IN_TITLE_STORAGE_KEY,default_value:r.TIMER_IN_TITLE_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["timer_in_title_preference",0,s])},60935,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.TIMER_SHOW_SECONDS_STORAGE_KEY,default_value:r.TIMER_SHOW_SECONDS_DEFAULT,is_valid:e=>"true"===e||"false"===e});e.s(["timer_show_seconds_preference",0,s])},57853,e=>{"use strict";var t=e.i(34869),r=e.i(92629);let s=(0,t.create_ui_preference_store)({storage_key:r.WEEK_STARTS_ON_STORAGE_KEY,default_value:r.WEEK_STARTS_ON_DEFAULT,is_valid:e=>"monday"===e||"sunday"===e});e.s(["week_starts_on_preference",0,s])},78539,e=>{"use strict";let t=new Set;e.s(["notify_compact_lists_subscribers",0,function(){t.forEach(e=>{e()})},"subscribe_compact_lists",0,function(e){return t.add(e),()=>{t.delete(e)}}])},98425,86580,e=>{"use strict";let t=[],r=null;function s(){r=null}e.s(["EMPTY_SHEET_TAG_FILTER",0,t,"get_stable_sheet_tag_filter_snapshot",0,function(e,s){let i=s.join("\0");if(null!==r&&r.sheet_name===e&&r.tags_key===i)return r.snapshot;let n=0===s.length?t:Object.freeze([...s]);return r={sheet_name:e,tags_key:i,snapshot:n},n},"reset_sheet_tag_filter_snapshot_cache",0,s],86580);let i=new Set;e.s(["notify_sheet_tag_filters_subscribers",0,function(){s(),i.forEach(e=>{e()})},"subscribe_sheet_tag_filters",0,function(e){return i.add(e),()=>{i.delete(e)}}],98425)},35434,e=>{"use strict";let t=new Set;e.s(["notify_theme_subscribers",0,function(){t.forEach(e=>{e()})},"subscribe_theme",0,function(e){return t.add(e),()=>{t.delete(e)}}])},60609,e=>{"use strict";let t="stt-ui-preferences-applied";e.s(["UI_PREFERENCES_APPLIED_EVENT",0,t,"dispatch_ui_preferences_applied_event",0,function(){window.dispatchEvent(new Event(t))}])},28274,18324,76670,76709,e=>{"use strict";var t=e.i(53602),r=e.i(8307),s=e.i(11184),i=e.i(50994),n=e.i(65742),a=e.i(2540),o=e.i(97026),l=e.i(36405),u=e.i(68462),c=e.i(1997),h=e.i(8492),d=e.i(4874),f=e.i(410),p=e.i(62796),g=e.i(56716),_=e.i(10464),m=e.i(97891),y=e.i(16967),b=e.i(60935),w=e.i(57853),v=e.i(78539),E=e.i(98425),T=e.i(35434),k=e.i(32418),S=e.i(60609),A=e.i(92629);function O(e){(0,r.apply_ui_preferences_record)(e);let O=(0,k.resolve_stored_color_palette)(e[A.COLOR_PALETTE_STORAGE_KEY],e[A.ACCENT_COLOR_STORAGE_KEY]);try{window.localStorage.setItem(A.COLOR_PALETTE_STORAGE_KEY,O),void 0!==e[A.COLOR_PALETTE_STORAGE_KEY]&&(window.localStorage.removeItem(A.ACCENT_COLOR_STORAGE_KEY),document.documentElement.removeAttribute("data-accent"))}catch{}(0,t.apply_ui_preferences_dom_from_window)(),s.accent_color_preference.notify(),i.check_in_form_collapsed_preference.notify(),n.clear_tag_filters_on_sheet_change_preference.notify(),a.color_palette_preference.notify(),o.confirm_before_checkout_preference.notify(),l.confirm_destructive_actions_preference.notify(),u.default_reporting_range_preference.notify(),c.default_reporting_sort_preference.notify(),h.duration_format_preference.notify(),d.entry_list_sort_preference.notify(),f.greedy_cloud_sync_preference.notify(),p.tag_filter_mode_preference.notify(),g.today_scope_preference.notify(),_.theme_mode_preference.notify(),m.time_format_preference.notify(),y.timer_in_title_preference.notify(),b.timer_show_seconds_preference.notify(),w.week_starts_on_preference.notify(),(0,v.notify_compact_lists_subscribers)(),(0,T.notify_theme_subscribers)(),(0,E.notify_sheet_tag_filters_subscribers)(),(0,S.dispatch_ui_preferences_applied_event)()}e.s(["apply_ui_preferences_from_record",0,O],18324);var R=e.i(89497),C=e.i(44171);let I="super-time-tracker-db-merged-session";function P(){try{sessionStorage.setItem(I,"1")}catch{}}e.s(["clear_tracker_db_merged_this_browser_session",0,function(){try{sessionStorage.removeItem(I)}catch{}},"has_tracker_db_merged_this_browser_session",0,function(){try{return"1"===sessionStorage.getItem(I)}catch{return!1}},"mark_tracker_db_merged_this_browser_session",0,P],76670);var L=e.i(47149);let j=new Set;function U(){j.forEach(e=>{e()})}e.s(["notify_tracker_state_sync",0,U,"subscribe_tracker_state_sync",0,function(e){return j.add(e),()=>{j.delete(e)}}],76709);var N=e.i(13582);async function $(e={}){if(!(0,C.is_cloud_sync_enabled)())return;let r=e.action??"push";(0,L.notify_cloud_db_sync)({phase:"syncing",message:"pull"===r?"Pulling from cloud…":"Syncing to cloud…"});try{!0===e.merge_on_load&&await (0,N.with_ui_preferences_merge_guard)(async()=>{let e=(0,R.collect_ui_preferences_from_window)(),t=await fetch("/api/sync/merge-on-load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({preferences:e})});if(!t.ok){let e=await t.json();throw Error(e.error??"Merge on load failed")}let r=await t.json();O(r.preferences??{})});let s=!0===e.merge_on_load&&"push"===r?"/api/sync/push?verbatim=true":`/api/sync/${r}`,i=await fetch(s,{method:"POST"});if(!i.ok){let e=await i.json();throw Error(e.error??`${r} failed`)}!0===e.merge_on_load&&P(),(0,L.notify_cloud_db_sync)({phase:"success",message:"pull"===r?"Cloud pull complete":"Cloud sync complete"}),("pull"===r||!0===e.merge_on_load)&&U(),!0===e.merge_on_load?(e.on_complete?.(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{(0,t.apply_ui_preferences_dom_from_window)()})})):e.on_complete?.()}catch(t){let e=t instanceof Error?t.message:String(t);throw(0,L.notify_cloud_db_sync)({phase:"error",message:e}),t}}e.s(["run_tracker_db_cloud_sync",0,$],28274)},46549,e=>{"use strict";let t=new Set,r="Settings saved",s=null,i=r;e.s(["SETTINGS_SAVED_DEFAULT_MESSAGE",0,r,"notify_settings_saved",0,function(e=r){i=e,null!==s&&clearTimeout(s),s=setTimeout(()=>{s=null;let e=i;t.forEach(t=>{t(e)})},200)},"subscribe_settings_saved",0,function(e){return t.add(e),()=>{t.delete(e)}}])},81553,e=>{"use strict";var t=e.i(27850),r=e.i(38633);e.s(["write_stored_theme",0,function(e){try{window.localStorage.setItem(r.THEME_STORAGE_KEY,e),(0,t.schedule_ui_preferences_cloud_sync)()}catch{}}])}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,22482,e=>{"use strict";var t=e.i(54710),n=e.i(45958),r=e.i(29158),s=e.i(14260),a=e.i(52663),i=e.i(52405),l=e.i(69472),o=e.i(84545),c=e.i(50937),d=e.i(83327);let m=e=>"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.name&&"string"==typeof e.description;var u=e.i(35877);async function p(e){if("none"===e.provider)throw Error("AI suggestion provider is disabled");let t="true"===u.debug_logging_preference.read(),n=Date.now(),r={provider:e.provider,context:e.context,notes:e.notes,debug_logging:t};t&&console.info("[ai-suggestion] client request start",{provider:e.provider,context_length:e.context.length,notes_length:e.notes.length});try{let s=await fetch("/api/entry/suggest-description",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,api_key:e.api_key})});if(!s.ok){let r=await s.json().catch(()=>({}));throw t&&console.warn("[ai-suggestion] client request failed",{provider:e.provider,status:s.status,elapsed_ms:Date.now()-n,error:r.error??"Failed to suggest description"}),Error(r.error??"Failed to suggest description")}let a=await s.json(),i=a.description?.trim()??"";if(0===i.length)throw Error("Suggestion was empty");return t&&console.info("[ai-suggestion] client request success",{provider:e.provider,elapsed_ms:Date.now()-n,description_length:i.length}),i}catch(r){throw t&&console.error("[ai-suggestion] client request error",{provider:e.provider,elapsed_ms:Date.now()-n,error:r instanceof Error?r.message:String(r)}),r}}function _(e){try{window.localStorage.setItem("super-time-tracker-entry-templates",JSON.stringify(e))}catch{}}function h({known_tags:e,on_submit:n,is_pending:u}){let[g,x]=(0,r.useState)([]),[f,b]=(0,r.useState)(""),[y,v]=(0,r.useState)(""),[w,j]=(0,r.useState)(""),[N,k]=(0,r.useState)(null),[S,E]=(0,r.useState)(!1),$=(0,r.useSyncExternalStore)(o.entry_suggestion_provider_preference.subscribe,o.entry_suggestion_provider_preference.get_snapshot,o.entry_suggestion_provider_preference.get_server_snapshot),C=(0,r.useSyncExternalStore)(d.openai_api_key_preference.subscribe,d.openai_api_key_preference.get_snapshot,d.openai_api_key_preference.get_server_snapshot),T=(0,r.useSyncExternalStore)(l.claude_api_key_preference.subscribe,l.claude_api_key_preference.get_snapshot,l.claude_api_key_preference.get_server_snapshot),D=(0,r.useSyncExternalStore)(c.google_ai_api_key_preference.subscribe,c.google_ai_api_key_preference.get_snapshot,c.google_ai_api_key_preference.get_server_snapshot),M="openai"===$?C:"claude"===$?T:"google_ai"===$?D:"",I="none"!==$&&M.trim().length>0;(0,r.useEffect)(()=>{x(function(){try{let e=window.localStorage.getItem("super-time-tracker-entry-templates");if(null===e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(m)}catch{return[]}}())},[]);let A=(0,r.useMemo)(()=>g.find(e=>e.id===f)??null,[g,f]),L=async()=>{if(I){E(!0),k(null);try{let e=await p({provider:$,api_key:M,context:y,notes:""});v(e)}catch(e){k(e instanceof Error?e.message:String(e))}finally{E(!1)}}};return(0,t.jsxs)("form",{className:"flex flex-col gap-2 border border-panel-border bg-panel p-[1.1rem] shadow-sm",onSubmit:e=>{e.preventDefault();let t=y.trim();if(0===t.length)return;let r=w.trim();n({description:t,...r.length>0?{at:r}:{}}),v(""),j("")},children:[(0,t.jsx)("label",{className:"text-[0.85rem] text-muted",htmlFor:"check-in-description",children:"What are you working on?"}),(0,t.jsxs)("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto_auto]",children:[(0,t.jsxs)("select",{className:(0,i.get_input_class_name)(),value:f,disabled:u||0===g.length,onChange:e=>{let t=e.target.value;b(t);let n=g.find(e=>e.id===t)??null;null!==n&&v(n.description)},children:[(0,t.jsx)("option",{value:"",children:0===g.length?"No templates":"Use a template…"}),g.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost"),disabled:u||0===y.trim().length,onClick:()=>{let e=y.trim();if(0===e.length)return;let t=e.slice(0,40),n=window.prompt("Template name",t.length>0?t:"New template");if(null===n)return;let r=n.trim();if(0===r.length)return;let s="u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,a=[...g,{id:s,name:r,description:e}];x(a),b(s),_(a)},children:"Save template"}),(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost"),disabled:u||null===A,onClick:()=>{if(null===A)return;let e=g.filter(e=>e.id!==A.id);x(e),b(""),_(e)},children:"Delete template"})]}),(0,t.jsxs)("div",{className:`grid gap-2 max-[860px]:grid-cols-1 ${I?"grid-cols-[minmax(0,1fr)_auto_auto]":"grid-cols-[minmax(0,1fr)_auto]"}`,children:[(0,t.jsx)(s.TagAutocompleteInput,{id:"check-in-description",value:y,known_tags:e,placeholder:"e.g. crafting something @design",disabled:u,autoFocus:!0,on_change:v}),I?(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost"),disabled:u||S,onClick:()=>void L(),title:"Suggest description with AI",children:S?"Suggesting…":"Suggest"}):null,(0,t.jsx)("button",{type:"submit",className:(0,a.get_button_class_name)("primary"),disabled:u||0===y.trim().length,children:"Check in"})]}),null!==N?(0,t.jsx)("p",{className:"m-0 text-[0.8rem] text-danger",children:N}):null,(0,t.jsxs)("label",{className:"text-[0.85rem] text-muted",htmlFor:"check-in-at",children:["Start time"," ",(0,t.jsx)("span",{className:"font-normal opacity-85",children:"(optional, natural language)"})]}),(0,t.jsx)("input",{id:"check-in-at",className:(0,i.get_input_class_name)(),value:w,onChange:e=>j(e.target.value),placeholder:"e.g. 30 minutes ago",disabled:u})]})}var g=e.i(50994);let x=(0,r.forwardRef)(function({known_tags:e,is_pending:n,on_submit:s,trailing:i},l){let o="true"===(0,r.useSyncExternalStore)(g.check_in_form_collapsed_preference.subscribe,g.check_in_form_collapsed_preference.get_snapshot,g.check_in_form_collapsed_preference.get_server_snapshot),[c,d]=(0,r.useState)(!o);return((0,r.useImperativeHandle)(l,()=>({expand_and_focus:()=>{d(!0),window.requestAnimationFrame(()=>{let e=document.getElementById("check-in-description");e instanceof HTMLElement&&e.focus()})}}),[]),o&&!c)?(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-3",children:[(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("primary"),disabled:n,onClick:()=>d(!0),children:"Check in"}),i]}):(0,t.jsx)(h,{known_tags:e,is_pending:n,on_submit:e=>{s(e),o&&d(!1)}})});var f=e.i(29539),b=e.i(32584),y=e.i(1238),v=e.i(83821),w=e.i(51703),j=e.i(74597),N=e.i(77130),k=e.i(56442),S=e.i(73228),E=e.i(56996),$=e.i(8654),C=e.i(76900),T=e.i(60145),D=e.i(26740),M=e.i(1800);function I({on_check_in_shortcut:e,has_running_timer:n=!1}){let s=(0,M.use_duration_format)(),a=(0,r.useSyncExternalStore)(E.focus_nudges_enabled_preference.subscribe,E.focus_nudges_enabled_preference.get_snapshot,E.focus_nudges_enabled_preference.get_server_snapshot),i=(0,r.useSyncExternalStore)(v.daily_focus_target_minutes_preference.subscribe,v.daily_focus_target_minutes_preference.get_snapshot,v.daily_focus_target_minutes_preference.get_server_snapshot),l=(0,r.useSyncExternalStore)(T.weekly_focus_target_minutes_preference.subscribe,T.weekly_focus_target_minutes_preference.get_snapshot,T.weekly_focus_target_minutes_preference.get_server_snapshot),o=(0,r.useSyncExternalStore)($.no_log_reminder_minutes_preference.subscribe,$.no_log_reminder_minutes_preference.get_snapshot,$.no_log_reminder_minutes_preference.get_server_snapshot),c=(0,r.useSyncExternalStore)(C.overwork_alert_hours_preference.subscribe,C.overwork_alert_hours_preference.get_snapshot,C.overwork_alert_hours_preference.get_server_snapshot),d=(0,r.useSyncExternalStore)(w.focus_goal_scope_preference.subscribe,w.focus_goal_scope_preference.get_snapshot,w.focus_goal_scope_preference.get_server_snapshot),m=(0,r.useSyncExternalStore)(j.focus_goal_sheet_name_preference.subscribe,j.focus_goal_sheet_name_preference.get_snapshot,j.focus_goal_sheet_name_preference.get_server_snapshot),u=(0,r.useSyncExternalStore)(N.focus_goal_tag_name_preference.subscribe,N.focus_goal_tag_name_preference.get_snapshot,N.focus_goal_tag_name_preference.get_server_snapshot),p=(0,r.useSyncExternalStore)(k.focus_goals_per_sheet_preference.subscribe,k.focus_goals_per_sheet_preference.get_snapshot,k.focus_goals_per_sheet_preference.get_server_snapshot),_=(0,r.useSyncExternalStore)(S.focus_goals_per_tag_preference.subscribe,S.focus_goals_per_tag_preference.get_snapshot,S.focus_goals_per_tag_preference.get_server_snapshot),[h,g]=(0,r.useState)(null),[x,f]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=()=>{try{let e=window.localStorage.getItem(D.POMODORO_STORAGE_KEY);if(null===e)return null;let t=JSON.parse(e).state;if(void 0===t||"running"!==t.status||null===t.deadline_at_ms)return null;let n=Math.max(0,t.deadline_at_ms-Date.now()),r=Math.floor(n/6e4),s=Math.floor(n%6e4/1e3);return{phase_label:"work"===t.phase?"Focus":"short_break"===t.phase?"Short break":"Long break",remaining_label:`${r.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}}catch{return null}},t=window.setTimeout(()=>{f(e())},0),n=window.setInterval(()=>{f(e())},1e3);return()=>{window.clearTimeout(t),window.clearInterval(n)}},[]),(0,r.useEffect)(()=>{if("true"!==a)return;let e=!1,t=async()=>{try{var t,n,r;let s=new URLSearchParams;s.set("scope",(t=d,n=m,r=u,"sheet"===t&&0===n.length||"tag"===t&&0===r.length?"global":t)),"sheet"===d&&m.length>0&&s.set("sheet",m),"tag"===d&&u.length>0&&s.set("tag",u);let a=await fetch(`/api/focus-nudges/status?${s.toString()}`);if(!a.ok)return;let i=await a.json();e||g(i)}catch{}};t();let n=window.setInterval(()=>{t()},6e4);return()=>{e=!0,window.clearInterval(n)}},[a,d,m,u]);let R=(0,r.useMemo)(()=>{if("true"!==a||null===h)return null;let{daily_minutes:e,weekly_minutes:t}=function(e){if("sheet"===e.scope&&e.sheet_name.length>0){let t=(0,y.parse_focus_goals_by_name)(e.per_sheet_json)[e.sheet_name];return void 0===t?{daily_minutes:null,weekly_minutes:null}:{daily_minutes:t.daily??e.global_daily,weekly_minutes:t.weekly??e.global_weekly}}if("tag"===e.scope&&e.tag_name.length>0){let t=(0,y.parse_focus_goals_by_name)(e.per_tag_json)[e.tag_name];return void 0===t?{daily_minutes:null,weekly_minutes:null}:{daily_minutes:t.daily??e.global_daily,weekly_minutes:t.weekly??e.global_weekly}}return{daily_minutes:e.global_daily,weekly_minutes:e.global_weekly}}({scope:d,sheet_name:m,tag_name:u,per_sheet_json:p,per_tag_json:_,global_daily:i,global_weekly:l});if(null===e||null===t)return{kind:"alert",tone:"info",title:A("daily",d,m,u),detail:"No goals configured yet for this scope. Set daily and weekly targets in Goal settings."};let r=6e4*Number.parseInt(e,10),g=6e4*Number.parseInt(t,10),x=36e5*Number.parseInt(c,10),f=Number.parseInt(o,10);return null!==h.activeTimerDurationMs&&h.activeTimerDurationMs>=x?{kind:"alert",tone:"warning",title:"Overwork alert",detail:`Current session is ${(0,b.format_duration)(h.activeTimerDurationMs,s)}. Consider a short break.`}:!n&&null!==h.minutesSinceLastLog&&h.minutesSinceLastLog>=f?{kind:"alert",tone:"warning",title:"Gentle reminder",detail:`No time logged for ${h.minutesSinceLastLog} min. Start a timer when you are back on task.`,show_check_in_shortcut:!0}:h.todayTrackedMs<r?{kind:"progress",scope:"daily",title:A("daily",d,m,u),tracked_ms:h.todayTrackedMs,target_ms:r}:h.weekTrackedMs<g?{kind:"progress",scope:"weekly",title:A("weekly",d,m,u),tracked_ms:h.weekTrackedMs,target_ms:g}:{kind:"alert",tone:"success",title:"Targets met",detail:"Daily and weekly focus goals are on track."}},[i,s,a,c,n,d,m,u,p,_,o,h,l]);if(null===R)return null;if("progress"===R.kind)return(0,t.jsx)(L,{scope:R.scope,title:R.title,tracked_ms:R.tracked_ms,target_ms:R.target_ms,duration_format:s,active_pomodoro:x});let F="warning"===R.tone?"mb-4 rounded-md border border-danger-border bg-danger-soft px-3 py-2.5 text-danger-text":"success"===R.tone?"mb-4 rounded-md border border-accent-border bg-accent-soft px-3 py-2.5 text-accent":"mb-4 rounded-md border border-panel-border bg-panel px-3 py-2.5 text-foreground";return(0,t.jsxs)("section",{className:F,"aria-live":"polite","aria-atomic":"true",children:[(0,t.jsx)("p",{className:"m-0 text-[0.85rem] font-semibold",children:R.title}),(0,t.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,t.jsx)("p",{className:"m-0 text-[0.82rem] leading-relaxed",children:R.detail}),R.show_check_in_shortcut&&void 0!==e?(0,t.jsx)("button",{type:"button",className:"cursor-pointer rounded border border-current bg-transparent px-2 py-1 text-[0.75rem] font-semibold",onClick:e,children:"Check in"}):null]})]})}function A(e,t,n,r){let s="daily"===e?"Relevant goal":"Weekly goal";return"sheet"===t&&n.length>0?`${s} \xb7 ${n}`:"tag"===t&&r.length>0?`${s} \xb7 @${r}`:s}function L({scope:e,title:r,tracked_ms:s,target_ms:a,duration_format:i,active_pomodoro:l}){let o=a>0?Math.min(100,s/a*100):0,c=Math.max(0,a-s);return(0,t.jsx)("section",{className:"mb-4 rounded-md border border-panel-border bg-panel px-4 py-3 shadow-sm","aria-label":r,"aria-live":"polite",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-stretch justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:r}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:["daily"===e?(0,t.jsx)(n.default,{href:"/settings/goals#focus-goals-nudges",className:"inline-flex h-6 w-6 items-center justify-center rounded border border-panel-border text-muted no-underline hover:bg-surface-hover hover:text-foreground","aria-label":"Open daily focus target settings",title:"Daily focus target settings",children:(0,t.jsx)(f.SettingsIcon,{})}):null,(0,t.jsxs)("p",{className:"m-0 font-mono text-[0.78rem] font-semibold text-accent",children:[Math.round(o),"%"]})]})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-baseline justify-between gap-3",children:[(0,t.jsxs)("p",{className:"m-0 font-mono text-[1.35rem] font-semibold leading-none text-foreground",children:[(0,b.format_duration)(s,i),(0,t.jsxs)("span",{className:"ml-1 text-[0.85rem] font-medium text-muted",children:["/ ",(0,b.format_duration)(a,i)]})]}),(0,t.jsxs)("p",{className:"m-0 text-[0.78rem] text-muted",children:[(0,b.format_duration)(c,i)," left ","daily"===e?"today":"this week"]})]}),(0,t.jsx)("div",{className:"mt-3 h-1.5 w-full overflow-hidden rounded-full bg-accent-soft",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:(0,t.jsx)("div",{className:"h-full rounded-full bg-accent transition-[width] duration-300",style:{width:`${o}%`}})})]}),null!==l?(0,t.jsxs)("aside",{className:"min-w-52 rounded-md border border-panel-border bg-surface-raised px-3 py-2.5",children:[(0,t.jsx)("p",{className:"m-0 text-[0.68rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Active Pomodoro"}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.82rem] font-semibold text-foreground",children:l.phase_label}),(0,t.jsx)("p",{className:"m-0 mt-1 font-mono text-[1.25rem] font-semibold leading-none text-accent",children:l.remaining_label})]}):null]})})}var R=e.i(71060),F=e.i(83391);function O(e,t,n){if(0===e.length)return null;let r=e.findIndex(e=>e.name===t),s=((-1===r?0:r)+("next"===n?1:-1)+e.length)%e.length;return e[s]?.name??null}var P=e.i(34995),U=e.i(53754),z=e.i(99211);function H({sheets:e,active_sheet_name:n,active_entry:s,is_pending:a,check_in_form_ref:i,active_entry_panel_ref:l,on_select_sheet:o,on_check_out:c}){let d=(0,R.useRouter)(),[m,u]=(0,r.useState)(!1),p=(0,U.use_check_out_action)(c),_=(0,r.useMemo)(()=>{let t=null!==s;return[{id:"help",label:"?",description:"Show keyboard shortcuts",key:"?",modifiers:["shift"],action:()=>{u(e=>!e)}},{id:"check-in",label:"C",description:"Check in (focus description)",key:"c",is_available:()=>!a&&!t,action:()=>{i.current?.expand_and_focus()}},{id:"check-out",label:"O",description:"Check out",key:"o",is_available:()=>!a&&t,action:()=>{p()}},{id:"edit-entry",label:"E",description:"Edit active entry",key:"e",is_available:()=>!a&&t,action:()=>{l.current?.start_edit()}},{id:"add-note",label:"N",description:"Add note to active entry",key:"n",is_available:()=>!a&&t,action:()=>{l.current?.start_add_note()}},{id:"pomodoro",label:"P",description:"Open Pomodoro",key:"p",is_available:()=>!a,action:()=>{d.push("/pomodoro")}},{id:"previous-sheet",label:"[",description:"Previous sheet",key:"[",is_available:()=>!a&&e.length>1,action:()=>{let t=O(e,n,"previous");null!==t&&t!==n&&o(t)}},{id:"next-sheet",label:"]",description:"Next sheet",key:"]",is_available:()=>!a&&e.length>1,action:()=>{let t=O(e,n,"next");null!==t&&t!==n&&o(t)}}]},[s,l,n,i,p,a,o,d,e]);return((0,z.use_document_keyboard_shortcuts)(_),m)?(0,t.jsx)(F.KeyboardShortcutsDialog,{sections:[...(0,P.get_app_keyboard_shortcut_sections)(),{title:"Tracker",entries:[{label:"C",description:"Check in (focus description)"},{label:"O",description:"Check out"},{label:"E",description:"Edit active entry description"},{label:"N",description:"Add note to active entry"},{label:"P",description:"Open Pomodoro"},{label:"[",description:"Previous sheet"},{label:"]",description:"Next sheet"}]}],on_close:()=>u(!1)}):null}var q=e.i(18774),B=e.i(31113),G=e.i(72550);function J(){try{let e=window.localStorage.getItem(G.SHEET_TAG_FILTERS_STORAGE_KEY);if(null===e)return{};let t=JSON.parse(e);if(null===t||"object"!=typeof t)return{};return t}catch{return{}}}function W(e){let t=J()[e]??[],n=[],r=new Set;for(let e of t)try{let t=(0,B.normalize_stored_tag)(e);r.has(t)||(r.add(t),n.push(t))}catch{continue}return n}var K=e.i(86580);function Y(e){return(0,K.get_stable_sheet_tag_filter_snapshot)(e,W(e))}function V(){return K.EMPTY_SHEET_TAG_FILTER}var Q=e.i(98425),Z=e.i(27850);function X(e,t){let n=J();0===t.length?delete n[e]:n[e]=t;try{window.localStorage.setItem(G.SHEET_TAG_FILTERS_STORAGE_KEY,JSON.stringify(n)),(0,Z.schedule_ui_preferences_cloud_sync)()}catch{}(0,Q.notify_sheet_tag_filters_subscribers)()}function ee(e,t){try{return(0,B.normalize_stored_tag)(e)===(0,B.normalize_stored_tag)(t)}catch{return!1}}var et=e.i(62796);function en(){return(0,r.useSyncExternalStore)(et.tag_filter_mode_preference.subscribe,et.tag_filter_mode_preference.get_snapshot,et.tag_filter_mode_preference.get_server_snapshot)}function er({sheet_name:e,sheet_tags:n}){let s=en(),i=(0,r.useSyncExternalStore)(Q.subscribe_sheet_tag_filters,()=>Y(e),V);if((0,r.useEffect)(()=>{!function(e,t){let n=W(e);if(0===n.length)return;let r=n.filter(e=>t.some(t=>ee(e,t)));r.length!==n.length&&X(e,r)}(e,n.map(e=>e.name))},[e,n]),0===n.length)return null;let l=i.length>0;return(0,t.jsxs)("div",{role:"group","aria-label":"Filter by tag",className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,t.jsx)("h2",{className:"m-0 shrink-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em]",children:"Filter by tag"}),(0,t.jsx)("p",{className:"m-0 shrink-0 text-[0.8rem] text-muted",children:"any"===s?"Show entries that include any selected tag.":"Show entries that include every selected tag."}),(0,t.jsxs)("div",{className:"ml-auto flex min-w-0 flex-wrap justify-end gap-1",children:[n.map(n=>{let r=i.some(e=>ee(e,n.name));return(0,t.jsxs)("button",{type:"button",className:`${(0,a.get_button_class_name)("ghost","small")} ${r?"border-accent-border bg-accent-soft text-foreground":""}`,"aria-pressed":r,onClick:()=>{var t;let r,s;return t=n.name,r=(0,B.normalize_stored_tag)(t),void((s=W(e)).some(e=>ee(e,r))?X(e,s.filter(e=>!ee(e,r))):X(e,[...s,r]))},children:[(0,q.format_display_tag)(n.name),(0,t.jsxs)("span",{className:"ml-1 font-normal text-muted",children:["(",n.entryCount,")"]})]},n.name)}),l?(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost","small"),onClick:()=>X(e,[]),children:"Clear filter"}):null]})]})}let es="inline-flex shrink-0 cursor-pointer items-center gap-1.5";function ea({checked:e,disabled:n=!1,indeterminate:s=!1,nested:a=!1,on_change:i,label:l,aria_label:o,className:c}){let d=(0,r.useRef)(null);(0,r.useEffect)(()=>{null!==d.current&&(d.current.indeterminate=s)},[s]);let m=void 0===c?es:`${es} ${c}`,u=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:d,type:"checkbox",className:"peer absolute m-0 h-px w-px overflow-hidden opacity-0",checked:e,disabled:n,"aria-label":a&&void 0===l?o:void 0,onChange:i}),(0,t.jsx)("span",{className:'relative block h-[0.85rem] w-[0.85rem] shrink-0 rounded-[0.2rem] border border-panel-border bg-input-bg box-border transition-[background-color,border-color] duration-150 peer-checked:border-accent peer-checked:bg-accent peer-indeterminate:border-accent peer-indeterminate:bg-accent peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-input-focus-border peer-focus-visible:outline-offset-1 peer-disabled:cursor-not-allowed peer-disabled:opacity-55 after:absolute after:left-1/2 after:top-[44%] after:hidden after:h-[0.28rem] after:w-[0.45rem] after:-translate-x-1/2 after:-translate-y-[60%] after:rotate-[-45deg] after:border-b-[1.5px] after:border-l-[1.5px] after:border-accent-text-on after:content-[""] peer-checked:after:block peer-indeterminate:after:top-1/2 peer-indeterminate:after:block peer-indeterminate:after:h-[1.5px] peer-indeterminate:after:w-[0.45rem] peer-indeterminate:after:-translate-x-1/2 peer-indeterminate:after:-translate-y-1/2 peer-indeterminate:after:rotate-0 peer-indeterminate:after:border-0 peer-indeterminate:after:bg-accent-text-on',"aria-hidden":"true"})]});return a?(0,t.jsx)("span",{className:m,children:u}):(0,t.jsxs)("label",{className:m,children:[u,void 0!==l?(0,t.jsx)("span",{className:"select-none text-[0.8rem] leading-tight text-muted",children:l}):null]})}var ei=e.i(14974),el=e.i(37399),eo=e.i(25204);let ec="block w-full cursor-pointer rounded-[0.45rem] border-0 bg-transparent px-2.5 py-1.5 text-left font-inherit text-[0.85rem] text-inherit hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-55";function ed({current_sheet_name:e,sheets:n,is_pending:s,on_edit:a,on_add_note:i,on_show_add_note_form:l,on_revise_description_ai:o,can_revise_description_ai:c=!1,on_resume:d,entry_is_active:m=!1,on_delete:u,on_move:p}){let _=n.find(t=>t.name===e),h=m||_?.hasActiveEntry===!0&&!m,g=n.filter(t=>t.name!==e),[x,f]=(0,r.useState)(!1),b=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!x)return;let e=e=>{null===b.current||b.current.contains(e.target)||f(!1)};return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[x]);let y=()=>{f(!1)};return(0,eo.use_escape_to_cancel)(y,x),(0,t.jsxs)("div",{className:"relative shrink-0",ref:b,children:[(0,t.jsx)("button",{type:"button",className:"inline-flex cursor-pointer appearance-none items-center justify-center rounded-none border-0 bg-transparent p-0.5 text-muted shadow-none hover:opacity-75 focus-visible:outline-2 focus-visible:outline-input-focus-border focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-55","aria-label":"Entry actions","aria-expanded":x,"aria-haspopup":"menu",disabled:s,onClick:()=>f(e=>!e),children:(0,t.jsx)(el.HamburgerIcon,{})}),x?(0,t.jsxs)("ul",{className:"absolute right-0 top-full z-10 mt-1.5 min-w-56 list-none rounded-md border border-panel-border bg-panel p-1.5 shadow-md",role:"menu",children:[(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:s,onClick:()=>{y(),a()},children:"Edit times"})}),void 0!==l||void 0!==i?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:s,onClick:()=>{if(y(),void 0!==l)return void l();let e=function(){let e=window.prompt("Add note","");if(null===e)return null;let t=e.trim();return 0===t.length?null:t}();null!==e&&void 0!==i&&i(e)},children:"Add note"})}):null,void 0!==o?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:s||!c,title:c?"Revise with AI":"Configure provider and key in Settings → AI suggestions",onClick:()=>{y(),o()},children:"Revise description with AI"})}):null,void 0!==d?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:s||h,title:h?m?"This entry is already active":"Another entry is active on this sheet":void 0,onClick:()=>{y(),d()},children:"Resume"})}):null,(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("p",{className:"m-0 px-2.5 py-0.5 text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted",children:"Move to sheet"})}),0===g.length?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:!0,children:"No other sheets"})}):g.map(e=>(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:`${ec} pl-4`,role:"menuitem",disabled:s||e.hasActiveEntry,title:e.hasActiveEntry?"That sheet already has an active entry":void 0,onClick:()=>{y(),p(e.name)},children:e.name})},e.name)),(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:`${ec} text-danger`,role:"menuitem",disabled:s,onClick:()=>{y(),u()},children:"Delete"})})]}):null]})}function em({rotated:e=!1,className:n=""}){return(0,t.jsx)("svg",{className:`h-3 w-3 shrink-0 transition-transform duration-150 ${e?"rotate-90":""} ${n}`.trim(),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m9 18 6-6-6-6"})})}var eu=e.i(75899);function ep({initial_text:e,is_pending:n,inline:s=!1,on_save:l,on_cancel:o}){let[c,d]=(0,r.useState)(e);(0,eo.use_escape_to_cancel)(o);let m=Math.min(6,Math.max(2,e.split("\n").length)),u=s?`${(0,i.get_input_class_name)()} min-h-10 w-full resize-y text-xs leading-snug`:`${(0,i.get_input_class_name)()} min-h-10 w-full resize-y text-[0.85rem] leading-snug`;return(0,t.jsxs)("form",{className:"flex w-full flex-col gap-1.5",onSubmit:e=>{e.preventDefault();let t=c.trim();0!==t.length&&l(t)},onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("textarea",{className:u,value:c,rows:m,disabled:n,onChange:e=>d(e.target.value)}),(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost"),disabled:n,onClick:o,children:"Cancel"}),(0,t.jsx)("button",{type:"submit",className:(0,a.get_button_class_name)("ghost"),disabled:n||0===c.trim().length,children:"Save"})]})]})}function e_(){return(0,t.jsxs)("svg",{className:"h-[0.85rem] w-[0.85rem]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M12 20h9"}),(0,t.jsx)("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function eh(){return(0,t.jsxs)("svg",{className:"h-[0.85rem] w-[0.85rem]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3 6h18"}),(0,t.jsx)("path",{d:"M8 6V4h8v2"}),(0,t.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),(0,t.jsx)("path",{d:"M10 11v6"}),(0,t.jsx)("path",{d:"M14 11v6"})]})}var eg=e.i(35923);let ex="inline-flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-[0.35rem] border-0 bg-transparent p-0 text-muted hover:bg-surface-hover hover:text-foreground disabled:cursor-not-allowed disabled:opacity-55";function ef({notes:e,variant:n="panel",in_bar:s=!1,is_pending:a=!1,on_edit_note:i,on_delete_note:l}){let o=(0,eg.use_time_format)(),[c,d]=(0,r.useState)(null),[m,u]=(0,r.useState)("panel"===n&&!s);if(0===e.length)return null;let p=[...e].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),_="inline"===n,h="panel"===n&&s,g=m||null!==c,x=_?`${e.length} ${1===e.length?"note":"notes"}`:`Notes (${e.length})`,f=[_?"m-0 w-full p-0":"border-t border-accent-border pt-3.5",s&&!_?"border-[color-mix(in_srgb,var(--accent-border)_65%,var(--panel-border))]":"",h&&g?"flex min-h-0 flex-1 flex-col":h?"flex shrink-0 flex-col":""].filter(Boolean).join(" "),b=g?"mt-1.5":"hidden",y=_?`m-0 flex list-none flex-col gap-1.5 overflow-visible p-0 compact:gap-0.5 ${b}`:h?`m-0 grid min-h-0 flex-1 list-none auto-rows-fr grid-cols-2 gap-2 p-0 max-[860px]:grid-cols-1 ${b}`:`m-0 grid list-none grid-cols-2 gap-2 p-0 max-[860px]:grid-cols-1 ${b}`,v=_?"flex flex-col gap-0.5 rounded-sm border border-panel-border bg-ghost-bg px-2 py-1.5 compact:rounded-none compact:px-1.5 compact:py-1":h?"flex min-h-0 flex-col justify-center gap-0.5 rounded-sm border border-panel-border bg-[color-mix(in_srgb,var(--panel)_55%,var(--background))] px-2.5 py-2":"flex flex-col gap-0.5 rounded-sm border border-panel-border bg-[color-mix(in_srgb,var(--panel)_55%,var(--background))] px-2.5 py-2",w=e=>void 0===i&&void 0===l?null:(0,t.jsxs)("div",{className:"flex shrink-0 gap-0.5",children:[void 0!==i?(0,t.jsx)("button",{type:"button",className:ex,"aria-label":"Edit note",title:"Edit note",disabled:a,onClick:t=>{var n;t.stopPropagation(),n=e.timestamp,u(!0),d(n)},children:(0,t.jsx)(e_,{})}):null,void 0!==l?(0,t.jsx)("button",{type:"button",className:`${ex} hover:text-danger`,"aria-label":"Delete note",title:"Delete note",disabled:a,onClick:t=>{var n;t.stopPropagation(),c===(n=e.timestamp)&&d(null),l?.(n)},children:(0,t.jsx)(eh,{})}):null]});return(0,t.jsxs)("section",{className:f,"aria-label":"Entry notes",children:[(0,t.jsxs)("button",{type:"button",className:_?"inline-flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 font-inherit text-xs font-medium normal-case tracking-normal text-muted hover:text-foreground":"inline-flex cursor-pointer items-center gap-1.5 border-0 bg-transparent px-0 py-0.5 font-inherit text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted hover:text-foreground","aria-expanded":g,onClick:e=>{e.stopPropagation(),null===c&&u(e=>!e)},children:[(0,t.jsx)(em,{rotated:g}),(0,t.jsx)("span",{children:x})]}),(0,t.jsx)("ul",{className:y,children:p.map((e,n)=>{let r=c===e.timestamp;return(0,t.jsx)("li",{className:v,children:r?(0,t.jsx)(ep,{initial_text:e.text,inline:_,is_pending:a,on_cancel:()=>d(null),on_save:t=>{var n;return n=e.timestamp,void(i?.(n,t),d(null))}}):_?(0,t.jsxs)("div",{className:"flex w-full items-start justify-between gap-1.5",children:[(0,t.jsxs)("p",{className:"m-0 flex min-w-0 flex-1 items-baseline gap-1.5 text-xs leading-snug text-foreground compact:text-[0.72rem]",children:[(0,t.jsx)("time",{className:"shrink-0 font-mono text-[0.68rem] text-muted",dateTime:e.timestamp,children:(0,eu.format_time)(e.timestamp,o)}),(0,t.jsx)("span",{className:"min-w-0 overflow-wrap-anywhere whitespace-pre-wrap",children:e.text})]}),w(e)]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex w-full items-start justify-between gap-1.5",children:[(0,t.jsx)("time",{className:"font-mono text-[0.72rem] text-muted",dateTime:e.timestamp,children:(0,eu.format_time)(e.timestamp,o)}),w(e)]}),(0,t.jsx)("p",{className:"m-0 overflow-wrap-anywhere text-[0.9rem] leading-snug whitespace-pre-wrap",children:e.text})]})},`${e.timestamp}-${n}`)})})]})}var eb=e.i(39552);function ey(e){return(0,eb.format)(new Date(e),"MMM d, h:mm a")}var ev=e.i(44356);function ew({entry:e,known_tags:n,is_pending:l,initial_description_override:o,in_active_panel:c=!1,times_only:d=!1,start_only:m=!1,on_save:u,on_cancel:p}){let _=(0,r.useMemo)(()=>o??(0,ev.build_resume_description)(e.description,e.tags),[e.description,e.id,e.tags,o]),[h,g]=(0,r.useState)(_),[x,f]=(0,r.useState)(""),[b,y]=(0,r.useState)("");(0,r.useEffect)(()=>{g(o??(0,ev.build_resume_description)(e.description,e.tags)),f(""),y("")},[e.description,e.id,e.sheetName,e.tags,o]),(0,eo.use_escape_to_cancel)(p);let v=e.isActive?"still running":ey(e.end??e.start),w=d?x.trim().length>0||!m&&b.trim().length>0:h.trim()!==_.trim()||x.trim().length>0||!m&&b.trim().length>0;return(0,t.jsxs)("form",{className:`flex flex-col gap-3 rounded-[0.65rem] border border-panel-border bg-input-bg p-3 ${c?"mt-2":""}`,onSubmit:e=>{e.preventDefault();let t=h.trim(),n=x.trim(),r=b.trim(),s={};d||t===_.trim()||(s.description=t),n.length>0&&(s.start=n),!m&&r.length>0&&(s.end=r),(void 0!==s.description||void 0!==s.start||void 0!==s.end)&&u(s)},children:[(0,t.jsx)("p",{className:"m-0 text-[0.85rem] font-semibold",children:d?"Edit times":"Edit entry"}),d?null:(0,t.jsxs)("label",{className:"flex flex-col gap-1",htmlFor:`entry-description-${e.id}`,children:[(0,t.jsx)("span",{className:"text-[0.8rem] font-semibold",children:"Description"}),(0,t.jsx)(s.TagAutocompleteInput,{id:`entry-description-${e.id}`,value:h,known_tags:n,placeholder:"e.g. crafting something @design",disabled:l,autoFocus:c,on_change:g})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"m-0 text-[0.8rem] font-semibold text-muted",children:"Times (optional)"}),(0,t.jsxs)("div",{className:`grid gap-2.5 max-[860px]:grid-cols-1 ${m?"grid-cols-1":"grid-cols-2"}`,children:[(0,t.jsxs)("label",{className:"flex flex-col gap-1",htmlFor:`entry-start-${e.id}`,children:[(0,t.jsx)("span",{className:"text-[0.8rem] font-semibold",children:"Start"}),(0,t.jsxs)("span",{className:"text-[0.72rem] text-muted",children:["Current: ",ey(e.start)]}),(0,t.jsx)("input",{id:`entry-start-${e.id}`,className:(0,i.get_input_class_name)("compact"),value:x,onChange:e=>f(e.target.value),placeholder:"e.g. 10am, 30 minutes ago",disabled:l,autoFocus:d&&c})]}),m?null:(0,t.jsxs)("label",{className:"flex flex-col gap-1",htmlFor:`entry-end-${e.id}`,children:[(0,t.jsx)("span",{className:"text-[0.8rem] font-semibold",children:"End"}),(0,t.jsxs)("span",{className:"text-[0.72rem] text-muted",children:["Current: ",v]}),(0,t.jsx)("input",{id:`entry-end-${e.id}`,className:(0,i.get_input_class_name)("compact"),value:b,onChange:e=>y(e.target.value),placeholder:e.isActive?"e.g. now, 5 minutes ago":"e.g. 11:30am",disabled:l})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)("button",{type:"submit",className:(0,a.get_button_class_name)("primary","small"),disabled:l||!w,children:"Save"}),(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost","small"),disabled:l,onClick:p,children:"Cancel"})]})]})}function ej({selected_count:e,total_count:n,all_selected:s,some_selected:l,selected_entries:o,sheets:c,is_pending:d,on_toggle_all:m,on_move:u,on_delete:p,on_clear:_}){let[h,g]=(0,r.useState)(""),x=o.some(e=>e.isActive),f=c.filter(e=>(!x||!e.hasActiveEntry)&&o.some(t=>t.sheetName!==e.name));return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md border border-accent-border bg-accent-soft px-3 py-2",children:[(0,t.jsx)(ea,{className:"shrink-0",checked:s,indeterminate:l,disabled:d,aria_label:s?"Deselect all entries":"Select all entries",on_change:m}),(0,t.jsxs)("p",{className:"m-0 shrink-0 text-[0.85rem] font-semibold",children:[e,(0,t.jsx)("span",{className:"text-muted",children:` of ${n} selected`})]}),(0,t.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)("select",{className:`${(0,i.get_input_class_name)("compact")} min-w-32`,value:h,disabled:d||0===f.length,"aria-label":"Move to sheet",onChange:e=>g(e.target.value),children:[(0,t.jsx)("option",{value:"",children:"Move to…"}),f.map(e=>(0,t.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost","small"),disabled:d||0===h.trim().length||0===f.length,onClick:()=>{let e=h.trim();0!==e.length&&(u(e),g(""))},children:"Move"})]}),(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("danger","small"),disabled:d,onClick:p,children:"Delete"}),(0,t.jsx)("button",{type:"button",className:`${(0,a.get_button_class_name)("ghost","small")} shrink-0`,disabled:d,"aria-label":"Clear selection",title:"Clear selection",onClick:_,children:"✕"})]})]})}var eN=e.i(66770),ek=e.i(4874),eS=e.i(7902);function eE(){return(0,r.useSyncExternalStore)(ek.entry_list_sort_preference.subscribe,ek.entry_list_sort_preference.get_snapshot,ek.entry_list_sort_preference.get_server_snapshot)}let e$=(0,eN.get_entry_list_sort_options)();function eC({is_pending:e=!1}){let n=eE();return(0,t.jsxs)("fieldset",{className:"m-0 flex flex-wrap items-center gap-x-2 gap-y-1.5 border-0 p-0",children:[(0,t.jsx)("legend",{className:"sr-only",children:"Order entries by"}),(0,t.jsx)("span",{className:"shrink-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Order by"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Order entries by",children:e$.map(r=>{let s=n===r.value;return(0,t.jsx)("button",{type:"button",className:s?(0,a.get_button_class_name)("primary","small"):(0,a.get_button_class_name)("ghost","small"),disabled:e,"aria-pressed":s,onClick:()=>(0,eS.persist_ui_preference)(ek.entry_list_sort_preference,r.value),children:r.label},r.value)})})]})}function eT(e){let t=e.description.trim()||"Untitled entry",n=e.isActive?" This will stop the active timer.":"";return{title:"Delete entry?",message:`Delete "${t}" on sheet "${e.sheetName}"?${n}`,confirmLabel:"Delete",variant:"danger"}}function eD(e){return`${e.sheetName}-${e.id}`}var eM=e.i(36405);function eI(){return"true"===(0,r.useSyncExternalStore)(eM.confirm_destructive_actions_preference.subscribe,eM.confirm_destructive_actions_preference.get_snapshot,eM.confirm_destructive_actions_preference.get_server_snapshot)}function eA({title:e,entries:n,sheets:s,known_tags:a,total_ms:i,empty_message:m,is_pending:u,show_sheet_name:_=!0,header_extra:h,on_delete:g,on_edit:x,on_move:f,on_move_many:y,on_delete_many:v,on_edit_note:w,on_add_note:j,on_resume:N}){let{confirm:k}=(0,ei.use_confirm_dialog)(),S=eI(),E=(0,eg.use_time_format)(),$=(0,M.use_duration_format)(),[C,T]=(0,r.useState)(null),[D,I]=(0,r.useState)(()=>new Set),[A,L]=(0,r.useState)(null),[R,F]=(0,r.useState)(null),[O,P]=(0,r.useState)({}),U=(0,r.useSyncExternalStore)(o.entry_suggestion_provider_preference.subscribe,o.entry_suggestion_provider_preference.get_snapshot,o.entry_suggestion_provider_preference.get_server_snapshot),z=(0,r.useSyncExternalStore)(d.openai_api_key_preference.subscribe,d.openai_api_key_preference.get_snapshot,d.openai_api_key_preference.get_server_snapshot),H=(0,r.useSyncExternalStore)(l.claude_api_key_preference.subscribe,l.claude_api_key_preference.get_snapshot,l.claude_api_key_preference.get_server_snapshot),B=(0,r.useSyncExternalStore)(c.google_ai_api_key_preference.subscribe,c.google_ai_api_key_preference.get_snapshot,c.google_ai_api_key_preference.get_server_snapshot),G="openai"===U?z:"claude"===U?H:"google_ai"===U?B:"",J="none"!==U&&G.trim().length>0,W=n.map(e=>eD(e)),K=n.filter(e=>D.has(eD(e))),Y=n.length>0&&K.length===n.length,V=K.length>0&&K.length<n.length;(0,r.useEffect)(()=>{I(e=>{let t=new Set(W),n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[W.join("|")]);let Q=()=>{Y?I(new Set):I(new Set(W))},Z=()=>{I(new Set)},X=async()=>{let e,t,n;0!==K.length&&(!S||await k((e=K.length,t=K.some(e=>e.isActive),n=1===e?"1 entry":`${e} entries`,{title:1===e?"Delete entry?":"Delete entries?",message:`Permanently delete ${n}?${t?" This will stop the active timer.":""}`,confirmLabel:"Delete",variant:"danger"})))&&(v(K),Z())},ee=K.length>0,et=async e=>{if(!J)return;let t=eD(e);L(t),F(null);try{let n=e.notes.map(e=>e.text).join("\n"),r=await p({provider:U,api_key:G,context:e.description,notes:n});P(e=>({...e,[t]:r})),T(t)}catch(e){F(e instanceof Error?e.message:String(e))}finally{L(null)}};return(0,eo.use_escape_to_cancel)(Z,ee&&null===C),(0,t.jsxs)("section",{className:"min-w-0",children:[(0,t.jsx)("header",{className:"mb-3 flex flex-col gap-2 border-b border-panel-border pb-2.5 compact:mb-2 compact:pb-1.5",children:ee?(0,t.jsx)(ej,{selected_count:K.length,total_count:n.length,all_selected:Y,some_selected:V,selected_entries:K,sheets:s,is_pending:u,on_toggle_all:Q,on_move:e=>{y(K,e),Z()},on_delete:()=>void X(),on_clear:Z}):(0,t.jsxs)(t.Fragment,{children:[h,(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2.5",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[n.length>0?(0,t.jsx)(ea,{className:"shrink-0",checked:Y,indeterminate:V,disabled:u,aria_label:"Select all entries",on_change:Q}):null,(0,t.jsx)("h2",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em]",children:e}),(0,t.jsx)("span",{className:"text-[0.8rem] text-muted",children:0===n.length?null:1===n.length?"1 entry":`${n.length} entries`})]}),(0,t.jsxs)("p",{className:"m-0 font-mono text-[0.85rem] text-muted max-[640px]:w-full",children:[(0,b.format_duration)(i,$)," total"]})]}),(0,t.jsx)(eC,{is_pending:u}),null!==R?(0,t.jsx)("p",{className:"m-0 text-[0.8rem] text-danger",children:R}):null]})}),0===n.length?(0,t.jsx)("p",{className:"m-0 text-muted",children:m}):(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("ul",{className:"m-0 flex list-none flex-col p-0",children:n.map(e=>{let n=eD(e),r=C===n,i=D.has(n);return r?(0,t.jsx)("li",{className:"block border-b border-panel-border py-2.5 last:border-b-0 compact:py-1.5",children:(0,t.jsx)(ew,{entry:e,known_tags:a,is_pending:u,initial_description_override:O[n],on_cancel:()=>{T(null),P(e=>{if(!(n in e))return e;let t={...e};return delete t[n],t})},on_save:t=>{x(e,t),T(null),P(e=>{if(!(n in e))return e;let t={...e};return delete t[n],t})}})},n):(0,t.jsxs)("li",{className:`group relative flex flex-col gap-0 border-b border-panel-border px-2 py-2.5 transition-colors duration-150 last:border-b-0 hover:bg-surface-hover compact:py-1.5 ${i?"bg-accent-soft hover:bg-accent-soft":""}`,children:[(0,t.jsxs)("div",{className:"flex w-full min-w-0 flex-col items-start gap-2.5 min-[700px]:flex-row min-[700px]:items-center compact:gap-1.5",children:[(0,t.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 has-disabled:cursor-not-allowed","aria-label":`Select entry ${e.description||"Untitled entry"}`,children:[(0,t.jsx)(ea,{nested:!0,className:`shrink-0 pr-1 transition-opacity duration-150 compact:pr-0.5 ${i||ee?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"}`,checked:i,disabled:u,on_change:()=>{I(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t})}}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"m-0 overflow-wrap-anywhere font-semibold leading-snug compact:text-[0.9rem] compact:leading-tight",children:e.description||"Untitled entry"}),(0,t.jsxs)("div",{className:"mt-0.5 flex flex-wrap items-center gap-1 text-[0.8rem] text-muted compact:mt-px compact:gap-0.5 compact:text-[0.72rem]",children:[_?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:e.sheetName}),(0,t.jsx)("span",{children:"·"})]}):null,(0,t.jsxs)("span",{children:["#",e.id]}),(0,t.jsx)("span",{children:"·"}),(0,t.jsxs)("span",{className:"whitespace-nowrap",children:[(0,eu.format_time)(e.start,E),null===e.end?" → now":` → ${(0,eu.format_time)(e.end,E)}`]}),e.tags.length>0?(0,t.jsx)("ul",{className:"m-0 flex list-none flex-wrap gap-1 p-0",children:e.tags.map(e=>(0,t.jsx)("li",{className:"rounded-full bg-tag-bg px-2 py-0.5 text-xs text-tag-text",children:(0,q.format_display_tag)(e)},e))}):null]})]})]}),(0,t.jsxs)("div",{className:"flex w-full shrink-0 flex-row items-center justify-between gap-2 min-[700px]:w-auto min-[700px]:justify-end max-[860px]:flex-wrap compact:gap-1.5",children:[(0,t.jsx)("p",{className:`m-0 whitespace-nowrap text-right font-mono text-[0.9rem] text-muted compact:text-[0.8rem] ${e.isActive?"text-accent":""}`,children:(0,b.format_duration)(e.durationMs,$)}),(0,t.jsx)(ed,{current_sheet_name:e.sheetName,sheets:s,is_pending:u||A===n,on_edit:()=>{T(n),P(e=>{if(!(n in e))return e;let t={...e};return delete t[n],t})},on_revise_description_ai:J?()=>void et(e):void 0,can_revise_description_ai:J,on_add_note:t=>j(e,t),on_resume:()=>N(e),entry_is_active:e.isActive,on_move:t=>f(e,t),on_delete:async()=>{(!S||await k(eT(e)))&&g(e)}})]})]}),e.notes.length>0?(0,t.jsx)("div",{className:"w-full pt-1 pl-[calc(0.85rem+0.5rem+0.35rem)] compact:pt-0.5 compact:pl-[calc(0.85rem+0.35rem+0.2rem)]",children:(0,t.jsx)(ef,{notes:e.notes,variant:"inline",is_pending:u,on_edit_note:(t,n)=>w(e,t,n)})}):null]},n)})})})]})}let eL="block w-full cursor-pointer rounded-[0.45rem] border-0 bg-transparent px-2.5 py-1.5 text-left font-inherit text-[0.85rem] text-inherit hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-55";function eR({sheet_name:e,is_pending:n,can_delete:s,on_rename:a,on_delete:i}){let[l,o]=(0,r.useState)(!1),c=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!l)return;let e=e=>{null===c.current||c.current.contains(e.target)||o(!1)};return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[l]);let d=()=>{o(!1)};return(0,t.jsxs)("div",{className:"relative shrink-0 self-center",ref:c,children:[(0,t.jsx)("button",{type:"button",className:"inline-flex cursor-pointer appearance-none items-center justify-center rounded-none border-0 bg-transparent p-0.5 text-muted shadow-none hover:opacity-75 focus-visible:outline-2 focus-visible:outline-input-focus-border focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-55","aria-label":`Actions for sheet ${e}`,"aria-expanded":l,"aria-haspopup":"menu",disabled:n,onClick:()=>o(e=>!e),children:(0,t.jsx)(el.HamburgerIcon,{})}),l?(0,t.jsxs)("ul",{className:"absolute right-0 top-full z-10 mt-1.5 min-w-56 list-none rounded-md border border-panel-border bg-panel p-1.5 shadow-md",role:"menu",children:[(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:eL,role:"menuitem",disabled:n,onClick:()=>{d(),a()},children:"Rename"})}),(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:`${eL} text-danger`,role:"menuitem",disabled:n||!s,title:s?void 0:"Cannot delete the last sheet",onClick:()=>{d(),i()},children:"Delete sheet"})})]}):null]})}function eF({sheets:e,db_path:n,on_select:s,on_create:l,on_rename:o,on_delete:c,is_pending:d}){let{confirm:m}=(0,ei.use_confirm_dialog)(),u=eI(),p=e.length>1,[_,h]=(0,r.useState)(!1),[g,x]=(0,r.useState)(""),[f,b]=(0,r.useState)(null),[y,v]=(0,r.useState)(""),w=()=>{h(!1),x("")},j=()=>{b(null),v("")};(0,eo.use_escape_to_cancel)(j,null!==f),(0,eo.use_escape_to_cancel)(w,_);let N=e=>{if(e.preventDefault(),null===f)return;let t=y.trim();0===t.length||t===f||o(f,t),j()};return(0,t.jsxs)("aside",{className:"flex min-w-0 flex-col gap-3 max-[860px]:min-w-0",children:[(0,t.jsx)("h2",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Sheets"}),(0,t.jsx)("ul",{className:"m-0 flex min-h-0 flex-1 list-none flex-col gap-1.5 p-0",children:e.map(e=>(0,t.jsx)("li",{className:"min-w-0",children:f===e.name?(0,t.jsxs)("form",{className:"flex w-full min-w-0 flex-col gap-1.5",onSubmit:N,children:[(0,t.jsx)("input",{className:(0,i.get_input_class_name)("compact"),value:y,onChange:e=>v(e.target.value),disabled:d,autoFocus:!0}),(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)("button",{type:"submit",className:`${(0,a.get_button_class_name)("ghost")} flex-1`,disabled:d||0===y.trim().length,children:"Save"}),(0,t.jsx)("button",{type:"button",className:`${(0,a.get_button_class_name)("ghost")} flex-1`,disabled:d,onClick:j,children:"Cancel"})]})]}):(0,t.jsxs)("div",{className:"flex min-w-0 items-stretch gap-1",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 cursor-pointer items-center justify-between gap-2 rounded-md border border-transparent bg-transparent px-2.5 py-2 text-left transition-[background-color,color] duration-150 hover:bg-surface-hover",disabled:d&&!e.isActive,onClick:()=>s(e.name),children:[(0,t.jsx)("span",{className:`min-w-0 flex-1 truncate font-semibold ${e.isActive||e.hasActiveEntry?"text-accent":""}`,children:e.name}),(0,t.jsx)("span",{className:`shrink-0 text-xs whitespace-nowrap ${e.hasActiveEntry?"text-accent":"text-muted"}`,children:e.hasActiveEntry?"● active":`${e.entryCount} entries`})]}),(0,t.jsx)(eR,{sheet_name:e.name,is_pending:d,can_delete:p,on_rename:()=>{var t;b(t=e.name),v(t)},on_delete:async()=>{var t,n,r;let s;(!u||await m((t=e.name,n=e.entryCount,r=e.hasActiveEntry,s=0===n?"":` This will delete ${n} ${1===n?"entry":"entries"}.`,{title:"Delete sheet?",message:`Delete "${t}"?${s}${r?" This will stop the active timer.":""}`,confirmLabel:"Delete sheet",variant:"danger"})))&&c(e.name)}})]})},e.name))}),_?(0,t.jsxs)("form",{className:"flex w-full min-w-0 flex-col gap-2",onSubmit:e=>{e.preventDefault();let t=g.trim();0!==t.length&&(l(t),w())},children:[(0,t.jsx)("input",{className:(0,i.get_input_class_name)("compact"),value:g,onChange:e=>x(e.target.value),placeholder:"New sheet name",disabled:d,autoFocus:!0}),(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)("button",{type:"submit",className:`${(0,a.get_button_class_name)("ghost")} flex-1`,disabled:d||0===g.trim().length,children:"Add"}),(0,t.jsx)("button",{type:"button",className:`${(0,a.get_button_class_name)("ghost")} flex-1`,disabled:d,onClick:w,children:"Cancel"})]})]}):(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost"),disabled:d,onClick:()=>h(!0),children:"Add sheet"}),(0,t.jsx)("p",{className:"mt-auto shrink-0 overflow-wrap-anywhere border-t border-panel-border pt-3 font-mono text-[0.65rem] leading-snug text-muted",title:n,children:n})]})}var eO=e.i(60935);function eP(){return"true"===(0,r.useSyncExternalStore)(eO.timer_show_seconds_preference.subscribe,eO.timer_show_seconds_preference.get_snapshot,eO.timer_show_seconds_preference.get_server_snapshot)}function eU({entry:e,in_bar:n,is_pending:s,initial_at:l,on_cancel:o,on_submit:c}){let d=(0,M.use_duration_format)(),m=eP(),[u,p]=(0,r.useState)(()=>Date.now()-new Date(e.start).getTime()),[_,h]=(0,r.useState)(""),[g,x]=(0,r.useState)(l??""),f=(0,r.useRef)(null);(0,eo.use_escape_to_cancel)(o),(0,r.useEffect)(()=>{f.current?.focus()},[]),(0,r.useEffect)(()=>{p(Date.now()-new Date(e.start).getTime());let t=window.setInterval(()=>{p(Date.now()-new Date(e.start).getTime())},1e3);return()=>window.clearInterval(t)},[e.start]);let y=(0,b.format_duration)(u,d,m),v=e.description||"Untitled entry";return(0,t.jsxs)("form",{className:"flex min-w-0 flex-col gap-4","aria-label":"Check out form",onSubmit:e=>{e.preventDefault();let t=_.trim(),n=g.trim(),r=t.length>0,s=n.length>0;r||s?c({...s?{at:n}:{},...r?{note:t}:{}}):c(void 0)},children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-[0.68rem] font-bold uppercase leading-none tracking-wider text-danger",children:"Checking out"}),(0,t.jsx)("h2",{className:"m-0 min-w-0 truncate text-[1.05rem] font-[650] leading-tight tracking-tight min-[560px]:text-[1.15rem]",children:v})]}),(0,t.jsx)("p",{className:"m-0 whitespace-nowrap font-mono text-[1.4rem] font-medium leading-none tracking-tight text-accent min-[560px]:text-[1.6rem]",children:y})]}),e.tags.length>0?(0,t.jsx)("ul",{className:"m-0 flex list-none flex-wrap gap-1.5 p-0",children:e.tags.map(e=>(0,t.jsx)("li",{className:"rounded-full bg-tag-bg px-2 py-0.5 text-[0.72rem] text-tag-text",children:(0,q.format_display_tag)(e)},e))}):null,(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3 min-[640px]:grid-cols-[minmax(0,1fr)_minmax(10rem,14rem)]",children:[(0,t.jsxs)("label",{className:"flex min-w-0 flex-col gap-1",htmlFor:"checkout-note",children:[(0,t.jsxs)("span",{className:"text-[0.8rem] font-semibold",children:["Note ",(0,t.jsx)("span",{className:"font-normal text-muted",children:"(optional)"})]}),(0,t.jsx)("input",{ref:f,id:"checkout-note",className:(0,i.get_input_class_name)("compact"),value:_,onChange:e=>h(e.target.value),placeholder:"Wrap-up, blockers, next steps…",disabled:s})]}),(0,t.jsxs)("label",{className:"flex min-w-0 flex-col gap-1",htmlFor:"checkout-at",children:[(0,t.jsxs)("span",{className:"text-[0.8rem] font-semibold",children:["End time ",(0,t.jsx)("span",{className:"font-normal text-muted",children:"(optional)"})]}),(0,t.jsx)("input",{id:"checkout-at",className:(0,i.get_input_class_name)("compact"),value:g,onChange:e=>x(e.target.value),placeholder:"e.g. now, 30 minutes ago, 5:30pm",disabled:s})]})]}),(0,t.jsxs)("div",{className:`flex flex-wrap items-center gap-2 ${n?"":"pt-1"}`,children:[(0,t.jsx)("button",{type:"submit",className:(0,a.get_button_class_name)("danger-solid"),disabled:s,children:"Confirm check out"}),(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost"),disabled:s,onClick:o,children:"Cancel"})]})]})}function ez(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",role:"presentation","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M12 3l1.7 4.3L18 9l-4.3 1.7L12 15l-1.7-4.3L6 9l4.3-1.7L12 3zM19 14l.9 2.1L22 17l-2.1.9L19 20l-.9-2.1L16 17l2.1-.9L19 14zM5 15l.9 2.1L8 18l-2.1.9L5 21l-.9-2.1L2 18l2.1-.9L5 15z",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function eH({entry:e,known_tags:n,is_pending:i,on_save:m,on_cancel:u}){let _=(0,r.useMemo)(()=>(0,ev.build_resume_description)(e.description,e.tags),[e.description,e.id,e.tags]),[h,g]=(0,r.useState)(_),[x,f]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),v=(0,r.useSyncExternalStore)(o.entry_suggestion_provider_preference.subscribe,o.entry_suggestion_provider_preference.get_snapshot,o.entry_suggestion_provider_preference.get_server_snapshot),w=(0,r.useSyncExternalStore)(d.openai_api_key_preference.subscribe,d.openai_api_key_preference.get_snapshot,d.openai_api_key_preference.get_server_snapshot),j=(0,r.useSyncExternalStore)(l.claude_api_key_preference.subscribe,l.claude_api_key_preference.get_snapshot,l.claude_api_key_preference.get_server_snapshot),N=(0,r.useSyncExternalStore)(c.google_ai_api_key_preference.subscribe,c.google_ai_api_key_preference.get_snapshot,c.google_ai_api_key_preference.get_server_snapshot),k="openai"===v?w:"claude"===v?j:"google_ai"===v?N:"",S="none"!==v&&k.trim().length>0;(0,r.useEffect)(()=>{g((0,ev.build_resume_description)(e.description,e.tags))},[e.description,e.id,e.sheetName,e.tags]),(0,eo.use_escape_to_cancel)(u);let E=async()=>{if(S){f(!0),y(null);try{let t=e.notes.map(e=>e.text).join("\n"),n=await p({provider:v,api_key:k,context:h,notes:t});g(n)}catch(e){y(e instanceof Error?e.message:String(e))}finally{f(!1)}}};return(0,t.jsxs)("form",{className:"flex min-w-0 flex-1 flex-col gap-2",onSubmit:e=>{e.preventDefault();let t=h.trim();t===_.trim()?u():m(t)},children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-start gap-2 max-[700px]:flex-col",children:[(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)(s.TagAutocompleteInput,{id:`active-entry-description-${e.id}`,value:h,known_tags:n,placeholder:"e.g. crafting something @design",disabled:i,autoFocus:!0,on_change:g})}),(0,t.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2 max-[700px]:w-full",children:[S?(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost","small"),disabled:i||x,title:"Revise description with AI","aria-label":"Revise description with AI",onClick:()=>void E(),children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsx)(ez,{}),x?"Revising…":"Revise with AI"]})}):null,(0,t.jsx)("button",{type:"submit",className:(0,a.get_button_class_name)("primary","small"),disabled:i||h.trim()===_.trim(),children:"Save"}),(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost","small"),disabled:i,onClick:u,children:"Cancel"})]})]}),null!==b?(0,t.jsx)("p",{className:"m-0 text-[0.8rem] text-danger",children:b}):null]})}var eq=e.i(50459);let eB=`${(0,a.get_button_class_name)("danger-solid")} rounded-none first:rounded-l-[0.65rem] last:rounded-r-[0.65rem] not-first:-ml-px not-first:min-w-12 not-first:border-l not-first:border-l-[color-mix(in_srgb,#ffffff_30%,var(--danger-solid))] min-[561px]:px-2.5 min-[561px]:py-2 min-[561px]:text-[0.9rem] max-[560px]:flex-1 max-[560px]:basis-1/2`;function eG({in_bar:e=!1,is_pending:n,on_start_checkout:r}){return(0,t.jsxs)("div",{className:`inline-flex min-w-0 max-w-full ${e?"max-[560px]:w-full":"min-w-30 max-[560px]:w-full"}`,children:[(0,t.jsx)("button",{type:"button",className:eB,disabled:n,onClick:()=>r(),children:"Check out"}),(0,t.jsx)("button",{type:"button",className:eB,disabled:n,title:"Check out at a specific time",onClick:()=>{let e=(0,eq.prompt_check_out_at)();null!==e&&r(e)},children:"@"})]})}function eJ({on_submit:e,on_cancel:n,is_pending:s,in_active_panel:l=!1,in_bar:o=!1,allow_at:c=!1}){let[d,m]=(0,r.useState)(""),[u,p]=(0,r.useState)("");return(0,eo.use_escape_to_cancel)(()=>n?.(),void 0!==n),(0,t.jsxs)("form",{className:`flex flex-col gap-2 ${l&&!o?"border-t border-accent-border pt-4":o?"border-t border-[color-mix(in_srgb,var(--accent-border)_65%,var(--panel-border))] pt-3.5":""}`,onSubmit:t=>{t.preventDefault();let n=d.trim();if(0===n.length)return;let r=u.trim();e(n,r.length>0?r:void 0),m(""),p("")},children:[(0,t.jsx)("label",{className:"text-[0.85rem] text-muted",htmlFor:"note-text",children:"Add note"}),(0,t.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2 max-[860px]:grid-cols-1",children:[(0,t.jsx)("input",{id:"note-text",className:(0,i.get_input_class_name)(),value:d,onChange:e=>m(e.target.value),placeholder:"Pair with alice on the widget",disabled:s,autoFocus:!0}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 max-[860px]:w-full",children:[(0,t.jsx)("button",{type:"submit",className:(0,a.get_button_class_name)("ghost"),disabled:s||0===d.trim().length,children:"Save note"}),void 0!==n?(0,t.jsx)("button",{type:"button",className:(0,a.get_button_class_name)("ghost"),disabled:s,onClick:n,children:"Cancel"}):null]})]}),c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("label",{className:"text-[0.85rem] text-muted",htmlFor:"note-at",children:["Note time"," ",(0,t.jsx)("span",{className:"font-normal opacity-85",children:"(optional, natural language)"})]}),(0,t.jsx)("input",{id:"note-at",className:(0,i.get_input_class_name)(),value:u,onChange:e=>p(e.target.value),placeholder:"e.g. 30 minutes ago",disabled:s})]}):null]})}var eW=e.i(76379),eK=e.i(7554);let eY=(0,r.forwardRef)(function({entry:e,sheets:n,known_tags:s,in_bar:i=!1,on_check_out:l,on_delete:o,on_edit:c,on_move:d,on_add_note:m,on_edit_note:u,on_delete_note:p,is_pending:_},h){var g;let x,{confirm:f}=(0,ei.use_confirm_dialog)(),y=eI(),v=(0,eW.use_confirm_before_checkout)(),w=(0,M.use_duration_format)(),j=eP(),[N,k]=(0,r.useState)(e.durationMs),[S,E]=(0,r.useState)(!1),[$,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),[I,A]=(0,r.useState)(!1),[L,R]=(0,r.useState)(void 0);(0,r.useImperativeHandle)(h,()=>({start_edit:()=>{S||$||I||E(!0)},start_add_note:()=>{S||$||T||I||D(!0)}}),[T,S,$,I]),(0,r.useEffect)(()=>{D(!1),E(!1),C(!1),A(!1),R(void 0)},[e.id,e.sheetName]),(0,r.useEffect)(()=>{k(e.durationMs);let t=window.setInterval(()=>{k(Date.now()-new Date(e.start).getTime())},1e3);return()=>window.clearInterval(t)},[e.durationMs,e.start]);let F=()=>{A(!1),R(void 0)},O=async e=>{(!v||await f((0,eK.get_check_out_confirm_dialog)(e)))&&(l(e),F())},P=(g=S||$||I,x="flex flex-col gap-4 rounded-lg border border-accent-border p-[1.1rem] shadow-sm",i?g?`${x} rounded-md border border-accent-border bg-[color-mix(in_srgb,var(--panel)_70%,var(--background))] p-3.5`:"flex flex-col gap-3 border-0 bg-transparent p-0 shadow-none":`${x} bg-[image:var(--active-panel-bg)]`),U=async t=>{let n,r,s=e.notes.find(e=>e.timestamp===t);(!y||await f({title:"Delete note?",message:(r=(n=(s?.text??"").trim()).length>80?`${n.slice(0,80)}…`:n).length>0?`Remove this note? "${r}"`:"Remove this note?",confirmLabel:"Delete",variant:"danger"}))&&p(t)},z=(0,t.jsx)(ed,{current_sheet_name:e.sheetName,sheets:n,is_pending:_,on_edit:()=>C(!0),on_show_add_note_form:()=>D(!0),on_move:d,on_delete:async()=>{(!y||await f(eT(e)))&&o()}});return I?(0,t.jsx)("section",{className:P,"aria-label":"Check out active entry",children:(0,t.jsx)(eU,{entry:e,in_bar:i,is_pending:_,initial_at:L,on_cancel:F,on_submit:e=>{O(e)}})}):$?(0,t.jsx)("section",{className:P,children:(0,t.jsx)(ew,{entry:e,known_tags:s,is_pending:_,in_active_panel:!0,times_only:!0,start_only:!0,on_cancel:()=>C(!1),on_save:e=>{c(e),C(!1)}})}):(0,t.jsxs)("section",{className:P,children:[(0,t.jsxs)("div",{className:"flex min-w-0 shrink-0 items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[i?null:(0,t.jsx)("span",{className:"self-start rounded-full bg-accent px-2 py-0.5 text-[0.68rem] font-bold uppercase leading-none tracking-wider text-accent-text-on",children:"Tracking"}),S?(0,t.jsx)(eH,{entry:e,known_tags:s,is_pending:_,on_cancel:()=>E(!1),on_save:e=>{c({description:e}),E(!1)}}):(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[(0,t.jsx)("h2",{className:"m-0 min-w-0 truncate text-[1.12rem] font-[650] leading-tight tracking-tight min-[560px]:text-xl",children:e.description||"Untitled entry"}),(0,t.jsx)("button",{type:"button",className:"inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-[0.35rem] border-0 bg-transparent p-0 text-muted hover:bg-surface-hover hover:text-foreground disabled:cursor-not-allowed disabled:opacity-55","aria-label":"Edit description",title:"Edit description",disabled:_||T,onClick:()=>E(!0),children:(0,t.jsx)(e_,{})})]})]}),i?null:(0,t.jsx)("div",{className:"max-[560px]:self-end",children:z})]}),(0,t.jsxs)("div",{className:`flex shrink-0 items-end justify-between gap-4 max-[860px]:flex-col max-[860px]:items-stretch ${i?"px-3":""}`,children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,t.jsx)("p",{className:"m-0 whitespace-nowrap font-mono text-[1.65rem] font-medium leading-none tracking-tight text-accent min-[440px]:text-[1.85rem] min-[560px]:text-[2rem]",children:(0,b.format_duration)(N,w,j)}),!S&&e.tags.length>0?(0,t.jsx)("ul",{className:"m-0 flex list-none flex-wrap gap-1.5 p-0",children:e.tags.map(e=>(0,t.jsx)("li",{className:"rounded-full bg-tag-bg px-2 py-0.5 text-xs text-tag-text",children:(0,q.format_display_tag)(e)},e))}):null]}),(0,t.jsxs)("div",{className:`flex min-w-0 shrink-0 flex-wrap items-center justify-end gap-2 max-[560px]:flex-col max-[560px]:items-stretch ${i?"w-full":"min-w-30 max-[860px]:w-full max-[860px]:justify-stretch"}`,children:[T?null:(0,t.jsx)("button",{type:"button",className:`${(0,a.get_button_class_name)("ghost")} min-w-0 min-[561px]:px-2.5 min-[561px]:py-2 min-[561px]:text-[0.9rem] max-[560px]:flex-1`,disabled:_||S,onClick:()=>D(!0),children:"Add note"}),(0,t.jsx)(eG,{in_bar:i,is_pending:_,on_start_checkout:e=>{_||(E(!1),C(!1),D(!1),R(e),A(!0))}})]})]}),(0,t.jsx)(ef,{notes:e.notes,variant:"panel",in_bar:i,is_pending:_,on_edit_note:u,on_delete_note:U}),T?(0,t.jsx)("div",{className:"shrink-0",children:(0,t.jsx)(eJ,{in_active_panel:!0,in_bar:i,allow_at:!0,is_pending:_,on_cancel:()=>D(!1),on_submit:(e,t)=>{m(e,t),D(!1)}})}):null]})});var eV=e.i(15526);let eQ=(0,r.forwardRef)(function({active_entry:e,sheets:n,known_tags:s,is_pending:a,on_check_out:i,on_delete:l,on_edit:o,on_move:c,on_add_note:d,on_edit_note:m,on_delete_note:u},p){let{confirm:_}=(0,ei.use_confirm_dialog)(),h=eI(),g=(0,r.useRef)(null);return((0,r.useImperativeHandle)(p,()=>({start_edit:()=>{g.current?.start_edit()},start_add_note:()=>{g.current?.start_add_note()}})),null===e)?null:(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,t.jsxs)("span",{className:"text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted whitespace-nowrap truncate",children:["Sheet ",e.sheetName]}),(0,t.jsx)("span",{className:"shrink-0 rounded-full bg-accent px-2 py-0.5 text-[0.68rem] font-bold uppercase leading-none tracking-wider text-accent-text-on",children:"Tracking"}),(0,eV.is_pomodoro_task_entry)(e)?(0,t.jsx)("span",{className:"shrink-0 rounded-full border border-panel-border bg-surface-raised px-2 py-0.5 text-[0.68rem] font-bold uppercase leading-none tracking-wider text-foreground",children:"Pomodoro"}):null,(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(ed,{current_sheet_name:e.sheetName,sheets:n,is_pending:a,on_edit:()=>g.current?.start_edit(),on_show_add_note_form:()=>g.current?.start_add_note(),on_move:c,on_delete:async()=>{(!h||await _(eT(e)))&&l()}})})]}),(0,t.jsx)(eY,{ref:g,entry:e,sheets:n,known_tags:s,in_bar:!0,is_pending:a,on_check_out:i,on_delete:l,on_edit:o,on_move:c,on_add_note:d,on_edit_note:m,on_delete_note:u},`${e.sheetName}-${e.id}`)]})});var eZ=e.i(16967);let eX="super-time-tracker";function e0({active_entry:e}){let t="true"===(0,r.useSyncExternalStore)(eZ.timer_in_title_preference.subscribe,eZ.timer_in_title_preference.get_snapshot,eZ.timer_in_title_preference.get_server_snapshot),n=(0,M.use_duration_format)(),s=eP(),[a,i]=(0,r.useState)(e?.durationMs??0);return(0,r.useEffect)(()=>{if(null===e)return void i(0);i(e.durationMs);let t=window.setInterval(()=>{i(Date.now()-new Date(e.start).getTime())},1e3);return()=>window.clearInterval(t)},[e]),(0,r.useEffect)(()=>{if(!t||null===e){document.title=eX;return}let r=e.description.trim()||"Tracking",i=(0,b.format_duration)(a,n,s);return document.title=`${i} — ${r}`,()=>{document.title=eX}},[e,n,a,s,t]),null}var e1=e.i(75404),e5=e.i(36178),e2=e.i(68713);function e6(e){return`${e.sheetName}:${e.id}`}var e8=e.i(67999),e4=e.i(85323);async function e3(e,t){let n=await fetch(e,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error((await n.json()).error??"Request failed");return await n.json()}var e7=e.i(3159),e9=e.i(51229),te=e.i(17003);function tt(e){let t=e.activeSheetName;null!==t&&(0,te.write_active_sheet_preference)(t)}var tn=e.i(65742),tr=e.i(48541);e.s(["TrackerApp",0,function({initial_state:e}){let[s,i]=(0,r.useState)(e),[l,o]=(0,r.useState)(null),[c,d]=(0,r.useState)(!1),[m,u]=(0,r.useState)(!1),p=(0,r.useRef)(e);(0,r.useEffect)(()=>{tt(e)},[e]);let _=async e=>{d(!0),o(null);try{let t=await e(),n=null!==s.activeEntry&&null===t.activeEntry,r=s.runningEntry,a=t.runningEntry;if(tt(t),i(t),n&&(0,e2.finish_running_pomodoro_timer)(),!b)return;if(null===r&&null!==a)return void(0,e4.notify_desktop)({title:"Tracking started",body:`${a.description||"Untitled entry"} (${a.sheetName})`,tag:"tracker-running-entry"});if(null!==r&&null===a)return void(0,e4.notify_desktop)({title:"Tracking stopped",body:`${r.description||"Untitled entry"} (${r.sheetName})`,tag:"tracker-running-entry"});null!==r&&null!==a&&e6(r)!==e6(a)&&(0,e4.notify_desktop)({title:"Tracking switched",body:`${a.description||"Untitled entry"} (${a.sheetName})`,tag:"tracker-running-entry"})}catch(e){o(e instanceof Error?e.message:String(e))}finally{d(!1)}},h=s.activeSheetName??s.sheets.find(e=>e.isActive)?.name??"main",g=en(),f=eE(),b="true"===(0,r.useSyncExternalStore)(tr.desktop_notifications_preference.subscribe,tr.desktop_notifications_preference.get_snapshot,tr.desktop_notifications_preference.get_server_snapshot),y="true"===(0,r.useSyncExternalStore)(tn.clear_tag_filters_on_sheet_change_preference.subscribe,tn.clear_tag_filters_on_sheet_change_preference.get_snapshot,tn.clear_tag_filters_on_sheet_change_preference.get_server_snapshot),v=(0,r.useRef)(null),w=(0,r.useRef)(null),j=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!y||null===v.current||v.current===h){v.current=h;return}X(h,[]),v.current=h},[h,y]);let N=(0,r.useSyncExternalStore)(Q.subscribe_sheet_tag_filters,()=>Y(h),V),k=(0,r.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=new Set;for(let r of n.tags)try{let n=(0,B.normalize_stored_tag)(r);if(e.has(n))continue;e.add(n),t.set(n,(t.get(n)??0)+1)}catch{continue}}return[...t.entries()].map(([e,t])=>({name:e,entryCount:t})).sort((e,t)=>e.name.localeCompare(t.name))})(s.activeSheetEntries),[s.activeSheetEntries]),S=(0,r.useMemo)(()=>{if(m)return[];let e=[...function(e,t,n="all"){return 0===t.length?e:e.filter(e=>(function(e,t,n="all"){return 0===t.length||("any"===n?t.some(t=>e.tags.some(e=>ee(e,t))):t.every(t=>e.tags.some(e=>ee(e,t))))})(e,t,n))}(s.activeSheetEntries,N,g)];switch(f){case"oldest":return e.sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime());case"duration":return e.sort((e,t)=>t.durationMs-e.durationMs);case"description":return e.sort((e,t)=>{let n=e.description.trim()||"Untitled entry",r=t.description.trim()||"Untitled entry";return n.localeCompare(r)});default:return e.sort((e,t)=>new Date(t.start).getTime()-new Date(e.start).getTime())}},[s.activeSheetEntries,N,g,f,m]),E=(0,r.useMemo)(()=>(0,e8.get_serialized_entries_total_ms)(S),[S]),$=m?`Loading entries for "${h}"…`:N.length>0?"any"===g?`No entries on sheet "${h}" match any selected tag.`:`No entries on sheet "${h}" match all selected tags.`:`No entries on sheet "${h}".`,C=e=>{let t;if(e===h&&!m)return;p.current=s;let n=(t=s.runningEntries.find(t=>t.sheetName===e)??null,{...s,activeSheetName:e,sheets:s.sheets.map(t=>({...t,isActive:t.name===e})),activeEntry:t,activeSheetEntries:s.activeSheetEntries,activeSheetTotalMs:s.activeSheetTotalMs});tt(n),i(n),u(!0),o(null),(0,e9.post_tracker_action)("/api/sheet",{name:e}).then(e=>{tt(e),i(e)}).catch(e=>{o(e instanceof Error?e.message:String(e)),i(p.current)}).finally(()=>{u(!1)})},T=(e,t,n)=>(0,e7.patch_tracker_action)("/api/entry",{sheetName:e,entryId:t,...n});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e0,{active_entry:s.activeEntry}),(0,t.jsx)(H,{sheets:s.sheets,active_sheet_name:h,active_entry:s.activeEntry,is_pending:c,check_in_form_ref:w,active_entry_panel_ref:j,on_select_sheet:C,on_check_out:e=>_(()=>(0,e9.post_tracker_action)("/api/out",(0,e5.build_check_out_request_payload)(h,e)))}),(0,t.jsx)("div",{className:"relative z-1",children:(0,t.jsx)(e1.TrackerTopbar,{})}),(0,t.jsxs)("div",{className:"mx-auto max-w-[1120px] px-4 pb-10 pt-4 sm:px-5 sm:pt-5",children:[null!==l?(0,t.jsx)("p",{className:"mb-4 border border-danger-border bg-danger-soft px-3 py-2.5 text-danger-text",children:l}):null,(0,t.jsx)(I,{has_running_timer:null!==s.runningEntry,on_check_in_shortcut:()=>{w.current?.expand_and_focus()}}),(0,t.jsxs)("div",{className:"grid grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)] items-stretch border border-panel-border bg-panel shadow-sm max-[960px]:grid-cols-1",children:[(0,t.jsx)("div",{className:"flex min-h-0 min-w-0 flex-col border-r border-panel-border p-4 max-[860px]:border-r-0 max-[860px]:border-b",children:(0,t.jsx)(eF,{sheets:s.sheets,db_path:s.dbPath,is_pending:c,on_select:C,on_create:e=>_(()=>(0,e9.post_tracker_action)("/api/sheet",{name:e})),on_rename:(e,t)=>_(()=>(0,e7.patch_tracker_action)("/api/sheet",{name:e,newName:t})),on_delete:e=>_(()=>(0,e9.post_tracker_action)("/api/sheet",{name:e,delete:!0}))})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,t.jsxs)("section",{className:"flex min-w-0 flex-col gap-4 border-b border-panel-border border-l-4 border-l-accent p-4",children:[null===s.activeEntry?(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-md border border-panel-border bg-background px-3 py-2",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Quick action"}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.9rem] font-medium",children:"Jump into Pomodoro without leaving the tracker."})]}),(0,t.jsxs)(n.default,{href:"/pomodoro",className:`${(0,a.get_button_class_name)("primary")} inline-flex min-w-40 flex-col items-center justify-center whitespace-nowrap text-center`,"aria-label":"Open Pomodoro timer",children:[(0,t.jsx)("span",{className:"text-white text-[0.9rem] leading-none",children:"Start Pomodoro"}),(0,t.jsx)("span",{className:"text-white mt-1 text-[0.72rem] font-medium leading-none opacity-85",children:"Focus timer"})]})]}):null,(0,t.jsx)(eQ,{ref:j,active_entry:s.activeEntry,sheets:s.sheets,known_tags:s.knownTags,is_pending:c,on_check_out:e=>_(()=>(0,e9.post_tracker_action)("/api/out",(0,e5.build_check_out_request_payload)(h,e))),on_delete:()=>_(()=>(0,e9.post_tracker_action)("/api/entry",{sheetName:h,entryId:s.activeEntry?.id})),on_edit:e=>_(()=>T(h,s.activeEntry?.id??0,e)),on_move:e=>_(()=>(0,e9.post_tracker_action)("/api/entry/move",{sheetName:h,entryId:s.activeEntry?.id,targetSheetName:e})),on_add_note:(e,t)=>_(()=>(0,e9.post_tracker_action)("/api/note",{text:e,...void 0!==t?{at:t}:{},sheetName:h,entryId:s.activeEntry?.id})),on_edit_note:(e,t)=>_(()=>(0,e7.patch_tracker_action)("/api/note",{sheetName:h,entryId:s.activeEntry?.id,timestamp:e,text:t})),on_delete_note:e=>_(()=>e3("/api/note",{sheetName:h,entryId:s.activeEntry?.id,timestamp:e}))}),null===s.activeEntry?(0,t.jsx)(x,{ref:w,known_tags:s.knownTags,is_pending:c,trailing:(0,t.jsx)("p",{className:"m-0 text-[0.85rem] leading-tight text-muted",children:"Not tracking"}),on_submit:e=>_(()=>(0,e9.post_tracker_action)("/api/in",{...e,sheetName:h}))}):null]}),(0,t.jsx)("section",{className:"flex min-w-0 flex-col gap-4 p-4",children:(0,t.jsx)(eA,{title:"Entries",entries:S,sheets:s.sheets,known_tags:s.knownTags,total_ms:E,empty_message:$,is_pending:c,show_sheet_name:!1,header_extra:(0,t.jsx)(er,{sheet_name:h,sheet_tags:k}),on_delete:e=>_(()=>(0,e9.post_tracker_action)("/api/entry",{sheetName:e.sheetName,entryId:e.id})),on_edit:(e,t)=>_(()=>T(e.sheetName,e.id,t)),on_move:(e,t)=>_(()=>(0,e9.post_tracker_action)("/api/entry/move",{sheetName:e.sheetName,entryId:e.id,targetSheetName:t})),on_move_many:(e,t)=>_(()=>(0,e9.post_tracker_action)("/api/entry/move-bulk",{entries:e.map(e=>({sheetName:e.sheetName,entryId:e.id})),targetSheetName:t})),on_delete_many:e=>_(()=>(0,e9.post_tracker_action)("/api/entry/delete-bulk",{entries:e.map(e=>({sheetName:e.sheetName,entryId:e.id}))})),on_edit_note:(e,t,n)=>_(()=>(0,e7.patch_tracker_action)("/api/note",{sheetName:e.sheetName,entryId:e.id,timestamp:t,text:n})),on_add_note:(e,t)=>_(()=>(0,e9.post_tracker_action)("/api/note",{sheetName:e.sheetName,entryId:e.id,text:t})),on_resume:e=>_(()=>(0,e9.post_tracker_action)("/api/in",{description:(0,ev.build_resume_description)(e.description,e.tags),sheetName:e.sheetName}))})})]})]})]})]})}],22482)}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,22482,e=>{"use strict";var t=e.i(54710),n=e.i(45958),r=e.i(29158),a=e.i(14260),s=e.i(52663),i=e.i(52405),l=e.i(69472),o=e.i(84545),c=e.i(50937),d=e.i(83327);let m=e=>"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.name&&"string"==typeof e.description;var u=e.i(35877);async function p(e){if("none"===e.provider)throw Error("AI suggestion provider is disabled");let t="true"===u.debug_logging_preference.read(),n=Date.now(),r={provider:e.provider,context:e.context,notes:e.notes,debug_logging:t};t&&console.info("[ai-suggestion] client request start",{provider:e.provider,context_length:e.context.length,notes_length:e.notes.length});try{let a=await fetch("/api/entry/suggest-description",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,api_key:e.api_key})});if(!a.ok){let r=await a.json().catch(()=>({}));throw t&&console.warn("[ai-suggestion] client request failed",{provider:e.provider,status:a.status,elapsed_ms:Date.now()-n,error:r.error??"Failed to suggest description"}),Error(r.error??"Failed to suggest description")}let s=await a.json(),i=s.description?.trim()??"";if(0===i.length)throw Error("Suggestion was empty");return t&&console.info("[ai-suggestion] client request success",{provider:e.provider,elapsed_ms:Date.now()-n,description_length:i.length}),i}catch(r){throw t&&console.error("[ai-suggestion] client request error",{provider:e.provider,elapsed_ms:Date.now()-n,error:r instanceof Error?r.message:String(r)}),r}}function _(e){try{window.localStorage.setItem("super-time-tracker-entry-templates",JSON.stringify(e))}catch{}}function h({known_tags:e,on_submit:n,is_pending:u}){let[g,x]=(0,r.useState)([]),[f,b]=(0,r.useState)(""),[y,v]=(0,r.useState)(""),[w,j]=(0,r.useState)(""),[N,k]=(0,r.useState)(null),[S,E]=(0,r.useState)(!1),$=(0,r.useSyncExternalStore)(o.entry_suggestion_provider_preference.subscribe,o.entry_suggestion_provider_preference.get_snapshot,o.entry_suggestion_provider_preference.get_server_snapshot),C=(0,r.useSyncExternalStore)(d.openai_api_key_preference.subscribe,d.openai_api_key_preference.get_snapshot,d.openai_api_key_preference.get_server_snapshot),T=(0,r.useSyncExternalStore)(l.claude_api_key_preference.subscribe,l.claude_api_key_preference.get_snapshot,l.claude_api_key_preference.get_server_snapshot),D=(0,r.useSyncExternalStore)(c.google_ai_api_key_preference.subscribe,c.google_ai_api_key_preference.get_snapshot,c.google_ai_api_key_preference.get_server_snapshot),M="openai"===$?C:"claude"===$?T:"google_ai"===$?D:"",I="none"!==$&&M.trim().length>0;(0,r.useEffect)(()=>{x(function(){try{let e=window.localStorage.getItem("super-time-tracker-entry-templates");if(null===e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(m)}catch{return[]}}())},[]);let A=(0,r.useMemo)(()=>g.find(e=>e.id===f)??null,[g,f]),L=async()=>{if(I){E(!0),k(null);try{let e=await p({provider:$,api_key:M,context:y,notes:""});v(e)}catch(e){k(e instanceof Error?e.message:String(e))}finally{E(!1)}}};return(0,t.jsxs)("form",{className:"flex flex-col gap-2 border border-panel-border bg-panel p-[1.1rem] shadow-sm",onSubmit:e=>{e.preventDefault();let t=y.trim();if(0===t.length)return;let r=w.trim();n({description:t,...r.length>0?{at:r}:{}}),v(""),j("")},children:[(0,t.jsx)("label",{className:"text-[0.85rem] text-muted",htmlFor:"check-in-description",children:"What are you working on?"}),(0,t.jsxs)("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto_auto]",children:[(0,t.jsxs)("select",{className:(0,i.get_input_class_name)(),value:f,disabled:u||0===g.length,onChange:e=>{let t=e.target.value;b(t);let n=g.find(e=>e.id===t)??null;null!==n&&v(n.description)},children:[(0,t.jsx)("option",{value:"",children:0===g.length?"No templates":"Use a template…"}),g.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost"),disabled:u||0===y.trim().length,onClick:()=>{let e=y.trim();if(0===e.length)return;let t=e.slice(0,40),n=window.prompt("Template name",t.length>0?t:"New template");if(null===n)return;let r=n.trim();if(0===r.length)return;let a="u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,s=[...g,{id:a,name:r,description:e}];x(s),b(a),_(s)},children:"Save template"}),(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost"),disabled:u||null===A,onClick:()=>{if(null===A)return;let e=g.filter(e=>e.id!==A.id);x(e),b(""),_(e)},children:"Delete template"})]}),(0,t.jsxs)("div",{className:`grid gap-2 max-[860px]:grid-cols-1 ${I?"grid-cols-[minmax(0,1fr)_auto_auto]":"grid-cols-[minmax(0,1fr)_auto]"}`,children:[(0,t.jsx)(a.TagAutocompleteInput,{id:"check-in-description",value:y,known_tags:e,placeholder:"e.g. crafting something @design",disabled:u,autoFocus:!0,on_change:v}),I?(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost"),disabled:u||S,onClick:()=>void L(),title:"Suggest description with AI",children:S?"Suggesting…":"Suggest"}):null,(0,t.jsx)("button",{type:"submit",className:(0,s.get_button_class_name)("primary"),disabled:u||0===y.trim().length,children:"Check in"})]}),null!==N?(0,t.jsx)("p",{className:"m-0 text-[0.8rem] text-danger",children:N}):null,(0,t.jsxs)("label",{className:"text-[0.85rem] text-muted",htmlFor:"check-in-at",children:["Start time"," ",(0,t.jsx)("span",{className:"font-normal opacity-85",children:"(optional, natural language)"})]}),(0,t.jsx)("input",{id:"check-in-at",className:(0,i.get_input_class_name)(),value:w,onChange:e=>j(e.target.value),placeholder:"e.g. 30 minutes ago",disabled:u})]})}var g=e.i(50994);let x=(0,r.forwardRef)(function({known_tags:e,is_pending:n,on_submit:a,trailing:i},l){let o="true"===(0,r.useSyncExternalStore)(g.check_in_form_collapsed_preference.subscribe,g.check_in_form_collapsed_preference.get_snapshot,g.check_in_form_collapsed_preference.get_server_snapshot),[c,d]=(0,r.useState)(!o);return((0,r.useImperativeHandle)(l,()=>({expand_and_focus:()=>{d(!0),window.requestAnimationFrame(()=>{let e=document.getElementById("check-in-description");e instanceof HTMLElement&&e.focus()})}}),[]),o&&!c)?(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-3",children:[(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("primary"),disabled:n,onClick:()=>d(!0),children:"Check in"}),i]}):(0,t.jsx)(h,{known_tags:e,is_pending:n,on_submit:e=>{a(e),o&&d(!1)}})});var f=e.i(29539),b=e.i(32584),y=e.i(1238),v=e.i(83821),w=e.i(51703),j=e.i(74597),N=e.i(77130),k=e.i(56442),S=e.i(73228),E=e.i(56996),$=e.i(8654),C=e.i(76900),T=e.i(60145),D=e.i(26740),M=e.i(1800);function I({on_check_in_shortcut:e,has_running_timer:n=!1}){let a=(0,M.use_duration_format)(),s=(0,r.useSyncExternalStore)(E.focus_nudges_enabled_preference.subscribe,E.focus_nudges_enabled_preference.get_snapshot,E.focus_nudges_enabled_preference.get_server_snapshot),i=(0,r.useSyncExternalStore)(v.daily_focus_target_minutes_preference.subscribe,v.daily_focus_target_minutes_preference.get_snapshot,v.daily_focus_target_minutes_preference.get_server_snapshot),l=(0,r.useSyncExternalStore)(T.weekly_focus_target_minutes_preference.subscribe,T.weekly_focus_target_minutes_preference.get_snapshot,T.weekly_focus_target_minutes_preference.get_server_snapshot),o=(0,r.useSyncExternalStore)($.no_log_reminder_minutes_preference.subscribe,$.no_log_reminder_minutes_preference.get_snapshot,$.no_log_reminder_minutes_preference.get_server_snapshot),c=(0,r.useSyncExternalStore)(C.overwork_alert_hours_preference.subscribe,C.overwork_alert_hours_preference.get_snapshot,C.overwork_alert_hours_preference.get_server_snapshot),d=(0,r.useSyncExternalStore)(w.focus_goal_scope_preference.subscribe,w.focus_goal_scope_preference.get_snapshot,w.focus_goal_scope_preference.get_server_snapshot),m=(0,r.useSyncExternalStore)(j.focus_goal_sheet_name_preference.subscribe,j.focus_goal_sheet_name_preference.get_snapshot,j.focus_goal_sheet_name_preference.get_server_snapshot),u=(0,r.useSyncExternalStore)(N.focus_goal_tag_name_preference.subscribe,N.focus_goal_tag_name_preference.get_snapshot,N.focus_goal_tag_name_preference.get_server_snapshot),p=(0,r.useSyncExternalStore)(k.focus_goals_per_sheet_preference.subscribe,k.focus_goals_per_sheet_preference.get_snapshot,k.focus_goals_per_sheet_preference.get_server_snapshot),_=(0,r.useSyncExternalStore)(S.focus_goals_per_tag_preference.subscribe,S.focus_goals_per_tag_preference.get_snapshot,S.focus_goals_per_tag_preference.get_server_snapshot),[h,g]=(0,r.useState)(null),[x,f]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=()=>{try{let e=window.localStorage.getItem(D.POMODORO_STORAGE_KEY);if(null===e)return null;let t=JSON.parse(e).state;if(void 0===t||"running"!==t.status||null===t.deadline_at_ms)return null;let n=Math.max(0,t.deadline_at_ms-Date.now()),r=Math.floor(n/6e4),a=Math.floor(n%6e4/1e3);return{phase_label:"work"===t.phase?"Focus":"short_break"===t.phase?"Short break":"Long break",remaining_label:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}}catch{return null}},t=window.setTimeout(()=>{f(e())},0),n=window.setInterval(()=>{f(e())},1e3);return()=>{window.clearTimeout(t),window.clearInterval(n)}},[]),(0,r.useEffect)(()=>{if("true"!==s)return;let e=!1,t=async()=>{try{var t,n,r;let a=new URLSearchParams;a.set("scope",(t=d,n=m,r=u,"sheet"===t&&0===n.length||"tag"===t&&0===r.length?"global":t)),"sheet"===d&&m.length>0&&a.set("sheet",m),"tag"===d&&u.length>0&&a.set("tag",u);let s=await fetch(`/api/focus-nudges/status?${a.toString()}`);if(!s.ok)return;let i=await s.json();e||g(i)}catch{}};t();let n=window.setInterval(()=>{t()},6e4);return()=>{e=!0,window.clearInterval(n)}},[s,d,m,u]);let R=(0,r.useMemo)(()=>{if("true"!==s||null===h)return null;let{daily_minutes:e,weekly_minutes:t}=function(e){if("sheet"===e.scope&&e.sheet_name.length>0){let t=(0,y.parse_focus_goals_by_name)(e.per_sheet_json)[e.sheet_name];return void 0===t?{daily_minutes:null,weekly_minutes:null}:{daily_minutes:t.daily??e.global_daily,weekly_minutes:t.weekly??e.global_weekly}}if("tag"===e.scope&&e.tag_name.length>0){let t=(0,y.parse_focus_goals_by_name)(e.per_tag_json)[e.tag_name];return void 0===t?{daily_minutes:null,weekly_minutes:null}:{daily_minutes:t.daily??e.global_daily,weekly_minutes:t.weekly??e.global_weekly}}return{daily_minutes:e.global_daily,weekly_minutes:e.global_weekly}}({scope:d,sheet_name:m,tag_name:u,per_sheet_json:p,per_tag_json:_,global_daily:i,global_weekly:l});if(null===e||null===t)return{kind:"alert",tone:"info",title:A("daily",d,m,u),detail:"No goals configured yet for this scope. Set daily and weekly targets in Goal settings."};let r=6e4*Number.parseInt(e,10),g=6e4*Number.parseInt(t,10),x=36e5*Number.parseInt(c,10),f=Number.parseInt(o,10);return null!==h.activeTimerDurationMs&&h.activeTimerDurationMs>=x?{kind:"alert",tone:"warning",title:"Overwork alert",detail:`Current session is ${(0,b.format_duration)(h.activeTimerDurationMs,a)}. Consider a short break.`}:!n&&null!==h.minutesSinceLastLog&&h.minutesSinceLastLog>=f?{kind:"alert",tone:"warning",title:"Gentle reminder",detail:`No time logged for ${h.minutesSinceLastLog} min. Start a timer when you are back on task.`,show_check_in_shortcut:!0}:h.todayTrackedMs<r?{kind:"progress",scope:"daily",title:A("daily",d,m,u),tracked_ms:h.todayTrackedMs,target_ms:r}:h.weekTrackedMs<g?{kind:"progress",scope:"weekly",title:A("weekly",d,m,u),tracked_ms:h.weekTrackedMs,target_ms:g}:{kind:"alert",tone:"success",title:"Targets met",detail:"Daily and weekly focus goals are on track."}},[i,a,s,c,n,d,m,u,p,_,o,h,l]);if(null===R)return null;if("progress"===R.kind)return(0,t.jsx)(L,{scope:R.scope,title:R.title,tracked_ms:R.tracked_ms,target_ms:R.target_ms,duration_format:a,active_pomodoro:x});let F="warning"===R.tone?"mb-4 rounded-md border border-danger-border bg-danger-soft px-3 py-2.5 text-danger-text":"success"===R.tone?"mb-4 rounded-md border border-accent-border bg-accent-soft px-3 py-2.5 text-accent":"mb-4 rounded-md border border-panel-border bg-panel px-3 py-2.5 text-foreground";return(0,t.jsxs)("section",{className:F,"aria-live":"polite","aria-atomic":"true",children:[(0,t.jsx)("p",{className:"m-0 text-[0.85rem] font-semibold",children:R.title}),(0,t.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,t.jsx)("p",{className:"m-0 text-[0.82rem] leading-relaxed",children:R.detail}),R.show_check_in_shortcut&&void 0!==e?(0,t.jsx)("button",{type:"button",className:"cursor-pointer rounded border border-current bg-transparent px-2 py-1 text-[0.75rem] font-semibold",onClick:e,children:"Check in"}):null]})]})}function A(e,t,n,r){let a="daily"===e?"Relevant goal":"Weekly goal";return"sheet"===t&&n.length>0?`${a} \xb7 ${n}`:"tag"===t&&r.length>0?`${a} \xb7 @${r}`:a}function L({scope:e,title:r,tracked_ms:a,target_ms:s,duration_format:i,active_pomodoro:l}){let o=s>0?Math.min(100,a/s*100):0,c=Math.max(0,s-a);return(0,t.jsx)("section",{className:"mb-4 rounded-md border border-panel-border bg-panel px-4 py-3 shadow-sm","aria-label":r,"aria-live":"polite",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-stretch justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:r}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:["daily"===e?(0,t.jsx)(n.default,{href:"/settings/goals#focus-goals-nudges",className:"inline-flex h-6 w-6 items-center justify-center rounded border border-panel-border text-muted no-underline hover:bg-surface-hover hover:text-foreground","aria-label":"Open daily focus target settings",title:"Daily focus target settings",children:(0,t.jsx)(f.SettingsIcon,{})}):null,(0,t.jsxs)("p",{className:"m-0 font-mono text-[0.78rem] font-semibold text-accent",children:[Math.round(o),"%"]})]})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-baseline justify-between gap-3",children:[(0,t.jsxs)("p",{className:"m-0 font-mono text-[1.35rem] font-semibold leading-none text-foreground",children:[(0,b.format_duration)(a,i),(0,t.jsxs)("span",{className:"ml-1 text-[0.85rem] font-medium text-muted",children:["/ ",(0,b.format_duration)(s,i)]})]}),(0,t.jsxs)("p",{className:"m-0 text-[0.78rem] text-muted",children:[(0,b.format_duration)(c,i)," left ","daily"===e?"today":"this week"]})]}),(0,t.jsx)("div",{className:"mt-3 h-1.5 w-full overflow-hidden rounded-full bg-accent-soft",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:(0,t.jsx)("div",{className:"h-full rounded-full bg-accent transition-[width] duration-300",style:{width:`${o}%`}})})]}),null!==l?(0,t.jsxs)("aside",{className:"min-w-52 rounded-md border border-panel-border bg-surface-raised px-3 py-2.5",children:[(0,t.jsx)("p",{className:"m-0 text-[0.68rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Active Pomodoro"}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.82rem] font-semibold text-foreground",children:l.phase_label}),(0,t.jsx)("p",{className:"m-0 mt-1 font-mono text-[1.25rem] font-semibold leading-none text-accent",children:l.remaining_label})]}):null]})})}var R=e.i(71060),F=e.i(83391);function O(e,t,n){if(0===e.length)return null;let r=e.findIndex(e=>e.name===t),a=((-1===r?0:r)+("next"===n?1:-1)+e.length)%e.length;return e[a]?.name??null}var P=e.i(34995),U=e.i(53754),z=e.i(99211);function H({sheets:e,active_sheet_name:n,active_entry:a,is_pending:s,check_in_form_ref:i,active_entry_panel_ref:l,on_select_sheet:o,on_check_out:c}){let d=(0,R.useRouter)(),[m,u]=(0,r.useState)(!1),p=(0,U.use_check_out_action)(c),_=(0,r.useMemo)(()=>{let t=null!==a;return[{id:"help",label:"?",description:"Show keyboard shortcuts",key:"?",modifiers:["shift"],action:()=>{u(e=>!e)}},{id:"check-in",label:"C",description:"Check in (focus description)",key:"c",is_available:()=>!s&&!t,action:()=>{i.current?.expand_and_focus()}},{id:"check-out",label:"O",description:"Check out",key:"o",is_available:()=>!s&&t,action:()=>{p()}},{id:"edit-entry",label:"E",description:"Edit active entry",key:"e",is_available:()=>!s&&t,action:()=>{l.current?.start_edit()}},{id:"add-note",label:"N",description:"Add note to active entry",key:"n",is_available:()=>!s&&t,action:()=>{l.current?.start_add_note()}},{id:"pomodoro",label:"P",description:"Open Pomodoro",key:"p",is_available:()=>!s,action:()=>{d.push("/pomodoro")}},{id:"previous-sheet",label:"[",description:"Previous sheet",key:"[",is_available:()=>!s&&e.length>1,action:()=>{let t=O(e,n,"previous");null!==t&&t!==n&&o(t)}},{id:"next-sheet",label:"]",description:"Next sheet",key:"]",is_available:()=>!s&&e.length>1,action:()=>{let t=O(e,n,"next");null!==t&&t!==n&&o(t)}}]},[a,l,n,i,p,s,o,d,e]);return((0,z.use_document_keyboard_shortcuts)(_),m)?(0,t.jsx)(F.KeyboardShortcutsDialog,{sections:[...(0,P.get_app_keyboard_shortcut_sections)(),{title:"Tracker",entries:[{label:"C",description:"Check in (focus description)"},{label:"O",description:"Check out"},{label:"E",description:"Edit active entry description"},{label:"N",description:"Add note to active entry"},{label:"P",description:"Open Pomodoro"},{label:"[",description:"Previous sheet"},{label:"]",description:"Next sheet"}]}],on_close:()=>u(!1)}):null}var q=e.i(18774),B=e.i(31113),G=e.i(72550);function J(){try{let e=window.localStorage.getItem(G.SHEET_TAG_FILTERS_STORAGE_KEY);if(null===e)return{};let t=JSON.parse(e);if(null===t||"object"!=typeof t)return{};return t}catch{return{}}}function W(e){let t=J()[e]??[],n=[],r=new Set;for(let e of t)try{let t=(0,B.normalize_stored_tag)(e);r.has(t)||(r.add(t),n.push(t))}catch{continue}return n}var K=e.i(86580);function Y(e){return(0,K.get_stable_sheet_tag_filter_snapshot)(e,W(e))}function V(){return K.EMPTY_SHEET_TAG_FILTER}var Q=e.i(98425),Z=e.i(27850);function X(e,t){let n=J();0===t.length?delete n[e]:n[e]=t;try{window.localStorage.setItem(G.SHEET_TAG_FILTERS_STORAGE_KEY,JSON.stringify(n)),(0,Z.schedule_ui_preferences_cloud_sync)()}catch{}(0,Q.notify_sheet_tag_filters_subscribers)()}function ee(e,t){try{return(0,B.normalize_stored_tag)(e)===(0,B.normalize_stored_tag)(t)}catch{return!1}}var et=e.i(62796);function en(){return(0,r.useSyncExternalStore)(et.tag_filter_mode_preference.subscribe,et.tag_filter_mode_preference.get_snapshot,et.tag_filter_mode_preference.get_server_snapshot)}function er({sheet_name:e,sheet_tags:n}){let a=en(),i=(0,r.useSyncExternalStore)(Q.subscribe_sheet_tag_filters,()=>Y(e),V);if((0,r.useEffect)(()=>{!function(e,t){let n=W(e);if(0===n.length)return;let r=n.filter(e=>t.some(t=>ee(e,t)));r.length!==n.length&&X(e,r)}(e,n.map(e=>e.name))},[e,n]),0===n.length)return null;let l=i.length>0;return(0,t.jsxs)("div",{role:"group","aria-label":"Filter by tag",className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,t.jsx)("h2",{className:"m-0 shrink-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em]",children:"Filter by tag"}),(0,t.jsx)("p",{className:"m-0 shrink-0 text-[0.8rem] text-muted",children:"any"===a?"Show entries that include any selected tag.":"Show entries that include every selected tag."}),(0,t.jsxs)("div",{className:"ml-auto flex min-w-0 flex-wrap justify-end gap-1",children:[n.map(n=>{let r=i.some(e=>ee(e,n.name));return(0,t.jsxs)("button",{type:"button",className:`${(0,s.get_button_class_name)("ghost","small")} ${r?"border-accent-border bg-accent-soft text-foreground":""}`,"aria-pressed":r,onClick:()=>{var t;let r,a;return t=n.name,r=(0,B.normalize_stored_tag)(t),void((a=W(e)).some(e=>ee(e,r))?X(e,a.filter(e=>!ee(e,r))):X(e,[...a,r]))},children:[(0,q.format_display_tag)(n.name),(0,t.jsxs)("span",{className:"ml-1 font-normal text-muted",children:["(",n.entryCount,")"]})]},n.name)}),l?(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost","small"),onClick:()=>X(e,[]),children:"Clear filter"}):null]})]})}let ea="inline-flex shrink-0 cursor-pointer items-center gap-1.5";function es({checked:e,disabled:n=!1,indeterminate:a=!1,nested:s=!1,on_change:i,label:l,aria_label:o,className:c}){let d=(0,r.useRef)(null);(0,r.useEffect)(()=>{null!==d.current&&(d.current.indeterminate=a)},[a]);let m=void 0===c?ea:`${ea} ${c}`,u=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:d,type:"checkbox",className:"peer absolute m-0 h-px w-px overflow-hidden opacity-0",checked:e,disabled:n,"aria-label":s&&void 0===l?o:void 0,onChange:i}),(0,t.jsx)("span",{className:'relative block h-[0.85rem] w-[0.85rem] shrink-0 rounded-[0.2rem] border border-panel-border bg-input-bg box-border transition-[background-color,border-color] duration-150 peer-checked:border-accent peer-checked:bg-accent peer-indeterminate:border-accent peer-indeterminate:bg-accent peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-input-focus-border peer-focus-visible:outline-offset-1 peer-disabled:cursor-not-allowed peer-disabled:opacity-55 after:absolute after:left-1/2 after:top-[44%] after:hidden after:h-[0.28rem] after:w-[0.45rem] after:-translate-x-1/2 after:-translate-y-[60%] after:rotate-[-45deg] after:border-b-[1.5px] after:border-l-[1.5px] after:border-accent-text-on after:content-[""] peer-checked:after:block peer-indeterminate:after:top-1/2 peer-indeterminate:after:block peer-indeterminate:after:h-[1.5px] peer-indeterminate:after:w-[0.45rem] peer-indeterminate:after:-translate-x-1/2 peer-indeterminate:after:-translate-y-1/2 peer-indeterminate:after:rotate-0 peer-indeterminate:after:border-0 peer-indeterminate:after:bg-accent-text-on',"aria-hidden":"true"})]});return s?(0,t.jsx)("span",{className:m,children:u}):(0,t.jsxs)("label",{className:m,children:[u,void 0!==l?(0,t.jsx)("span",{className:"select-none text-[0.8rem] leading-tight text-muted",children:l}):null]})}var ei=e.i(14974),el=e.i(37399),eo=e.i(25204);let ec="block w-full cursor-pointer rounded-[0.45rem] border-0 bg-transparent px-2.5 py-1.5 text-left font-inherit text-[0.85rem] text-inherit hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-55";function ed({current_sheet_name:e,sheets:n,is_pending:a,on_edit:s,on_add_note:i,on_show_add_note_form:l,on_revise_description_ai:o,can_revise_description_ai:c=!1,on_resume:d,entry_is_active:m=!1,on_delete:u,on_move:p}){let _=n.find(t=>t.name===e),h=m||_?.hasActiveEntry===!0&&!m,g=n.filter(t=>t.name!==e),[x,f]=(0,r.useState)(!1),b=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!x)return;let e=e=>{null===b.current||b.current.contains(e.target)||f(!1)};return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[x]);let y=()=>{f(!1)};return(0,eo.use_escape_to_cancel)(y,x),(0,t.jsxs)("div",{className:"relative shrink-0",ref:b,children:[(0,t.jsx)("button",{type:"button",className:"inline-flex cursor-pointer appearance-none items-center justify-center rounded-none border-0 bg-transparent p-0.5 text-muted shadow-none hover:opacity-75 focus-visible:outline-2 focus-visible:outline-input-focus-border focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-55","aria-label":"Entry actions","aria-expanded":x,"aria-haspopup":"menu",disabled:a,onClick:()=>f(e=>!e),children:(0,t.jsx)(el.HamburgerIcon,{})}),x?(0,t.jsxs)("ul",{className:"absolute right-0 top-full z-10 mt-1.5 min-w-56 list-none rounded-md border border-panel-border bg-panel p-1.5 shadow-md",role:"menu",children:[(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:a,onClick:()=>{y(),s()},children:"Edit times"})}),void 0!==l||void 0!==i?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:a,onClick:()=>{if(y(),void 0!==l)return void l();let e=function(){let e=window.prompt("Add note","");if(null===e)return null;let t=e.trim();return 0===t.length?null:t}();null!==e&&void 0!==i&&i(e)},children:"Add note"})}):null,void 0!==o?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:a||!c,title:c?"Revise with AI":"Configure provider and key in Settings → AI suggestions",onClick:()=>{y(),o()},children:"Revise description with AI"})}):null,void 0!==d?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:a||h,title:h?m?"This entry is already active":"Another entry is active on this sheet":void 0,onClick:()=>{y(),d()},children:"Resume"})}):null,(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("p",{className:"m-0 px-2.5 py-0.5 text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted",children:"Move to sheet"})}),0===g.length?(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:ec,role:"menuitem",disabled:!0,children:"No other sheets"})}):g.map(e=>(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:`${ec} pl-4`,role:"menuitem",disabled:a||e.hasActiveEntry,title:e.hasActiveEntry?"That sheet already has an active entry":void 0,onClick:()=>{y(),p(e.name)},children:e.name})},e.name)),(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:`${ec} text-danger`,role:"menuitem",disabled:a,onClick:()=>{y(),u()},children:"Delete"})})]}):null]})}function em({rotated:e=!1,className:n=""}){return(0,t.jsx)("svg",{className:`h-3 w-3 shrink-0 transition-transform duration-150 ${e?"rotate-90":""} ${n}`.trim(),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m9 18 6-6-6-6"})})}var eu=e.i(75899);function ep({initial_text:e,is_pending:n,inline:a=!1,on_save:l,on_cancel:o}){let[c,d]=(0,r.useState)(e);(0,eo.use_escape_to_cancel)(o);let m=Math.min(6,Math.max(2,e.split("\n").length)),u=a?`${(0,i.get_input_class_name)()} min-h-10 w-full resize-y text-xs leading-snug`:`${(0,i.get_input_class_name)()} min-h-10 w-full resize-y text-[0.85rem] leading-snug`;return(0,t.jsxs)("form",{className:"flex w-full flex-col gap-1.5",onSubmit:e=>{e.preventDefault();let t=c.trim();0!==t.length&&l(t)},onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("textarea",{className:u,value:c,rows:m,disabled:n,onChange:e=>d(e.target.value)}),(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost"),disabled:n,onClick:o,children:"Cancel"}),(0,t.jsx)("button",{type:"submit",className:(0,s.get_button_class_name)("ghost"),disabled:n||0===c.trim().length,children:"Save"})]})]})}function e_(){return(0,t.jsxs)("svg",{className:"h-[0.85rem] w-[0.85rem]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M12 20h9"}),(0,t.jsx)("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function eh(){return(0,t.jsxs)("svg",{className:"h-[0.85rem] w-[0.85rem]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3 6h18"}),(0,t.jsx)("path",{d:"M8 6V4h8v2"}),(0,t.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),(0,t.jsx)("path",{d:"M10 11v6"}),(0,t.jsx)("path",{d:"M14 11v6"})]})}var eg=e.i(35923);let ex="inline-flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-[0.35rem] border-0 bg-transparent p-0 text-muted hover:bg-surface-hover hover:text-foreground disabled:cursor-not-allowed disabled:opacity-55";function ef({notes:e,variant:n="panel",in_bar:a=!1,is_pending:s=!1,on_edit_note:i,on_delete_note:l}){let o=(0,eg.use_time_format)(),[c,d]=(0,r.useState)(null),[m,u]=(0,r.useState)("panel"===n&&!a);if(0===e.length)return null;let p=[...e].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),_="inline"===n,h="panel"===n&&a,g=m||null!==c,x=_?`${e.length} ${1===e.length?"note":"notes"}`:`Notes (${e.length})`,f=[_?"m-0 w-full p-0":"border-t border-accent-border pt-3.5",a&&!_?"border-[color-mix(in_srgb,var(--accent-border)_65%,var(--panel-border))]":"",h&&g?"flex min-h-0 flex-1 flex-col":h?"flex shrink-0 flex-col":""].filter(Boolean).join(" "),b=g?"mt-1.5":"hidden",y=_?`m-0 flex list-none flex-col gap-1.5 overflow-visible p-0 compact:gap-0.5 ${b}`:h?`m-0 grid min-h-0 flex-1 list-none auto-rows-fr grid-cols-2 gap-2 p-0 max-[860px]:grid-cols-1 ${b}`:`m-0 grid list-none grid-cols-2 gap-2 p-0 max-[860px]:grid-cols-1 ${b}`,v=_?"flex flex-col gap-0.5 rounded-sm border border-panel-border bg-ghost-bg px-2 py-1.5 compact:rounded-none compact:px-1.5 compact:py-1":h?"flex min-h-0 flex-col justify-center gap-0.5 rounded-sm border border-panel-border bg-[color-mix(in_srgb,var(--panel)_55%,var(--background))] px-2.5 py-2":"flex flex-col gap-0.5 rounded-sm border border-panel-border bg-[color-mix(in_srgb,var(--panel)_55%,var(--background))] px-2.5 py-2",w=e=>void 0===i&&void 0===l?null:(0,t.jsxs)("div",{className:"flex shrink-0 gap-0.5",children:[void 0!==i?(0,t.jsx)("button",{type:"button",className:ex,"aria-label":"Edit note",title:"Edit note",disabled:s,onClick:t=>{var n;t.stopPropagation(),n=e.timestamp,u(!0),d(n)},children:(0,t.jsx)(e_,{})}):null,void 0!==l?(0,t.jsx)("button",{type:"button",className:`${ex} hover:text-danger`,"aria-label":"Delete note",title:"Delete note",disabled:s,onClick:t=>{var n;t.stopPropagation(),c===(n=e.timestamp)&&d(null),l?.(n)},children:(0,t.jsx)(eh,{})}):null]});return(0,t.jsxs)("section",{className:f,"aria-label":"Entry notes",children:[(0,t.jsxs)("button",{type:"button",className:_?"inline-flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 font-inherit text-xs font-medium normal-case tracking-normal text-muted hover:text-foreground":"inline-flex cursor-pointer items-center gap-1.5 border-0 bg-transparent px-0 py-0.5 font-inherit text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted hover:text-foreground","aria-expanded":g,onClick:e=>{e.stopPropagation(),null===c&&u(e=>!e)},children:[(0,t.jsx)(em,{rotated:g}),(0,t.jsx)("span",{children:x})]}),(0,t.jsx)("ul",{className:y,children:p.map((e,n)=>{let r=c===e.timestamp;return(0,t.jsx)("li",{className:v,children:r?(0,t.jsx)(ep,{initial_text:e.text,inline:_,is_pending:s,on_cancel:()=>d(null),on_save:t=>{var n;return n=e.timestamp,void(i?.(n,t),d(null))}}):_?(0,t.jsxs)("div",{className:"flex w-full items-start justify-between gap-1.5",children:[(0,t.jsxs)("p",{className:"m-0 flex min-w-0 flex-1 items-baseline gap-1.5 text-xs leading-snug text-foreground compact:text-[0.72rem]",children:[(0,t.jsx)("time",{className:"shrink-0 font-mono text-[0.68rem] text-muted",dateTime:e.timestamp,children:(0,eu.format_time)(e.timestamp,o)}),(0,t.jsx)("span",{className:"min-w-0 overflow-wrap-anywhere whitespace-pre-wrap",children:e.text})]}),w(e)]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex w-full items-start justify-between gap-1.5",children:[(0,t.jsx)("time",{className:"font-mono text-[0.72rem] text-muted",dateTime:e.timestamp,children:(0,eu.format_time)(e.timestamp,o)}),w(e)]}),(0,t.jsx)("p",{className:"m-0 overflow-wrap-anywhere text-[0.9rem] leading-snug whitespace-pre-wrap",children:e.text})]})},`${e.timestamp}-${n}`)})})]})}var eb=e.i(39552);function ey(e){return(0,eb.format)(new Date(e),"MMM d, h:mm a")}var ev=e.i(44356);function ew({entry:e,known_tags:n,is_pending:l,initial_description_override:o,in_active_panel:c=!1,times_only:d=!1,start_only:m=!1,on_save:u,on_cancel:p}){let _=(0,r.useMemo)(()=>o??(0,ev.build_resume_description)(e.description,e.tags),[e.description,e.id,e.tags,o]),[h,g]=(0,r.useState)(_),[x,f]=(0,r.useState)(""),[b,y]=(0,r.useState)("");(0,r.useEffect)(()=>{g(o??(0,ev.build_resume_description)(e.description,e.tags)),f(""),y("")},[e.description,e.id,e.sheetName,e.tags,o]),(0,eo.use_escape_to_cancel)(p);let v=e.isActive?"still running":ey(e.end??e.start),w=d?x.trim().length>0||!m&&b.trim().length>0:h.trim()!==_.trim()||x.trim().length>0||!m&&b.trim().length>0;return(0,t.jsxs)("form",{className:`flex flex-col gap-3 rounded-[0.65rem] border border-panel-border bg-input-bg p-3 ${c?"mt-2":""}`,onSubmit:e=>{e.preventDefault();let t=h.trim(),n=x.trim(),r=b.trim(),a={};d||t===_.trim()||(a.description=t),n.length>0&&(a.start=n),!m&&r.length>0&&(a.end=r),(void 0!==a.description||void 0!==a.start||void 0!==a.end)&&u(a)},children:[(0,t.jsx)("p",{className:"m-0 text-[0.85rem] font-semibold",children:d?"Edit times":"Edit entry"}),d?null:(0,t.jsxs)("label",{className:"flex flex-col gap-1",htmlFor:`entry-description-${e.id}`,children:[(0,t.jsx)("span",{className:"text-[0.8rem] font-semibold",children:"Description"}),(0,t.jsx)(a.TagAutocompleteInput,{id:`entry-description-${e.id}`,value:h,known_tags:n,placeholder:"e.g. crafting something @design",disabled:l,autoFocus:c,on_change:g})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"m-0 text-[0.8rem] font-semibold text-muted",children:"Times (optional)"}),(0,t.jsxs)("div",{className:`grid gap-2.5 max-[860px]:grid-cols-1 ${m?"grid-cols-1":"grid-cols-2"}`,children:[(0,t.jsxs)("label",{className:"flex flex-col gap-1",htmlFor:`entry-start-${e.id}`,children:[(0,t.jsx)("span",{className:"text-[0.8rem] font-semibold",children:"Start"}),(0,t.jsxs)("span",{className:"text-[0.72rem] text-muted",children:["Current: ",ey(e.start)]}),(0,t.jsx)("input",{id:`entry-start-${e.id}`,className:(0,i.get_input_class_name)("compact"),value:x,onChange:e=>f(e.target.value),placeholder:"e.g. 10am, 30 minutes ago",disabled:l,autoFocus:d&&c})]}),m?null:(0,t.jsxs)("label",{className:"flex flex-col gap-1",htmlFor:`entry-end-${e.id}`,children:[(0,t.jsx)("span",{className:"text-[0.8rem] font-semibold",children:"End"}),(0,t.jsxs)("span",{className:"text-[0.72rem] text-muted",children:["Current: ",v]}),(0,t.jsx)("input",{id:`entry-end-${e.id}`,className:(0,i.get_input_class_name)("compact"),value:b,onChange:e=>y(e.target.value),placeholder:e.isActive?"e.g. now, 5 minutes ago":"e.g. 11:30am",disabled:l})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)("button",{type:"submit",className:(0,s.get_button_class_name)("primary","small"),disabled:l||!w,children:"Save"}),(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost","small"),disabled:l,onClick:p,children:"Cancel"})]})]})}function ej({selected_count:e,total_count:n,all_selected:a,some_selected:l,selected_entries:o,sheets:c,is_pending:d,on_toggle_all:m,on_move:u,on_delete:p,on_clear:_}){let[h,g]=(0,r.useState)(""),x=o.some(e=>e.isActive),f=c.filter(e=>(!x||!e.hasActiveEntry)&&o.some(t=>t.sheetName!==e.name));return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md border border-accent-border bg-accent-soft px-3 py-2",children:[(0,t.jsx)(es,{className:"shrink-0",checked:a,indeterminate:l,disabled:d,aria_label:a?"Deselect all entries":"Select all entries",on_change:m}),(0,t.jsxs)("p",{className:"m-0 shrink-0 text-[0.85rem] font-semibold",children:[e,(0,t.jsx)("span",{className:"text-muted",children:` of ${n} selected`})]}),(0,t.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)("select",{className:`${(0,i.get_input_class_name)("compact")} min-w-32`,value:h,disabled:d||0===f.length,"aria-label":"Move to sheet",onChange:e=>g(e.target.value),children:[(0,t.jsx)("option",{value:"",children:"Move to…"}),f.map(e=>(0,t.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost","small"),disabled:d||0===h.trim().length||0===f.length,onClick:()=>{let e=h.trim();0!==e.length&&(u(e),g(""))},children:"Move"})]}),(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("danger","small"),disabled:d,onClick:p,children:"Delete"}),(0,t.jsx)("button",{type:"button",className:`${(0,s.get_button_class_name)("ghost","small")} shrink-0`,disabled:d,"aria-label":"Clear selection",title:"Clear selection",onClick:_,children:"✕"})]})]})}var eN=e.i(66770),ek=e.i(4874),eS=e.i(7902);function eE(){return(0,r.useSyncExternalStore)(ek.entry_list_sort_preference.subscribe,ek.entry_list_sort_preference.get_snapshot,ek.entry_list_sort_preference.get_server_snapshot)}let e$=(0,eN.get_entry_list_sort_options)();function eC({is_pending:e=!1}){let n=eE();return(0,t.jsxs)("fieldset",{className:"m-0 flex flex-wrap items-center gap-x-2 gap-y-1.5 border-0 p-0",children:[(0,t.jsx)("legend",{className:"sr-only",children:"Order entries by"}),(0,t.jsx)("span",{className:"shrink-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Order by"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Order entries by",children:e$.map(r=>{let a=n===r.value;return(0,t.jsx)("button",{type:"button",className:a?(0,s.get_button_class_name)("primary","small"):(0,s.get_button_class_name)("ghost","small"),disabled:e,"aria-pressed":a,onClick:()=>(0,eS.persist_ui_preference)(ek.entry_list_sort_preference,r.value),children:r.label},r.value)})})]})}function eT(e){let t=e.description.trim()||"Untitled entry",n=e.isActive?" This will stop the active timer.":"";return{title:"Delete entry?",message:`Delete "${t}" on sheet "${e.sheetName}"?${n}`,confirmLabel:"Delete",variant:"danger"}}function eD(e){return`${e.sheetName}-${e.id}`}var eM=e.i(36405);function eI(){return"true"===(0,r.useSyncExternalStore)(eM.confirm_destructive_actions_preference.subscribe,eM.confirm_destructive_actions_preference.get_snapshot,eM.confirm_destructive_actions_preference.get_server_snapshot)}function eA({title:e,entries:n,sheets:a,known_tags:s,total_ms:i,empty_message:m,is_pending:u,show_sheet_name:_=!0,header_extra:h,on_delete:g,on_edit:x,on_move:f,on_move_many:y,on_delete_many:v,on_edit_note:w,on_add_note:j,on_resume:N}){let{confirm:k}=(0,ei.use_confirm_dialog)(),S=eI(),E=(0,eg.use_time_format)(),$=(0,M.use_duration_format)(),[C,T]=(0,r.useState)(null),[D,I]=(0,r.useState)(()=>new Set),[A,L]=(0,r.useState)(null),[R,F]=(0,r.useState)(null),[O,P]=(0,r.useState)({}),U=(0,r.useSyncExternalStore)(o.entry_suggestion_provider_preference.subscribe,o.entry_suggestion_provider_preference.get_snapshot,o.entry_suggestion_provider_preference.get_server_snapshot),z=(0,r.useSyncExternalStore)(d.openai_api_key_preference.subscribe,d.openai_api_key_preference.get_snapshot,d.openai_api_key_preference.get_server_snapshot),H=(0,r.useSyncExternalStore)(l.claude_api_key_preference.subscribe,l.claude_api_key_preference.get_snapshot,l.claude_api_key_preference.get_server_snapshot),B=(0,r.useSyncExternalStore)(c.google_ai_api_key_preference.subscribe,c.google_ai_api_key_preference.get_snapshot,c.google_ai_api_key_preference.get_server_snapshot),G="openai"===U?z:"claude"===U?H:"google_ai"===U?B:"",J="none"!==U&&G.trim().length>0,W=n.map(e=>eD(e)),K=n.filter(e=>D.has(eD(e))),Y=n.length>0&&K.length===n.length,V=K.length>0&&K.length<n.length;(0,r.useEffect)(()=>{I(e=>{let t=new Set(W),n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[W.join("|")]);let Q=()=>{Y?I(new Set):I(new Set(W))},Z=()=>{I(new Set)},X=async()=>{let e,t,n;0!==K.length&&(!S||await k((e=K.length,t=K.some(e=>e.isActive),n=1===e?"1 entry":`${e} entries`,{title:1===e?"Delete entry?":"Delete entries?",message:`Permanently delete ${n}?${t?" This will stop the active timer.":""}`,confirmLabel:"Delete",variant:"danger"})))&&(v(K),Z())},ee=K.length>0,et=async e=>{if(!J)return;let t=eD(e);L(t),F(null);try{let n=e.notes.map(e=>e.text).join("\n"),r=await p({provider:U,api_key:G,context:e.description,notes:n});P(e=>({...e,[t]:r})),T(t)}catch(e){F(e instanceof Error?e.message:String(e))}finally{L(null)}};return(0,eo.use_escape_to_cancel)(Z,ee&&null===C),(0,t.jsxs)("section",{className:"min-w-0",children:[(0,t.jsx)("header",{className:"mb-3 flex flex-col gap-2 border-b border-panel-border pb-2.5 compact:mb-2 compact:pb-1.5",children:ee?(0,t.jsx)(ej,{selected_count:K.length,total_count:n.length,all_selected:Y,some_selected:V,selected_entries:K,sheets:a,is_pending:u,on_toggle_all:Q,on_move:e=>{y(K,e),Z()},on_delete:()=>void X(),on_clear:Z}):(0,t.jsxs)(t.Fragment,{children:[h,(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2.5",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[n.length>0?(0,t.jsx)(es,{className:"shrink-0",checked:Y,indeterminate:V,disabled:u,aria_label:"Select all entries",on_change:Q}):null,(0,t.jsx)("h2",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em]",children:e}),(0,t.jsx)("span",{className:"text-[0.8rem] text-muted",children:0===n.length?null:1===n.length?"1 entry":`${n.length} entries`})]}),(0,t.jsxs)("p",{className:"m-0 font-mono text-[0.85rem] text-muted max-[640px]:w-full",children:[(0,b.format_duration)(i,$)," total"]})]}),(0,t.jsx)(eC,{is_pending:u}),null!==R?(0,t.jsx)("p",{className:"m-0 text-[0.8rem] text-danger",children:R}):null]})}),0===n.length?(0,t.jsx)("p",{className:"m-0 text-muted",children:m}):(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("ul",{className:"m-0 flex list-none flex-col p-0",children:n.map(e=>{let n=eD(e),r=C===n,i=D.has(n);return r?(0,t.jsx)("li",{className:"block border-b border-panel-border py-2.5 last:border-b-0 compact:py-1.5",children:(0,t.jsx)(ew,{entry:e,known_tags:s,is_pending:u,initial_description_override:O[n],on_cancel:()=>{T(null),P(e=>{if(!(n in e))return e;let t={...e};return delete t[n],t})},on_save:t=>{x(e,t),T(null),P(e=>{if(!(n in e))return e;let t={...e};return delete t[n],t})}})},n):(0,t.jsxs)("li",{className:`group relative flex flex-col gap-0 border-b border-panel-border px-2 py-2.5 transition-colors duration-150 last:border-b-0 hover:bg-surface-hover compact:py-1.5 ${i?"bg-accent-soft hover:bg-accent-soft":""}`,children:[(0,t.jsxs)("div",{className:"flex w-full min-w-0 flex-col items-start gap-2.5 min-[700px]:flex-row min-[700px]:items-center compact:gap-1.5",children:[(0,t.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 has-disabled:cursor-not-allowed","aria-label":`Select entry ${e.description||"Untitled entry"}`,children:[(0,t.jsx)(es,{nested:!0,className:`shrink-0 pr-1 transition-opacity duration-150 compact:pr-0.5 ${i||ee?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"}`,checked:i,disabled:u,on_change:()=>{I(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t})}}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"m-0 overflow-wrap-anywhere font-semibold leading-snug compact:text-[0.9rem] compact:leading-tight",children:e.description||"Untitled entry"}),(0,t.jsxs)("div",{className:"mt-0.5 flex flex-wrap items-center gap-1 text-[0.8rem] text-muted compact:mt-px compact:gap-0.5 compact:text-[0.72rem]",children:[_?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:e.sheetName}),(0,t.jsx)("span",{children:"·"})]}):null,(0,t.jsxs)("span",{children:["#",e.id]}),(0,t.jsx)("span",{children:"·"}),(0,t.jsxs)("span",{className:"whitespace-nowrap",children:[(0,eu.format_time)(e.start,E),null===e.end?" → now":` → ${(0,eu.format_time)(e.end,E)}`]}),e.tags.length>0?(0,t.jsx)("ul",{className:"m-0 flex list-none flex-wrap gap-1 p-0",children:e.tags.map(e=>(0,t.jsx)("li",{className:"rounded-full bg-tag-bg px-2 py-0.5 text-xs text-tag-text",children:(0,q.format_display_tag)(e)},e))}):null]})]})]}),(0,t.jsxs)("div",{className:"flex w-full shrink-0 flex-row items-center justify-between gap-2 min-[700px]:w-auto min-[700px]:justify-end max-[860px]:flex-wrap compact:gap-1.5",children:[(0,t.jsx)("p",{className:`m-0 whitespace-nowrap text-right font-mono text-[0.9rem] text-muted compact:text-[0.8rem] ${e.isActive?"text-accent":""}`,children:(0,b.format_duration)(e.durationMs,$)}),(0,t.jsx)(ed,{current_sheet_name:e.sheetName,sheets:a,is_pending:u||A===n,on_edit:()=>{T(n),P(e=>{if(!(n in e))return e;let t={...e};return delete t[n],t})},on_revise_description_ai:J?()=>void et(e):void 0,can_revise_description_ai:J,on_add_note:t=>j(e,t),on_resume:()=>N(e),entry_is_active:e.isActive,on_move:t=>f(e,t),on_delete:async()=>{(!S||await k(eT(e)))&&g(e)}})]})]}),e.notes.length>0?(0,t.jsx)("div",{className:"w-full pt-1 pl-[calc(0.85rem+0.5rem+0.35rem)] compact:pt-0.5 compact:pl-[calc(0.85rem+0.35rem+0.2rem)]",children:(0,t.jsx)(ef,{notes:e.notes,variant:"inline",is_pending:u,on_edit_note:(t,n)=>w(e,t,n)})}):null]},n)})})})]})}let eL="block w-full cursor-pointer rounded-[0.45rem] border-0 bg-transparent px-2.5 py-1.5 text-left font-inherit text-[0.85rem] text-inherit hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-55";function eR({sheet_name:e,is_pending:n,can_delete:a,on_rename:s,on_delete:i}){let[l,o]=(0,r.useState)(!1),c=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!l)return;let e=e=>{null===c.current||c.current.contains(e.target)||o(!1)};return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[l]);let d=()=>{o(!1)};return(0,t.jsxs)("div",{className:"relative shrink-0 self-center",ref:c,children:[(0,t.jsx)("button",{type:"button",className:"inline-flex cursor-pointer appearance-none items-center justify-center rounded-none border-0 bg-transparent p-0.5 text-muted shadow-none hover:opacity-75 focus-visible:outline-2 focus-visible:outline-input-focus-border focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-55","aria-label":`Actions for sheet ${e}`,"aria-expanded":l,"aria-haspopup":"menu",disabled:n,onClick:()=>o(e=>!e),children:(0,t.jsx)(el.HamburgerIcon,{})}),l?(0,t.jsxs)("ul",{className:"absolute right-0 top-full z-10 mt-1.5 min-w-56 list-none rounded-md border border-panel-border bg-panel p-1.5 shadow-md",role:"menu",children:[(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:eL,role:"menuitem",disabled:n,onClick:()=>{d(),s()},children:"Rename"})}),(0,t.jsx)("li",{className:"my-1 border-t border-panel-border",role:"separator","aria-hidden":"true"}),(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{type:"button",className:`${eL} text-danger`,role:"menuitem",disabled:n||!a,title:a?void 0:"Cannot delete the last sheet",onClick:()=>{d(),i()},children:"Delete sheet"})})]}):null]})}function eF({sheets:e,db_path:n,on_select:a,on_create:l,on_rename:o,on_delete:c,is_pending:d}){let{confirm:m}=(0,ei.use_confirm_dialog)(),u=eI(),p=e.length>1,[_,h]=(0,r.useState)(!1),[g,x]=(0,r.useState)(""),[f,b]=(0,r.useState)(null),[y,v]=(0,r.useState)(""),w=()=>{h(!1),x("")},j=()=>{b(null),v("")};(0,eo.use_escape_to_cancel)(j,null!==f),(0,eo.use_escape_to_cancel)(w,_);let N=e=>{if(e.preventDefault(),null===f)return;let t=y.trim();0===t.length||t===f||o(f,t),j()};return(0,t.jsxs)("aside",{className:"flex min-w-0 flex-col gap-3 max-[860px]:min-w-0",children:[(0,t.jsx)("h2",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Sheets"}),(0,t.jsx)("ul",{className:"m-0 flex min-h-0 flex-1 list-none flex-col gap-1.5 p-0",children:e.map(e=>(0,t.jsx)("li",{className:"min-w-0",children:f===e.name?(0,t.jsxs)("form",{className:"flex w-full min-w-0 flex-col gap-1.5",onSubmit:N,children:[(0,t.jsx)("input",{className:(0,i.get_input_class_name)("compact"),value:y,onChange:e=>v(e.target.value),disabled:d,autoFocus:!0}),(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)("button",{type:"submit",className:`${(0,s.get_button_class_name)("ghost")} flex-1`,disabled:d||0===y.trim().length,children:"Save"}),(0,t.jsx)("button",{type:"button",className:`${(0,s.get_button_class_name)("ghost")} flex-1`,disabled:d,onClick:j,children:"Cancel"})]})]}):(0,t.jsxs)("div",{className:"flex min-w-0 items-stretch gap-1",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 cursor-pointer items-center justify-between gap-2 rounded-md border border-transparent bg-transparent px-2.5 py-2 text-left transition-[background-color,color] duration-150 hover:bg-surface-hover",disabled:d&&!e.isActive,onClick:()=>a(e.name),children:[(0,t.jsx)("span",{className:`min-w-0 flex-1 truncate font-semibold ${e.isActive||e.hasActiveEntry?"text-accent":""}`,children:e.name}),(0,t.jsx)("span",{className:`shrink-0 text-xs whitespace-nowrap ${e.hasActiveEntry?"text-accent":"text-muted"}`,children:e.hasActiveEntry?"● active":`${e.entryCount} entries`})]}),(0,t.jsx)(eR,{sheet_name:e.name,is_pending:d,can_delete:p,on_rename:()=>{var t;b(t=e.name),v(t)},on_delete:async()=>{var t,n,r;let a;(!u||await m((t=e.name,n=e.entryCount,r=e.hasActiveEntry,a=0===n?"":` This will delete ${n} ${1===n?"entry":"entries"}.`,{title:"Delete sheet?",message:`Delete "${t}"?${a}${r?" This will stop the active timer.":""}`,confirmLabel:"Delete sheet",variant:"danger"})))&&c(e.name)}})]})},e.name))}),_?(0,t.jsxs)("form",{className:"flex w-full min-w-0 flex-col gap-2",onSubmit:e=>{e.preventDefault();let t=g.trim();0!==t.length&&(l(t),w())},children:[(0,t.jsx)("input",{className:(0,i.get_input_class_name)("compact"),value:g,onChange:e=>x(e.target.value),placeholder:"New sheet name",disabled:d,autoFocus:!0}),(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)("button",{type:"submit",className:`${(0,s.get_button_class_name)("ghost")} flex-1`,disabled:d||0===g.trim().length,children:"Add"}),(0,t.jsx)("button",{type:"button",className:`${(0,s.get_button_class_name)("ghost")} flex-1`,disabled:d,onClick:w,children:"Cancel"})]})]}):(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost"),disabled:d,onClick:()=>h(!0),children:"Add sheet"}),(0,t.jsx)("p",{className:"mt-auto shrink-0 overflow-wrap-anywhere border-t border-panel-border pt-3 font-mono text-[0.65rem] leading-snug text-muted",title:n,children:n})]})}var eO=e.i(60935);function eP(){return"true"===(0,r.useSyncExternalStore)(eO.timer_show_seconds_preference.subscribe,eO.timer_show_seconds_preference.get_snapshot,eO.timer_show_seconds_preference.get_server_snapshot)}function eU({entry:e,in_bar:n,is_pending:a,initial_at:l,on_cancel:o,on_submit:c}){let d=(0,M.use_duration_format)(),m=eP(),[u,p]=(0,r.useState)(()=>Date.now()-new Date(e.start).getTime()),[_,h]=(0,r.useState)(""),[g,x]=(0,r.useState)(l??""),f=(0,r.useRef)(null);(0,eo.use_escape_to_cancel)(o),(0,r.useEffect)(()=>{f.current?.focus()},[]),(0,r.useEffect)(()=>{p(Date.now()-new Date(e.start).getTime());let t=window.setInterval(()=>{p(Date.now()-new Date(e.start).getTime())},1e3);return()=>window.clearInterval(t)},[e.start]);let y=(0,b.format_duration)(u,d,m),v=e.description||"Untitled entry";return(0,t.jsxs)("form",{className:"flex min-w-0 flex-col gap-4","aria-label":"Check out form",onSubmit:e=>{e.preventDefault();let t=_.trim(),n=g.trim(),r=t.length>0,a=n.length>0;r||a?c({...a?{at:n}:{},...r?{note:t}:{}}):c(void 0)},children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-[0.68rem] font-bold uppercase leading-none tracking-wider text-danger",children:"Checking out"}),(0,t.jsx)("h2",{className:"m-0 min-w-0 truncate text-[1.05rem] font-[650] leading-tight tracking-tight min-[560px]:text-[1.15rem]",children:v})]}),(0,t.jsx)("p",{className:"m-0 whitespace-nowrap font-mono text-[1.4rem] font-medium leading-none tracking-tight text-accent min-[560px]:text-[1.6rem]",children:y})]}),e.tags.length>0?(0,t.jsx)("ul",{className:"m-0 flex list-none flex-wrap gap-1.5 p-0",children:e.tags.map(e=>(0,t.jsx)("li",{className:"rounded-full bg-tag-bg px-2 py-0.5 text-[0.72rem] text-tag-text",children:(0,q.format_display_tag)(e)},e))}):null,(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3 min-[640px]:grid-cols-[minmax(0,1fr)_minmax(10rem,14rem)]",children:[(0,t.jsxs)("label",{className:"flex min-w-0 flex-col gap-1",htmlFor:"checkout-note",children:[(0,t.jsxs)("span",{className:"text-[0.8rem] font-semibold",children:["Note ",(0,t.jsx)("span",{className:"font-normal text-muted",children:"(optional)"})]}),(0,t.jsx)("input",{ref:f,id:"checkout-note",className:(0,i.get_input_class_name)("compact"),value:_,onChange:e=>h(e.target.value),placeholder:"Wrap-up, blockers, next steps…",disabled:a})]}),(0,t.jsxs)("label",{className:"flex min-w-0 flex-col gap-1",htmlFor:"checkout-at",children:[(0,t.jsxs)("span",{className:"text-[0.8rem] font-semibold",children:["End time ",(0,t.jsx)("span",{className:"font-normal text-muted",children:"(optional)"})]}),(0,t.jsx)("input",{id:"checkout-at",className:(0,i.get_input_class_name)("compact"),value:g,onChange:e=>x(e.target.value),placeholder:"e.g. now, 30 minutes ago, 5:30pm",disabled:a})]})]}),(0,t.jsxs)("div",{className:`flex flex-wrap items-center gap-2 ${n?"":"pt-1"}`,children:[(0,t.jsx)("button",{type:"submit",className:(0,s.get_button_class_name)("danger-solid"),disabled:a,children:"Confirm check out"}),(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost"),disabled:a,onClick:o,children:"Cancel"})]})]})}function ez(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",role:"presentation","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M12 3l1.7 4.3L18 9l-4.3 1.7L12 15l-1.7-4.3L6 9l4.3-1.7L12 3zM19 14l.9 2.1L22 17l-2.1.9L19 20l-.9-2.1L16 17l2.1-.9L19 14zM5 15l.9 2.1L8 18l-2.1.9L5 21l-.9-2.1L2 18l2.1-.9L5 15z",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function eH({entry:e,known_tags:n,is_pending:i,on_save:m,on_cancel:u}){let _=(0,r.useMemo)(()=>(0,ev.build_resume_description)(e.description,e.tags),[e.description,e.id,e.tags]),[h,g]=(0,r.useState)(_),[x,f]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),v=(0,r.useSyncExternalStore)(o.entry_suggestion_provider_preference.subscribe,o.entry_suggestion_provider_preference.get_snapshot,o.entry_suggestion_provider_preference.get_server_snapshot),w=(0,r.useSyncExternalStore)(d.openai_api_key_preference.subscribe,d.openai_api_key_preference.get_snapshot,d.openai_api_key_preference.get_server_snapshot),j=(0,r.useSyncExternalStore)(l.claude_api_key_preference.subscribe,l.claude_api_key_preference.get_snapshot,l.claude_api_key_preference.get_server_snapshot),N=(0,r.useSyncExternalStore)(c.google_ai_api_key_preference.subscribe,c.google_ai_api_key_preference.get_snapshot,c.google_ai_api_key_preference.get_server_snapshot),k="openai"===v?w:"claude"===v?j:"google_ai"===v?N:"",S="none"!==v&&k.trim().length>0;(0,r.useEffect)(()=>{g((0,ev.build_resume_description)(e.description,e.tags))},[e.description,e.id,e.sheetName,e.tags]),(0,eo.use_escape_to_cancel)(u);let E=async()=>{if(S){f(!0),y(null);try{let t=e.notes.map(e=>e.text).join("\n"),n=await p({provider:v,api_key:k,context:h,notes:t});g(n)}catch(e){y(e instanceof Error?e.message:String(e))}finally{f(!1)}}};return(0,t.jsxs)("form",{className:"flex min-w-0 flex-1 flex-col gap-2",onSubmit:e=>{e.preventDefault();let t=h.trim();t===_.trim()?u():m(t)},children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-start gap-2 max-[700px]:flex-col",children:[(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)(a.TagAutocompleteInput,{id:`active-entry-description-${e.id}`,value:h,known_tags:n,placeholder:"e.g. crafting something @design",disabled:i,autoFocus:!0,on_change:g})}),(0,t.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2 max-[700px]:w-full",children:[S?(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost","small"),disabled:i||x,title:"Revise description with AI","aria-label":"Revise description with AI",onClick:()=>void E(),children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsx)(ez,{}),x?"Revising…":"Revise with AI"]})}):null,(0,t.jsx)("button",{type:"submit",className:(0,s.get_button_class_name)("primary","small"),disabled:i||h.trim()===_.trim(),children:"Save"}),(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost","small"),disabled:i,onClick:u,children:"Cancel"})]})]}),null!==b?(0,t.jsx)("p",{className:"m-0 text-[0.8rem] text-danger",children:b}):null]})}var eq=e.i(50459);let eB=`${(0,s.get_button_class_name)("danger-solid")} rounded-none first:rounded-l-[0.65rem] last:rounded-r-[0.65rem] not-first:-ml-px not-first:min-w-12 not-first:border-l not-first:border-l-[color-mix(in_srgb,#ffffff_30%,var(--danger-solid))] min-[561px]:px-2.5 min-[561px]:py-2 min-[561px]:text-[0.9rem] max-[560px]:flex-1 max-[560px]:basis-1/2`;function eG({in_bar:e=!1,is_pending:n,on_start_checkout:r}){return(0,t.jsxs)("div",{className:`inline-flex min-w-0 max-w-full ${e?"max-[560px]:w-full":"min-w-30 max-[560px]:w-full"}`,children:[(0,t.jsx)("button",{type:"button",className:eB,disabled:n,onClick:()=>r(),children:"Check out"}),(0,t.jsx)("button",{type:"button",className:eB,disabled:n,title:"Check out at a specific time",onClick:()=>{let e=(0,eq.prompt_check_out_at)();null!==e&&r(e)},children:"@"})]})}function eJ({on_submit:e,on_cancel:n,is_pending:a,in_active_panel:l=!1,in_bar:o=!1,allow_at:c=!1}){let[d,m]=(0,r.useState)(""),[u,p]=(0,r.useState)("");return(0,eo.use_escape_to_cancel)(()=>n?.(),void 0!==n),(0,t.jsxs)("form",{className:`flex flex-col gap-2 ${l&&!o?"border-t border-accent-border pt-4":o?"border-t border-[color-mix(in_srgb,var(--accent-border)_65%,var(--panel-border))] pt-3.5":""}`,onSubmit:t=>{t.preventDefault();let n=d.trim();if(0===n.length)return;let r=u.trim();e(n,r.length>0?r:void 0),m(""),p("")},children:[(0,t.jsx)("label",{className:"text-[0.85rem] text-muted",htmlFor:"note-text",children:"Add note"}),(0,t.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2 max-[860px]:grid-cols-1",children:[(0,t.jsx)("input",{id:"note-text",className:(0,i.get_input_class_name)(),value:d,onChange:e=>m(e.target.value),placeholder:"Pair with alice on the widget",disabled:a,autoFocus:!0}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 max-[860px]:w-full",children:[(0,t.jsx)("button",{type:"submit",className:(0,s.get_button_class_name)("ghost"),disabled:a||0===d.trim().length,children:"Save note"}),void 0!==n?(0,t.jsx)("button",{type:"button",className:(0,s.get_button_class_name)("ghost"),disabled:a,onClick:n,children:"Cancel"}):null]})]}),c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("label",{className:"text-[0.85rem] text-muted",htmlFor:"note-at",children:["Note time"," ",(0,t.jsx)("span",{className:"font-normal opacity-85",children:"(optional, natural language)"})]}),(0,t.jsx)("input",{id:"note-at",className:(0,i.get_input_class_name)(),value:u,onChange:e=>p(e.target.value),placeholder:"e.g. 30 minutes ago",disabled:a})]}):null]})}var eW=e.i(76379),eK=e.i(7554);let eY=(0,r.forwardRef)(function({entry:e,sheets:n,known_tags:a,in_bar:i=!1,on_check_out:l,on_delete:o,on_edit:c,on_move:d,on_add_note:m,on_edit_note:u,on_delete_note:p,is_pending:_},h){var g;let x,{confirm:f}=(0,ei.use_confirm_dialog)(),y=eI(),v=(0,eW.use_confirm_before_checkout)(),w=(0,M.use_duration_format)(),j=eP(),[N,k]=(0,r.useState)(e.durationMs),[S,E]=(0,r.useState)(!1),[$,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),[I,A]=(0,r.useState)(!1),[L,R]=(0,r.useState)(void 0);(0,r.useImperativeHandle)(h,()=>({start_edit:()=>{S||$||I||E(!0)},start_add_note:()=>{S||$||T||I||D(!0)}}),[T,S,$,I]),(0,r.useEffect)(()=>{D(!1),E(!1),C(!1),A(!1),R(void 0)},[e.id,e.sheetName]),(0,r.useEffect)(()=>{k(e.durationMs);let t=window.setInterval(()=>{k(Date.now()-new Date(e.start).getTime())},1e3);return()=>window.clearInterval(t)},[e.durationMs,e.start]);let F=()=>{A(!1),R(void 0)},O=async e=>{(!v||await f((0,eK.get_check_out_confirm_dialog)(e)))&&(l(e),F())},P=(g=S||$||I,x="flex flex-col gap-4 rounded-lg border border-accent-border p-[1.1rem] shadow-sm",i?g?`${x} rounded-md border border-accent-border bg-[color-mix(in_srgb,var(--panel)_70%,var(--background))] p-3.5`:"flex flex-col gap-3 border-0 bg-transparent p-0 shadow-none":`${x} bg-[image:var(--active-panel-bg)]`),U=async t=>{let n,r,a=e.notes.find(e=>e.timestamp===t);(!y||await f({title:"Delete note?",message:(r=(n=(a?.text??"").trim()).length>80?`${n.slice(0,80)}…`:n).length>0?`Remove this note? "${r}"`:"Remove this note?",confirmLabel:"Delete",variant:"danger"}))&&p(t)},z=(0,t.jsx)(ed,{current_sheet_name:e.sheetName,sheets:n,is_pending:_,on_edit:()=>C(!0),on_show_add_note_form:()=>D(!0),on_move:d,on_delete:async()=>{(!y||await f(eT(e)))&&o()}});return I?(0,t.jsx)("section",{className:P,"aria-label":"Check out active entry",children:(0,t.jsx)(eU,{entry:e,in_bar:i,is_pending:_,initial_at:L,on_cancel:F,on_submit:e=>{O(e)}})}):$?(0,t.jsx)("section",{className:P,children:(0,t.jsx)(ew,{entry:e,known_tags:a,is_pending:_,in_active_panel:!0,times_only:!0,start_only:!0,on_cancel:()=>C(!1),on_save:e=>{c(e),C(!1)}})}):(0,t.jsxs)("section",{className:P,children:[(0,t.jsxs)("div",{className:"flex min-w-0 shrink-0 items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[i?null:(0,t.jsx)("span",{className:"self-start rounded-full bg-accent px-2 py-0.5 text-[0.68rem] font-bold uppercase leading-none tracking-wider text-accent-text-on",children:"Tracking"}),S?(0,t.jsx)(eH,{entry:e,known_tags:a,is_pending:_,on_cancel:()=>E(!1),on_save:e=>{c({description:e}),E(!1)}}):(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[(0,t.jsx)("h2",{className:"m-0 min-w-0 truncate text-[1.12rem] font-[650] leading-tight tracking-tight min-[560px]:text-xl",children:e.description||"Untitled entry"}),(0,t.jsx)("button",{type:"button",className:"inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-[0.35rem] border-0 bg-transparent p-0 text-muted hover:bg-surface-hover hover:text-foreground disabled:cursor-not-allowed disabled:opacity-55","aria-label":"Edit description",title:"Edit description",disabled:_||T,onClick:()=>E(!0),children:(0,t.jsx)(e_,{})})]})]}),i?null:(0,t.jsx)("div",{className:"max-[560px]:self-end",children:z})]}),(0,t.jsxs)("div",{className:`flex shrink-0 items-end justify-between gap-4 max-[860px]:flex-col max-[860px]:items-stretch ${i?"px-3":""}`,children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,t.jsx)("p",{className:"m-0 whitespace-nowrap font-mono text-[1.65rem] font-medium leading-none tracking-tight text-accent min-[440px]:text-[1.85rem] min-[560px]:text-[2rem]",children:(0,b.format_duration)(N,w,j)}),!S&&e.tags.length>0?(0,t.jsx)("ul",{className:"m-0 flex list-none flex-wrap gap-1.5 p-0",children:e.tags.map(e=>(0,t.jsx)("li",{className:"rounded-full bg-tag-bg px-2 py-0.5 text-xs text-tag-text",children:(0,q.format_display_tag)(e)},e))}):null]}),(0,t.jsxs)("div",{className:`flex min-w-0 shrink-0 flex-wrap items-center justify-end gap-2 max-[560px]:flex-col max-[560px]:items-stretch ${i?"w-full":"min-w-30 max-[860px]:w-full max-[860px]:justify-stretch"}`,children:[T?null:(0,t.jsx)("button",{type:"button",className:`${(0,s.get_button_class_name)("ghost")} min-w-0 min-[561px]:px-2.5 min-[561px]:py-2 min-[561px]:text-[0.9rem] max-[560px]:flex-1`,disabled:_||S,onClick:()=>D(!0),children:"Add note"}),(0,t.jsx)(eG,{in_bar:i,is_pending:_,on_start_checkout:e=>{_||(E(!1),C(!1),D(!1),R(e),A(!0))}})]})]}),(0,t.jsx)(ef,{notes:e.notes,variant:"panel",in_bar:i,is_pending:_,on_edit_note:u,on_delete_note:U}),T?(0,t.jsx)("div",{className:"shrink-0",children:(0,t.jsx)(eJ,{in_active_panel:!0,in_bar:i,allow_at:!0,is_pending:_,on_cancel:()=>D(!1),on_submit:(e,t)=>{m(e,t),D(!1)}})}):null]})});var eV=e.i(15526);let eQ=(0,r.forwardRef)(function({active_entry:e,sheets:n,known_tags:a,is_pending:s,on_check_out:i,on_delete:l,on_edit:o,on_move:c,on_add_note:d,on_edit_note:m,on_delete_note:u},p){let{confirm:_}=(0,ei.use_confirm_dialog)(),h=eI(),g=(0,r.useRef)(null);return((0,r.useImperativeHandle)(p,()=>({start_edit:()=>{g.current?.start_edit()},start_add_note:()=>{g.current?.start_add_note()}})),null===e)?null:(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,t.jsxs)("span",{className:"text-[0.72rem] font-semibold uppercase tracking-[0.04em] text-muted whitespace-nowrap truncate",children:["Sheet ",e.sheetName]}),(0,t.jsx)("span",{className:"shrink-0 rounded-full bg-accent px-2 py-0.5 text-[0.68rem] font-bold uppercase leading-none tracking-wider text-accent-text-on",children:"Tracking"}),(0,eV.is_pomodoro_task_entry)(e)?(0,t.jsx)("span",{className:"shrink-0 rounded-full border border-panel-border bg-surface-raised px-2 py-0.5 text-[0.68rem] font-bold uppercase leading-none tracking-wider text-foreground",children:"Pomodoro"}):null,(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(ed,{current_sheet_name:e.sheetName,sheets:n,is_pending:s,on_edit:()=>g.current?.start_edit(),on_show_add_note_form:()=>g.current?.start_add_note(),on_move:c,on_delete:async()=>{(!h||await _(eT(e)))&&l()}})})]}),(0,t.jsx)(eY,{ref:g,entry:e,sheets:n,known_tags:a,in_bar:!0,is_pending:s,on_check_out:i,on_delete:l,on_edit:o,on_move:c,on_add_note:d,on_edit_note:m,on_delete_note:u},`${e.sheetName}-${e.id}`)]})});var eZ=e.i(16967);let eX="super-time-tracker";function e0({active_entry:e}){let t="true"===(0,r.useSyncExternalStore)(eZ.timer_in_title_preference.subscribe,eZ.timer_in_title_preference.get_snapshot,eZ.timer_in_title_preference.get_server_snapshot),n=(0,M.use_duration_format)(),a=eP(),[s,i]=(0,r.useState)(e?.durationMs??0);return(0,r.useEffect)(()=>{if(null===e)return void i(0);i(e.durationMs);let t=window.setInterval(()=>{i(Date.now()-new Date(e.start).getTime())},1e3);return()=>window.clearInterval(t)},[e]),(0,r.useEffect)(()=>{if(!t||null===e){document.title=eX;return}let r=e.description.trim()||"Tracking",i=(0,b.format_duration)(s,n,a);return document.title=`${i} — ${r}`,()=>{document.title=eX}},[e,n,s,a,t]),null}var e1=e.i(75404),e5=e.i(36178),e2=e.i(68713);function e6(e){return`${e.sheetName}:${e.id}`}var e8=e.i(67999),e4=e.i(85323),e3=e.i(76709);async function e7(e,t){let n=await fetch(e,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error((await n.json()).error??"Request failed");return await n.json()}var e9=e.i(3159),te=e.i(51229),tt=e.i(17003);function tn(e){let t=e.activeSheetName;null!==t&&(0,tt.write_active_sheet_preference)(t)}var tr=e.i(65742),ta=e.i(48541);e.s(["TrackerApp",0,function({initial_state:e}){let[a,i]=(0,r.useState)(e),[l,o]=(0,r.useState)(null),[c,d]=(0,r.useState)(!1),[m,u]=(0,r.useState)(!1),p=(0,r.useRef)(e);(0,r.useEffect)(()=>{tn(e)},[e]);let _=async e=>{d(!0),o(null);try{let t=await e(),n=null!==a.activeEntry&&null===t.activeEntry,r=a.runningEntry,s=t.runningEntry;if(tn(t),i(t),n&&(0,e2.finish_running_pomodoro_timer)(),!b)return;if(null===r&&null!==s)return void(0,e4.notify_desktop)({title:"Tracking started",body:`${s.description||"Untitled entry"} (${s.sheetName})`,tag:"tracker-running-entry"});if(null!==r&&null===s)return void(0,e4.notify_desktop)({title:"Tracking stopped",body:`${r.description||"Untitled entry"} (${r.sheetName})`,tag:"tracker-running-entry"});null!==r&&null!==s&&e6(r)!==e6(s)&&(0,e4.notify_desktop)({title:"Tracking switched",body:`${s.description||"Untitled entry"} (${s.sheetName})`,tag:"tracker-running-entry"})}catch(e){o(e instanceof Error?e.message:String(e))}finally{d(!1)}},h=a.activeSheetName??a.sheets.find(e=>e.isActive)?.name??"main",g=en(),f=eE(),b="true"===(0,r.useSyncExternalStore)(ta.desktop_notifications_preference.subscribe,ta.desktop_notifications_preference.get_snapshot,ta.desktop_notifications_preference.get_server_snapshot),y="true"===(0,r.useSyncExternalStore)(tr.clear_tag_filters_on_sheet_change_preference.subscribe,tr.clear_tag_filters_on_sheet_change_preference.get_snapshot,tr.clear_tag_filters_on_sheet_change_preference.get_server_snapshot),v=(0,r.useRef)(null),w=(0,r.useRef)(null),j=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!y||null===v.current||v.current===h){v.current=h;return}X(h,[]),v.current=h},[h,y]);let N=(0,r.useSyncExternalStore)(Q.subscribe_sheet_tag_filters,()=>Y(h),V),k=(0,r.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=new Set;for(let r of n.tags)try{let n=(0,B.normalize_stored_tag)(r);if(e.has(n))continue;e.add(n),t.set(n,(t.get(n)??0)+1)}catch{continue}}return[...t.entries()].map(([e,t])=>({name:e,entryCount:t})).sort((e,t)=>e.name.localeCompare(t.name))})(a.activeSheetEntries),[a.activeSheetEntries]),S=(0,r.useMemo)(()=>{if(m)return[];let e=[...function(e,t,n="all"){return 0===t.length?e:e.filter(e=>(function(e,t,n="all"){return 0===t.length||("any"===n?t.some(t=>e.tags.some(e=>ee(e,t))):t.every(t=>e.tags.some(e=>ee(e,t))))})(e,t,n))}(a.activeSheetEntries,N,g)];switch(f){case"oldest":return e.sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime());case"duration":return e.sort((e,t)=>t.durationMs-e.durationMs);case"description":return e.sort((e,t)=>{let n=e.description.trim()||"Untitled entry",r=t.description.trim()||"Untitled entry";return n.localeCompare(r)});default:return e.sort((e,t)=>new Date(t.start).getTime()-new Date(e.start).getTime())}},[a.activeSheetEntries,N,g,f,m]),E=(0,r.useMemo)(()=>(0,e8.get_serialized_entries_total_ms)(S),[S]);(0,r.useEffect)(()=>(0,e3.subscribe_tracker_state_sync)(()=>{c||m||fetch("/api/state").then(async e=>{if(!e.ok)throw Error("Failed to refresh tracker state");return await e.json()}).then(e=>{tn(e),i(t=>(null===t.activeEntry?null:`${t.activeEntry.sheetName}:${t.activeEntry.id}`)===(null===e.activeEntry?null:`${e.activeEntry.sheetName}:${e.activeEntry.id}`)?t:e)}).catch(()=>{})}),[c,m]);let $=m?`Loading entries for "${h}"…`:N.length>0?"any"===g?`No entries on sheet "${h}" match any selected tag.`:`No entries on sheet "${h}" match all selected tags.`:`No entries on sheet "${h}".`,C=e=>{let t;if(e===h&&!m)return;p.current=a;let n=(t=a.runningEntries.find(t=>t.sheetName===e)??null,{...a,activeSheetName:e,sheets:a.sheets.map(t=>({...t,isActive:t.name===e})),activeEntry:t,activeSheetEntries:a.activeSheetEntries,activeSheetTotalMs:a.activeSheetTotalMs});tn(n),i(n),u(!0),o(null),(0,te.post_tracker_action)("/api/sheet",{name:e}).then(e=>{tn(e),i(e)}).catch(e=>{o(e instanceof Error?e.message:String(e)),i(p.current)}).finally(()=>{u(!1)})},T=(e,t,n)=>(0,e9.patch_tracker_action)("/api/entry",{sheetName:e,entryId:t,...n});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e0,{active_entry:a.activeEntry}),(0,t.jsx)(H,{sheets:a.sheets,active_sheet_name:h,active_entry:a.activeEntry,is_pending:c,check_in_form_ref:w,active_entry_panel_ref:j,on_select_sheet:C,on_check_out:e=>_(()=>(0,te.post_tracker_action)("/api/out",(0,e5.build_check_out_request_payload)(h,e)))}),(0,t.jsx)("div",{className:"relative z-1",children:(0,t.jsx)(e1.TrackerTopbar,{})}),(0,t.jsxs)("div",{className:"mx-auto max-w-[1120px] px-4 pb-10 pt-4 sm:px-5 sm:pt-5",children:[null!==l?(0,t.jsx)("p",{className:"mb-4 border border-danger-border bg-danger-soft px-3 py-2.5 text-danger-text",children:l}):null,(0,t.jsx)(I,{has_running_timer:null!==a.runningEntry,on_check_in_shortcut:()=>{w.current?.expand_and_focus()}}),(0,t.jsxs)("div",{className:"grid grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)] items-stretch border border-panel-border bg-panel shadow-sm max-[960px]:grid-cols-1",children:[(0,t.jsx)("div",{className:"flex min-h-0 min-w-0 flex-col border-r border-panel-border p-4 max-[860px]:border-r-0 max-[860px]:border-b",children:(0,t.jsx)(eF,{sheets:a.sheets,db_path:a.dbPath,is_pending:c,on_select:C,on_create:e=>_(()=>(0,te.post_tracker_action)("/api/sheet",{name:e})),on_rename:(e,t)=>_(()=>(0,e9.patch_tracker_action)("/api/sheet",{name:e,newName:t})),on_delete:e=>_(()=>(0,te.post_tracker_action)("/api/sheet",{name:e,delete:!0}))})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,t.jsxs)("section",{className:"flex min-w-0 flex-col gap-4 border-b border-panel-border border-l-4 border-l-accent p-4",children:[null===a.activeEntry?(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-md border border-panel-border bg-background px-3 py-2",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"m-0 text-[0.72rem] font-semibold uppercase tracking-[0.06em] text-muted",children:"Quick action"}),(0,t.jsx)("p",{className:"m-0 mt-1 text-[0.9rem] font-medium",children:"Jump into Pomodoro without leaving the tracker."})]}),(0,t.jsxs)(n.default,{href:"/pomodoro",className:`${(0,s.get_button_class_name)("primary")} inline-flex min-w-40 flex-col items-center justify-center whitespace-nowrap text-center`,"aria-label":"Open Pomodoro timer",children:[(0,t.jsx)("span",{className:"text-white text-[0.9rem] leading-none",children:"Start Pomodoro"}),(0,t.jsx)("span",{className:"text-white mt-1 text-[0.72rem] font-medium leading-none opacity-85",children:"Focus timer"})]})]}):null,(0,t.jsx)(eQ,{ref:j,active_entry:a.activeEntry,sheets:a.sheets,known_tags:a.knownTags,is_pending:c,on_check_out:e=>_(()=>(0,te.post_tracker_action)("/api/out",(0,e5.build_check_out_request_payload)(h,e))),on_delete:()=>_(()=>(0,te.post_tracker_action)("/api/entry",{sheetName:h,entryId:a.activeEntry?.id})),on_edit:e=>_(()=>T(h,a.activeEntry?.id??0,e)),on_move:e=>_(()=>(0,te.post_tracker_action)("/api/entry/move",{sheetName:h,entryId:a.activeEntry?.id,targetSheetName:e})),on_add_note:(e,t)=>_(()=>(0,te.post_tracker_action)("/api/note",{text:e,...void 0!==t?{at:t}:{},sheetName:h,entryId:a.activeEntry?.id})),on_edit_note:(e,t)=>_(()=>(0,e9.patch_tracker_action)("/api/note",{sheetName:h,entryId:a.activeEntry?.id,timestamp:e,text:t})),on_delete_note:e=>_(()=>e7("/api/note",{sheetName:h,entryId:a.activeEntry?.id,timestamp:e}))}),null===a.activeEntry?(0,t.jsx)(x,{ref:w,known_tags:a.knownTags,is_pending:c,trailing:(0,t.jsx)("p",{className:"m-0 text-[0.85rem] leading-tight text-muted",children:"Not tracking"}),on_submit:e=>_(()=>(0,te.post_tracker_action)("/api/in",{...e,sheetName:h}))}):null]}),(0,t.jsx)("section",{className:"flex min-w-0 flex-col gap-4 p-4",children:(0,t.jsx)(eA,{title:"Entries",entries:S,sheets:a.sheets,known_tags:a.knownTags,total_ms:E,empty_message:$,is_pending:c,show_sheet_name:!1,header_extra:(0,t.jsx)(er,{sheet_name:h,sheet_tags:k}),on_delete:e=>_(()=>(0,te.post_tracker_action)("/api/entry",{sheetName:e.sheetName,entryId:e.id})),on_edit:(e,t)=>_(()=>T(e.sheetName,e.id,t)),on_move:(e,t)=>_(()=>(0,te.post_tracker_action)("/api/entry/move",{sheetName:e.sheetName,entryId:e.id,targetSheetName:t})),on_move_many:(e,t)=>_(()=>(0,te.post_tracker_action)("/api/entry/move-bulk",{entries:e.map(e=>({sheetName:e.sheetName,entryId:e.id})),targetSheetName:t})),on_delete_many:e=>_(()=>(0,te.post_tracker_action)("/api/entry/delete-bulk",{entries:e.map(e=>({sheetName:e.sheetName,entryId:e.id}))})),on_edit_note:(e,t,n)=>_(()=>(0,e9.patch_tracker_action)("/api/note",{sheetName:e.sheetName,entryId:e.id,timestamp:t,text:n})),on_add_note:(e,t)=>_(()=>(0,te.post_tracker_action)("/api/note",{sheetName:e.sheetName,entryId:e.id,text:t})),on_resume:e=>_(()=>(0,te.post_tracker_action)("/api/in",{description:(0,ev.build_resume_description)(e.description,e.tags),sheetName:e.sheetName}))})})]})]})]})]})}],22482)}]);
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|