jobtrack 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Martin Dahl
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Martin Dahl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/jobtrack.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jobtrack",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Runs the JobTrack API + web UI as one background process with a Windows tray icon",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@fastify/static": "^10.1.3",
|
|
30
|
-
"@jobtrack/api": "^1.0.
|
|
30
|
+
"@jobtrack/api": "^1.0.5",
|
|
31
31
|
"fastify": "^5.12.1",
|
|
32
32
|
"systray": "^1.0.5",
|
|
33
33
|
"tsx": "^4.23.12"
|
|
@@ -440,5 +440,5 @@ html body {
|
|
|
440
440
|
|
|
441
441
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=E$,s=!d$.jitless,c=s&&D$.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Y0([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Q0(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!U$(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>q$(e,r,f$())))}),t)}var $0=c$(`$ZodUnion`,(e,t)=>{d0.init(e,t),b$(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),b$(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),b$(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),b$(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>_$(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Q0(t,r,e,i)):Q0(o,r,e,i)}}),e2=c$(`$ZodIntersection`,(e,t)=>{d0.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>n2(e,t,n)):n2(e,i,a)}});function t2(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(O$(e)&&O$(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=t2(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=t2(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function n2(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),U$(e))return e;let o=t2(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var r2=c$(`$ZodEnum`,(e,t)=>{d0.init(e,t);let n=p$(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>A$.has(typeof e)).map(e=>typeof e==`string`?j$(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),i2=c$(`$ZodTransform`,(e,t)=>{d0.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new u$(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new l$;return n.value=i,n.fallback=!0,n}});function a2(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var o2=c$(`$ZodOptional`,(e,t)=>{d0.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,b$(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),b$(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${_$(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>a2(e,r)):a2(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),s2=c$(`$ZodExactOptional`,(e,t)=>{o2.init(e,t),b$(e._zod,`values`,()=>t.innerType._zod.values),b$(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),c2=c$(`$ZodNullable`,(e,t)=>{d0.init(e,t),b$(e._zod,`optin`,()=>t.innerType._zod.optin),b$(e._zod,`optout`,()=>t.innerType._zod.optout),b$(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${_$(e.source)}|null)$`):void 0}),b$(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),l2=c$(`$ZodDefault`,(e,t)=>{d0.init(e,t),e._zod.optin=`optional`,b$(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>u2(e,t)):u2(r,t)}});function u2(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var d2=c$(`$ZodPrefault`,(e,t)=>{d0.init(e,t),e._zod.optin=`optional`,b$(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),f2=c$(`$ZodNonOptional`,(e,t)=>{d0.init(e,t),b$(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>p2(t,e)):p2(i,e)}});function p2(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var m2=c$(`$ZodCatch`,(e,t)=>{d0.init(e,t),e._zod.optin=`optional`,b$(e._zod,`optout`,()=>t.innerType._zod.optout),b$(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>q$(e,n,f$()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>q$(e,n,f$()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),h2=c$(`$ZodPipe`,(e,t)=>{d0.init(e,t),b$(e._zod,`values`,()=>t.in._zod.values),b$(e._zod,`optin`,()=>t.in._zod.optin),b$(e._zod,`optout`,()=>t.out._zod.optout),b$(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>g2(e,t.in,n)):g2(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>g2(e,t.out,n)):g2(r,t.out,n)}});function g2(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var _2=c$(`$ZodPreprocess`,(e,t)=>{h2.init(e,t)}),v2=c$(`$ZodReadonly`,(e,t)=>{d0.init(e,t),b$(e._zod,`propValues`,()=>t.innerType._zod.propValues),b$(e._zod,`values`,()=>t.innerType._zod.values),b$(e._zod,`optin`,()=>t.innerType?._zod?.optin),b$(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(y2):y2(r)}});function y2(e){return e.value=Object.freeze(e.value),e}var b2=c$(`$ZodCustom`,(e,t)=>{K1.init(e,t),d0.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>x2(t,n,r,e));x2(i,n,r,e)}});function x2(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Y$(e))}}var S2,C2=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function w2(){return new C2}(S2=globalThis).__zod_globalRegistry??(S2.__zod_globalRegistry=w2());var T2=globalThis.__zod_globalRegistry;function E2(e,t){return new e({type:`string`,...N$(t)})}function D2(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N$(t)})}function O2(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N$(t)})}function k2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N$(t)})}function A2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N$(t)})}function j2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N$(t)})}function M2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N$(t)})}function N2(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N$(t)})}function P2(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N$(t)})}function F2(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N$(t)})}function I2(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N$(t)})}function L2(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N$(t)})}function R2(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N$(t)})}function z2(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N$(t)})}function B2(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N$(t)})}function V2(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N$(t)})}function H2(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N$(t)})}function U2(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N$(t)})}function W2(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N$(t)})}function G2(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N$(t)})}function K2(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N$(t)})}function q2(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N$(t)})}function J2(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N$(t)})}function Y2(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...N$(t)})}function X2(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N$(t)})}function Z2(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N$(t)})}function Q2(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N$(t)})}function $2(e,t){return new e({type:`number`,checks:[],...N$(t)})}function e4(e,t){return new e({type:`number`,coerce:!0,checks:[],...N$(t)})}function t4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...N$(t)})}function n4(e,t){return new e({type:`boolean`,...N$(t)})}function r4(e){return new e({type:`unknown`})}function i4(e,t){return new e({type:`never`,...N$(t)})}function a4(e,t){return new J1({check:`less_than`,...N$(t),value:e,inclusive:!1})}function o4(e,t){return new J1({check:`less_than`,...N$(t),value:e,inclusive:!0})}function s4(e,t){return new Y1({check:`greater_than`,...N$(t),value:e,inclusive:!1})}function c4(e,t){return new Y1({check:`greater_than`,...N$(t),value:e,inclusive:!0})}function l4(e,t){return new X1({check:`multiple_of`,...N$(t),value:e})}function u4(e,t){return new Q1({check:`max_length`,...N$(t),maximum:e})}function d4(e,t){return new $1({check:`min_length`,...N$(t),minimum:e})}function f4(e,t){return new e0({check:`length_equals`,...N$(t),length:e})}function p4(e,t){return new n0({check:`string_format`,format:`regex`,...N$(t),pattern:e})}function m4(e){return new r0({check:`string_format`,format:`lowercase`,...N$(e)})}function h4(e){return new i0({check:`string_format`,format:`uppercase`,...N$(e)})}function g4(e,t){return new a0({check:`string_format`,format:`includes`,...N$(t),includes:e})}function _4(e,t){return new o0({check:`string_format`,format:`starts_with`,...N$(t),prefix:e})}function v4(e,t){return new s0({check:`string_format`,format:`ends_with`,...N$(t),suffix:e})}function y4(e){return new c0({check:`overwrite`,tx:e})}function b4(e){return y4(t=>t.normalize(e))}function x4(){return y4(e=>e.trim())}function S4(){return y4(e=>e.toLowerCase())}function C4(){return y4(e=>e.toUpperCase())}function w4(){return y4(e=>w$(e))}function T4(e,t,n){return new e({type:`array`,element:t,...N$(n)})}function E4(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...N$(n)})}function D4(e,t){let n=O4(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Y$(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Y$(r))}},e(t.value,t)),t);return n}function O4(e,t){let n=new K1({check:`custom`,...N$(t)});return n._zod.check=e,n}function k4(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??T2,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function A4(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,A4(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&N4(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function j4(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
442
442
|
|
|
443
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function M4(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:F4(t,`input`,e.processors),output:F4(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function N4(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return N4(r.element,n);if(r.type===`set`)return N4(r.valueType,n);if(r.type===`lazy`)return N4(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return N4(r.innerType,n);if(r.type===`intersection`)return N4(r.left,n)||N4(r.right,n);if(r.type===`record`||r.type===`map`)return N4(r.keyType,n)||N4(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:N4(r.in,n)||N4(r.out,n);if(r.type===`object`){for(let e in r.shape)if(N4(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(N4(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(N4(e,n))return!0;return!!(r.rest&&N4(r.rest,n))}return!1}var P4=(e,t={})=>n=>{let r=k4({...n,processors:t});return A4(e,r),j4(r,e),M4(r,e)},F4=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=k4({...i??{},target:a,io:t,processors:n});return A4(e,o),j4(o,e),M4(o,e)},I4={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},L4=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=I4[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},R4=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},z4=(e,t,n,r)=>{n.type=`boolean`},B4=(e,t,n,r)=>{n.not={}},V4=(e,t,n,r)=>{let i=e._zod.def,a=p$(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},H4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},U4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},W4=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=A4(a.element,t,{...r,path:[...r.path,`items`]})},G4=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=A4(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=A4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},K4=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>A4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},q4=(e,t,n,r)=>{let i=e._zod.def,a=A4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=A4(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},J4=(e,t,n,r)=>{let i=e._zod.def,a=A4(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Y4=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},X4=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Z4=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Q4=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},$4=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;A4(o,t,r);let s=t.seen.get(e);s.ref=o},e3=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},t3=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},n3=c$(`ZodISODateTime`,(e,t)=>{T0.init(e,t),k3.init(e,t)});function r3(e){return Y2(n3,e)}var i3=c$(`ZodISODate`,(e,t)=>{E0.init(e,t),k3.init(e,t)});function a3(e){return X2(i3,e)}var o3=c$(`ZodISOTime`,(e,t)=>{D0.init(e,t),k3.init(e,t)});function s3(e){return Z2(o3,e)}var c3=c$(`ZodISODuration`,(e,t)=>{O0.init(e,t),k3.init(e,t)});function l3(e){return Q2(c3,e)}var u3=c$(`ZodError`,(e,t)=>{Z$.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>e1(e,t)},flatten:{value:t=>$$(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,m$,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,m$,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),d3=t1(u3),f3=n1(u3),p3=r1(u3),m3=a1(u3),h3=s1(u3),g3=c1(u3),_3=l1(u3),v3=u1(u3),y3=d1(u3),b3=f1(u3),x3=p1(u3),S3=m1(u3),C3=new WeakMap;function w3(e,t,n){let r=Object.getPrototypeOf(e),i=C3.get(r);if(i||(i=new Set,C3.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var T3=c$(`ZodType`,(e,t)=>(d0.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:F4(e,`input`),output:F4(e,`output`)}}),e.toJSONSchema=P4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>d3(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>p3(e,t,n),e.parseAsync=async(t,n)=>f3(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>m3(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>h3(e,t,n),e.decode=(t,n)=>g3(e,t,n),e.encodeAsync=async(t,n)=>_3(e,t,n),e.decodeAsync=async(t,n)=>v3(e,t,n),e.safeEncode=(t,n)=>y3(e,t,n),e.safeDecode=(t,n)=>b3(e,t,n),e.safeEncodeAsync=async(t,n)=>x3(e,t,n),e.safeDecodeAsync=async(t,n)=>S3(e,t,n),w3(e,`ZodType`,{check(...e){let t=this.def;return this.clone(S$(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return M$(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(R6(e,t))},superRefine(e,t){return this.check(z6(e,t))},overwrite(e){return this.check(y4(e))},optional(){return y6(this)},exactOptional(){return x6(this)},nullable(){return C6(this)},nullish(){return y6(C6(this))},nonoptional(e){return k6(this,e)},array(){return s6(this)},or(e){return d6([this,e])},and(e){return p6(this,e)},transform(e){return N6(this,_6(e))},default(e){return T6(this,e)},prefault(e){return D6(this,e)},catch(e){return j6(this,e)},pipe(e){return N6(this,e)},readonly(){return I6(this)},describe(e){let t=this.clone();return T2.add(t,{description:e}),t},meta(...e){if(e.length===0)return T2.get(this);let t=this.clone();return T2.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return T2.get(e)?.description},configurable:!0}),e)),E3=c$(`_ZodString`,(e,t)=>{f0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>L4(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,w3(e,`_ZodString`,{regex(...e){return this.check(p4(...e))},includes(...e){return this.check(g4(...e))},startsWith(...e){return this.check(_4(...e))},endsWith(...e){return this.check(v4(...e))},min(...e){return this.check(d4(...e))},max(...e){return this.check(u4(...e))},length(...e){return this.check(f4(...e))},nonempty(...e){return this.check(d4(1,...e))},lowercase(e){return this.check(m4(e))},uppercase(e){return this.check(h4(e))},trim(){return this.check(x4())},normalize(...e){return this.check(b4(...e))},toLowerCase(){return this.check(S4())},toUpperCase(){return this.check(C4())},slugify(){return this.check(w4())}})}),D3=c$(`ZodString`,(e,t)=>{f0.init(e,t),E3.init(e,t),e.email=t=>e.check(D2(A3,t)),e.url=t=>e.check(N2(P3,t)),e.jwt=t=>e.check(J2(Y3,t)),e.emoji=t=>e.check(P2(F3,t)),e.guid=t=>e.check(O2(j3,t)),e.uuid=t=>e.check(k2(M3,t)),e.uuidv4=t=>e.check(A2(M3,t)),e.uuidv6=t=>e.check(j2(M3,t)),e.uuidv7=t=>e.check(M2(M3,t)),e.nanoid=t=>e.check(F2(I3,t)),e.guid=t=>e.check(O2(j3,t)),e.cuid=t=>e.check(I2(L3,t)),e.cuid2=t=>e.check(L2(R3,t)),e.ulid=t=>e.check(R2(z3,t)),e.base64=t=>e.check(G2(K3,t)),e.base64url=t=>e.check(K2(q3,t)),e.xid=t=>e.check(z2(B3,t)),e.ksuid=t=>e.check(B2(V3,t)),e.ipv4=t=>e.check(V2(H3,t)),e.ipv6=t=>e.check(H2(U3,t)),e.cidrv4=t=>e.check(U2(W3,t)),e.cidrv6=t=>e.check(W2(G3,t)),e.e164=t=>e.check(q2(J3,t)),e.datetime=t=>e.check(r3(t)),e.date=t=>e.check(a3(t)),e.time=t=>e.check(s3(t)),e.duration=t=>e.check(l3(t))});function O3(e){return E2(D3,e)}var k3=c$(`ZodStringFormat`,(e,t)=>{p0.init(e,t),E3.init(e,t)}),A3=c$(`ZodEmail`,(e,t)=>{g0.init(e,t),k3.init(e,t)}),j3=c$(`ZodGUID`,(e,t)=>{m0.init(e,t),k3.init(e,t)}),M3=c$(`ZodUUID`,(e,t)=>{h0.init(e,t),k3.init(e,t)});function N3(e){return k2(M3,e)}var P3=c$(`ZodURL`,(e,t)=>{_0.init(e,t),k3.init(e,t)}),F3=c$(`ZodEmoji`,(e,t)=>{v0.init(e,t),k3.init(e,t)}),I3=c$(`ZodNanoID`,(e,t)=>{y0.init(e,t),k3.init(e,t)}),L3=c$(`ZodCUID`,(e,t)=>{b0.init(e,t),k3.init(e,t)}),R3=c$(`ZodCUID2`,(e,t)=>{x0.init(e,t),k3.init(e,t)}),z3=c$(`ZodULID`,(e,t)=>{S0.init(e,t),k3.init(e,t)}),B3=c$(`ZodXID`,(e,t)=>{C0.init(e,t),k3.init(e,t)}),V3=c$(`ZodKSUID`,(e,t)=>{w0.init(e,t),k3.init(e,t)}),H3=c$(`ZodIPv4`,(e,t)=>{k0.init(e,t),k3.init(e,t)}),U3=c$(`ZodIPv6`,(e,t)=>{A0.init(e,t),k3.init(e,t)}),W3=c$(`ZodCIDRv4`,(e,t)=>{j0.init(e,t),k3.init(e,t)}),G3=c$(`ZodCIDRv6`,(e,t)=>{M0.init(e,t),k3.init(e,t)}),K3=c$(`ZodBase64`,(e,t)=>{P0.init(e,t),k3.init(e,t)}),q3=c$(`ZodBase64URL`,(e,t)=>{I0.init(e,t),k3.init(e,t)}),J3=c$(`ZodE164`,(e,t)=>{L0.init(e,t),k3.init(e,t)}),Y3=c$(`ZodJWT`,(e,t)=>{z0.init(e,t),k3.init(e,t)}),X3=c$(`ZodNumber`,(e,t)=>{B0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>R4(e,t,n,r),w3(e,`ZodNumber`,{gt(e,t){return this.check(s4(e,t))},gte(e,t){return this.check(c4(e,t))},min(e,t){return this.check(c4(e,t))},lt(e,t){return this.check(a4(e,t))},lte(e,t){return this.check(o4(e,t))},max(e,t){return this.check(o4(e,t))},int(e){return this.check($3(e))},safe(e){return this.check($3(e))},positive(e){return this.check(s4(0,e))},nonnegative(e){return this.check(c4(0,e))},negative(e){return this.check(a4(0,e))},nonpositive(e){return this.check(o4(0,e))},multipleOf(e,t){return this.check(l4(e,t))},step(e,t){return this.check(l4(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Z3(e){return $2(X3,e)}var Q3=c$(`ZodNumberFormat`,(e,t)=>{V0.init(e,t),X3.init(e,t)});function $3(e){return t4(Q3,e)}var e6=c$(`ZodBoolean`,(e,t)=>{H0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z4(e,t,n,r)});function t6(e){return n4(e6,e)}var n6=c$(`ZodUnknown`,(e,t)=>{U0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function r6(){return r4(n6)}var i6=c$(`ZodNever`,(e,t)=>{W0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>B4(e,t,n,r)});function a6(e){return i4(i6,e)}var o6=c$(`ZodArray`,(e,t)=>{K0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W4(e,t,n,r),e.element=t.element,w3(e,`ZodArray`,{min(e,t){return this.check(d4(e,t))},nonempty(e){return this.check(d4(1,e))},max(e,t){return this.check(u4(e,t))},length(e,t){return this.check(f4(e,t))},unwrap(){return this.element}})});function s6(e,t){return T4(o6,e,t)}var c6=c$(`ZodObject`,(e,t)=>{Z0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G4(e,t,n,r),b$(e,`shape`,()=>t.shape),w3(e,`ZodObject`,{keyof(){return h6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:r6()})},loose(){return this.clone({...this._zod.def,catchall:r6()})},strict(){return this.clone({...this._zod.def,catchall:a6()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return R$(this,e)},safeExtend(e){return z$(this,e)},merge(e){return B$(this,e)},pick(e){return I$(this,e)},omit(e){return L$(this,e)},partial(...e){return V$(v6,this,e[0])},required(...e){return H$(O6,this,e[0])}})});function l6(e,t){return new c6({type:`object`,shape:e??{},...N$(t)})}var u6=c$(`ZodUnion`,(e,t)=>{$0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K4(e,t,n,r),e.options=t.options});function d6(e,t){return new u6({type:`union`,options:e,...N$(t)})}var f6=c$(`ZodIntersection`,(e,t)=>{e2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q4(e,t,n,r)});function p6(e,t){return new f6({type:`intersection`,left:e,right:t})}var m6=c$(`ZodEnum`,(e,t)=>{r2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V4(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new m6({...t,checks:[],...N$(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new m6({...t,checks:[],...N$(r),entries:i})}});function h6(e,t){return new m6({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N$(t)})}var g6=c$(`ZodTransform`,(e,t)=>{i2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>U4(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new u$(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Y$(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Y$(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function _6(e){return new g6({type:`transform`,transform:e})}var v6=c$(`ZodOptional`,(e,t)=>{o2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function y6(e){return new v6({type:`optional`,innerType:e})}var b6=c$(`ZodExactOptional`,(e,t)=>{s2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function x6(e){return new b6({type:`optional`,innerType:e})}var S6=c$(`ZodNullable`,(e,t)=>{c2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function C6(e){return new S6({type:`nullable`,innerType:e})}var w6=c$(`ZodDefault`,(e,t)=>{l2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function T6(e,t){return new w6({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():k$(t)}})}var E6=c$(`ZodPrefault`,(e,t)=>{d2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Z4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function D6(e,t){return new E6({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():k$(t)}})}var O6=c$(`ZodNonOptional`,(e,t)=>{f2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function k6(e,t){return new O6({type:`nonoptional`,innerType:e,...N$(t)})}var A6=c$(`ZodCatch`,(e,t)=>{m2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Q4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function j6(e,t){return new A6({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var M6=c$(`ZodPipe`,(e,t)=>{h2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$4(e,t,n,r),e.in=t.in,e.out=t.out});function N6(e,t){return new M6({type:`pipe`,in:e,out:t})}var P6=c$(`ZodPreprocess`,(e,t)=>{M6.init(e,t),_2.init(e,t)}),F6=c$(`ZodReadonly`,(e,t)=>{v2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function I6(e){return new F6({type:`readonly`,innerType:e})}var L6=c$(`ZodCustom`,(e,t)=>{b2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H4(e,t,n,r)});function R6(e,t={}){return E4(L6,e,t)}function z6(e,t){return D4(e,t)}function B6(e,t){return new P6({type:`pipe`,in:_6(e),out:t})}function V6(e){return e4(X3,e)}var H6=O3().regex(/^\d{4}-\d{2}-\d{2}$/,`Expected a YYYY-MM-DD date`),U6=e=>O3().trim().max(e).nullish().transform(e=>e==null||e===``?null:e),W6=h6(GQ),G6=h6(XQ),K6=h6($Q),q6=h6(e$);h6(QQ);var J6=s6(O3().trim().min(1).max(60)).max(30);l6({companyName:O3().trim().min(1,`Company is required`).max(200),jobTitle:O3().trim().min(1,`Job title is required`).max(200),appliedOn:H6,status:W6.default(`applied`),jobUrl:U6(2e3),location:U6(200),workMode:G6.default(`unspecified`),sourceName:U6(120),salaryMin:Z3().int().nonnegative().nullish().transform(e=>e??null),salaryMax:Z3().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:U6(8),followUpOn:H6.nullish().transform(e=>e??null),tags:J6.default([]),notes:U6(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),l6({companyName:O3().trim().min(1).max(200).optional(),jobTitle:O3().trim().min(1).max(200).optional(),appliedOn:H6.optional(),status:W6.optional(),statusComment:O3().trim().max(2e3).nullish(),jobUrl:U6(2e3).optional(),location:U6(200).optional(),workMode:G6.optional(),sourceName:U6(120).optional(),salaryMin:Z3().int().nonnegative().nullish(),salaryMax:Z3().int().nonnegative().nullish(),salaryCurrency:U6(8).optional(),followUpOn:H6.nullish(),archived:t6().optional(),tags:J6.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),l6({status:W6,occurredOn:H6.optional(),comment:O3().trim().max(2e3).nullish().transform(e=>e??null)});var Y6=e=>B6(e=>{if(e==null)return;let t=(Array.isArray(e)?e.map(String):String(e).split(`,`)).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},s6(e).optional()),X6=l6({q:O3().trim().max(300).optional(),year:V6().int().min(1970).max(2200).optional(),month:V6().int().min(1).max(12).optional(),status:Y6(W6),workMode:Y6(G6),tags:Y6(O3()),companyId:N3().optional(),source:O3().trim().max(120).optional(),from:H6.optional(),to:H6.optional(),archived:h6([`true`,`false`,`all`]).default(`false`).transform(e=>e===`all`?`all`:e===`true`),followUpDue:h6([`true`,`false`]).optional().transform(e=>e===`true`),sort:h6([`appliedOn`,`company`,`jobTitle`,`status`,`createdAt`]).default(`appliedOn`),direction:h6([`asc`,`desc`]).default(`desc`),limit:V6().int().min(1).max(200).default(50),cursor:O3().optional()});l6({company:O3().trim().min(1).max(200),title:O3().trim().max(200).optional().default(``),excludeId:N3().optional()}),l6({q:O3().trim().min(1).max(300),limit:V6().int().min(1).max(100).default(25),types:Y6(h6([`application`,`company`,`note`]))}),X6.extend({format:h6([`csv`,`xlsx`]).default(`csv`)}),l6({name:O3().trim().min(1).max(200),website:U6(2e3),location:U6(200),tags:J6.default([])}),l6({name:O3().trim().min(1).max(200).optional(),website:U6(2e3).optional(),location:U6(200).optional(),archived:t6().optional(),tags:J6.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),l6({title:O3().trim().min(1).max(200),body:O3().max(5e4).default(``),targetType:K6.default(`standalone`),targetId:N3().nullish().transform(e=>e??null),pinned:t6().default(!1)}),l6({title:O3().trim().min(1).max(200).optional(),body:O3().max(5e4).optional(),targetType:K6.optional(),targetId:N3().nullish(),pinned:t6().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),l6({name:O3().trim().min(1).max(60),color:U6(30),scope:q6.default(`both`)}),l6({companyName:O3().trim().min(1,`Company is required`).max(200),jobTitle:O3().trim().min(1,`Job title is required`).max(200),jobUrl:U6(2e3),location:U6(200),workMode:G6.default(`unspecified`),sourceName:U6(120),salaryMin:Z3().int().nonnegative().nullish().transform(e=>e??null),salaryMax:Z3().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:U6(8),notes:U6(2e4),savedOn:H6.optional()}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),l6({companyName:O3().trim().min(1).max(200).optional(),jobTitle:O3().trim().min(1).max(200).optional(),jobUrl:U6(2e3).optional(),location:U6(200).optional(),workMode:G6.optional(),sourceName:U6(120).optional(),salaryMin:Z3().int().nonnegative().nullish(),salaryMax:Z3().int().nonnegative().nullish(),salaryCurrency:U6(8).optional(),notes:U6(2e4).optional(),savedOn:H6.optional(),archived:t6().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),l6({appliedOn:H6.optional(),status:W6.optional(),tags:J6.optional()}),l6({target:O3().min(1)});function Z6(e){return e===`exact`}var Q6=class extends Error{status;code;details;constructor(e,t,n,r){super(n),this.name=`ApiError`,this.status=e,this.code=t,this.details=r}get fieldErrors(){return Array.isArray(this.details)?this.details:[]}};async function $6(e,t){let n=await fetch(e,{...t,headers:{...t?.body?{"Content-Type":`application/json`}:{},...t?.headers}});if(n.status===204)return;let r=await n.text(),i=r?JSON.parse(r):null;if(!n.ok)throw new Q6(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}function e8(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!=null&&r!==``){if(Array.isArray(r)){if(r.length===0)continue;t.set(n,r.join(`,`))}else t.set(n,String(r))}let n=t.toString();return n?`?${n}`:``}var t8={csv:`text/csv`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};async function n8(e,t,n){let r=await fetch(`/api/import${e8({format:t,mode:n})}`,{method:`POST`,headers:{"Content-Type":t8[t]},body:e}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok)throw new Q6(r.status,a?.error??`unknown`,a?.message??r.statusText,a?.details);return a}async function r8(e,t){let n=await fetch(`/api/backup/import${e8({mode:t})}`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e}),r=await n.text(),i=r?JSON.parse(r):null;if(!n.ok)throw new Q6(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}var i8={listApplications:e=>$6(`/api/applications${e8(e)}`),getApplication:e=>$6(`/api/applications/${e}`),periods:()=>$6(`/api/applications/periods`),checkDuplicates:e=>$6(`/api/applications/check${e8(e)}`),createApplication:e=>$6(`/api/applications`,{method:`POST`,body:JSON.stringify(e)}),updateApplication:(e,t)=>$6(`/api/applications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),changeStatus:(e,t)=>$6(`/api/applications/${e}/status`,{method:`POST`,body:JSON.stringify(t)}),deleteApplication:e=>$6(`/api/applications/${e}`,{method:`DELETE`}),listCompanies:(e={})=>$6(`/api/companies${e8(e)}`),suggestCompanies:e=>$6(`/api/companies/suggest${e8({q:e})}`),getCompany:e=>$6(`/api/companies/${e}`),updateCompany:(e,t)=>$6(`/api/companies/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),listTags:()=>$6(`/api/tags`),listNotes:(e={})=>$6(`/api/notes${e8(e)}`),createNote:e=>$6(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>$6(`/api/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNote:e=>$6(`/api/notes/${e}`,{method:`DELETE`}),dashboard:()=>$6(`/api/dashboard`),search:(e,t)=>$6(`/api/search${e8({q:e,types:t,limit:25})}`),exportUrl:(e,t)=>`/api/export${e8({...e,format:t})}`,previewImport:(e,t)=>n8(e,t,`preview`),commitImport:(e,t)=>n8(e,t,`commit`),listOpenings:(e={})=>$6(`/api/openings${e8(e)}`),getOpening:e=>$6(`/api/openings/${e}`),createOpening:e=>$6(`/api/openings`,{method:`POST`,body:JSON.stringify(e)}),updateOpening:(e,t)=>$6(`/api/openings/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteOpening:e=>$6(`/api/openings/${e}`,{method:`DELETE`}),convertOpening:(e,t)=>$6(`/api/openings/${e}/convert`,{method:`POST`,body:JSON.stringify(t)}),getDbTargets:()=>$6(`/api/db/targets`),switchDb:e=>$6(`/api/db/switch`,{method:`POST`,body:JSON.stringify({target:e})}),backupExportUrl:`/api/backup/export`,previewBackup:e=>r8(e,`preview`),commitBackup:e=>r8(e,`commit`),getDataStatus:()=>$6(`/api/backup/status`),clearDatabase:()=>$6(`/api/backup/clear`,{method:`POST`}),seedDatabase:()=>$6(`/api/backup/seed`,{method:`POST`}),getMeta:()=>$6(`/api/meta`)},a8=class extends Error{name=`RepoError`;cause;constructor(e,t){super(e),t?.cause!==void 0&&(this.cause=t.cause)}},o8=class extends a8{name=`SchemaError`},s8=new Set([`string`,`number`,`integer`,`boolean`,`date`,`json`]);function c8(e){let t=Object.keys(e);if(t.length===0)throw new o8(`A schema must define at least one field`);let n={},r={},i={},a;for(let o of t){let t=e[o];if(!s8.has(t.type))throw new o8(`Field "${o}" has unknown type ${JSON.stringify(t.type)}. Expected one of: ${[...s8].join(`, `)}`);let s=t.column??o;if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(s))throw new o8(`Field "${o}" maps to column ${JSON.stringify(s)}, which is not a plain identifier. Column names must match /^[A-Za-z_][A-Za-z0-9_]*$/ because repolayer never quotes-and-interpolates arbitrary text into SQL.`);if(s in r)throw new o8(`Fields "${r[s]}" and "${o}" both map to column "${s}"`);if(t.primaryKey){if(a!==void 0)throw new o8(`Schema declares two primary keys ("${a}" and "${o}"). repolayer supports single-column primary keys only.`);if(t.nullable)throw new o8(`Primary key "${o}" cannot be nullable`);a=o}n[o]=s,r[s]=o,i[o]=t.type}if(a===void 0)throw new o8("Schema has no primary key. Mark exactly one field with `primaryKey: true`.");return Object.freeze({fields:e,primaryKey:a,columns:Object.freeze(n),fieldsByColumn:Object.freeze(r),fieldNames:Object.freeze(t),types:Object.freeze(i)})}var l8={createdAt:{type:`date`,column:`created_at`},updatedAt:{type:`date`,column:`updated_at`}};c8({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},website:{type:`string`,nullable:!0},location:{type:`string`,nullable:!0},archived:{type:`boolean`},...l8}),c8({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},titleKey:{type:`string`,column:`title_key`},appliedOn:{type:`date`,column:`applied_on`},periodYear:{type:`integer`,column:`period_year`},periodMonth:{type:`integer`,column:`period_month`},status:{type:`string`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},followUpOn:{type:`date`,nullable:!0,column:`follow_up_on`},archived:{type:`boolean`},...l8}),c8({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},color:{type:`string`,nullable:!0},scope:{type:`string`},...l8}),c8({id:{type:`string`,primaryKey:!0},tagId:{type:`string`,column:`tag_id`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},...l8}),c8({id:{type:`string`,primaryKey:!0},title:{type:`string`},body:{type:`string`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,nullable:!0,column:`target_id`},pinned:{type:`boolean`},...l8}),c8({id:{type:`string`,primaryKey:!0},applicationId:{type:`string`,column:`application_id`},fromStatus:{type:`string`,nullable:!0,column:`from_status`},toStatus:{type:`string`,column:`to_status`},occurredOn:{type:`date`,column:`occurred_on`},commentText:{type:`string`,nullable:!0,column:`comment_text`},...l8}),c8({id:{type:`string`,primaryKey:!0},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},model:{type:`string`},dim:{type:`integer`},embedding:{type:`json`},textHash:{type:`string`,column:`text_hash`},...l8}),c8({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},notes:{type:`string`,nullable:!0},savedOn:{type:`date`,column:`saved_on`},archived:{type:`boolean`},convertedApplicationId:{type:`string`,nullable:!0,column:`converted_application_id`},...l8}),[{header:`Position`,value:e=>e.jobTitle,width:34},{header:`Company`,value:e=>e.company.name,width:28},{header:`Date`,value:e=>e.appliedOn,width:13},{header:`Status`,value:e=>YQ[e.status],width:13},{header:`Notes`,value:e=>e.notesText,width:70,wrap:!0}].map(e=>e.header),new Map(Object.entries(YQ).map(([e,t])=>[t.toLowerCase(),e]));var u8=i8,d8={applications:e=>[`applications`,e],application:e=>[`application`,e],periods:()=>[`periods`],companies:e=>[`companies`,e],company:e=>[`company`,e],companySuggest:e=>[`company-suggest`,e],tags:()=>[`tags`],notes:e=>[`notes`,e],dashboard:()=>[`dashboard`],duplicates:e=>[`duplicates`,e],search:e=>[`search`,e],openings:e=>[`openings`,e],opening:e=>[`opening`,e],dbTargets:()=>[`db-targets`],dataStatus:()=>[`data-status`],meta:()=>[`meta`]};function f8(e){e.invalidateQueries({queryKey:[`applications`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`periods`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`companies`]}),e.invalidateQueries({queryKey:[`company`]}),e.invalidateQueries({queryKey:[`tags`]}),e.invalidateQueries({queryKey:[`duplicates`]}),e.invalidateQueries({queryKey:[`search`]})}function p8(e){return qr({queryKey:d8.applications(e),queryFn:()=>u8.listApplications(e),placeholderData:e=>e})}function m8(e){return qr({queryKey:d8.application(e??``),queryFn:()=>u8.getApplication(e),enabled:!!e})}function h8(){return qr({queryKey:d8.periods(),queryFn:()=>u8.periods()})}function g8(){return qr({queryKey:d8.dashboard(),queryFn:()=>u8.dashboard()})}function _8(){return qr({queryKey:d8.tags(),queryFn:()=>u8.listTags()})}function v8(e={}){return qr({queryKey:d8.companies(e),queryFn:()=>u8.listCompanies(e)})}function y8(e){return qr({queryKey:d8.company(e??``),queryFn:()=>u8.getCompany(e),enabled:!!e})}function b8(e={}){return qr({queryKey:d8.notes(e),queryFn:()=>u8.listNotes(e)})}function x8(e){let{enabled:t=!0,...n}=e;return qr({queryKey:d8.duplicates(n),queryFn:()=>u8.checkDuplicates(n),enabled:t&&n.company.trim().length>1,staleTime:5e3})}function S8(e){return qr({queryKey:d8.companySuggest(e),queryFn:()=>u8.suggestCompanies(e),enabled:e.trim().length>0,staleTime:3e4})}function C8(){let e=Tn();return Jr({mutationFn:e=>u8.createApplication(e),onSuccess:()=>f8(e)})}function w8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.updateApplication(e,t),onSuccess:()=>f8(e)})}function T8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.changeStatus(e,t),onSuccess:()=>f8(e)})}function E8(){let e=Tn();return Jr({mutationFn:e=>u8.deleteApplication(e),onSuccess:()=>f8(e)})}function D8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.updateCompany(e,t),onSuccess:()=>f8(e)})}function O8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>e?u8.updateNote(e,t):u8.createNote(t),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`search`]})}})}function k8(){let e=Tn();return Jr({mutationFn:e=>u8.deleteNote(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]})}})}function A8(e={}){return qr({queryKey:d8.openings(e),queryFn:()=>u8.listOpenings(e)})}function j8(e){e.invalidateQueries({queryKey:[`openings`]}),e.invalidateQueries({queryKey:[`opening`]})}function M8(){let e=Tn();return Jr({mutationFn:e=>u8.createOpening(e),onSuccess:()=>j8(e)})}function N8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.updateOpening(e,t),onSuccess:()=>j8(e)})}function P8(){let e=Tn();return Jr({mutationFn:e=>u8.deleteOpening(e),onSuccess:()=>j8(e)})}function F8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.convertOpening(e,t),onSuccess:()=>{j8(e),e.invalidateQueries({queryKey:[`applications`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`periods`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`companies`]}),e.invalidateQueries({queryKey:[`search`]})}})}function I8(){return qr({queryKey:d8.dbTargets(),queryFn:()=>u8.getDbTargets()})}function L8(){return Jr({mutationFn:e=>u8.switchDb(e)})}function R8(){return qr({queryKey:d8.dataStatus(),queryFn:()=>u8.getDataStatus()})}function z8(){let e=Tn();return Jr({mutationFn:()=>u8.clearDatabase(),onSuccess:()=>void e.invalidateQueries()})}function B8(){let e=Tn();return Jr({mutationFn:()=>u8.seedDatabase(),onSuccess:()=>void e.invalidateQueries()})}function V8(){return qr({queryKey:d8.meta(),queryFn:()=>u8.getMeta(),staleTime:1/0})}function H8({status:e}){return(0,Z.jsx)(OY,{color:JQ[e],children:YQ[e]})}function U8(e,t=300){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var W8={exact:`error`,similar:`warning`,company:`info`,none:`success`};function G8({check:e,loading:t}){if(t&&!e)return(0,Z.jsx)(jp,{type:`info`,showIcon:!0,message:`Checking your history…`,style:{marginBottom:16}});if(!e)return null;if(e.verdict===`none`)return(0,Z.jsx)(jp,{type:`success`,showIcon:!0,message:`No history with this company`,description:`This looks like a company you haven't applied to before.`,style:{marginBottom:16}});let n=e.company?.name??`this company`;return(0,Z.jsx)(jp,{type:W8[e.verdict],showIcon:!0,style:{marginBottom:16},message:K8(e.verdict,n,e.priorCount),description:(0,Z.jsxs)(Pz,{direction:`vertical`,size:6,style:{width:`100%`},children:[e.matches.length>0?e.matches.slice(0,5).map(e=>(0,Z.jsx)(q8,{match:e},e.id)):(0,Z.jsx)(YX.Text,{type:`secondary`,children:`None of them were for this role, but it is worth a look before you apply again.`}),!e.semanticUsed&&e.matches.length>0&&(0,Z.jsx)(YX.Text,{type:`secondary`,style:{fontSize:12},children:`Matched on wording only — semantic matching is still warming up.`})]})})}function K8(e,t,n){let r=n===1?`once`:`${n} times`;switch(e){case`exact`:return`You have already applied for this exact role at ${t}`;case`similar`:return`You have applied for a very similar role at ${t}`;default:return`You have applied to ${t} ${r} before`}}function q8({match:e}){let t=Math.round(Math.max(e.titleSimilarity,e.semanticSimilarity??0)*100);return(0,Z.jsxs)(Pz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:e.appliedOn}),(0,Z.jsx)(OY,{color:JQ[e.status],children:YQ[e.status]}),e.matchKind===`exact`?(0,Z.jsx)(OY,{color:`red`,children:`exact title`}):(0,Z.jsxs)(OY,{children:[t,`% similar`]})]})}function J8({onStartApplication:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(``),a=U8(t,350),{data:o,isFetching:s}=x8({company:a,title:U8(r,350)}),c=a.trim().length>1;return(0,Z.jsx)(bF,{title:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(kQ,{}),(0,Z.jsx)(`span`,{children:`Check before you apply`})]}),extra:e&&(0,Z.jsx)(Vk,{type:`link`,onClick:e,children:`New application`}),children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(BU,{gutter:12,children:[(0,Z.jsx)(II,{xs:24,sm:12,children:(0,Z.jsx)(_V,{placeholder:`Company`,value:t,onChange:e=>n(e.target.value),allowClear:!0})}),(0,Z.jsx)(II,{xs:24,sm:12,children:(0,Z.jsx)(_V,{placeholder:`Job title (optional)`,value:r,onChange:e=>i(e.target.value),allowClear:!0})})]}),c?(0,Z.jsx)(G8,{check:o,loading:s}):(0,Z.jsx)(YX.Text,{type:`secondary`,children:`Type a company name to see whether you have been here before.`})]})})}function Y8({open:e,onClose:t,application:n}){let[r]=WB.useForm(),{message:i,modal:a}=NC.useApp(),o=!!n,s=C8(),c=w8(),{data:l}=_8(),u=WB.useWatch(`companyName`,r)??``,d=WB.useWatch(`jobTitle`,r)??``,f=U8(u,300),p=U8(d,300),{data:m}=S8(f),{data:h,isFetching:g}=x8({company:f,title:p,...n?{excludeId:n.id}:{},enabled:e});(0,_.useEffect)(()=>{e&&(n?r.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,appliedOn:(0,Yk.default)(n.appliedOn),status:n.status,jobUrl:n.jobUrl??void 0,location:n.location??void 0,workMode:n.workMode,sourceName:n.sourceName??void 0,salaryMin:n.salaryMin,salaryMax:n.salaryMax,salaryCurrency:n.salaryCurrency??void 0,followUpOn:n.followUpOn?(0,Yk.default)(n.followUpOn):null,tags:n.tags.map(e=>e.name)}):(r.resetFields(),r.setFieldsValue({appliedOn:(0,Yk.default)(),status:`applied`,workMode:`unspecified`,tags:[]})))},[e,n,r]);let v=(0,_.useMemo)(()=>(m?.companies??[]).map(e=>({value:e.name,label:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(`span`,{children:e.name}),e.applicationCount>0&&(0,Z.jsxs)(YX.Text,{type:`secondary`,style:{fontSize:12},children:[e.applicationCount,` application`,e.applicationCount===1?``:`s`]})]})})),[m]),y=(0,_.useMemo)(()=>(l?.tags??[]).map(e=>({value:e.name,label:e.name})),[l]),[b,x]=(0,_.useState)(!1);async function S(e){if(h&&Z6(h.verdict)&&!o&&!await new Promise(e=>{a.confirm({title:`You have applied for this exact role before`,content:(0,Z.jsxs)(Pz,{direction:`vertical`,children:[(0,Z.jsxs)(YX.Text,{children:[h.matches[0]?.jobTitle,` at `,h.company?.name,` on`,` `,h.matches[0]?.appliedOn,`.`]}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:`Save this as a new application anyway?`})]}),okText:`Save anyway`,cancelText:`Go back`,onOk:()=>e(!0),onCancel:()=>e(!1)})}))return;let l={companyName:e.companyName,jobTitle:e.jobTitle,appliedOn:e.appliedOn.format(`YYYY-MM-DD`),status:e.status,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,followUpOn:e.followUpOn?e.followUpOn.format(`YYYY-MM-DD`):null,tags:e.tags??[],...o?{}:{notes:e.notes??null}};x(!0);try{n?(await c.mutateAsync({id:n.id,body:l}),i.success(`Application updated`)):(await s.mutateAsync(l),i.success(`Application saved`)),t()}catch(e){e instanceof Q6&&e.fieldErrors.length>0?(r.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),i.error(`Please check the highlighted fields`)):i.error(e instanceof Error?e.message:`Could not save`)}finally{x(!1)}}return(0,Z.jsxs)(Tz,{title:o?`Edit application`:`New application`,open:e,onClose:t,width:640,destroyOnHidden:!0,extra:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Vk,{type:`primary`,loading:b,onClick:()=>r.submit(),children:o?`Save changes`:`Save application`})]}),children:[(0,Z.jsx)(G8,{check:h,loading:g}),(0,Z.jsxs)(WB,{form:r,layout:`vertical`,onFinish:S,requiredMark:`optional`,children:[(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:12,children:(0,Z.jsx)(WB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(NE,{options:v,placeholder:`Start typing — existing companies appear`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(II,{span:12,children:(0,Z.jsx)(WB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(_V,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(HR,{style:{width:`100%`},format:`YYYY-MM-DD`})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(EE,{options:GQ.map(e=>({value:e,label:YQ[e]}))})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`followUpOn`,label:`Follow up on`,children:(0,Z.jsx)(HR,{style:{width:`100%`},format:`YYYY-MM-DD`,allowClear:!0})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(EE,{options:XQ.map(e=>({value:e,label:ZQ[e]}))})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(_V,{placeholder:`Stockholm`})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(_V,{placeholder:`LinkedIn, referral…`})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(LL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(LL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(_V,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(WB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(_V,{placeholder:`https://…`})}),(0,Z.jsx)(WB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(EE,{mode:`tags`,options:y,placeholder:`fintech, remote-ok, dream-job…`,tokenSeparators:[`,`]})}),!o&&(0,Z.jsx)(WB.Item,{name:`notes`,label:`Notes`,help:`Saved as a note linked to this application. Searchable.`,children:(0,Z.jsx)(_V.TextArea,{rows:4,placeholder:`Anything worth remembering…`})})]})]})}var X8={dark:{bgBase:`#0d1117`,bgRaised:`#161b22`,bgSunken:`#010409`,border:`#30363d`,borderStrong:`#444c56`,textPrimary:`#e6edf3`,textMuted:`#8b949e`,textFaint:`#6e7681`,accent:`#58a6ff`,success:`#3fb950`,danger:`#f85149`,warning:`#d29922`},light:{bgBase:`#ffffff`,bgRaised:`#ffffff`,bgSunken:`#f6f8fa`,border:`#d0d7de`,borderStrong:`#afb8c1`,textPrimary:`#1f2328`,textMuted:`#656d76`,textFaint:`#8c959f`,accent:`#0969da`,success:`#1a7f37`,danger:`#d1242f`,warning:`#9a6700`}},Z8={bgBase:`var(--jt-bg-base)`,bgRaised:`var(--jt-bg-raised)`,bgSunken:`var(--jt-bg-sunken)`,border:`var(--jt-border)`,borderStrong:`var(--jt-border-strong)`,textPrimary:`var(--jt-text-primary)`,textMuted:`var(--jt-text-muted)`,textFaint:`var(--jt-text-faint)`,accent:`var(--jt-accent)`,success:`var(--jt-success)`,danger:`var(--jt-danger)`,warning:`var(--jt-warning)`};function Q8(e){let t=X8[e];return{algorithm:e===`dark`?RY.darkAlgorithm:RY.defaultAlgorithm,token:{colorBgBase:t.bgBase,colorBgContainer:t.bgRaised,colorBgElevated:t.bgRaised,colorBgLayout:t.bgBase,colorBorder:t.border,colorBorderSecondary:t.border,colorText:t.textPrimary,colorTextSecondary:t.textMuted,colorTextTertiary:t.textFaint,colorPrimary:t.accent,colorLink:t.accent,colorSuccess:t.success,colorError:t.danger,colorWarning:t.warning,borderRadius:8,fontSize:14},components:{Layout:{siderBg:t.bgSunken,headerBg:t.bgSunken,bodyBg:t.bgBase}}}}function $8(){let{data:e,isLoading:t}=g8(),[n,r]=(0,_.useState)(!1),i=r$(i$());if(t||!e)return(0,Z.jsx)(CS,{active:!0,paragraph:{rows:8}});let{stats:a,followUps:o,recentActivity:s}=e;return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`Total applications`,value:a.total})})}),(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`Still active`,value:a.active,valueStyle:{color:Z8.accent}})})}),(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`${o$(i.month)} ${i.year}`,value:a.thisMonth,suffix:a.thisMonth===1?`application`:`applications`})})}),(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)(YX.Text,{type:`secondary`,children:`Response rate`}),(0,Z.jsx)(bU,{percent:Math.round(a.responseRate*100),size:`small`,strokeColor:Z8.accent}),(0,Z.jsx)(YX.Text,{type:`secondary`,style:{fontSize:12},children:`Anything past “applied” counts as a reply`})]})})})]}),(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:24,lg:14,children:(0,Z.jsx)(J8,{onStartApplication:()=>r(!0)})}),(0,Z.jsx)(II,{xs:24,lg:10,children:(0,Z.jsx)(bF,{title:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(LR,{}),(0,Z.jsx)(`span`,{children:`Needs a follow-up`})]}),styles:{body:{maxHeight:320,overflowY:`auto`}},children:o.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`Nothing due — all caught up`}):(0,Z.jsx)(NH,{size:`small`,dataSource:o,renderItem:e=>(0,Z.jsxs)(NH.Item,{children:[(0,Z.jsx)(NH.Item.Meta,{title:(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(Xz,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)(YX.Text,{type:`danger`,children:[`due `,e.followUpOn]})]})}),(0,Z.jsx)(H8,{status:e.status})]})})})})]}),(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:24,lg:12,children:(0,Z.jsx)(bF,{title:`Pipeline`,children:(0,Z.jsx)(Pz,{direction:`vertical`,size:10,style:{width:`100%`},children:Object.entries(a.byStatus).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,Z.jsxs)(Xz,{align:`center`,gap:12,children:[(0,Z.jsx)(`div`,{style:{width:100},children:(0,Z.jsx)(H8,{status:e})}),(0,Z.jsx)(bU,{percent:a.total>0?Math.round(t/a.total*100):0,format:()=>t,size:`small`,style:{flex:1,marginBottom:0}})]},e))})})}),(0,Z.jsx)(II,{xs:24,lg:12,children:(0,Z.jsx)(bF,{title:`Recent activity`,styles:{body:{maxHeight:360,overflowY:`auto`}},children:s.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No status changes yet`}):(0,Z.jsx)(KY,{items:s.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsxs)(YX.Text,{children:[(0,Z.jsx)(dn,{to:`/applications/${e.applicationId}`,children:e.jobTitle}),` at `,e.companyName]}),(0,Z.jsxs)(YX.Text,{type:`secondary`,style:{fontSize:12},children:[e.fromStatus?`${YQ[e.fromStatus]} → ${YQ[e.toStatus]}`:`Applied (${YQ[e.toStatus]})`,` `,`· `,e.occurredOn]})]})}))})})})]}),(0,Z.jsx)(Y8,{open:n,onClose:()=>r(!1)})]})}function e5({periods:e,year:t,month:n,onSelect:r}){let i=(0,_.useMemo)(()=>e.map(e=>({key:`y:${e.year}`,title:(0,Z.jsx)(t5,{label:String(e.year),count:e.count,strong:!0}),children:(e.months??[]).map(e=>({key:`m:${e.year}:${e.month}`,title:(0,Z.jsx)(t5,{label:o$(e.month),count:e.count})}))})),[e]),a=(0,_.useMemo)(()=>t&&n?[`m:${t}:${n}`]:t?[`y:${t}`]:[],[t,n]),o=(0,_.useMemo)(()=>{let n=e[0],r=n?[`y:${n.year}`]:[];return t&&!r.includes(`y:${t}`)&&r.push(`y:${t}`),r},[e,t]);return e.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No applications yet`}):(0,Z.jsx)(rJ,{treeData:i,selectedKeys:a,defaultExpandedKeys:o,blockNode:!0,onSelect:e=>{let t=String(e[0]??``);if(t.startsWith(`m:`)){let[,e,n]=t.split(`:`);r({year:Number(e),month:Number(n)})}else t.startsWith(`y:`)?r({year:Number(t.slice(2))}):r({})}})}function t5({label:e,count:t,strong:n}){return(0,Z.jsxs)(`span`,{style:{display:`flex`,justifyContent:`space-between`,gap:12},children:[(0,Z.jsx)(YX.Text,{strong:n,children:e}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:t})]})}var n5={new:`green`,duplicate:`default`,error:`red`},r5={new:`New`,duplicate:`Duplicate — skipped`,error:`Error`};function i5({open:e,onClose:t}){let n=Tn(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`csv`),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null);function h(){i(null),c(null),u(null),m(null)}function g(){h(),t()}let v=e=>{let t=e.name.toLowerCase().endsWith(`.xlsx`)?`xlsx`:`csv`;return i(e),o(t),m(null),f(!0),u8.previewImport(e,t).then(c).catch(e=>m(e instanceof Error?e.message:`Could not read that file`)).finally(()=>f(!1)),!1};async function y(){if(r){f(!0),m(null);try{let e=await u8.commitImport(r,a);if(u(e),e.created>0)for(let e of[`applications`,`application`,`periods`,`dashboard`,`companies`,`company`,`search`])n.invalidateQueries({queryKey:[e]})}catch(e){m(e instanceof Error?e.message:`Import failed`)}finally{f(!1)}}}return(0,Z.jsx)(LH,{title:`Import applications`,open:e,onCancel:g,width:800,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(YX.Paragraph,{type:`secondary`,children:`CSV or .xlsx with the same columns Export produces: Position, Company, Date, Status, Notes. Rows that exactly match an application you have already logged are skipped automatically.`}),(0,Z.jsxs)(VZ.Dragger,{accept:`.csv,.xlsx`,maxCount:1,showUploadList:!1,beforeUpload:v,disabled:d,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(cQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a CSV or Excel file here`})]})]}),p&&(0,Z.jsx)(jp,{type:`error`,showIcon:!0,message:p}),s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Pz,{wrap:!0,children:[(0,Z.jsxs)(OY,{color:`green`,children:[s.totals.new,` new`]}),(0,Z.jsxs)(OY,{children:[s.totals.duplicate,` duplicate — will be skipped`]}),s.totals.error>0&&(0,Z.jsxs)(OY,{color:`red`,children:[s.totals.error,` error`]})]}),s.fileErrors.map(e=>(0,Z.jsx)(jp,{type:`warning`,showIcon:!0,message:e},e)),(0,Z.jsx)(hY,{size:`small`,rowKey:`rowNumber`,columns:[{title:`Row`,dataIndex:`rowNumber`,width:60},{title:`Position`,dataIndex:`jobTitle`,ellipsis:!0},{title:`Company`,dataIndex:`companyName`,ellipsis:!0},{title:`Date`,dataIndex:`appliedOn`,width:110},{title:`Status`,dataIndex:`status`,width:110,render:e=>e?YQ[e]:`—`},{title:`Result`,dataIndex:`verdict`,width:200,render:(e,t)=>(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(OY,{color:n5[e],children:r5[e]}),t.errors.length>0&&(0,Z.jsx)(YX.Text,{type:`danger`,style:{fontSize:12},children:t.errors.join(`; `)})]})}],dataSource:s.rows,pagination:{pageSize:10},scroll:{y:320}}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:h,children:`Choose a different file`}),(0,Z.jsxs)(Vk,{type:`primary`,loading:d,disabled:s.totals.new===0,onClick:y,children:[`Import `,s.totals.new,` application`,s.totals.new===1?``:`s`]})]})]}),l&&(0,Z.jsx)(zU,{status:l.failed>0?`warning`:`success`,title:`Imported ${l.created} application${l.created===1?``:`s`}`,subTitle:`${l.skipped} duplicate row${l.skipped===1?``:`s`} skipped`+(l.failed>0?`, ${l.failed} row${l.failed===1?``:`s`} failed`:``),extra:(0,Z.jsx)(Vk,{type:`primary`,onClick:g,children:`Done`})})]})})}function a5(){let e=Xe(),[t,n]=_n(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=(0,_.useMemo)(()=>{let e={};for(let n of[`q`,`source`,`sort`,`direction`,`cursor`,`from`,`to`]){let r=t.get(n);r&&(e[n]=r)}for(let n of[`year`,`month`]){let r=t.get(n);r&&(e[n]=Number(r))}for(let n of[`status`,`workMode`,`tags`]){let r=t.get(n);r&&(e[n]=r.split(`,`))}return e},[t]),{data:c,isLoading:l,isFetching:u}=p8(s),{data:d}=h8(),{data:f}=_8();function p(e){let r=new URLSearchParams(t);for(let[t,n]of Object.entries(e))n==null||n===``||Array.isArray(n)&&n.length===0?r.delete(t):r.set(t,Array.isArray(n)?n.join(`,`):String(n));r.delete(`cursor`),n(r,{replace:!0})}let m=[{title:`Applied`,dataIndex:`appliedOn`,width:118,sorter:!1,render:e=>(0,Z.jsx)(YX.Text,{children:e})},{title:`Company`,key:`company`,width:190,render:(t,n)=>(0,Z.jsx)(Vk,{type:`link`,style:{padding:0,height:`auto`},onClick:t=>{t.stopPropagation(),e(`/companies/${n.company.id}`)},children:n.company.name})},{title:`Job title`,dataIndex:`jobTitle`,render:(e,t)=>(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Text,{strong:!0,children:e}),t.location&&(0,Z.jsxs)(YX.Text,{type:`secondary`,style:{fontSize:12},children:[t.location,` · `,ZQ[t.workMode]]})]})},{title:`Status`,dataIndex:`status`,width:116,render:(e,t)=>(0,Z.jsx)(H8,{status:t.status})},{title:`Tags`,key:`tags`,width:210,render:(e,t)=>(0,Z.jsx)(Pz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(OY,{color:e.color??void 0,style:{marginInlineEnd:0},children:e.name},e.id))})},{title:`Source`,dataIndex:`sourceName`,width:120,render:e=>e??(0,Z.jsx)(YX.Text,{type:`secondary`,children:`—`})}],h=t.get(`from`),g=t.get(`to`),v=h&&g?[(0,Yk.default)(h),(0,Yk.default)(g)]:null,y=(0,Yk.default)(),b=[{label:`Today`,value:[y,y]},{label:`Yesterday`,value:[y.subtract(1,`day`),y.subtract(1,`day`)]},{label:`This week`,value:[y.startOf(`week`),y.endOf(`week`)]},{label:`This month`,value:[y.startOf(`month`),y.endOf(`month`)]},{label:`Last 7 days`,value:[y.subtract(6,`day`),y]},{label:`Last 30 days`,value:[y.subtract(29,`day`),y]}];function x(e){if(!e||!e[0]||!e[1]){p({from:``,to:``});return}p({from:e[0].format(`YYYY-MM-DD`),to:e[1].format(`YYYY-MM-DD`)})}let S=t.get(`year`)?Number(t.get(`year`)):void 0,C=t.get(`month`)?Number(t.get(`month`)):void 0,w=S&&C?`${o$(C)} ${S}`:S?String(S):`All applications`;return(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{xs:24,md:6,lg:5,children:(0,Z.jsx)(bF,{size:`small`,title:`By period`,extra:(S||C)&&(0,Z.jsx)(Vk,{size:`small`,type:`link`,onClick:()=>p({year:``,month:``}),children:`Clear`}),styles:{body:{maxHeight:`calc(100vh - 220px)`,overflowY:`auto`}},children:(0,Z.jsx)(e5,{periods:d?.periods??[],year:S,month:C,onSelect:e=>p({year:e.year??``,month:e.month??``})})})}),(0,Z.jsx)(II,{xs:24,md:18,lg:19,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:w}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:c?`${c.total} application${c.total===1?``:`s`}`:`Loading…`})]}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Iz,{menu:{items:[{key:`csv`,label:`Export as CSV`},{key:`xlsx`,label:`Export as Excel (.xlsx)`}],onClick:({key:e})=>{window.location.href=u8.exportUrl(s,e)}},children:(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(FZ,{}),children:`Export`})}),(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(WQ,{}),onClick:()=>o(!0),children:`Import`}),(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(cP,{}),onClick:()=>i(!0),children:`New application`})]})]}),(0,Z.jsx)(bF,{size:`small`,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(_V,{allowClear:!0,size:`large`,prefix:(0,Z.jsx)(xE,{}),placeholder:`Search by meaning — try “server-side developer” or “remote fintech”`,defaultValue:t.get(`q`)??``,onChange:e=>{e.target.value===``&&p({q:``})},onPressEnter:e=>p({q:e.target.value})}),(0,Z.jsxs)(Xz,{gap:8,wrap:!0,children:[(0,Z.jsx)(HR.RangePicker,{allowClear:!0,value:v,presets:b,format:`YYYY-MM-DD`,onChange:e=>x(e)}),(0,Z.jsx)(EE,{mode:`multiple`,allowClear:!0,placeholder:`Status`,style:{minWidth:180},suffixIcon:(0,Z.jsx)(aQ,{}),value:t.get(`status`)?.split(`,`)??[],onChange:e=>p({status:e}),options:GQ.map(e=>({value:e,label:YQ[e]}))}),(0,Z.jsx)(EE,{mode:`multiple`,allowClear:!0,placeholder:`Work mode`,style:{minWidth:160},value:t.get(`workMode`)?.split(`,`)??[],onChange:e=>p({workMode:e}),options:XQ.map(e=>({value:e,label:ZQ[e]}))}),(0,Z.jsx)(EE,{mode:`multiple`,allowClear:!0,placeholder:`Tags`,style:{minWidth:200},value:t.get(`tags`)?.split(`,`)??[],onChange:e=>p({tags:e}),options:(f?.tags??[]).map(e=>({value:e.name,label:e.name}))}),(0,Z.jsx)(EE,{style:{minWidth:170},value:t.get(`sort`)??`appliedOn`,onChange:e=>p({sort:e}),options:[{value:`appliedOn`,label:`Sort: date applied`},{value:`company`,label:`Sort: company`},{value:`jobTitle`,label:`Sort: job title`},{value:`status`,label:`Sort: status`}]}),(0,Z.jsx)(EE,{style:{width:130},value:t.get(`direction`)??`desc`,onChange:e=>p({direction:e}),options:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}]})]}),c?.searched&&!c.semanticReady&&(0,Z.jsx)(jp,{type:`info`,showIcon:!0,icon:(0,Z.jsx)(VQ,{}),message:`Results will improve shortly — the semantic model is still loading.`})]})}),(0,Z.jsx)(hY,{rowKey:`id`,columns:m,dataSource:c?.items??[],loading:l||u,pagination:!1,onRow:t=>({onClick:()=>e(`/applications/${t.id}`),style:{cursor:`pointer`}}),locale:{emptyText:(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:t.get(`q`)?`Nothing matched “${t.get(`q`)}”`:`No applications for this filter`})},footer:c?.hasMore?()=>(0,Z.jsx)(Xz,{justify:`center`,children:(0,Z.jsx)(gD,{title:`Loads the next page`,children:(0,Z.jsx)(Vk,{onClick:()=>o5(t,n,c.cursor),children:`Load more`})})}):void 0})]})}),(0,Z.jsx)(Y8,{open:r,onClose:()=>i(!1)}),(0,Z.jsx)(i5,{open:a,onClose:()=>o(!1)})]})}function o5(e,t,n){if(!n)return;let r=new URLSearchParams(e);r.set(`cursor`,n),t(r)}function s5(){let{id:e}=Qe(),t=Xe(),{message:n}=NC.useApp(),{data:r,isLoading:i}=m8(e),a=T8(),o=E8(),[s,c]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(CS,{active:!0,paragraph:{rows:10}});let l=qQ(r.status);async function u(t){e&&(await a.mutateAsync({id:e,body:{status:t,comment:null}}),n.success(`Moved to ${YQ[t]}`))}return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`flex-start`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Vk,{type:`link`,icon:(0,Z.jsx)(WZ,{}),style:{padding:0},onClick:()=>t(`/applications`),children:`Back to applications`}),(0,Z.jsx)(YX.Title,{level:3,style:{margin:0},children:r.jobTitle}),(0,Z.jsxs)(Pz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/companies/${r.company.id}`,children:r.company.name}),(0,Z.jsxs)(YX.Text,{type:`secondary`,children:[`applied `,r.appliedOn]}),(0,Z.jsx)(H8,{status:r.status})]})]}),(0,Z.jsxs)(Pz,{wrap:!0,children:[l&&(0,Z.jsxs)(Vk,{type:`primary`,onClick:()=>void u(l),children:[`Move to `,YQ[l]]}),(0,Z.jsx)(EE,{style:{width:150},value:r.status,onChange:e=>void u(e),options:GQ.map(e=>({value:e,label:YQ[e]}))}),(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(QY,{}),onClick:()=>c(!0),children:`Edit`}),(0,Z.jsx)(VH,{title:`Delete this application?`,description:`Its notes and status history go too. This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{e&&(await o.mutateAsync(e),n.success(`Application deleted`),t(`/applications`))},children:(0,Z.jsx)(Vk,{danger:!0,icon:(0,Z.jsx)(YY,{})})})]})]}),(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:24,lg:14,children:(0,Z.jsx)(bF,{title:`Details`,children:(0,Z.jsxs)(nz,{column:{xs:1,sm:2},size:`small`,bordered:!0,children:[(0,Z.jsx)(nz.Item,{label:`Company`,children:r.company.name}),(0,Z.jsx)(nz.Item,{label:`Applied on`,children:r.appliedOn}),(0,Z.jsx)(nz.Item,{label:`Location`,children:r.location??`—`}),(0,Z.jsx)(nz.Item,{label:`Work mode`,children:ZQ[r.workMode]}),(0,Z.jsx)(nz.Item,{label:`Source`,children:r.sourceName??`—`}),(0,Z.jsx)(nz.Item,{label:`Follow up`,children:r.followUpOn??`—`}),(0,Z.jsx)(nz.Item,{label:`Salary`,span:2,children:r.salaryMin||r.salaryMax?`${r.salaryMin?.toLocaleString()??`?`} – ${r.salaryMax?.toLocaleString()??`?`} ${r.salaryCurrency??``}`:`—`}),(0,Z.jsx)(nz.Item,{label:`Posting`,span:2,children:r.jobUrl?(0,Z.jsx)(`a`,{href:r.jobUrl,target:`_blank`,rel:`noreferrer`,children:(0,Z.jsxs)(Pz,{size:4,children:[(0,Z.jsx)(mQ,{}),r.jobUrl]})}):`—`}),(0,Z.jsx)(nz.Item,{label:`Tags`,span:2,children:r.tags.length>0?(0,Z.jsx)(Pz,{size:4,wrap:!0,children:r.tags.map(e=>(0,Z.jsx)(OY,{children:e.name},e.id))}):`—`})]})})}),(0,Z.jsx)(II,{xs:24,lg:10,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(bF,{title:`Status history`,children:r.statusEvents.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No changes recorded`}):(0,Z.jsx)(KY,{items:r.statusEvents.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Text,{strong:!0,children:e.fromStatus?`${YQ[e.fromStatus]} → ${YQ[e.toStatus]}`:`Applied`}),(0,Z.jsx)(YX.Text,{type:`secondary`,style:{fontSize:12},children:e.occurredOn}),e.comment&&(0,Z.jsx)(YX.Text,{children:e.comment})]})}))})}),(0,Z.jsx)(bF,{title:`Notes (${r.notes.length})`,children:r.notes.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No notes yet`}):(0,Z.jsx)(NH,{size:`small`,dataSource:r.notes,renderItem:e=>(0,Z.jsx)(NH.Item,{children:(0,Z.jsx)(NH.Item.Meta,{title:e.title,description:(0,Z.jsx)(YX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:4,expandable:!0,symbol:`more`},children:e.body})})})})})]})})]}),(0,Z.jsx)(Y8,{open:s,onClose:()=>c(!1),application:r})]})}function c5(){let e=Xe(),[t,n]=(0,_.useState)(``),r=U8(t,300),{data:i,isLoading:a}=v8(r?{q:r}:{});return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:`Companies`}),(0,Z.jsx)(_V,{allowClear:!0,prefix:(0,Z.jsx)(xE,{}),placeholder:`Find a company`,style:{maxWidth:320},value:t,onChange:e=>n(e.target.value)})]}),(0,Z.jsx)(bF,{size:`small`,children:(0,Z.jsx)(hY,{rowKey:`id`,size:`middle`,loading:a,columns:[{title:`Company`,dataIndex:`name`,render:(e,t)=>(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Text,{strong:!0,children:e}),t.website&&(0,Z.jsx)(YX.Link,{href:t.website,target:`_blank`,style:{fontSize:12},children:t.website.replace(/^https?:\/\//,``)})]}),sorter:(e,t)=>e.name.localeCompare(t.name)},{title:`Applications`,dataIndex:`applicationCount`,width:140,align:`right`,sorter:(e,t)=>e.applicationCount-t.applicationCount,defaultSortOrder:`descend`,render:e=>(0,Z.jsx)(YX.Text,{strong:e>2,type:e>2?`warning`:void 0,children:e})},{title:`Active`,dataIndex:`activeCount`,width:90,align:`right`},{title:`Last applied`,dataIndex:`lastAppliedOn`,width:130,sorter:(e,t)=>(e.lastAppliedOn??``).localeCompare(t.lastAppliedOn??``),render:e=>e??(0,Z.jsx)(YX.Text,{type:`secondary`,children:`—`})},{title:`Tags`,key:`tags`,width:260,render:(e,t)=>(0,Z.jsx)(Pz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(OY,{style:{marginInlineEnd:0},children:e.name},e.id))})}],dataSource:i?.companies??[],pagination:{pageSize:25,hideOnSinglePage:!0},onRow:t=>({onClick:()=>e(`/companies/${t.id}`),style:{cursor:`pointer`}})})})]})}function l5(){let{id:e}=Qe(),t=Xe(),{data:n,isLoading:r}=y8(e),{data:i}=b8(e?{targetType:`company`,targetId:e}:{}),{data:a}=_8(),o=D8();if(r||!n)return(0,Z.jsx)(CS,{active:!0,paragraph:{rows:8}});let{company:s,applications:c}=n,l=c.filter(e=>[`applied`,`screening`,`interview`].includes(e.status)).length;return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Vk,{type:`link`,icon:(0,Z.jsx)(WZ,{}),style:{padding:0},onClick:()=>t(`/companies`),children:`Back to companies`}),(0,Z.jsx)(YX.Title,{level:3,style:{margin:0},children:s.name}),s.website&&(0,Z.jsx)(YX.Link,{href:s.website,target:`_blank`,children:s.website})]}),(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`Applications`,value:c.length})})}),(0,Z.jsx)(II,{xs:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`Still active`,value:l,valueStyle:{color:Z8.accent}})})}),(0,Z.jsx)(II,{xs:24,md:12,children:(0,Z.jsx)(bF,{children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)(YX.Text,{type:`secondary`,children:`Company tags`}),(0,Z.jsx)(EE,{mode:`tags`,style:{width:`100%`},placeholder:`fintech, remote-first…`,value:s.tags.map(e=>e.name),options:(a?.tags??[]).map(e=>({value:e.name,label:e.name})),onChange:t=>{e&&o.mutate({id:e,body:{tags:t}})}})]})})})]}),(0,Z.jsx)(bF,{title:`Application history`,children:(0,Z.jsx)(hY,{rowKey:`id`,size:`middle`,columns:[{title:`Applied`,dataIndex:`appliedOn`,width:120},{title:`Job title`,dataIndex:`jobTitle`,render:e=>(0,Z.jsx)(YX.Text,{strong:!0,children:e})},{title:`Status`,dataIndex:`status`,width:120,render:(e,t)=>(0,Z.jsx)(H8,{status:t.status})},{title:`Source`,dataIndex:`sourceName`,width:130}],dataSource:c,pagination:!1,onRow:e=>({onClick:()=>t(`/applications/${e.id}`),style:{cursor:`pointer`}})})}),(0,Z.jsx)(bF,{title:`Notes about ${s.name}`,children:(i?.notes??[]).length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No notes about this company`}):(0,Z.jsx)(NH,{dataSource:i?.notes??[],renderItem:e=>(0,Z.jsx)(NH.Item,{children:(0,Z.jsx)(NH.Item.Meta,{title:e.title,description:(0,Z.jsx)(YX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e.body})})})})})]})}function u5(){let{message:e}=NC.useApp(),[t,n]=(0,_.useState)(`all`),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),{data:l,isLoading:u}=b8(t===`all`?{}:{targetType:t}),d=k8(),f=l?.notes??[],p=(0,_.useMemo)(()=>{let e=r.trim().toLowerCase();return e?f.filter(t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||(t.targetLabel?.toLowerCase().includes(e)??!1)):f},[f,r]);return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:`Notes`}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(XI,{value:t,onChange:e=>n(e),options:[{label:`All`,value:`all`},{label:`Standalone`,value:`standalone`},{label:`Companies`,value:`company`},{label:`Applications`,value:`application`}]}),(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(cP,{}),onClick:()=>c(!0),children:`New note`})]})]}),(0,Z.jsx)(_V,{allowClear:!0,prefix:(0,Z.jsx)(xE,{}),placeholder:`Search notes by title, body, or what they're attached to`,value:r,onChange:e=>i(e.target.value)}),(0,Z.jsx)(bF,{size:`small`,loading:u,children:p.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:r?`Nothing matched “${r}”`:`No notes here yet`}):(0,Z.jsx)(NH,{dataSource:p,renderItem:t=>(0,Z.jsx)(NH.Item,{actions:[(0,Z.jsx)(Vk,{type:`text`,icon:(0,Z.jsx)(QY,{}),onClick:()=>o(t)},`edit`),(0,Z.jsx)(VH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await d.mutateAsync(t.id),e.success(`Note deleted`)},children:(0,Z.jsx)(Vk,{type:`text`,danger:!0,icon:(0,Z.jsx)(YY,{})})},`delete`)],children:(0,Z.jsx)(NH.Item.Meta,{title:(0,Z.jsxs)(Pz,{size:8,wrap:!0,children:[t.pinned&&(0,Z.jsx)(CQ,{style:{color:`#faad14`}}),(0,Z.jsx)(YX.Text,{strong:!0,children:t.title}),(0,Z.jsx)(d5,{note:t})]}),description:(0,Z.jsx)(YX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:3,expandable:!0,symbol:`more`},children:t.body})})})})}),(0,Z.jsx)(f5,{open:s||a!==null,note:a,onClose:()=>{c(!1),o(null)}})]})}function d5({note:e}){if(e.targetType===`standalone`)return(0,Z.jsx)(OY,{children:`general`});if(!e.targetId)return(0,Z.jsx)(OY,{children:`unlinked`});let t=e.targetType===`company`?`/companies/${e.targetId}`:`/applications/${e.targetId}`;return(0,Z.jsx)(dn,{to:t,children:(0,Z.jsxs)(OY,{color:`blue`,children:[e.targetType,`: `,e.targetLabel??`view`]})})}function f5({open:e,note:t,onClose:n}){let[r]=WB.useForm(),{message:i}=NC.useApp(),a=O8(),o=WB.useWatch(`targetType`,r)??`standalone`,{data:s}=v8(),{data:c}=p8({limit:200}),l=(0,_.useMemo)(()=>o===`company`?(s?.companies??[]).map(e=>({value:e.id,label:e.name})):o===`application`?(c?.items??[]).map(e=>({value:e.id,label:`${e.jobTitle} — ${e.company.name}`})):[],[o,s,c]);return(0,Z.jsx)(LH,{open:e,title:t?`Edit note`:`New note`,okText:`Save`,destroyOnHidden:!0,onCancel:n,afterOpenChange:e=>{e&&(t?r.setFieldsValue({title:t.title,body:t.body,targetType:t.targetType,targetId:t.targetId,pinned:t.pinned}):(r.resetFields(),r.setFieldsValue({targetType:`standalone`,pinned:!1,body:``})))},onOk:async()=>{let e=await r.validateFields();await a.mutateAsync({...t?{id:t.id}:{},body:{title:e.title,body:e.body??``,targetType:e.targetType,targetId:e.targetType===`standalone`?null:e.targetId??null,pinned:e.pinned??!1}}),i.success(t?`Note updated`:`Note saved`),n()},children:(0,Z.jsxs)(WB,{form:r,layout:`vertical`,children:[(0,Z.jsx)(WB.Item,{name:`title`,label:`Title`,rules:[{required:!0,message:`Title is required`}],children:(0,Z.jsx)(_V,{placeholder:`Interview prep, salary research…`})}),(0,Z.jsx)(WB.Item,{name:`body`,label:`Note`,children:(0,Z.jsx)(_V.TextArea,{rows:8,placeholder:`Anything worth keeping`})}),(0,Z.jsxs)(Xz,{gap:12,children:[(0,Z.jsx)(WB.Item,{name:`targetType`,label:`Attach to`,style:{flex:1},children:(0,Z.jsx)(EE,{options:[{value:`standalone`,label:`Nothing in particular`},{value:`company`,label:`A company`},{value:`application`,label:`An application`}],onChange:()=>r.setFieldValue(`targetId`,null)})}),o!==`standalone`&&(0,Z.jsx)(WB.Item,{name:`targetId`,label:o===`company`?`Company`:`Application`,style:{flex:2},rules:[{required:!0,message:`Pick what this note is about`}],children:(0,Z.jsx)(EE,{showSearch:!0,optionFilterProp:`label`,options:l})})]}),(0,Z.jsx)(WB.Item,{name:`pinned`,label:`Pinned`,valuePropName:`checked`,children:(0,Z.jsx)(XW,{})})]})})}function p5({open:e,onClose:t,opening:n}){let[r]=WB.useForm(),{message:i}=NC.useApp(),a=!!n,o=M8(),s=N8(),{data:c}=S8(WB.useWatch(`companyName`,r)??``);(0,_.useEffect)(()=>{e&&(n?r.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,savedOn:(0,Yk.default)(n.savedOn),jobUrl:n.jobUrl??void 0,location:n.location??void 0,workMode:n.workMode,sourceName:n.sourceName??void 0,salaryMin:n.salaryMin,salaryMax:n.salaryMax,salaryCurrency:n.salaryCurrency??void 0,notes:n.notes??void 0}):(r.resetFields(),r.setFieldsValue({savedOn:(0,Yk.default)(),workMode:`unspecified`})))},[e,n,r]);let l=(0,_.useMemo)(()=>(c?.companies??[]).map(e=>({value:e.name})),[c]);async function u(e){let c={companyName:e.companyName,jobTitle:e.jobTitle,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,notes:e.notes??null,...a?{}:{savedOn:e.savedOn.format(`YYYY-MM-DD`)}};try{n?(await s.mutateAsync({id:n.id,body:c}),i.success(`Opening updated`)):(await o.mutateAsync(c),i.success(`Opening saved`)),t()}catch(e){e instanceof Q6&&e.fieldErrors.length>0?(r.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),i.error(`Please check the highlighted fields`)):i.error(e instanceof Error?e.message:`Could not save`)}}return(0,Z.jsxs)(Tz,{title:a?`Edit opening`:`Save opening for later`,open:e,onClose:t,width:560,destroyOnHidden:!0,extra:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Vk,{type:`primary`,loading:o.isPending||s.isPending,onClick:()=>r.submit(),children:a?`Save changes`:`Save opening`})]}),children:[(0,Z.jsx)(YX.Paragraph,{type:`secondary`,children:`For a role you found but are not ready to apply to yet — no status, no tags, just enough to find it again. Convert it into a real application when you are ready.`}),(0,Z.jsxs)(WB,{form:r,layout:`vertical`,onFinish:u,requiredMark:`optional`,children:[(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:12,children:(0,Z.jsx)(WB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(NE,{options:l,placeholder:`Start typing — existing companies appear`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(II,{span:12,children:(0,Z.jsx)(WB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(_V,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`savedOn`,label:`Found on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(HR,{style:{width:`100%`},format:`YYYY-MM-DD`,disabled:a})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(EE,{options:XQ.map(e=>({value:e,label:ZQ[e]}))})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(_V,{placeholder:`Stockholm`})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(LL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(LL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(_V,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(WB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(_V,{placeholder:`LinkedIn, referral…`})}),(0,Z.jsx)(WB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(_V,{placeholder:`https://…`})}),(0,Z.jsx)(WB.Item,{name:`notes`,label:`Notes`,children:(0,Z.jsx)(_V.TextArea,{rows:4,placeholder:`Why this looked interesting, what you're missing to apply…`})})]})]})}function m5(){let e=Xe(),{message:t}=NC.useApp(),[n,r]=(0,_.useState)(`active`),{data:i,isLoading:a}=A8(n===`archived`?{archived:!0}:{}),{data:o}=_8(),s=P8(),c=F8(),l=N8(),u=(0,_.useMemo)(()=>{let e=i?.openings??[];return n===`archived`?e.filter(e=>e.archived):e},[i,n]),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(void 0),[h,g]=(0,_.useState)(null),[v]=WB.useForm();function y(e){g(e),v.setFieldsValue({appliedOn:(0,Yk.default)(),status:`applied`,tags:[]})}async function b(n){if(h)try{let r=await c.mutateAsync({id:h.id,body:{appliedOn:n.appliedOn.format(`YYYY-MM-DD`),status:n.status,tags:n.tags??[]}});t.success(`Converted to an application`),g(null),e(`/applications/${r.id}`)}catch(e){t.error(e instanceof Error?e.message:`Could not convert`)}}async function x(e){try{await l.mutateAsync({id:e.id,body:{archived:!1}}),t.success(`Opening restored`)}catch(e){t.error(e instanceof Error?e.message:`Could not restore`)}}let S=[{title:`Company`,dataIndex:[`company`,`name`]},{title:`Job title`,dataIndex:`jobTitle`},{title:`Found on`,dataIndex:`savedOn`,width:120},{title:`Location`,key:`location`,render:(e,t)=>[t.location,ZQ[t.workMode]].filter(Boolean).join(` · `)||(0,Z.jsx)(YX.Text,{type:`secondary`,children:`—`})},{title:`Source`,dataIndex:`sourceName`,render:e=>e??`—`}],C=e=>e.jobUrl&&(0,Z.jsx)(gD,{title:`Open job posting`,children:(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(mQ,{}),href:e.jobUrl,target:`_blank`,rel:`noreferrer`})}),w=e=>(0,Z.jsx)(VH,{title:`Delete this opening?`,description:`This removes it for good and cannot be undone.`,onConfirm:()=>s.mutate(e.id),okText:`Delete`,okButtonProps:{danger:!0},children:(0,Z.jsx)(Vk,{size:`small`,danger:!0,children:`Delete`})}),T=[...S,{title:``,key:`actions`,width:260,render:(e,t)=>(0,Z.jsxs)(Pz,{onClick:e=>e.stopPropagation(),children:[C(t),(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(qB,{}),onClick:()=>y(t),children:`Convert`}),(0,Z.jsx)(Vk,{size:`small`,onClick:()=>{m(t),f(!0)},children:`Edit`}),w(t)]})}],E=[...S,{title:`Archived because`,key:`reason`,width:160,render:(e,t)=>t.convertedApplicationId?(0,Z.jsx)(dn,{to:`/applications/${t.convertedApplicationId}`,children:(0,Z.jsx)(OY,{color:`blue`,children:`Converted`})}):(0,Z.jsx)(OY,{children:`Archived by hand`})},{title:``,key:`actions`,width:220,render:(e,t)=>(0,Z.jsxs)(Pz,{onClick:e=>e.stopPropagation(),children:[C(t),(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(EQ,{}),loading:l.isPending,onClick:()=>x(t),children:`Restore`}),w(t)]})}];return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`center`,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:`Job openings`}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:n===`active`?`Saved for later — convert one to a real application when you're ready to apply.`:`Openings that were converted into an application or archived by hand.`})]}),(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(cP,{}),onClick:()=>{m(void 0),f(!0)},children:`Save opening for later`})]}),(0,Z.jsx)(XI,{value:n,onChange:r,options:[{label:`Active`,value:`active`},{label:`Archived`,value:`archived`}]}),(0,Z.jsx)(bF,{size:`small`,children:(0,Z.jsx)(hY,{rowKey:`id`,columns:n===`archived`?E:T,dataSource:u,loading:a,pagination:!1,locale:{emptyText:(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:n===`active`?`Nothing saved yet — use “Save opening for later” for a role you're not ready to apply to.`:`No archived openings.`})}})}),(0,Z.jsx)(p5,{open:d,onClose:()=>f(!1),opening:p}),(0,Z.jsx)(LH,{title:h?`Convert "${h.jobTitle}" at ${h.company.name}`:``,open:!!h,onCancel:()=>g(null),onOk:()=>v.submit(),okText:`Create application`,confirmLoading:c.isPending,children:(0,Z.jsxs)(WB,{form:v,layout:`vertical`,onFinish:b,children:[(0,Z.jsx)(WB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0}],children:(0,Z.jsx)(HR,{style:{width:`100%`},format:`YYYY-MM-DD`})}),(0,Z.jsx)(WB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(EE,{options:GQ.map(e=>({value:e,label:YQ[e]}))})}),(0,Z.jsx)(WB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(EE,{mode:`tags`,options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),placeholder:`fintech, remote-ok…`,tokenSeparators:[`,`]})})]})})]})}var h5={companies:`Companies`,applications:`Applications`,tags:`Tags`,tagLinks:`Tag links`,notes:`Notes`,statusEvents:`Status events`,jobOpenings:`Job openings`};function g5({counts:e}){return(0,Z.jsx)(nz,{size:`small`,column:2,bordered:!0,children:Object.entries(e).map(([e,t])=>(0,Z.jsx)(nz.Item,{label:h5[e]??e,children:t},e))})}function _5(){let{message:e}=NC.useApp(),{data:t,isLoading:n}=I8(),r=L8(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{c.current&&clearInterval(c.current)},[]);function l(t){LH.confirm({title:`Switch to "${t}"?`,content:"The server restarts to connect to the new target. This page will reconnect and reload automatically once it is back — under `npm run dev`, that may require restarting it by hand.",okText:`Switch and restart`,onOk:async()=>{try{await r.mutateAsync(t)}catch(t){e.error(t instanceof Error?t.message:`Could not switch database`);return}s(!0),c.current=setInterval(()=>{u8.getDbTargets().then(()=>{c.current&&clearInterval(c.current),window.location.reload()}).catch(()=>{})},500)}})}if(o)return(0,Z.jsx)(bF,{title:`Database`,children:(0,Z.jsx)(zU,{icon:(0,Z.jsx)(CU,{spin:!0}),title:`Reconnecting…`,subTitle:`Waiting for the server to come back up.`})});let u=t?.targets??[];return(0,Z.jsx)(bF,{title:`Database`,loading:n,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(YX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:[`Connection settings live in `,(0,Z.jsx)(`code`,{children:`.env`}),` and are never shown or editable here.`,u.length<=1&&` Only one target is configured, so there is nothing to switch between.`]}),(0,Z.jsx)(nz,{size:`small`,column:1,bordered:!0,children:(0,Z.jsx)(nz.Item,{label:`Active target`,children:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)($Z,{}),t?.active,` (`,u.find(e=>e.name===t?.active)?.driver,`)`]})})}),u.length>1&&(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(EE,{style:{width:220},value:i??t?.active,options:u.map(e=>({value:e.name,label:`${e.name} (${e.driver})`})),onChange:a}),(0,Z.jsx)(Vk,{type:`primary`,disabled:!i||i===t?.active,loading:r.isPending,onClick:()=>i&&l(i),children:`Switch`})]})]})})}function v5(){let{message:e}=NC.useApp(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);function p(){n(null),i(null),o(null),u(null)}function m(){p(),f(!1)}let h=e=>(n(e),u(null),c(!0),u8.previewBackup(e).then(i).catch(e=>u(e instanceof Error?e.message:`Could not read that file`)).finally(()=>c(!1)),!1);function g(){t&&LH.confirm({title:`Replace all data in the active database?`,content:`Every table is wiped and recreated from this backup. This cannot be undone.`,okText:`Restore`,okButtonProps:{danger:!0},onOk:async()=>{c(!0),u(null);try{let e=await u8.commitBackup(t);o(e)}catch(t){e.error(t instanceof Error?t.message:`Restore failed`)}finally{c(!1)}}})}return(0,Z.jsxs)(bF,{title:`Backup & restore`,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(YX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`A full-fidelity snapshot of every table — every field, every relation, driver-agnostic. Not the same as the CSV/Excel export elsewhere in the app, which is a lossy report meant for people to read. This file is scrambled (gzip + obfuscation) so it isn't plain, readable JSON at rest — that's an obfuscation step, not encryption, and does not protect the personal data inside from anyone who actually wants it.`}),(0,Z.jsx)(Vk,{icon:(0,Z.jsx)($Z,{}),onClick:()=>{window.location.href=u8.backupExportUrl},children:`Export backup`}),(0,Z.jsx)(Vk,{onClick:()=>f(!0),children:`Restore from backup…`})]}),(0,Z.jsx)(LH,{title:`Restore from backup`,open:d,onCancel:m,width:600,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!r&&!a&&(0,Z.jsxs)(VZ.Dragger,{accept:`.jtbak`,maxCount:1,showUploadList:!1,beforeUpload:h,disabled:s,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(cQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a JobTrack backup file (.jtbak) here`})]}),l&&(0,Z.jsx)(jp,{type:`error`,showIcon:!0,message:l}),r&&!a&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(YX.Text,{type:`secondary`,children:[`Backup taken `,new Date(r.exportedAt).toLocaleString(),`. Restoring will replace everything currently in the active database with:`]}),(0,Z.jsx)(g5,{counts:r.counts}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:p,children:`Choose a different file`}),(0,Z.jsx)(Vk,{type:`primary`,danger:!0,loading:s,onClick:g,children:`Restore`})]})]}),a&&(0,Z.jsx)(zU,{status:`success`,title:`Restore complete`,extra:(0,Z.jsxs)(Pz,{direction:`vertical`,style:{width:`100%`},children:[(0,Z.jsx)(g5,{counts:a.counts}),(0,Z.jsx)(Vk,{type:`primary`,onClick:()=>window.location.reload(),children:`Reload`})]})})]})})]})}var y5=`CLEAR`;function b5(){let{message:e}=NC.useApp(),{data:t,isLoading:n}=R8(),r=z8(),i=B8(),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``);function l(){o(!1),c(``)}function u(){r.mutate(void 0,{onSuccess:()=>{e.success(`Database cleared`),l()},onError:t=>e.error(t instanceof Error?t.message:`Could not clear the database`)})}function d(){i.mutate(void 0,{onSuccess:t=>e.success(`Seeded ${t.applications} applications and ${t.companies} companies`),onError:t=>e.error(t instanceof Error?t.message:`Could not seed the database`)})}let f=t?.counts??{};return(0,Z.jsxs)(bF,{title:`Reset & demo data`,loading:n,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(YX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`Wipe everything in the active database, or — only while it's empty — fill it with a realistic multi-year demo dataset to explore the app with.`}),!t?.empty&&(0,Z.jsx)(g5,{counts:f}),(0,Z.jsxs)(Pz,{wrap:!0,children:[t?.empty&&(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(nQ,{}),loading:i.isPending,onClick:d,children:`Seed with demo data`}),(0,Z.jsx)(Vk,{danger:!0,disabled:t?.empty,onClick:()=>o(!0),children:`Clear database…`})]})]}),(0,Z.jsx)(LH,{title:`Clear the active database?`,open:a,onCancel:l,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(jp,{type:`warning`,showIcon:!0,message:`This permanently deletes every row below. There is no undo — export a backup first if you might want this data again.`}),(0,Z.jsx)(g5,{counts:f}),(0,Z.jsxs)(YX.Text,{children:[`Type `,(0,Z.jsx)(YX.Text,{code:!0,children:y5}),` to confirm.`]}),(0,Z.jsx)(_V,{value:s,onChange:e=>c(e.target.value),placeholder:y5,onPressEnter:()=>s===y5&&u()}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:l,children:`Cancel`}),(0,Z.jsx)(Vk,{danger:!0,type:`primary`,disabled:s!==y5,loading:r.isPending,onClick:u,children:`Clear database`})]})]})})]})}function x5(){let{data:e,isLoading:t}=V8(),n=e?`${e.name} ${e.version}`:``;return(0,Z.jsx)(bF,{title:`About`,loading:t,children:(0,Z.jsxs)(nz,{size:`small`,column:1,bordered:!0,children:[(0,Z.jsx)(nz.Item,{label:`Running`,children:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(dQ,{}),(0,Z.jsxs)(YX.Text,{copyable:{text:n},children:[(0,Z.jsx)(`code`,{children:e?.name}),` `,e?.version]})]})}),(0,Z.jsx)(nz.Item,{label:`Database driver`,children:e?.driver})]})})}function S5(){return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:`Settings`}),(0,Z.jsx)(_5,{}),(0,Z.jsx)(v5,{}),(0,Z.jsx)(b5,{}),(0,Z.jsx)(x5,{})]})}var C5=`jobtrack.theme`,w5=[{key:`/dashboard`,icon:(0,Z.jsx)(XZ,{}),label:(0,Z.jsx)(dn,{to:`/dashboard`,children:`Dashboard`})},{key:`/applications`,icon:(0,Z.jsx)(bQ,{}),label:(0,Z.jsx)(dn,{to:`/applications`,children:`Applications`})},{key:`/openings`,icon:(0,Z.jsx)(qZ,{}),label:(0,Z.jsx)(dn,{to:`/openings`,children:`Openings`})},{key:`/companies`,icon:(0,Z.jsx)(FQ,{}),label:(0,Z.jsx)(dn,{to:`/companies`,children:`Companies`})},{key:`/notes`,icon:(0,Z.jsx)($z,{}),label:(0,Z.jsx)(dn,{to:`/notes`,children:`Notes`})},{key:`/settings`,icon:(0,Z.jsx)(MQ,{}),label:(0,Z.jsx)(dn,{to:`/settings`,children:`Settings`})}],T5=[{key:`light`,icon:(0,Z.jsx)(RQ,{}),label:`Light`},{key:`dark`,icon:(0,Z.jsx)(_Q,{}),label:`Dark`}];function E5(){let[e,t]=(0,_.useState)(()=>{try{let e=localStorage.getItem(C5);if(e)return e===`dark`}catch{}return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1});(0,_.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`);try{localStorage.setItem(C5,e?`dark`:`light`)}catch{}},[e]);let n=qe(),r=(0,_.useMemo)(()=>{let e=w5.find(e=>n.pathname.startsWith(e.key));return e?[e.key]:[`/dashboard`]},[n.pathname]);return(0,Z.jsx)(Nh,{theme:Q8(e?`dark`:`light`),children:(0,Z.jsx)(NC,{children:(0,Z.jsxs)(EV,{style:{minHeight:`100vh`},children:[(0,Z.jsxs)(EV.Header,{style:{display:`flex`,alignItems:`center`,gap:24,paddingInline:24,borderBottom:`1px solid ${Z8.border}`,position:`sticky`,top:0,zIndex:10},children:[(0,Z.jsxs)(YX.Title,{level:4,style:{margin:0,whiteSpace:`nowrap`},children:[`Job`,(0,Z.jsx)(`span`,{style:{color:Z8.accent},children:`Track`})]}),(0,Z.jsx)(Fk,{mode:`horizontal`,selectedKeys:r,items:w5,style:{flex:1,minWidth:0,borderBottom:`none`}}),(0,Z.jsx)(Iz,{trigger:[`click`],menu:{items:T5,selectable:!0,selectedKeys:[e?`dark`:`light`],onClick:({key:e})=>t(e===`dark`)},children:(0,Z.jsx)(Vk,{icon:e?(0,Z.jsx)(_Q,{}):(0,Z.jsx)(RQ,{}),"aria-label":`Theme settings`,children:`Theme`})})]}),(0,Z.jsx)(EV.Content,{style:{padding:24},children:(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(xt,{path:`/`,element:(0,Z.jsx)(bt,{to:`/dashboard`,replace:!0})}),(0,Z.jsx)(xt,{path:`/dashboard`,element:(0,Z.jsx)($8,{})}),(0,Z.jsx)(xt,{path:`/applications`,element:(0,Z.jsx)(a5,{})}),(0,Z.jsx)(xt,{path:`/applications/:id`,element:(0,Z.jsx)(s5,{})}),(0,Z.jsx)(xt,{path:`/openings`,element:(0,Z.jsx)(m5,{})}),(0,Z.jsx)(xt,{path:`/companies`,element:(0,Z.jsx)(c5,{})}),(0,Z.jsx)(xt,{path:`/companies/:id`,element:(0,Z.jsx)(l5,{})}),(0,Z.jsx)(xt,{path:`/notes`,element:(0,Z.jsx)(u5,{})}),(0,Z.jsx)(xt,{path:`/settings`,element:(0,Z.jsx)(S5,{})}),(0,Z.jsx)(xt,{path:`*`,element:(0,Z.jsx)(bt,{to:`/dashboard`,replace:!0})})]})})]})})})}var D5=new Pr({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});(0,v.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(_.StrictMode,{children:(0,Z.jsx)(En,{client:D5,children:(0,Z.jsx)(un,{children:(0,Z.jsx)(E5,{})})})}));
|
|
444
|
-
//# sourceMappingURL=index-
|
|
443
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function M4(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:F4(t,`input`,e.processors),output:F4(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function N4(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return N4(r.element,n);if(r.type===`set`)return N4(r.valueType,n);if(r.type===`lazy`)return N4(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return N4(r.innerType,n);if(r.type===`intersection`)return N4(r.left,n)||N4(r.right,n);if(r.type===`record`||r.type===`map`)return N4(r.keyType,n)||N4(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:N4(r.in,n)||N4(r.out,n);if(r.type===`object`){for(let e in r.shape)if(N4(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(N4(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(N4(e,n))return!0;return!!(r.rest&&N4(r.rest,n))}return!1}var P4=(e,t={})=>n=>{let r=k4({...n,processors:t});return A4(e,r),j4(r,e),M4(r,e)},F4=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=k4({...i??{},target:a,io:t,processors:n});return A4(e,o),j4(o,e),M4(o,e)},I4={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},L4=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=I4[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},R4=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},z4=(e,t,n,r)=>{n.type=`boolean`},B4=(e,t,n,r)=>{n.not={}},V4=(e,t,n,r)=>{let i=e._zod.def,a=p$(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},H4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},U4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},W4=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=A4(a.element,t,{...r,path:[...r.path,`items`]})},G4=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=A4(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=A4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},K4=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>A4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},q4=(e,t,n,r)=>{let i=e._zod.def,a=A4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=A4(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},J4=(e,t,n,r)=>{let i=e._zod.def,a=A4(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Y4=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},X4=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Z4=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Q4=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},$4=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;A4(o,t,r);let s=t.seen.get(e);s.ref=o},e3=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},t3=(e,t,n,r)=>{let i=e._zod.def;A4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},n3=c$(`ZodISODateTime`,(e,t)=>{T0.init(e,t),k3.init(e,t)});function r3(e){return Y2(n3,e)}var i3=c$(`ZodISODate`,(e,t)=>{E0.init(e,t),k3.init(e,t)});function a3(e){return X2(i3,e)}var o3=c$(`ZodISOTime`,(e,t)=>{D0.init(e,t),k3.init(e,t)});function s3(e){return Z2(o3,e)}var c3=c$(`ZodISODuration`,(e,t)=>{O0.init(e,t),k3.init(e,t)});function l3(e){return Q2(c3,e)}var u3=c$(`ZodError`,(e,t)=>{Z$.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>e1(e,t)},flatten:{value:t=>$$(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,m$,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,m$,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),d3=t1(u3),f3=n1(u3),p3=r1(u3),m3=a1(u3),h3=s1(u3),g3=c1(u3),_3=l1(u3),v3=u1(u3),y3=d1(u3),b3=f1(u3),x3=p1(u3),S3=m1(u3),C3=new WeakMap;function w3(e,t,n){let r=Object.getPrototypeOf(e),i=C3.get(r);if(i||(i=new Set,C3.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var T3=c$(`ZodType`,(e,t)=>(d0.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:F4(e,`input`),output:F4(e,`output`)}}),e.toJSONSchema=P4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>d3(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>p3(e,t,n),e.parseAsync=async(t,n)=>f3(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>m3(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>h3(e,t,n),e.decode=(t,n)=>g3(e,t,n),e.encodeAsync=async(t,n)=>_3(e,t,n),e.decodeAsync=async(t,n)=>v3(e,t,n),e.safeEncode=(t,n)=>y3(e,t,n),e.safeDecode=(t,n)=>b3(e,t,n),e.safeEncodeAsync=async(t,n)=>x3(e,t,n),e.safeDecodeAsync=async(t,n)=>S3(e,t,n),w3(e,`ZodType`,{check(...e){let t=this.def;return this.clone(S$(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return M$(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(R6(e,t))},superRefine(e,t){return this.check(z6(e,t))},overwrite(e){return this.check(y4(e))},optional(){return y6(this)},exactOptional(){return x6(this)},nullable(){return C6(this)},nullish(){return y6(C6(this))},nonoptional(e){return k6(this,e)},array(){return s6(this)},or(e){return d6([this,e])},and(e){return p6(this,e)},transform(e){return N6(this,_6(e))},default(e){return T6(this,e)},prefault(e){return D6(this,e)},catch(e){return j6(this,e)},pipe(e){return N6(this,e)},readonly(){return I6(this)},describe(e){let t=this.clone();return T2.add(t,{description:e}),t},meta(...e){if(e.length===0)return T2.get(this);let t=this.clone();return T2.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return T2.get(e)?.description},configurable:!0}),e)),E3=c$(`_ZodString`,(e,t)=>{f0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>L4(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,w3(e,`_ZodString`,{regex(...e){return this.check(p4(...e))},includes(...e){return this.check(g4(...e))},startsWith(...e){return this.check(_4(...e))},endsWith(...e){return this.check(v4(...e))},min(...e){return this.check(d4(...e))},max(...e){return this.check(u4(...e))},length(...e){return this.check(f4(...e))},nonempty(...e){return this.check(d4(1,...e))},lowercase(e){return this.check(m4(e))},uppercase(e){return this.check(h4(e))},trim(){return this.check(x4())},normalize(...e){return this.check(b4(...e))},toLowerCase(){return this.check(S4())},toUpperCase(){return this.check(C4())},slugify(){return this.check(w4())}})}),D3=c$(`ZodString`,(e,t)=>{f0.init(e,t),E3.init(e,t),e.email=t=>e.check(D2(A3,t)),e.url=t=>e.check(N2(P3,t)),e.jwt=t=>e.check(J2(Y3,t)),e.emoji=t=>e.check(P2(F3,t)),e.guid=t=>e.check(O2(j3,t)),e.uuid=t=>e.check(k2(M3,t)),e.uuidv4=t=>e.check(A2(M3,t)),e.uuidv6=t=>e.check(j2(M3,t)),e.uuidv7=t=>e.check(M2(M3,t)),e.nanoid=t=>e.check(F2(I3,t)),e.guid=t=>e.check(O2(j3,t)),e.cuid=t=>e.check(I2(L3,t)),e.cuid2=t=>e.check(L2(R3,t)),e.ulid=t=>e.check(R2(z3,t)),e.base64=t=>e.check(G2(K3,t)),e.base64url=t=>e.check(K2(q3,t)),e.xid=t=>e.check(z2(B3,t)),e.ksuid=t=>e.check(B2(V3,t)),e.ipv4=t=>e.check(V2(H3,t)),e.ipv6=t=>e.check(H2(U3,t)),e.cidrv4=t=>e.check(U2(W3,t)),e.cidrv6=t=>e.check(W2(G3,t)),e.e164=t=>e.check(q2(J3,t)),e.datetime=t=>e.check(r3(t)),e.date=t=>e.check(a3(t)),e.time=t=>e.check(s3(t)),e.duration=t=>e.check(l3(t))});function O3(e){return E2(D3,e)}var k3=c$(`ZodStringFormat`,(e,t)=>{p0.init(e,t),E3.init(e,t)}),A3=c$(`ZodEmail`,(e,t)=>{g0.init(e,t),k3.init(e,t)}),j3=c$(`ZodGUID`,(e,t)=>{m0.init(e,t),k3.init(e,t)}),M3=c$(`ZodUUID`,(e,t)=>{h0.init(e,t),k3.init(e,t)});function N3(e){return k2(M3,e)}var P3=c$(`ZodURL`,(e,t)=>{_0.init(e,t),k3.init(e,t)}),F3=c$(`ZodEmoji`,(e,t)=>{v0.init(e,t),k3.init(e,t)}),I3=c$(`ZodNanoID`,(e,t)=>{y0.init(e,t),k3.init(e,t)}),L3=c$(`ZodCUID`,(e,t)=>{b0.init(e,t),k3.init(e,t)}),R3=c$(`ZodCUID2`,(e,t)=>{x0.init(e,t),k3.init(e,t)}),z3=c$(`ZodULID`,(e,t)=>{S0.init(e,t),k3.init(e,t)}),B3=c$(`ZodXID`,(e,t)=>{C0.init(e,t),k3.init(e,t)}),V3=c$(`ZodKSUID`,(e,t)=>{w0.init(e,t),k3.init(e,t)}),H3=c$(`ZodIPv4`,(e,t)=>{k0.init(e,t),k3.init(e,t)}),U3=c$(`ZodIPv6`,(e,t)=>{A0.init(e,t),k3.init(e,t)}),W3=c$(`ZodCIDRv4`,(e,t)=>{j0.init(e,t),k3.init(e,t)}),G3=c$(`ZodCIDRv6`,(e,t)=>{M0.init(e,t),k3.init(e,t)}),K3=c$(`ZodBase64`,(e,t)=>{P0.init(e,t),k3.init(e,t)}),q3=c$(`ZodBase64URL`,(e,t)=>{I0.init(e,t),k3.init(e,t)}),J3=c$(`ZodE164`,(e,t)=>{L0.init(e,t),k3.init(e,t)}),Y3=c$(`ZodJWT`,(e,t)=>{z0.init(e,t),k3.init(e,t)}),X3=c$(`ZodNumber`,(e,t)=>{B0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>R4(e,t,n,r),w3(e,`ZodNumber`,{gt(e,t){return this.check(s4(e,t))},gte(e,t){return this.check(c4(e,t))},min(e,t){return this.check(c4(e,t))},lt(e,t){return this.check(a4(e,t))},lte(e,t){return this.check(o4(e,t))},max(e,t){return this.check(o4(e,t))},int(e){return this.check($3(e))},safe(e){return this.check($3(e))},positive(e){return this.check(s4(0,e))},nonnegative(e){return this.check(c4(0,e))},negative(e){return this.check(a4(0,e))},nonpositive(e){return this.check(o4(0,e))},multipleOf(e,t){return this.check(l4(e,t))},step(e,t){return this.check(l4(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Z3(e){return $2(X3,e)}var Q3=c$(`ZodNumberFormat`,(e,t)=>{V0.init(e,t),X3.init(e,t)});function $3(e){return t4(Q3,e)}var e6=c$(`ZodBoolean`,(e,t)=>{H0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z4(e,t,n,r)});function t6(e){return n4(e6,e)}var n6=c$(`ZodUnknown`,(e,t)=>{U0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function r6(){return r4(n6)}var i6=c$(`ZodNever`,(e,t)=>{W0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>B4(e,t,n,r)});function a6(e){return i4(i6,e)}var o6=c$(`ZodArray`,(e,t)=>{K0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W4(e,t,n,r),e.element=t.element,w3(e,`ZodArray`,{min(e,t){return this.check(d4(e,t))},nonempty(e){return this.check(d4(1,e))},max(e,t){return this.check(u4(e,t))},length(e,t){return this.check(f4(e,t))},unwrap(){return this.element}})});function s6(e,t){return T4(o6,e,t)}var c6=c$(`ZodObject`,(e,t)=>{Z0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G4(e,t,n,r),b$(e,`shape`,()=>t.shape),w3(e,`ZodObject`,{keyof(){return h6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:r6()})},loose(){return this.clone({...this._zod.def,catchall:r6()})},strict(){return this.clone({...this._zod.def,catchall:a6()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return R$(this,e)},safeExtend(e){return z$(this,e)},merge(e){return B$(this,e)},pick(e){return I$(this,e)},omit(e){return L$(this,e)},partial(...e){return V$(v6,this,e[0])},required(...e){return H$(O6,this,e[0])}})});function l6(e,t){return new c6({type:`object`,shape:e??{},...N$(t)})}var u6=c$(`ZodUnion`,(e,t)=>{$0.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K4(e,t,n,r),e.options=t.options});function d6(e,t){return new u6({type:`union`,options:e,...N$(t)})}var f6=c$(`ZodIntersection`,(e,t)=>{e2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q4(e,t,n,r)});function p6(e,t){return new f6({type:`intersection`,left:e,right:t})}var m6=c$(`ZodEnum`,(e,t)=>{r2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V4(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new m6({...t,checks:[],...N$(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new m6({...t,checks:[],...N$(r),entries:i})}});function h6(e,t){return new m6({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N$(t)})}var g6=c$(`ZodTransform`,(e,t)=>{i2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>U4(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new u$(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Y$(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Y$(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function _6(e){return new g6({type:`transform`,transform:e})}var v6=c$(`ZodOptional`,(e,t)=>{o2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function y6(e){return new v6({type:`optional`,innerType:e})}var b6=c$(`ZodExactOptional`,(e,t)=>{s2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function x6(e){return new b6({type:`optional`,innerType:e})}var S6=c$(`ZodNullable`,(e,t)=>{c2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function C6(e){return new S6({type:`nullable`,innerType:e})}var w6=c$(`ZodDefault`,(e,t)=>{l2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function T6(e,t){return new w6({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():k$(t)}})}var E6=c$(`ZodPrefault`,(e,t)=>{d2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Z4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function D6(e,t){return new E6({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():k$(t)}})}var O6=c$(`ZodNonOptional`,(e,t)=>{f2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function k6(e,t){return new O6({type:`nonoptional`,innerType:e,...N$(t)})}var A6=c$(`ZodCatch`,(e,t)=>{m2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Q4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function j6(e,t){return new A6({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var M6=c$(`ZodPipe`,(e,t)=>{h2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$4(e,t,n,r),e.in=t.in,e.out=t.out});function N6(e,t){return new M6({type:`pipe`,in:e,out:t})}var P6=c$(`ZodPreprocess`,(e,t)=>{M6.init(e,t),_2.init(e,t)}),F6=c$(`ZodReadonly`,(e,t)=>{v2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function I6(e){return new F6({type:`readonly`,innerType:e})}var L6=c$(`ZodCustom`,(e,t)=>{b2.init(e,t),T3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H4(e,t,n,r)});function R6(e,t={}){return E4(L6,e,t)}function z6(e,t){return D4(e,t)}function B6(e,t){return new P6({type:`pipe`,in:_6(e),out:t})}function V6(e){return e4(X3,e)}var H6=O3().regex(/^\d{4}-\d{2}-\d{2}$/,`Expected a YYYY-MM-DD date`),U6=e=>O3().trim().max(e).nullish().transform(e=>e==null||e===``?null:e),W6=h6(GQ),G6=h6(XQ),K6=h6($Q),q6=h6(e$);h6(QQ);var J6=s6(O3().trim().min(1).max(60)).max(30);l6({companyName:O3().trim().min(1,`Company is required`).max(200),jobTitle:O3().trim().min(1,`Job title is required`).max(200),appliedOn:H6,status:W6.default(`applied`),jobUrl:U6(2e3),location:U6(200),workMode:G6.default(`unspecified`),sourceName:U6(120),salaryMin:Z3().int().nonnegative().nullish().transform(e=>e??null),salaryMax:Z3().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:U6(8),followUpOn:H6.nullish().transform(e=>e??null),tags:J6.default([]),notes:U6(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),l6({companyName:O3().trim().min(1).max(200).optional(),jobTitle:O3().trim().min(1).max(200).optional(),appliedOn:H6.optional(),status:W6.optional(),statusComment:O3().trim().max(2e3).nullish(),jobUrl:U6(2e3).optional(),location:U6(200).optional(),workMode:G6.optional(),sourceName:U6(120).optional(),salaryMin:Z3().int().nonnegative().nullish(),salaryMax:Z3().int().nonnegative().nullish(),salaryCurrency:U6(8).optional(),followUpOn:H6.nullish(),archived:t6().optional(),tags:J6.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),l6({status:W6,occurredOn:H6.optional(),comment:O3().trim().max(2e3).nullish().transform(e=>e??null)});var Y6=e=>B6(e=>{if(e==null)return;let t=(Array.isArray(e)?e.map(String):String(e).split(`,`)).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},s6(e).optional()),X6=l6({q:O3().trim().max(300).optional(),year:V6().int().min(1970).max(2200).optional(),month:V6().int().min(1).max(12).optional(),status:Y6(W6),workMode:Y6(G6),tags:Y6(O3()),companyId:N3().optional(),source:O3().trim().max(120).optional(),from:H6.optional(),to:H6.optional(),archived:h6([`true`,`false`,`all`]).default(`false`).transform(e=>e===`all`?`all`:e===`true`),followUpDue:h6([`true`,`false`]).optional().transform(e=>e===`true`),sort:h6([`appliedOn`,`company`,`jobTitle`,`status`,`createdAt`]).default(`appliedOn`),direction:h6([`asc`,`desc`]).default(`desc`),limit:V6().int().min(1).max(200).default(50),cursor:O3().optional()});l6({company:O3().trim().min(1).max(200),title:O3().trim().max(200).optional().default(``),excludeId:N3().optional()}),l6({q:O3().trim().min(1).max(300),limit:V6().int().min(1).max(100).default(25),types:Y6(h6([`application`,`company`,`note`]))}),X6.extend({format:h6([`csv`,`xlsx`]).default(`csv`)}),l6({name:O3().trim().min(1).max(200),website:U6(2e3),location:U6(200),tags:J6.default([])}),l6({name:O3().trim().min(1).max(200).optional(),website:U6(2e3).optional(),location:U6(200).optional(),archived:t6().optional(),tags:J6.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),l6({title:O3().trim().min(1).max(200),body:O3().max(5e4).default(``),targetType:K6.default(`standalone`),targetId:N3().nullish().transform(e=>e??null),pinned:t6().default(!1)}),l6({title:O3().trim().min(1).max(200).optional(),body:O3().max(5e4).optional(),targetType:K6.optional(),targetId:N3().nullish(),pinned:t6().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),l6({name:O3().trim().min(1).max(60),color:U6(30),scope:q6.default(`both`)}),l6({companyName:O3().trim().min(1,`Company is required`).max(200),jobTitle:O3().trim().min(1,`Job title is required`).max(200),jobUrl:U6(2e3),location:U6(200),workMode:G6.default(`unspecified`),sourceName:U6(120),salaryMin:Z3().int().nonnegative().nullish().transform(e=>e??null),salaryMax:Z3().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:U6(8),notes:U6(2e4),savedOn:H6.optional()}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),l6({companyName:O3().trim().min(1).max(200).optional(),jobTitle:O3().trim().min(1).max(200).optional(),jobUrl:U6(2e3).optional(),location:U6(200).optional(),workMode:G6.optional(),sourceName:U6(120).optional(),salaryMin:Z3().int().nonnegative().nullish(),salaryMax:Z3().int().nonnegative().nullish(),salaryCurrency:U6(8).optional(),notes:U6(2e4).optional(),savedOn:H6.optional(),archived:t6().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),l6({appliedOn:H6.optional(),status:W6.optional(),tags:J6.optional()}),l6({target:O3().min(1)});function Z6(e){return e===`exact`}var Q6=class extends Error{status;code;details;constructor(e,t,n,r){super(n),this.name=`ApiError`,this.status=e,this.code=t,this.details=r}get fieldErrors(){return Array.isArray(this.details)?this.details:[]}};async function $6(e,t){let n=await fetch(e,{...t,headers:{...t?.body?{"Content-Type":`application/json`}:{},...t?.headers}});if(n.status===204)return;let r=await n.text(),i=r?JSON.parse(r):null;if(!n.ok)throw new Q6(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}function e8(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!=null&&r!==``){if(Array.isArray(r)){if(r.length===0)continue;t.set(n,r.join(`,`))}else t.set(n,String(r))}let n=t.toString();return n?`?${n}`:``}var t8={csv:`text/csv`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};async function n8(e,t,n){let r=await fetch(`/api/import${e8({format:t,mode:n})}`,{method:`POST`,headers:{"Content-Type":t8[t]},body:e}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok)throw new Q6(r.status,a?.error??`unknown`,a?.message??r.statusText,a?.details);return a}async function r8(e,t){let n=await fetch(`/api/backup/import${e8({mode:t})}`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e}),r=await n.text(),i=r?JSON.parse(r):null;if(!n.ok)throw new Q6(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}var i8={listApplications:e=>$6(`/api/applications${e8(e)}`),getApplication:e=>$6(`/api/applications/${e}`),periods:()=>$6(`/api/applications/periods`),checkDuplicates:e=>$6(`/api/applications/check${e8(e)}`),createApplication:e=>$6(`/api/applications`,{method:`POST`,body:JSON.stringify(e)}),updateApplication:(e,t)=>$6(`/api/applications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),changeStatus:(e,t)=>$6(`/api/applications/${e}/status`,{method:`POST`,body:JSON.stringify(t)}),deleteApplication:e=>$6(`/api/applications/${e}`,{method:`DELETE`}),listCompanies:(e={})=>$6(`/api/companies${e8(e)}`),suggestCompanies:e=>$6(`/api/companies/suggest${e8({q:e})}`),getCompany:e=>$6(`/api/companies/${e}`),updateCompany:(e,t)=>$6(`/api/companies/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),listTags:()=>$6(`/api/tags`),listNotes:(e={})=>$6(`/api/notes${e8(e)}`),createNote:e=>$6(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>$6(`/api/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNote:e=>$6(`/api/notes/${e}`,{method:`DELETE`}),dashboard:()=>$6(`/api/dashboard`),search:(e,t)=>$6(`/api/search${e8({q:e,types:t,limit:25})}`),exportUrl:(e,t)=>`/api/export${e8({...e,format:t})}`,previewImport:(e,t)=>n8(e,t,`preview`),commitImport:(e,t)=>n8(e,t,`commit`),listOpenings:(e={})=>$6(`/api/openings${e8(e)}`),getOpening:e=>$6(`/api/openings/${e}`),createOpening:e=>$6(`/api/openings`,{method:`POST`,body:JSON.stringify(e)}),updateOpening:(e,t)=>$6(`/api/openings/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteOpening:e=>$6(`/api/openings/${e}`,{method:`DELETE`}),convertOpening:(e,t)=>$6(`/api/openings/${e}/convert`,{method:`POST`,body:JSON.stringify(t)}),getDbTargets:()=>$6(`/api/db/targets`),switchDb:e=>$6(`/api/db/switch`,{method:`POST`,body:JSON.stringify({target:e})}),backupExportUrl:`/api/backup/export`,previewBackup:e=>r8(e,`preview`),commitBackup:e=>r8(e,`commit`),getDataStatus:()=>$6(`/api/backup/status`),clearDatabase:()=>$6(`/api/backup/clear`,{method:`POST`}),seedDatabase:()=>$6(`/api/backup/seed`,{method:`POST`}),getMeta:()=>$6(`/api/meta`)},a8=class extends Error{name=`RepoError`;cause;constructor(e,t){super(e),t?.cause!==void 0&&(this.cause=t.cause)}},o8=class extends a8{name=`SchemaError`},s8=new Set([`string`,`number`,`integer`,`boolean`,`date`,`json`]);function c8(e){let t=Object.keys(e);if(t.length===0)throw new o8(`A schema must define at least one field`);let n={},r={},i={},a;for(let o of t){let t=e[o];if(!s8.has(t.type))throw new o8(`Field "${o}" has unknown type ${JSON.stringify(t.type)}. Expected one of: ${[...s8].join(`, `)}`);let s=t.column??o;if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(s))throw new o8(`Field "${o}" maps to column ${JSON.stringify(s)}, which is not a plain identifier. Column names must match /^[A-Za-z_][A-Za-z0-9_]*$/ because repolayer never quotes-and-interpolates arbitrary text into SQL.`);if(s in r)throw new o8(`Fields "${r[s]}" and "${o}" both map to column "${s}"`);if(t.primaryKey){if(a!==void 0)throw new o8(`Schema declares two primary keys ("${a}" and "${o}"). repolayer supports single-column primary keys only.`);if(t.nullable)throw new o8(`Primary key "${o}" cannot be nullable`);a=o}n[o]=s,r[s]=o,i[o]=t.type}if(a===void 0)throw new o8("Schema has no primary key. Mark exactly one field with `primaryKey: true`.");return Object.freeze({fields:e,primaryKey:a,columns:Object.freeze(n),fieldsByColumn:Object.freeze(r),fieldNames:Object.freeze(t),types:Object.freeze(i)})}var l8={createdAt:{type:`date`,column:`created_at`},updatedAt:{type:`date`,column:`updated_at`}};c8({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},website:{type:`string`,nullable:!0},location:{type:`string`,nullable:!0},archived:{type:`boolean`},...l8}),c8({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},titleKey:{type:`string`,column:`title_key`},appliedOn:{type:`date`,column:`applied_on`},periodYear:{type:`integer`,column:`period_year`},periodMonth:{type:`integer`,column:`period_month`},status:{type:`string`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},followUpOn:{type:`date`,nullable:!0,column:`follow_up_on`},archived:{type:`boolean`},...l8}),c8({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},color:{type:`string`,nullable:!0},scope:{type:`string`},...l8}),c8({id:{type:`string`,primaryKey:!0},tagId:{type:`string`,column:`tag_id`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},...l8}),c8({id:{type:`string`,primaryKey:!0},title:{type:`string`},body:{type:`string`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,nullable:!0,column:`target_id`},pinned:{type:`boolean`},...l8}),c8({id:{type:`string`,primaryKey:!0},applicationId:{type:`string`,column:`application_id`},fromStatus:{type:`string`,nullable:!0,column:`from_status`},toStatus:{type:`string`,column:`to_status`},occurredOn:{type:`date`,column:`occurred_on`},commentText:{type:`string`,nullable:!0,column:`comment_text`},...l8}),c8({id:{type:`string`,primaryKey:!0},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},model:{type:`string`},dim:{type:`integer`},embedding:{type:`json`},textHash:{type:`string`,column:`text_hash`},...l8}),c8({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},notes:{type:`string`,nullable:!0},savedOn:{type:`date`,column:`saved_on`},archived:{type:`boolean`},convertedApplicationId:{type:`string`,nullable:!0,column:`converted_application_id`},...l8}),[{header:`Position`,value:e=>e.jobTitle,width:34},{header:`Company`,value:e=>e.company.name,width:28},{header:`Date`,value:e=>e.appliedOn,width:13},{header:`Status`,value:e=>YQ[e.status],width:13},{header:`Notes`,value:e=>e.notesText,width:70,wrap:!0}].map(e=>e.header),new Map(Object.entries(YQ).map(([e,t])=>[t.toLowerCase(),e]));var u8=i8,d8={applications:e=>[`applications`,e],application:e=>[`application`,e],periods:()=>[`periods`],companies:e=>[`companies`,e],company:e=>[`company`,e],companySuggest:e=>[`company-suggest`,e],tags:()=>[`tags`],notes:e=>[`notes`,e],dashboard:()=>[`dashboard`],duplicates:e=>[`duplicates`,e],search:e=>[`search`,e],openings:e=>[`openings`,e],opening:e=>[`opening`,e],dbTargets:()=>[`db-targets`],dataStatus:()=>[`data-status`],meta:()=>[`meta`]};function f8(e){e.invalidateQueries({queryKey:[`applications`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`periods`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`companies`]}),e.invalidateQueries({queryKey:[`company`]}),e.invalidateQueries({queryKey:[`tags`]}),e.invalidateQueries({queryKey:[`duplicates`]}),e.invalidateQueries({queryKey:[`search`]})}function p8(e){return qr({queryKey:d8.applications(e),queryFn:()=>u8.listApplications(e),placeholderData:e=>e})}function m8(e){return qr({queryKey:d8.application(e??``),queryFn:()=>u8.getApplication(e),enabled:!!e})}function h8(){return qr({queryKey:d8.periods(),queryFn:()=>u8.periods()})}function g8(){return qr({queryKey:d8.dashboard(),queryFn:()=>u8.dashboard()})}function _8(){return qr({queryKey:d8.tags(),queryFn:()=>u8.listTags()})}function v8(e={}){return qr({queryKey:d8.companies(e),queryFn:()=>u8.listCompanies(e)})}function y8(e){return qr({queryKey:d8.company(e??``),queryFn:()=>u8.getCompany(e),enabled:!!e})}function b8(e={}){return qr({queryKey:d8.notes(e),queryFn:()=>u8.listNotes(e)})}function x8(e){let{enabled:t=!0,...n}=e;return qr({queryKey:d8.duplicates(n),queryFn:()=>u8.checkDuplicates(n),enabled:t&&n.company.trim().length>1,staleTime:5e3})}function S8(e){return qr({queryKey:d8.companySuggest(e),queryFn:()=>u8.suggestCompanies(e),enabled:e.trim().length>0,staleTime:3e4})}function C8(){let e=Tn();return Jr({mutationFn:e=>u8.createApplication(e),onSuccess:()=>f8(e)})}function w8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.updateApplication(e,t),onSuccess:()=>f8(e)})}function T8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.changeStatus(e,t),onSuccess:()=>f8(e)})}function E8(){let e=Tn();return Jr({mutationFn:e=>u8.deleteApplication(e),onSuccess:()=>f8(e)})}function D8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.updateCompany(e,t),onSuccess:()=>f8(e)})}function O8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>e?u8.updateNote(e,t):u8.createNote(t),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`search`]})}})}function k8(){let e=Tn();return Jr({mutationFn:e=>u8.deleteNote(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]})}})}function A8(e={}){return qr({queryKey:d8.openings(e),queryFn:()=>u8.listOpenings(e)})}function j8(e){e.invalidateQueries({queryKey:[`openings`]}),e.invalidateQueries({queryKey:[`opening`]})}function M8(){let e=Tn();return Jr({mutationFn:e=>u8.createOpening(e),onSuccess:()=>j8(e)})}function N8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.updateOpening(e,t),onSuccess:()=>j8(e)})}function P8(){let e=Tn();return Jr({mutationFn:e=>u8.deleteOpening(e),onSuccess:()=>j8(e)})}function F8(){let e=Tn();return Jr({mutationFn:({id:e,body:t})=>u8.convertOpening(e,t),onSuccess:()=>{j8(e),e.invalidateQueries({queryKey:[`applications`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`periods`]}),e.invalidateQueries({queryKey:[`dashboard`]}),e.invalidateQueries({queryKey:[`companies`]}),e.invalidateQueries({queryKey:[`search`]})}})}function I8(){return qr({queryKey:d8.dbTargets(),queryFn:()=>u8.getDbTargets()})}function L8(){return Jr({mutationFn:e=>u8.switchDb(e)})}function R8(){return qr({queryKey:d8.dataStatus(),queryFn:()=>u8.getDataStatus()})}function z8(){let e=Tn();return Jr({mutationFn:()=>u8.clearDatabase(),onSuccess:()=>void e.invalidateQueries()})}function B8(){let e=Tn();return Jr({mutationFn:()=>u8.seedDatabase(),onSuccess:()=>void e.invalidateQueries()})}function V8(){return qr({queryKey:d8.meta(),queryFn:()=>u8.getMeta(),staleTime:1/0})}function H8({status:e}){return(0,Z.jsx)(OY,{color:JQ[e],children:YQ[e]})}function U8(e,t=300){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var W8={exact:`error`,similar:`warning`,company:`info`,none:`success`};function G8({check:e,loading:t}){if(t&&!e)return(0,Z.jsx)(jp,{type:`info`,showIcon:!0,message:`Checking your history…`,style:{marginBottom:16}});if(!e)return null;if(e.verdict===`none`)return(0,Z.jsx)(jp,{type:`success`,showIcon:!0,message:`No history with this company`,description:`This looks like a company you haven't applied to before.`,style:{marginBottom:16}});let n=e.company?.name??`this company`;return(0,Z.jsx)(jp,{type:W8[e.verdict],showIcon:!0,style:{marginBottom:16},message:K8(e.verdict,n,e.priorCount),description:(0,Z.jsxs)(Pz,{direction:`vertical`,size:6,style:{width:`100%`},children:[e.matches.length>0?e.matches.slice(0,5).map(e=>(0,Z.jsx)(q8,{match:e},e.id)):(0,Z.jsx)(YX.Text,{type:`secondary`,children:`None of them were for this role, but it is worth a look before you apply again.`}),!e.semanticUsed&&e.matches.length>0&&(0,Z.jsx)(YX.Text,{type:`secondary`,style:{fontSize:12},children:`Matched on wording only — semantic matching is still warming up.`})]})})}function K8(e,t,n){let r=n===1?`once`:`${n} times`;switch(e){case`exact`:return`You have already applied for this exact role at ${t}`;case`similar`:return`You have applied for a very similar role at ${t}`;default:return`You have applied to ${t} ${r} before`}}function q8({match:e}){let t=Math.round(Math.max(e.titleSimilarity,e.semanticSimilarity??0)*100);return(0,Z.jsxs)(Pz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:e.appliedOn}),(0,Z.jsx)(OY,{color:JQ[e.status],children:YQ[e.status]}),e.matchKind===`exact`?(0,Z.jsx)(OY,{color:`red`,children:`exact title`}):(0,Z.jsxs)(OY,{children:[t,`% similar`]})]})}function J8({onStartApplication:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(``),a=U8(t,350),{data:o,isFetching:s}=x8({company:a,title:U8(r,350)}),c=a.trim().length>1;return(0,Z.jsx)(bF,{title:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(kQ,{}),(0,Z.jsx)(`span`,{children:`Check before you apply`})]}),extra:e&&(0,Z.jsx)(Vk,{type:`link`,onClick:e,children:`New application`}),children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(BU,{gutter:12,children:[(0,Z.jsx)(II,{xs:24,sm:12,children:(0,Z.jsx)(_V,{placeholder:`Company`,value:t,onChange:e=>n(e.target.value),allowClear:!0})}),(0,Z.jsx)(II,{xs:24,sm:12,children:(0,Z.jsx)(_V,{placeholder:`Job title (optional)`,value:r,onChange:e=>i(e.target.value),allowClear:!0})})]}),c?(0,Z.jsx)(G8,{check:o,loading:s}):(0,Z.jsx)(YX.Text,{type:`secondary`,children:`Type a company name to see whether you have been here before.`})]})})}function Y8({open:e,onClose:t,application:n}){let[r]=WB.useForm(),{message:i,modal:a}=NC.useApp(),o=!!n,s=C8(),c=w8(),{data:l}=_8(),u=WB.useWatch(`companyName`,r)??``,d=WB.useWatch(`jobTitle`,r)??``,f=U8(u,300),p=U8(d,300),m=o&&u.trim()===(n?.company.name??``).trim()&&d.trim()===(n?.jobTitle??``).trim(),{data:h}=S8(f),{data:g,isFetching:v}=x8({company:f,title:p,...n?{excludeId:n.id}:{},enabled:e&&!m});(0,_.useEffect)(()=>{e&&(n?r.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,appliedOn:(0,Yk.default)(n.appliedOn),status:n.status,jobUrl:n.jobUrl??void 0,location:n.location??void 0,workMode:n.workMode,sourceName:n.sourceName??void 0,salaryMin:n.salaryMin,salaryMax:n.salaryMax,salaryCurrency:n.salaryCurrency??void 0,followUpOn:n.followUpOn?(0,Yk.default)(n.followUpOn):null,tags:n.tags.map(e=>e.name)}):(r.resetFields(),r.setFieldsValue({appliedOn:(0,Yk.default)(),status:`applied`,workMode:`unspecified`,tags:[]})))},[e,n,r]);let y=(0,_.useMemo)(()=>(h?.companies??[]).map(e=>({value:e.name,label:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(`span`,{children:e.name}),e.applicationCount>0&&(0,Z.jsxs)(YX.Text,{type:`secondary`,style:{fontSize:12},children:[e.applicationCount,` application`,e.applicationCount===1?``:`s`]})]})})),[h]),b=(0,_.useMemo)(()=>(l?.tags??[]).map(e=>({value:e.name,label:e.name})),[l]),[x,S]=(0,_.useState)(!1);async function C(e){if(g&&Z6(g.verdict)&&!o&&!await new Promise(e=>{a.confirm({title:`You have applied for this exact role before`,content:(0,Z.jsxs)(Pz,{direction:`vertical`,children:[(0,Z.jsxs)(YX.Text,{children:[g.matches[0]?.jobTitle,` at `,g.company?.name,` on`,` `,g.matches[0]?.appliedOn,`.`]}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:`Save this as a new application anyway?`})]}),okText:`Save anyway`,cancelText:`Go back`,onOk:()=>e(!0),onCancel:()=>e(!1)})}))return;let l={companyName:e.companyName,jobTitle:e.jobTitle,appliedOn:e.appliedOn.format(`YYYY-MM-DD`),status:e.status,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,followUpOn:e.followUpOn?e.followUpOn.format(`YYYY-MM-DD`):null,tags:e.tags??[],...o?{}:{notes:e.notes??null}};S(!0);try{n?(await c.mutateAsync({id:n.id,body:l}),i.success(`Application updated`)):(await s.mutateAsync(l),i.success(`Application saved`)),t()}catch(e){e instanceof Q6&&e.fieldErrors.length>0?(r.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),i.error(`Please check the highlighted fields`)):i.error(e instanceof Error?e.message:`Could not save`)}finally{S(!1)}}return(0,Z.jsxs)(Tz,{title:o?`Edit application`:`New application`,open:e,onClose:t,width:640,destroyOnHidden:!0,extra:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Vk,{type:`primary`,loading:x,onClick:()=>r.submit(),children:o?`Save changes`:`Save application`})]}),children:[!m&&(0,Z.jsx)(G8,{check:g,loading:v}),(0,Z.jsxs)(WB,{form:r,layout:`vertical`,onFinish:C,requiredMark:`optional`,children:[(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:12,children:(0,Z.jsx)(WB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(NE,{options:y,placeholder:`Start typing — existing companies appear`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(II,{span:12,children:(0,Z.jsx)(WB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(_V,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(HR,{style:{width:`100%`},format:`YYYY-MM-DD`})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(EE,{options:GQ.map(e=>({value:e,label:YQ[e]}))})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`followUpOn`,label:`Follow up on`,children:(0,Z.jsx)(HR,{style:{width:`100%`},format:`YYYY-MM-DD`,allowClear:!0})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(EE,{options:XQ.map(e=>({value:e,label:ZQ[e]}))})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(_V,{placeholder:`Stockholm`})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(_V,{placeholder:`LinkedIn, referral…`})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(LL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(LL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(_V,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(WB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(_V,{placeholder:`https://…`})}),(0,Z.jsx)(WB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(EE,{mode:`tags`,options:b,placeholder:`fintech, remote-ok, dream-job…`,tokenSeparators:[`,`]})}),!o&&(0,Z.jsx)(WB.Item,{name:`notes`,label:`Notes`,help:`Saved as a note linked to this application. Searchable.`,children:(0,Z.jsx)(_V.TextArea,{rows:4,placeholder:`Anything worth remembering…`})})]})]})}var X8={dark:{bgBase:`#0d1117`,bgRaised:`#161b22`,bgSunken:`#010409`,border:`#30363d`,borderStrong:`#444c56`,textPrimary:`#e6edf3`,textMuted:`#8b949e`,textFaint:`#6e7681`,accent:`#58a6ff`,success:`#3fb950`,danger:`#f85149`,warning:`#d29922`},light:{bgBase:`#ffffff`,bgRaised:`#ffffff`,bgSunken:`#f6f8fa`,border:`#d0d7de`,borderStrong:`#afb8c1`,textPrimary:`#1f2328`,textMuted:`#656d76`,textFaint:`#8c959f`,accent:`#0969da`,success:`#1a7f37`,danger:`#d1242f`,warning:`#9a6700`}},Z8={bgBase:`var(--jt-bg-base)`,bgRaised:`var(--jt-bg-raised)`,bgSunken:`var(--jt-bg-sunken)`,border:`var(--jt-border)`,borderStrong:`var(--jt-border-strong)`,textPrimary:`var(--jt-text-primary)`,textMuted:`var(--jt-text-muted)`,textFaint:`var(--jt-text-faint)`,accent:`var(--jt-accent)`,success:`var(--jt-success)`,danger:`var(--jt-danger)`,warning:`var(--jt-warning)`};function Q8(e){let t=X8[e];return{algorithm:e===`dark`?RY.darkAlgorithm:RY.defaultAlgorithm,token:{colorBgBase:t.bgBase,colorBgContainer:t.bgRaised,colorBgElevated:t.bgRaised,colorBgLayout:t.bgBase,colorBorder:t.border,colorBorderSecondary:t.border,colorText:t.textPrimary,colorTextSecondary:t.textMuted,colorTextTertiary:t.textFaint,colorPrimary:t.accent,colorLink:t.accent,colorSuccess:t.success,colorError:t.danger,colorWarning:t.warning,borderRadius:8,fontSize:14},components:{Layout:{siderBg:t.bgSunken,headerBg:t.bgSunken,bodyBg:t.bgBase}}}}function $8(){let{data:e,isLoading:t}=g8(),[n,r]=(0,_.useState)(!1),i=r$(i$());if(t||!e)return(0,Z.jsx)(CS,{active:!0,paragraph:{rows:8}});let{stats:a,followUps:o,recentActivity:s}=e;return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`Total applications`,value:a.total})})}),(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`Still active`,value:a.active,valueStyle:{color:Z8.accent}})})}),(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`${o$(i.month)} ${i.year}`,value:a.thisMonth,suffix:a.thisMonth===1?`application`:`applications`})})}),(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)(YX.Text,{type:`secondary`,children:`Response rate`}),(0,Z.jsx)(bU,{percent:Math.round(a.responseRate*100),size:`small`,strokeColor:Z8.accent}),(0,Z.jsx)(YX.Text,{type:`secondary`,style:{fontSize:12},children:`Anything past “applied” counts as a reply`})]})})})]}),(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:24,lg:14,children:(0,Z.jsx)(J8,{onStartApplication:()=>r(!0)})}),(0,Z.jsx)(II,{xs:24,lg:10,children:(0,Z.jsx)(bF,{title:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(LR,{}),(0,Z.jsx)(`span`,{children:`Needs a follow-up`})]}),styles:{body:{maxHeight:320,overflowY:`auto`}},children:o.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`Nothing due — all caught up`}):(0,Z.jsx)(NH,{size:`small`,dataSource:o,renderItem:e=>(0,Z.jsxs)(NH.Item,{children:[(0,Z.jsx)(NH.Item.Meta,{title:(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(Xz,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)(YX.Text,{type:`danger`,children:[`due `,e.followUpOn]})]})}),(0,Z.jsx)(H8,{status:e.status})]})})})})]}),(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:24,lg:12,children:(0,Z.jsx)(bF,{title:`Pipeline`,children:(0,Z.jsx)(Pz,{direction:`vertical`,size:10,style:{width:`100%`},children:Object.entries(a.byStatus).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,Z.jsxs)(Xz,{align:`center`,gap:12,children:[(0,Z.jsx)(`div`,{style:{width:100},children:(0,Z.jsx)(H8,{status:e})}),(0,Z.jsx)(bU,{percent:a.total>0?Math.round(t/a.total*100):0,format:()=>t,size:`small`,style:{flex:1,marginBottom:0}})]},e))})})}),(0,Z.jsx)(II,{xs:24,lg:12,children:(0,Z.jsx)(bF,{title:`Recent activity`,styles:{body:{maxHeight:360,overflowY:`auto`}},children:s.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No status changes yet`}):(0,Z.jsx)(KY,{items:s.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsxs)(YX.Text,{children:[(0,Z.jsx)(dn,{to:`/applications/${e.applicationId}`,children:e.jobTitle}),` at `,e.companyName]}),(0,Z.jsxs)(YX.Text,{type:`secondary`,style:{fontSize:12},children:[e.fromStatus?`${YQ[e.fromStatus]} → ${YQ[e.toStatus]}`:`Applied (${YQ[e.toStatus]})`,` `,`· `,e.occurredOn]})]})}))})})})]}),(0,Z.jsx)(Y8,{open:n,onClose:()=>r(!1)})]})}function e5({periods:e,year:t,month:n,onSelect:r}){let i=(0,_.useMemo)(()=>e.map(e=>({key:`y:${e.year}`,title:(0,Z.jsx)(t5,{label:String(e.year),count:e.count,strong:!0}),children:(e.months??[]).map(e=>({key:`m:${e.year}:${e.month}`,title:(0,Z.jsx)(t5,{label:o$(e.month),count:e.count})}))})),[e]),a=(0,_.useMemo)(()=>t&&n?[`m:${t}:${n}`]:t?[`y:${t}`]:[],[t,n]),o=(0,_.useMemo)(()=>{let n=e[0],r=n?[`y:${n.year}`]:[];return t&&!r.includes(`y:${t}`)&&r.push(`y:${t}`),r},[e,t]);return e.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No applications yet`}):(0,Z.jsx)(rJ,{treeData:i,selectedKeys:a,defaultExpandedKeys:o,blockNode:!0,onSelect:e=>{let t=String(e[0]??``);if(t.startsWith(`m:`)){let[,e,n]=t.split(`:`);r({year:Number(e),month:Number(n)})}else t.startsWith(`y:`)?r({year:Number(t.slice(2))}):r({})}})}function t5({label:e,count:t,strong:n}){return(0,Z.jsxs)(`span`,{style:{display:`flex`,justifyContent:`space-between`,gap:12},children:[(0,Z.jsx)(YX.Text,{strong:n,children:e}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:t})]})}var n5={new:`green`,duplicate:`default`,error:`red`},r5={new:`New`,duplicate:`Duplicate — skipped`,error:`Error`};function i5({open:e,onClose:t}){let n=Tn(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`csv`),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null);function h(){i(null),c(null),u(null),m(null)}function g(){h(),t()}let v=e=>{let t=e.name.toLowerCase().endsWith(`.xlsx`)?`xlsx`:`csv`;return i(e),o(t),m(null),f(!0),u8.previewImport(e,t).then(c).catch(e=>m(e instanceof Error?e.message:`Could not read that file`)).finally(()=>f(!1)),!1};async function y(){if(r){f(!0),m(null);try{let e=await u8.commitImport(r,a);if(u(e),e.created>0)for(let e of[`applications`,`application`,`periods`,`dashboard`,`companies`,`company`,`search`])n.invalidateQueries({queryKey:[e]})}catch(e){m(e instanceof Error?e.message:`Import failed`)}finally{f(!1)}}}return(0,Z.jsx)(LH,{title:`Import applications`,open:e,onCancel:g,width:800,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(YX.Paragraph,{type:`secondary`,children:`CSV or .xlsx with the same columns Export produces: Position, Company, Date, Status, Notes. Rows that exactly match an application you have already logged are skipped automatically.`}),(0,Z.jsxs)(VZ.Dragger,{accept:`.csv,.xlsx`,maxCount:1,showUploadList:!1,beforeUpload:v,disabled:d,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(cQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a CSV or Excel file here`})]})]}),p&&(0,Z.jsx)(jp,{type:`error`,showIcon:!0,message:p}),s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Pz,{wrap:!0,children:[(0,Z.jsxs)(OY,{color:`green`,children:[s.totals.new,` new`]}),(0,Z.jsxs)(OY,{children:[s.totals.duplicate,` duplicate — will be skipped`]}),s.totals.error>0&&(0,Z.jsxs)(OY,{color:`red`,children:[s.totals.error,` error`]})]}),s.fileErrors.map(e=>(0,Z.jsx)(jp,{type:`warning`,showIcon:!0,message:e},e)),(0,Z.jsx)(hY,{size:`small`,rowKey:`rowNumber`,columns:[{title:`Row`,dataIndex:`rowNumber`,width:60},{title:`Position`,dataIndex:`jobTitle`,ellipsis:!0},{title:`Company`,dataIndex:`companyName`,ellipsis:!0},{title:`Date`,dataIndex:`appliedOn`,width:110},{title:`Status`,dataIndex:`status`,width:110,render:e=>e?YQ[e]:`—`},{title:`Result`,dataIndex:`verdict`,width:200,render:(e,t)=>(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(OY,{color:n5[e],children:r5[e]}),t.errors.length>0&&(0,Z.jsx)(YX.Text,{type:`danger`,style:{fontSize:12},children:t.errors.join(`; `)})]})}],dataSource:s.rows,pagination:{pageSize:10},scroll:{y:320}}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:h,children:`Choose a different file`}),(0,Z.jsxs)(Vk,{type:`primary`,loading:d,disabled:s.totals.new===0,onClick:y,children:[`Import `,s.totals.new,` application`,s.totals.new===1?``:`s`]})]})]}),l&&(0,Z.jsx)(zU,{status:l.failed>0?`warning`:`success`,title:`Imported ${l.created} application${l.created===1?``:`s`}`,subTitle:`${l.skipped} duplicate row${l.skipped===1?``:`s`} skipped`+(l.failed>0?`, ${l.failed} row${l.failed===1?``:`s`} failed`:``),extra:(0,Z.jsx)(Vk,{type:`primary`,onClick:g,children:`Done`})})]})})}function a5(){let e=Xe(),[t,n]=_n(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=(0,_.useMemo)(()=>{let e={};for(let n of[`q`,`source`,`sort`,`direction`,`cursor`,`from`,`to`]){let r=t.get(n);r&&(e[n]=r)}for(let n of[`year`,`month`]){let r=t.get(n);r&&(e[n]=Number(r))}for(let n of[`status`,`workMode`,`tags`]){let r=t.get(n);r&&(e[n]=r.split(`,`))}return e},[t]),{data:c,isLoading:l,isFetching:u}=p8(s),{data:d}=h8(),{data:f}=_8();function p(e){let r=new URLSearchParams(t);for(let[t,n]of Object.entries(e))n==null||n===``||Array.isArray(n)&&n.length===0?r.delete(t):r.set(t,Array.isArray(n)?n.join(`,`):String(n));r.delete(`cursor`),n(r,{replace:!0})}let m=[{title:`Applied`,dataIndex:`appliedOn`,width:118,sorter:!1,render:e=>(0,Z.jsx)(YX.Text,{children:e})},{title:`Company`,key:`company`,width:190,render:(t,n)=>(0,Z.jsx)(Vk,{type:`link`,style:{padding:0,height:`auto`},onClick:t=>{t.stopPropagation(),e(`/companies/${n.company.id}`)},children:n.company.name})},{title:`Job title`,dataIndex:`jobTitle`,render:(e,t)=>(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Text,{strong:!0,children:e}),t.location&&(0,Z.jsxs)(YX.Text,{type:`secondary`,style:{fontSize:12},children:[t.location,` · `,ZQ[t.workMode]]})]})},{title:`Status`,dataIndex:`status`,width:116,render:(e,t)=>(0,Z.jsx)(H8,{status:t.status})},{title:`Tags`,key:`tags`,width:210,render:(e,t)=>(0,Z.jsx)(Pz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(OY,{color:e.color??void 0,style:{marginInlineEnd:0},children:e.name},e.id))})},{title:`Source`,dataIndex:`sourceName`,width:120,render:e=>e??(0,Z.jsx)(YX.Text,{type:`secondary`,children:`—`})}],h=t.get(`from`),g=t.get(`to`),v=h&&g?[(0,Yk.default)(h),(0,Yk.default)(g)]:null,y=(0,Yk.default)(),b=[{label:`Today`,value:[y,y]},{label:`Yesterday`,value:[y.subtract(1,`day`),y.subtract(1,`day`)]},{label:`This week`,value:[y.startOf(`week`),y.endOf(`week`)]},{label:`This month`,value:[y.startOf(`month`),y.endOf(`month`)]},{label:`Last 7 days`,value:[y.subtract(6,`day`),y]},{label:`Last 30 days`,value:[y.subtract(29,`day`),y]}];function x(e){if(!e||!e[0]||!e[1]){p({from:``,to:``});return}p({from:e[0].format(`YYYY-MM-DD`),to:e[1].format(`YYYY-MM-DD`)})}let S=t.get(`year`)?Number(t.get(`year`)):void 0,C=t.get(`month`)?Number(t.get(`month`)):void 0,w=S&&C?`${o$(C)} ${S}`:S?String(S):`All applications`;return(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{xs:24,md:6,lg:5,children:(0,Z.jsx)(bF,{size:`small`,title:`By period`,extra:(S||C)&&(0,Z.jsx)(Vk,{size:`small`,type:`link`,onClick:()=>p({year:``,month:``}),children:`Clear`}),styles:{body:{maxHeight:`calc(100vh - 220px)`,overflowY:`auto`}},children:(0,Z.jsx)(e5,{periods:d?.periods??[],year:S,month:C,onSelect:e=>p({year:e.year??``,month:e.month??``})})})}),(0,Z.jsx)(II,{xs:24,md:18,lg:19,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:w}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:c?`${c.total} application${c.total===1?``:`s`}`:`Loading…`})]}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Iz,{menu:{items:[{key:`csv`,label:`Export as CSV`},{key:`xlsx`,label:`Export as Excel (.xlsx)`}],onClick:({key:e})=>{window.location.href=u8.exportUrl(s,e)}},children:(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(FZ,{}),children:`Export`})}),(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(WQ,{}),onClick:()=>o(!0),children:`Import`}),(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(cP,{}),onClick:()=>i(!0),children:`New application`})]})]}),(0,Z.jsx)(bF,{size:`small`,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(_V,{allowClear:!0,size:`large`,prefix:(0,Z.jsx)(xE,{}),placeholder:`Search by meaning — try “server-side developer” or “remote fintech”`,defaultValue:t.get(`q`)??``,onChange:e=>{e.target.value===``&&p({q:``})},onPressEnter:e=>p({q:e.target.value})}),(0,Z.jsxs)(Xz,{gap:8,wrap:!0,children:[(0,Z.jsx)(HR.RangePicker,{allowClear:!0,value:v,presets:b,format:`YYYY-MM-DD`,onChange:e=>x(e)}),(0,Z.jsx)(EE,{mode:`multiple`,allowClear:!0,placeholder:`Status`,style:{minWidth:180},suffixIcon:(0,Z.jsx)(aQ,{}),value:t.get(`status`)?.split(`,`)??[],onChange:e=>p({status:e}),options:GQ.map(e=>({value:e,label:YQ[e]}))}),(0,Z.jsx)(EE,{mode:`multiple`,allowClear:!0,placeholder:`Work mode`,style:{minWidth:160},value:t.get(`workMode`)?.split(`,`)??[],onChange:e=>p({workMode:e}),options:XQ.map(e=>({value:e,label:ZQ[e]}))}),(0,Z.jsx)(EE,{mode:`multiple`,allowClear:!0,placeholder:`Tags`,style:{minWidth:200},value:t.get(`tags`)?.split(`,`)??[],onChange:e=>p({tags:e}),options:(f?.tags??[]).map(e=>({value:e.name,label:e.name}))}),(0,Z.jsx)(EE,{style:{minWidth:170},value:t.get(`sort`)??`appliedOn`,onChange:e=>p({sort:e}),options:[{value:`appliedOn`,label:`Sort: date applied`},{value:`company`,label:`Sort: company`},{value:`jobTitle`,label:`Sort: job title`},{value:`status`,label:`Sort: status`}]}),(0,Z.jsx)(EE,{style:{width:130},value:t.get(`direction`)??`desc`,onChange:e=>p({direction:e}),options:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}]})]}),c?.searched&&!c.semanticReady&&(0,Z.jsx)(jp,{type:`info`,showIcon:!0,icon:(0,Z.jsx)(VQ,{}),message:`Results will improve shortly — the semantic model is still loading.`})]})}),(0,Z.jsx)(hY,{rowKey:`id`,columns:m,dataSource:c?.items??[],loading:l||u,pagination:!1,onRow:t=>({onClick:()=>e(`/applications/${t.id}`),style:{cursor:`pointer`}}),locale:{emptyText:(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:t.get(`q`)?`Nothing matched “${t.get(`q`)}”`:`No applications for this filter`})},footer:c?.hasMore?()=>(0,Z.jsx)(Xz,{justify:`center`,children:(0,Z.jsx)(gD,{title:`Loads the next page`,children:(0,Z.jsx)(Vk,{onClick:()=>o5(t,n,c.cursor),children:`Load more`})})}):void 0})]})}),(0,Z.jsx)(Y8,{open:r,onClose:()=>i(!1)}),(0,Z.jsx)(i5,{open:a,onClose:()=>o(!1)})]})}function o5(e,t,n){if(!n)return;let r=new URLSearchParams(e);r.set(`cursor`,n),t(r)}function s5({open:e,note:t,onClose:n,target:r}){let[i]=WB.useForm(),{message:a}=NC.useApp(),o=O8();return(0,Z.jsx)(LH,{open:e,title:t?`Edit note`:`New note`,okText:`Save`,destroyOnHidden:!0,onCancel:n,afterOpenChange:e=>{e&&(t?i.setFieldsValue({title:t.title,body:t.body,targetType:t.targetType,targetId:t.targetId,pinned:t.pinned}):(i.resetFields(),i.setFieldsValue({targetType:r?r.type:`standalone`,targetId:r?r.id:null,pinned:!1,body:``})))},onOk:async()=>{let e=await i.validateFields();await o.mutateAsync({...t?{id:t.id}:{},body:{title:e.title,body:e.body??``,targetType:e.targetType,targetId:e.targetType===`standalone`?null:e.targetId??null,pinned:e.pinned??!1}}),a.success(t?`Note updated`:`Note saved`),n()},children:(0,Z.jsxs)(WB,{form:i,layout:`vertical`,children:[(0,Z.jsx)(WB.Item,{name:`title`,label:`Title`,rules:[{required:!0,message:`Title is required`}],children:(0,Z.jsx)(_V,{placeholder:`Interview prep, salary research…`})}),(0,Z.jsx)(WB.Item,{name:`body`,label:`Note`,children:(0,Z.jsx)(_V.TextArea,{rows:8,placeholder:`Anything worth keeping`})}),r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WB.Item,{name:`targetType`,hidden:!0,children:(0,Z.jsx)(_V,{})}),(0,Z.jsx)(WB.Item,{name:`targetId`,hidden:!0,children:(0,Z.jsx)(_V,{})}),(0,Z.jsxs)(YX.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Attached to `,r.label]})]}):(0,Z.jsx)(c5,{form:i}),(0,Z.jsx)(WB.Item,{name:`pinned`,label:`Pinned`,valuePropName:`checked`,children:(0,Z.jsx)(XW,{})})]})})}function c5({form:e}){let t=WB.useWatch(`targetType`,e)??`standalone`,{data:n}=v8(),{data:r}=p8({limit:200}),i=(0,_.useMemo)(()=>t===`company`?(n?.companies??[]).map(e=>({value:e.id,label:e.name})):t===`application`?(r?.items??[]).map(e=>({value:e.id,label:`${e.jobTitle} — ${e.company.name}`})):[],[t,n,r]);return(0,Z.jsxs)(Xz,{gap:12,children:[(0,Z.jsx)(WB.Item,{name:`targetType`,label:`Attach to`,style:{flex:1},children:(0,Z.jsx)(EE,{options:[{value:`standalone`,label:`Nothing in particular`},{value:`company`,label:`A company`},{value:`application`,label:`An application`}],onChange:()=>e.setFieldValue(`targetId`,null)})}),t!==`standalone`&&(0,Z.jsx)(WB.Item,{name:`targetId`,label:t===`company`?`Company`:`Application`,style:{flex:2},rules:[{required:!0,message:`Pick what this note is about`}],children:(0,Z.jsx)(EE,{showSearch:!0,optionFilterProp:`label`,options:i})})]})}function l5(){let{id:e}=Qe(),t=Xe(),{message:n}=NC.useApp(),{data:r,isLoading:i}=m8(e),a=T8(),o=E8(),s=k8(),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(CS,{active:!0,paragraph:{rows:10}});let m=qQ(r.status);async function h(t){e&&(await a.mutateAsync({id:e,body:{status:t,comment:null}}),n.success(`Moved to ${YQ[t]}`))}return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`flex-start`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Vk,{type:`link`,icon:(0,Z.jsx)(WZ,{}),style:{padding:0},onClick:()=>t(`/applications`),children:`Back to applications`}),(0,Z.jsx)(YX.Title,{level:3,style:{margin:0},children:r.jobTitle}),(0,Z.jsxs)(Pz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/companies/${r.company.id}`,children:r.company.name}),(0,Z.jsxs)(YX.Text,{type:`secondary`,children:[`applied `,r.appliedOn]}),(0,Z.jsx)(H8,{status:r.status})]})]}),(0,Z.jsxs)(Pz,{wrap:!0,children:[m&&(0,Z.jsxs)(Vk,{type:`primary`,onClick:()=>void h(m),children:[`Move to `,YQ[m]]}),(0,Z.jsx)(EE,{style:{width:150},value:r.status,onChange:e=>void h(e),options:GQ.map(e=>({value:e,label:YQ[e]}))}),(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(QY,{}),onClick:()=>l(!0),children:`Edit`}),(0,Z.jsx)(VH,{title:`Delete this application?`,description:`Its notes and status history go too. This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{e&&(await o.mutateAsync(e),n.success(`Application deleted`),t(`/applications`))},children:(0,Z.jsx)(Vk,{danger:!0,icon:(0,Z.jsx)(YY,{})})})]})]}),(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:24,lg:14,children:(0,Z.jsx)(bF,{title:`Details`,children:(0,Z.jsxs)(nz,{column:{xs:1,sm:2},size:`small`,bordered:!0,children:[(0,Z.jsx)(nz.Item,{label:`Company`,children:r.company.name}),(0,Z.jsx)(nz.Item,{label:`Applied on`,children:r.appliedOn}),(0,Z.jsx)(nz.Item,{label:`Location`,children:r.location??`—`}),(0,Z.jsx)(nz.Item,{label:`Work mode`,children:ZQ[r.workMode]}),(0,Z.jsx)(nz.Item,{label:`Source`,children:r.sourceName??`—`}),(0,Z.jsx)(nz.Item,{label:`Follow up`,children:r.followUpOn??`—`}),(0,Z.jsx)(nz.Item,{label:`Salary`,span:2,children:r.salaryMin||r.salaryMax?`${r.salaryMin?.toLocaleString()??`?`} – ${r.salaryMax?.toLocaleString()??`?`} ${r.salaryCurrency??``}`:`—`}),(0,Z.jsx)(nz.Item,{label:`Posting`,span:2,children:r.jobUrl?(0,Z.jsx)(`a`,{href:r.jobUrl,target:`_blank`,rel:`noreferrer`,children:(0,Z.jsxs)(Pz,{size:4,children:[(0,Z.jsx)(mQ,{}),r.jobUrl]})}):`—`}),(0,Z.jsx)(nz.Item,{label:`Tags`,span:2,children:r.tags.length>0?(0,Z.jsx)(Pz,{size:4,wrap:!0,children:r.tags.map(e=>(0,Z.jsx)(OY,{children:e.name},e.id))}):`—`})]})})}),(0,Z.jsx)(II,{xs:24,lg:10,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(bF,{title:`Status history`,children:r.statusEvents.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No changes recorded`}):(0,Z.jsx)(KY,{items:r.statusEvents.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Text,{strong:!0,children:e.fromStatus?`${YQ[e.fromStatus]} → ${YQ[e.toStatus]}`:`Applied`}),(0,Z.jsx)(YX.Text,{type:`secondary`,style:{fontSize:12},children:e.occurredOn}),e.comment&&(0,Z.jsx)(YX.Text,{children:e.comment})]})}))})}),(0,Z.jsx)(bF,{title:`Notes (${r.notes.length})`,extra:(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(cP,{}),onClick:()=>p(!0),children:`Add note`}),children:r.notes.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No notes yet`}):(0,Z.jsx)(NH,{size:`small`,dataSource:r.notes,renderItem:e=>(0,Z.jsx)(NH.Item,{actions:[(0,Z.jsx)(Vk,{type:`text`,icon:(0,Z.jsx)(QY,{}),onClick:()=>d(e)},`edit`),(0,Z.jsx)(VH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await s.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Vk,{type:`text`,danger:!0,icon:(0,Z.jsx)(YY,{})})},`delete`)],children:(0,Z.jsx)(NH.Item.Meta,{title:(0,Z.jsxs)(Pz,{size:8,children:[e.pinned&&(0,Z.jsx)(CQ,{style:{color:`#faad14`}}),(0,Z.jsx)(YX.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)(YX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:4,expandable:!0,symbol:`more`},children:e.body})})})})})]})})]}),(0,Z.jsx)(Y8,{open:c,onClose:()=>l(!1),application:r}),(0,Z.jsx)(s5,{open:f||u!==null,note:u,target:{type:`application`,id:r.id,label:r.jobTitle},onClose:()=>{p(!1),d(null)}})]})}function u5(){let e=Xe(),[t,n]=(0,_.useState)(``),r=U8(t,300),{data:i,isLoading:a}=v8(r?{q:r}:{});return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:`Companies`}),(0,Z.jsx)(_V,{allowClear:!0,prefix:(0,Z.jsx)(xE,{}),placeholder:`Find a company`,style:{maxWidth:320},value:t,onChange:e=>n(e.target.value)})]}),(0,Z.jsx)(bF,{size:`small`,children:(0,Z.jsx)(hY,{rowKey:`id`,size:`middle`,loading:a,columns:[{title:`Company`,dataIndex:`name`,render:(e,t)=>(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Text,{strong:!0,children:e}),t.website&&(0,Z.jsx)(YX.Link,{href:t.website,target:`_blank`,style:{fontSize:12},children:t.website.replace(/^https?:\/\//,``)})]}),sorter:(e,t)=>e.name.localeCompare(t.name)},{title:`Applications`,dataIndex:`applicationCount`,width:140,align:`right`,sorter:(e,t)=>e.applicationCount-t.applicationCount,defaultSortOrder:`descend`,render:e=>(0,Z.jsx)(YX.Text,{strong:e>2,type:e>2?`warning`:void 0,children:e})},{title:`Active`,dataIndex:`activeCount`,width:90,align:`right`},{title:`Last applied`,dataIndex:`lastAppliedOn`,width:130,sorter:(e,t)=>(e.lastAppliedOn??``).localeCompare(t.lastAppliedOn??``),render:e=>e??(0,Z.jsx)(YX.Text,{type:`secondary`,children:`—`})},{title:`Tags`,key:`tags`,width:260,render:(e,t)=>(0,Z.jsx)(Pz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(OY,{style:{marginInlineEnd:0},children:e.name},e.id))})}],dataSource:i?.companies??[],pagination:{pageSize:25,hideOnSinglePage:!0},onRow:t=>({onClick:()=>e(`/companies/${t.id}`),style:{cursor:`pointer`}})})})]})}function d5(){let{id:e}=Qe(),t=Xe(),{message:n}=NC.useApp(),{data:r,isLoading:i}=y8(e),{data:a}=b8(e?{targetType:`company`,targetId:e}:{}),{data:o}=_8(),s=D8(),c=k8(),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(CS,{active:!0,paragraph:{rows:8}});let{company:p,applications:m}=r,h=m.filter(e=>[`applied`,`screening`,`interview`].includes(e.status)).length;return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Vk,{type:`link`,icon:(0,Z.jsx)(WZ,{}),style:{padding:0},onClick:()=>t(`/companies`),children:`Back to companies`}),(0,Z.jsx)(YX.Title,{level:3,style:{margin:0},children:p.name}),p.website&&(0,Z.jsx)(YX.Link,{href:p.website,target:`_blank`,children:p.website})]}),(0,Z.jsxs)(BU,{gutter:[16,16],children:[(0,Z.jsx)(II,{xs:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`Applications`,value:m.length})})}),(0,Z.jsx)(II,{xs:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`Still active`,value:h,valueStyle:{color:Z8.accent}})})}),(0,Z.jsx)(II,{xs:24,md:12,children:(0,Z.jsx)(bF,{children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)(YX.Text,{type:`secondary`,children:`Company tags`}),(0,Z.jsx)(EE,{mode:`tags`,style:{width:`100%`},placeholder:`fintech, remote-first…`,value:p.tags.map(e=>e.name),options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),onChange:t=>{e&&s.mutate({id:e,body:{tags:t}})}})]})})})]}),(0,Z.jsx)(bF,{title:`Application history`,children:(0,Z.jsx)(hY,{rowKey:`id`,size:`middle`,columns:[{title:`Applied`,dataIndex:`appliedOn`,width:120},{title:`Job title`,dataIndex:`jobTitle`,render:e=>(0,Z.jsx)(YX.Text,{strong:!0,children:e})},{title:`Status`,dataIndex:`status`,width:120,render:(e,t)=>(0,Z.jsx)(H8,{status:t.status})},{title:`Source`,dataIndex:`sourceName`,width:130}],dataSource:m,pagination:!1,onRow:e=>({onClick:()=>t(`/applications/${e.id}`),style:{cursor:`pointer`}})})}),(0,Z.jsx)(bF,{title:`Notes about ${p.name}`,extra:(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(cP,{}),onClick:()=>f(!0),children:`Add note`}),children:(a?.notes??[]).length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No notes about this company`}):(0,Z.jsx)(NH,{dataSource:a?.notes??[],renderItem:e=>(0,Z.jsx)(NH.Item,{actions:[(0,Z.jsx)(Vk,{type:`text`,icon:(0,Z.jsx)(QY,{}),onClick:()=>u(e)},`edit`),(0,Z.jsx)(VH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await c.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Vk,{type:`text`,danger:!0,icon:(0,Z.jsx)(YY,{})})},`delete`)],children:(0,Z.jsx)(NH.Item.Meta,{title:(0,Z.jsxs)(Pz,{size:8,children:[e.pinned&&(0,Z.jsx)(CQ,{style:{color:`#faad14`}}),(0,Z.jsx)(YX.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)(YX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e.body})})})})}),(0,Z.jsx)(s5,{open:d||l!==null,note:l,target:{type:`company`,id:p.id,label:p.name},onClose:()=>{f(!1),u(null)}})]})}function f5(){let{message:e}=NC.useApp(),[t,n]=(0,_.useState)(`all`),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),{data:l,isLoading:u}=b8(t===`all`?{}:{targetType:t}),d=k8(),f=l?.notes??[],p=(0,_.useMemo)(()=>{let e=r.trim().toLowerCase();return e?f.filter(t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||(t.targetLabel?.toLowerCase().includes(e)??!1)):f},[f,r]);return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:`Notes`}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(XI,{value:t,onChange:e=>n(e),options:[{label:`All`,value:`all`},{label:`Standalone`,value:`standalone`},{label:`Companies`,value:`company`},{label:`Applications`,value:`application`}]}),(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(cP,{}),onClick:()=>c(!0),children:`New note`})]})]}),(0,Z.jsx)(_V,{allowClear:!0,prefix:(0,Z.jsx)(xE,{}),placeholder:`Search notes by title, body, or what they're attached to`,value:r,onChange:e=>i(e.target.value)}),(0,Z.jsx)(bF,{size:`small`,loading:u,children:p.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:r?`Nothing matched “${r}”`:`No notes here yet`}):(0,Z.jsx)(NH,{dataSource:p,renderItem:t=>(0,Z.jsx)(NH.Item,{actions:[(0,Z.jsx)(Vk,{type:`text`,icon:(0,Z.jsx)(QY,{}),onClick:()=>o(t)},`edit`),(0,Z.jsx)(VH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await d.mutateAsync(t.id),e.success(`Note deleted`)},children:(0,Z.jsx)(Vk,{type:`text`,danger:!0,icon:(0,Z.jsx)(YY,{})})},`delete`)],children:(0,Z.jsx)(NH.Item.Meta,{title:(0,Z.jsxs)(Pz,{size:8,wrap:!0,children:[t.pinned&&(0,Z.jsx)(CQ,{style:{color:`#faad14`}}),(0,Z.jsx)(YX.Text,{strong:!0,children:t.title}),(0,Z.jsx)(p5,{note:t})]}),description:(0,Z.jsx)(YX.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:3,expandable:!0,symbol:`more`},children:t.body})})})})}),(0,Z.jsx)(s5,{open:s||a!==null,note:a,onClose:()=>{c(!1),o(null)}})]})}function p5({note:e}){if(e.targetType===`standalone`)return(0,Z.jsx)(OY,{children:`general`});if(!e.targetId)return(0,Z.jsx)(OY,{children:`unlinked`});let t=e.targetType===`company`?`/companies/${e.targetId}`:`/applications/${e.targetId}`;return(0,Z.jsx)(dn,{to:t,children:(0,Z.jsxs)(OY,{color:`blue`,children:[e.targetType,`: `,e.targetLabel??`view`]})})}function m5({open:e,onClose:t,opening:n}){let[r]=WB.useForm(),{message:i}=NC.useApp(),a=!!n,o=M8(),s=N8(),{data:c}=S8(WB.useWatch(`companyName`,r)??``);(0,_.useEffect)(()=>{e&&(n?r.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,savedOn:(0,Yk.default)(n.savedOn),jobUrl:n.jobUrl??void 0,location:n.location??void 0,workMode:n.workMode,sourceName:n.sourceName??void 0,salaryMin:n.salaryMin,salaryMax:n.salaryMax,salaryCurrency:n.salaryCurrency??void 0,notes:n.notes??void 0}):(r.resetFields(),r.setFieldsValue({savedOn:(0,Yk.default)(),workMode:`unspecified`})))},[e,n,r]);let l=(0,_.useMemo)(()=>(c?.companies??[]).map(e=>({value:e.name})),[c]);async function u(e){let c={companyName:e.companyName,jobTitle:e.jobTitle,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,notes:e.notes??null,...a?{}:{savedOn:e.savedOn.format(`YYYY-MM-DD`)}};try{n?(await s.mutateAsync({id:n.id,body:c}),i.success(`Opening updated`)):(await o.mutateAsync(c),i.success(`Opening saved`)),t()}catch(e){e instanceof Q6&&e.fieldErrors.length>0?(r.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),i.error(`Please check the highlighted fields`)):i.error(e instanceof Error?e.message:`Could not save`)}}return(0,Z.jsxs)(Tz,{title:a?`Edit opening`:`Save opening for later`,open:e,onClose:t,width:560,destroyOnHidden:!0,extra:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Vk,{type:`primary`,loading:o.isPending||s.isPending,onClick:()=>r.submit(),children:a?`Save changes`:`Save opening`})]}),children:[(0,Z.jsx)(YX.Paragraph,{type:`secondary`,children:`For a role you found but are not ready to apply to yet — no status, no tags, just enough to find it again. Convert it into a real application when you are ready.`}),(0,Z.jsxs)(WB,{form:r,layout:`vertical`,onFinish:u,requiredMark:`optional`,children:[(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:12,children:(0,Z.jsx)(WB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(NE,{options:l,placeholder:`Start typing — existing companies appear`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(II,{span:12,children:(0,Z.jsx)(WB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(_V,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`savedOn`,label:`Found on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(HR,{style:{width:`100%`},format:`YYYY-MM-DD`,disabled:a})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(EE,{options:XQ.map(e=>({value:e,label:ZQ[e]}))})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(_V,{placeholder:`Stockholm`})})})]}),(0,Z.jsxs)(BU,{gutter:16,children:[(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(LL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(LL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(II,{span:8,children:(0,Z.jsx)(WB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(_V,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(WB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(_V,{placeholder:`LinkedIn, referral…`})}),(0,Z.jsx)(WB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(_V,{placeholder:`https://…`})}),(0,Z.jsx)(WB.Item,{name:`notes`,label:`Notes`,children:(0,Z.jsx)(_V.TextArea,{rows:4,placeholder:`Why this looked interesting, what you're missing to apply…`})})]})]})}function h5(){let e=Xe(),{message:t}=NC.useApp(),[n,r]=(0,_.useState)(`active`),{data:i,isLoading:a}=A8(n===`archived`?{archived:!0}:{}),{data:o}=_8(),s=P8(),c=F8(),l=N8(),u=(0,_.useMemo)(()=>{let e=i?.openings??[];return n===`archived`?e.filter(e=>e.archived):e},[i,n]),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(void 0),[h,g]=(0,_.useState)(null),[v]=WB.useForm();function y(e){g(e),v.setFieldsValue({appliedOn:(0,Yk.default)(),status:`applied`,tags:[]})}async function b(n){if(h)try{let r=await c.mutateAsync({id:h.id,body:{appliedOn:n.appliedOn.format(`YYYY-MM-DD`),status:n.status,tags:n.tags??[]}});t.success(`Converted to an application`),g(null),e(`/applications/${r.id}`)}catch(e){t.error(e instanceof Error?e.message:`Could not convert`)}}async function x(e){try{await l.mutateAsync({id:e.id,body:{archived:!1}}),t.success(`Opening restored`)}catch(e){t.error(e instanceof Error?e.message:`Could not restore`)}}let S=[{title:`Company`,dataIndex:[`company`,`name`]},{title:`Job title`,dataIndex:`jobTitle`},{title:`Found on`,dataIndex:`savedOn`,width:120},{title:`Location`,key:`location`,render:(e,t)=>[t.location,ZQ[t.workMode]].filter(Boolean).join(` · `)||(0,Z.jsx)(YX.Text,{type:`secondary`,children:`—`})},{title:`Source`,dataIndex:`sourceName`,render:e=>e??`—`}],C=e=>e.jobUrl&&(0,Z.jsx)(gD,{title:`Open job posting`,children:(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(mQ,{}),href:e.jobUrl,target:`_blank`,rel:`noreferrer`})}),w=e=>(0,Z.jsx)(VH,{title:`Delete this opening?`,description:`This removes it for good and cannot be undone.`,onConfirm:()=>s.mutate(e.id),okText:`Delete`,okButtonProps:{danger:!0},children:(0,Z.jsx)(Vk,{size:`small`,danger:!0,children:`Delete`})}),T=[...S,{title:``,key:`actions`,width:260,render:(e,t)=>(0,Z.jsxs)(Pz,{onClick:e=>e.stopPropagation(),children:[C(t),(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(qB,{}),onClick:()=>y(t),children:`Convert`}),(0,Z.jsx)(Vk,{size:`small`,onClick:()=>{m(t),f(!0)},children:`Edit`}),w(t)]})}],E=[...S,{title:`Archived because`,key:`reason`,width:160,render:(e,t)=>t.convertedApplicationId?(0,Z.jsx)(dn,{to:`/applications/${t.convertedApplicationId}`,children:(0,Z.jsx)(OY,{color:`blue`,children:`Converted`})}):(0,Z.jsx)(OY,{children:`Archived by hand`})},{title:``,key:`actions`,width:220,render:(e,t)=>(0,Z.jsxs)(Pz,{onClick:e=>e.stopPropagation(),children:[C(t),(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(EQ,{}),loading:l.isPending,onClick:()=>x(t),children:`Restore`}),w(t)]})}];return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Xz,{justify:`space-between`,align:`center`,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:`Job openings`}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:n===`active`?`Saved for later — convert one to a real application when you're ready to apply.`:`Openings that were converted into an application or archived by hand.`})]}),(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(cP,{}),onClick:()=>{m(void 0),f(!0)},children:`Save opening for later`})]}),(0,Z.jsx)(XI,{value:n,onChange:r,options:[{label:`Active`,value:`active`},{label:`Archived`,value:`archived`}]}),(0,Z.jsx)(bF,{size:`small`,children:(0,Z.jsx)(hY,{rowKey:`id`,columns:n===`archived`?E:T,dataSource:u,loading:a,pagination:!1,locale:{emptyText:(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:n===`active`?`Nothing saved yet — use “Save opening for later” for a role you're not ready to apply to.`:`No archived openings.`})}})}),(0,Z.jsx)(m5,{open:d,onClose:()=>f(!1),opening:p}),(0,Z.jsx)(LH,{title:h?`Convert "${h.jobTitle}" at ${h.company.name}`:``,open:!!h,onCancel:()=>g(null),onOk:()=>v.submit(),okText:`Create application`,confirmLoading:c.isPending,children:(0,Z.jsxs)(WB,{form:v,layout:`vertical`,onFinish:b,children:[(0,Z.jsx)(WB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0}],children:(0,Z.jsx)(HR,{style:{width:`100%`},format:`YYYY-MM-DD`})}),(0,Z.jsx)(WB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(EE,{options:GQ.map(e=>({value:e,label:YQ[e]}))})}),(0,Z.jsx)(WB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(EE,{mode:`tags`,options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),placeholder:`fintech, remote-ok…`,tokenSeparators:[`,`]})})]})})]})}var g5={companies:`Companies`,applications:`Applications`,tags:`Tags`,tagLinks:`Tag links`,notes:`Notes`,statusEvents:`Status events`,jobOpenings:`Job openings`};function _5({counts:e}){return(0,Z.jsx)(nz,{size:`small`,column:2,bordered:!0,children:Object.entries(e).map(([e,t])=>(0,Z.jsx)(nz.Item,{label:g5[e]??e,children:t},e))})}function v5(){let{message:e}=NC.useApp(),{data:t,isLoading:n}=I8(),r=L8(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{c.current&&clearInterval(c.current)},[]);function l(t){LH.confirm({title:`Switch to "${t}"?`,content:"The server restarts to connect to the new target. This page will reconnect and reload automatically once it is back — under `npm run dev`, that may require restarting it by hand.",okText:`Switch and restart`,onOk:async()=>{try{await r.mutateAsync(t)}catch(t){e.error(t instanceof Error?t.message:`Could not switch database`);return}s(!0),c.current=setInterval(()=>{u8.getDbTargets().then(()=>{c.current&&clearInterval(c.current),window.location.reload()}).catch(()=>{})},500)}})}if(o)return(0,Z.jsx)(bF,{title:`Database`,children:(0,Z.jsx)(zU,{icon:(0,Z.jsx)(CU,{spin:!0}),title:`Reconnecting…`,subTitle:`Waiting for the server to come back up.`})});let u=t?.targets??[];return(0,Z.jsx)(bF,{title:`Database`,loading:n,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(YX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:[`Connection settings live in `,(0,Z.jsx)(`code`,{children:`.env`}),` and are never shown or editable here.`,u.length<=1&&` Only one target is configured, so there is nothing to switch between.`]}),(0,Z.jsx)(nz,{size:`small`,column:1,bordered:!0,children:(0,Z.jsx)(nz.Item,{label:`Active target`,children:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)($Z,{}),t?.active,` (`,u.find(e=>e.name===t?.active)?.driver,`)`]})})}),u.length>1&&(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(EE,{style:{width:220},value:i??t?.active,options:u.map(e=>({value:e.name,label:`${e.name} (${e.driver})`})),onChange:a}),(0,Z.jsx)(Vk,{type:`primary`,disabled:!i||i===t?.active,loading:r.isPending,onClick:()=>i&&l(i),children:`Switch`})]})]})})}function y5(){let{message:e}=NC.useApp(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);function p(){n(null),i(null),o(null),u(null)}function m(){p(),f(!1)}let h=e=>(n(e),u(null),c(!0),u8.previewBackup(e).then(i).catch(e=>u(e instanceof Error?e.message:`Could not read that file`)).finally(()=>c(!1)),!1);function g(){t&&LH.confirm({title:`Replace all data in the active database?`,content:`Every table is wiped and recreated from this backup. This cannot be undone.`,okText:`Restore`,okButtonProps:{danger:!0},onOk:async()=>{c(!0),u(null);try{let e=await u8.commitBackup(t);o(e)}catch(t){e.error(t instanceof Error?t.message:`Restore failed`)}finally{c(!1)}}})}return(0,Z.jsxs)(bF,{title:`Backup & restore`,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(YX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`A full-fidelity snapshot of every table — every field, every relation, driver-agnostic. Not the same as the CSV/Excel export elsewhere in the app, which is a lossy report meant for people to read. This file is scrambled (gzip + obfuscation) so it isn't plain, readable JSON at rest — that's an obfuscation step, not encryption, and does not protect the personal data inside from anyone who actually wants it.`}),(0,Z.jsx)(Vk,{icon:(0,Z.jsx)($Z,{}),onClick:()=>{window.location.href=u8.backupExportUrl},children:`Export backup`}),(0,Z.jsx)(Vk,{onClick:()=>f(!0),children:`Restore from backup…`})]}),(0,Z.jsx)(LH,{title:`Restore from backup`,open:d,onCancel:m,width:600,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!r&&!a&&(0,Z.jsxs)(VZ.Dragger,{accept:`.jtbak`,maxCount:1,showUploadList:!1,beforeUpload:h,disabled:s,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(cQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a JobTrack backup file (.jtbak) here`})]}),l&&(0,Z.jsx)(jp,{type:`error`,showIcon:!0,message:l}),r&&!a&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(YX.Text,{type:`secondary`,children:[`Backup taken `,new Date(r.exportedAt).toLocaleString(),`. Restoring will replace everything currently in the active database with:`]}),(0,Z.jsx)(_5,{counts:r.counts}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:p,children:`Choose a different file`}),(0,Z.jsx)(Vk,{type:`primary`,danger:!0,loading:s,onClick:g,children:`Restore`})]})]}),a&&(0,Z.jsx)(zU,{status:`success`,title:`Restore complete`,extra:(0,Z.jsxs)(Pz,{direction:`vertical`,style:{width:`100%`},children:[(0,Z.jsx)(_5,{counts:a.counts}),(0,Z.jsx)(Vk,{type:`primary`,onClick:()=>window.location.reload(),children:`Reload`})]})})]})})]})}var b5=`CLEAR`;function x5(){let{message:e}=NC.useApp(),{data:t,isLoading:n}=R8(),r=z8(),i=B8(),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``);function l(){o(!1),c(``)}function u(){r.mutate(void 0,{onSuccess:()=>{e.success(`Database cleared`),l()},onError:t=>e.error(t instanceof Error?t.message:`Could not clear the database`)})}function d(){i.mutate(void 0,{onSuccess:t=>e.success(`Seeded ${t.applications} applications and ${t.companies} companies`),onError:t=>e.error(t instanceof Error?t.message:`Could not seed the database`)})}let f=t?.counts??{};return(0,Z.jsxs)(bF,{title:`Reset & demo data`,loading:n,children:[(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(YX.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`Wipe everything in the active database, or — only while it's empty — fill it with a realistic multi-year demo dataset to explore the app with.`}),!t?.empty&&(0,Z.jsx)(_5,{counts:f}),(0,Z.jsxs)(Pz,{wrap:!0,children:[t?.empty&&(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(nQ,{}),loading:i.isPending,onClick:d,children:`Seed with demo data`}),(0,Z.jsx)(Vk,{danger:!0,disabled:t?.empty,onClick:()=>o(!0),children:`Clear database…`})]})]}),(0,Z.jsx)(LH,{title:`Clear the active database?`,open:a,onCancel:l,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(jp,{type:`warning`,showIcon:!0,message:`This permanently deletes every row below. There is no undo — export a backup first if you might want this data again.`}),(0,Z.jsx)(_5,{counts:f}),(0,Z.jsxs)(YX.Text,{children:[`Type `,(0,Z.jsx)(YX.Text,{code:!0,children:b5}),` to confirm.`]}),(0,Z.jsx)(_V,{value:s,onChange:e=>c(e.target.value),placeholder:b5,onPressEnter:()=>s===b5&&u()}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:l,children:`Cancel`}),(0,Z.jsx)(Vk,{danger:!0,type:`primary`,disabled:s!==b5,loading:r.isPending,onClick:u,children:`Clear database`})]})]})})]})}function S5(){let{data:e,isLoading:t}=V8(),n=e?`${e.name} ${e.version}`:``;return(0,Z.jsx)(bF,{title:`About`,loading:t,children:(0,Z.jsxs)(nz,{size:`small`,column:1,bordered:!0,children:[(0,Z.jsx)(nz.Item,{label:`Running`,children:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(dQ,{}),(0,Z.jsxs)(YX.Text,{copyable:{text:n},children:[(0,Z.jsx)(`code`,{children:e?.name}),` `,e?.version]})]})}),(0,Z.jsx)(nz.Item,{label:`Database driver`,children:e?.driver})]})})}function C5(){return(0,Z.jsxs)(Pz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(YX.Title,{level:4,style:{margin:0},children:`Settings`}),(0,Z.jsx)(v5,{}),(0,Z.jsx)(y5,{}),(0,Z.jsx)(x5,{}),(0,Z.jsx)(S5,{})]})}var w5=`jobtrack.theme`,T5=[{key:`/dashboard`,icon:(0,Z.jsx)(XZ,{}),label:(0,Z.jsx)(dn,{to:`/dashboard`,children:`Dashboard`})},{key:`/applications`,icon:(0,Z.jsx)(bQ,{}),label:(0,Z.jsx)(dn,{to:`/applications`,children:`Applications`})},{key:`/openings`,icon:(0,Z.jsx)(qZ,{}),label:(0,Z.jsx)(dn,{to:`/openings`,children:`Openings`})},{key:`/companies`,icon:(0,Z.jsx)(FQ,{}),label:(0,Z.jsx)(dn,{to:`/companies`,children:`Companies`})},{key:`/notes`,icon:(0,Z.jsx)($z,{}),label:(0,Z.jsx)(dn,{to:`/notes`,children:`Notes`})},{key:`/settings`,icon:(0,Z.jsx)(MQ,{}),label:(0,Z.jsx)(dn,{to:`/settings`,children:`Settings`})}],E5=[{key:`light`,icon:(0,Z.jsx)(RQ,{}),label:`Light`},{key:`dark`,icon:(0,Z.jsx)(_Q,{}),label:`Dark`}];function D5(){let[e,t]=(0,_.useState)(()=>{try{let e=localStorage.getItem(w5);if(e)return e===`dark`}catch{}return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1});(0,_.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`);try{localStorage.setItem(w5,e?`dark`:`light`)}catch{}},[e]);let n=qe(),r=(0,_.useMemo)(()=>{let e=T5.find(e=>n.pathname.startsWith(e.key));return e?[e.key]:[`/dashboard`]},[n.pathname]);return(0,Z.jsx)(Nh,{theme:Q8(e?`dark`:`light`),children:(0,Z.jsx)(NC,{children:(0,Z.jsxs)(EV,{style:{minHeight:`100vh`},children:[(0,Z.jsxs)(EV.Header,{style:{display:`flex`,alignItems:`center`,gap:24,paddingInline:24,borderBottom:`1px solid ${Z8.border}`,position:`sticky`,top:0,zIndex:10},children:[(0,Z.jsxs)(YX.Title,{level:4,style:{margin:0,whiteSpace:`nowrap`},children:[`Job`,(0,Z.jsx)(`span`,{style:{color:Z8.accent},children:`Track`})]}),(0,Z.jsx)(Fk,{mode:`horizontal`,selectedKeys:r,items:T5,style:{flex:1,minWidth:0,borderBottom:`none`}}),(0,Z.jsx)(Iz,{trigger:[`click`],menu:{items:E5,selectable:!0,selectedKeys:[e?`dark`:`light`],onClick:({key:e})=>t(e===`dark`)},children:(0,Z.jsx)(Vk,{icon:e?(0,Z.jsx)(_Q,{}):(0,Z.jsx)(RQ,{}),"aria-label":`Theme settings`,children:`Theme`})})]}),(0,Z.jsx)(EV.Content,{style:{padding:24},children:(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(xt,{path:`/`,element:(0,Z.jsx)(bt,{to:`/dashboard`,replace:!0})}),(0,Z.jsx)(xt,{path:`/dashboard`,element:(0,Z.jsx)($8,{})}),(0,Z.jsx)(xt,{path:`/applications`,element:(0,Z.jsx)(a5,{})}),(0,Z.jsx)(xt,{path:`/applications/:id`,element:(0,Z.jsx)(l5,{})}),(0,Z.jsx)(xt,{path:`/openings`,element:(0,Z.jsx)(h5,{})}),(0,Z.jsx)(xt,{path:`/companies`,element:(0,Z.jsx)(u5,{})}),(0,Z.jsx)(xt,{path:`/companies/:id`,element:(0,Z.jsx)(d5,{})}),(0,Z.jsx)(xt,{path:`/notes`,element:(0,Z.jsx)(f5,{})}),(0,Z.jsx)(xt,{path:`/settings`,element:(0,Z.jsx)(C5,{})}),(0,Z.jsx)(xt,{path:`*`,element:(0,Z.jsx)(bt,{to:`/dashboard`,replace:!0})})]})})]})})})}var O5=new Pr({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});(0,v.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(_.StrictMode,{children:(0,Z.jsx)(En,{client:O5,children:(0,Z.jsx)(un,{children:(0,Z.jsx)(D5,{})})})}));
|
|
444
|
+
//# sourceMappingURL=index-Bqi0Bj8-.js.map
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-label="JobTrack">
|
|
2
|
-
<title>JobTrack</title>
|
|
3
|
-
|
|
4
|
-
<!--
|
|
5
|
-
A track of waypoints climbing toward a goal.
|
|
6
|
-
|
|
7
|
-
"Track" is both what the app does and the shape of the mark: three stages on a path,
|
|
8
|
-
each more prominent than the last, ending in a highlighted node. It reads as progress
|
|
9
|
-
through a pipeline without resorting to a briefcase, a checkmark, or a bar chart —
|
|
10
|
-
the last of which would misrepresent an app that is deliberately a list, not a report.
|
|
11
|
-
|
|
12
|
-
Geometry is tuned for 16px: a 3px stroke on a 32 grid is ~9% of the width, which
|
|
13
|
-
survives downsampling, and the terminal node is nearly twice the radius of the first
|
|
14
|
-
so the direction of travel stays legible when the detail collapses.
|
|
15
|
-
-->
|
|
16
|
-
|
|
17
|
-
<defs>
|
|
18
|
-
<linearGradient id="tile" x1="0" y1="0" x2="32" y2="32" gradientUnits="userSpaceOnUse">
|
|
19
|
-
<!-- Indigo 500 → 700, straddling the #4f46e5 primary used in the app theme. -->
|
|
20
|
-
<stop offset="0" stop-color="#6366f1" />
|
|
21
|
-
<stop offset="1" stop-color="#4338ca" />
|
|
22
|
-
</linearGradient>
|
|
23
|
-
</defs>
|
|
24
|
-
|
|
25
|
-
<rect width="32" height="32" rx="7.5" fill="url(#tile)" />
|
|
26
|
-
|
|
27
|
-
<!-- The path already traveled, held back so the nodes carry the emphasis. -->
|
|
28
|
-
<path
|
|
29
|
-
d="M8 23 L14.5 16.5 L23.5 9.5"
|
|
30
|
-
fill="none"
|
|
31
|
-
stroke="#ffffff"
|
|
32
|
-
stroke-width="3"
|
|
33
|
-
stroke-linecap="round"
|
|
34
|
-
stroke-linejoin="round"
|
|
35
|
-
opacity="0.45"
|
|
36
|
-
/>
|
|
37
|
-
|
|
38
|
-
<!-- Earlier stages: present, but clearly behind. -->
|
|
39
|
-
<circle cx="8" cy="23" r="3" fill="#ffffff" opacity="0.6" />
|
|
40
|
-
<circle cx="14.5" cy="16.5" r="3" fill="#ffffff" opacity="0.8" />
|
|
41
|
-
|
|
42
|
-
<!-- The current stage: solid, ringed, and the only fully opaque element. -->
|
|
43
|
-
<circle cx="23.5" cy="9.5" r="4.5" fill="#ffffff" />
|
|
44
|
-
<circle cx="23.5" cy="9.5" r="1.75" fill="#4338ca" />
|
|
45
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-label="JobTrack">
|
|
2
|
+
<title>JobTrack</title>
|
|
3
|
+
|
|
4
|
+
<!--
|
|
5
|
+
A track of waypoints climbing toward a goal.
|
|
6
|
+
|
|
7
|
+
"Track" is both what the app does and the shape of the mark: three stages on a path,
|
|
8
|
+
each more prominent than the last, ending in a highlighted node. It reads as progress
|
|
9
|
+
through a pipeline without resorting to a briefcase, a checkmark, or a bar chart —
|
|
10
|
+
the last of which would misrepresent an app that is deliberately a list, not a report.
|
|
11
|
+
|
|
12
|
+
Geometry is tuned for 16px: a 3px stroke on a 32 grid is ~9% of the width, which
|
|
13
|
+
survives downsampling, and the terminal node is nearly twice the radius of the first
|
|
14
|
+
so the direction of travel stays legible when the detail collapses.
|
|
15
|
+
-->
|
|
16
|
+
|
|
17
|
+
<defs>
|
|
18
|
+
<linearGradient id="tile" x1="0" y1="0" x2="32" y2="32" gradientUnits="userSpaceOnUse">
|
|
19
|
+
<!-- Indigo 500 → 700, straddling the #4f46e5 primary used in the app theme. -->
|
|
20
|
+
<stop offset="0" stop-color="#6366f1" />
|
|
21
|
+
<stop offset="1" stop-color="#4338ca" />
|
|
22
|
+
</linearGradient>
|
|
23
|
+
</defs>
|
|
24
|
+
|
|
25
|
+
<rect width="32" height="32" rx="7.5" fill="url(#tile)" />
|
|
26
|
+
|
|
27
|
+
<!-- The path already traveled, held back so the nodes carry the emphasis. -->
|
|
28
|
+
<path
|
|
29
|
+
d="M8 23 L14.5 16.5 L23.5 9.5"
|
|
30
|
+
fill="none"
|
|
31
|
+
stroke="#ffffff"
|
|
32
|
+
stroke-width="3"
|
|
33
|
+
stroke-linecap="round"
|
|
34
|
+
stroke-linejoin="round"
|
|
35
|
+
opacity="0.45"
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
<!-- Earlier stages: present, but clearly behind. -->
|
|
39
|
+
<circle cx="8" cy="23" r="3" fill="#ffffff" opacity="0.6" />
|
|
40
|
+
<circle cx="14.5" cy="16.5" r="3" fill="#ffffff" opacity="0.8" />
|
|
41
|
+
|
|
42
|
+
<!-- The current stage: solid, ringed, and the only fully opaque element. -->
|
|
43
|
+
<circle cx="23.5" cy="9.5" r="4.5" fill="#ffffff" />
|
|
44
|
+
<circle cx="23.5" cy="9.5" r="1.75" fill="#4338ca" />
|
|
45
|
+
</svg>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<meta name="description" content="Track job applications, spot the ones you have already applied for, and search them by meaning." />
|
|
20
20
|
<title>JobTrack</title>
|
|
21
|
-
<script type="module" crossorigin src="/assets/index-
|
|
21
|
+
<script type="module" crossorigin src="/assets/index-Bqi0Bj8-.js"></script>
|
|
22
22
|
<link rel="stylesheet" crossorigin href="/assets/index-CRnClsEb.css">
|
|
23
23
|
</head>
|
|
24
24
|
<body>
|