jobtrack 1.0.1 → 1.0.3
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
ADDED
|
@@ -0,0 +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.
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jobtrack",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"description": "Runs the JobTrack API + web UI as one background process with a Windows tray icon",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
@@ -16,7 +17,8 @@
|
|
|
16
17
|
"files": [
|
|
17
18
|
"bin",
|
|
18
19
|
"src",
|
|
19
|
-
"vendor"
|
|
20
|
+
"vendor",
|
|
21
|
+
"LICENSE"
|
|
20
22
|
],
|
|
21
23
|
"scripts": {
|
|
22
24
|
"dev": "tsx watch --clear-screen=false src/cli.ts",
|
|
@@ -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=b$,s=!a$.jitless,c=s&&x$.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?U0([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function K0(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=>!L$(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=>V$(e,r,o$())))}),t)}var q0=n$(`$ZodUnion`,(e,t)=>{a0.init(e,t),m$(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),m$(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),m$(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m$(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=>d$(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=>K0(t,r,e,i)):K0(o,r,e,i)}}),J0=n$(`$ZodIntersection`,(e,t)=>{a0.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])=>X0(e,t,n)):X0(e,i,a)}});function Y0(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(S$(e)&&S$(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=Y0(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=Y0(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 X0(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}),L$(e))return e;let o=Y0(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Z0=n$(`$ZodEnum`,(e,t)=>{a0.init(e,t);let n=s$(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>w$.has(typeof e)).map(e=>typeof e==`string`?T$(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}}),Q0=n$(`$ZodTransform`,(e,t)=>{a0.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new i$(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 r$;return n.value=i,n.fallback=!0,n}});function $0(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var e2=n$(`$ZodOptional`,(e,t)=>{a0.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,m$(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m$(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d$(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=>$0(e,r)):$0(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),t2=n$(`$ZodExactOptional`,(e,t)=>{e2.init(e,t),m$(e._zod,`values`,()=>t.innerType._zod.values),m$(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),n2=n$(`$ZodNullable`,(e,t)=>{a0.init(e,t),m$(e._zod,`optin`,()=>t.innerType._zod.optin),m$(e._zod,`optout`,()=>t.innerType._zod.optout),m$(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d$(e.source)}|null)$`):void 0}),m$(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)}),r2=n$(`$ZodDefault`,(e,t)=>{a0.init(e,t),e._zod.optin=`optional`,m$(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=>i2(e,t)):i2(r,t)}});function i2(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var a2=n$(`$ZodPrefault`,(e,t)=>{a0.init(e,t),e._zod.optin=`optional`,m$(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))}),o2=n$(`$ZodNonOptional`,(e,t)=>{a0.init(e,t),m$(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=>s2(t,e)):s2(i,e)}});function s2(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 c2=n$(`$ZodCatch`,(e,t)=>{a0.init(e,t),e._zod.optin=`optional`,m$(e._zod,`optout`,()=>t.innerType._zod.optout),m$(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=>V$(e,n,o$()))},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=>V$(e,n,o$()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),l2=n$(`$ZodPipe`,(e,t)=>{a0.init(e,t),m$(e._zod,`values`,()=>t.in._zod.values),m$(e._zod,`optin`,()=>t.in._zod.optin),m$(e._zod,`optout`,()=>t.out._zod.optout),m$(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=>u2(e,t.in,n)):u2(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>u2(e,t.out,n)):u2(r,t.out,n)}});function u2(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 d2=n$(`$ZodPreprocess`,(e,t)=>{l2.init(e,t)}),f2=n$(`$ZodReadonly`,(e,t)=>{a0.init(e,t),m$(e._zod,`propValues`,()=>t.innerType._zod.propValues),m$(e._zod,`values`,()=>t.innerType._zod.values),m$(e._zod,`optin`,()=>t.innerType?._zod?.optin),m$(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(p2):p2(r)}});function p2(e){return e.value=Object.freeze(e.value),e}var m2=n$(`$ZodCustom`,(e,t)=>{B1.init(e,t),a0.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=>h2(t,n,r,e));h2(i,n,r,e)}});function h2(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(U$(e))}}var g2,_2=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 v2(){return new _2}(g2=globalThis).__zod_globalRegistry??(g2.__zod_globalRegistry=v2());var y2=globalThis.__zod_globalRegistry;function b2(e,t){return new e({type:`string`,...D$(t)})}function x2(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...D$(t)})}function S2(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...D$(t)})}function C2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...D$(t)})}function w2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...D$(t)})}function T2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...D$(t)})}function E2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...D$(t)})}function D2(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...D$(t)})}function O2(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...D$(t)})}function k2(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...D$(t)})}function A2(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...D$(t)})}function j2(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...D$(t)})}function M2(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...D$(t)})}function N2(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...D$(t)})}function P2(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...D$(t)})}function F2(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...D$(t)})}function I2(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...D$(t)})}function L2(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...D$(t)})}function R2(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...D$(t)})}function z2(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...D$(t)})}function B2(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...D$(t)})}function V2(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...D$(t)})}function H2(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...D$(t)})}function U2(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...D$(t)})}function W2(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...D$(t)})}function G2(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...D$(t)})}function K2(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...D$(t)})}function q2(e,t){return new e({type:`number`,checks:[],...D$(t)})}function J2(e,t){return new e({type:`number`,coerce:!0,checks:[],...D$(t)})}function Y2(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...D$(t)})}function X2(e,t){return new e({type:`boolean`,...D$(t)})}function Z2(e){return new e({type:`unknown`})}function Q2(e,t){return new e({type:`never`,...D$(t)})}function $2(e,t){return new H1({check:`less_than`,...D$(t),value:e,inclusive:!1})}function e4(e,t){return new H1({check:`less_than`,...D$(t),value:e,inclusive:!0})}function t4(e,t){return new U1({check:`greater_than`,...D$(t),value:e,inclusive:!1})}function n4(e,t){return new U1({check:`greater_than`,...D$(t),value:e,inclusive:!0})}function r4(e,t){return new W1({check:`multiple_of`,...D$(t),value:e})}function i4(e,t){return new K1({check:`max_length`,...D$(t),maximum:e})}function a4(e,t){return new q1({check:`min_length`,...D$(t),minimum:e})}function o4(e,t){return new J1({check:`length_equals`,...D$(t),length:e})}function s4(e,t){return new X1({check:`string_format`,format:`regex`,...D$(t),pattern:e})}function c4(e){return new Z1({check:`string_format`,format:`lowercase`,...D$(e)})}function l4(e){return new Q1({check:`string_format`,format:`uppercase`,...D$(e)})}function u4(e,t){return new $1({check:`string_format`,format:`includes`,...D$(t),includes:e})}function d4(e,t){return new e0({check:`string_format`,format:`starts_with`,...D$(t),prefix:e})}function f4(e,t){return new t0({check:`string_format`,format:`ends_with`,...D$(t),suffix:e})}function p4(e){return new n0({check:`overwrite`,tx:e})}function m4(e){return p4(t=>t.normalize(e))}function h4(){return p4(e=>e.trim())}function g4(){return p4(e=>e.toLowerCase())}function _4(){return p4(e=>e.toUpperCase())}function v4(){return p4(e=>v$(e))}function y4(e,t,n){return new e({type:`array`,element:t,...D$(n)})}function b4(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...D$(n)})}function x4(e,t){let n=S4(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(U$(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(U$(r))}},e(t.value,t)),t);return n}function S4(e,t){let n=new B1({check:`custom`,...D$(t)});return n._zod.check=e,n}function C4(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??y2,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 w4(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,w4(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`&&D4(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 T4(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 E4(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:k4(t,`input`,e.processors),output:k4(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function D4(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 D4(r.element,n);if(r.type===`set`)return D4(r.valueType,n);if(r.type===`lazy`)return D4(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 D4(r.innerType,n);if(r.type===`intersection`)return D4(r.left,n)||D4(r.right,n);if(r.type===`record`||r.type===`map`)return D4(r.keyType,n)||D4(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:D4(r.in,n)||D4(r.out,n);if(r.type===`object`){for(let e in r.shape)if(D4(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(D4(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(D4(e,n))return!0;return!!(r.rest&&D4(r.rest,n))}return!1}var O4=(e,t={})=>n=>{let r=C4({...n,processors:t});return w4(e,r),T4(r,e),E4(r,e)},k4=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=C4({...i??{},target:a,io:t,processors:n});return w4(e,o),T4(o,e),E4(o,e)},A4={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},j4=(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=A4[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}))])}},M4=(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)},N4=(e,t,n,r)=>{n.type=`boolean`},P4=(e,t,n,r)=>{n.not={}},F4=(e,t,n,r)=>{let i=e._zod.def,a=s$(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},I4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},L4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},R4=(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=w4(a.element,t,{...r,path:[...r.path,`items`]})},z4=(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]=w4(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=w4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},B4=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>w4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},V4=(e,t,n,r)=>{let i=e._zod.def,a=w4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=w4(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]]},H4=(e,t,n,r)=>{let i=e._zod.def,a=w4(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`}]},U4=(e,t,n,r)=>{let i=e._zod.def;w4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},W4=(e,t,n,r)=>{let i=e._zod.def;w4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},G4=(e,t,n,r)=>{let i=e._zod.def;w4(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)))},K4=(e,t,n,r)=>{let i=e._zod.def;w4(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},q4=(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;w4(o,t,r);let s=t.seen.get(e);s.ref=o},J4=(e,t,n,r)=>{let i=e._zod.def;w4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Y4=(e,t,n,r)=>{let i=e._zod.def;w4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},X4=n$(`ZodISODateTime`,(e,t)=>{y0.init(e,t),C3.init(e,t)});function Z4(e){return U2(X4,e)}var Q4=n$(`ZodISODate`,(e,t)=>{b0.init(e,t),C3.init(e,t)});function $4(e){return W2(Q4,e)}var e3=n$(`ZodISOTime`,(e,t)=>{x0.init(e,t),C3.init(e,t)});function t3(e){return G2(e3,e)}var n3=n$(`ZodISODuration`,(e,t)=>{S0.init(e,t),C3.init(e,t)});function r3(e){return K2(n3,e)}var i3=n$(`ZodError`,(e,t)=>{G$.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>J$(e,t)},flatten:{value:t=>q$(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c$,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c$,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),a3=Y$(i3),o3=X$(i3),s3=Z$(i3),c3=$$(i3),l3=t1(i3),u3=n1(i3),d3=r1(i3),f3=i1(i3),p3=a1(i3),m3=o1(i3),h3=s1(i3),g3=c1(i3),_3=new WeakMap;function v3(e,t,n){let r=Object.getPrototypeOf(e),i=_3.get(r);if(i||(i=new Set,_3.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 y3=n$(`ZodType`,(e,t)=>(a0.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:k4(e,`input`),output:k4(e,`output`)}}),e.toJSONSchema=O4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>a3(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>s3(e,t,n),e.parseAsync=async(t,n)=>o3(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>c3(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>l3(e,t,n),e.decode=(t,n)=>u3(e,t,n),e.encodeAsync=async(t,n)=>d3(e,t,n),e.decodeAsync=async(t,n)=>f3(e,t,n),e.safeEncode=(t,n)=>p3(e,t,n),e.safeDecode=(t,n)=>m3(e,t,n),e.safeEncodeAsync=async(t,n)=>h3(e,t,n),e.safeDecodeAsync=async(t,n)=>g3(e,t,n),v3(e,`ZodType`,{check(...e){let t=this.def;return this.clone(g$(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 E$(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(M6(e,t))},superRefine(e,t){return this.check(N6(e,t))},overwrite(e){return this.check(p4(e))},optional(){return p6(this)},exactOptional(){return h6(this)},nullable(){return _6(this)},nullish(){return p6(_6(this))},nonoptional(e){return C6(this,e)},array(){return t6(this)},or(e){return a6([this,e])},and(e){return s6(this,e)},transform(e){return D6(this,d6(e))},default(e){return y6(this,e)},prefault(e){return x6(this,e)},catch(e){return T6(this,e)},pipe(e){return D6(this,e)},readonly(){return A6(this)},describe(e){let t=this.clone();return y2.add(t,{description:e}),t},meta(...e){if(e.length===0)return y2.get(this);let t=this.clone();return y2.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 y2.get(e)?.description},configurable:!0}),e)),b3=n$(`_ZodString`,(e,t)=>{o0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>j4(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,v3(e,`_ZodString`,{regex(...e){return this.check(s4(...e))},includes(...e){return this.check(u4(...e))},startsWith(...e){return this.check(d4(...e))},endsWith(...e){return this.check(f4(...e))},min(...e){return this.check(a4(...e))},max(...e){return this.check(i4(...e))},length(...e){return this.check(o4(...e))},nonempty(...e){return this.check(a4(1,...e))},lowercase(e){return this.check(c4(e))},uppercase(e){return this.check(l4(e))},trim(){return this.check(h4())},normalize(...e){return this.check(m4(...e))},toLowerCase(){return this.check(g4())},toUpperCase(){return this.check(_4())},slugify(){return this.check(v4())}})}),x3=n$(`ZodString`,(e,t)=>{o0.init(e,t),b3.init(e,t),e.email=t=>e.check(x2(w3,t)),e.url=t=>e.check(D2(O3,t)),e.jwt=t=>e.check(H2(U3,t)),e.emoji=t=>e.check(O2(k3,t)),e.guid=t=>e.check(S2(T3,t)),e.uuid=t=>e.check(C2(E3,t)),e.uuidv4=t=>e.check(w2(E3,t)),e.uuidv6=t=>e.check(T2(E3,t)),e.uuidv7=t=>e.check(E2(E3,t)),e.nanoid=t=>e.check(k2(A3,t)),e.guid=t=>e.check(S2(T3,t)),e.cuid=t=>e.check(A2(j3,t)),e.cuid2=t=>e.check(j2(M3,t)),e.ulid=t=>e.check(M2(N3,t)),e.base64=t=>e.check(z2(B3,t)),e.base64url=t=>e.check(B2(V3,t)),e.xid=t=>e.check(N2(P3,t)),e.ksuid=t=>e.check(P2(F3,t)),e.ipv4=t=>e.check(F2(I3,t)),e.ipv6=t=>e.check(I2(L3,t)),e.cidrv4=t=>e.check(L2(R3,t)),e.cidrv6=t=>e.check(R2(z3,t)),e.e164=t=>e.check(V2(H3,t)),e.datetime=t=>e.check(Z4(t)),e.date=t=>e.check($4(t)),e.time=t=>e.check(t3(t)),e.duration=t=>e.check(r3(t))});function S3(e){return b2(x3,e)}var C3=n$(`ZodStringFormat`,(e,t)=>{s0.init(e,t),b3.init(e,t)}),w3=n$(`ZodEmail`,(e,t)=>{u0.init(e,t),C3.init(e,t)}),T3=n$(`ZodGUID`,(e,t)=>{c0.init(e,t),C3.init(e,t)}),E3=n$(`ZodUUID`,(e,t)=>{l0.init(e,t),C3.init(e,t)});function D3(e){return C2(E3,e)}var O3=n$(`ZodURL`,(e,t)=>{d0.init(e,t),C3.init(e,t)}),k3=n$(`ZodEmoji`,(e,t)=>{f0.init(e,t),C3.init(e,t)}),A3=n$(`ZodNanoID`,(e,t)=>{p0.init(e,t),C3.init(e,t)}),j3=n$(`ZodCUID`,(e,t)=>{m0.init(e,t),C3.init(e,t)}),M3=n$(`ZodCUID2`,(e,t)=>{h0.init(e,t),C3.init(e,t)}),N3=n$(`ZodULID`,(e,t)=>{g0.init(e,t),C3.init(e,t)}),P3=n$(`ZodXID`,(e,t)=>{_0.init(e,t),C3.init(e,t)}),F3=n$(`ZodKSUID`,(e,t)=>{v0.init(e,t),C3.init(e,t)}),I3=n$(`ZodIPv4`,(e,t)=>{C0.init(e,t),C3.init(e,t)}),L3=n$(`ZodIPv6`,(e,t)=>{w0.init(e,t),C3.init(e,t)}),R3=n$(`ZodCIDRv4`,(e,t)=>{T0.init(e,t),C3.init(e,t)}),z3=n$(`ZodCIDRv6`,(e,t)=>{E0.init(e,t),C3.init(e,t)}),B3=n$(`ZodBase64`,(e,t)=>{O0.init(e,t),C3.init(e,t)}),V3=n$(`ZodBase64URL`,(e,t)=>{A0.init(e,t),C3.init(e,t)}),H3=n$(`ZodE164`,(e,t)=>{j0.init(e,t),C3.init(e,t)}),U3=n$(`ZodJWT`,(e,t)=>{N0.init(e,t),C3.init(e,t)}),W3=n$(`ZodNumber`,(e,t)=>{P0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>M4(e,t,n,r),v3(e,`ZodNumber`,{gt(e,t){return this.check(t4(e,t))},gte(e,t){return this.check(n4(e,t))},min(e,t){return this.check(n4(e,t))},lt(e,t){return this.check($2(e,t))},lte(e,t){return this.check(e4(e,t))},max(e,t){return this.check(e4(e,t))},int(e){return this.check(q3(e))},safe(e){return this.check(q3(e))},positive(e){return this.check(t4(0,e))},nonnegative(e){return this.check(n4(0,e))},negative(e){return this.check($2(0,e))},nonpositive(e){return this.check(e4(0,e))},multipleOf(e,t){return this.check(r4(e,t))},step(e,t){return this.check(r4(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 G3(e){return q2(W3,e)}var K3=n$(`ZodNumberFormat`,(e,t)=>{F0.init(e,t),W3.init(e,t)});function q3(e){return Y2(K3,e)}var J3=n$(`ZodBoolean`,(e,t)=>{I0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>N4(e,t,n,r)});function Y3(e){return X2(J3,e)}var X3=n$(`ZodUnknown`,(e,t)=>{L0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Z3(){return Z2(X3)}var Q3=n$(`ZodNever`,(e,t)=>{R0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>P4(e,t,n,r)});function $3(e){return Q2(Q3,e)}var e6=n$(`ZodArray`,(e,t)=>{B0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>R4(e,t,n,r),e.element=t.element,v3(e,`ZodArray`,{min(e,t){return this.check(a4(e,t))},nonempty(e){return this.check(a4(1,e))},max(e,t){return this.check(i4(e,t))},length(e,t){return this.check(o4(e,t))},unwrap(){return this.element}})});function t6(e,t){return y4(e6,e,t)}var n6=n$(`ZodObject`,(e,t)=>{G0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z4(e,t,n,r),m$(e,`shape`,()=>t.shape),v3(e,`ZodObject`,{keyof(){return l6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Z3()})},loose(){return this.clone({...this._zod.def,catchall:Z3()})},strict(){return this.clone({...this._zod.def,catchall:$3()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return M$(this,e)},safeExtend(e){return N$(this,e)},merge(e){return P$(this,e)},pick(e){return A$(this,e)},omit(e){return j$(this,e)},partial(...e){return F$(f6,this,e[0])},required(...e){return I$(S6,this,e[0])}})});function r6(e,t){return new n6({type:`object`,shape:e??{},...D$(t)})}var i6=n$(`ZodUnion`,(e,t)=>{q0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>B4(e,t,n,r),e.options=t.options});function a6(e,t){return new i6({type:`union`,options:e,...D$(t)})}var o6=n$(`ZodIntersection`,(e,t)=>{J0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V4(e,t,n,r)});function s6(e,t){return new o6({type:`intersection`,left:e,right:t})}var c6=n$(`ZodEnum`,(e,t)=>{Z0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>F4(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 c6({...t,checks:[],...D$(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 c6({...t,checks:[],...D$(r),entries:i})}});function l6(e,t){return new c6({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...D$(t)})}var u6=n$(`ZodTransform`,(e,t)=>{Q0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>L4(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new i$(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(U$(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(U$(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 d6(e){return new u6({type:`transform`,transform:e})}var f6=n$(`ZodOptional`,(e,t)=>{e2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function p6(e){return new f6({type:`optional`,innerType:e})}var m6=n$(`ZodExactOptional`,(e,t)=>{t2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function h6(e){return new m6({type:`optional`,innerType:e})}var g6=n$(`ZodNullable`,(e,t)=>{n2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _6(e){return new g6({type:`nullable`,innerType:e})}var v6=n$(`ZodDefault`,(e,t)=>{r2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function y6(e,t){return new v6({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():C$(t)}})}var b6=n$(`ZodPrefault`,(e,t)=>{a2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function x6(e,t){return new b6({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():C$(t)}})}var S6=n$(`ZodNonOptional`,(e,t)=>{o2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>U4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function C6(e,t){return new S6({type:`nonoptional`,innerType:e,...D$(t)})}var w6=n$(`ZodCatch`,(e,t)=>{c2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function T6(e,t){return new w6({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var E6=n$(`ZodPipe`,(e,t)=>{l2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q4(e,t,n,r),e.in=t.in,e.out=t.out});function D6(e,t){return new E6({type:`pipe`,in:e,out:t})}var O6=n$(`ZodPreprocess`,(e,t)=>{E6.init(e,t),d2.init(e,t)}),k6=n$(`ZodReadonly`,(e,t)=>{f2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function A6(e){return new k6({type:`readonly`,innerType:e})}var j6=n$(`ZodCustom`,(e,t)=>{m2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>I4(e,t,n,r)});function M6(e,t={}){return b4(j6,e,t)}function N6(e,t){return x4(e,t)}function P6(e,t){return new O6({type:`pipe`,in:d6(e),out:t})}function F6(e){return J2(W3,e)}var I6=S3().regex(/^\d{4}-\d{2}-\d{2}$/,`Expected a YYYY-MM-DD date`),L6=e=>S3().trim().max(e).nullish().transform(e=>e==null||e===``?null:e),R6=l6(zQ),z6=l6(WQ),B6=l6(qQ),V6=l6(JQ);l6(KQ);var H6=t6(S3().trim().min(1).max(60)).max(30);r6({companyName:S3().trim().min(1,`Company is required`).max(200),jobTitle:S3().trim().min(1,`Job title is required`).max(200),appliedOn:I6,status:R6.default(`applied`),jobUrl:L6(2e3),location:L6(200),workMode:z6.default(`unspecified`),sourceName:L6(120),salaryMin:G3().int().nonnegative().nullish().transform(e=>e??null),salaryMax:G3().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:L6(8),followUpOn:I6.nullish().transform(e=>e??null),tags:H6.default([]),notes:L6(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),r6({companyName:S3().trim().min(1).max(200).optional(),jobTitle:S3().trim().min(1).max(200).optional(),appliedOn:I6.optional(),status:R6.optional(),statusComment:S3().trim().max(2e3).nullish(),jobUrl:L6(2e3).optional(),location:L6(200).optional(),workMode:z6.optional(),sourceName:L6(120).optional(),salaryMin:G3().int().nonnegative().nullish(),salaryMax:G3().int().nonnegative().nullish(),salaryCurrency:L6(8).optional(),followUpOn:I6.nullish(),archived:Y3().optional(),tags:H6.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),r6({status:R6,occurredOn:I6.optional(),comment:S3().trim().max(2e3).nullish().transform(e=>e??null)});var U6=e=>P6(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},t6(e).optional()),W6=r6({q:S3().trim().max(300).optional(),year:F6().int().min(1970).max(2200).optional(),month:F6().int().min(1).max(12).optional(),status:U6(R6),workMode:U6(z6),tags:U6(S3()),companyId:D3().optional(),source:S3().trim().max(120).optional(),from:I6.optional(),to:I6.optional(),archived:l6([`true`,`false`,`all`]).default(`false`).transform(e=>e===`all`?`all`:e===`true`),followUpDue:l6([`true`,`false`]).optional().transform(e=>e===`true`),sort:l6([`appliedOn`,`company`,`jobTitle`,`status`,`createdAt`]).default(`appliedOn`),direction:l6([`asc`,`desc`]).default(`desc`),limit:F6().int().min(1).max(200).default(50),cursor:S3().optional()});r6({company:S3().trim().min(1).max(200),title:S3().trim().max(200).optional().default(``),excludeId:D3().optional()}),r6({q:S3().trim().min(1).max(300),limit:F6().int().min(1).max(100).default(25),types:U6(l6([`application`,`company`,`note`]))}),W6.extend({format:l6([`csv`,`xlsx`]).default(`csv`)}),r6({name:S3().trim().min(1).max(200),website:L6(2e3),location:L6(200),tags:H6.default([])}),r6({name:S3().trim().min(1).max(200).optional(),website:L6(2e3).optional(),location:L6(200).optional(),archived:Y3().optional(),tags:H6.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),r6({title:S3().trim().min(1).max(200),body:S3().max(5e4).default(``),targetType:B6.default(`standalone`),targetId:D3().nullish().transform(e=>e??null),pinned:Y3().default(!1)}),r6({title:S3().trim().min(1).max(200).optional(),body:S3().max(5e4).optional(),targetType:B6.optional(),targetId:D3().nullish(),pinned:Y3().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),r6({name:S3().trim().min(1).max(60),color:L6(30),scope:V6.default(`both`)}),r6({companyName:S3().trim().min(1,`Company is required`).max(200),jobTitle:S3().trim().min(1,`Job title is required`).max(200),jobUrl:L6(2e3),location:L6(200),workMode:z6.default(`unspecified`),sourceName:L6(120),salaryMin:G3().int().nonnegative().nullish().transform(e=>e??null),salaryMax:G3().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:L6(8),notes:L6(2e4),savedOn:I6.optional()}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),r6({companyName:S3().trim().min(1).max(200).optional(),jobTitle:S3().trim().min(1).max(200).optional(),jobUrl:L6(2e3).optional(),location:L6(200).optional(),workMode:z6.optional(),sourceName:L6(120).optional(),salaryMin:G3().int().nonnegative().nullish(),salaryMax:G3().int().nonnegative().nullish(),salaryCurrency:L6(8).optional(),notes:L6(2e4).optional(),savedOn:I6.optional(),archived:Y3().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),r6({appliedOn:I6.optional(),status:R6.optional(),tags:H6.optional()}),r6({target:S3().min(1)});function G6(e){return e===`exact`}var K6=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 q6(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 K6(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}function J6(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 Y6={csv:`text/csv`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};async function X6(e,t,n){let r=await fetch(`/api/import${J6({format:t,mode:n})}`,{method:`POST`,headers:{"Content-Type":Y6[t]},body:e}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok)throw new K6(r.status,a?.error??`unknown`,a?.message??r.statusText,a?.details);return a}async function Z6(e,t){let n=await fetch(`/api/backup/import${J6({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 K6(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}var Q6={listApplications:e=>q6(`/api/applications${J6(e)}`),getApplication:e=>q6(`/api/applications/${e}`),periods:()=>q6(`/api/applications/periods`),checkDuplicates:e=>q6(`/api/applications/check${J6(e)}`),createApplication:e=>q6(`/api/applications`,{method:`POST`,body:JSON.stringify(e)}),updateApplication:(e,t)=>q6(`/api/applications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),changeStatus:(e,t)=>q6(`/api/applications/${e}/status`,{method:`POST`,body:JSON.stringify(t)}),deleteApplication:e=>q6(`/api/applications/${e}`,{method:`DELETE`}),listCompanies:(e={})=>q6(`/api/companies${J6(e)}`),suggestCompanies:e=>q6(`/api/companies/suggest${J6({q:e})}`),getCompany:e=>q6(`/api/companies/${e}`),updateCompany:(e,t)=>q6(`/api/companies/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),listTags:()=>q6(`/api/tags`),listNotes:(e={})=>q6(`/api/notes${J6(e)}`),createNote:e=>q6(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>q6(`/api/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNote:e=>q6(`/api/notes/${e}`,{method:`DELETE`}),dashboard:()=>q6(`/api/dashboard`),search:(e,t)=>q6(`/api/search${J6({q:e,types:t,limit:25})}`),exportUrl:(e,t)=>`/api/export${J6({...e,format:t})}`,previewImport:(e,t)=>X6(e,t,`preview`),commitImport:(e,t)=>X6(e,t,`commit`),listOpenings:(e={})=>q6(`/api/openings${J6(e)}`),getOpening:e=>q6(`/api/openings/${e}`),createOpening:e=>q6(`/api/openings`,{method:`POST`,body:JSON.stringify(e)}),updateOpening:(e,t)=>q6(`/api/openings/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteOpening:e=>q6(`/api/openings/${e}`,{method:`DELETE`}),convertOpening:(e,t)=>q6(`/api/openings/${e}/convert`,{method:`POST`,body:JSON.stringify(t)}),getDbTargets:()=>q6(`/api/db/targets`),switchDb:e=>q6(`/api/db/switch`,{method:`POST`,body:JSON.stringify({target:e})}),backupExportUrl:`/api/backup/export`,previewBackup:e=>Z6(e,`preview`),commitBackup:e=>Z6(e,`commit`),getDataStatus:()=>q6(`/api/backup/status`),clearDatabase:()=>q6(`/api/backup/clear`,{method:`POST`}),seedDatabase:()=>q6(`/api/backup/seed`,{method:`POST`})},$6={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`]};function e8(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 t8(e){return Kr({queryKey:$6.applications(e),queryFn:()=>Q6.listApplications(e),placeholderData:e=>e})}function n8(e){return Kr({queryKey:$6.application(e??``),queryFn:()=>Q6.getApplication(e),enabled:!!e})}function r8(){return Kr({queryKey:$6.periods(),queryFn:()=>Q6.periods()})}function i8(){return Kr({queryKey:$6.dashboard(),queryFn:()=>Q6.dashboard()})}function a8(){return Kr({queryKey:$6.tags(),queryFn:()=>Q6.listTags()})}function o8(e={}){return Kr({queryKey:$6.companies(e),queryFn:()=>Q6.listCompanies(e)})}function s8(e){return Kr({queryKey:$6.company(e??``),queryFn:()=>Q6.getCompany(e),enabled:!!e})}function c8(e={}){return Kr({queryKey:$6.notes(e),queryFn:()=>Q6.listNotes(e)})}function l8(e){let{enabled:t=!0,...n}=e;return Kr({queryKey:$6.duplicates(n),queryFn:()=>Q6.checkDuplicates(n),enabled:t&&n.company.trim().length>1,staleTime:5e3})}function u8(e){return Kr({queryKey:$6.companySuggest(e),queryFn:()=>Q6.suggestCompanies(e),enabled:e.trim().length>0,staleTime:3e4})}function d8(){let e=wn();return qr({mutationFn:e=>Q6.createApplication(e),onSuccess:()=>e8(e)})}function f8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.updateApplication(e,t),onSuccess:()=>e8(e)})}function p8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.changeStatus(e,t),onSuccess:()=>e8(e)})}function m8(){let e=wn();return qr({mutationFn:e=>Q6.deleteApplication(e),onSuccess:()=>e8(e)})}function h8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.updateCompany(e,t),onSuccess:()=>e8(e)})}function g8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>e?Q6.updateNote(e,t):Q6.createNote(t),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`search`]})}})}function _8(){let e=wn();return qr({mutationFn:e=>Q6.deleteNote(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]})}})}function v8(e={}){return Kr({queryKey:$6.openings(e),queryFn:()=>Q6.listOpenings(e)})}function y8(e){e.invalidateQueries({queryKey:[`openings`]}),e.invalidateQueries({queryKey:[`opening`]})}function b8(){let e=wn();return qr({mutationFn:e=>Q6.createOpening(e),onSuccess:()=>y8(e)})}function x8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.updateOpening(e,t),onSuccess:()=>y8(e)})}function S8(){let e=wn();return qr({mutationFn:e=>Q6.deleteOpening(e),onSuccess:()=>y8(e)})}function C8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.convertOpening(e,t),onSuccess:()=>{y8(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 w8(){return Kr({queryKey:$6.dbTargets(),queryFn:()=>Q6.getDbTargets()})}function T8(){return qr({mutationFn:e=>Q6.switchDb(e)})}function E8(){return Kr({queryKey:$6.dataStatus(),queryFn:()=>Q6.getDataStatus()})}function D8(){let e=wn();return qr({mutationFn:()=>Q6.clearDatabase(),onSuccess:()=>void e.invalidateQueries()})}function O8(){let e=wn();return qr({mutationFn:()=>Q6.seedDatabase(),onSuccess:()=>void e.invalidateQueries()})}function k8({status:e}){return(0,Z.jsx)(OY,{color:HQ[e],children:UQ[e]})}function A8(e,t=300){let[n,r]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var j8={exact:`error`,similar:`warning`,company:`info`,none:`success`};function M8({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:j8[e.verdict],showIcon:!0,style:{marginBottom:16},message:N8(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)(P8,{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 N8(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 P8({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)(un,{to:`/applications/${e.id}`,children:e.jobTitle}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:e.appliedOn}),(0,Z.jsx)(OY,{color:HQ[e.status],children:UQ[e.status]}),e.matchKind===`exact`?(0,Z.jsx)(OY,{color:`red`,children:`exact title`}):(0,Z.jsxs)(OY,{children:[t,`% similar`]})]})}function F8({onStartApplication:e}){let[t,n]=(0,x.useState)(``),[r,i]=(0,x.useState)(``),a=A8(t,350),{data:o,isFetching:s}=l8({company:a,title:A8(r,350)}),c=a.trim().length>1;return(0,Z.jsx)(bF,{title:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(CQ,{}),(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)(M8,{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 I8({open:e,onClose:t,application:n}){let[r]=WB.useForm(),{message:i,modal:a}=NC.useApp(),o=!!n,s=d8(),c=f8(),{data:l}=a8(),u=WB.useWatch(`companyName`,r)??``,d=WB.useWatch(`jobTitle`,r)??``,f=A8(u,300),p=A8(d,300),{data:m}=u8(f),{data:h,isFetching:g}=l8({company:f,title:p,...n?{excludeId:n.id}:{},enabled:e});(0,x.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 _=(0,x.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]),v=(0,x.useMemo)(()=>(l?.tags??[]).map(e=>({value:e.name,label:e.name})),[l]),[y,b]=(0,x.useState)(!1);async function S(e){if(h&&G6(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}};b(!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 K6&&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{b(!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:y,onClick:()=>r.submit(),children:o?`Save changes`:`Save application`})]}),children:[(0,Z.jsx)(M8,{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:_,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:zQ.map(e=>({value:e,label:UQ[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:WQ.map(e=>({value:e,label:GQ[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:v,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 L8={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`}},R8={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 z8(e){let t=L8[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 B8(){let{data:e,isLoading:t}=i8(),[n,r]=(0,x.useState)(!1),i=ZQ(QQ());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:R8.accent}})})}),(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`${e$(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:R8.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)(F8,{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)(un,{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)(k8,{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)(k8,{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)(un,{to:`/applications/${e.applicationId}`,children:e.jobTitle}),` at `,e.companyName]}),(0,Z.jsxs)(YX.Text,{type:`secondary`,style:{fontSize:12},children:[e.fromStatus?`${UQ[e.fromStatus]} → ${UQ[e.toStatus]}`:`Applied (${UQ[e.toStatus]})`,` `,`· `,e.occurredOn]})]})}))})})})]}),(0,Z.jsx)(I8,{open:n,onClose:()=>r(!1)})]})}function V8({periods:e,year:t,month:n,onSelect:r}){let i=(0,x.useMemo)(()=>e.map(e=>({key:`y:${e.year}`,title:(0,Z.jsx)(H8,{label:String(e.year),count:e.count,strong:!0}),children:(e.months??[]).map(e=>({key:`m:${e.year}:${e.month}`,title:(0,Z.jsx)(H8,{label:e$(e.month),count:e.count})}))})),[e]),a=(0,x.useMemo)(()=>t&&n?[`m:${t}:${n}`]:t?[`y:${t}`]:[],[t,n]),o=(0,x.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 H8({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 U8={new:`green`,duplicate:`default`,error:`red`},W8={new:`New`,duplicate:`Duplicate — skipped`,error:`Error`};function G8({open:e,onClose:t}){let n=wn(),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(`csv`),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(!1),[p,m]=(0,x.useState)(null);function h(){i(null),c(null),u(null),m(null)}function g(){h(),t()}let _=e=>{let t=e.name.toLowerCase().endsWith(`.xlsx`)?`xlsx`:`csv`;return i(e),o(t),m(null),f(!0),Q6.previewImport(e,t).then(c).catch(e=>m(e instanceof Error?e.message:`Could not read that file`)).finally(()=>f(!1)),!1};async function v(){if(r){f(!0),m(null);try{let e=await Q6.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:_,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?UQ[e]:`—`},{title:`Result`,dataIndex:`verdict`,width:200,render:(e,t)=>(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(OY,{color:U8[e],children:W8[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:v,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 K8(){let e=Ye(),[t,n]=gn(),[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(!1),s=(0,x.useMemo)(()=>{let e={};for(let n of[`q`,`source`,`sort`,`direction`,`cursor`]){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}=t8(s),{data:d}=r8(),{data:f}=a8();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,` · `,GQ[t.workMode]]})]})},{title:`Status`,dataIndex:`status`,width:116,render:(e,t)=>(0,Z.jsx)(k8,{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(`year`)?Number(t.get(`year`)):void 0,g=t.get(`month`)?Number(t.get(`month`)):void 0,_=h&&g?`${e$(g)} ${h}`:h?String(h):`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:(h||g)&&(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)(V8,{periods:d?.periods??[],year:h,month:g,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:_}),(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=Q6.exportUrl(s,e)}},children:(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(FZ,{}),children:`Export`})}),(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(RQ,{}),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)(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:zQ.map(e=>({value:e,label:UQ[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:WQ.map(e=>({value:e,label:GQ[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)(FQ,{}),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:()=>q8(t,n,c.cursor),children:`Load more`})})}):void 0})]})}),(0,Z.jsx)(I8,{open:r,onClose:()=>i(!1)}),(0,Z.jsx)(G8,{open:a,onClose:()=>o(!1)})]})}function q8(e,t,n){if(!n)return;let r=new URLSearchParams(e);r.set(`cursor`,n),t(r)}function J8(){let{id:e}=Ze(),t=Ye(),{message:n}=NC.useApp(),{data:r,isLoading:i}=n8(e),a=p8(),o=m8(),[s,c]=(0,x.useState)(!1);if(i||!r)return(0,Z.jsx)(CS,{active:!0,paragraph:{rows:10}});let l=VQ(r.status);async function u(t){e&&(await a.mutateAsync({id:e,body:{status:t,comment:null}}),n.success(`Moved to ${UQ[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)(un,{to:`/companies/${r.company.id}`,children:r.company.name}),(0,Z.jsxs)(YX.Text,{type:`secondary`,children:[`applied `,r.appliedOn]}),(0,Z.jsx)(k8,{status:r.status})]})]}),(0,Z.jsxs)(Pz,{wrap:!0,children:[l&&(0,Z.jsxs)(Vk,{type:`primary`,onClick:()=>void u(l),children:[`Move to `,UQ[l]]}),(0,Z.jsx)(EE,{style:{width:150},value:r.status,onChange:e=>void u(e),options:zQ.map(e=>({value:e,label:UQ[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:GQ[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)(dQ,{}),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?`${UQ[e.fromStatus]} → ${UQ[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)(I8,{open:s,onClose:()=>c(!1),application:r})]})}function Y8(){let e=Ye(),[t,n]=(0,x.useState)(``),r=A8(t,300),{data:i,isLoading:a}=o8(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 X8(){let{id:e}=Ze(),t=Ye(),{data:n,isLoading:r}=s8(e),{data:i}=c8(e?{targetType:`company`,targetId:e}:{}),{data:a}=a8(),o=h8();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:R8.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)(k8,{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 Z8(){let{message:e}=NC.useApp(),[t,n]=(0,x.useState)(`all`),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(!1),{data:s,isLoading:c}=c8(t===`all`?{}:{targetType:t}),l=_8(),u=s?.notes??[];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:()=>o(!0),children:`New note`})]})]}),(0,Z.jsx)(bF,{size:`small`,loading:c,children:u.length===0?(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`No notes here yet`}):(0,Z.jsx)(NH,{dataSource:u,renderItem:t=>(0,Z.jsx)(NH.Item,{actions:[(0,Z.jsx)(Vk,{type:`text`,icon:(0,Z.jsx)(QY,{}),onClick:()=>i(t)},`edit`),(0,Z.jsx)(VH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await l.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)(bQ,{style:{color:`#faad14`}}),(0,Z.jsx)(YX.Text,{strong:!0,children:t.title}),(0,Z.jsx)(Q8,{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)($8,{open:a||r!==null,note:r,onClose:()=>{o(!1),i(null)}})]})}function Q8({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)(un,{to:t,children:(0,Z.jsxs)(OY,{color:`blue`,children:[e.targetType,`: `,e.targetLabel??`view`]})})}function $8({open:e,note:t,onClose:n}){let[r]=WB.useForm(),{message:i}=NC.useApp(),a=g8(),o=WB.useWatch(`targetType`,r)??`standalone`,{data:s}=o8(),{data:c}=t8({limit:200}),l=(0,x.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 e5({open:e,onClose:t,opening:n}){let[r]=WB.useForm(),{message:i}=NC.useApp(),a=!!n,o=b8(),s=x8(),{data:c}=u8(WB.useWatch(`companyName`,r)??``);(0,x.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,x.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 K6&&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:WQ.map(e=>({value:e,label:GQ[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 t5(){let e=Ye(),{message:t}=NC.useApp(),{data:n,isLoading:r}=v8(),{data:i}=a8(),a=S8(),o=C8(),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(void 0),[d,f]=(0,x.useState)(null),[p]=WB.useForm();function m(e){f(e),p.setFieldsValue({appliedOn:(0,Yk.default)(),status:`applied`,tags:[]})}async function h(n){if(d)try{let r=await o.mutateAsync({id:d.id,body:{appliedOn:n.appliedOn.format(`YYYY-MM-DD`),status:n.status,tags:n.tags??[]}});t.success(`Converted to an application`),f(null),e(`/applications/${r.id}`)}catch(e){t.error(e instanceof Error?e.message:`Could not convert`)}}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:`Saved for later — convert one to a real application when you're ready to apply.`})]}),(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(cP,{}),onClick:()=>{u(void 0),c(!0)},children:`Save opening for later`})]}),(0,Z.jsx)(bF,{size:`small`,children:(0,Z.jsx)(hY,{rowKey:`id`,columns:[{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,GQ[t.workMode]].filter(Boolean).join(` · `)||(0,Z.jsx)(YX.Text,{type:`secondary`,children:`—`})},{title:`Source`,dataIndex:`sourceName`,render:e=>e??`—`},{title:``,key:`actions`,width:220,render:(e,t)=>(0,Z.jsxs)(Pz,{onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(qB,{}),onClick:()=>m(t),children:`Convert`}),(0,Z.jsx)(Vk,{size:`small`,onClick:()=>{u(t),c(!0)},children:`Edit`}),(0,Z.jsx)(VH,{title:`Delete this opening?`,onConfirm:()=>a.mutate(t.id),okText:`Delete`,okButtonProps:{danger:!0},children:(0,Z.jsx)(Vk,{size:`small`,danger:!0,children:`Delete`})})]})}],dataSource:n?.openings??[],loading:r,pagination:!1,locale:{emptyText:(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`Nothing saved yet — use “Save opening for later” for a role you're not ready to apply to.`})}})}),(0,Z.jsx)(e5,{open:s,onClose:()=>c(!1),opening:l}),(0,Z.jsx)(LH,{title:d?`Convert "${d.jobTitle}" at ${d.company.name}`:``,open:!!d,onCancel:()=>f(null),onOk:()=>p.submit(),okText:`Create application`,confirmLoading:o.isPending,children:(0,Z.jsxs)(WB,{form:p,layout:`vertical`,onFinish:h,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:zQ.map(e=>({value:e,label:UQ[e]}))})}),(0,Z.jsx)(WB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(EE,{mode:`tags`,options:(i?.tags??[]).map(e=>({value:e.name,label:e.name})),placeholder:`fintech, remote-ok…`,tokenSeparators:[`,`]})})]})})]})}var n5={companies:`Companies`,applications:`Applications`,tags:`Tags`,tagLinks:`Tag links`,notes:`Notes`,statusEvents:`Status events`,jobOpenings:`Job openings`};function r5({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:n5[e]??e,children:t},e))})}function i5(){let{message:e}=NC.useApp(),{data:t,isLoading:n}=w8(),r=T8(),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!1),c=(0,x.useRef)(null);(0,x.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(()=>{Q6.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 a5(){let{message:e}=NC.useApp(),[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(null),[d,f]=(0,x.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),Q6.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 Q6.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=Q6.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)(r5,{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)(r5,{counts:a.counts}),(0,Z.jsx)(Vk,{type:`primary`,onClick:()=>window.location.reload(),children:`Reload`})]})})]})})]})}var o5=`CLEAR`;function s5(){let{message:e}=NC.useApp(),{data:t,isLoading:n}=E8(),r=D8(),i=O8(),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.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)(r5,{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)(r5,{counts:f}),(0,Z.jsxs)(YX.Text,{children:[`Type `,(0,Z.jsx)(YX.Text,{code:!0,children:o5}),` to confirm.`]}),(0,Z.jsx)(_V,{value:s,onChange:e=>c(e.target.value),placeholder:o5,onPressEnter:()=>s===o5&&u()}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:l,children:`Cancel`}),(0,Z.jsx)(Vk,{danger:!0,type:`primary`,disabled:s!==o5,loading:r.isPending,onClick:u,children:`Clear database`})]})]})})]})}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)(i5,{}),(0,Z.jsx)(a5,{}),(0,Z.jsx)(s5,{})]})}var l5=`jobtrack.theme`,u5=[{key:`/dashboard`,icon:(0,Z.jsx)(XZ,{}),label:(0,Z.jsx)(un,{to:`/dashboard`,children:`Dashboard`})},{key:`/applications`,icon:(0,Z.jsx)(_Q,{}),label:(0,Z.jsx)(un,{to:`/applications`,children:`Applications`})},{key:`/openings`,icon:(0,Z.jsx)(qZ,{}),label:(0,Z.jsx)(un,{to:`/openings`,children:`Openings`})},{key:`/companies`,icon:(0,Z.jsx)(kQ,{}),label:(0,Z.jsx)(un,{to:`/companies`,children:`Companies`})},{key:`/notes`,icon:(0,Z.jsx)($z,{}),label:(0,Z.jsx)(un,{to:`/notes`,children:`Notes`})},{key:`/settings`,icon:(0,Z.jsx)(EQ,{}),label:(0,Z.jsx)(un,{to:`/settings`,children:`Settings`})}],d5=[{key:`light`,icon:(0,Z.jsx)(MQ,{}),label:`Light`},{key:`dark`,icon:(0,Z.jsx)(mQ,{}),label:`Dark`}];function f5(){let[e,t]=(0,x.useState)(()=>{try{let e=localStorage.getItem(l5);if(e)return e===`dark`}catch{}return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1});(0,x.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`);try{localStorage.setItem(l5,e?`dark`:`light`)}catch{}},[e]);let n=Ke(),r=(0,x.useMemo)(()=>{let e=u5.find(e=>n.pathname.startsWith(e.key));return e?[e.key]:[`/dashboard`]},[n.pathname]);return(0,Z.jsx)(Nh,{theme:z8(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 ${R8.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:R8.accent},children:`Track`})]}),(0,Z.jsx)(Fk,{mode:`horizontal`,selectedKeys:r,items:u5,style:{flex:1,minWidth:0,borderBottom:`none`}}),(0,Z.jsx)(Iz,{trigger:[`click`],menu:{items:d5,selectable:!0,selectedKeys:[e?`dark`:`light`],onClick:({key:e})=>t(e===`dark`)},children:(0,Z.jsx)(Vk,{icon:e?(0,Z.jsx)(mQ,{}):(0,Z.jsx)(MQ,{}),"aria-label":`Theme settings`,children:`Theme`})})]}),(0,Z.jsx)(EV.Content,{style:{padding:24},children:(0,Z.jsxs)(St,{children:[(0,Z.jsx)(bt,{path:`/`,element:(0,Z.jsx)(yt,{to:`/dashboard`,replace:!0})}),(0,Z.jsx)(bt,{path:`/dashboard`,element:(0,Z.jsx)(B8,{})}),(0,Z.jsx)(bt,{path:`/applications`,element:(0,Z.jsx)(K8,{})}),(0,Z.jsx)(bt,{path:`/applications/:id`,element:(0,Z.jsx)(J8,{})}),(0,Z.jsx)(bt,{path:`/openings`,element:(0,Z.jsx)(t5,{})}),(0,Z.jsx)(bt,{path:`/companies`,element:(0,Z.jsx)(Y8,{})}),(0,Z.jsx)(bt,{path:`/companies/:id`,element:(0,Z.jsx)(X8,{})}),(0,Z.jsx)(bt,{path:`/notes`,element:(0,Z.jsx)(Z8,{})}),(0,Z.jsx)(bt,{path:`/settings`,element:(0,Z.jsx)(c5,{})}),(0,Z.jsx)(bt,{path:`*`,element:(0,Z.jsx)(yt,{to:`/dashboard`,replace:!0})})]})})]})})})}var p5=new Nr({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});(0,Jr.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(x.StrictMode,{children:(0,Z.jsx)(Tn,{client:p5,children:(0,Z.jsx)(ln,{children:(0,Z.jsx)(f5,{})})})}));
|
|
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 E4(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:k4(t,`input`,e.processors),output:k4(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function D4(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 D4(r.element,n);if(r.type===`set`)return D4(r.valueType,n);if(r.type===`lazy`)return D4(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 D4(r.innerType,n);if(r.type===`intersection`)return D4(r.left,n)||D4(r.right,n);if(r.type===`record`||r.type===`map`)return D4(r.keyType,n)||D4(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:D4(r.in,n)||D4(r.out,n);if(r.type===`object`){for(let e in r.shape)if(D4(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(D4(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(D4(e,n))return!0;return!!(r.rest&&D4(r.rest,n))}return!1}var O4=(e,t={})=>n=>{let r=C4({...n,processors:t});return w4(e,r),T4(r,e),E4(r,e)},k4=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=C4({...i??{},target:a,io:t,processors:n});return w4(e,o),T4(o,e),E4(o,e)},A4={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},j4=(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=A4[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}))])}},M4=(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)},N4=(e,t,n,r)=>{n.type=`boolean`},P4=(e,t,n,r)=>{n.not={}},F4=(e,t,n,r)=>{let i=e._zod.def,a=s$(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},I4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},L4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},R4=(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=w4(a.element,t,{...r,path:[...r.path,`items`]})},z4=(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]=w4(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=w4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},B4=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>w4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},V4=(e,t,n,r)=>{let i=e._zod.def,a=w4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=w4(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]]},H4=(e,t,n,r)=>{let i=e._zod.def,a=w4(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`}]},U4=(e,t,n,r)=>{let i=e._zod.def;w4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},W4=(e,t,n,r)=>{let i=e._zod.def;w4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},G4=(e,t,n,r)=>{let i=e._zod.def;w4(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)))},K4=(e,t,n,r)=>{let i=e._zod.def;w4(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},q4=(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;w4(o,t,r);let s=t.seen.get(e);s.ref=o},J4=(e,t,n,r)=>{let i=e._zod.def;w4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Y4=(e,t,n,r)=>{let i=e._zod.def;w4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},X4=n$(`ZodISODateTime`,(e,t)=>{y0.init(e,t),C3.init(e,t)});function Z4(e){return U2(X4,e)}var Q4=n$(`ZodISODate`,(e,t)=>{b0.init(e,t),C3.init(e,t)});function $4(e){return W2(Q4,e)}var e3=n$(`ZodISOTime`,(e,t)=>{x0.init(e,t),C3.init(e,t)});function t3(e){return G2(e3,e)}var n3=n$(`ZodISODuration`,(e,t)=>{S0.init(e,t),C3.init(e,t)});function r3(e){return K2(n3,e)}var i3=n$(`ZodError`,(e,t)=>{G$.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>J$(e,t)},flatten:{value:t=>q$(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c$,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c$,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),a3=Y$(i3),o3=X$(i3),s3=Z$(i3),c3=$$(i3),l3=t1(i3),u3=n1(i3),d3=r1(i3),f3=i1(i3),p3=a1(i3),m3=o1(i3),h3=s1(i3),g3=c1(i3),_3=new WeakMap;function v3(e,t,n){let r=Object.getPrototypeOf(e),i=_3.get(r);if(i||(i=new Set,_3.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 y3=n$(`ZodType`,(e,t)=>(a0.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:k4(e,`input`),output:k4(e,`output`)}}),e.toJSONSchema=O4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>a3(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>s3(e,t,n),e.parseAsync=async(t,n)=>o3(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>c3(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>l3(e,t,n),e.decode=(t,n)=>u3(e,t,n),e.encodeAsync=async(t,n)=>d3(e,t,n),e.decodeAsync=async(t,n)=>f3(e,t,n),e.safeEncode=(t,n)=>p3(e,t,n),e.safeDecode=(t,n)=>m3(e,t,n),e.safeEncodeAsync=async(t,n)=>h3(e,t,n),e.safeDecodeAsync=async(t,n)=>g3(e,t,n),v3(e,`ZodType`,{check(...e){let t=this.def;return this.clone(g$(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 E$(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(M6(e,t))},superRefine(e,t){return this.check(N6(e,t))},overwrite(e){return this.check(p4(e))},optional(){return p6(this)},exactOptional(){return h6(this)},nullable(){return _6(this)},nullish(){return p6(_6(this))},nonoptional(e){return C6(this,e)},array(){return t6(this)},or(e){return a6([this,e])},and(e){return s6(this,e)},transform(e){return D6(this,d6(e))},default(e){return y6(this,e)},prefault(e){return x6(this,e)},catch(e){return T6(this,e)},pipe(e){return D6(this,e)},readonly(){return A6(this)},describe(e){let t=this.clone();return y2.add(t,{description:e}),t},meta(...e){if(e.length===0)return y2.get(this);let t=this.clone();return y2.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 y2.get(e)?.description},configurable:!0}),e)),b3=n$(`_ZodString`,(e,t)=>{o0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>j4(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,v3(e,`_ZodString`,{regex(...e){return this.check(s4(...e))},includes(...e){return this.check(u4(...e))},startsWith(...e){return this.check(d4(...e))},endsWith(...e){return this.check(f4(...e))},min(...e){return this.check(a4(...e))},max(...e){return this.check(i4(...e))},length(...e){return this.check(o4(...e))},nonempty(...e){return this.check(a4(1,...e))},lowercase(e){return this.check(c4(e))},uppercase(e){return this.check(l4(e))},trim(){return this.check(h4())},normalize(...e){return this.check(m4(...e))},toLowerCase(){return this.check(g4())},toUpperCase(){return this.check(_4())},slugify(){return this.check(v4())}})}),x3=n$(`ZodString`,(e,t)=>{o0.init(e,t),b3.init(e,t),e.email=t=>e.check(x2(w3,t)),e.url=t=>e.check(D2(O3,t)),e.jwt=t=>e.check(H2(U3,t)),e.emoji=t=>e.check(O2(k3,t)),e.guid=t=>e.check(S2(T3,t)),e.uuid=t=>e.check(C2(E3,t)),e.uuidv4=t=>e.check(w2(E3,t)),e.uuidv6=t=>e.check(T2(E3,t)),e.uuidv7=t=>e.check(E2(E3,t)),e.nanoid=t=>e.check(k2(A3,t)),e.guid=t=>e.check(S2(T3,t)),e.cuid=t=>e.check(A2(j3,t)),e.cuid2=t=>e.check(j2(M3,t)),e.ulid=t=>e.check(M2(N3,t)),e.base64=t=>e.check(z2(B3,t)),e.base64url=t=>e.check(B2(V3,t)),e.xid=t=>e.check(N2(P3,t)),e.ksuid=t=>e.check(P2(F3,t)),e.ipv4=t=>e.check(F2(I3,t)),e.ipv6=t=>e.check(I2(L3,t)),e.cidrv4=t=>e.check(L2(R3,t)),e.cidrv6=t=>e.check(R2(z3,t)),e.e164=t=>e.check(V2(H3,t)),e.datetime=t=>e.check(Z4(t)),e.date=t=>e.check($4(t)),e.time=t=>e.check(t3(t)),e.duration=t=>e.check(r3(t))});function S3(e){return b2(x3,e)}var C3=n$(`ZodStringFormat`,(e,t)=>{s0.init(e,t),b3.init(e,t)}),w3=n$(`ZodEmail`,(e,t)=>{u0.init(e,t),C3.init(e,t)}),T3=n$(`ZodGUID`,(e,t)=>{c0.init(e,t),C3.init(e,t)}),E3=n$(`ZodUUID`,(e,t)=>{l0.init(e,t),C3.init(e,t)});function D3(e){return C2(E3,e)}var O3=n$(`ZodURL`,(e,t)=>{d0.init(e,t),C3.init(e,t)}),k3=n$(`ZodEmoji`,(e,t)=>{f0.init(e,t),C3.init(e,t)}),A3=n$(`ZodNanoID`,(e,t)=>{p0.init(e,t),C3.init(e,t)}),j3=n$(`ZodCUID`,(e,t)=>{m0.init(e,t),C3.init(e,t)}),M3=n$(`ZodCUID2`,(e,t)=>{h0.init(e,t),C3.init(e,t)}),N3=n$(`ZodULID`,(e,t)=>{g0.init(e,t),C3.init(e,t)}),P3=n$(`ZodXID`,(e,t)=>{_0.init(e,t),C3.init(e,t)}),F3=n$(`ZodKSUID`,(e,t)=>{v0.init(e,t),C3.init(e,t)}),I3=n$(`ZodIPv4`,(e,t)=>{C0.init(e,t),C3.init(e,t)}),L3=n$(`ZodIPv6`,(e,t)=>{w0.init(e,t),C3.init(e,t)}),R3=n$(`ZodCIDRv4`,(e,t)=>{T0.init(e,t),C3.init(e,t)}),z3=n$(`ZodCIDRv6`,(e,t)=>{E0.init(e,t),C3.init(e,t)}),B3=n$(`ZodBase64`,(e,t)=>{O0.init(e,t),C3.init(e,t)}),V3=n$(`ZodBase64URL`,(e,t)=>{A0.init(e,t),C3.init(e,t)}),H3=n$(`ZodE164`,(e,t)=>{j0.init(e,t),C3.init(e,t)}),U3=n$(`ZodJWT`,(e,t)=>{N0.init(e,t),C3.init(e,t)}),W3=n$(`ZodNumber`,(e,t)=>{P0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>M4(e,t,n,r),v3(e,`ZodNumber`,{gt(e,t){return this.check(t4(e,t))},gte(e,t){return this.check(n4(e,t))},min(e,t){return this.check(n4(e,t))},lt(e,t){return this.check($2(e,t))},lte(e,t){return this.check(e4(e,t))},max(e,t){return this.check(e4(e,t))},int(e){return this.check(q3(e))},safe(e){return this.check(q3(e))},positive(e){return this.check(t4(0,e))},nonnegative(e){return this.check(n4(0,e))},negative(e){return this.check($2(0,e))},nonpositive(e){return this.check(e4(0,e))},multipleOf(e,t){return this.check(r4(e,t))},step(e,t){return this.check(r4(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 G3(e){return q2(W3,e)}var K3=n$(`ZodNumberFormat`,(e,t)=>{F0.init(e,t),W3.init(e,t)});function q3(e){return Y2(K3,e)}var J3=n$(`ZodBoolean`,(e,t)=>{I0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>N4(e,t,n,r)});function Y3(e){return X2(J3,e)}var X3=n$(`ZodUnknown`,(e,t)=>{L0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Z3(){return Z2(X3)}var Q3=n$(`ZodNever`,(e,t)=>{R0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>P4(e,t,n,r)});function $3(e){return Q2(Q3,e)}var e6=n$(`ZodArray`,(e,t)=>{B0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>R4(e,t,n,r),e.element=t.element,v3(e,`ZodArray`,{min(e,t){return this.check(a4(e,t))},nonempty(e){return this.check(a4(1,e))},max(e,t){return this.check(i4(e,t))},length(e,t){return this.check(o4(e,t))},unwrap(){return this.element}})});function t6(e,t){return y4(e6,e,t)}var n6=n$(`ZodObject`,(e,t)=>{G0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z4(e,t,n,r),m$(e,`shape`,()=>t.shape),v3(e,`ZodObject`,{keyof(){return l6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Z3()})},loose(){return this.clone({...this._zod.def,catchall:Z3()})},strict(){return this.clone({...this._zod.def,catchall:$3()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return M$(this,e)},safeExtend(e){return N$(this,e)},merge(e){return P$(this,e)},pick(e){return A$(this,e)},omit(e){return j$(this,e)},partial(...e){return F$(f6,this,e[0])},required(...e){return I$(S6,this,e[0])}})});function r6(e,t){return new n6({type:`object`,shape:e??{},...D$(t)})}var i6=n$(`ZodUnion`,(e,t)=>{q0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>B4(e,t,n,r),e.options=t.options});function a6(e,t){return new i6({type:`union`,options:e,...D$(t)})}var o6=n$(`ZodIntersection`,(e,t)=>{J0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V4(e,t,n,r)});function s6(e,t){return new o6({type:`intersection`,left:e,right:t})}var c6=n$(`ZodEnum`,(e,t)=>{Z0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>F4(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 c6({...t,checks:[],...D$(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 c6({...t,checks:[],...D$(r),entries:i})}});function l6(e,t){return new c6({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...D$(t)})}var u6=n$(`ZodTransform`,(e,t)=>{Q0.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>L4(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new i$(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(U$(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(U$(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 d6(e){return new u6({type:`transform`,transform:e})}var f6=n$(`ZodOptional`,(e,t)=>{e2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function p6(e){return new f6({type:`optional`,innerType:e})}var m6=n$(`ZodExactOptional`,(e,t)=>{t2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function h6(e){return new m6({type:`optional`,innerType:e})}var g6=n$(`ZodNullable`,(e,t)=>{n2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _6(e){return new g6({type:`nullable`,innerType:e})}var v6=n$(`ZodDefault`,(e,t)=>{r2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function y6(e,t){return new v6({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():C$(t)}})}var b6=n$(`ZodPrefault`,(e,t)=>{a2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function x6(e,t){return new b6({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():C$(t)}})}var S6=n$(`ZodNonOptional`,(e,t)=>{o2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>U4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function C6(e,t){return new S6({type:`nonoptional`,innerType:e,...D$(t)})}var w6=n$(`ZodCatch`,(e,t)=>{c2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function T6(e,t){return new w6({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var E6=n$(`ZodPipe`,(e,t)=>{l2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q4(e,t,n,r),e.in=t.in,e.out=t.out});function D6(e,t){return new E6({type:`pipe`,in:e,out:t})}var O6=n$(`ZodPreprocess`,(e,t)=>{E6.init(e,t),d2.init(e,t)}),k6=n$(`ZodReadonly`,(e,t)=>{f2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function A6(e){return new k6({type:`readonly`,innerType:e})}var j6=n$(`ZodCustom`,(e,t)=>{m2.init(e,t),y3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>I4(e,t,n,r)});function M6(e,t={}){return b4(j6,e,t)}function N6(e,t){return x4(e,t)}function P6(e,t){return new O6({type:`pipe`,in:d6(e),out:t})}function F6(e){return J2(W3,e)}var I6=S3().regex(/^\d{4}-\d{2}-\d{2}$/,`Expected a YYYY-MM-DD date`),L6=e=>S3().trim().max(e).nullish().transform(e=>e==null||e===``?null:e),R6=l6(zQ),z6=l6(WQ),B6=l6(qQ),V6=l6(JQ);l6(KQ);var H6=t6(S3().trim().min(1).max(60)).max(30);r6({companyName:S3().trim().min(1,`Company is required`).max(200),jobTitle:S3().trim().min(1,`Job title is required`).max(200),appliedOn:I6,status:R6.default(`applied`),jobUrl:L6(2e3),location:L6(200),workMode:z6.default(`unspecified`),sourceName:L6(120),salaryMin:G3().int().nonnegative().nullish().transform(e=>e??null),salaryMax:G3().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:L6(8),followUpOn:I6.nullish().transform(e=>e??null),tags:H6.default([]),notes:L6(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),r6({companyName:S3().trim().min(1).max(200).optional(),jobTitle:S3().trim().min(1).max(200).optional(),appliedOn:I6.optional(),status:R6.optional(),statusComment:S3().trim().max(2e3).nullish(),jobUrl:L6(2e3).optional(),location:L6(200).optional(),workMode:z6.optional(),sourceName:L6(120).optional(),salaryMin:G3().int().nonnegative().nullish(),salaryMax:G3().int().nonnegative().nullish(),salaryCurrency:L6(8).optional(),followUpOn:I6.nullish(),archived:Y3().optional(),tags:H6.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),r6({status:R6,occurredOn:I6.optional(),comment:S3().trim().max(2e3).nullish().transform(e=>e??null)});var U6=e=>P6(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},t6(e).optional()),W6=r6({q:S3().trim().max(300).optional(),year:F6().int().min(1970).max(2200).optional(),month:F6().int().min(1).max(12).optional(),status:U6(R6),workMode:U6(z6),tags:U6(S3()),companyId:D3().optional(),source:S3().trim().max(120).optional(),from:I6.optional(),to:I6.optional(),archived:l6([`true`,`false`,`all`]).default(`false`).transform(e=>e===`all`?`all`:e===`true`),followUpDue:l6([`true`,`false`]).optional().transform(e=>e===`true`),sort:l6([`appliedOn`,`company`,`jobTitle`,`status`,`createdAt`]).default(`appliedOn`),direction:l6([`asc`,`desc`]).default(`desc`),limit:F6().int().min(1).max(200).default(50),cursor:S3().optional()});r6({company:S3().trim().min(1).max(200),title:S3().trim().max(200).optional().default(``),excludeId:D3().optional()}),r6({q:S3().trim().min(1).max(300),limit:F6().int().min(1).max(100).default(25),types:U6(l6([`application`,`company`,`note`]))}),W6.extend({format:l6([`csv`,`xlsx`]).default(`csv`)}),r6({name:S3().trim().min(1).max(200),website:L6(2e3),location:L6(200),tags:H6.default([])}),r6({name:S3().trim().min(1).max(200).optional(),website:L6(2e3).optional(),location:L6(200).optional(),archived:Y3().optional(),tags:H6.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),r6({title:S3().trim().min(1).max(200),body:S3().max(5e4).default(``),targetType:B6.default(`standalone`),targetId:D3().nullish().transform(e=>e??null),pinned:Y3().default(!1)}),r6({title:S3().trim().min(1).max(200).optional(),body:S3().max(5e4).optional(),targetType:B6.optional(),targetId:D3().nullish(),pinned:Y3().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),r6({name:S3().trim().min(1).max(60),color:L6(30),scope:V6.default(`both`)}),r6({companyName:S3().trim().min(1,`Company is required`).max(200),jobTitle:S3().trim().min(1,`Job title is required`).max(200),jobUrl:L6(2e3),location:L6(200),workMode:z6.default(`unspecified`),sourceName:L6(120),salaryMin:G3().int().nonnegative().nullish().transform(e=>e??null),salaryMax:G3().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:L6(8),notes:L6(2e4),savedOn:I6.optional()}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),r6({companyName:S3().trim().min(1).max(200).optional(),jobTitle:S3().trim().min(1).max(200).optional(),jobUrl:L6(2e3).optional(),location:L6(200).optional(),workMode:z6.optional(),sourceName:L6(120).optional(),salaryMin:G3().int().nonnegative().nullish(),salaryMax:G3().int().nonnegative().nullish(),salaryCurrency:L6(8).optional(),notes:L6(2e4).optional(),savedOn:I6.optional(),archived:Y3().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),r6({appliedOn:I6.optional(),status:R6.optional(),tags:H6.optional()}),r6({target:S3().min(1)});function G6(e){return e===`exact`}var K6=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 q6(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 K6(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}function J6(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 Y6={csv:`text/csv`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};async function X6(e,t,n){let r=await fetch(`/api/import${J6({format:t,mode:n})}`,{method:`POST`,headers:{"Content-Type":Y6[t]},body:e}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok)throw new K6(r.status,a?.error??`unknown`,a?.message??r.statusText,a?.details);return a}async function Z6(e,t){let n=await fetch(`/api/backup/import${J6({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 K6(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}var Q6={listApplications:e=>q6(`/api/applications${J6(e)}`),getApplication:e=>q6(`/api/applications/${e}`),periods:()=>q6(`/api/applications/periods`),checkDuplicates:e=>q6(`/api/applications/check${J6(e)}`),createApplication:e=>q6(`/api/applications`,{method:`POST`,body:JSON.stringify(e)}),updateApplication:(e,t)=>q6(`/api/applications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),changeStatus:(e,t)=>q6(`/api/applications/${e}/status`,{method:`POST`,body:JSON.stringify(t)}),deleteApplication:e=>q6(`/api/applications/${e}`,{method:`DELETE`}),listCompanies:(e={})=>q6(`/api/companies${J6(e)}`),suggestCompanies:e=>q6(`/api/companies/suggest${J6({q:e})}`),getCompany:e=>q6(`/api/companies/${e}`),updateCompany:(e,t)=>q6(`/api/companies/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),listTags:()=>q6(`/api/tags`),listNotes:(e={})=>q6(`/api/notes${J6(e)}`),createNote:e=>q6(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>q6(`/api/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNote:e=>q6(`/api/notes/${e}`,{method:`DELETE`}),dashboard:()=>q6(`/api/dashboard`),search:(e,t)=>q6(`/api/search${J6({q:e,types:t,limit:25})}`),exportUrl:(e,t)=>`/api/export${J6({...e,format:t})}`,previewImport:(e,t)=>X6(e,t,`preview`),commitImport:(e,t)=>X6(e,t,`commit`),listOpenings:(e={})=>q6(`/api/openings${J6(e)}`),getOpening:e=>q6(`/api/openings/${e}`),createOpening:e=>q6(`/api/openings`,{method:`POST`,body:JSON.stringify(e)}),updateOpening:(e,t)=>q6(`/api/openings/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteOpening:e=>q6(`/api/openings/${e}`,{method:`DELETE`}),convertOpening:(e,t)=>q6(`/api/openings/${e}/convert`,{method:`POST`,body:JSON.stringify(t)}),getDbTargets:()=>q6(`/api/db/targets`),switchDb:e=>q6(`/api/db/switch`,{method:`POST`,body:JSON.stringify({target:e})}),backupExportUrl:`/api/backup/export`,previewBackup:e=>Z6(e,`preview`),commitBackup:e=>Z6(e,`commit`),getDataStatus:()=>q6(`/api/backup/status`),clearDatabase:()=>q6(`/api/backup/clear`,{method:`POST`}),seedDatabase:()=>q6(`/api/backup/seed`,{method:`POST`})},$6={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`]};function e8(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 t8(e){return Kr({queryKey:$6.applications(e),queryFn:()=>Q6.listApplications(e),placeholderData:e=>e})}function n8(e){return Kr({queryKey:$6.application(e??``),queryFn:()=>Q6.getApplication(e),enabled:!!e})}function r8(){return Kr({queryKey:$6.periods(),queryFn:()=>Q6.periods()})}function i8(){return Kr({queryKey:$6.dashboard(),queryFn:()=>Q6.dashboard()})}function a8(){return Kr({queryKey:$6.tags(),queryFn:()=>Q6.listTags()})}function o8(e={}){return Kr({queryKey:$6.companies(e),queryFn:()=>Q6.listCompanies(e)})}function s8(e){return Kr({queryKey:$6.company(e??``),queryFn:()=>Q6.getCompany(e),enabled:!!e})}function c8(e={}){return Kr({queryKey:$6.notes(e),queryFn:()=>Q6.listNotes(e)})}function l8(e){let{enabled:t=!0,...n}=e;return Kr({queryKey:$6.duplicates(n),queryFn:()=>Q6.checkDuplicates(n),enabled:t&&n.company.trim().length>1,staleTime:5e3})}function u8(e){return Kr({queryKey:$6.companySuggest(e),queryFn:()=>Q6.suggestCompanies(e),enabled:e.trim().length>0,staleTime:3e4})}function d8(){let e=wn();return qr({mutationFn:e=>Q6.createApplication(e),onSuccess:()=>e8(e)})}function f8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.updateApplication(e,t),onSuccess:()=>e8(e)})}function p8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.changeStatus(e,t),onSuccess:()=>e8(e)})}function m8(){let e=wn();return qr({mutationFn:e=>Q6.deleteApplication(e),onSuccess:()=>e8(e)})}function h8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.updateCompany(e,t),onSuccess:()=>e8(e)})}function g8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>e?Q6.updateNote(e,t):Q6.createNote(t),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`search`]})}})}function _8(){let e=wn();return qr({mutationFn:e=>Q6.deleteNote(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]})}})}function v8(e={}){return Kr({queryKey:$6.openings(e),queryFn:()=>Q6.listOpenings(e)})}function y8(e){e.invalidateQueries({queryKey:[`openings`]}),e.invalidateQueries({queryKey:[`opening`]})}function b8(){let e=wn();return qr({mutationFn:e=>Q6.createOpening(e),onSuccess:()=>y8(e)})}function x8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.updateOpening(e,t),onSuccess:()=>y8(e)})}function S8(){let e=wn();return qr({mutationFn:e=>Q6.deleteOpening(e),onSuccess:()=>y8(e)})}function C8(){let e=wn();return qr({mutationFn:({id:e,body:t})=>Q6.convertOpening(e,t),onSuccess:()=>{y8(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 w8(){return Kr({queryKey:$6.dbTargets(),queryFn:()=>Q6.getDbTargets()})}function T8(){return qr({mutationFn:e=>Q6.switchDb(e)})}function E8(){return Kr({queryKey:$6.dataStatus(),queryFn:()=>Q6.getDataStatus()})}function D8(){let e=wn();return qr({mutationFn:()=>Q6.clearDatabase(),onSuccess:()=>void e.invalidateQueries()})}function O8(){let e=wn();return qr({mutationFn:()=>Q6.seedDatabase(),onSuccess:()=>void e.invalidateQueries()})}function k8({status:e}){return(0,Z.jsx)(OY,{color:HQ[e],children:UQ[e]})}function A8(e,t=300){let[n,r]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var j8={exact:`error`,similar:`warning`,company:`info`,none:`success`};function M8({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:j8[e.verdict],showIcon:!0,style:{marginBottom:16},message:N8(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)(P8,{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 N8(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 P8({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)(un,{to:`/applications/${e.id}`,children:e.jobTitle}),(0,Z.jsx)(YX.Text,{type:`secondary`,children:e.appliedOn}),(0,Z.jsx)(OY,{color:HQ[e.status],children:UQ[e.status]}),e.matchKind===`exact`?(0,Z.jsx)(OY,{color:`red`,children:`exact title`}):(0,Z.jsxs)(OY,{children:[t,`% similar`]})]})}function F8({onStartApplication:e}){let[t,n]=(0,x.useState)(``),[r,i]=(0,x.useState)(``),a=A8(t,350),{data:o,isFetching:s}=l8({company:a,title:A8(r,350)}),c=a.trim().length>1;return(0,Z.jsx)(bF,{title:(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(CQ,{}),(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)(M8,{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 I8({open:e,onClose:t,application:n}){let[r]=WB.useForm(),{message:i,modal:a}=NC.useApp(),o=!!n,s=d8(),c=f8(),{data:l}=a8(),u=WB.useWatch(`companyName`,r)??``,d=WB.useWatch(`jobTitle`,r)??``,f=A8(u,300),p=A8(d,300),{data:m}=u8(f),{data:h,isFetching:g}=l8({company:f,title:p,...n?{excludeId:n.id}:{},enabled:e});(0,x.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 _=(0,x.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]),v=(0,x.useMemo)(()=>(l?.tags??[]).map(e=>({value:e.name,label:e.name})),[l]),[y,b]=(0,x.useState)(!1);async function S(e){if(h&&G6(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}};b(!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 K6&&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{b(!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:y,onClick:()=>r.submit(),children:o?`Save changes`:`Save application`})]}),children:[(0,Z.jsx)(M8,{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:_,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:zQ.map(e=>({value:e,label:UQ[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:WQ.map(e=>({value:e,label:GQ[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:v,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 L8={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`}},R8={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 z8(e){let t=L8[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 B8(){let{data:e,isLoading:t}=i8(),[n,r]=(0,x.useState)(!1),i=ZQ(QQ());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:R8.accent}})})}),(0,Z.jsx)(II,{xs:12,sm:12,md:6,children:(0,Z.jsx)(bF,{children:(0,Z.jsx)(QU,{title:`${e$(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:R8.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)(F8,{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)(un,{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)(k8,{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)(k8,{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)(un,{to:`/applications/${e.applicationId}`,children:e.jobTitle}),` at `,e.companyName]}),(0,Z.jsxs)(YX.Text,{type:`secondary`,style:{fontSize:12},children:[e.fromStatus?`${UQ[e.fromStatus]} → ${UQ[e.toStatus]}`:`Applied (${UQ[e.toStatus]})`,` `,`· `,e.occurredOn]})]})}))})})})]}),(0,Z.jsx)(I8,{open:n,onClose:()=>r(!1)})]})}function V8({periods:e,year:t,month:n,onSelect:r}){let i=(0,x.useMemo)(()=>e.map(e=>({key:`y:${e.year}`,title:(0,Z.jsx)(H8,{label:String(e.year),count:e.count,strong:!0}),children:(e.months??[]).map(e=>({key:`m:${e.year}:${e.month}`,title:(0,Z.jsx)(H8,{label:e$(e.month),count:e.count})}))})),[e]),a=(0,x.useMemo)(()=>t&&n?[`m:${t}:${n}`]:t?[`y:${t}`]:[],[t,n]),o=(0,x.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 H8({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 U8={new:`green`,duplicate:`default`,error:`red`},W8={new:`New`,duplicate:`Duplicate — skipped`,error:`Error`};function G8({open:e,onClose:t}){let n=wn(),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(`csv`),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(!1),[p,m]=(0,x.useState)(null);function h(){i(null),c(null),u(null),m(null)}function g(){h(),t()}let _=e=>{let t=e.name.toLowerCase().endsWith(`.xlsx`)?`xlsx`:`csv`;return i(e),o(t),m(null),f(!0),Q6.previewImport(e,t).then(c).catch(e=>m(e instanceof Error?e.message:`Could not read that file`)).finally(()=>f(!1)),!1};async function v(){if(r){f(!0),m(null);try{let e=await Q6.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:_,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?UQ[e]:`—`},{title:`Result`,dataIndex:`verdict`,width:200,render:(e,t)=>(0,Z.jsxs)(Pz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(OY,{color:U8[e],children:W8[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:v,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 K8(){let e=Ye(),[t,n]=gn(),[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(!1),s=(0,x.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}=t8(s),{data:d}=r8(),{data:f}=a8();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,` · `,GQ[t.workMode]]})]})},{title:`Status`,dataIndex:`status`,width:116,render:(e,t)=>(0,Z.jsx)(k8,{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`),_=h&&g?[(0,Yk.default)(h),(0,Yk.default)(g)]:null,v=(0,Yk.default)(),y=[{label:`Today`,value:[v,v]},{label:`Yesterday`,value:[v.subtract(1,`day`),v.subtract(1,`day`)]},{label:`This week`,value:[v.startOf(`week`),v.endOf(`week`)]},{label:`This month`,value:[v.startOf(`month`),v.endOf(`month`)]},{label:`Last 7 days`,value:[v.subtract(6,`day`),v]},{label:`Last 30 days`,value:[v.subtract(29,`day`),v]}];function b(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?`${e$(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)(V8,{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=Q6.exportUrl(s,e)}},children:(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(FZ,{}),children:`Export`})}),(0,Z.jsx)(Vk,{icon:(0,Z.jsx)(RQ,{}),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:_,presets:y,format:`YYYY-MM-DD`,onChange:e=>b(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:zQ.map(e=>({value:e,label:UQ[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:WQ.map(e=>({value:e,label:GQ[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)(FQ,{}),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:()=>q8(t,n,c.cursor),children:`Load more`})})}):void 0})]})}),(0,Z.jsx)(I8,{open:r,onClose:()=>i(!1)}),(0,Z.jsx)(G8,{open:a,onClose:()=>o(!1)})]})}function q8(e,t,n){if(!n)return;let r=new URLSearchParams(e);r.set(`cursor`,n),t(r)}function J8(){let{id:e}=Ze(),t=Ye(),{message:n}=NC.useApp(),{data:r,isLoading:i}=n8(e),a=p8(),o=m8(),[s,c]=(0,x.useState)(!1);if(i||!r)return(0,Z.jsx)(CS,{active:!0,paragraph:{rows:10}});let l=VQ(r.status);async function u(t){e&&(await a.mutateAsync({id:e,body:{status:t,comment:null}}),n.success(`Moved to ${UQ[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)(un,{to:`/companies/${r.company.id}`,children:r.company.name}),(0,Z.jsxs)(YX.Text,{type:`secondary`,children:[`applied `,r.appliedOn]}),(0,Z.jsx)(k8,{status:r.status})]})]}),(0,Z.jsxs)(Pz,{wrap:!0,children:[l&&(0,Z.jsxs)(Vk,{type:`primary`,onClick:()=>void u(l),children:[`Move to `,UQ[l]]}),(0,Z.jsx)(EE,{style:{width:150},value:r.status,onChange:e=>void u(e),options:zQ.map(e=>({value:e,label:UQ[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:GQ[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)(dQ,{}),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?`${UQ[e.fromStatus]} → ${UQ[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)(I8,{open:s,onClose:()=>c(!1),application:r})]})}function Y8(){let e=Ye(),[t,n]=(0,x.useState)(``),r=A8(t,300),{data:i,isLoading:a}=o8(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 X8(){let{id:e}=Ze(),t=Ye(),{data:n,isLoading:r}=s8(e),{data:i}=c8(e?{targetType:`company`,targetId:e}:{}),{data:a}=a8(),o=h8();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:R8.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)(k8,{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 Z8(){let{message:e}=NC.useApp(),[t,n]=(0,x.useState)(`all`),[r,i]=(0,x.useState)(``),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),{data:l,isLoading:u}=c8(t===`all`?{}:{targetType:t}),d=_8(),f=l?.notes??[],p=(0,x.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)(bQ,{style:{color:`#faad14`}}),(0,Z.jsx)(YX.Text,{strong:!0,children:t.title}),(0,Z.jsx)(Q8,{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)($8,{open:s||a!==null,note:a,onClose:()=>{c(!1),o(null)}})]})}function Q8({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)(un,{to:t,children:(0,Z.jsxs)(OY,{color:`blue`,children:[e.targetType,`: `,e.targetLabel??`view`]})})}function $8({open:e,note:t,onClose:n}){let[r]=WB.useForm(),{message:i}=NC.useApp(),a=g8(),o=WB.useWatch(`targetType`,r)??`standalone`,{data:s}=o8(),{data:c}=t8({limit:200}),l=(0,x.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 e5({open:e,onClose:t,opening:n}){let[r]=WB.useForm(),{message:i}=NC.useApp(),a=!!n,o=b8(),s=x8(),{data:c}=u8(WB.useWatch(`companyName`,r)??``);(0,x.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,x.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 K6&&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:WQ.map(e=>({value:e,label:GQ[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 t5(){let e=Ye(),{message:t}=NC.useApp(),{data:n,isLoading:r}=v8(),{data:i}=a8(),a=S8(),o=C8(),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(void 0),[d,f]=(0,x.useState)(null),[p]=WB.useForm();function m(e){f(e),p.setFieldsValue({appliedOn:(0,Yk.default)(),status:`applied`,tags:[]})}async function h(n){if(d)try{let r=await o.mutateAsync({id:d.id,body:{appliedOn:n.appliedOn.format(`YYYY-MM-DD`),status:n.status,tags:n.tags??[]}});t.success(`Converted to an application`),f(null),e(`/applications/${r.id}`)}catch(e){t.error(e instanceof Error?e.message:`Could not convert`)}}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:`Saved for later — convert one to a real application when you're ready to apply.`})]}),(0,Z.jsx)(Vk,{type:`primary`,icon:(0,Z.jsx)(cP,{}),onClick:()=>{u(void 0),c(!0)},children:`Save opening for later`})]}),(0,Z.jsx)(bF,{size:`small`,children:(0,Z.jsx)(hY,{rowKey:`id`,columns:[{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,GQ[t.workMode]].filter(Boolean).join(` · `)||(0,Z.jsx)(YX.Text,{type:`secondary`,children:`—`})},{title:`Source`,dataIndex:`sourceName`,render:e=>e??`—`},{title:``,key:`actions`,width:260,render:(e,t)=>(0,Z.jsxs)(Pz,{onClick:e=>e.stopPropagation(),children:[t.jobUrl&&(0,Z.jsx)(gD,{title:`Open job posting`,children:(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(dQ,{}),href:t.jobUrl,target:`_blank`,rel:`noreferrer`})}),(0,Z.jsx)(Vk,{size:`small`,icon:(0,Z.jsx)(qB,{}),onClick:()=>m(t),children:`Convert`}),(0,Z.jsx)(Vk,{size:`small`,onClick:()=>{u(t),c(!0)},children:`Edit`}),(0,Z.jsx)(VH,{title:`Delete this opening?`,onConfirm:()=>a.mutate(t.id),okText:`Delete`,okButtonProps:{danger:!0},children:(0,Z.jsx)(Vk,{size:`small`,danger:!0,children:`Delete`})})]})}],dataSource:n?.openings??[],loading:r,pagination:!1,locale:{emptyText:(0,Z.jsx)(YT,{image:YT.PRESENTED_IMAGE_SIMPLE,description:`Nothing saved yet — use “Save opening for later” for a role you're not ready to apply to.`})}})}),(0,Z.jsx)(e5,{open:s,onClose:()=>c(!1),opening:l}),(0,Z.jsx)(LH,{title:d?`Convert "${d.jobTitle}" at ${d.company.name}`:``,open:!!d,onCancel:()=>f(null),onOk:()=>p.submit(),okText:`Create application`,confirmLoading:o.isPending,children:(0,Z.jsxs)(WB,{form:p,layout:`vertical`,onFinish:h,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:zQ.map(e=>({value:e,label:UQ[e]}))})}),(0,Z.jsx)(WB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(EE,{mode:`tags`,options:(i?.tags??[]).map(e=>({value:e.name,label:e.name})),placeholder:`fintech, remote-ok…`,tokenSeparators:[`,`]})})]})})]})}var n5={companies:`Companies`,applications:`Applications`,tags:`Tags`,tagLinks:`Tag links`,notes:`Notes`,statusEvents:`Status events`,jobOpenings:`Job openings`};function r5({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:n5[e]??e,children:t},e))})}function i5(){let{message:e}=NC.useApp(),{data:t,isLoading:n}=w8(),r=T8(),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!1),c=(0,x.useRef)(null);(0,x.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(()=>{Q6.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 a5(){let{message:e}=NC.useApp(),[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(null),[d,f]=(0,x.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),Q6.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 Q6.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=Q6.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)(r5,{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)(r5,{counts:a.counts}),(0,Z.jsx)(Vk,{type:`primary`,onClick:()=>window.location.reload(),children:`Reload`})]})})]})})]})}var o5=`CLEAR`;function s5(){let{message:e}=NC.useApp(),{data:t,isLoading:n}=E8(),r=D8(),i=O8(),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.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)(r5,{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)(r5,{counts:f}),(0,Z.jsxs)(YX.Text,{children:[`Type `,(0,Z.jsx)(YX.Text,{code:!0,children:o5}),` to confirm.`]}),(0,Z.jsx)(_V,{value:s,onChange:e=>c(e.target.value),placeholder:o5,onPressEnter:()=>s===o5&&u()}),(0,Z.jsxs)(Pz,{children:[(0,Z.jsx)(Vk,{onClick:l,children:`Cancel`}),(0,Z.jsx)(Vk,{danger:!0,type:`primary`,disabled:s!==o5,loading:r.isPending,onClick:u,children:`Clear database`})]})]})})]})}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)(i5,{}),(0,Z.jsx)(a5,{}),(0,Z.jsx)(s5,{})]})}var l5=`jobtrack.theme`,u5=[{key:`/dashboard`,icon:(0,Z.jsx)(XZ,{}),label:(0,Z.jsx)(un,{to:`/dashboard`,children:`Dashboard`})},{key:`/applications`,icon:(0,Z.jsx)(_Q,{}),label:(0,Z.jsx)(un,{to:`/applications`,children:`Applications`})},{key:`/openings`,icon:(0,Z.jsx)(qZ,{}),label:(0,Z.jsx)(un,{to:`/openings`,children:`Openings`})},{key:`/companies`,icon:(0,Z.jsx)(kQ,{}),label:(0,Z.jsx)(un,{to:`/companies`,children:`Companies`})},{key:`/notes`,icon:(0,Z.jsx)($z,{}),label:(0,Z.jsx)(un,{to:`/notes`,children:`Notes`})},{key:`/settings`,icon:(0,Z.jsx)(EQ,{}),label:(0,Z.jsx)(un,{to:`/settings`,children:`Settings`})}],d5=[{key:`light`,icon:(0,Z.jsx)(MQ,{}),label:`Light`},{key:`dark`,icon:(0,Z.jsx)(mQ,{}),label:`Dark`}];function f5(){let[e,t]=(0,x.useState)(()=>{try{let e=localStorage.getItem(l5);if(e)return e===`dark`}catch{}return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1});(0,x.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`);try{localStorage.setItem(l5,e?`dark`:`light`)}catch{}},[e]);let n=Ke(),r=(0,x.useMemo)(()=>{let e=u5.find(e=>n.pathname.startsWith(e.key));return e?[e.key]:[`/dashboard`]},[n.pathname]);return(0,Z.jsx)(Nh,{theme:z8(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 ${R8.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:R8.accent},children:`Track`})]}),(0,Z.jsx)(Fk,{mode:`horizontal`,selectedKeys:r,items:u5,style:{flex:1,minWidth:0,borderBottom:`none`}}),(0,Z.jsx)(Iz,{trigger:[`click`],menu:{items:d5,selectable:!0,selectedKeys:[e?`dark`:`light`],onClick:({key:e})=>t(e===`dark`)},children:(0,Z.jsx)(Vk,{icon:e?(0,Z.jsx)(mQ,{}):(0,Z.jsx)(MQ,{}),"aria-label":`Theme settings`,children:`Theme`})})]}),(0,Z.jsx)(EV.Content,{style:{padding:24},children:(0,Z.jsxs)(St,{children:[(0,Z.jsx)(bt,{path:`/`,element:(0,Z.jsx)(yt,{to:`/dashboard`,replace:!0})}),(0,Z.jsx)(bt,{path:`/dashboard`,element:(0,Z.jsx)(B8,{})}),(0,Z.jsx)(bt,{path:`/applications`,element:(0,Z.jsx)(K8,{})}),(0,Z.jsx)(bt,{path:`/applications/:id`,element:(0,Z.jsx)(J8,{})}),(0,Z.jsx)(bt,{path:`/openings`,element:(0,Z.jsx)(t5,{})}),(0,Z.jsx)(bt,{path:`/companies`,element:(0,Z.jsx)(Y8,{})}),(0,Z.jsx)(bt,{path:`/companies/:id`,element:(0,Z.jsx)(X8,{})}),(0,Z.jsx)(bt,{path:`/notes`,element:(0,Z.jsx)(Z8,{})}),(0,Z.jsx)(bt,{path:`/settings`,element:(0,Z.jsx)(c5,{})}),(0,Z.jsx)(bt,{path:`*`,element:(0,Z.jsx)(yt,{to:`/dashboard`,replace:!0})})]})})]})})})}var p5=new Nr({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});(0,Jr.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(x.StrictMode,{children:(0,Z.jsx)(Tn,{client:p5,children:(0,Z.jsx)(ln,{children:(0,Z.jsx)(f5,{})})})}));
|
|
444
|
+
//# sourceMappingURL=index-BdMHFySq.js.map
|
|
@@ -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-BdMHFySq.js"></script>
|
|
22
22
|
<link rel="stylesheet" crossorigin href="/assets/index-CRnClsEb.css">
|
|
23
23
|
</head>
|
|
24
24
|
<body>
|