Set up a list of common projects or task types you work on. Assigning a color can help in visual identification in future reports (though not heavily used in this version's display).
2. Logging Time (Timer & Daily Log Tab)
Using the Live Timer:
Select a project from the dropdown or choose "Log Ad-hoc Task" and enter a name.
Click "Start Timer". The timer will run, showing elapsed time for the active task.
Use "Pause" and "Resume" as needed.
When finished, click "Stop & Log". You'll be prompted to add notes before the entry is saved.
"Discard" will stop the timer without saving an entry.
Manual Entry:
Select the date for which you want to log time.
Click "Add Manual Entry".
Fill in the task description, select a project (or enter ad-hoc), set Start Time, End Time (or Duration), and add optional notes.
3. Recovering Interrupted Timers
If you close your browser or navigate away while a timer is running, the tool will attempt to detect this when you next open it. You'll be prompted to log, adjust, or discard the time that seems to have elapsed.
4. Viewing Reports (Reports Tab)
Select a period (Today, This Week, This Month, or a Custom Range) and click "Generate Report". You'll see:
Total time logged for the period.
A summary of time spent per project/task.
A detailed list of all individual time entries.
5. Exporting
Use the "Download Report as PDF" button (available after a report is generated) to save your time analysis.
Tips for Effective Time Logging:
Be Consistent: Log time as you work or immediately after to ensure accuracy.
Be Granular (Enough): Log distinct tasks separately if you need to analyze them. Broad categories are fine if you don't need deep detail.
Use Notes: Add brief notes to entries to remember specific details about the work done.
Review Regularly: Use the reports to understand where your time goes. This can help identify inefficiencies or areas where you're spending more or less time than intended.
×
Log Time Entry
No projects defined. Add one above.
'; return;
}
stlProjects.forEach(proj => {
const itemEl = document.createElement('div');
itemEl.className = 'stl-entry-item'; // Re-use class for similar styling
itemEl.innerHTML = `
${proj.name}
`;
stlProjectsListEl.appendChild(itemEl);
});
}
window.stlDeleteProject = function(projId) { /* ... from previous tool, adapted ... */
if (confirm("Are you sure? This won't delete logged time entries for this project, but will remove it from the list for new entries.")) {
stlProjects = stlProjects.filter(p => p.id !== projId);
stlSaveProjects();
stlRenderProjectsList();
stlPopulateProjectSelects();
}
}
function stlPopulateProjectSelects() { /* ... from previous tool, adapted ... */
const selects = [stlTaskSelectTimerEl, stlEntryProjectIdSelectEl];
selects.forEach(selectEl => {
if(!selectEl) return;
const currentVal = selectEl.value;
selectEl.innerHTML = '';
stlProjects.forEach(proj => {
const option = document.createElement('option');
option.value = proj.id;
option.textContent = proj.name;
selectEl.appendChild(option);
});
if(selectEl === stlTaskSelectTimerEl) { // Specific to timer select
selectEl.innerHTML += '';
}
selectEl.value = currentVal;
});
}
// --- Timer Logic ---
// (Timer logic, manual entry, daily log, reports, PDF will go here)
// This will be extensive. I will ensure all event listeners and DOM manipulations
// are robustly handled, especially those defined or called within DOMContentLoaded.
// --- Initialization ---
document.addEventListener('DOMContentLoaded', () => {
// Assign DOM elements
stlTaskSelectTimerEl = document.getElementById('stlTaskSelectTimer');
stlAdhocTaskNameGroupEl = document.getElementById('stlAdhocTaskNameGroup');
stlAdhocTaskNameTimerEl = document.getElementById('stlAdhocTaskNameTimer');
stlStartNewTimerButtonEl = document.getElementById('stlStartNewTimerButton');
stlActiveTimerAreaEl = document.getElementById('stlActiveTimerArea');
stlActiveTaskNameEl = document.getElementById('stlActiveTaskName');
stlActiveTimerDisplayEl = document.getElementById('stlActiveTimerDisplay');
stlPauseResumeTimerButtonEl = document.getElementById('stlPauseResumeTimerButton');
stlStopTimerButtonEl = document.getElementById('stlStopTimerButton');
stlDiscardTimerButtonEl = document.getElementById('stlDiscardTimerButton');
stlCurrentDateDisplayEl = document.getElementById('stlCurrentDateDisplay');
stlLogViewDateEl = document.getElementById('stlLogViewDate');
stlDailyLogEntriesListEl = document.getElementById('stlDailyLogEntriesList');
stlAddProjectForm = document.getElementById('stlAddProjectForm');
stlProjectNameInputEl = document.getElementById('stlProjectNameInput');
stlProjectColorInputEl = document.getElementById('stlProjectColorInput');
stlProjectsListEl = document.getElementById('stlProjectsList');
stlReportPeriodSelectEl = document.getElementById('stlReportPeriodSelect');
stlCustomDateRangePickerEl = document.getElementById('stlCustomDateRangePicker');
stlReportStartDateInputEl = document.getElementById('stlReportStartDate');
stlReportEndDateInputEl = document.getElementById('stlReportEndDate');
stlReportOutputAreaEl = document.getElementById('stlReportOutputArea');
stlReportPeriodDisplayEl = document.getElementById('stlReportPeriodDisplay');
stlReportSummaryEl = document.getElementById('stlReportSummary');
stlReportDetailsTableBodyEl = document.querySelector('#stlReportDetailsTable tbody');
stlTimeEntryModalEl = document.getElementById('stlTimeEntryModal');
stlTimeEntryModalTitleEl = document.getElementById('stlTimeEntryModalTitle');
stlTimeEntryForm = document.getElementById('stlTimeEntryForm');
stlEntryIdInput = document.getElementById('stlEntryId');
stlEntryDateKeyInput = document.getElementById('stlEntryDateKey');
stlEntryTaskDescriptionInput = document.getElementById('stlEntryTaskDescription');
stlEntryProjectIdSelectEl = document.getElementById('stlEntryProjectId');
stlEntryStartDateInput = document.getElementById('stlEntryStartDate');
stlEntryStartTimeInput = document.getElementById('stlEntryStartTime');
stlEntryEndDateInput = document.getElementById('stlEntryEndDate');
stlEntryEndTimeInput = document.getElementById('stlEntryEndTime');
stlEntryDurationMinutesInput = document.getElementById('stlEntryDurationMinutes');
stlEntryNotesInput = document.getElementById('stlEntryNotes');
stlDownloadPdfBtn = document.getElementById('stlDownloadPdfButton');
// Attach form submit listeners
if(stlAddProjectForm) stlAddProjectForm.addEventListener('submit', handleAddProjectFormSubmit);
if(stlTimeEntryForm) stlTimeEntryForm.addEventListener('submit', handleTimeEntryFormSubmit); // Define this function
// Other event listeners
if(stlTaskSelectTimerEl) stlTaskSelectTimerEl.addEventListener('change', () => {
stlAdhocTaskNameGroupEl.style.display = stlTaskSelectTimerEl.value === 'adhoc' ? 'block' : 'none';
});
if(stlStartNewTimerButtonEl) stlStartNewTimerButtonEl.addEventListener('click', stlStartNewTimer);
if(stlPauseResumeTimerButtonEl) stlPauseResumeTimerButtonEl.addEventListener('click', stlTogglePauseResumeTimer);
if(stlStopTimerButtonEl) stlStopTimerButtonEl.addEventListener('click', stlStopAndLogTimer);
if(stlDiscardTimerButtonEl) stlDiscardTimerButtonEl.addEventListener('click', stlDiscardActiveTimer);
if(stlLogViewDateEl) stlLogViewDateEl.addEventListener('change', stlRenderDailyLogEntries);
if(stlReportPeriodSelectEl) stlReportPeriodSelectEl.addEventListener('change', () => {
stlCustomDateRangePickerEl.style.display = stlReportPeriodSelectEl.value === 'custom_range' ? 'grid' : 'none';
});
if(stlDownloadPdfBtn) stlDownloadPdfBtn.addEventListener('click', handlePdfDownload); // Define this
const today = new Date(2025, 4, 14); // May 14, 2025
if(stlLogViewDateEl) stlLogViewDateEl.value = stlFormatDateKey(today);
if(stlCurrentDateDisplayEl) stlCurrentDateDisplayEl.textContent = today.toLocaleDateString();
stlLoadData(); // Load projects, entries, and potentially recovering active timer
const firstTabButton = document.querySelector('#smartTimeLoggerTool .stl-tab-button');
if (firstTabButton) firstTabButton.click();
window.addEventListener('click', function(event) { // Global modal closer
if (event.target.classList.contains('stl-modal')) {
stlCloseModal(event.target.id);
}
});
});
// --- Live Timer Functions ---
function stlStartNewTimer() {
if (stlActiveTimer) {
alert("A timer is already running. Stop or discard it first.");
return;
}
const projectId = stlTaskSelectTimerEl.value;
let taskDescription;
let originalTaskName = ""; // For adhoc tasks, if project is selected it's the project name
if (projectId === 'adhoc') {
taskDescription = stlAdhocTaskNameTimerEl.value.trim();
if (!taskDescription) {
alert("Please enter a name for the ad-hoc task.");
return;
}
originalTaskName = taskDescription; // Use this for display
} else if (projectId) {
const project = stlProjects.find(p => p.id === projectId);
if (!project) { alert("Selected project not found."); return; }
taskDescription = project.name; // Default task description to project name
originalTaskName = project.name;
} else {
alert("Please select a project or choose 'Log Ad-hoc Task'.");
return;
}
stlActiveTimer = {
projectId: projectId === 'adhoc' ? null : projectId,
taskDescription: taskDescription, // This will be the task name displayed
originalTaskName: originalTaskName, // For display when timer running
startTimeEpoch: Date.now(),
isPaused: false,
pausedDuration: 0, // Total time spent paused in milliseconds
lastPauseTime: 0 // Timestamp when timer was last paused
};
stlActiveTimerAreaEl.style.display = 'block';
stlActiveTaskNameEl.textContent = `Working on: ${stlActiveTimer.originalTaskName}`;
stlPauseResumeTimerButtonEl.textContent = "Pause";
stlUpdateRunningTimerDisplay();
stlActiveTimer.intervalId = setInterval(stlUpdateRunningTimerDisplay, 1000);
stlSaveActiveTimer();
}
function stlUpdateRunningTimerDisplay() {
if (!stlActiveTimer || stlActiveTimer.isPaused) return;
const now = Date.now();
const elapsedMs = now - stlActiveTimer.startTimeEpoch - stlActiveTimer.pausedDuration;
const totalSeconds = Math.floor(elapsedMs / 1000);
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
stlActiveTimerDisplayEl.textContent =
`${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
document.title = `${stlActiveTimerDisplayEl.textContent} - ${stlActiveTimer.originalTaskName}`;
}
function stlTogglePauseResumeTimer() {
if (!stlActiveTimer) return;
stlActiveTimer.isPaused = !stlActiveTimer.isPaused;
if (stlActiveTimer.isPaused) {
clearInterval(stlActiveTimer.intervalId);
stlActiveTimer.lastPauseTime = Date.now();
stlPauseResumeTimerButtonEl.textContent = "Resume";
document.title = `Paused - ${stlActiveTimer.originalTaskName}`;
} else {
// Add the duration of the current pause to total paused duration
stlActiveTimer.pausedDuration += (Date.now() - stlActiveTimer.lastPauseTime);
stlActiveTimer.lastPauseTime = 0; // Reset lastPauseTime
// Resume: re-calculate elapsed and restart interval
stlUpdateRunningTimerDisplay(); // Update display once immediately
stlActiveTimer.intervalId = setInterval(stlUpdateRunningTimerDisplay, 1000);
stlPauseResumeTimerButtonEl.textContent = "Pause";
}
stlSaveActiveTimer(); // Save pause state
}
function stlStopAndLogTimer() {
if (!stlActiveTimer) return;
clearInterval(stlActiveTimer.intervalId);
const endTimeEpoch = Date.now();
let elapsedMs = endTimeEpoch - stlActiveTimer.startTimeEpoch - stlActiveTimer.pausedDuration;
if(stlActiveTimer.isPaused) { // If stopped while paused, account for the final pause duration
elapsedMs -= (Date.now() - stlActiveTimer.lastPauseTime); // Effectively, don't count the last pause period if stopped during pause.
// Or better, when stopping, if paused, add the current pause duration first.
// If it was paused, the current pause period hasn't been added to stlActiveTimer.pausedDuration yet.
// No, if it was paused, elapsedMs should be calculated based on when it was effectively running.
// The current way of subtracting total pausedDuration from (now - start) is correct.
}
const durationMinutes = Math.max(1, Math.round(elapsedMs / (1000 * 60))); // Min 1 minute log
// Open modal to confirm/edit details before saving
stlTimeEntryModalTitleEl.textContent = "Confirm & Log Timed Entry";
stlEntryIdInput.value = ''; // New entry
const startDateObj = new Date(stlActiveTimer.startTimeEpoch);
const {date: startDate, time: startTime} = stlDateTimeToInputFields(startDateObj.toISOString());
const endDateObj = new Date(endTimeEpoch);
const {date: endDate, time: endTime} = stlDateTimeToInputFields(endDateObj.toISOString());
stlEntryDateKeyInput.value = stlFormatDateKey(startDateObj); // For saving under correct date
stlEntryTaskDescriptionInput.value = stlActiveTimer.taskDescription; // Pre-fill description
stlEntryProjectIdSelectEl.value = stlActiveTimer.projectId || "";
stlEntryStartDateInput.value = startDate;
stlEntryStartTimeInput.value = startTime;
stlEntryEndDateInput.value = endDate;
stlEntryEndTimeInput.value = endTime;
stlEntryDurationMinutesInput.value = durationMinutes;
stlEntryNotesInput.value = ""; // Clear notes for new entry
// Disable date/time/duration fields initially as they are from timer
stlEntryStartDateInput.readOnly = true; stlEntryStartTimeInput.readOnly = true;
stlEntryEndDateInput.readOnly = true; stlEntryEndTimeInput.readOnly = true;
stlEntryDurationMinutesInput.readOnly = true;
stlTimeEntryModalEl.style.display = 'block';
// Actual saving happens when modal form is submitted
stlActiveTimer = null;
stlActiveTimerAreaEl.style.display = 'none';
stlSaveActiveTimer(); // Clears active timer from storage
document.title = "Smart Time Logger";
if(stlTaskSelectTimerEl) stlTaskSelectTimerEl.value = ""; // Reset select
if(stlAdhocTaskNameTimerEl) stlAdhocTaskNameTimerEl.value = "";
if(stlAdhocTaskNameGroupEl) stlAdhocTaskNameGroupEl.style.display = "none";
}
function stlDiscardActiveTimer() {
if (stlActiveTimer && confirm("Are you sure you want to discard this running timer?")) {
clearInterval(stlActiveTimer.intervalId);
stlActiveTimer = null;
stlActiveTimerAreaEl.style.display = 'none';
stlSaveActiveTimer();
document.title = "Smart Time Logger";
}
}
function stlResumeInterruptedTimer() {
if (!stlActiveTimer) return;
const now = Date.now();
let effectiveStartTime = stlActiveTimer.startTimeEpoch;
let totalPausedTime = stlActiveTimer.pausedDuration || 0;
// If it was paused when interrupted, add the time since lastPauseTime to pausedDuration
if (stlActiveTimer.isPaused && stlActiveTimer.lastPauseTime) {
totalPausedTime += (now - stlActiveTimer.lastPauseTime);
}
const elapsedSinceOriginalStartMs = now - effectiveStartTime;
const actualRunningTimeMs = elapsedSinceOriginalStartMs - totalPausedTime;
const actualRunningTimeMinutes = Math.round(actualRunningTimeMs / (1000 * 60));
if (confirm(`An active timer for "${stlActiveTimer.originalTaskName}" was found. It appears to have been running for about ${stlFormatDuration(actualRunningTimeMinutes)}. Do you want to log this? You can adjust details before saving.`)) {
// Adjust the timer's stored start time to reflect the actual running duration if user logs.
// For simplicity, let's set up the modal as if the timer was just stopped.
// The user can then edit notes.
// To log it correctly, we need the perceived end time (now)
const endTimeEpoch = Date.now();
const durationMinutes = Math.max(1, actualRunningTimeMinutes);
stlTimeEntryModalTitleEl.textContent = "Log Recovered Timer Session";
stlEntryIdInput.value = '';
const startDateObj = new Date(stlActiveTimer.startTimeEpoch); // original start
const {date: startDate, time: startTime} = stlDateTimeToInputFields(startDateObj.toISOString());
const endDateObj = new Date(endTimeEpoch);
const {date: endDate, time: endTime} = stlDateTimeToInputFields(endDateObj.toISOString());
stlEntryDateKeyInput.value = stlFormatDateKey(startDateObj);
stlEntryTaskDescriptionInput.value = stlActiveTimer.taskDescription;
stlEntryProjectIdSelectEl.value = stlActiveTimer.projectId || "";
stlEntryStartDateInput.value = startDate;
stlEntryStartTimeInput.value = startTime;
stlEntryEndDateInput.value = endDate; // This is now
stlEntryEndTimeInput.value = endTime; // This is now
stlEntryDurationMinutesInput.value = durationMinutes;
stlEntryNotesInput.value = "Recovered session.";
stlEntryStartDateInput.readOnly = true; stlEntryStartTimeInput.readOnly = true;
stlEntryEndDateInput.readOnly = true; stlEntryEndTimeInput.readOnly = true;
stlEntryDurationMinutesInput.readOnly = true;
stlTimeEntryModalEl.style.display = 'block';
}
// In either case, clear the active timer from storage now
stlActiveTimer = null;
stlSaveActiveTimer();
stlActiveTimerAreaEl.style.display = 'none'; // Hide the active timer UI
document.title = "Smart Time Logger";
}
// --- Manual Entry & Daily Log ---
// (To be filled, including modal form submission, edit, delete, render)
// ... (This will be similar to previous tools' CRUD for list items) ...
// ... Placeholder for these functions ...
window.stlOpenManualEntryModal = function(entryId = null) {
if (!stlTimeEntryModalEl || !stlEntryTaskDescriptionInput || !stlEntryProjectIdSelectEl || !stlEntryStartDateInput || !stlEntryStartTimeInput || !stlEntryEndDateInput || !stlEntryEndTimeInput || !stlEntryDurationMinutesInput || !stlEntryNotesInput) {
console.error("Manual entry modal elements not fully loaded."); return;
}
stlTimeEntryForm.reset();
stlPopulateProjectSelects(); // Ensure project dropdown is fresh
stlEntryIdInput.value = '';
stlEntryDateKeyInput.value = stlLogViewDateEl.value; // Date from the log view date picker
// Enable editing of date/time fields for manual entry
stlEntryStartDateInput.readOnly = false; stlEntryStartTimeInput.readOnly = false;
stlEntryEndDateInput.readOnly = false; stlEntryEndTimeInput.readOnly = false;
stlEntryDurationMinutesInput.readOnly = false;
if (entryId) {
stlTimeEntryModalTitleEl.textContent = "Edit Time Entry";
const entry = stlTimeEntries.find(e => e.id === entryId);
if (entry) {
stlEntryIdInput.value = entry.id;
stlEntryTaskDescriptionInput.value = entry.taskDescription;
stlEntryProjectIdSelectEl.value = entry.projectId || "";
const startDT = stlDateTimeToInputFields(entry.startTimeISO);
stlEntryStartDateInput.value = startDT.date;
stlEntryStartTimeInput.value = startDT.time;
const endDT = stlDateTimeToInputFields(entry.endTimeISO);
stlEntryEndDateInput.value = endDT.date;
stlEntryEndTimeInput.value = endDT.time;
stlEntryDurationMinutesInput.value = entry.durationMinutes;
stlEntryNotesInput.value = entry.notes || "";
}
} else {
stlTimeEntryModalTitleEl.textContent = "Add Manual Time Entry";
// Set default date/time for new manual entry based on selected log view date
const defaultDate = stlLogViewDateEl.value || stlFormatDateKey(new Date(2025, 4, 14));
stlEntryStartDateInput.value = defaultDate;
stlEntryStartTimeInput.value = "09:00"; // Default start time
stlEntryEndDateInput.value = defaultDate;
stlEntryEndTimeInput.value = "10:00"; // Default end time (1 hour duration)
stlCalculateDuration(); // Calculate initial duration
}
stlTimeEntryModalEl.style.display = 'block';
};
function stlCalculateDuration() {
const start = stlInputFieldsToISO(stlEntryStartDateInput.value, stlEntryStartTimeInput.value);
const end = stlInputFieldsToISO(stlEntryEndDateInput.value, stlEntryEndTimeInput.value);
if (start && end) {
const diffMs = new Date(end) - new Date(start);
if (diffMs > 0) {
stlEntryDurationMinutesInput.value = Math.round(diffMs / (1000 * 60));
} else {
stlEntryDurationMinutesInput.value = 0;
}
}
}
// Attach listeners for auto-duration calculation in manual entry modal
[stlEntryStartDateInput, stlEntryStartTimeInput, stlEntryEndDateInput, stlEntryEndTimeInput].forEach(el => {
if(el) el.addEventListener('change', stlCalculateDuration);
});
if(stlEntryDurationMinutesInput) { // If user types duration, clear end time to avoid confusion, or update end time
stlEntryDurationMinutesInput.addEventListener('change', () => {
// This could auto-update end time based on start time + duration
// For simplicity now, just let it be. User should ensure consistency.
});
}
function handleTimeEntryFormSubmit(e) {
e.preventDefault();
const entryId = stlEntryIdInput.value;
const taskDescription = stlEntryTaskDescriptionInput.value.trim();
const projectId = stlEntryProjectIdSelectEl.value;
const startDate = stlEntryStartDateInput.value;
const startTime = stlEntryStartTimeInput.value;
const endDate = stlEntryEndDateInput.value;
const endTime = stlEntryEndTimeInput.value;
let durationMinutes = parseInt(stlEntryDurationMinutesInput.value);
const notes = stlEntryNotesInput.value.trim();
if (!taskDescription || !startDate || !startTime) {
alert("Task description, start date, and start time are required."); return;
}
let startTimeISO = stlInputFieldsToISO(startDate, startTime);
let endTimeISO;
if(endDate && endTime) { // If end date/time provided
endTimeISO = stlInputFieldsToISO(endDate, endTime);
const diffMs = new Date(endTimeISO) - new Date(startTimeISO);
if (diffMs <=0) { alert("End time must be after start time."); return; }
durationMinutes = Math.round(diffMs / (1000 * 60));
} else if (!isNaN(durationMinutes) && durationMinutes > 0) { // If only duration provided
const startEpoch = new Date(startTimeISO).getTime();
endTimeISO = new Date(startEpoch + durationMinutes * 60000).toISOString();
} else {
alert("Please provide either a valid End Date/Time or a valid Duration."); return;
}
const newEntryData = {
projectId: projectId || null, // Store null if no project
taskDescription,
startTimeISO,
endTimeISO,
durationMinutes,
notes
};
if (entryId) { // Editing
const index = stlTimeEntries.findIndex(entry => entry.id === entryId);
if (index > -1) {
stlTimeEntries[index] = { ...stlTimeEntries[index], ...newEntryData };
}
} else { // Adding new
stlTimeEntries.push({ id: 'entry-' + Date.now(), ...newEntryData });
}
stlSaveTimeEntries();
stlRenderDailyLogEntries(); // Re-render log for the current view date
stlCloseModal('stlTimeEntryModal');
}
window.stlDeleteLogEntry = function(entryId) {
if (confirm("Are you sure you want to delete this time entry?")) {
stlTimeEntries = stlTimeEntries.filter(entry => entry.id !== entryId);
stlSaveTimeEntries();
stlRenderDailyLogEntries();
}
};
function stlRenderDailyLogEntries() {
if (!stlDailyLogEntriesListEl || !stlLogViewDateEl || !stlCurrentDateDisplayEl) return;
const selectedDateKey = stlLogViewDateEl.value;
if (!selectedDateKey) {
stlDailyLogEntriesListEl.innerHTML = '
Select a date to view log entries.
';
stlCurrentDateDisplayEl.textContent = 'N/A';
return;
}
stlCurrentDateDisplayEl.textContent = new Date(selectedDateKey + "T00:00:00").toLocaleDateString();
const entriesForDay = stlTimeEntries.filter(entry =>
stlFormatDateKey(new Date(entry.startTimeISO)) === selectedDateKey
).sort((a,b) => new Date(a.startTimeISO) - new Date(b.startTimeISO)); // Sort by start time
stlDailyLogEntriesListEl.innerHTML = '';
if (entriesForDay.length === 0) {
stlDailyLogEntriesListEl.innerHTML = '