4 lines
48 KiB
JavaScript
4 lines
48 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jspdf.es.min-BjhgvCCx.js","assets/index-9FS9bw8D.js","assets/index-DG9A8wSV.css","assets/jspdf.plugin.autotable-DBLRFAAy.js"])))=>i.map(i=>d[i]);
|
|
import{r as E,j as i,p as Z,z as ee,K as ve,_ as se}from"./index-9FS9bw8D.js";function pe({title:a,titleId:t,...e},n){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},e),a?E.createElement("title",{id:t},a):null,E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))}const xe=E.forwardRef(pe);function we({title:a,titleId:t,...e},n){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},e),a?E.createElement("title",{id:t},a):null,E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m.75 12 3 3m0 0 3-3m-3 3v-6m-1.5-9H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const ye=E.forwardRef(we);function X(a){"@babel/helpers - typeof";return X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X(a)}function I(a){if(a===null||a===!0||a===!1)return NaN;var t=Number(a);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function U(a,t){if(t.length<a)throw new TypeError(a+" argument"+(a>1?"s":"")+" required, but only "+t.length+" present")}function q(a){U(1,arguments);var t=Object.prototype.toString.call(a);return a instanceof Date||X(a)==="object"&&t==="[object Date]"?new Date(a.getTime()):typeof a=="number"||t==="[object Number]"?new Date(a):((typeof a=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function be(a,t){U(2,arguments);var e=q(a).getTime(),n=I(t);return new Date(e+n)}var Ne={};function K(){return Ne}function je(a){var t=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()));return t.setUTCFullYear(a.getFullYear()),a.getTime()-t.getTime()}function Ce(a){return U(1,arguments),a instanceof Date||X(a)==="object"&&Object.prototype.toString.call(a)==="[object Date]"}function Se(a){if(U(1,arguments),!Ce(a)&&typeof a!="number")return!1;var t=q(a);return!isNaN(Number(t))}function Te(a,t){U(2,arguments);var e=I(t);return be(a,-e)}var Me=864e5;function De(a){U(1,arguments);var t=q(a),e=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=t.getTime(),r=e-n;return Math.floor(r/Me)+1}function V(a){U(1,arguments);var t=1,e=q(a),n=e.getUTCDay(),r=(n<t?7:0)+n-t;return e.setUTCDate(e.getUTCDate()-r),e.setUTCHours(0,0,0,0),e}function me(a){U(1,arguments);var t=q(a),e=t.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(e+1,0,4),n.setUTCHours(0,0,0,0);var r=V(n),s=new Date(0);s.setUTCFullYear(e,0,4),s.setUTCHours(0,0,0,0);var o=V(s);return t.getTime()>=r.getTime()?e+1:t.getTime()>=o.getTime()?e:e-1}function Pe(a){U(1,arguments);var t=me(a),e=new Date(0);e.setUTCFullYear(t,0,4),e.setUTCHours(0,0,0,0);var n=V(e);return n}var Oe=6048e5;function ke(a){U(1,arguments);var t=q(a),e=V(t).getTime()-Pe(t).getTime();return Math.round(e/Oe)+1}function J(a,t){var e,n,r,s,o,p,v,N;U(1,arguments);var M=K(),h=I((e=(n=(r=(s=t==null?void 0:t.weekStartsOn)!==null&&s!==void 0?s:t==null||(o=t.locale)===null||o===void 0||(p=o.options)===null||p===void 0?void 0:p.weekStartsOn)!==null&&r!==void 0?r:M.weekStartsOn)!==null&&n!==void 0?n:(v=M.locale)===null||v===void 0||(N=v.options)===null||N===void 0?void 0:N.weekStartsOn)!==null&&e!==void 0?e:0);if(!(h>=0&&h<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var k=q(a),P=k.getUTCDay(),j=(P<h?7:0)+P-h;return k.setUTCDate(k.getUTCDate()-j),k.setUTCHours(0,0,0,0),k}function fe(a,t){var e,n,r,s,o,p,v,N;U(1,arguments);var M=q(a),h=M.getUTCFullYear(),k=K(),P=I((e=(n=(r=(s=t==null?void 0:t.firstWeekContainsDate)!==null&&s!==void 0?s:t==null||(o=t.locale)===null||o===void 0||(p=o.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&r!==void 0?r:k.firstWeekContainsDate)!==null&&n!==void 0?n:(v=k.locale)===null||v===void 0||(N=v.options)===null||N===void 0?void 0:N.firstWeekContainsDate)!==null&&e!==void 0?e:1);if(!(P>=1&&P<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var j=new Date(0);j.setUTCFullYear(h+1,0,P),j.setUTCHours(0,0,0,0);var l=J(j,t),u=new Date(0);u.setUTCFullYear(h,0,P),u.setUTCHours(0,0,0,0);var d=J(u,t);return M.getTime()>=l.getTime()?h+1:M.getTime()>=d.getTime()?h:h-1}function We(a,t){var e,n,r,s,o,p,v,N;U(1,arguments);var M=K(),h=I((e=(n=(r=(s=t==null?void 0:t.firstWeekContainsDate)!==null&&s!==void 0?s:t==null||(o=t.locale)===null||o===void 0||(p=o.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&r!==void 0?r:M.firstWeekContainsDate)!==null&&n!==void 0?n:(v=M.locale)===null||v===void 0||(N=v.options)===null||N===void 0?void 0:N.firstWeekContainsDate)!==null&&e!==void 0?e:1),k=fe(a,t),P=new Date(0);P.setUTCFullYear(k,0,h),P.setUTCHours(0,0,0,0);var j=J(P,t);return j}var Ee=6048e5;function Ue(a,t){U(1,arguments);var e=q(a),n=J(e,t).getTime()-We(e,t).getTime();return Math.round(n/Ee)+1}function T(a,t){for(var e=a<0?"-":"",n=Math.abs(a).toString();n.length<t;)n="0"+n;return e+n}var _={y:function(t,e){var n=t.getUTCFullYear(),r=n>0?n:1-n;return T(e==="yy"?r%100:r,e.length)},M:function(t,e){var n=t.getUTCMonth();return e==="M"?String(n+1):T(n+1,2)},d:function(t,e){return T(t.getUTCDate(),e.length)},a:function(t,e){var n=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h:function(t,e){return T(t.getUTCHours()%12||12,e.length)},H:function(t,e){return T(t.getUTCHours(),e.length)},m:function(t,e){return T(t.getUTCMinutes(),e.length)},s:function(t,e){return T(t.getUTCSeconds(),e.length)},S:function(t,e){var n=e.length,r=t.getUTCMilliseconds(),s=Math.floor(r*Math.pow(10,n-3));return T(s,e.length)}},H={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Le={G:function(t,e,n){var r=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){var r=t.getUTCFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return _.y(t,e)},Y:function(t,e,n,r){var s=fe(t,r),o=s>0?s:1-s;if(e==="YY"){var p=o%100;return T(p,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):T(o,e.length)},R:function(t,e){var n=me(t);return T(n,e.length)},u:function(t,e){var n=t.getUTCFullYear();return T(n,e.length)},Q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return T(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return T(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){var r=t.getUTCMonth();switch(e){case"M":case"MM":return _.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){var r=t.getUTCMonth();switch(e){case"L":return String(r+1);case"LL":return T(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){var s=Ue(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):T(s,e.length)},I:function(t,e,n){var r=ke(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):T(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getUTCDate(),{unit:"date"}):_.d(t,e)},D:function(t,e,n){var r=De(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):T(r,e.length)},E:function(t,e,n){var r=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){var s=t.getUTCDay(),o=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return T(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){var s=t.getUTCDay(),o=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return T(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){var r=t.getUTCDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return T(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){var r=t.getUTCHours(),s=r/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){var r=t.getUTCHours(),s;switch(r===12?s=H.noon:r===0?s=H.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){var r=t.getUTCHours(),s;switch(r>=17?s=H.evening:r>=12?s=H.afternoon:r>=4?s=H.morning:s=H.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){var r=t.getUTCHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return _.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):_.H(t,e)},K:function(t,e,n){var r=t.getUTCHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):T(r,e.length)},k:function(t,e,n){var r=t.getUTCHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):T(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):_.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):_.s(t,e)},S:function(t,e){return _.S(t,e)},X:function(t,e,n,r){var s=r._originalDate||t,o=s.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return le(o);case"XXXX":case"XX":return F(o);case"XXXXX":case"XXX":default:return F(o,":")}},x:function(t,e,n,r){var s=r._originalDate||t,o=s.getTimezoneOffset();switch(e){case"x":return le(o);case"xxxx":case"xx":return F(o);case"xxxxx":case"xxx":default:return F(o,":")}},O:function(t,e,n,r){var s=r._originalDate||t,o=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+oe(o,":");case"OOOO":default:return"GMT"+F(o,":")}},z:function(t,e,n,r){var s=r._originalDate||t,o=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+oe(o,":");case"zzzz":default:return"GMT"+F(o,":")}},t:function(t,e,n,r){var s=r._originalDate||t,o=Math.floor(s.getTime()/1e3);return T(o,e.length)},T:function(t,e,n,r){var s=r._originalDate||t,o=s.getTime();return T(o,e.length)}};function oe(a,t){var e=a>0?"-":"+",n=Math.abs(a),r=Math.floor(n/60),s=n%60;if(s===0)return e+String(r);var o=t;return e+String(r)+o+T(s,2)}function le(a,t){if(a%60===0){var e=a>0?"-":"+";return e+T(Math.abs(a)/60,2)}return F(a,t)}function F(a,t){var e=t||"",n=a>0?"-":"+",r=Math.abs(a),s=T(Math.floor(r/60),2),o=T(r%60,2);return n+s+e+o}var de=function(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},he=function(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Ae=function(t,e){var n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return de(t,e);var o;switch(r){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;case"PPPP":default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",de(r,e)).replace("{{time}}",he(s,e))},qe={p:he,P:Ae},Re=["D","DD"],$e=["YY","YYYY"];function _e(a){return Re.indexOf(a)!==-1}function Ye(a){return $e.indexOf(a)!==-1}function ce(a,t,e){if(a==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(a==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(a==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(a==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Fe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ie=function(t,e,n){var r,s=Fe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function te(a){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.width?String(t.width):a.defaultWidth,n=a.formats[e]||a.formats[a.defaultWidth];return n}}var He={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ge={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Be={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ze={date:te({formats:He,defaultWidth:"full"}),time:te({formats:Ge,defaultWidth:"full"}),dateTime:te({formats:Be,defaultWidth:"full"})},Qe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Xe=function(t,e,n,r){return Qe[t]};function B(a){return function(t,e){var n=e!=null&&e.context?String(e.context):"standalone",r;if(n==="formatting"&&a.formattingValues){var s=a.defaultFormattingWidth||a.defaultWidth,o=e!=null&&e.width?String(e.width):s;r=a.formattingValues[o]||a.formattingValues[s]}else{var p=a.defaultWidth,v=e!=null&&e.width?String(e.width):a.defaultWidth;r=a.values[v]||a.values[p]}var N=a.argumentCallback?a.argumentCallback(t):t;return r[N]}}var Ve={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Je={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ke={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ze={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},et={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},tt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},at=function(t,e){var n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},nt={ordinalNumber:at,era:B({values:Ve,defaultWidth:"wide"}),quarter:B({values:Je,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:B({values:Ke,defaultWidth:"wide"}),day:B({values:Ze,defaultWidth:"wide"}),dayPeriod:B({values:et,defaultWidth:"wide",formattingValues:tt,defaultFormattingWidth:"wide"})};function z(a){return function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.width,r=n&&a.matchPatterns[n]||a.matchPatterns[a.defaultMatchWidth],s=t.match(r);if(!s)return null;var o=s[0],p=n&&a.parsePatterns[n]||a.parsePatterns[a.defaultParseWidth],v=Array.isArray(p)?it(p,function(h){return h.test(o)}):rt(p,function(h){return h.test(o)}),N;N=a.valueCallback?a.valueCallback(v):v,N=e.valueCallback?e.valueCallback(N):N;var M=t.slice(o.length);return{value:N,rest:M}}}function rt(a,t){for(var e in a)if(a.hasOwnProperty(e)&&t(a[e]))return e}function it(a,t){for(var e=0;e<a.length;e++)if(t(a[e]))return e}function st(a){return function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.match(a.matchPattern);if(!n)return null;var r=n[0],s=t.match(a.parsePattern);if(!s)return null;var o=a.valueCallback?a.valueCallback(s[0]):s[0];o=e.valueCallback?e.valueCallback(o):o;var p=t.slice(r.length);return{value:o,rest:p}}}var ot=/^(\d+)(th|st|nd|rd)?/i,lt=/\d+/i,dt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ct={any:[/^b/i,/^(a|c)/i]},ut={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},mt={any:[/1/i,/2/i,/3/i,/4/i]},ft={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ht={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},gt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},vt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},pt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},xt={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},wt={ordinalNumber:st({matchPattern:ot,parsePattern:lt,valueCallback:function(t){return parseInt(t,10)}}),era:z({matchPatterns:dt,defaultMatchWidth:"wide",parsePatterns:ct,defaultParseWidth:"any"}),quarter:z({matchPatterns:ut,defaultMatchWidth:"wide",parsePatterns:mt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:z({matchPatterns:ft,defaultMatchWidth:"wide",parsePatterns:ht,defaultParseWidth:"any"}),day:z({matchPatterns:gt,defaultMatchWidth:"wide",parsePatterns:vt,defaultParseWidth:"any"}),dayPeriod:z({matchPatterns:pt,defaultMatchWidth:"any",parsePatterns:xt,defaultParseWidth:"any"})},yt={code:"en-US",formatDistance:Ie,formatLong:ze,formatRelative:Xe,localize:nt,match:wt,options:{weekStartsOn:0,firstWeekContainsDate:1}},bt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Nt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,jt=/^'([^]*?)'?$/,Ct=/''/g,St=/[a-zA-Z]/;function ge(a,t,e){var n,r,s,o,p,v,N,M,h,k,P,j,l,u;U(2,arguments);var d=String(t),m=K(),g=(n=(r=void 0)!==null&&r!==void 0?r:m.locale)!==null&&n!==void 0?n:yt,f=I((s=(o=(p=(v=void 0)!==null&&v!==void 0?v:void 0)!==null&&p!==void 0?p:m.firstWeekContainsDate)!==null&&o!==void 0?o:(N=m.locale)===null||N===void 0||(M=N.options)===null||M===void 0?void 0:M.firstWeekContainsDate)!==null&&s!==void 0?s:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=I((h=(k=(P=(j=void 0)!==null&&j!==void 0?j:void 0)!==null&&P!==void 0?P:m.weekStartsOn)!==null&&k!==void 0?k:(l=m.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&h!==void 0?h:0);if(!(C>=0&&C<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!g.localize)throw new RangeError("locale must contain localize property");if(!g.formatLong)throw new RangeError("locale must contain formatLong property");var W=q(a);if(!Se(W))throw new RangeError("Invalid time value");var L=je(W),x=Te(W,L),S={firstWeekContainsDate:f,weekStartsOn:C,locale:g,_originalDate:W},c=d.match(Nt).map(function(w){var O=w[0];if(O==="p"||O==="P"){var b=qe[O];return b(w,g.formatLong)}return w}).join("").match(bt).map(function(w){if(w==="''")return"'";var O=w[0];if(O==="'")return Tt(w);var b=Le[O];if(b)return Ye(w)&&ce(w,t,String(a)),_e(w)&&ce(w,t,String(a)),b(x,w,g.localize,S);if(O.match(St))throw new RangeError("Format string contains an unescaped latin alphabet character `"+O+"`");return w}).join("");return c}function Tt(a){var t=a.match(jt);return t?t[1].replace(Ct,"'"):a}const Mt=()=>{const a=new Date;return a.setDate(a.getDate()-30),a.toISOString().split("T")[0]},Q=a=>({N_S:"North/South",E_W:"East/West",NE_SW:"NE/SW",NW_SE:"NW/SE",CIRCULAR:"Circular"})[a]||a||"N/A",$=a=>{if(!a)return"N/A";try{return ge(new Date(a),"MMM d, yyyy")}catch{return a}},y=(a,t=2)=>Number(a||0).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:t}),Dt=a=>{const t=e=>{const n=e==null?"":String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n};return a.map(e=>e.map(t).join(",")).join(`
|
|
`)},Pt=a=>((a==null?void 0:a.sections)||[]).map(t=>{var r;let e=t.polygonData||t.polygon_data;if(typeof e=="string")try{e=JSON.parse(e)}catch{e=null}const n=((r=e==null?void 0:e.coordinates)==null?void 0:r[0])||[];return n.length?{name:t.name,area:Number(t.area||0),points:n.map(([s,o])=>({lat:Number(s),lng:Number(o)}))}:null}).filter(Boolean),ae=a=>a==="liquid"?"oz":"lbs",ue=a=>a.reduce((t,e)=>(e.products.forEach(n=>{const r=Number(n.actualProductAmount||0);n.type==="liquid"?t.liquidOunces+=r:t.granularLbs+=r}),t),{granularLbs:0,liquidOunces:0}),Ot=async(a,t=8e3)=>{try{const e=new AbortController,n=window.setTimeout(()=>e.abort(),t),r=await fetch(a,{signal:e.signal,mode:"cors"});if(window.clearTimeout(n),!r.ok)return null;const s=await r.blob();return await new Promise(o=>{const p=new FileReader;p.onloadend=()=>o(p.result),p.onerror=()=>o(null),p.readAsDataURL(s)})}catch{return null}},kt=(a,t,e)=>{const n=a.flatMap(g=>g.points),r=Math.min(...n.map(g=>g.lat)),s=Math.max(...n.map(g=>g.lat)),o=Math.min(...n.map(g=>g.lng)),p=Math.max(...n.map(g=>g.lng)),v=Math.max(s-r,1e-5),N=Math.max(p-o,1e-5),M=.18;let h=r-v*M,k=s+v*M,P=o-N*M,j=p+N*M,l=Math.max(k-h,1e-5),u=Math.max(j-P,1e-5);const d=t/e;if(u/l>d){const g=u/d,f=(g-l)/2;h-=f,k+=f,l=g}else{const g=l*d,f=(g-u)/2;P-=f,j+=f,u=g}return{minLat:h,maxLat:k,minLng:P,maxLng:j,latRange:l,lngRange:u}},Wt=async(a,t,e,n,r,s)=>{if(!t.length)return n;const o=kt(t,r,s),p=10,v=r-p*2,N=s-p*2;a.setDrawColor(180,180,180),a.setFillColor(248,250,252),a.roundedRect(e,n,r,s,6,6,"FD");const M=await Ot(`https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/export?bbox=${[o.minLng,o.minLat,o.maxLng,o.maxLat].join(",")}&bboxSR=4326&imageSR=4326&size=${Math.round(r*2)},${Math.round(s*2)}&format=jpgpng&transparent=false&f=image`);if(M)try{a.addImage(M,"JPEG",e,n,r,s)}catch{}const h=[[59,130,246],[16,185,129],[249,115,22],[168,85,247],[236,72,153],[234,179,8]];return t.forEach((k,P)=>{const j=h[P%h.length],l=k.points.map(f=>[e+p+(f.lng-o.minLng)/o.lngRange*v,n+s-p-(f.lat-o.minLat)/o.latRange*N]);a.setDrawColor(j[0],j[1],j[2]),a.setFillColor(j[0],j[1],j[2]),a.setLineWidth(2);for(let f=0;f<l.length;f+=1){const[C,W]=l[f],[L,x]=l[(f+1)%l.length];a.line(C,W,L,x),a.circle(C,W,1.2,"F")}const[u,d]=l[0],[m,g]=l[l.length-1];(u!==m||d!==g)&&a.line(m,g,u,d)}),n+s},Et=(a,t,e,n,r)=>{const p=[[59,130,246],[16,185,129],[249,115,22],[168,85,247],[236,72,153],[234,179,8]];a.setFontSize(9),a.setTextColor(31,41,55),a.text("Section Legend",e,n);let v=n+10;return a.setFillColor(249,250,251),a.setDrawColor(229,231,235),a.roundedRect(e,v,r,18,4,4,"FD"),a.text("Color",e+10,v+12),a.text("Section",e+42,v+12),a.text("Area",e+r-70,v+12),v+=18,t.forEach((N,M)=>{const h=p[M%p.length];a.setFillColor(255,255,255),a.setDrawColor(229,231,235),a.rect(e,v,r,18),a.setFillColor(h[0],h[1],h[2]),a.rect(e+10,v+4,10,10,"F"),a.setTextColor(31,41,55),a.text(N.name,e+42,v+12),a.text(`${y(N.area,0)} sq ft`,e+r-70,v+12),v+=18}),v},Ut=a=>{const t=new Map,e=n=>n!=null&&n.id?(t.has(n.id)||t.set(n.id,{property:n,applications:[],mowingSessions:[],wateringRuns:[]}),t.get(n.id)):null;return a.applications.forEach(n=>{const r=e(n.property);r&&r.applications.push(n)}),a.mowingSessions.forEach(n=>{const r=e(n.property);r&&r.mowingSessions.push(n)}),a.wateringRuns.forEach(n=>{const r=e(n.property);r&&r.wateringRuns.push(n)}),Array.from(t.values())},Lt=()=>{const[a,t]=E.useState([]),[e,n]=E.useState(null),[r,s]=E.useState({propertyId:"",startDate:Mt(),endDate:new Date().toISOString().split("T")[0],activityTypes:{applications:!0,mowing:!0,watering:!0},search:""}),[o,p]=E.useState(!1),[v,N]=E.useState(null);E.useEffect(()=>{(async()=>{var u,d;try{const m=await Z.getAll();t(((d=(u=m.data)==null?void 0:u.data)==null?void 0:d.properties)||[])}catch{ee.error("Failed to load report locations")}})()},[]),E.useEffect(()=>{(async()=>{var u,d;if(!r.propertyId){n(null);return}try{const m=await Z.getById(r.propertyId);n(((d=(u=m.data)==null?void 0:u.data)==null?void 0:d.property)||null)}catch{n(null)}})()},[r.propertyId]);const M=async()=>{var l;try{p(!0);const u=Object.entries(r.activityTypes).filter(([,m])=>m).map(([m])=>m),d=await ve.getOperations({propertyId:r.propertyId||void 0,startDate:r.startDate||void 0,endDate:r.endDate||void 0,activityTypes:u.join(",")});N(((l=d.data)==null?void 0:l.data)||null)}catch{ee.error("Failed to load report data")}finally{p(!1)}};E.useEffect(()=>{M()},[]);const h=E.useMemo(()=>{var C,W,L;if(!v)return{applications:[],mowingSessions:[],wateringRuns:[],summary:null};const l=r.search.trim().toLowerCase(),u=(...x)=>l?x.some(S=>String(S||"").toLowerCase().includes(l)):!0,d=(((C=v.report)==null?void 0:C.applications)||[]).filter(x=>{var S,c,w;return u((S=x.property)==null?void 0:S.name,x.sectionNames,(c=x.plan)==null?void 0:c.applicationType,(w=x.equipment)==null?void 0:w.name,x.products.map(O=>`${O.name} ${O.actualProductAmount} ${O.rateUnit}`).join(" "))}),m=(((W=v.report)==null?void 0:W.mowingSessions)||[]).filter(x=>{var S,c;return u((S=x.property)==null?void 0:S.name,x.sectionNames,(c=x.equipment)==null?void 0:c.name,Q(x.direction),x.cutHeightInches)}),g=(((L=v.report)==null?void 0:L.wateringRuns)||[]).filter(x=>{var S;return u((S=x.property)==null?void 0:S.name,x.name,x.points.map(c=>`${c.sequence} ${c.equipmentName} ${c.sprinklerHeadType}`).join(" "))}),f=ue(d);return{applications:d,mowingSessions:m,wateringRuns:g,summary:{propertyCount:new Set([...d.map(x=>{var S;return(S=x.property)==null?void 0:S.id}),...m.map(x=>{var S;return(S=x.property)==null?void 0:S.id}),...g.map(x=>{var S;return(S=x.property)==null?void 0:S.id})].filter(Boolean)).size,applicationCount:d.length,mowingCount:m.length,wateringCount:g.length,totalGranularLbsUsed:f.granularLbs,totalLiquidOuncesUsed:f.liquidOunces,totalWaterAmountUsed:d.reduce((x,S)=>{var c;return x+(((c=S.totals)==null?void 0:c.totalWaterAmountUsed)||0)},0),totalApplicationArea:d.reduce((x,S)=>x+(S.areaCovered||0),0),totalMowedArea:m.reduce((x,S)=>x+(S.areaCoveredSqft||0),0),totalWateringCoverage:g.reduce((x,S)=>x+(S.totalCoverageSqft||0),0),totalWateringDurationMinutes:g.reduce((x,S)=>x+(S.totalDurationMinutes||0),0)}}},[r.search,v]),k=()=>{const l=[["Activity Type","Date","Property","Sections/Plan","Equipment","Details","Quantity / Area","Notes"]];h.applications.forEach(f=>{f.products.forEach(C=>{var W,L;l.push(["Application",$(f.date),((W=f.property)==null?void 0:W.name)||"",f.sectionNames||"",((L=f.equipment)==null?void 0:L.name)||"",`${C.name} @ ${y(C.rateAmount)} ${C.rateUnit}`,`${y(C.actualProductAmount)} ${ae(C.type)}${C.type==="liquid",""}${C.type==="granular"||C.type==="seed",""}, ${C.type==="liquid"?`${y(C.actualWaterAmount)} water`:"no water"}, area ${y(f.areaCovered)} sq ft`,f.notes||""])})}),h.mowingSessions.forEach(f=>{var C,W;l.push(["Mowing",$(f.date),((C=f.property)==null?void 0:C.name)||"",f.sectionNames||"",((W=f.equipment)==null?void 0:W.name)||"",`Cut height ${y(f.cutHeightInches)} in, direction ${Q(f.direction)}`,`${y(f.areaCoveredSqft)} sq ft, ${y(f.durationSeconds/60)} min`,f.notes||""])}),h.wateringRuns.forEach(f=>{f.points.forEach(C=>{var W;l.push(["Watering",$(f.runDate||f.updatedAt||f.createdAt),((W=f.property)==null?void 0:W.name)||"",f.name||"",C.equipmentName||"",`Point ${C.sequence}: ${C.sprinklerHeadType||"N/A"} ${C.durationMinutes} min`,`${y(C.coverageSqft)} sq ft, ${y(C.sprinklerGpm)} gpm`,f.notes||""])})});const u=Dt(l),d=new Blob([u],{type:"text/csv;charset=utf-8;"}),m=URL.createObjectURL(d),g=document.createElement("a");g.href=m,g.download=`turftracking-report-${new Date().toISOString().slice(0,10)}.csv`,g.click(),URL.revokeObjectURL(m)},P=async()=>{try{const[{default:l},{default:u}]=await Promise.all([se(()=>import("./jspdf.es.min-BjhgvCCx.js").then(c=>c.j),__vite__mapDeps([0,1,2])),se(()=>import("./jspdf.plugin.autotable-DBLRFAAy.js").then(c=>c.j),__vite__mapDeps([3,1,2,0]))]),d=new l({unit:"pt",format:"letter"}),m=40,g=`${r.startDate||"All"} to ${r.endDate||"All"}`,f=new Map,C=async c=>{var w,O;if(!c)return null;if(f.has(c))return f.get(c);try{const Y=((O=(w=(await Z.getById(c)).data)==null?void 0:w.data)==null?void 0:O.property)||null;return f.set(c,Y),Y}catch{return f.set(c,null),null}};e!=null&&e.id&&f.set(e.id,e);const W=c=>{const w=ue(c.applications);return{applicationCount:c.applications.length,mowingCount:c.mowingSessions.length,wateringCount:c.wateringRuns.length,totalGranularLbsUsed:w.granularLbs,totalLiquidOuncesUsed:w.liquidOunces,totalMowedArea:c.mowingSessions.reduce((O,b)=>O+(b.areaCoveredSqft||0),0)}},L=async(c,w,O)=>{var ne,re,ie;O||d.addPage();let b=48;d.setFontSize(20),d.setTextColor(20,20,20),d.text("Operations Report",m,b),b+=20,d.setFontSize(10),d.setTextColor(90,90,90),d.text(`Generated ${ge(new Date,"MMM d, yyyy h:mm a")} | Range ${r.startDate||"All"} to ${r.endDate||"All"}`,m,b),b+=18;const Y=(w==null?void 0:w.name)||((ne=c.property)==null?void 0:ne.name)||"Unknown location";if(d.text(`Location: ${Y}`,m,b),b+=14,w!=null&&w.address||(re=c.property)!=null&&re.address?(d.text(`Address: ${(w==null?void 0:w.address)||((ie=c.property)==null?void 0:ie.address)}`,m,b),b+=16):b+=10,w){const D=Pt(w);D.length&&(d.setFontSize(11),d.setTextColor(31,41,55),d.text("Location Map",m,b),b+=8,b=await Wt(d,D,m,b,300,210)+12,b=Et(d,D,m,b,300)+18)}const R=W(c);u(d,{startY:b,head:[["Applications","Mowing","Watering","Product Used","Mowed Area"]],body:[[R.applicationCount,R.mowingCount,R.wateringCount,`${y(R.totalGranularLbsUsed)} lbs granular / ${y(R.totalLiquidOuncesUsed)} oz liquid`,`${y(R.totalMowedArea)} sq ft`]],theme:"grid",margin:{left:m,right:m}}),b=d.lastAutoTable.finalY+24;const G=D=>{b>700&&(d.addPage(),b=48),d.setFontSize(14),d.setTextColor(20,20,20),d.text(D,m,b),b+=12};c.applications.length&&(G("Product Applications"),u(d,{startY:b,margin:{left:m,right:m},head:[["Date","Sections","Product","Rate","Actual Used","Area"]],body:c.applications.flatMap(D=>D.products.map(A=>[$(D.date),D.sectionNames||"",A.name,`${y(A.rateAmount)} ${A.rateUnit}`,`${y(A.actualProductAmount)} ${ae(A.type)}${A.type==="liquid"?` / ${y(A.actualWaterAmount)} water`:" / no water"}`,`${y(D.areaCovered)} sq ft`])),theme:"striped",styles:{fontSize:8,cellPadding:4}}),b=d.lastAutoTable.finalY+24),c.mowingSessions.length&&(G("Mowing"),u(d,{startY:b,margin:{left:m,right:m},head:[["Date","Sections","Mower","Cut Height","Direction","Area"]],body:c.mowingSessions.map(D=>{var A;return[$(D.date),D.sectionNames||"",((A=D.equipment)==null?void 0:A.name)||"",`${y(D.cutHeightInches)} in`,Q(D.direction),`${y(D.areaCoveredSqft)} sq ft`]}),theme:"striped",styles:{fontSize:8,cellPadding:4}}),b=d.lastAutoTable.finalY+24),c.wateringRuns.length&&(G("Watering"),u(d,{startY:b,margin:{left:m,right:m},head:[["Run Date","Plan","Points","Coverage","Duration","Estimated Gallons"]],body:c.wateringRuns.map(D=>[$(D.runDate||D.updatedAt||D.createdAt),D.name||"",D.pointCount,`${y(D.totalCoverageSqft)} sq ft`,`${y(D.totalDurationMinutes)} min`,y(D.totalEstimatedGallons)]),theme:"striped",styles:{fontSize:8,cellPadding:4}}))},x=r.propertyId?[]:Ut(h),S=r.propertyId?1:x.length||1;if(r.propertyId){const c=e||await C(r.propertyId);await L({property:c||a.find(w=>String(w.id)===String(r.propertyId)),applications:h.applications,mowingSessions:h.mowingSessions,wateringRuns:h.wateringRuns},c,!0)}else for(let c=0;c<x.length;c+=1){const w=x[c],O=await C(w.property.id);await L(w,O||w.property,c===0)}for(let c=1;c<=d.getNumberOfPages();c+=1){d.setPage(c);const w=`${c} of ${S}`,O=(()=>{var b,Y,R;return r.propertyId?(e==null?void 0:e.name)||((b=a.find(G=>String(G.id)===String(r.propertyId)))==null?void 0:b.name)||"Location":((R=(Y=x[c-1])==null?void 0:Y.property)==null?void 0:R.name)||"Location"})();d.setFontSize(9),d.setTextColor(90,90,90),d.text(O,m,24),d.text(`Date Range: ${g}`,m,36),d.text(w,d.internal.pageSize.getWidth()-m,d.internal.pageSize.getHeight()-20,{align:"right"})}d.save(`turftracking-report-${new Date().toISOString().slice(0,10)}.pdf`)}catch{ee.error("Failed to export PDF")}},j=h.summary;return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-end md:justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Reports"}),i.jsx("p",{className:"text-sm text-gray-600",children:"Build filtered operational reports for applications, mowing, and watering."})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs("button",{onClick:k,className:"btn-secondary inline-flex items-center gap-2",disabled:!v,children:[i.jsx(xe,{className:"h-5 w-5"}),"Export CSV"]}),i.jsxs("button",{onClick:P,className:"btn-primary inline-flex items-center gap-2",disabled:!v,children:[i.jsx(ye,{className:"h-5 w-5"}),"Export PDF"]})]})]}),i.jsxs("div",{className:"card p-4",children:[i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-5",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Location"}),i.jsxs("select",{className:"input",value:r.propertyId,onChange:l=>s(u=>({...u,propertyId:l.target.value})),children:[i.jsx("option",{value:"",children:"All locations"}),a.map(l=>i.jsx("option",{value:l.id,children:l.name},l.id))]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Start Date"}),i.jsx("input",{type:"date",className:"input",value:r.startDate,onChange:l=>s(u=>({...u,startDate:l.target.value}))})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"End Date"}),i.jsx("input",{type:"date",className:"input",value:r.endDate,onChange:l=>s(u=>({...u,endDate:l.target.value}))})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Search"}),i.jsx("input",{type:"text",className:"input",placeholder:"Filter visible results",value:r.search,onChange:l=>s(u=>({...u,search:l.target.value}))})]}),i.jsx("div",{className:"flex items-end",children:i.jsx("button",{onClick:M,className:"btn-primary w-full",disabled:o,children:o?"Loading…":"Run Report"})})]}),i.jsx("div",{className:"mt-4 flex flex-wrap gap-4",children:Object.entries(r.activityTypes).map(([l,u])=>i.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700",children:[i.jsx("input",{type:"checkbox",checked:u,onChange:d=>s(m=>({...m,activityTypes:{...m.activityTypes,[l]:d.target.checked}}))}),l.charAt(0).toUpperCase()+l.slice(1)]},l))})]}),j&&i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-5",children:[i.jsxs("div",{className:"card p-4",children:[i.jsx("div",{className:"text-sm text-gray-500",children:"Applications"}),i.jsx("div",{className:"text-2xl font-semibold",children:j.applicationCount}),i.jsxs("div",{className:"text-sm text-gray-600",children:[y(j.totalGranularLbsUsed)," lbs granular / ",y(j.totalLiquidOuncesUsed)," oz liquid"]})]}),i.jsxs("div",{className:"card p-4",children:[i.jsx("div",{className:"text-sm text-gray-500",children:"Mowing Sessions"}),i.jsx("div",{className:"text-2xl font-semibold",children:j.mowingCount}),i.jsxs("div",{className:"text-sm text-gray-600",children:[y(j.totalMowedArea)," sq ft mowed"]})]}),i.jsxs("div",{className:"card p-4",children:[i.jsx("div",{className:"text-sm text-gray-500",children:"Watering Plans"}),i.jsx("div",{className:"text-2xl font-semibold",children:j.wateringCount}),i.jsxs("div",{className:"text-sm text-gray-600",children:[y(j.totalWateringCoverage)," sq ft covered"]})]}),i.jsxs("div",{className:"card p-4",children:[i.jsx("div",{className:"text-sm text-gray-500",children:"Water Used"}),i.jsx("div",{className:"text-2xl font-semibold",children:y(j.totalWaterAmountUsed)}),i.jsx("div",{className:"text-sm text-gray-600",children:"logged during applications"})]}),i.jsxs("div",{className:"card p-4",children:[i.jsx("div",{className:"text-sm text-gray-500",children:"Watering Duration"}),i.jsx("div",{className:"text-2xl font-semibold",children:y(j.totalWateringDurationMinutes)}),i.jsx("div",{className:"text-sm text-gray-600",children:"minutes configured"})]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{className:"card p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Applications"}),i.jsxs("span",{className:"text-sm text-gray-500",children:[h.applications.length," records"]})]}),i.jsxs("div",{className:"space-y-4",children:[h.applications.map(l=>{var u,d,m;return i.jsxs("div",{className:"rounded-lg border border-gray-200 p-4",children:[i.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-gray-900",children:(u=l.property)==null?void 0:u.name}),i.jsx("div",{className:"text-sm text-gray-600",children:l.sectionNames})]}),i.jsxs("div",{className:"text-sm text-gray-600",children:[i.jsx("div",{children:$(l.date)}),i.jsxs("div",{children:[y(l.areaCovered)," sq ft treated"]})]})]}),i.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-3 text-sm text-gray-700",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Equipment:"})," ",((d=l.equipment)==null?void 0:d.name)||"N/A"]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Application Type:"})," ",((m=l.plan)==null?void 0:m.applicationType)||"N/A"]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Average Speed:"})," ",y(l.averageSpeed)," mph"]})]}),i.jsx("div",{className:"mt-4 overflow-x-auto",children:i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 text-sm",children:[i.jsx("thead",{className:"bg-gray-50",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Product"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Rate"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Exact Product Used"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Water Used"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Actual Speed"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-100 bg-white",children:l.products.map(g=>i.jsxs("tr",{children:[i.jsx("td",{className:"px-3 py-2",children:g.name}),i.jsxs("td",{className:"px-3 py-2",children:[y(g.rateAmount)," ",g.rateUnit]}),i.jsxs("td",{className:"px-3 py-2",children:[y(g.actualProductAmount)," ",ae(g.type)]}),i.jsx("td",{className:"px-3 py-2",children:g.type==="liquid"?y(g.actualWaterAmount):"No water"}),i.jsxs("td",{className:"px-3 py-2",children:[y(g.actualSpeedMph)," mph"]})]},g.id))})]})})]},l.id)}),!h.applications.length&&i.jsx("div",{className:"text-sm text-gray-500",children:"No application records match the current filters."})]})]}),i.jsxs("section",{className:"card p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Mowing"}),i.jsxs("span",{className:"text-sm text-gray-500",children:[h.mowingSessions.length," records"]})]}),i.jsxs("div",{className:"space-y-4",children:[h.mowingSessions.map(l=>{var u,d;return i.jsxs("div",{className:"rounded-lg border border-gray-200 p-4",children:[i.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-gray-900",children:(u=l.property)==null?void 0:u.name}),i.jsx("div",{className:"text-sm text-gray-600",children:l.sectionNames})]}),i.jsxs("div",{className:"text-sm text-gray-600",children:[i.jsx("div",{children:$(l.date)}),i.jsxs("div",{children:[y(l.areaCoveredSqft)," sq ft mowed"]})]})]}),i.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-4 text-sm text-gray-700",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Mower:"})," ",((d=l.equipment)==null?void 0:d.name)||"N/A"]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Cut Height:"})," ",y(l.cutHeightInches)," in"]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Direction:"})," ",Q(l.direction)]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Duration:"})," ",y(l.durationSeconds/60)," min"]})]})]},l.id)}),!h.mowingSessions.length&&i.jsx("div",{className:"text-sm text-gray-500",children:"No mowing records match the current filters."})]})]}),i.jsxs("section",{className:"card p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Watering"}),i.jsxs("span",{className:"text-sm text-gray-500",children:[h.wateringRuns.length," runs"]})]}),i.jsxs("div",{className:"space-y-4",children:[h.wateringRuns.map(l=>{var u;return i.jsxs("div",{className:"rounded-lg border border-gray-200 p-4",children:[i.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-gray-900",children:(u=l.property)==null?void 0:u.name}),i.jsx("div",{className:"text-sm text-gray-600",children:l.name})]}),i.jsxs("div",{className:"text-sm text-gray-600",children:[i.jsxs("div",{children:["Run ",$(l.runDate||l.updatedAt||l.createdAt)]}),i.jsxs("div",{children:[y(l.totalCoverageSqft)," sq ft coverage"]})]})]}),i.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-3 text-sm text-gray-700",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Points:"})," ",l.pointCount]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Configured Duration:"})," ",y(l.totalDurationMinutes)," min"]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Estimated Gallons:"})," ",y(l.totalEstimatedGallons)]})]}),i.jsx("div",{className:"mt-4 overflow-x-auto",children:i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 text-sm",children:[i.jsx("thead",{className:"bg-gray-50",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Point"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Head Type"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Duration"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Coverage"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-600",children:"Equipment"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-100 bg-white",children:l.points.map(d=>i.jsxs("tr",{children:[i.jsxs("td",{className:"px-3 py-2",children:["#",d.sequence]}),i.jsx("td",{className:"px-3 py-2",children:d.sprinklerHeadType||"N/A"}),i.jsxs("td",{className:"px-3 py-2",children:[y(d.durationMinutes)," min"]}),i.jsxs("td",{className:"px-3 py-2",children:[y(d.coverageSqft)," sq ft"]}),i.jsx("td",{className:"px-3 py-2",children:d.equipmentName||"N/A"})]},d.id))})]})})]},l.id)}),!h.wateringRuns.length&&i.jsx("div",{className:"text-sm text-gray-500",children:"No watering runs match the current filters."})]})]})]})]})},qt=Object.freeze(Object.defineProperty({__proto__:null,default:Lt},Symbol.toStringTag,{value:"Module"}));export{qt as R,X as _};
|