var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function o(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function s(e,n,r){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}function c(t,e){t.appendChild(e)}function i(t,e,n){t.insertBefore(e,n||null)}function u(t){t.parentNode.removeChild(t)}function l(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function g(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function b(t,e){e=""+e,t.data!==e&&(t.data=e)}let y;function v(t){y=t}const $=[],M=[],w=[],D=[],k=Promise.resolve();let S=!1;function x(t){w.push(t)}let Y=!1;const H=new Set;function T(){if(!Y){Y=!0;do{for(let t=0;t<$.length;t+=1){const e=$[t];v(e),J(e.$$)}for($.length=0;M.length;)M.pop()();for(let t=0;t{N.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}function C(t){t&&t.c()}function _(t,n,a){const{fragment:s,on_mount:c,on_destroy:i,after_update:u}=t.$$;s&&s.m(n,a),x(()=>{const n=c.map(e).filter(o);i?i.push(...n):r(n),t.$$.on_mount=[]}),u.forEach(x)}function O(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function L(t,e){-1===t.$$.dirty[0]&&($.push(t),S||(S=!0,k.then(T)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const o=r.length?r[0]:n;return m.ctx&&c(m.ctx[t],m.ctx[t]=o)&&(m.bound[t]&&m.bound[t](o),p&&L(e,t)),n}):[],m.update(),p=!0,r(m.before_update),m.fragment=!!s&&s(m.ctx),o.target){if(o.hydrate){const t=function(t){return Array.from(t.childNodes)}(o.target);m.fragment&&m.fragment.l(t),t.forEach(u)}else m.fragment&&m.fragment.c();o.intro&&j(e.$$.fragment),_(e,o.target,o.anchor),T()}v(d)}class R{$destroy(){O(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}}const E=[];function F(e,n=t){let r;const o=[];function s(t){if(a(e,t)&&(e=t,r)){const t=!E.length;for(let t=0;t{const t=o.indexOf(i);-1!==t&&o.splice(t,1),0===o.length&&(r(),r=null)}}}}var Z=function t(e){function n(t){return function(e,n){return a(e,Object.assign({method:t},n))}}function r(t){return function(e,n,r){return a(e,Object.assign({method:t,data:n},r))}}function o(t,e,n){if(Array.isArray(t))return t.concat(e);if(e&&"object"==typeof e){var r,a={};if(t)for(r in t)a[n?r.toLowerCase():r]=t[r];for(r in e){var s=n?r.toLowerCase():r;"headers"===s&&(n=!0),a[s]=r in a?o(a[s],e[r],n):e[r]}return a}return e}function a(t,n){"string"!=typeof t&&(t=(n=t).url);var r=o(e,n||{}),a=r.data;if(r.transformRequest)for(var s=0;s{const e=JSON.parse(t.data);I.set(e)}).catch(t=>{console.error("getJobList",t)})},loadJobDetail(t){if(console.log("loadJobDetail: "+t),t){const e=`${z.jobs}/${t}`;Z.get(e).then(t=>{const e=JSON.parse(t.data);U.set(e)}).catch(t=>{console.error("loadJobDetail",t)})}},async touchJob(t){if(console.log("touchJob: "+t),t){const e=`${z.jobs}/${t}`;await Z.put(e).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("touchJob",t)}),I.update(e=>(e.map(e=>{if(e._id===t)return e.read=(new Date).getTime(),e}),e))}},async appliedJob(t){console.log("touchJob: "+t);const e=(new Date).getTime();if(t){console.log("Applying..");const n=`${z.apply}/${t}`;await Z.put(n).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("appliedJob",t)});const r=t;I.update(t=>(t.map(t=>{if(t._id===r)return t.applied=e,t}),t)),U.update(t=>(t.data.applied=e,t))}},async markAllRead(){console.log(">> markAllRead");const t=""+z.readall;await Z.put(t).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("markAllRead",t)}),this.getJobList()},killWord(t){console.log(">> killword:"+t);const e=`${z.kill}/${t}`;Z.put(e).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("killword",t)})},upVote(t){console.log(">> upvote:"+t);const e=`${z.upvote}/${t}`;Z.put(e).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("upvote",t)})},downVote(t){console.log(">> downvote:"+t);const e=`${z.downvote}/${t}`;Z.put(e).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("downvote",t)})}};var V=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,B=/\[([^]*?)\]/gm;function G(t,e){for(var n=[],r=0,o=t.length;r3?0:(t-t%10!=10?1:0)*t%10]}}),nt=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+nt(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+nt(Math.floor(Math.abs(e)/60),2)+":"+nt(Math.abs(e)%60,2)}},ot={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},at=function(t,e,n){if(void 0===e&&(e=ot.default),void 0===n&&(n={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var r=[];e=(e=ot[e]||e).replace(B,(function(t,e){return r.push(e),"@@@"}));var o=K(K({},et),n);return(e=e.replace(V,(function(e){return rt[e](t,o)}))).replace(/@@@/g,(function(){return r.shift()}))};function st(t,e,n){const r=t.slice();return r[5]=e[n],r[7]=n,r}function ct(t){let e,n,r,o,a,s,l,p,y,v,$,M,w,D,k,S,x,Y,H=t[5].title+"",T=t[5].site+"",J=ut(t[5].company,25)+"",N=t[2](t[5].timestamp)+"";return{c(){e=d("tr"),n=d("td"),r=f(H),o=m(),a=d("td"),s=f(T),l=m(),p=d("td"),y=f(J),$=m(),M=d("td"),w=f(N),k=m(),g(n,"class","noOverflow svelte-hvjw8w"),g(p,"title",v=t[5].company),g(M,"title",D=ft(t[5].timestamp)),g(e,"class",S="dataRow "+lt(t[5])+" "+dt(t[5])+" svelte-hvjw8w"),g(e,"data-id",x=t[5]._id)},m(u,d,f){var m;i(u,e,d),c(e,n),c(n,r),c(e,o),c(e,a),c(a,s),c(e,l),c(e,p),c(p,y),c(e,$),c(e,M),c(M,w),c(e,k),f&&Y(),Y=h(e,"click",(m=t[1],function(t){return t.stopPropagation(),m.call(this,t)}))},p(t,n){1&n&&H!==(H=t[5].title+"")&&b(r,H),1&n&&T!==(T=t[5].site+"")&&b(s,T),1&n&&J!==(J=ut(t[5].company,25)+"")&&b(y,J),1&n&&v!==(v=t[5].company)&&g(p,"title",v),1&n&&N!==(N=t[2](t[5].timestamp)+"")&&b(w,N),1&n&&D!==(D=ft(t[5].timestamp))&&g(M,"title",D),1&n&&S!==(S="dataRow "+lt(t[5])+" "+dt(t[5])+" svelte-hvjw8w")&&g(e,"class",S),1&n&&x!==(x=t[5]._id)&&g(e,"data-id",x)},d(t){t&&u(e),Y()}}}function it(e){let n,r,o,a,s,f=e[0],p=[];for(let t=0;t\n Title\n \n \n Site\n \n \n Company\n \n \n Date\n ',a=m(),s=d("tbody");for(let t=0;tn(0,r=t)),[r,function(t){const e=t.target.parentElement.dataset.id;W.loadJobDetail(e),W.touchJob(e)},function(t){const e=864e5*~~(Date.now()/864e5);return at(new Date(t),t>e?"shortTime":"isoDate")}]}class pt extends R{constructor(t){super(),P(this,t,mt,it,a,{})}}function ht(t,e,n){const r=t.slice();return r[8]=e[n],r[10]=n,r}function gt(t){let e,n,r,o,a,s,p,h,y,v,$,M,w,D,k,S,x,Y,H,T,J,N,j,A,C,_,O,L,P,R,E,F,Z,q,z,I,U,W,V,B,G,K,Q=t[3].title+"",X=t[3].company+"",tt=t[3].location+"",et=t[3].salary+"",nt=t[3].date+"",rt=t[3].site+"",ot=t[3].summary+"";function at(t,e){return 1===t[2]?yt:2===t[2]?bt:void 0}let st=at(t),ct=st&&st(t);function it(t,e){return t[1]?vt:$t}let ut=it(t),lt=ut(t),dt=t[3].data.autoclass.words,ft=[];for(let e=0;e>kill",t)}function Ht(t,e,n){let r;s(t,U,t=>n(3,r=t));let o=!1,a=!1,c=0;return U.subscribe(t=>{n(0,o=!xt(t))}),t.$$.update=()=>{8&t.$$.dirty&&(xt(r)||(n(1,a="number"==typeof r.data.applied&&0!==r.data.applied),n(2,c=r.data.jobtype)))},[o,a,c,r,function(){W.appliedJob(r._id)}]}class Tt extends R{constructor(t){super(),P(this,t,Ht,St,a,{})}}function Jt(e){let n,r,o,a,s,l,f;return{c(){n=d("header"),r=d("section"),o=d("span"),o.textContent=""+Nt,a=m(),s=d("section"),l=d("button"),l.textContent="Mark All Read",g(o,"class","text-bold navbar-brand mx-1 text-uppercase"),g(r,"class","navbar-section"),g(l,"class","btn btn-sm btn-primary"),g(s,"class","navbar-section text-right"),g(n,"class","navbar bg-primary")},m(t,u,d){i(t,n,u),c(n,r),c(r,o),c(n,a),c(n,s),c(s,l),d&&f(),f=h(l,"click",e[0])},p:t,i:t,o:t,d(t){t&&u(n),f()}}}let Nt="Jobs";function jt(t){return[function(){W.markAllRead()}]}class At extends R{constructor(t){super(),P(this,t,jt,Jt,a,{})}}function Ct(e){let n,r,o,a,s;const l=new At({}),f=new pt({}),p=new Tt({});return{c(){C(l.$$.fragment),n=m(),r=d("div"),o=d("div"),C(f.$$.fragment),a=m(),C(p.$$.fragment),g(o,"class","col-12"),g(r,"class","container fullWidth noscroll")},m(t,e){_(l,t,e),i(t,n,e),i(t,r,e),c(r,o),_(f,o,null),c(o,a),_(p,o,null),s=!0},p:t,i(t){s||(j(l.$$.fragment,t),j(f.$$.fragment,t),j(p.$$.fragment,t),s=!0)},o(t){A(l.$$.fragment,t),A(f.$$.fragment,t),A(p.$$.fragment,t),s=!1},d(t){O(l,t),t&&u(n),t&&u(r),O(f),O(p)}}}var _t=1e3,Ot=6e4,Lt=60*Ot,Pt=24*Lt,Rt=function(t,e){e=e||{};var n=typeof t;if("string"===n&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return n*Pt;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Lt;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ot;case"seconds":case"second":case"secs":case"sec":case"s":return n*_t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(t);if("number"===n&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=Pt)return Et(t,e,Pt,"day");if(e>=Lt)return Et(t,e,Lt,"hour");if(e>=Ot)return Et(t,e,Ot,"minute");if(e>=_t)return Et(t,e,_t,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=Pt)return Math.round(t/Pt)+"d";if(e>=Lt)return Math.round(t/Lt)+"h";if(e>=Ot)return Math.round(t/Ot)+"m";if(e>=_t)return Math.round(t/_t)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Et(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}let Ft=0;const Zt=new class extends R{constructor(t){super(),P(this,t,null,Ct,a,{})}}({target:document.body});return function t(){W.getJobList();const e=function(t=0){return 36e5-(new Date).getTime()%36e5+t}()+Rt("10m");console.log("Next:",e),Ft=setTimeout(()=>{t()},e)}(),Zt}();