import{r as w,t as k,k as _}from"./index-33b41d47.js";function g(t){if(t===null||t===!0||t===!1)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function S(t,e){var o,n,r,i,s,u,v,d;w(1,arguments);var f=_(),l=g((o=(n=(r=(i=e==null?void 0:e.weekStartsOn)!==null&&i!==void 0?i:e==null||(s=e.locale)===null||s===void 0||(u=s.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&r!==void 0?r:f.weekStartsOn)!==null&&n!==void 0?n:(v=f.locale)===null||v===void 0||(d=v.options)===null||d===void 0?void 0:d.weekStartsOn)!==null&&o!==void 0?o:0);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var a=k(t),O=a.getUTCDay(),c=(O<l?7:0)+O-l;return a.setUTCDate(a.getUTCDate()-c),a.setUTCHours(0,0,0,0),a}export{S as s,g as t};
