var i=class{static normalizeInput(r){let t=r?.trim()?.toLowerCase();return t||null}static tryParseDecimal(r){let t=parseFloat(r.replace(",","."));return Number.isNaN(t)?null:t}static tryParseHMinStrict(r){let t=r.match(/^(\d+)\s*h\s*(\d+)\s*m(?:in)?$/);return t?parseInt(t[1],10)+parseInt(t[2],10)/60:null}static tryParseHoursOnly(r){let t=r.match(/^(\d+)\s*h$/);return t?parseInt(t[1],10):null}static tryParseMinutesOnly(r){let t=r.match(/^(\d+)\s*m(?:in)?$/);return t?parseInt(t[1],10)/60:null}static tryParseDecimalWithCommaOrDot(r){return/^(\d+)[.,](\d+)$/.test(r)?this.tryParseDecimal(r):null}static tryParsePlainNumberAsMinutes(r){return/^(\d+)$/.test(r)?parseInt(r,10)/60:null}static tryParseFlexibleHMin(r){let t=r.match(/(\d+)\s*h/),s=r.match(/(\d+)\s*m(?:in)?/);if(!t&&!s)return null;let n=t?parseInt(t[1],10):0,e=s?parseInt(s[1],10):0;return n+e/60}static formatDecimalHoursToHMin(r,t){let s=t?.zeroAs??"";if(r==null||Number.isNaN(r))return"";let n=Math.floor(r),e=Math.round((r-n)*60);return n===0&&e===0?s:n===0?`${e}min`:e===0?`${n}h`:`${n}h ${e}min`}static parseUsedTimePerformedTasks(r){if(typeof r=="number")return r;let t=this.normalizeInput(r);return t?this.tryParseHMinStrict(t)??this.tryParseHoursOnly(t)??this.tryParseMinutesOnly(t)??this.tryParseDecimal(t)??0:0}static parseUsedTimeMinutesDefault(r){let t=this.normalizeInput(r);return t?this.tryParseDecimalWithCommaOrDot(t)??this.tryParsePlainNumberAsMinutes(t)??this.tryParseFlexibleHMin(t):null}static formatDecimalToHoursMinutes(r){let t=Math.floor(r),s=Math.round((r-t)*60);return`${t}.${String(s).padStart(2,"0")}`}};export{i as a};
