PageSourceSearch

https://kindredly.ai/js/familyDowntimeDMv_mvJ9.js

js kindredly.ai collected 2026-10-02 01:14:05 UTC 5,029 bytes, 1 lines download raw bytes

1import{i as x,t as F,f as k}from"./familyClockv2WXhBE2.js";import{n as E,a as U}from"./alwaysAllowedBZhbIqQn.js";const A=6e4,y=24*60*A,T=14*y,N=20,C=300;function S(){return{enabled:!1,schedules:[],oneOffs:[],exceptions:[],dismissals:[],allow:{urlPatterns:[],itemIds:[],appIds:[]},updatedAt:0,updatedBy:""}}const g=/^([01]\d|2[0-3]):([0-5]\d)$/;function I(t){return typeof t=="string"&&g.test(t)}function D(t){const[e,s]=t.split(":").map(Number);return e*60+s}function M(t){return typeof t=="number"&&Number.isFinite(t)}function m(t,e=C){return typeof t=="string"?t.trim().slice(0,e):""}function X(t){const e=t&&typeof t=="object"?t:{},s=S();s.enabled=e.enabled===!0;const r=new Set,o=new Set;for(const[i,a]of(Array.isArray(e.schedules)?e.schedules:[]).entries()){const n=a&&typeof a=="object"?a:{};if(!I(n.start)||!I(n.end)||n.start===n.end)continue;const f=[...new Set((Array.isArray(n.daysOfWeek)?n.daysOfWeek:[]).filter(u=>Number.isInteger(u)&&u>=0&&u<=6))].filter(u=>!r.has(u)).sort((u,w)=>u-w);if(!f.length)continue;let c=m(n.id,64)||`schedule-${i+1}`;o.has(c)&&(c=`${c}-${i+1}`),o.add(c),f.forEach(u=>r.add(u)),s.schedules.push({id:c,daysOfWeek:f,start:n.start,end:n.end})}const d=new Set;for(const[i,a]of(Array.isArray(e.oneOffs)?e.oneOffs:[]).entries()){const n=a&&typeof a=="object"?a:{};if(!M(n.startAt)||!M(n.endAt)||n.endAt<=n.startAt||n.endAt-n.startAt>T)continue;let f=m(n.id,64)||`one-off-${i+1}`;if(d.has(f)&&(f=`${f}-${i+1}`),d.add(f),s.oneOffs.push({id:f,startAt:n.startAt,endAt:n.endAt,createdBy:m(n.createdBy,64)}),s.oneOffs.length>=N)break}s.oneOffs.sort((i,a)=>i.startAt-a.startAt);for(const i of Array.isArray(e.exceptions)?e.exceptions:[]){const a=i&&typeof i=="object"?i:{};if(!M(a.fromMs)||!M(a.untilMs)||a.untilMs<=a.fromMs)continue;const n=a.kind==="skipped"?"skipped":"ended";s.exceptions.push({fromMs:a.fromMs,untilMs:a.untilMs,kind:n,byUserId:m(a.byUserId,64)})}const l=new Map;for(const i of Array.isArray(e.dismissals)?e.dismissals:[]){const a=i&&typeof i=="object"?i:{},n=m(a.userId,64);!n||!M(a.untilMs)||l.set(n,Math.max(l.get(n)??0,a.untilMs))}return s.dismissals=[...l].map(([i,a])=>({userId:i,untilMs:a})),s.allow=E(e.allow),s.updatedAt=M(e.updatedAt)?e.updatedAt:0,s.updatedBy=m(e.updatedBy,64),s}function v(t,e,s){return!M(t)||!M(e)?"Pick a start and an end.":e<=t?"The end has to be after the start.":e<=s?"That time has already passed.":e-t>T?"A one-off can last up to 14 days.":null}function h(t,e){return e?F(t,e):-new Date(t).getTimezoneOffset()}function W(t,e,s,r,o,d){const l=x(d)?d:null,i=Date.UTC(t,e,s,r,o),a=h(i-y,l),n=h(i+y,l),f=[a,n].map(c=>i-c*A).filter((c,u)=>h(c,l)===[a,n][u]);return f.length?Math.min(...f):i-a*A}function O(t,e){const[s,r,o]=k(t,e).dateKey.split("-").map(Number);return p({year:s,monthIndex:r-1,day:o},0)}function p(t,e){const s=new Date(Date.UTC(t.year,t.monthIndex,t.day+e));return{year:s.getUTCFullYear(),monthIndex:s.getUTCMonth(),day:s.getUTCDate(),weekday:s.getUTCDay()}}function b(t,e,s){const r=D(e);return W(t.year,t.monthIndex,t.day,Math.floor(r/60),r%60,s)}function L(t,e,s,r){if(!t.enabled||!t.schedules.length||s<=e)return[];const o=[];let d=p(O(e,r),-1);const l=O(s,r),i=Date.UTC(l.year,l.monthIndex,l.day);for(;Date.UTC(d.year,d.monthIndex,d.day)<=i;){for(const a of t.schedules){if(!a.daysOfWeek.includes(d.weekday))continue;const n=b(d,a.start,r),f=D(a.end)<=D(a.start),c=b(f?p(d,1):d,a.end,r);c>n&&c>e&&n<s&&o.push({startMs:n,endMs:c})}d=p(d,1)}return o}function z(t,e){if(e.untilMs<=t.startMs||e.fromMs>=t.endMs)return[t];const s=[];return e.fromMs>t.startMs&&s.push({startMs:t.startMs,endMs:e.fromMs}),e.untilMs<t.endMs&&s.push({startMs:e.untilMs,endMs:t.endMs}),s}function $(t){const e=t.filter(r=>r.endMs>r.startMs).sort((r,o)=>r.startMs-o.startMs),s=[];for(const r of e){const o=s[s.length-1];o&&r.startMs<=o.endMs?o.endMs=Math.max(o.endMs,r.endMs):s.push({...r})}return s}function _(t,e,s,r){if(!t.enabled)return[];let o=L(t,e,s,r);for(const l of t.exceptions)o=o.flatMap(i=>z(i,l));const d=t.oneOffs.filter(l=>l.endAt>e&&l.startAt<s).map(l=>({startMs:l.startAt,endMs:l.endAt}));return $([...o,...d])}
1const B=15*y;function P(t,e,s,r){const o=t?_(t,e,e+B,s):[];return Y(o,(t==null?void 0:t.dismissals)||[],e,r)}function Y(t,e,s,r){const o=t.find(n=>n.startMs<=s&&s<n.endMs)||null,d=t.find(n=>n.startMs>s)||null,l=r&&o&&e.find(n=>n.userId===r&&n.untilMs>s)||null,i=!!l,a=[o==null?void 0:o.endMs,d==null?void 0:d.startMs,i?l.untilMs:void 0].filter(n=>typeof n=="number"&&n>s);return{active:!!o,startedAtMs:(o==null?void 0:o.startMs)??null,endsAtMs:(o==null?void 0:o.endMs)??null,nextStartMs:(d==null?void 0:d.startMs)??null,nextEndMs:(d==null?void 0:d.endMs)??null,dismissedForUser:i,dismissedUntilMs:i?l.untilMs:null,lockedForUser:!!o&&!i,nextChangeMs:a.length?Math.min(...a):null}}function V(t,e){return U(t,e)}const j=28*y;function G(t,e,s){const r=e+j;return{intervals:_(t,e,r,s).filter(o=>o.endMs>e),horizonEndMs:r,allowAppIds:[...t.allow.appIds]}}export{B as F,G as a,_ as b,S as e,Y as f,V as i,X as n,v as o,P as r,W as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.