var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(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,o){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const o=e.subscribe(...n);return o.unsubscribe?()=>o.unsubscribe():o}(n,o))}function c(t,e){t.appendChild(e)}function l(t,e,n){t.insertBefore(e,n||null)}function i(t){t.parentNode.removeChild(t)}function u(t,e){for(let n=0;nt.removeEventListener(e,n,o)}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 $=[],w=[],x=[],k=[],J=Promise.resolve();let _=!1;function C(t){x.push(t)}let A=!1;const L=new Set;function j(){if(!A){A=!0;do{for(let t=0;t<$.length;t+=1){const e=$[t];v(e),T(e.$$)}for($.length=0;w.length;)w.pop()();for(let t=0;t{M.delete(t),o&&(n&&t.d(1),o())}),t.o(e)}}function N(t){t&&t.c()}function R(t,n,a){const{fragment:s,on_mount:c,on_destroy:l,after_update:i}=t.$$;s&&s.m(n,a),C(()=>{const n=c.map(e).filter(r);l?l.push(...n):o(n),t.$$.on_mount=[]}),i.forEach(C)}function D(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function E(t,e){-1===t.$$.dirty[0]&&($.push(t),_||(_=!0,J.then(j)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const r=o.length?o[0]:n;return p.ctx&&c(p.ctx[t],p.ctx[t]=r)&&(p.bound[t]&&p.bound[t](r),m&&E(e,t)),n}):[],p.update(),m=!0,o(p.before_update),p.fragment=!!s&&s(p.ctx),r.target){if(r.hydrate){const t=function(t){return Array.from(t.childNodes)}(r.target);p.fragment&&p.fragment.l(t),t.forEach(i)}else p.fragment&&p.fragment.c();r.intro&&O(e.$$.fragment),R(e,r.target,r.anchor),j()}v(d)}class P{$destroy(){D(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 q=[];function z(e,n=t){let o;const r=[];function s(t){if(a(e,t)&&(e=t,o)){const t=!q.length;for(let t=0;t{const t=r.indexOf(l);-1!==t&&r.splice(t,1),0===r.length&&(o(),o=null)}}}}var F=function t(e){function n(t){return function(e,n){return a(e,Object.assign({method:t},n))}}function o(t){return function(e,n,o){return a(e,Object.assign({method:t,data:n},o))}}function r(t,e,n){if(Array.isArray(t))return t.concat(e);if(e&&"object"==typeof e){var o,a={};if(t)for(o in t)a[n?o.toLowerCase():o]=t[o];for(o in e){var s=n?o.toLowerCase():o;"headers"===s&&(n=!0),a[s]=o in a?r(a[s],e[o],n):e[o]}return a}return e}function a(t,n){"string"!=typeof t&&(t=(n=t).url);var o=r(e,n||{}),a=o.data;if(o.transformRequest)for(var s=0;s{const e=JSON.parse(t.data);W.set(e)}).catch(t=>{console.error("getJobList",t)})},loadJobDetail(t){if(console.log("loadJobDetail: "+t),t){const e=`${V.jobs}/${t}`;F.get(e).then(t=>{const e=JSON.parse(t.data);B.set(e)}).catch(t=>{console.error("loadJobDetail",t)})}},async touchJob(t){if(console.log("touchJob: "+t),t){const e=`${V.jobs}/${t}`;await F.put(e).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("touchJob",t)}),W.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=`${V.apply}/${t}`;await F.put(n).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("appliedJob",t)});const o=parseInt(t,10);W.update(t=>(t.map(t=>{if(t._id===o)return t.a=e,t}),t)),B.update(t=>(t.a=e,t))}},async markAllRead(){console.log(">> markAllRead");const t=""+V.readall;await F.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=`${V.kill}/${t}`;F.put(e).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("killword",t)})},upVote(t){console.log(">> upvote:"+t);const e=`${V.upvote}/${t}`;F.put(e).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("upvote",t)})},downVote(t){console.log(">> downvote:"+t);const e=`${V.downvote}/${t}`;F.put(e).then(t=>{200!==t.status&&console.error(t)}).catch(t=>{console.error("downvote",t)})}};function G(t,e,n){const o=t.slice();return o[4]=e[n],o[6]=n,o}function K(t){let e,n,o,r,a,s,u,m,y,v,$,w,x,k,J,_,C=t[4].title+"",A=t[4].site+"",L=X(t[4].company)+"",j=tt(t[4].timestamp)+"";return{c(){e=d("tr"),n=d("td"),o=f(C),r=p(),a=d("td"),s=f(A),u=p(),m=d("td"),y=f(L),v=p(),$=d("td"),w=f(j),x=p(),g(n,"class","noOverflow svelte-15500pg"),g(e,"class",k="dataRow "+Y(t[4])+" "+Z(t[4])+" svelte-15500pg"),g(e,"data-id",J=t[4]._id)},m(i,d,f){var p;l(i,e,d),c(e,n),c(n,o),c(e,r),c(e,a),c(a,s),c(e,u),c(e,m),c(m,y),c(e,v),c(e,$),c($,w),c(e,x),f&&_(),_=h(e,"click",(p=t[1],function(t){return t.stopPropagation(),p.call(this,t)}))},p(t,n){1&n&&C!==(C=t[4].title+"")&&b(o,C),1&n&&A!==(A=t[4].site+"")&&b(s,A),1&n&&L!==(L=X(t[4].company)+"")&&b(y,L),1&n&&j!==(j=tt(t[4].timestamp)+"")&&b(w,j),1&n&&k!==(k="dataRow "+Y(t[4])+" "+Z(t[4])+" svelte-15500pg")&&g(e,"class",k),1&n&&J!==(J=t[4]._id)&&g(e,"data-id",J)},d(t){t&&i(e),_()}}}function Q(e){let n,o,r,a,s,f=e[0],m=[];for(let t=0;t\n Title\n \n \n Site\n \n \n Company\n \n \n Date\n ',a=p(),s=d("tbody");for(let t=0;tn(0,o=t)),[o,function(t){const e=t.target.parentElement.dataset.id;U.loadJobDetail(e),U.touchJob(e)}]}class nt extends P{constructor(t){super(),H(this,t,et,Q,a,{})}}function ot(t,e,n){const o=t.slice();return o[8]=e[n],o[10]=n,o}function rt(t){let e,n,o,r,a,s,m,h,y,v,$,w,x,k,J,_,C,A,L,j,T,M,O,S,N,R,D,E,H,P,q,z,F,I,V,W,B,U,G,K,Q,X,Y=t[3].title+"",Z=t[3].company+"",tt=t[3].location+"",et=t[3].salary+"",nt=t[3].date+"",rt=t[3].site+"",it=t[3].summary+"";function ut(t,e){return 1===t[2]?st:2===t[2]?at:void 0}let dt=ut(t),pt=dt&&dt(t);function mt(t,e){return t[3].a?ct:lt}let ht=mt(t),gt=ht(t),bt=t[3].data.autoclass.words,yt=[];for(let e=0;e>kill",t)}function gt(t,e,n){let o;s(t,B,t=>n(3,o=t));let r=!1,a=!1,c=0;return B.subscribe(t=>{n(0,r=!mt(t)),console.log(t)}),t.$$.update=()=>{8&t.$$.dirty&&(mt(o)||(n(1,a="number"==typeof o.data.applied&&1===o.data.applied),n(2,c=o.data.jobtype)))},[r,a,c,o,function(){U.appliedJob(o._id)}]}class bt extends P{constructor(t){super(),H(this,t,gt,pt,a,{})}}function yt(e){let n,o,r,a,s,u,f;return{c(){n=d("header"),o=d("section"),r=d("span"),r.textContent=""+vt,a=p(),s=d("section"),u=d("button"),u.textContent="Mark All Read",g(r,"class","text-bold navbar-brand mx-1 text-uppercase"),g(o,"class","navbar-section"),g(u,"class","btn btn-sm btn-primary"),g(s,"class","navbar-section text-right"),g(n,"class","navbar bg-primary")},m(t,i,d){l(t,n,i),c(n,o),c(o,r),c(n,a),c(n,s),c(s,u),d&&f(),f=h(u,"click",e[0])},p:t,i:t,o:t,d(t){t&&i(n),f()}}}let vt="Jobs";function $t(t){return[function(){U.markAllRead()}]}class wt extends P{constructor(t){super(),H(this,t,$t,yt,a,{})}}function xt(e){let n,o,r,a,s;const u=new wt({}),f=new nt({}),m=new bt({});return{c(){N(u.$$.fragment),n=p(),o=d("div"),r=d("div"),N(f.$$.fragment),a=p(),N(m.$$.fragment),g(r,"class","col-12"),g(o,"class","container fullWidth")},m(t,e){R(u,t,e),l(t,n,e),l(t,o,e),c(o,r),R(f,r,null),c(r,a),R(m,r,null),s=!0},p:t,i(t){s||(O(u.$$.fragment,t),O(f.$$.fragment,t),O(m.$$.fragment,t),s=!0)},o(t){S(u.$$.fragment,t),S(f.$$.fragment,t),S(m.$$.fragment,t),s=!1},d(t){D(u,t),t&&i(n),t&&i(o),D(f),D(m)}}}var kt=1e3,Jt=6e4,_t=60*Jt,Ct=24*_t,At=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*Ct;case"hours":case"hour":case"hrs":case"hr":case"h":return n*_t;case"minutes":case"minute":case"mins":case"min":case"m":return n*Jt;case"seconds":case"second":case"secs":case"sec":case"s":return n*kt;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>=Ct)return Lt(t,e,Ct,"day");if(e>=_t)return Lt(t,e,_t,"hour");if(e>=Jt)return Lt(t,e,Jt,"minute");if(e>=kt)return Lt(t,e,kt,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=Ct)return Math.round(t/Ct)+"d";if(e>=_t)return Math.round(t/_t)+"h";if(e>=Jt)return Math.round(t/Jt)+"m";if(e>=kt)return Math.round(t/kt)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Lt(t,e,n,o){var r=e>=1.5*n;return Math.round(t/n)+" "+o+(r?"s":"")}let jt=0;const Tt=new class extends P{constructor(t){super(),H(this,t,null,xt,a,{})}}({target:document.body});return function t(){U.getJobList();const e=function(t=0){return 36e5-(new Date).getTime()%36e5+t}()+At("10m");console.log("Next:",e),jt=setTimeout(()=>{t()},e)}(),Tt}();