jobtrack 1.0.11 → 1.0.12
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jobtrack",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Runs the JobTrack API + web UI as one background process with a Windows tray icon",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@fastify/static": "^10.1.3",
|
|
33
|
-
"@jobtrack/api": "^1.0.
|
|
33
|
+
"@jobtrack/api": "^1.0.8",
|
|
34
34
|
"fastify": "^5.12.1",
|
|
35
35
|
"systray": "^1.0.5",
|
|
36
36
|
"tsx": "^4.23.12"
|
|
@@ -440,7 +440,7 @@ 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=N$,s=!v$.jitless,c=s&&P$.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?n2([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function a2(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=>!X$(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=>e1(e,r,y$())))}),t)}var o2=h$(`$ZodUnion`,(e,t)=>{v0.init(e,t),D$(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),D$(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),D$(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),D$(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=>w$(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=>a2(t,r,e,i)):a2(o,r,e,i)}}),s2=h$(`$ZodIntersection`,(e,t)=>{v0.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])=>l2(e,t,n)):l2(e,i,a)}});function c2(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(F$(e)&&F$(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=c2(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=c2(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 l2(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}),X$(e))return e;let o=c2(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var u2=h$(`$ZodEnum`,(e,t)=>{v0.init(e,t);let n=b$(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>L$.has(typeof e)).map(e=>typeof e==`string`?R$(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}}),d2=h$(`$ZodTransform`,(e,t)=>{v0.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _$(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 g$;return n.value=i,n.fallback=!0,n}});function f2(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var p2=h$(`$ZodOptional`,(e,t)=>{v0.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,D$(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),D$(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${w$(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=>f2(e,r)):f2(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),m2=h$(`$ZodExactOptional`,(e,t)=>{p2.init(e,t),D$(e._zod,`values`,()=>t.innerType._zod.values),D$(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),h2=h$(`$ZodNullable`,(e,t)=>{v0.init(e,t),D$(e._zod,`optin`,()=>t.innerType._zod.optin),D$(e._zod,`optout`,()=>t.innerType._zod.optout),D$(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${w$(e.source)}|null)$`):void 0}),D$(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)}),g2=h$(`$ZodDefault`,(e,t)=>{v0.init(e,t),e._zod.optin=`optional`,D$(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=>_2(e,t)):_2(r,t)}});function _2(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var v2=h$(`$ZodPrefault`,(e,t)=>{v0.init(e,t),e._zod.optin=`optional`,D$(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))}),y2=h$(`$ZodNonOptional`,(e,t)=>{v0.init(e,t),D$(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=>b2(t,e)):b2(i,e)}});function b2(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 x2=h$(`$ZodCatch`,(e,t)=>{v0.init(e,t),e._zod.optin=`optional`,D$(e._zod,`optout`,()=>t.innerType._zod.optout),D$(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=>e1(e,n,y$()))},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=>e1(e,n,y$()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),S2=h$(`$ZodPipe`,(e,t)=>{v0.init(e,t),D$(e._zod,`values`,()=>t.in._zod.values),D$(e._zod,`optin`,()=>t.in._zod.optin),D$(e._zod,`optout`,()=>t.out._zod.optout),D$(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=>C2(e,t.in,n)):C2(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>C2(e,t.out,n)):C2(r,t.out,n)}});function C2(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 w2=h$(`$ZodPreprocess`,(e,t)=>{S2.init(e,t)}),T2=h$(`$ZodReadonly`,(e,t)=>{v0.init(e,t),D$(e._zod,`propValues`,()=>t.innerType._zod.propValues),D$(e._zod,`values`,()=>t.innerType._zod.values),D$(e._zod,`optin`,()=>t.innerType?._zod?.optin),D$(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(E2):E2(r)}});function E2(e){return e.value=Object.freeze(e.value),e}var D2=h$(`$ZodCustom`,(e,t)=>{$1.init(e,t),v0.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=>O2(t,n,r,e));O2(i,n,r,e)}});function O2(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(n1(e))}}var k2,A2=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 j2(){return new A2}(k2=globalThis).__zod_globalRegistry??(k2.__zod_globalRegistry=j2());var M2=globalThis.__zod_globalRegistry;function N2(e,t){return new e({type:`string`,...B$(t)})}function P2(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...B$(t)})}function F2(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...B$(t)})}function I2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...B$(t)})}function L2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...B$(t)})}function R2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...B$(t)})}function z2(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...B$(t)})}function B2(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...B$(t)})}function V2(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...B$(t)})}function H2(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...B$(t)})}function U2(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...B$(t)})}function W2(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...B$(t)})}function G2(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...B$(t)})}function K2(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...B$(t)})}function q2(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...B$(t)})}function J2(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...B$(t)})}function Y2(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...B$(t)})}function X2(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...B$(t)})}function Z2(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...B$(t)})}function Q2(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...B$(t)})}function $2(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...B$(t)})}function e4(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...B$(t)})}function t4(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...B$(t)})}function n4(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...B$(t)})}function r4(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...B$(t)})}function i4(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...B$(t)})}function a4(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...B$(t)})}function o4(e,t){return new e({type:`number`,checks:[],...B$(t)})}function s4(e,t){return new e({type:`number`,coerce:!0,checks:[],...B$(t)})}function c4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...B$(t)})}function l4(e,t){return new e({type:`boolean`,...B$(t)})}function u4(e){return new e({type:`unknown`})}function d4(e,t){return new e({type:`never`,...B$(t)})}function f4(e,t){return new t0({check:`less_than`,...B$(t),value:e,inclusive:!1})}function p4(e,t){return new t0({check:`less_than`,...B$(t),value:e,inclusive:!0})}function m4(e,t){return new n0({check:`greater_than`,...B$(t),value:e,inclusive:!1})}function h4(e,t){return new n0({check:`greater_than`,...B$(t),value:e,inclusive:!0})}function g4(e,t){return new r0({check:`multiple_of`,...B$(t),value:e})}function _4(e,t){return new a0({check:`max_length`,...B$(t),maximum:e})}function v4(e,t){return new o0({check:`min_length`,...B$(t),minimum:e})}function y4(e,t){return new s0({check:`length_equals`,...B$(t),length:e})}function b4(e,t){return new l0({check:`string_format`,format:`regex`,...B$(t),pattern:e})}function x4(e){return new u0({check:`string_format`,format:`lowercase`,...B$(e)})}function S4(e){return new d0({check:`string_format`,format:`uppercase`,...B$(e)})}function C4(e,t){return new f0({check:`string_format`,format:`includes`,...B$(t),includes:e})}function w4(e,t){return new p0({check:`string_format`,format:`starts_with`,...B$(t),prefix:e})}function T4(e,t){return new m0({check:`string_format`,format:`ends_with`,...B$(t),suffix:e})}function E4(e){return new h0({check:`overwrite`,tx:e})}function D4(e){return E4(t=>t.normalize(e))}function O4(){return E4(e=>e.trim())}function k4(){return E4(e=>e.toLowerCase())}function A4(){return E4(e=>e.toUpperCase())}function j4(){return E4(e=>j$(e))}function M4(e,t,n){return new e({type:`array`,element:t,...B$(n)})}function N4(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...B$(n)})}function P4(e,t){let n=F4(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(n1(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(n1(r))}},e(t.value,t)),t);return n}function F4(e,t){let n=new $1({check:`custom`,...B$(t)});return n._zod.check=e,n}function I4(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??M2,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 L4(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,L4(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`&&B4(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 R4(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 z4(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:H4(t,`input`,e.processors),output:H4(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function B4(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 B4(r.element,n);if(r.type===`set`)return B4(r.valueType,n);if(r.type===`lazy`)return B4(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 B4(r.innerType,n);if(r.type===`intersection`)return B4(r.left,n)||B4(r.right,n);if(r.type===`record`||r.type===`map`)return B4(r.keyType,n)||B4(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:B4(r.in,n)||B4(r.out,n);if(r.type===`object`){for(let e in r.shape)if(B4(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(B4(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(B4(e,n))return!0;return!!(r.rest&&B4(r.rest,n))}return!1}var V4=(e,t={})=>n=>{let r=I4({...n,processors:t});return L4(e,r),R4(r,e),z4(r,e)},H4=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=I4({...i??{},target:a,io:t,processors:n});return L4(e,o),R4(o,e),z4(o,e)},U4={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},W4=(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=U4[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}))])}},G4=(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)},K4=(e,t,n,r)=>{n.type=`boolean`},q4=(e,t,n,r)=>{n.not={}},J4=(e,t,n,r)=>{let i=e._zod.def,a=b$(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Y4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},X4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Z4=(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=L4(a.element,t,{...r,path:[...r.path,`items`]})},Q4=(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]=L4(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=L4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},$4=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>L4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},e3=(e,t,n,r)=>{let i=e._zod.def,a=L4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=L4(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]]},t3=(e,t,n,r)=>{let i=e._zod.def,a=L4(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`}]},n3=(e,t,n,r)=>{let i=e._zod.def;L4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},r3=(e,t,n,r)=>{let i=e._zod.def;L4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},i3=(e,t,n,r)=>{let i=e._zod.def;L4(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)))},a3=(e,t,n,r)=>{let i=e._zod.def;L4(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},o3=(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;L4(o,t,r);let s=t.seen.get(e);s.ref=o},s3=(e,t,n,r)=>{let i=e._zod.def;L4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},c3=(e,t,n,r)=>{let i=e._zod.def;L4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},l3=h$(`ZodISODateTime`,(e,t)=>{M0.init(e,t),I3.init(e,t)});function u3(e){return n4(l3,e)}var d3=h$(`ZodISODate`,(e,t)=>{N0.init(e,t),I3.init(e,t)});function f3(e){return r4(d3,e)}var p3=h$(`ZodISOTime`,(e,t)=>{P0.init(e,t),I3.init(e,t)});function m3(e){return i4(p3,e)}var h3=h$(`ZodISODuration`,(e,t)=>{F0.init(e,t),I3.init(e,t)});function g3(e){return a4(h3,e)}var _3=h$(`ZodError`,(e,t)=>{i1.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>s1(e,t)},flatten:{value:t=>o1(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,x$,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,x$,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),v3=c1(_3),y3=l1(_3),b3=u1(_3),x3=f1(_3),S3=m1(_3),C3=h1(_3),w3=g1(_3),T3=_1(_3),E3=v1(_3),D3=y1(_3),O3=b1(_3),k3=x1(_3),A3=new WeakMap;function j3(e,t,n){let r=Object.getPrototypeOf(e),i=A3.get(r);if(i||(i=new Set,A3.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 M3=h$(`ZodType`,(e,t)=>(v0.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:H4(e,`input`),output:H4(e,`output`)}}),e.toJSONSchema=V4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>v3(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>b3(e,t,n),e.parseAsync=async(t,n)=>y3(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>x3(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>S3(e,t,n),e.decode=(t,n)=>C3(e,t,n),e.encodeAsync=async(t,n)=>w3(e,t,n),e.decodeAsync=async(t,n)=>T3(e,t,n),e.safeEncode=(t,n)=>E3(e,t,n),e.safeDecode=(t,n)=>D3(e,t,n),e.safeEncodeAsync=async(t,n)=>O3(e,t,n),e.safeDecodeAsync=async(t,n)=>k3(e,t,n),j3(e,`ZodType`,{check(...e){let t=this.def;return this.clone(k$(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 z$(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(G6(e,t))},superRefine(e,t){return this.check(K6(e,t))},overwrite(e){return this.check(E4(e))},optional(){return E6(this)},exactOptional(){return O6(this)},nullable(){return A6(this)},nullish(){return E6(A6(this))},nonoptional(e){return I6(this,e)},array(){return m6(this)},or(e){return v6([this,e])},and(e){return b6(this,e)},transform(e){return B6(this,w6(e))},default(e){return M6(this,e)},prefault(e){return P6(this,e)},catch(e){return R6(this,e)},pipe(e){return B6(this,e)},readonly(){return U6(this)},describe(e){let t=this.clone();return M2.add(t,{description:e}),t},meta(...e){if(e.length===0)return M2.get(this);let t=this.clone();return M2.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 M2.get(e)?.description},configurable:!0}),e)),N3=h$(`_ZodString`,(e,t)=>{y0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W4(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,j3(e,`_ZodString`,{regex(...e){return this.check(b4(...e))},includes(...e){return this.check(C4(...e))},startsWith(...e){return this.check(w4(...e))},endsWith(...e){return this.check(T4(...e))},min(...e){return this.check(v4(...e))},max(...e){return this.check(_4(...e))},length(...e){return this.check(y4(...e))},nonempty(...e){return this.check(v4(1,...e))},lowercase(e){return this.check(x4(e))},uppercase(e){return this.check(S4(e))},trim(){return this.check(O4())},normalize(...e){return this.check(D4(...e))},toLowerCase(){return this.check(k4())},toUpperCase(){return this.check(A4())},slugify(){return this.check(j4())}})}),P3=h$(`ZodString`,(e,t)=>{y0.init(e,t),N3.init(e,t),e.email=t=>e.check(P2(L3,t)),e.url=t=>e.check(B2(V3,t)),e.jwt=t=>e.check(t4(n6,t)),e.emoji=t=>e.check(V2(H3,t)),e.guid=t=>e.check(F2(R3,t)),e.uuid=t=>e.check(I2(z3,t)),e.uuidv4=t=>e.check(L2(z3,t)),e.uuidv6=t=>e.check(R2(z3,t)),e.uuidv7=t=>e.check(z2(z3,t)),e.nanoid=t=>e.check(H2(U3,t)),e.guid=t=>e.check(F2(R3,t)),e.cuid=t=>e.check(U2(W3,t)),e.cuid2=t=>e.check(W2(G3,t)),e.ulid=t=>e.check(G2(K3,t)),e.base64=t=>e.check(Q2($3,t)),e.base64url=t=>e.check($2(e6,t)),e.xid=t=>e.check(K2(q3,t)),e.ksuid=t=>e.check(q2(J3,t)),e.ipv4=t=>e.check(J2(Y3,t)),e.ipv6=t=>e.check(Y2(X3,t)),e.cidrv4=t=>e.check(X2(Z3,t)),e.cidrv6=t=>e.check(Z2(Q3,t)),e.e164=t=>e.check(e4(t6,t)),e.datetime=t=>e.check(u3(t)),e.date=t=>e.check(f3(t)),e.time=t=>e.check(m3(t)),e.duration=t=>e.check(g3(t))});function F3(e){return N2(P3,e)}var I3=h$(`ZodStringFormat`,(e,t)=>{b0.init(e,t),N3.init(e,t)}),L3=h$(`ZodEmail`,(e,t)=>{C0.init(e,t),I3.init(e,t)}),R3=h$(`ZodGUID`,(e,t)=>{x0.init(e,t),I3.init(e,t)}),z3=h$(`ZodUUID`,(e,t)=>{S0.init(e,t),I3.init(e,t)});function B3(e){return I2(z3,e)}var V3=h$(`ZodURL`,(e,t)=>{w0.init(e,t),I3.init(e,t)}),H3=h$(`ZodEmoji`,(e,t)=>{T0.init(e,t),I3.init(e,t)}),U3=h$(`ZodNanoID`,(e,t)=>{E0.init(e,t),I3.init(e,t)}),W3=h$(`ZodCUID`,(e,t)=>{D0.init(e,t),I3.init(e,t)}),G3=h$(`ZodCUID2`,(e,t)=>{O0.init(e,t),I3.init(e,t)}),K3=h$(`ZodULID`,(e,t)=>{k0.init(e,t),I3.init(e,t)}),q3=h$(`ZodXID`,(e,t)=>{A0.init(e,t),I3.init(e,t)}),J3=h$(`ZodKSUID`,(e,t)=>{j0.init(e,t),I3.init(e,t)}),Y3=h$(`ZodIPv4`,(e,t)=>{I0.init(e,t),I3.init(e,t)}),X3=h$(`ZodIPv6`,(e,t)=>{L0.init(e,t),I3.init(e,t)}),Z3=h$(`ZodCIDRv4`,(e,t)=>{R0.init(e,t),I3.init(e,t)}),Q3=h$(`ZodCIDRv6`,(e,t)=>{z0.init(e,t),I3.init(e,t)}),$3=h$(`ZodBase64`,(e,t)=>{V0.init(e,t),I3.init(e,t)}),e6=h$(`ZodBase64URL`,(e,t)=>{U0.init(e,t),I3.init(e,t)}),t6=h$(`ZodE164`,(e,t)=>{W0.init(e,t),I3.init(e,t)}),n6=h$(`ZodJWT`,(e,t)=>{K0.init(e,t),I3.init(e,t)}),r6=h$(`ZodNumber`,(e,t)=>{q0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G4(e,t,n,r),j3(e,`ZodNumber`,{gt(e,t){return this.check(m4(e,t))},gte(e,t){return this.check(h4(e,t))},min(e,t){return this.check(h4(e,t))},lt(e,t){return this.check(f4(e,t))},lte(e,t){return this.check(p4(e,t))},max(e,t){return this.check(p4(e,t))},int(e){return this.check(o6(e))},safe(e){return this.check(o6(e))},positive(e){return this.check(m4(0,e))},nonnegative(e){return this.check(h4(0,e))},negative(e){return this.check(f4(0,e))},nonpositive(e){return this.check(p4(0,e))},multipleOf(e,t){return this.check(g4(e,t))},step(e,t){return this.check(g4(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 i6(e){return o4(r6,e)}var a6=h$(`ZodNumberFormat`,(e,t)=>{J0.init(e,t),r6.init(e,t)});function o6(e){return c4(a6,e)}var s6=h$(`ZodBoolean`,(e,t)=>{Y0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K4(e,t,n,r)});function c6(e){return l4(s6,e)}var l6=h$(`ZodUnknown`,(e,t)=>{X0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function u6(){return u4(l6)}var d6=h$(`ZodNever`,(e,t)=>{Z0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q4(e,t,n,r)});function f6(e){return d4(d6,e)}var p6=h$(`ZodArray`,(e,t)=>{$0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Z4(e,t,n,r),e.element=t.element,j3(e,`ZodArray`,{min(e,t){return this.check(v4(e,t))},nonempty(e){return this.check(v4(1,e))},max(e,t){return this.check(_4(e,t))},length(e,t){return this.check(y4(e,t))},unwrap(){return this.element}})});function m6(e,t){return M4(p6,e,t)}var h6=h$(`ZodObject`,(e,t)=>{i2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Q4(e,t,n,r),D$(e,`shape`,()=>t.shape),j3(e,`ZodObject`,{keyof(){return S6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:u6()})},loose(){return this.clone({...this._zod.def,catchall:u6()})},strict(){return this.clone({...this._zod.def,catchall:f6()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return G$(this,e)},safeExtend(e){return K$(this,e)},merge(e){return q$(this,e)},pick(e){return U$(this,e)},omit(e){return W$(this,e)},partial(...e){return J$(T6,this,e[0])},required(...e){return Y$(F6,this,e[0])}})});function g6(e,t){return new h6({type:`object`,shape:e??{},...B$(t)})}var _6=h$(`ZodUnion`,(e,t)=>{o2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$4(e,t,n,r),e.options=t.options});function v6(e,t){return new _6({type:`union`,options:e,...B$(t)})}var y6=h$(`ZodIntersection`,(e,t)=>{s2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e3(e,t,n,r)});function b6(e,t){return new y6({type:`intersection`,left:e,right:t})}var x6=h$(`ZodEnum`,(e,t)=>{u2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J4(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 x6({...t,checks:[],...B$(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 x6({...t,checks:[],...B$(r),entries:i})}});function S6(e,t){return new x6({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...B$(t)})}var C6=h$(`ZodTransform`,(e,t)=>{d2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X4(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _$(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(n1(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(n1(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 w6(e){return new C6({type:`transform`,transform:e})}var T6=h$(`ZodOptional`,(e,t)=>{p2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function E6(e){return new T6({type:`optional`,innerType:e})}var D6=h$(`ZodExactOptional`,(e,t)=>{m2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function O6(e){return new D6({type:`optional`,innerType:e})}var k6=h$(`ZodNullable`,(e,t)=>{h2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function A6(e){return new k6({type:`nullable`,innerType:e})}var j6=h$(`ZodDefault`,(e,t)=>{g2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function M6(e,t){return new j6({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():I$(t)}})}var N6=h$(`ZodPrefault`,(e,t)=>{v2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>i3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function P6(e,t){return new N6({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():I$(t)}})}var F6=h$(`ZodNonOptional`,(e,t)=>{y2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function I6(e,t){return new F6({type:`nonoptional`,innerType:e,...B$(t)})}var L6=h$(`ZodCatch`,(e,t)=>{x2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>a3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function R6(e,t){return new L6({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var z6=h$(`ZodPipe`,(e,t)=>{S2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o3(e,t,n,r),e.in=t.in,e.out=t.out});function B6(e,t){return new z6({type:`pipe`,in:e,out:t})}var V6=h$(`ZodPreprocess`,(e,t)=>{z6.init(e,t),w2.init(e,t)}),H6=h$(`ZodReadonly`,(e,t)=>{T2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function U6(e){return new H6({type:`readonly`,innerType:e})}var W6=h$(`ZodCustom`,(e,t)=>{D2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y4(e,t,n,r)});function G6(e,t={}){return N4(W6,e,t)}function K6(e,t){return P4(e,t)}function q6(e,t){return new V6({type:`pipe`,in:w6(e),out:t})}function J6(e){return s4(r6,e)}var Y6=F3().regex(/^\d{4}-\d{2}-\d{2}$/,`Expected a YYYY-MM-DD date`),X6=e=>F3().trim().max(e).nullish().transform(e=>e==null||e===``?null:e),Z6=S6(QQ),Q6=S6(r$),$6=S6(o$),e8=S6(s$);S6(a$);var t8=m6(F3().trim().min(1).max(60)).max(30);g6({companyName:F3().trim().min(1,`Company is required`).max(200),jobTitle:F3().trim().min(1,`Job title is required`).max(200),appliedOn:Y6,status:Z6.default(`applied`),jobUrl:X6(2e3),location:X6(200),workMode:Q6.default(`unspecified`),sourceName:X6(120),salaryMin:i6().int().nonnegative().nullish().transform(e=>e??null),salaryMax:i6().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:X6(8),followUpOn:Y6.nullish().transform(e=>e??null),tags:t8.default([]),notes:X6(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),g6({companyName:F3().trim().min(1).max(200).optional(),jobTitle:F3().trim().min(1).max(200).optional(),appliedOn:Y6.optional(),status:Z6.optional(),statusComment:F3().trim().max(2e3).nullish(),jobUrl:X6(2e3).optional(),location:X6(200).optional(),workMode:Q6.optional(),sourceName:X6(120).optional(),salaryMin:i6().int().nonnegative().nullish(),salaryMax:i6().int().nonnegative().nullish(),salaryCurrency:X6(8).optional(),followUpOn:Y6.nullish(),archived:c6().optional(),tags:t8.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),g6({status:Z6,occurredOn:Y6.optional(),comment:F3().trim().max(2e3).nullish().transform(e=>e??null)});var n8=e=>q6(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},m6(e).optional()),r8=g6({q:F3().trim().max(300).optional(),year:J6().int().min(1970).max(2200).optional(),month:J6().int().min(1).max(12).optional(),status:n8(Z6),workMode:n8(Q6),tags:n8(F3()),companyId:B3().optional(),source:F3().trim().max(120).optional(),from:Y6.optional(),to:Y6.optional(),archived:S6([`true`,`false`,`all`]).default(`false`).transform(e=>e===`all`?`all`:e===`true`),followUpDue:S6([`true`,`false`]).optional().transform(e=>e===`true`),sort:S6([`appliedOn`,`company`,`jobTitle`,`status`,`createdAt`]).default(`appliedOn`),direction:S6([`asc`,`desc`]).default(`desc`),limit:J6().int().min(1).max(200).default(50),cursor:F3().optional()});g6({company:F3().trim().min(1).max(200),title:F3().trim().max(200).optional().default(``),excludeId:B3().optional()}),g6({q:F3().trim().min(1).max(300),limit:J6().int().min(1).max(100).default(25),types:n8(S6([`application`,`company`,`note`]))}),r8.extend({format:S6([`csv`,`xlsx`]).default(`csv`)}),g6({name:F3().trim().min(1).max(200),website:X6(2e3),location:X6(200),tags:t8.default([])}),g6({name:F3().trim().min(1).max(200).optional(),website:X6(2e3).optional(),location:X6(200).optional(),archived:c6().optional(),tags:t8.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),g6({title:F3().trim().min(1).max(200),body:F3().max(5e4).default(``),targetType:$6.default(`standalone`),targetId:B3().nullish().transform(e=>e??null),pinned:c6().default(!1)}),g6({title:F3().trim().min(1).max(200).optional(),body:F3().max(5e4).optional(),targetType:$6.optional(),targetId:B3().nullish(),pinned:c6().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),g6({name:F3().trim().min(1).max(60),color:X6(30),scope:e8.default(`both`)}),g6({companyName:F3().trim().min(1,`Company is required`).max(200),jobTitle:F3().trim().min(1,`Job title is required`).max(200),jobUrl:X6(2e3),location:X6(200),workMode:Q6.default(`unspecified`),sourceName:X6(120),salaryMin:i6().int().nonnegative().nullish().transform(e=>e??null),salaryMax:i6().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:X6(8),notes:X6(2e4),savedOn:Y6.optional()}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),g6({companyName:F3().trim().min(1).max(200).optional(),jobTitle:F3().trim().min(1).max(200).optional(),jobUrl:X6(2e3).optional(),location:X6(200).optional(),workMode:Q6.optional(),sourceName:X6(120).optional(),salaryMin:i6().int().nonnegative().nullish(),salaryMax:i6().int().nonnegative().nullish(),salaryCurrency:X6(8).optional(),notes:X6(2e4).optional(),savedOn:Y6.optional(),archived:c6().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),g6({appliedOn:Y6.optional(),status:Z6.optional(),tags:t8.optional()}),g6({url:F3().trim().min(1).max(2e3)}),g6({text:F3().min(1).max(2e5),url:X6(2e3).optional()}),g6({companyName:F3().trim().min(1,`Company is required`).max(200),jobTitle:F3().trim().min(1,`Job title is required`).max(200),jobUrl:X6(2e3),location:X6(200),workMode:Q6.default(`unspecified`),sourceName:X6(120),salaryMin:i6().int().nonnegative().nullish().transform(e=>e??null),salaryMax:i6().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:X6(8),notes:X6(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),g6({target:F3().min(1)});function i8(e){return e===`exact`}var a8=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 o8(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 a8(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}function s8(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 c8={csv:`text/csv`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};async function l8(e,t,n){let r=await fetch(`/api/import${s8({format:t,mode:n})}`,{method:`POST`,headers:{"Content-Type":c8[t]},body:e}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok)throw new a8(r.status,a?.error??`unknown`,a?.message??r.statusText,a?.details);return a}async function u8(e,t){let n=await fetch(`/api/backup/import${s8({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 a8(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}var d8={listApplications:e=>o8(`/api/applications${s8(e)}`),getApplication:e=>o8(`/api/applications/${e}`),periods:()=>o8(`/api/applications/periods`),checkDuplicates:e=>o8(`/api/applications/check${s8(e)}`),createApplication:e=>o8(`/api/applications`,{method:`POST`,body:JSON.stringify(e)}),updateApplication:(e,t)=>o8(`/api/applications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),changeStatus:(e,t)=>o8(`/api/applications/${e}/status`,{method:`POST`,body:JSON.stringify(t)}),deleteApplication:e=>o8(`/api/applications/${e}`,{method:`DELETE`}),listCompanies:(e={})=>o8(`/api/companies${s8(e)}`),suggestCompanies:e=>o8(`/api/companies/suggest${s8({q:e})}`),getCompany:e=>o8(`/api/companies/${e}`),updateCompany:(e,t)=>o8(`/api/companies/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),listTags:()=>o8(`/api/tags`),listNotes:(e={})=>o8(`/api/notes${s8(e)}`),createNote:e=>o8(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>o8(`/api/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNote:e=>o8(`/api/notes/${e}`,{method:`DELETE`}),dashboard:()=>o8(`/api/dashboard`),search:(e,t)=>o8(`/api/search${s8({q:e,types:t,limit:25})}`),exportUrl:(e,t)=>`/api/export${s8({...e,format:t})}`,previewImport:(e,t)=>l8(e,t,`preview`),commitImport:(e,t)=>l8(e,t,`commit`),listOpenings:(e={})=>o8(`/api/openings${s8(e)}`),getOpening:e=>o8(`/api/openings/${e}`),createOpening:e=>o8(`/api/openings`,{method:`POST`,body:JSON.stringify(e)}),updateOpening:(e,t)=>o8(`/api/openings/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteOpening:e=>o8(`/api/openings/${e}`,{method:`DELETE`}),convertOpening:(e,t)=>o8(`/api/openings/${e}/convert`,{method:`POST`,body:JSON.stringify(t)}),ingestUrl:e=>o8(`/api/ingest/url`,{method:`POST`,body:JSON.stringify({url:e})}),ingestText:(e,t)=>o8(`/api/ingest/text`,{method:`POST`,body:JSON.stringify({text:e,url:t??null})}),clipPosting:e=>o8(`/api/ingest/clip`,{method:`POST`,body:JSON.stringify(e)}),getDbTargets:()=>o8(`/api/db/targets`),switchDb:e=>o8(`/api/db/switch`,{method:`POST`,body:JSON.stringify({target:e})}),backupExportUrl:`/api/backup/export`,previewBackup:e=>u8(e,`preview`),commitBackup:e=>u8(e,`commit`),getDataStatus:()=>o8(`/api/backup/status`),clearDatabase:()=>o8(`/api/backup/clear`,{method:`POST`}),seedDatabase:()=>o8(`/api/backup/seed`,{method:`POST`}),getMeta:()=>o8(`/api/meta`)},f8=class extends Error{name=`RepoError`;cause;constructor(e,t){super(e),t?.cause!==void 0&&(this.cause=t.cause)}},p8=class extends f8{name=`SchemaError`},m8=new Set([`string`,`number`,`integer`,`boolean`,`date`,`json`]);function h8(e){let t=Object.keys(e);if(t.length===0)throw new p8(`A schema must define at least one field`);let n={},r={},i={},a;for(let o of t){let t=e[o];if(!m8.has(t.type))throw new p8(`Field "${o}" has unknown type ${JSON.stringify(t.type)}. Expected one of: ${[...m8].join(`, `)}`);let s=t.column??o;if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(s))throw new p8(`Field "${o}" maps to column ${JSON.stringify(s)}, which is not a plain identifier. Column names must match /^[A-Za-z_][A-Za-z0-9_]*$/ because repolayer never quotes-and-interpolates arbitrary text into SQL.`);if(s in r)throw new p8(`Fields "${r[s]}" and "${o}" both map to column "${s}"`);if(t.primaryKey){if(a!==void 0)throw new p8(`Schema declares two primary keys ("${a}" and "${o}"). repolayer supports single-column primary keys only.`);if(t.nullable)throw new p8(`Primary key "${o}" cannot be nullable`);a=o}n[o]=s,r[s]=o,i[o]=t.type}if(a===void 0)throw new p8("Schema has no primary key. Mark exactly one field with `primaryKey: true`.");return Object.freeze({fields:e,primaryKey:a,columns:Object.freeze(n),fieldsByColumn:Object.freeze(r),fieldNames:Object.freeze(t),types:Object.freeze(i)})}var g8={createdAt:{type:`date`,column:`created_at`},updatedAt:{type:`date`,column:`updated_at`}};h8({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},website:{type:`string`,nullable:!0},location:{type:`string`,nullable:!0},archived:{type:`boolean`},...g8}),h8({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},titleKey:{type:`string`,column:`title_key`},appliedOn:{type:`date`,column:`applied_on`},periodYear:{type:`integer`,column:`period_year`},periodMonth:{type:`integer`,column:`period_month`},status:{type:`string`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},followUpOn:{type:`date`,nullable:!0,column:`follow_up_on`},archived:{type:`boolean`},...g8}),h8({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},color:{type:`string`,nullable:!0},scope:{type:`string`},...g8}),h8({id:{type:`string`,primaryKey:!0},tagId:{type:`string`,column:`tag_id`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},...g8}),h8({id:{type:`string`,primaryKey:!0},title:{type:`string`},body:{type:`string`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,nullable:!0,column:`target_id`},pinned:{type:`boolean`},...g8}),h8({id:{type:`string`,primaryKey:!0},applicationId:{type:`string`,column:`application_id`},fromStatus:{type:`string`,nullable:!0,column:`from_status`},toStatus:{type:`string`,column:`to_status`},occurredOn:{type:`date`,column:`occurred_on`},commentText:{type:`string`,nullable:!0,column:`comment_text`},...g8}),h8({id:{type:`string`,primaryKey:!0},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},model:{type:`string`},dim:{type:`integer`},embedding:{type:`json`},textHash:{type:`string`,column:`text_hash`},...g8}),h8({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},notes:{type:`string`,nullable:!0},savedOn:{type:`date`,column:`saved_on`},archived:{type:`boolean`},convertedApplicationId:{type:`string`,nullable:!0,column:`converted_application_id`},...g8}),[{header:`Position`,value:e=>e.jobTitle,width:34},{header:`Company`,value:e=>e.company.name,width:28},{header:`Date`,value:e=>e.appliedOn,width:13},{header:`Status`,value:e=>n$[e.status],width:13},{header:`Notes`,value:e=>e.notesText,width:70,wrap:!0}].map(e=>e.header),new Map(Object.entries(n$).map(([e,t])=>[t.toLowerCase(),e]));var _8=d8,v8={applications:e=>[`applications`,e],application:e=>[`application`,e],periods:()=>[`periods`],companies:e=>[`companies`,e],company:e=>[`company`,e],companySuggest:e=>[`company-suggest`,e],tags:()=>[`tags`],notes:e=>[`notes`,e],dashboard:()=>[`dashboard`],duplicates:e=>[`duplicates`,e],search:e=>[`search`,e],openings:e=>[`openings`,e],opening:e=>[`opening`,e],dbTargets:()=>[`db-targets`],dataStatus:()=>[`data-status`],meta:()=>[`meta`]};function 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:[`company`]}),e.invalidateQueries({queryKey:[`tags`]}),e.invalidateQueries({queryKey:[`duplicates`]}),e.invalidateQueries({queryKey:[`search`]})}function b8(e){return Xr({queryKey:v8.applications(e),queryFn:()=>_8.listApplications(e),placeholderData:e=>e})}function x8(e){return Qr({queryKey:v8.applications(e),queryFn:({pageParam:t})=>_8.listApplications(t?{...e,cursor:t}:e),initialPageParam:null,getNextPageParam:e=>e.hasMore?e.cursor:null,placeholderData:e=>e})}function S8(e){return Xr({queryKey:v8.application(e??``),queryFn:()=>_8.getApplication(e),enabled:!!e})}function C8(){return Xr({queryKey:v8.periods(),queryFn:()=>_8.periods()})}function w8(){return Xr({queryKey:v8.dashboard(),queryFn:()=>_8.dashboard()})}function T8(){return Xr({queryKey:v8.tags(),queryFn:()=>_8.listTags()})}function E8(e={}){return Xr({queryKey:v8.companies(e),queryFn:()=>_8.listCompanies(e)})}function D8(e){return Xr({queryKey:v8.company(e??``),queryFn:()=>_8.getCompany(e),enabled:!!e})}function O8(e={}){return Xr({queryKey:v8.notes(e),queryFn:()=>_8.listNotes(e)})}function k8(e){let{enabled:t=!0,...n}=e;return Xr({queryKey:v8.duplicates(n),queryFn:()=>_8.checkDuplicates(n),enabled:t&&n.company.trim().length>1,staleTime:5e3})}function A8(e){return Xr({queryKey:v8.companySuggest(e),queryFn:()=>_8.suggestCompanies(e),enabled:e.trim().length>0,staleTime:3e4})}function j8(){let e=Tn();return Zr({mutationFn:e=>_8.createApplication(e),onSuccess:()=>y8(e)})}function M8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.updateApplication(e,t),onSuccess:()=>y8(e)})}function N8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.changeStatus(e,t),onSuccess:()=>y8(e)})}function P8(){let e=Tn();return Zr({mutationFn:e=>_8.deleteApplication(e),onSuccess:()=>y8(e)})}function F8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.updateCompany(e,t),onSuccess:()=>y8(e)})}function I8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>e?_8.updateNote(e,t):_8.createNote(t),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`search`]})}})}function L8(){let e=Tn();return Zr({mutationFn:e=>_8.deleteNote(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]})}})}function R8(e={}){return Xr({queryKey:v8.openings(e),queryFn:()=>_8.listOpenings(e)})}function z8(e){e.invalidateQueries({queryKey:[`openings`]}),e.invalidateQueries({queryKey:[`opening`]})}function B8(){let e=Tn();return Zr({mutationFn:e=>_8.createOpening(e),onSuccess:()=>z8(e)})}function V8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.updateOpening(e,t),onSuccess:()=>z8(e)})}function H8(){let e=Tn();return Zr({mutationFn:e=>_8.deleteOpening(e),onSuccess:()=>z8(e)})}function U8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.convertOpening(e,t),onSuccess:()=>{z8(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 Xr({queryKey:v8.dbTargets(),queryFn:()=>_8.getDbTargets()})}function G8(){return Zr({mutationFn:e=>_8.switchDb(e)})}function K8(){return Xr({queryKey:v8.dataStatus(),queryFn:()=>_8.getDataStatus()})}function q8(){let e=Tn();return Zr({mutationFn:()=>_8.clearDatabase(),onSuccess:()=>void e.invalidateQueries()})}function J8(){let e=Tn();return Zr({mutationFn:()=>_8.seedDatabase(),onSuccess:()=>void e.invalidateQueries()})}function Y8(){return Xr({queryKey:v8.meta(),queryFn:()=>_8.getMeta(),staleTime:1/0})}function X8({status:e}){return(0,Z.jsx)(MY,{color:t$[e],children:n$[e]})}function Z8(e,t=300){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var Q8={exact:`error`,similar:`warning`,company:`info`,none:`success`};function $8({check:e,loading:t}){if(t&&!e)return(0,Z.jsx)(Fp,{type:`info`,showIcon:!0,message:`Checking your history…`,style:{marginBottom:16}});if(!e)return null;if(e.verdict===`none`)return(0,Z.jsx)(Fp,{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)(Fp,{type:Q8[e.verdict],showIcon:!0,style:{marginBottom:16},message:e5(e.verdict,n,e.priorCount),description:(0,Z.jsxs)(Rz,{direction:`vertical`,size:6,style:{width:`100%`},children:[e.matches.length>0?e.matches.slice(0,5).map(e=>(0,Z.jsx)(t5,{match:e},e.id)):(0,Z.jsx)($X.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)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Matched on wording only — semantic matching is still warming up.`})]})})}function e5(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 t5({match:e}){let t=Math.round(Math.max(e.titleSimilarity,e.semanticSimilarity??0)*100);return(0,Z.jsxs)(Rz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),(0,Z.jsx)($X.Text,{type:`secondary`,children:e.appliedOn}),(0,Z.jsx)(MY,{color:t$[e.status],children:n$[e.status]}),e.matchKind===`exact`?(0,Z.jsx)(MY,{color:`red`,children:`exact title`}):(0,Z.jsxs)(MY,{children:[t,`% similar`]})]})}function n5({onStartApplication:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(``),a=Z8(t,350),{data:o,isFetching:s}=k8({company:a,title:Z8(r,350)}),c=a.trim().length>1;return(0,Z.jsx)(wF,{title:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(IQ,{}),(0,Z.jsx)(`span`,{children:`Check before you apply`})]}),extra:e&&(0,Z.jsx)(Gk,{type:`link`,onClick:e,children:`New application`}),children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(WU,{gutter:12,children:[(0,Z.jsx)(BI,{xs:24,sm:12,children:(0,Z.jsx)(xV,{placeholder:`Company`,value:t,onChange:e=>n(e.target.value),allowClear:!0})}),(0,Z.jsx)(BI,{xs:24,sm:12,children:(0,Z.jsx)(xV,{placeholder:`Job title (optional)`,value:r,onChange:e=>i(e.target.value),allowClear:!0})})]}),c?(0,Z.jsx)($8,{check:o,loading:s}):(0,Z.jsx)($X.Text,{type:`secondary`,children:`Type a company name to see whether you have been here before.`})]})})}function r5({open:e,onClose:t,application:n}){let[r]=JB.useForm(),{message:i,modal:a}=LC.useApp(),o=!!n,s=j8(),c=M8(),{data:l}=T8(),u=JB.useWatch(`companyName`,r)??``,d=JB.useWatch(`jobTitle`,r)??``,f=Z8(u,300),p=Z8(d,300),m=o&&u.trim()===(n?.company.name??``).trim()&&d.trim()===(n?.jobTitle??``).trim(),{data:h}=A8(f),{data:g,isFetching:v}=k8({company:f,title:p,...n?{excludeId:n.id}:{},enabled:e&&!m});(0,_.useEffect)(()=>{e&&(n?r.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,appliedOn:(0,$k.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,$k.default)(n.followUpOn):null,tags:n.tags.map(e=>e.name)}):(r.resetFields(),r.setFieldsValue({appliedOn:(0,$k.default)(),status:`applied`,workMode:`unspecified`,tags:[]})))},[e,n,r]);let y=(0,_.useMemo)(()=>(h?.companies??[]).map(e=>({value:e.name,label:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(`span`,{children:e.name}),e.applicationCount>0&&(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[e.applicationCount,` application`,e.applicationCount===1?``:`s`]})]})})),[h]),b=(0,_.useMemo)(()=>(l?.tags??[]).map(e=>({value:e.name,label:e.name})),[l]),[x,S]=(0,_.useState)(!1);async function C(e){if(g&&i8(g.verdict)&&!o&&!await new Promise(e=>{a.confirm({title:`You have applied for this exact role before`,content:(0,Z.jsxs)(Rz,{direction:`vertical`,children:[(0,Z.jsxs)($X.Text,{children:[g.matches[0]?.jobTitle,` at `,g.company?.name,` on`,` `,g.matches[0]?.appliedOn,`.`]}),(0,Z.jsx)($X.Text,{type:`secondary`,children:`Save this as a new application anyway?`})]}),okText:`Save anyway`,cancelText:`Go back`,onOk:()=>e(!0),onCancel:()=>e(!1)})}))return;let l={companyName:e.companyName,jobTitle:e.jobTitle,appliedOn:e.appliedOn.format(`YYYY-MM-DD`),status:e.status,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,followUpOn:e.followUpOn?e.followUpOn.format(`YYYY-MM-DD`):null,tags:e.tags??[],...o?{}:{notes:e.notes??null}};S(!0);try{n?(await c.mutateAsync({id:n.id,body:l}),i.success(`Application updated`)):(await s.mutateAsync(l),i.success(`Application saved`)),t()}catch(e){e instanceof a8&&e.fieldErrors.length>0?(r.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),i.error(`Please check the highlighted fields`)):i.error(e instanceof Error?e.message:`Could not save`)}finally{S(!1)}}return(0,Z.jsxs)(kz,{title:o?`Edit application`:`New application`,open:e,onClose:t,width:640,destroyOnHidden:!0,extra:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Gk,{type:`primary`,loading:x,onClick:()=>r.submit(),children:o?`Save changes`:`Save application`})]}),children:[!m&&(0,Z.jsx)($8,{check:g,loading:v}),(0,Z.jsxs)(JB,{form:r,layout:`vertical`,onFinish:C,requiredMark:`optional`,children:[(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:12,children:(0,Z.jsx)(JB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(LE,{options:y,placeholder:`Start typing — existing companies appear`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(BI,{span:12,children:(0,Z.jsx)(JB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(xV,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(KR,{style:{width:`100%`},format:`YYYY-MM-DD`})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(AE,{options:QQ.map(e=>({value:e,label:n$[e]}))})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`followUpOn`,label:`Follow up on`,children:(0,Z.jsx)(KR,{style:{width:`100%`},format:`YYYY-MM-DD`,allowClear:!0})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(AE,{options:r$.map(e=>({value:e,label:i$[e]}))})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(xV,{placeholder:`Stockholm`})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(xV,{placeholder:`LinkedIn, referral…`})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(VL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(VL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(xV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(JB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(xV,{placeholder:`https://…`})}),(0,Z.jsx)(JB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(AE,{mode:`tags`,options:b,placeholder:`fintech, remote-ok, dream-job…`,tokenSeparators:[`,`]})}),!o&&(0,Z.jsx)(JB.Item,{name:`notes`,label:`Notes`,help:`Saved as a note linked to this application. Searchable.`,children:(0,Z.jsx)(xV.TextArea,{rows:4,placeholder:`Anything worth remembering…`})})]})]})}var i5={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`}},a5={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 o5(e){let t=i5[e];return{algorithm:e===`dark`?HY.darkAlgorithm:HY.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 s5(e){return`${p$(e.month).slice(0,3)} ${e.year}`}function c5({points:e,height:t=140}){let[n,r]=(0,_.useState)(null);if(e.length===0)return null;let i=Math.max(...e.map(e=>e.count),1),a=e.reduce((e,t)=>e+t.count,0),o=n===null?null:e[n];return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`baseline`,style:{marginBottom:8},children:[(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:o?`${s5(o)}: ${o.count} application${o.count===1?``:`s`}`:`${a} application${a===1?``:`s`} over ${e.length} months`}),(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[`peak `,i]})]}),(0,Z.jsxs)(`svg`,{viewBox:`0 0 ${e.length*10} 100`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Applications per month, ${s5(e[0])} to ${s5(e.at(-1))}. Peak ${i} in one month, ${a} in total.`,style:{display:`block`,width:`100%`,height:t},onMouseLeave:()=>r(null),children:[(0,Z.jsx)(`title`,{children:`Applications per month`}),e.map((e,t)=>{let a=e.count===0?0:Math.max(e.count/i*100,2);return(0,Z.jsxs)(`g`,{onMouseEnter:()=>r(t),children:[(0,Z.jsx)(`rect`,{x:t*10,y:`0`,width:10,height:100,fill:`transparent`}),(0,Z.jsx)(`rect`,{x:t*10+3/2,y:100-a,width:7,height:Math.max(a,1),rx:`1`,fill:e.count===0?a5.border:a5.accent,opacity:n===null||n===t?1:.45})]},`${e.year}-${e.month}`)})]}),(0,Z.jsx)(eB,{justify:`space-between`,style:{marginTop:6},children:[e[0],e[Math.floor(e.length/2)],e.at(-1)].map((e,t)=>(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:11},children:s5(e)},t))})]})}var l5=[.45,.6,.78,1];function u5({stages:e}){let t=e[0]?.count??0;return(0,Z.jsxs)(Rz,{direction:`vertical`,size:10,style:{width:`100%`},children:[e.map((e,n)=>{let r=t>0?e.count/t:0;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,marginBottom:4,gap:8},children:[(0,Z.jsx)($X.Text,{style:{fontSize:13},children:n$[e.status]}),(0,Z.jsxs)(Rz,{size:8,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e.count}),e.conversion!==null&&(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[Math.round(e.conversion*100),`% of previous`]})]})]}),(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 6`,preserveAspectRatio:`none`,role:`img`,"aria-label":`${n$[e.status]}: ${e.count} applications ever reached this stage`,style:{display:`block`,width:`100%`,height:10},children:[(0,Z.jsx)(`title`,{children:`${n$[e.status]}: ${e.count}`}),(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`6`,rx:`1.5`,fill:a5.bgSunken}),r>0&&(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:Math.max(r*100,1),height:`6`,rx:`1.5`,fill:a5.accent,opacity:l5[n]??1})]})]},e.status)}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Counted from your status history — an application that interviewed and was then turned down still counts at every stage it reached.`})]})}function d5({values:e,label:t,height:n=28}){if(e.length<2)return null;let r=Math.max(...e,1),i=100/(e.length-1),a=e.map((e,t)=>`${(t*i).toFixed(2)},${(100-e/r*100).toFixed(2)}`).join(` `),o=`0,100 ${a} 100,100`;return(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 100`,preserveAspectRatio:`none`,role:`img`,"aria-label":t,style:{display:`block`,width:`100%`,height:n},children:[(0,Z.jsx)(`title`,{children:t}),(0,Z.jsx)(`polygon`,{points:o,fill:a5.accent,opacity:.12}),(0,Z.jsx)(`polyline`,{points:a,fill:`none`,stroke:a5.accent,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`})]})}function f5(){let{data:e,isLoading:t}=w8(),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(`follow-ups`),o=u$(d$());if(t||!e)return(0,Z.jsx)(DS,{active:!0,paragraph:{rows:8}});let{stats:s,followUps:c,recentActivity:l,funnel:u,volume:d,stale:f}=e;if(s.total===0)return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wF,{children:(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,children:[(0,Z.jsx)($X.Text,{strong:!0,children:`No applications yet`}),(0,Z.jsx)($X.Text,{type:`secondary`,children:`Add the first one, or bring in a spreadsheet you already keep.`})]}),children:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{type:`primary`,icon:(0,Z.jsx)(fP,{}),onClick:()=>r(!0),children:`New application`}),(0,Z.jsx)(dn,{to:`/applications`,children:(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(ZQ,{}),children:`Import`})})]})})}),(0,Z.jsx)(r5,{open:n,onClose:()=>r(!1)})]});let p=d.slice(-12),m=d.slice(-13,-1),h=m.length>0?m.reduce((e,t)=>e+t.count,0)/m.length:0,g=s.thisMonth-h,v=i===`follow-ups`?c.length:f.length;return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsx)(nW,{title:`Total applications`,value:s.total})})}),(0,Z.jsx)(BI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsx)(nW,{title:`Still active`,value:s.active,valueStyle:{color:a5.accent}})})}),(0,Z.jsx)(BI,{xs:12,sm:12,md:6,children:(0,Z.jsxs)(wF,{size:`small`,children:[(0,Z.jsx)(nW,{title:`${p$(o.month)} ${o.year}`,value:s.thisMonth}),(0,Z.jsx)(d5,{values:p.map(e=>e.count),label:`Applications in each of the last ${p.length} months: ${p.map(e=>e.count).join(`, `)}`}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:h===0?`first month on record`:`${g>=0?`+`:``}${g.toFixed(1)} vs your monthly average`})]})}),(0,Z.jsx)(BI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)($X.Text,{type:`secondary`,children:`Response rate`}),(0,Z.jsx)(wU,{percent:Math.round(s.responseRate*100),size:`small`,strokeColor:a5.accent}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Anything past “applied” counts as a reply`})]})})})]}),(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:24,lg:14,children:(0,Z.jsx)(n5,{onStartApplication:()=>r(!0)})}),(0,Z.jsx)(BI,{xs:24,lg:10,children:(0,Z.jsx)(wF,{title:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(VR,{}),(0,Z.jsx)(`span`,{children:`Needs attention`})]}),extra:(0,Z.jsx)(eL,{size:`small`,value:i,onChange:e=>a(e),options:[{label:`Follow-ups (${c.length})`,value:`follow-ups`},{label:`Gone quiet (${f.length})`,value:`quiet`}]}),styles:{body:{maxHeight:320,overflowY:`auto`}},children:v===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:i===`follow-ups`?`Nothing due — all caught up`:`Nothing has gone quiet`}):i===`follow-ups`?(0,Z.jsx)(LH,{size:`small`,dataSource:c,renderItem:e=>(0,Z.jsxs)(LH.Item,{children:[(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(eB,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)($X.Text,{type:`danger`,children:[`due `,e.followUpOn]})]})}),(0,Z.jsx)(X8,{status:e.status})]})}):(0,Z.jsx)(LH,{size:`small`,dataSource:f,header:(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Still live, no follow-up date, and nothing has moved.`}),renderItem:e=>(0,Z.jsxs)(LH.Item,{children:[(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(eB,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)($X.Text,{type:`warning`,children:[`silent `,e.silentDays,` days`]})]})}),(0,Z.jsx)(X8,{status:e.status})]})})})})]}),(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:24,lg:12,children:(0,Z.jsx)(wF,{title:`Pipeline`,size:`small`,children:(0,Z.jsx)(u5,{stages:u})})}),(0,Z.jsx)(BI,{xs:24,lg:12,children:(0,Z.jsx)(wF,{title:`Applications over time`,size:`small`,children:(0,Z.jsx)(c5,{points:d})})})]}),(0,Z.jsx)(wF,{title:`Recent activity`,size:`small`,styles:{body:{maxHeight:360,overflowY:`auto`}},children:l.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No status changes yet`}):(0,Z.jsx)(XY,{items:l.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsxs)($X.Text,{children:[(0,Z.jsx)(dn,{to:`/applications/${e.applicationId}`,children:e.jobTitle}),` at `,e.companyName]}),(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[e.fromStatus?`${n$[e.fromStatus]} → ${n$[e.toStatus]}`:`Applied (${n$[e.toStatus]})`,` `,`· `,e.occurredOn]})]})}))})}),(0,Z.jsx)(r5,{open:n,onClose:()=>r(!1)})]})}function p5({periods:e,year:t,month:n,onSelect:r}){let i=(0,_.useMemo)(()=>e.map(e=>({key:`y:${e.year}`,title:(0,Z.jsx)(m5,{label:String(e.year),count:e.count,strong:!0}),children:(e.months??[]).map(e=>({key:`m:${e.year}:${e.month}`,title:(0,Z.jsx)(m5,{label:p$(e.month),count:e.count})}))})),[e]),a=(0,_.useMemo)(()=>t&&n?[`m:${t}:${n}`]:t?[`y:${t}`]:[],[t,n]),o=(0,_.useMemo)(()=>{let n=e[0],r=n?[`y:${n.year}`]:[];return t&&!r.includes(`y:${t}`)&&r.push(`y:${t}`),r},[e,t]);return e.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No applications yet`}):(0,Z.jsx)(sJ,{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 m5({label:e,count:t,strong:n}){return(0,Z.jsxs)(`span`,{style:{display:`flex`,justifyContent:`space-between`,gap:12},children:[(0,Z.jsx)($X.Text,{strong:n,children:e}),(0,Z.jsx)($X.Text,{type:`secondary`,children:t})]})}var h5={new:`green`,duplicate:`default`,error:`red`},g5={new:`New`,duplicate:`Duplicate — skipped`,error:`Error`};function _5({open:e,onClose:t}){let n=Tn(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`csv`),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null);function h(){i(null),c(null),u(null),m(null)}function g(){h(),t()}let v=e=>{let t=e.name.toLowerCase().endsWith(`.xlsx`)?`xlsx`:`csv`;return i(e),o(t),m(null),f(!0),_8.previewImport(e,t).then(c).catch(e=>m(e instanceof Error?e.message:`Could not read that file`)).finally(()=>f(!1)),!1};async function y(){if(r){f(!0),m(null);try{let e=await _8.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)(VH,{title:`Import applications`,open:e,onCancel:g,width:800,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($X.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)(GZ.Dragger,{accept:`.csv,.xlsx`,maxCount:1,showUploadList:!1,beforeUpload:v,disabled:d,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(hQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a CSV or Excel file here`})]})]}),p&&(0,Z.jsx)(Fp,{type:`error`,showIcon:!0,message:p}),s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Rz,{wrap:!0,children:[(0,Z.jsxs)(MY,{color:`green`,children:[s.totals.new,` new`]}),(0,Z.jsxs)(MY,{children:[s.totals.duplicate,` duplicate — will be skipped`]}),s.totals.error>0&&(0,Z.jsxs)(MY,{color:`red`,children:[s.totals.error,` error`]})]}),s.fileErrors.map(e=>(0,Z.jsx)(Fp,{type:`warning`,showIcon:!0,message:e},e)),(0,Z.jsx)(yY,{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?n$[e]:`—`},{title:`Result`,dataIndex:`verdict`,width:200,render:(e,t)=>(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(MY,{color:h5[e],children:g5[e]}),t.errors.length>0&&(0,Z.jsx)($X.Text,{type:`danger`,style:{fontSize:12},children:t.errors.join(`; `)})]})}],dataSource:s.rows,pagination:{pageSize:10},scroll:{y:320}}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:h,children:`Choose a different file`}),(0,Z.jsxs)(Gk,{type:`primary`,loading:d,disabled:s.totals.new===0,onClick:y,children:[`Import `,s.totals.new,` application`,s.totals.new===1?``:`s`]})]})]}),l&&(0,Z.jsx)(UU,{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)(Gk,{type:`primary`,onClick:g,children:`Done`})})]})})}function v5(){let e=Xe(),[t,n]=_n(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=(0,_.useMemo)(()=>{let e={};for(let n of[`q`,`source`,`sort`,`direction`,`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,hasNextPage:d,fetchNextPage:f,isFetchingNextPage:p}=x8(s),{data:m}=C8(),{data:h}=T8(),g=c?.pages??[],v=(0,_.useMemo)(()=>g.flatMap(e=>e.items),[g]),y=g[0];function b(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));n(r,{replace:!0})}let x=[{title:`Applied`,dataIndex:`appliedOn`,width:118,sorter:!1,render:e=>(0,Z.jsx)($X.Text,{children:e})},{title:`Company`,key:`company`,width:190,render:(t,n)=>(0,Z.jsx)(Gk,{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)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e}),t.location&&(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[t.location,` · `,i$[t.workMode]]})]})},{title:`Status`,dataIndex:`status`,width:116,render:(e,t)=>(0,Z.jsx)(X8,{status:t.status})},{title:`Tags`,key:`tags`,width:210,render:(e,t)=>(0,Z.jsx)(Rz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(MY,{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)($X.Text,{type:`secondary`,children:`—`})}],S=t.get(`from`),C=t.get(`to`),w=S&&C?[(0,$k.default)(S),(0,$k.default)(C)]:null,T=(0,$k.default)(),E=[{label:`Today`,value:[T,T]},{label:`Yesterday`,value:[T.subtract(1,`day`),T.subtract(1,`day`)]},{label:`This week`,value:[T.startOf(`week`),T.endOf(`week`)]},{label:`This month`,value:[T.startOf(`month`),T.endOf(`month`)]},{label:`Last 7 days`,value:[T.subtract(6,`day`),T]},{label:`Last 30 days`,value:[T.subtract(29,`day`),T]}];function D(e){if(!e||!e[0]||!e[1]){b({from:``,to:``});return}b({from:e[0].format(`YYYY-MM-DD`),to:e[1].format(`YYYY-MM-DD`)})}let O=t.get(`year`)?Number(t.get(`year`)):void 0,k=t.get(`month`)?Number(t.get(`month`)):void 0,A=O&&k?`${p$(k)} ${O}`:O?String(O):`All applications`;return(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{xs:24,md:6,lg:5,children:(0,Z.jsx)(wF,{size:`small`,title:`By period`,extra:(O||k)&&(0,Z.jsx)(Gk,{size:`small`,type:`link`,onClick:()=>b({year:``,month:``}),children:`Clear`}),styles:{body:{maxHeight:`calc(100vh - 220px)`,overflowY:`auto`}},children:(0,Z.jsx)(p5,{periods:m?.periods??[],year:O,month:k,onSelect:e=>b({year:e.year??``,month:e.month??``})})})}),(0,Z.jsx)(BI,{xs:24,md:18,lg:19,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:A}),(0,Z.jsx)($X.Text,{type:`secondary`,children:y?v.length<y.total?`Showing ${v.length} of ${y.total} applications`:`${y.total} application${y.total===1?``:`s`}`:`Loading…`})]}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Bz,{menu:{items:[{key:`csv`,label:`Export as CSV`},{key:`xlsx`,label:`Export as Excel (.xlsx)`}],onClick:({key:e})=>{window.location.href=_8.exportUrl(s,e)}},children:(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(zZ,{}),children:`Export`})}),(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(ZQ,{}),onClick:()=>o(!0),children:`Import`}),(0,Z.jsx)(Gk,{type:`primary`,icon:(0,Z.jsx)(fP,{}),onClick:()=>i(!0),children:`New application`})]})]}),(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(xV,{allowClear:!0,size:`large`,prefix:(0,Z.jsx)(TE,{}),placeholder:`Search by meaning — try “server-side developer” or “remote fintech”`,defaultValue:t.get(`q`)??``,onChange:e=>{e.target.value===``&&b({q:``})},onPressEnter:e=>b({q:e.target.value})}),(0,Z.jsxs)(eB,{gap:8,wrap:!0,children:[(0,Z.jsx)(KR.RangePicker,{allowClear:!0,value:w,presets:E,format:`YYYY-MM-DD`,onChange:e=>D(e)}),(0,Z.jsx)(AE,{mode:`multiple`,allowClear:!0,placeholder:`Status`,style:{minWidth:180},suffixIcon:(0,Z.jsx)(lQ,{}),value:t.get(`status`)?.split(`,`)??[],onChange:e=>b({status:e}),options:QQ.map(e=>({value:e,label:n$[e]}))}),(0,Z.jsx)(AE,{mode:`multiple`,allowClear:!0,placeholder:`Work mode`,style:{minWidth:160},value:t.get(`workMode`)?.split(`,`)??[],onChange:e=>b({workMode:e}),options:r$.map(e=>({value:e,label:i$[e]}))}),(0,Z.jsx)(AE,{mode:`multiple`,allowClear:!0,placeholder:`Tags`,style:{minWidth:200},value:t.get(`tags`)?.split(`,`)??[],onChange:e=>b({tags:e}),options:(h?.tags??[]).map(e=>({value:e.name,label:e.name}))}),(0,Z.jsx)(AE,{style:{minWidth:170},value:t.get(`sort`)??`appliedOn`,onChange:e=>b({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)(AE,{style:{width:130},value:t.get(`direction`)??`desc`,onChange:e=>b({direction:e}),options:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}]})]}),y?.searched&&!y.semanticReady&&(0,Z.jsx)(Fp,{type:`info`,showIcon:!0,icon:(0,Z.jsx)(JQ,{}),message:`Results will improve shortly — the semantic model is still loading.`})]})}),(0,Z.jsx)(yY,{rowKey:`id`,columns:x,dataSource:v,loading:l||u&&!p,pagination:!1,onRow:t=>({onClick:()=>e(`/applications/${t.id}`),style:{cursor:`pointer`}}),locale:{emptyText:(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:t.get(`q`)?`Nothing matched “${t.get(`q`)}”`:`No applications for this filter`})},footer:d?()=>(0,Z.jsx)(eB,{justify:`center`,children:(0,Z.jsx)(bD,{title:`Adds the next page to the list`,children:(0,Z.jsx)(Gk,{loading:p,onClick:()=>void f(),children:`Load more`})})}):void 0})]})}),(0,Z.jsx)(r5,{open:r,onClose:()=>i(!1)}),(0,Z.jsx)(_5,{open:a,onClose:()=>o(!1)})]})}function y5({open:e,note:t,onClose:n,target:r}){let[i]=JB.useForm(),{message:a}=LC.useApp(),o=I8();return(0,Z.jsx)(VH,{open:e,title:t?`Edit note`:`New note`,okText:`Save`,destroyOnHidden:!0,onCancel:n,afterOpenChange:e=>{e&&(t?i.setFieldsValue({title:t.title,body:t.body,targetType:t.targetType,targetId:t.targetId,pinned:t.pinned}):(i.resetFields(),i.setFieldsValue({targetType:r?r.type:`standalone`,targetId:r?r.id:null,pinned:!1,body:``})))},onOk:async()=>{let e=await i.validateFields();await o.mutateAsync({...t?{id:t.id}:{},body:{title:e.title,body:e.body??``,targetType:e.targetType,targetId:e.targetType===`standalone`?null:e.targetId??null,pinned:e.pinned??!1}}),a.success(t?`Note updated`:`Note saved`),n()},children:(0,Z.jsxs)(JB,{form:i,layout:`vertical`,children:[(0,Z.jsx)(JB.Item,{name:`title`,label:`Title`,rules:[{required:!0,message:`Title is required`}],children:(0,Z.jsx)(xV,{placeholder:`Interview prep, salary research…`})}),(0,Z.jsx)(JB.Item,{name:`body`,label:`Note`,children:(0,Z.jsx)(xV.TextArea,{rows:8,placeholder:`Anything worth keeping`})}),r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JB.Item,{name:`targetType`,hidden:!0,children:(0,Z.jsx)(xV,{})}),(0,Z.jsx)(JB.Item,{name:`targetId`,hidden:!0,children:(0,Z.jsx)(xV,{})}),(0,Z.jsxs)($X.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Attached to `,r.label]})]}):(0,Z.jsx)(b5,{form:i}),(0,Z.jsx)(JB.Item,{name:`pinned`,label:`Pinned`,valuePropName:`checked`,children:(0,Z.jsx)(eG,{})})]})})}function b5({form:e}){let t=JB.useWatch(`targetType`,e)??`standalone`,{data:n}=E8(),{data:r}=b8({limit:200}),i=(0,_.useMemo)(()=>t===`company`?(n?.companies??[]).map(e=>({value:e.id,label:e.name})):t===`application`?(r?.items??[]).map(e=>({value:e.id,label:`${e.jobTitle} — ${e.company.name}`})):[],[t,n,r]);return(0,Z.jsxs)(eB,{gap:12,children:[(0,Z.jsx)(JB.Item,{name:`targetType`,label:`Attach to`,style:{flex:1},children:(0,Z.jsx)(AE,{options:[{value:`standalone`,label:`Nothing in particular`},{value:`company`,label:`A company`},{value:`application`,label:`An application`}],onChange:()=>e.setFieldValue(`targetId`,null)})}),t!==`standalone`&&(0,Z.jsx)(JB.Item,{name:`targetId`,label:t===`company`?`Company`:`Application`,style:{flex:2},rules:[{required:!0,message:`Pick what this note is about`}],children:(0,Z.jsx)(AE,{showSearch:!0,optionFilterProp:`label`,options:i})})]})}function x5(){let{id:e}=Qe(),t=Xe(),{message:n}=LC.useApp(),{data:r,isLoading:i}=S8(e),a=N8(),o=P8(),s=L8(),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(DS,{active:!0,paragraph:{rows:10}});let m=e$(r.status);async function h(t){e&&(await a.mutateAsync({id:e,body:{status:t,comment:null}}),n.success(`Moved to ${n$[t]}`))}return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`flex-start`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Gk,{type:`link`,icon:(0,Z.jsx)(JZ,{}),style:{padding:0},onClick:()=>t(`/applications`),children:`Back to applications`}),(0,Z.jsx)($X.Title,{level:3,style:{margin:0},children:r.jobTitle}),(0,Z.jsxs)(Rz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/companies/${r.company.id}`,children:r.company.name}),(0,Z.jsxs)($X.Text,{type:`secondary`,children:[`applied `,r.appliedOn]}),(0,Z.jsx)(X8,{status:r.status})]})]}),(0,Z.jsxs)(Rz,{wrap:!0,children:[m&&(0,Z.jsxs)(Gk,{type:`primary`,onClick:()=>void h(m),children:[`Move to `,n$[m]]}),(0,Z.jsx)(AE,{style:{width:150},value:r.status,onChange:e=>void h(e),options:QQ.map(e=>({value:e,label:n$[e]}))}),(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(nX,{}),onClick:()=>l(!0),children:`Edit`}),(0,Z.jsx)(GH,{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)(Gk,{danger:!0,icon:(0,Z.jsx)($Y,{})})})]})]}),(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:24,lg:14,children:(0,Z.jsx)(wF,{title:`Details`,children:(0,Z.jsxs)(oz,{column:{xs:1,sm:2},size:`small`,bordered:!0,children:[(0,Z.jsx)(oz.Item,{label:`Company`,children:r.company.name}),(0,Z.jsx)(oz.Item,{label:`Applied on`,children:r.appliedOn}),(0,Z.jsx)(oz.Item,{label:`Location`,children:r.location??`—`}),(0,Z.jsx)(oz.Item,{label:`Work mode`,children:i$[r.workMode]}),(0,Z.jsx)(oz.Item,{label:`Source`,children:r.sourceName??`—`}),(0,Z.jsx)(oz.Item,{label:`Follow up`,children:r.followUpOn??`—`}),(0,Z.jsx)(oz.Item,{label:`Salary`,span:2,children:r.salaryMin||r.salaryMax?`${r.salaryMin?.toLocaleString()??`?`} – ${r.salaryMax?.toLocaleString()??`?`} ${r.salaryCurrency??``}`:`—`}),(0,Z.jsx)(oz.Item,{label:`Posting`,span:2,children:r.jobUrl?(0,Z.jsx)(`a`,{href:r.jobUrl,target:`_blank`,rel:`noreferrer`,children:(0,Z.jsxs)(Rz,{size:4,children:[(0,Z.jsx)(xQ,{}),r.jobUrl]})}):`—`}),(0,Z.jsx)(oz.Item,{label:`Tags`,span:2,children:r.tags.length>0?(0,Z.jsx)(Rz,{size:4,wrap:!0,children:r.tags.map(e=>(0,Z.jsx)(MY,{children:e.name},e.id))}):`—`})]})})}),(0,Z.jsx)(BI,{xs:24,lg:10,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(wF,{title:`Status history`,children:r.statusEvents.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No changes recorded`}):(0,Z.jsx)(XY,{items:r.statusEvents.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e.fromStatus?`${n$[e.fromStatus]} → ${n$[e.toStatus]}`:`Applied`}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:e.occurredOn}),e.comment&&(0,Z.jsx)($X.Text,{children:e.comment})]})}))})}),(0,Z.jsx)(wF,{title:`Notes (${r.notes.length})`,extra:(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(fP,{}),onClick:()=>p(!0),children:`Add note`}),children:r.notes.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No notes yet`}):(0,Z.jsx)(LH,{size:`small`,dataSource:r.notes,renderItem:e=>(0,Z.jsx)(LH.Item,{actions:[(0,Z.jsx)(Gk,{type:`text`,icon:(0,Z.jsx)(nX,{}),onClick:()=>d(e)},`edit`),(0,Z.jsx)(GH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await s.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Gk,{type:`text`,danger:!0,icon:(0,Z.jsx)($Y,{})})},`delete`)],children:(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsxs)(Rz,{size:8,children:[e.pinned&&(0,Z.jsx)(AQ,{style:{color:`#faad14`}}),(0,Z.jsx)($X.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)($X.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:4,expandable:!0,symbol:`more`},children:e.body})})})})})]})})]}),(0,Z.jsx)(r5,{open:c,onClose:()=>l(!1),application:r}),(0,Z.jsx)(y5,{open:f||u!==null,note:u,target:{type:`application`,id:r.id,label:r.jobTitle},onClose:()=>{p(!1),d(null)}})]})}var S5=25;function C5(){let e=Xe(),[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(S5),a=Z8(t,300),{data:o,isLoading:s}=E8(a?{q:a}:{});return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Companies`}),(0,Z.jsx)(xV,{allowClear:!0,prefix:(0,Z.jsx)(TE,{}),placeholder:`Find a company`,style:{maxWidth:320},value:t,onChange:e=>n(e.target.value)})]}),(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsx)(yY,{rowKey:`id`,size:`middle`,loading:s,columns:[{title:`Company`,dataIndex:`name`,render:(e,t)=>(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e}),t.website&&(0,Z.jsx)($X.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)($X.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)($X.Text,{type:`secondary`,children:`—`})},{title:`Tags`,key:`tags`,width:260,render:(e,t)=>(0,Z.jsx)(Rz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(MY,{style:{marginInlineEnd:0},children:e.name},e.id))})}],dataSource:o?.companies??[],pagination:{pageSize:r,showSizeChanger:!0,onChange:(e,t)=>i(t),hideOnSinglePage:r===S5},onRow:t=>({onClick:()=>e(`/companies/${t.id}`),style:{cursor:`pointer`}})})})]})}function w5(){let{id:e}=Qe(),t=Xe(),{message:n}=LC.useApp(),{data:r,isLoading:i}=D8(e),{data:a}=O8(e?{targetType:`company`,targetId:e}:{}),{data:o}=T8(),s=F8(),c=L8(),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(DS,{active:!0,paragraph:{rows:8}});let{company:p,applications:m}=r,h=m.filter(e=>[`applied`,`screening`,`interview`].includes(e.status)).length;return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Gk,{type:`link`,icon:(0,Z.jsx)(JZ,{}),style:{padding:0},onClick:()=>t(`/companies`),children:`Back to companies`}),(0,Z.jsx)($X.Title,{level:3,style:{margin:0},children:p.name}),p.website&&(0,Z.jsx)($X.Link,{href:p.website,target:`_blank`,children:p.website})]}),(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:12,md:6,children:(0,Z.jsx)(wF,{children:(0,Z.jsx)(nW,{title:`Applications`,value:m.length})})}),(0,Z.jsx)(BI,{xs:12,md:6,children:(0,Z.jsx)(wF,{children:(0,Z.jsx)(nW,{title:`Still active`,value:h,valueStyle:{color:a5.accent}})})}),(0,Z.jsx)(BI,{xs:24,md:12,children:(0,Z.jsx)(wF,{children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)($X.Text,{type:`secondary`,children:`Company tags`}),(0,Z.jsx)(AE,{mode:`tags`,style:{width:`100%`},placeholder:`fintech, remote-first…`,value:p.tags.map(e=>e.name),options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),onChange:t=>{e&&s.mutate({id:e,body:{tags:t}})}})]})})})]}),(0,Z.jsx)(wF,{title:`Application history`,children:(0,Z.jsx)(yY,{rowKey:`id`,size:`middle`,columns:[{title:`Applied`,dataIndex:`appliedOn`,width:120},{title:`Job title`,dataIndex:`jobTitle`,render:e=>(0,Z.jsx)($X.Text,{strong:!0,children:e})},{title:`Status`,dataIndex:`status`,width:120,render:(e,t)=>(0,Z.jsx)(X8,{status:t.status})},{title:`Source`,dataIndex:`sourceName`,width:130}],dataSource:m,pagination:!1,onRow:e=>({onClick:()=>t(`/applications/${e.id}`),style:{cursor:`pointer`}})})}),(0,Z.jsx)(wF,{title:`Notes about ${p.name}`,extra:(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(fP,{}),onClick:()=>f(!0),children:`Add note`}),children:(a?.notes??[]).length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No notes about this company`}):(0,Z.jsx)(LH,{dataSource:a?.notes??[],renderItem:e=>(0,Z.jsx)(LH.Item,{actions:[(0,Z.jsx)(Gk,{type:`text`,icon:(0,Z.jsx)(nX,{}),onClick:()=>u(e)},`edit`),(0,Z.jsx)(GH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await c.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Gk,{type:`text`,danger:!0,icon:(0,Z.jsx)($Y,{})})},`delete`)],children:(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsxs)(Rz,{size:8,children:[e.pinned&&(0,Z.jsx)(AQ,{style:{color:`#faad14`}}),(0,Z.jsx)($X.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)($X.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e.body})})})})}),(0,Z.jsx)(y5,{open:d||l!==null,note:l,target:{type:`company`,id:p.id,label:p.name},onClose:()=>{f(!1),u(null)}})]})}function T5(){let{message:e}=LC.useApp(),[t,n]=(0,_.useState)(`all`),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),{data:l,isLoading:u}=O8(t===`all`?{}:{targetType:t}),d=L8(),f=l?.notes??[],p=(0,_.useMemo)(()=>{let e=r.trim().toLowerCase();return e?f.filter(t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||(t.targetLabel?.toLowerCase().includes(e)??!1)):f},[f,r]);return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Notes`}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(eL,{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)(Gk,{type:`primary`,icon:(0,Z.jsx)(fP,{}),onClick:()=>c(!0),children:`New note`})]})]}),(0,Z.jsx)(xV,{allowClear:!0,prefix:(0,Z.jsx)(TE,{}),placeholder:`Search notes by title, body, or what they're attached to`,value:r,onChange:e=>i(e.target.value)}),(0,Z.jsx)(wF,{size:`small`,loading:u,children:p.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:r?`Nothing matched “${r}”`:`No notes here yet`}):(0,Z.jsx)(LH,{dataSource:p,renderItem:t=>(0,Z.jsx)(LH.Item,{actions:[(0,Z.jsx)(Gk,{type:`text`,icon:(0,Z.jsx)(nX,{}),onClick:()=>o(t)},`edit`),(0,Z.jsx)(GH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await d.mutateAsync(t.id),e.success(`Note deleted`)},children:(0,Z.jsx)(Gk,{type:`text`,danger:!0,icon:(0,Z.jsx)($Y,{})})},`delete`)],children:(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsxs)(Rz,{size:8,wrap:!0,children:[t.pinned&&(0,Z.jsx)(AQ,{style:{color:`#faad14`}}),(0,Z.jsx)($X.Text,{strong:!0,children:t.title}),(0,Z.jsx)(E5,{note:t})]}),description:(0,Z.jsx)($X.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:3,expandable:!0,symbol:`more`},children:t.body})})})})}),(0,Z.jsx)(y5,{open:s||a!==null,note:a,onClose:()=>{c(!1),o(null)}})]})}function E5({note:e}){if(e.targetType===`standalone`)return(0,Z.jsx)(MY,{children:`general`});if(!e.targetId)return(0,Z.jsx)(MY,{children:`unlinked`});let t=e.targetType===`company`?`/companies/${e.targetId}`:`/applications/${e.targetId}`;return(0,Z.jsx)(dn,{to:t,children:(0,Z.jsxs)(MY,{color:`blue`,children:[e.targetType,`: `,e.targetLabel??`view`]})})}function D5({open:e,onClose:t,opening:n,draft:r}){let[i]=JB.useForm(),{message:a}=LC.useApp(),o=!!n,s=B8(),c=V8(),{data:l}=A8(JB.useWatch(`companyName`,i)??``);(0,_.useEffect)(()=>{e&&(n?i.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,savedOn:(0,$k.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}):(i.resetFields(),i.setFieldsValue({savedOn:(0,$k.default)(),workMode:r?.workMode??`unspecified`,...r?{companyName:r.companyName,jobTitle:r.jobTitle,jobUrl:r.jobUrl??void 0,location:r.location??void 0,sourceName:r.sourceName??void 0,salaryMin:r.salaryMin,salaryMax:r.salaryMax,salaryCurrency:r.salaryCurrency??void 0,notes:r.notes??void 0}:{}})))},[e,n,r,i]);let u=(0,_.useMemo)(()=>(l?.companies??[]).map(e=>({value:e.name})),[l]);async function d(e){let r={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,...o?{}:{savedOn:e.savedOn.format(`YYYY-MM-DD`)}};try{n?(await c.mutateAsync({id:n.id,body:r}),a.success(`Opening updated`)):(await s.mutateAsync(r),a.success(`Opening saved`)),t()}catch(e){e instanceof a8&&e.fieldErrors.length>0?(i.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),a.error(`Please check the highlighted fields`)):a.error(e instanceof Error?e.message:`Could not save`)}}return(0,Z.jsxs)(kz,{title:o?`Edit opening`:`Save opening for later`,open:e,onClose:t,width:560,destroyOnHidden:!0,extra:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Gk,{type:`primary`,loading:s.isPending||c.isPending,onClick:()=>i.submit(),children:o?`Save changes`:`Save opening`})]}),children:[(0,Z.jsx)($X.Paragraph,{type:`secondary`,children:r&&!o?`Read from the posting — check it over before saving. Anything the parser could not find is blank rather than guessed.`:`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)(JB,{form:i,layout:`vertical`,onFinish:d,requiredMark:`optional`,children:[(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:12,children:(0,Z.jsx)(JB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(LE,{options:u,placeholder:`Start typing — existing companies appear`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(BI,{span:12,children:(0,Z.jsx)(JB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(xV,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`savedOn`,label:`Found on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(KR,{style:{width:`100%`},format:`YYYY-MM-DD`,disabled:o})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(AE,{options:r$.map(e=>({value:e,label:i$[e]}))})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(xV,{placeholder:`Stockholm`})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(VL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(VL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(xV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(JB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(xV,{placeholder:`LinkedIn, referral…`})}),(0,Z.jsx)(JB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(xV,{placeholder:`https://…`})}),(0,Z.jsx)(JB.Item,{name:`notes`,label:`Notes`,children:(0,Z.jsx)(xV.TextArea,{rows:4,placeholder:`Why this looked interesting, what you're missing to apply…`})})]})]})}var O5=!1;function k5({open:e,onClose:t,onUse:n}){let[r,i]=(0,_.useState)(`link`),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(null);function h(){o(``),c(``),f(null),m(null),u(!1)}function g(){h(),t()}async function v(e){u(!0),f(null),m(null);try{let t=await e();(t.draft.companyName.trim()===``||t.draft.jobTitle.trim()===``)&&f(`Could not make out the company and job title. Open the form and fill them in, or paste more of the posting.`),m(t)}catch(e){f(e instanceof Error?e.message:`Could not read that posting`),e instanceof a8&&e.code===`ingest_blocked`&&i(`text`)}finally{u(!1)}}let y=p?.draft;return(0,Z.jsxs)(VH,{open:e,onCancel:g,title:`Save from a posting`,width:640,destroyOnHidden:!0,footer:(0,Z.jsxs)(eB,{justify:`end`,gap:8,children:[(0,Z.jsx)(Gk,{onClick:g,children:`Cancel`}),(0,Z.jsx)(Gk,{type:`primary`,disabled:!y,onClick:()=>{y&&(n(y),h())},children:`Review and save`})]}),children:[(0,Z.jsx)(uF,{activeKey:r,onChange:e=>{i(e),f(null),m(null)},items:[{key:`link`,label:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(xQ,{}),` Paste a link`]}),disabled:O5,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(xV.Search,{placeholder:`https://boards.greenhouse.io/…`,value:a,enterButton:`Read`,loading:l,onChange:e=>o(e.target.value),onSearch:e=>e.trim()&&void v(()=>_8.ingestUrl(e.trim()))}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Works on most company career pages and applicant tracking systems. LinkedIn and Indeed block automated readers — for those, copy the posting and use the other tab.`})]})},{key:`text`,label:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(rB,{}),` Paste the text`]}),children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(xV.TextArea,{rows:8,value:s,placeholder:`Backend Engineer at Spotify
|
|
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 z4(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:H4(t,`input`,e.processors),output:H4(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function B4(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 B4(r.element,n);if(r.type===`set`)return B4(r.valueType,n);if(r.type===`lazy`)return B4(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 B4(r.innerType,n);if(r.type===`intersection`)return B4(r.left,n)||B4(r.right,n);if(r.type===`record`||r.type===`map`)return B4(r.keyType,n)||B4(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:B4(r.in,n)||B4(r.out,n);if(r.type===`object`){for(let e in r.shape)if(B4(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(B4(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(B4(e,n))return!0;return!!(r.rest&&B4(r.rest,n))}return!1}var V4=(e,t={})=>n=>{let r=I4({...n,processors:t});return L4(e,r),R4(r,e),z4(r,e)},H4=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=I4({...i??{},target:a,io:t,processors:n});return L4(e,o),R4(o,e),z4(o,e)},U4={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},W4=(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=U4[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}))])}},G4=(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)},K4=(e,t,n,r)=>{n.type=`boolean`},q4=(e,t,n,r)=>{n.not={}},J4=(e,t,n,r)=>{let i=e._zod.def,a=b$(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Y4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},X4=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Z4=(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=L4(a.element,t,{...r,path:[...r.path,`items`]})},Q4=(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]=L4(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=L4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},$4=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>L4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},e3=(e,t,n,r)=>{let i=e._zod.def,a=L4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=L4(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]]},t3=(e,t,n,r)=>{let i=e._zod.def,a=L4(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`}]},n3=(e,t,n,r)=>{let i=e._zod.def;L4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},r3=(e,t,n,r)=>{let i=e._zod.def;L4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},i3=(e,t,n,r)=>{let i=e._zod.def;L4(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)))},a3=(e,t,n,r)=>{let i=e._zod.def;L4(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},o3=(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;L4(o,t,r);let s=t.seen.get(e);s.ref=o},s3=(e,t,n,r)=>{let i=e._zod.def;L4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},c3=(e,t,n,r)=>{let i=e._zod.def;L4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},l3=h$(`ZodISODateTime`,(e,t)=>{M0.init(e,t),I3.init(e,t)});function u3(e){return n4(l3,e)}var d3=h$(`ZodISODate`,(e,t)=>{N0.init(e,t),I3.init(e,t)});function f3(e){return r4(d3,e)}var p3=h$(`ZodISOTime`,(e,t)=>{P0.init(e,t),I3.init(e,t)});function m3(e){return i4(p3,e)}var h3=h$(`ZodISODuration`,(e,t)=>{F0.init(e,t),I3.init(e,t)});function g3(e){return a4(h3,e)}var _3=h$(`ZodError`,(e,t)=>{i1.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>s1(e,t)},flatten:{value:t=>o1(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,x$,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,x$,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),v3=c1(_3),y3=l1(_3),b3=u1(_3),x3=f1(_3),S3=m1(_3),C3=h1(_3),w3=g1(_3),T3=_1(_3),E3=v1(_3),D3=y1(_3),O3=b1(_3),k3=x1(_3),A3=new WeakMap;function j3(e,t,n){let r=Object.getPrototypeOf(e),i=A3.get(r);if(i||(i=new Set,A3.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 M3=h$(`ZodType`,(e,t)=>(v0.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:H4(e,`input`),output:H4(e,`output`)}}),e.toJSONSchema=V4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>v3(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>b3(e,t,n),e.parseAsync=async(t,n)=>y3(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>x3(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>S3(e,t,n),e.decode=(t,n)=>C3(e,t,n),e.encodeAsync=async(t,n)=>w3(e,t,n),e.decodeAsync=async(t,n)=>T3(e,t,n),e.safeEncode=(t,n)=>E3(e,t,n),e.safeDecode=(t,n)=>D3(e,t,n),e.safeEncodeAsync=async(t,n)=>O3(e,t,n),e.safeDecodeAsync=async(t,n)=>k3(e,t,n),j3(e,`ZodType`,{check(...e){let t=this.def;return this.clone(k$(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 z$(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(G6(e,t))},superRefine(e,t){return this.check(K6(e,t))},overwrite(e){return this.check(E4(e))},optional(){return E6(this)},exactOptional(){return O6(this)},nullable(){return A6(this)},nullish(){return E6(A6(this))},nonoptional(e){return I6(this,e)},array(){return m6(this)},or(e){return v6([this,e])},and(e){return b6(this,e)},transform(e){return B6(this,w6(e))},default(e){return M6(this,e)},prefault(e){return P6(this,e)},catch(e){return R6(this,e)},pipe(e){return B6(this,e)},readonly(){return U6(this)},describe(e){let t=this.clone();return M2.add(t,{description:e}),t},meta(...e){if(e.length===0)return M2.get(this);let t=this.clone();return M2.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 M2.get(e)?.description},configurable:!0}),e)),N3=h$(`_ZodString`,(e,t)=>{y0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W4(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,j3(e,`_ZodString`,{regex(...e){return this.check(b4(...e))},includes(...e){return this.check(C4(...e))},startsWith(...e){return this.check(w4(...e))},endsWith(...e){return this.check(T4(...e))},min(...e){return this.check(v4(...e))},max(...e){return this.check(_4(...e))},length(...e){return this.check(y4(...e))},nonempty(...e){return this.check(v4(1,...e))},lowercase(e){return this.check(x4(e))},uppercase(e){return this.check(S4(e))},trim(){return this.check(O4())},normalize(...e){return this.check(D4(...e))},toLowerCase(){return this.check(k4())},toUpperCase(){return this.check(A4())},slugify(){return this.check(j4())}})}),P3=h$(`ZodString`,(e,t)=>{y0.init(e,t),N3.init(e,t),e.email=t=>e.check(P2(L3,t)),e.url=t=>e.check(B2(V3,t)),e.jwt=t=>e.check(t4(n6,t)),e.emoji=t=>e.check(V2(H3,t)),e.guid=t=>e.check(F2(R3,t)),e.uuid=t=>e.check(I2(z3,t)),e.uuidv4=t=>e.check(L2(z3,t)),e.uuidv6=t=>e.check(R2(z3,t)),e.uuidv7=t=>e.check(z2(z3,t)),e.nanoid=t=>e.check(H2(U3,t)),e.guid=t=>e.check(F2(R3,t)),e.cuid=t=>e.check(U2(W3,t)),e.cuid2=t=>e.check(W2(G3,t)),e.ulid=t=>e.check(G2(K3,t)),e.base64=t=>e.check(Q2($3,t)),e.base64url=t=>e.check($2(e6,t)),e.xid=t=>e.check(K2(q3,t)),e.ksuid=t=>e.check(q2(J3,t)),e.ipv4=t=>e.check(J2(Y3,t)),e.ipv6=t=>e.check(Y2(X3,t)),e.cidrv4=t=>e.check(X2(Z3,t)),e.cidrv6=t=>e.check(Z2(Q3,t)),e.e164=t=>e.check(e4(t6,t)),e.datetime=t=>e.check(u3(t)),e.date=t=>e.check(f3(t)),e.time=t=>e.check(m3(t)),e.duration=t=>e.check(g3(t))});function F3(e){return N2(P3,e)}var I3=h$(`ZodStringFormat`,(e,t)=>{b0.init(e,t),N3.init(e,t)}),L3=h$(`ZodEmail`,(e,t)=>{C0.init(e,t),I3.init(e,t)}),R3=h$(`ZodGUID`,(e,t)=>{x0.init(e,t),I3.init(e,t)}),z3=h$(`ZodUUID`,(e,t)=>{S0.init(e,t),I3.init(e,t)});function B3(e){return I2(z3,e)}var V3=h$(`ZodURL`,(e,t)=>{w0.init(e,t),I3.init(e,t)}),H3=h$(`ZodEmoji`,(e,t)=>{T0.init(e,t),I3.init(e,t)}),U3=h$(`ZodNanoID`,(e,t)=>{E0.init(e,t),I3.init(e,t)}),W3=h$(`ZodCUID`,(e,t)=>{D0.init(e,t),I3.init(e,t)}),G3=h$(`ZodCUID2`,(e,t)=>{O0.init(e,t),I3.init(e,t)}),K3=h$(`ZodULID`,(e,t)=>{k0.init(e,t),I3.init(e,t)}),q3=h$(`ZodXID`,(e,t)=>{A0.init(e,t),I3.init(e,t)}),J3=h$(`ZodKSUID`,(e,t)=>{j0.init(e,t),I3.init(e,t)}),Y3=h$(`ZodIPv4`,(e,t)=>{I0.init(e,t),I3.init(e,t)}),X3=h$(`ZodIPv6`,(e,t)=>{L0.init(e,t),I3.init(e,t)}),Z3=h$(`ZodCIDRv4`,(e,t)=>{R0.init(e,t),I3.init(e,t)}),Q3=h$(`ZodCIDRv6`,(e,t)=>{z0.init(e,t),I3.init(e,t)}),$3=h$(`ZodBase64`,(e,t)=>{V0.init(e,t),I3.init(e,t)}),e6=h$(`ZodBase64URL`,(e,t)=>{U0.init(e,t),I3.init(e,t)}),t6=h$(`ZodE164`,(e,t)=>{W0.init(e,t),I3.init(e,t)}),n6=h$(`ZodJWT`,(e,t)=>{K0.init(e,t),I3.init(e,t)}),r6=h$(`ZodNumber`,(e,t)=>{q0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G4(e,t,n,r),j3(e,`ZodNumber`,{gt(e,t){return this.check(m4(e,t))},gte(e,t){return this.check(h4(e,t))},min(e,t){return this.check(h4(e,t))},lt(e,t){return this.check(f4(e,t))},lte(e,t){return this.check(p4(e,t))},max(e,t){return this.check(p4(e,t))},int(e){return this.check(o6(e))},safe(e){return this.check(o6(e))},positive(e){return this.check(m4(0,e))},nonnegative(e){return this.check(h4(0,e))},negative(e){return this.check(f4(0,e))},nonpositive(e){return this.check(p4(0,e))},multipleOf(e,t){return this.check(g4(e,t))},step(e,t){return this.check(g4(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 i6(e){return o4(r6,e)}var a6=h$(`ZodNumberFormat`,(e,t)=>{J0.init(e,t),r6.init(e,t)});function o6(e){return c4(a6,e)}var s6=h$(`ZodBoolean`,(e,t)=>{Y0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K4(e,t,n,r)});function c6(e){return l4(s6,e)}var l6=h$(`ZodUnknown`,(e,t)=>{X0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function u6(){return u4(l6)}var d6=h$(`ZodNever`,(e,t)=>{Z0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q4(e,t,n,r)});function f6(e){return d4(d6,e)}var p6=h$(`ZodArray`,(e,t)=>{$0.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Z4(e,t,n,r),e.element=t.element,j3(e,`ZodArray`,{min(e,t){return this.check(v4(e,t))},nonempty(e){return this.check(v4(1,e))},max(e,t){return this.check(_4(e,t))},length(e,t){return this.check(y4(e,t))},unwrap(){return this.element}})});function m6(e,t){return M4(p6,e,t)}var h6=h$(`ZodObject`,(e,t)=>{i2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Q4(e,t,n,r),D$(e,`shape`,()=>t.shape),j3(e,`ZodObject`,{keyof(){return S6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:u6()})},loose(){return this.clone({...this._zod.def,catchall:u6()})},strict(){return this.clone({...this._zod.def,catchall:f6()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return G$(this,e)},safeExtend(e){return K$(this,e)},merge(e){return q$(this,e)},pick(e){return U$(this,e)},omit(e){return W$(this,e)},partial(...e){return J$(T6,this,e[0])},required(...e){return Y$(F6,this,e[0])}})});function g6(e,t){return new h6({type:`object`,shape:e??{},...B$(t)})}var _6=h$(`ZodUnion`,(e,t)=>{o2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$4(e,t,n,r),e.options=t.options});function v6(e,t){return new _6({type:`union`,options:e,...B$(t)})}var y6=h$(`ZodIntersection`,(e,t)=>{s2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e3(e,t,n,r)});function b6(e,t){return new y6({type:`intersection`,left:e,right:t})}var x6=h$(`ZodEnum`,(e,t)=>{u2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J4(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 x6({...t,checks:[],...B$(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 x6({...t,checks:[],...B$(r),entries:i})}});function S6(e,t){return new x6({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...B$(t)})}var C6=h$(`ZodTransform`,(e,t)=>{d2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X4(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _$(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(n1(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(n1(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 w6(e){return new C6({type:`transform`,transform:e})}var T6=h$(`ZodOptional`,(e,t)=>{p2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function E6(e){return new T6({type:`optional`,innerType:e})}var D6=h$(`ZodExactOptional`,(e,t)=>{m2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function O6(e){return new D6({type:`optional`,innerType:e})}var k6=h$(`ZodNullable`,(e,t)=>{h2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function A6(e){return new k6({type:`nullable`,innerType:e})}var j6=h$(`ZodDefault`,(e,t)=>{g2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function M6(e,t){return new j6({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():I$(t)}})}var N6=h$(`ZodPrefault`,(e,t)=>{v2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>i3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function P6(e,t){return new N6({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():I$(t)}})}var F6=h$(`ZodNonOptional`,(e,t)=>{y2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function I6(e,t){return new F6({type:`nonoptional`,innerType:e,...B$(t)})}var L6=h$(`ZodCatch`,(e,t)=>{x2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>a3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function R6(e,t){return new L6({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var z6=h$(`ZodPipe`,(e,t)=>{S2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o3(e,t,n,r),e.in=t.in,e.out=t.out});function B6(e,t){return new z6({type:`pipe`,in:e,out:t})}var V6=h$(`ZodPreprocess`,(e,t)=>{z6.init(e,t),w2.init(e,t)}),H6=h$(`ZodReadonly`,(e,t)=>{T2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function U6(e){return new H6({type:`readonly`,innerType:e})}var W6=h$(`ZodCustom`,(e,t)=>{D2.init(e,t),M3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y4(e,t,n,r)});function G6(e,t={}){return N4(W6,e,t)}function K6(e,t){return P4(e,t)}function q6(e,t){return new V6({type:`pipe`,in:w6(e),out:t})}function J6(e){return s4(r6,e)}var Y6=F3().regex(/^\d{4}-\d{2}-\d{2}$/,`Expected a YYYY-MM-DD date`),X6=e=>F3().trim().max(e).nullish().transform(e=>e==null||e===``?null:e),Z6=S6(QQ),Q6=S6(r$),$6=S6(o$),e8=S6(s$);S6(a$);var t8=m6(F3().trim().min(1).max(60)).max(30);g6({companyName:F3().trim().min(1,`Company is required`).max(200),jobTitle:F3().trim().min(1,`Job title is required`).max(200),appliedOn:Y6,status:Z6.default(`applied`),jobUrl:X6(2e3),location:X6(200),workMode:Q6.default(`unspecified`),sourceName:X6(120),salaryMin:i6().int().nonnegative().nullish().transform(e=>e??null),salaryMax:i6().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:X6(8),followUpOn:Y6.nullish().transform(e=>e??null),tags:t8.default([]),notes:X6(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),g6({companyName:F3().trim().min(1).max(200).optional(),jobTitle:F3().trim().min(1).max(200).optional(),appliedOn:Y6.optional(),status:Z6.optional(),statusComment:F3().trim().max(2e3).nullish(),jobUrl:X6(2e3).optional(),location:X6(200).optional(),workMode:Q6.optional(),sourceName:X6(120).optional(),salaryMin:i6().int().nonnegative().nullish(),salaryMax:i6().int().nonnegative().nullish(),salaryCurrency:X6(8).optional(),followUpOn:Y6.nullish(),archived:c6().optional(),tags:t8.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),g6({status:Z6,occurredOn:Y6.optional(),comment:F3().trim().max(2e3).nullish().transform(e=>e??null)});var n8=e=>q6(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},m6(e).optional()),r8=g6({q:F3().trim().max(300).optional(),year:J6().int().min(1970).max(2200).optional(),month:J6().int().min(1).max(12).optional(),status:n8(Z6),workMode:n8(Q6),tags:n8(F3()),companyId:B3().optional(),source:F3().trim().max(120).optional(),from:Y6.optional(),to:Y6.optional(),archived:S6([`true`,`false`,`all`]).default(`false`).transform(e=>e===`all`?`all`:e===`true`),followUpDue:S6([`true`,`false`]).optional().transform(e=>e===`true`),sort:S6([`appliedOn`,`company`,`jobTitle`,`status`,`createdAt`]).default(`appliedOn`),direction:S6([`asc`,`desc`]).default(`desc`),limit:J6().int().min(1).max(200).default(50),cursor:F3().optional()});g6({ids:m6(B3()).min(1).max(500)}),g6({company:F3().trim().min(1).max(200),title:F3().trim().max(200).optional().default(``),excludeId:B3().optional()}),g6({q:F3().trim().min(1).max(300),limit:J6().int().min(1).max(100).default(25),types:n8(S6([`application`,`company`,`note`]))}),r8.extend({format:S6([`csv`,`xlsx`]).default(`csv`)}),g6({name:F3().trim().min(1).max(200),website:X6(2e3),location:X6(200),tags:t8.default([])}),g6({name:F3().trim().min(1).max(200).optional(),website:X6(2e3).optional(),location:X6(200).optional(),archived:c6().optional(),tags:t8.optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),g6({title:F3().trim().min(1).max(200),body:F3().max(5e4).default(``),targetType:$6.default(`standalone`),targetId:B3().nullish().transform(e=>e??null),pinned:c6().default(!1)}),g6({title:F3().trim().min(1).max(200).optional(),body:F3().max(5e4).optional(),targetType:$6.optional(),targetId:B3().nullish(),pinned:c6().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),g6({name:F3().trim().min(1).max(60),color:X6(30),scope:e8.default(`both`)}),g6({companyName:F3().trim().min(1,`Company is required`).max(200),jobTitle:F3().trim().min(1,`Job title is required`).max(200),jobUrl:X6(2e3),location:X6(200),workMode:Q6.default(`unspecified`),sourceName:X6(120),salaryMin:i6().int().nonnegative().nullish().transform(e=>e??null),salaryMax:i6().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:X6(8),notes:X6(2e4),savedOn:Y6.optional()}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),g6({companyName:F3().trim().min(1).max(200).optional(),jobTitle:F3().trim().min(1).max(200).optional(),jobUrl:X6(2e3).optional(),location:X6(200).optional(),workMode:Q6.optional(),sourceName:X6(120).optional(),salaryMin:i6().int().nonnegative().nullish(),salaryMax:i6().int().nonnegative().nullish(),salaryCurrency:X6(8).optional(),notes:X6(2e4).optional(),savedOn:Y6.optional(),archived:c6().optional()}).refine(e=>Object.keys(e).length>0,{message:`Nothing to update`}),g6({appliedOn:Y6.optional(),status:Z6.optional(),tags:t8.optional()}),g6({url:F3().trim().min(1).max(2e3)}),g6({text:F3().min(1).max(2e5),url:X6(2e3).optional()}),g6({companyName:F3().trim().min(1,`Company is required`).max(200),jobTitle:F3().trim().min(1,`Job title is required`).max(200),jobUrl:X6(2e3),location:X6(200),workMode:Q6.default(`unspecified`),sourceName:X6(120),salaryMin:i6().int().nonnegative().nullish().transform(e=>e??null),salaryMax:i6().int().nonnegative().nullish().transform(e=>e??null),salaryCurrency:X6(8),notes:X6(2e4)}).refine(e=>e.salaryMin===null||e.salaryMax===null||e.salaryMin<=e.salaryMax,{message:`Minimum salary cannot exceed the maximum`,path:[`salaryMin`]}),g6({target:F3().min(1)});function i8(e){return e===`exact`}var a8=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 o8(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 a8(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}function s8(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 c8={csv:`text/csv`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};async function l8(e,t,n){let r=await fetch(`/api/import${s8({format:t,mode:n})}`,{method:`POST`,headers:{"Content-Type":c8[t]},body:e}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok)throw new a8(r.status,a?.error??`unknown`,a?.message??r.statusText,a?.details);return a}async function u8(e,t){let n=await fetch(`/api/backup/import${s8({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 a8(n.status,i?.error??`unknown`,i?.message??n.statusText,i?.details);return i}var d8={listApplications:e=>o8(`/api/applications${s8(e)}`),getApplication:e=>o8(`/api/applications/${e}`),periods:()=>o8(`/api/applications/periods`),checkDuplicates:e=>o8(`/api/applications/check${s8(e)}`),duplicateGroups:()=>o8(`/api/applications/duplicates`),createApplication:e=>o8(`/api/applications`,{method:`POST`,body:JSON.stringify(e)}),updateApplication:(e,t)=>o8(`/api/applications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),changeStatus:(e,t)=>o8(`/api/applications/${e}/status`,{method:`POST`,body:JSON.stringify(t)}),deleteApplication:e=>o8(`/api/applications/${e}`,{method:`DELETE`}),deleteApplications:e=>o8(`/api/applications/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:e})}),listCompanies:(e={})=>o8(`/api/companies${s8(e)}`),suggestCompanies:e=>o8(`/api/companies/suggest${s8({q:e})}`),getCompany:e=>o8(`/api/companies/${e}`),updateCompany:(e,t)=>o8(`/api/companies/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),listTags:()=>o8(`/api/tags`),listNotes:(e={})=>o8(`/api/notes${s8(e)}`),createNote:e=>o8(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>o8(`/api/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNote:e=>o8(`/api/notes/${e}`,{method:`DELETE`}),dashboard:()=>o8(`/api/dashboard`),search:(e,t)=>o8(`/api/search${s8({q:e,types:t,limit:25})}`),exportUrl:(e,t)=>`/api/export${s8({...e,format:t})}`,previewImport:(e,t)=>l8(e,t,`preview`),commitImport:(e,t)=>l8(e,t,`commit`),listOpenings:(e={})=>o8(`/api/openings${s8(e)}`),getOpening:e=>o8(`/api/openings/${e}`),createOpening:e=>o8(`/api/openings`,{method:`POST`,body:JSON.stringify(e)}),updateOpening:(e,t)=>o8(`/api/openings/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteOpening:e=>o8(`/api/openings/${e}`,{method:`DELETE`}),convertOpening:(e,t)=>o8(`/api/openings/${e}/convert`,{method:`POST`,body:JSON.stringify(t)}),ingestUrl:e=>o8(`/api/ingest/url`,{method:`POST`,body:JSON.stringify({url:e})}),ingestText:(e,t)=>o8(`/api/ingest/text`,{method:`POST`,body:JSON.stringify({text:e,url:t??null})}),clipPosting:e=>o8(`/api/ingest/clip`,{method:`POST`,body:JSON.stringify(e)}),getDbTargets:()=>o8(`/api/db/targets`),switchDb:e=>o8(`/api/db/switch`,{method:`POST`,body:JSON.stringify({target:e})}),backupExportUrl:`/api/backup/export`,previewBackup:e=>u8(e,`preview`),commitBackup:e=>u8(e,`commit`),getDataStatus:()=>o8(`/api/backup/status`),clearDatabase:()=>o8(`/api/backup/clear`,{method:`POST`}),seedDatabase:()=>o8(`/api/backup/seed`,{method:`POST`}),getMeta:()=>o8(`/api/meta`)},f8=class extends Error{name=`RepoError`;cause;constructor(e,t){super(e),t?.cause!==void 0&&(this.cause=t.cause)}},p8=class extends f8{name=`SchemaError`},m8=new Set([`string`,`number`,`integer`,`boolean`,`date`,`json`]);function h8(e){let t=Object.keys(e);if(t.length===0)throw new p8(`A schema must define at least one field`);let n={},r={},i={},a;for(let o of t){let t=e[o];if(!m8.has(t.type))throw new p8(`Field "${o}" has unknown type ${JSON.stringify(t.type)}. Expected one of: ${[...m8].join(`, `)}`);let s=t.column??o;if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(s))throw new p8(`Field "${o}" maps to column ${JSON.stringify(s)}, which is not a plain identifier. Column names must match /^[A-Za-z_][A-Za-z0-9_]*$/ because repolayer never quotes-and-interpolates arbitrary text into SQL.`);if(s in r)throw new p8(`Fields "${r[s]}" and "${o}" both map to column "${s}"`);if(t.primaryKey){if(a!==void 0)throw new p8(`Schema declares two primary keys ("${a}" and "${o}"). repolayer supports single-column primary keys only.`);if(t.nullable)throw new p8(`Primary key "${o}" cannot be nullable`);a=o}n[o]=s,r[s]=o,i[o]=t.type}if(a===void 0)throw new p8("Schema has no primary key. Mark exactly one field with `primaryKey: true`.");return Object.freeze({fields:e,primaryKey:a,columns:Object.freeze(n),fieldsByColumn:Object.freeze(r),fieldNames:Object.freeze(t),types:Object.freeze(i)})}var g8={createdAt:{type:`date`,column:`created_at`},updatedAt:{type:`date`,column:`updated_at`}};h8({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},website:{type:`string`,nullable:!0},location:{type:`string`,nullable:!0},archived:{type:`boolean`},...g8}),h8({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},titleKey:{type:`string`,column:`title_key`},appliedOn:{type:`date`,column:`applied_on`},periodYear:{type:`integer`,column:`period_year`},periodMonth:{type:`integer`,column:`period_month`},status:{type:`string`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},followUpOn:{type:`date`,nullable:!0,column:`follow_up_on`},archived:{type:`boolean`},...g8}),h8({id:{type:`string`,primaryKey:!0},name:{type:`string`},nameKey:{type:`string`,unique:!0,column:`name_key`},color:{type:`string`,nullable:!0},scope:{type:`string`},...g8}),h8({id:{type:`string`,primaryKey:!0},tagId:{type:`string`,column:`tag_id`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},...g8}),h8({id:{type:`string`,primaryKey:!0},title:{type:`string`},body:{type:`string`},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,nullable:!0,column:`target_id`},pinned:{type:`boolean`},...g8}),h8({id:{type:`string`,primaryKey:!0},applicationId:{type:`string`,column:`application_id`},fromStatus:{type:`string`,nullable:!0,column:`from_status`},toStatus:{type:`string`,column:`to_status`},occurredOn:{type:`date`,column:`occurred_on`},commentText:{type:`string`,nullable:!0,column:`comment_text`},...g8}),h8({id:{type:`string`,primaryKey:!0},targetType:{type:`string`,column:`target_type`},targetId:{type:`string`,column:`target_id`},model:{type:`string`},dim:{type:`integer`},embedding:{type:`json`},textHash:{type:`string`,column:`text_hash`},...g8}),h8({id:{type:`string`,primaryKey:!0},companyId:{type:`string`,column:`company_id`},jobTitle:{type:`string`,column:`job_title`},jobUrl:{type:`string`,nullable:!0,column:`job_url`},location:{type:`string`,nullable:!0},workMode:{type:`string`,column:`work_mode`},sourceName:{type:`string`,nullable:!0,column:`source_name`},salaryMin:{type:`integer`,nullable:!0,column:`salary_min`},salaryMax:{type:`integer`,nullable:!0,column:`salary_max`},salaryCurrency:{type:`string`,nullable:!0,column:`salary_currency`},notes:{type:`string`,nullable:!0},savedOn:{type:`date`,column:`saved_on`},archived:{type:`boolean`},convertedApplicationId:{type:`string`,nullable:!0,column:`converted_application_id`},...g8}),[{header:`Position`,value:e=>e.jobTitle,width:34},{header:`Company`,value:e=>e.company.name,width:28},{header:`Location`,value:e=>e.location??``,width:22},{header:`Date`,value:e=>e.appliedOn,width:13},{header:`Status`,value:e=>n$[e.status],width:13},{header:`Notes`,value:e=>e.notesText,width:70,wrap:!0}].map(e=>e.header).filter(e=>e!==`Location`),new Map(Object.entries(n$).map(([e,t])=>[t.toLowerCase(),e]));var _8=d8,v8={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],duplicateGroups:()=>[`duplicates`,`groups`],search:e=>[`search`,e],openings:e=>[`openings`,e],opening:e=>[`opening`,e],dbTargets:()=>[`db-targets`],dataStatus:()=>[`data-status`],meta:()=>[`meta`]};function 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:[`company`]}),e.invalidateQueries({queryKey:[`tags`]}),e.invalidateQueries({queryKey:[`duplicates`]}),e.invalidateQueries({queryKey:[`search`]})}function b8(e){return Xr({queryKey:v8.applications(e),queryFn:()=>_8.listApplications(e),placeholderData:e=>e})}function x8(e){return Qr({queryKey:v8.applications(e),queryFn:({pageParam:t})=>_8.listApplications(t?{...e,cursor:t}:e),initialPageParam:null,getNextPageParam:e=>e.hasMore?e.cursor:null,placeholderData:e=>e})}function S8(e){return Xr({queryKey:v8.application(e??``),queryFn:()=>_8.getApplication(e),enabled:!!e})}function C8(){return Xr({queryKey:v8.periods(),queryFn:()=>_8.periods()})}function w8(){return Xr({queryKey:v8.dashboard(),queryFn:()=>_8.dashboard()})}function T8(){return Xr({queryKey:v8.tags(),queryFn:()=>_8.listTags()})}function E8(e={}){return Xr({queryKey:v8.companies(e),queryFn:()=>_8.listCompanies(e)})}function D8(e){return Xr({queryKey:v8.company(e??``),queryFn:()=>_8.getCompany(e),enabled:!!e})}function O8(e={}){return Xr({queryKey:v8.notes(e),queryFn:()=>_8.listNotes(e)})}function k8(e){let{enabled:t=!0,...n}=e;return Xr({queryKey:v8.duplicates(n),queryFn:()=>_8.checkDuplicates(n),enabled:t&&n.company.trim().length>1,staleTime:5e3})}function A8(){return Xr({queryKey:v8.duplicateGroups(),queryFn:()=>_8.duplicateGroups()})}function j8(e){return Xr({queryKey:v8.companySuggest(e),queryFn:()=>_8.suggestCompanies(e),enabled:e.trim().length>0,staleTime:3e4})}function M8(){let e=Tn();return Zr({mutationFn:e=>_8.createApplication(e),onSuccess:()=>y8(e)})}function N8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.updateApplication(e,t),onSuccess:()=>y8(e)})}function P8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.changeStatus(e,t),onSuccess:()=>y8(e)})}function F8(){let e=Tn();return Zr({mutationFn:e=>_8.deleteApplication(e),onSuccess:()=>y8(e)})}function I8(){let e=Tn();return Zr({mutationFn:e=>_8.deleteApplications(e),onSuccess:()=>y8(e)})}function L8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.updateCompany(e,t),onSuccess:()=>y8(e)})}function R8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>e?_8.updateNote(e,t):_8.createNote(t),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]}),e.invalidateQueries({queryKey:[`search`]})}})}function z8(){let e=Tn();return Zr({mutationFn:e=>_8.deleteNote(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`notes`]}),e.invalidateQueries({queryKey:[`application`]})}})}function B8(e={}){return Xr({queryKey:v8.openings(e),queryFn:()=>_8.listOpenings(e)})}function V8(e){e.invalidateQueries({queryKey:[`openings`]}),e.invalidateQueries({queryKey:[`opening`]})}function H8(){let e=Tn();return Zr({mutationFn:e=>_8.createOpening(e),onSuccess:()=>V8(e)})}function U8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.updateOpening(e,t),onSuccess:()=>V8(e)})}function W8(){let e=Tn();return Zr({mutationFn:e=>_8.deleteOpening(e),onSuccess:()=>V8(e)})}function G8(){let e=Tn();return Zr({mutationFn:({id:e,body:t})=>_8.convertOpening(e,t),onSuccess:()=>{V8(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 K8(){return Xr({queryKey:v8.dbTargets(),queryFn:()=>_8.getDbTargets()})}function q8(){return Zr({mutationFn:e=>_8.switchDb(e)})}function J8(){return Xr({queryKey:v8.dataStatus(),queryFn:()=>_8.getDataStatus()})}function Y8(){let e=Tn();return Zr({mutationFn:()=>_8.clearDatabase(),onSuccess:()=>void e.invalidateQueries()})}function X8(){let e=Tn();return Zr({mutationFn:()=>_8.seedDatabase(),onSuccess:()=>void e.invalidateQueries()})}function Z8(){return Xr({queryKey:v8.meta(),queryFn:()=>_8.getMeta(),staleTime:1/0})}function Q8({status:e}){return(0,Z.jsx)(MY,{color:t$[e],children:n$[e]})}function $8(e,t=300){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var e5={exact:`error`,similar:`warning`,company:`info`,none:`success`};function t5({check:e,loading:t}){if(t&&!e)return(0,Z.jsx)(Fp,{type:`info`,showIcon:!0,message:`Checking your history…`,style:{marginBottom:16}});if(!e)return null;if(e.verdict===`none`)return(0,Z.jsx)(Fp,{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)(Fp,{type:e5[e.verdict],showIcon:!0,style:{marginBottom:16},message:n5(e.verdict,n,e.priorCount),description:(0,Z.jsxs)(Rz,{direction:`vertical`,size:6,style:{width:`100%`},children:[e.matches.length>0?e.matches.slice(0,5).map(e=>(0,Z.jsx)(r5,{match:e},e.id)):(0,Z.jsx)($X.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)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Matched on wording only — semantic matching is still warming up.`})]})})}function n5(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 r5({match:e}){let t=Math.round(Math.max(e.titleSimilarity,e.semanticSimilarity??0)*100);return(0,Z.jsxs)(Rz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),(0,Z.jsx)($X.Text,{type:`secondary`,children:e.appliedOn}),(0,Z.jsx)(MY,{color:t$[e.status],children:n$[e.status]}),e.matchKind===`exact`?(0,Z.jsx)(MY,{color:`red`,children:`exact title`}):(0,Z.jsxs)(MY,{children:[t,`% similar`]})]})}function i5({onStartApplication:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(``),a=$8(t,350),{data:o,isFetching:s}=k8({company:a,title:$8(r,350)}),c=a.trim().length>1;return(0,Z.jsx)(wF,{title:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(IQ,{}),(0,Z.jsx)(`span`,{children:`Check before you apply`})]}),extra:e&&(0,Z.jsx)(Gk,{type:`link`,onClick:e,children:`New application`}),children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)(WU,{gutter:12,children:[(0,Z.jsx)(BI,{xs:24,sm:12,children:(0,Z.jsx)(xV,{placeholder:`Company`,value:t,onChange:e=>n(e.target.value),allowClear:!0})}),(0,Z.jsx)(BI,{xs:24,sm:12,children:(0,Z.jsx)(xV,{placeholder:`Job title (optional)`,value:r,onChange:e=>i(e.target.value),allowClear:!0})})]}),c?(0,Z.jsx)(t5,{check:o,loading:s}):(0,Z.jsx)($X.Text,{type:`secondary`,children:`Type a company name to see whether you have been here before.`})]})})}function a5({open:e,onClose:t,application:n}){let[r]=JB.useForm(),{message:i,modal:a}=LC.useApp(),o=!!n,s=M8(),c=N8(),{data:l}=T8(),u=JB.useWatch(`companyName`,r)??``,d=JB.useWatch(`jobTitle`,r)??``,f=$8(u,300),p=$8(d,300),m=o&&u.trim()===(n?.company.name??``).trim()&&d.trim()===(n?.jobTitle??``).trim(),{data:h}=j8(f),{data:g,isFetching:v}=k8({company:f,title:p,...n?{excludeId:n.id}:{},enabled:e&&!m});(0,_.useEffect)(()=>{e&&(n?r.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,appliedOn:(0,$k.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,$k.default)(n.followUpOn):null,tags:n.tags.map(e=>e.name)}):(r.resetFields(),r.setFieldsValue({appliedOn:(0,$k.default)(),status:`applied`,workMode:`unspecified`,tags:[]})))},[e,n,r]);let y=(0,_.useMemo)(()=>(h?.companies??[]).map(e=>({value:e.name,label:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(`span`,{children:e.name}),e.applicationCount>0&&(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[e.applicationCount,` application`,e.applicationCount===1?``:`s`]})]})})),[h]),b=(0,_.useMemo)(()=>(l?.tags??[]).map(e=>({value:e.name,label:e.name})),[l]),[x,S]=(0,_.useState)(!1);async function C(e){if(g&&i8(g.verdict)&&!o&&!await new Promise(e=>{a.confirm({title:`You have applied for this exact role before`,content:(0,Z.jsxs)(Rz,{direction:`vertical`,children:[(0,Z.jsxs)($X.Text,{children:[g.matches[0]?.jobTitle,` at `,g.company?.name,` on`,` `,g.matches[0]?.appliedOn,`.`]}),(0,Z.jsx)($X.Text,{type:`secondary`,children:`Save this as a new application anyway?`})]}),okText:`Save anyway`,cancelText:`Go back`,onOk:()=>e(!0),onCancel:()=>e(!1)})}))return;let l={companyName:e.companyName,jobTitle:e.jobTitle,appliedOn:e.appliedOn.format(`YYYY-MM-DD`),status:e.status,jobUrl:e.jobUrl??null,location:e.location??null,workMode:e.workMode,sourceName:e.sourceName??null,salaryMin:e.salaryMin??null,salaryMax:e.salaryMax??null,salaryCurrency:e.salaryCurrency??null,followUpOn:e.followUpOn?e.followUpOn.format(`YYYY-MM-DD`):null,tags:e.tags??[],...o?{}:{notes:e.notes??null}};S(!0);try{n?(await c.mutateAsync({id:n.id,body:l}),i.success(`Application updated`)):(await s.mutateAsync(l),i.success(`Application saved`)),t()}catch(e){e instanceof a8&&e.fieldErrors.length>0?(r.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),i.error(`Please check the highlighted fields`)):i.error(e instanceof Error?e.message:`Could not save`)}finally{S(!1)}}return(0,Z.jsxs)(kz,{title:o?`Edit application`:`New application`,open:e,onClose:t,width:640,destroyOnHidden:!0,extra:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Gk,{type:`primary`,loading:x,onClick:()=>r.submit(),children:o?`Save changes`:`Save application`})]}),children:[!m&&(0,Z.jsx)(t5,{check:g,loading:v}),(0,Z.jsxs)(JB,{form:r,layout:`vertical`,onFinish:C,requiredMark:`optional`,children:[(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:12,children:(0,Z.jsx)(JB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(LE,{options:y,placeholder:`Start typing — existing companies appear`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(BI,{span:12,children:(0,Z.jsx)(JB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(xV,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(KR,{style:{width:`100%`},format:`YYYY-MM-DD`})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(AE,{options:QQ.map(e=>({value:e,label:n$[e]}))})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`followUpOn`,label:`Follow up on`,children:(0,Z.jsx)(KR,{style:{width:`100%`},format:`YYYY-MM-DD`,allowClear:!0})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(AE,{options:r$.map(e=>({value:e,label:i$[e]}))})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(xV,{placeholder:`Stockholm`})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(xV,{placeholder:`LinkedIn, referral…`})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(VL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(VL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(xV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(JB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(xV,{placeholder:`https://…`})}),(0,Z.jsx)(JB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(AE,{mode:`tags`,options:b,placeholder:`fintech, remote-ok, dream-job…`,tokenSeparators:[`,`]})}),!o&&(0,Z.jsx)(JB.Item,{name:`notes`,label:`Notes`,help:`Saved as a note linked to this application. Searchable.`,children:(0,Z.jsx)(xV.TextArea,{rows:4,placeholder:`Anything worth remembering…`})})]})]})}var o5={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`}},s5={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 c5(e){let t=o5[e];return{algorithm:e===`dark`?HY.darkAlgorithm:HY.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 l5(e){return`${p$(e.month).slice(0,3)} ${e.year}`}function u5({points:e,height:t=140}){let[n,r]=(0,_.useState)(null);if(e.length===0)return null;let i=Math.max(...e.map(e=>e.count),1),a=e.reduce((e,t)=>e+t.count,0),o=n===null?null:e[n];return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`baseline`,style:{marginBottom:8},children:[(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:o?`${l5(o)}: ${o.count} application${o.count===1?``:`s`}`:`${a} application${a===1?``:`s`} over ${e.length} months`}),(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[`peak `,i]})]}),(0,Z.jsxs)(`svg`,{viewBox:`0 0 ${e.length*10} 100`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Applications per month, ${l5(e[0])} to ${l5(e.at(-1))}. Peak ${i} in one month, ${a} in total.`,style:{display:`block`,width:`100%`,height:t},onMouseLeave:()=>r(null),children:[(0,Z.jsx)(`title`,{children:`Applications per month`}),e.map((e,t)=>{let a=e.count===0?0:Math.max(e.count/i*100,2);return(0,Z.jsxs)(`g`,{onMouseEnter:()=>r(t),children:[(0,Z.jsx)(`rect`,{x:t*10,y:`0`,width:10,height:100,fill:`transparent`}),(0,Z.jsx)(`rect`,{x:t*10+3/2,y:100-a,width:7,height:Math.max(a,1),rx:`1`,fill:e.count===0?s5.border:s5.accent,opacity:n===null||n===t?1:.45})]},`${e.year}-${e.month}`)})]}),(0,Z.jsx)(eB,{justify:`space-between`,style:{marginTop:6},children:[e[0],e[Math.floor(e.length/2)],e.at(-1)].map((e,t)=>(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:11},children:l5(e)},t))})]})}var d5=[.45,.6,.78,1];function f5({stages:e}){let t=e[0]?.count??0;return(0,Z.jsxs)(Rz,{direction:`vertical`,size:10,style:{width:`100%`},children:[e.map((e,n)=>{let r=t>0?e.count/t:0;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,marginBottom:4,gap:8},children:[(0,Z.jsx)($X.Text,{style:{fontSize:13},children:n$[e.status]}),(0,Z.jsxs)(Rz,{size:8,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e.count}),e.conversion!==null&&(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[Math.round(e.conversion*100),`% of previous`]})]})]}),(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 6`,preserveAspectRatio:`none`,role:`img`,"aria-label":`${n$[e.status]}: ${e.count} applications ever reached this stage`,style:{display:`block`,width:`100%`,height:10},children:[(0,Z.jsx)(`title`,{children:`${n$[e.status]}: ${e.count}`}),(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`6`,rx:`1.5`,fill:s5.bgSunken}),r>0&&(0,Z.jsx)(`rect`,{x:`0`,y:`0`,width:Math.max(r*100,1),height:`6`,rx:`1.5`,fill:s5.accent,opacity:d5[n]??1})]})]},e.status)}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Counted from your status history — an application that interviewed and was then turned down still counts at every stage it reached.`})]})}function p5({values:e,label:t,height:n=28}){if(e.length<2)return null;let r=Math.max(...e,1),i=100/(e.length-1),a=e.map((e,t)=>`${(t*i).toFixed(2)},${(100-e/r*100).toFixed(2)}`).join(` `),o=`0,100 ${a} 100,100`;return(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 100`,preserveAspectRatio:`none`,role:`img`,"aria-label":t,style:{display:`block`,width:`100%`,height:n},children:[(0,Z.jsx)(`title`,{children:t}),(0,Z.jsx)(`polygon`,{points:o,fill:s5.accent,opacity:.12}),(0,Z.jsx)(`polyline`,{points:a,fill:`none`,stroke:s5.accent,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`})]})}function m5(){let{data:e,isLoading:t}=w8(),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(`follow-ups`),o=u$(d$());if(t||!e)return(0,Z.jsx)(DS,{active:!0,paragraph:{rows:8}});let{stats:s,followUps:c,recentActivity:l,funnel:u,volume:d,stale:f}=e;if(s.total===0)return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wF,{children:(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,children:[(0,Z.jsx)($X.Text,{strong:!0,children:`No applications yet`}),(0,Z.jsx)($X.Text,{type:`secondary`,children:`Add the first one, or bring in a spreadsheet you already keep.`})]}),children:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{type:`primary`,icon:(0,Z.jsx)(fP,{}),onClick:()=>r(!0),children:`New application`}),(0,Z.jsx)(dn,{to:`/applications`,children:(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(ZQ,{}),children:`Import`})})]})})}),(0,Z.jsx)(a5,{open:n,onClose:()=>r(!1)})]});let p=d.slice(-12),m=d.slice(-13,-1),h=m.length>0?m.reduce((e,t)=>e+t.count,0)/m.length:0,g=s.thisMonth-h,v=i===`follow-ups`?c.length:f.length;return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsx)(nW,{title:`Total applications`,value:s.total})})}),(0,Z.jsx)(BI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsx)(nW,{title:`Still active`,value:s.active,valueStyle:{color:s5.accent}})})}),(0,Z.jsx)(BI,{xs:12,sm:12,md:6,children:(0,Z.jsxs)(wF,{size:`small`,children:[(0,Z.jsx)(nW,{title:`${p$(o.month)} ${o.year}`,value:s.thisMonth}),(0,Z.jsx)(p5,{values:p.map(e=>e.count),label:`Applications in each of the last ${p.length} months: ${p.map(e=>e.count).join(`, `)}`}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:h===0?`first month on record`:`${g>=0?`+`:``}${g.toFixed(1)} vs your monthly average`})]})}),(0,Z.jsx)(BI,{xs:12,sm:12,md:6,children:(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)($X.Text,{type:`secondary`,children:`Response rate`}),(0,Z.jsx)(wU,{percent:Math.round(s.responseRate*100),size:`small`,strokeColor:s5.accent}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Anything past “applied” counts as a reply`})]})})})]}),(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:24,lg:14,children:(0,Z.jsx)(i5,{onStartApplication:()=>r(!0)})}),(0,Z.jsx)(BI,{xs:24,lg:10,children:(0,Z.jsx)(wF,{title:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(VR,{}),(0,Z.jsx)(`span`,{children:`Needs attention`})]}),extra:(0,Z.jsx)(eL,{size:`small`,value:i,onChange:e=>a(e),options:[{label:`Follow-ups (${c.length})`,value:`follow-ups`},{label:`Gone quiet (${f.length})`,value:`quiet`}]}),styles:{body:{maxHeight:320,overflowY:`auto`}},children:v===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:i===`follow-ups`?`Nothing due — all caught up`:`Nothing has gone quiet`}):i===`follow-ups`?(0,Z.jsx)(LH,{size:`small`,dataSource:c,renderItem:e=>(0,Z.jsxs)(LH.Item,{children:[(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(eB,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)($X.Text,{type:`danger`,children:[`due `,e.followUpOn]})]})}),(0,Z.jsx)(Q8,{status:e.status})]})}):(0,Z.jsx)(LH,{size:`small`,dataSource:f,header:(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Still live, no follow-up date, and nothing has moved.`}),renderItem:e=>(0,Z.jsxs)(LH.Item,{children:[(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsx)(dn,{to:`/applications/${e.id}`,children:e.jobTitle}),description:(0,Z.jsxs)(eB,{justify:`space-between`,wrap:!0,gap:8,children:[(0,Z.jsx)(`span`,{children:e.company.name}),(0,Z.jsxs)($X.Text,{type:`warning`,children:[`silent `,e.silentDays,` days`]})]})}),(0,Z.jsx)(Q8,{status:e.status})]})})})})]}),(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:24,lg:12,children:(0,Z.jsx)(wF,{title:`Pipeline`,size:`small`,children:(0,Z.jsx)(f5,{stages:u})})}),(0,Z.jsx)(BI,{xs:24,lg:12,children:(0,Z.jsx)(wF,{title:`Applications over time`,size:`small`,children:(0,Z.jsx)(u5,{points:d})})})]}),(0,Z.jsx)(wF,{title:`Recent activity`,size:`small`,styles:{body:{maxHeight:360,overflowY:`auto`}},children:l.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No status changes yet`}):(0,Z.jsx)(XY,{items:l.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsxs)($X.Text,{children:[(0,Z.jsx)(dn,{to:`/applications/${e.applicationId}`,children:e.jobTitle}),` at `,e.companyName]}),(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[e.fromStatus?`${n$[e.fromStatus]} → ${n$[e.toStatus]}`:`Applied (${n$[e.toStatus]})`,` `,`· `,e.occurredOn]})]})}))})}),(0,Z.jsx)(a5,{open:n,onClose:()=>r(!1)})]})}function h5({periods:e,year:t,month:n,onSelect:r}){let i=(0,_.useMemo)(()=>e.map(e=>({key:`y:${e.year}`,title:(0,Z.jsx)(g5,{label:String(e.year),count:e.count,strong:!0}),children:(e.months??[]).map(e=>({key:`m:${e.year}:${e.month}`,title:(0,Z.jsx)(g5,{label:p$(e.month),count:e.count})}))})),[e]),a=(0,_.useMemo)(()=>t&&n?[`m:${t}:${n}`]:t?[`y:${t}`]:[],[t,n]),o=(0,_.useMemo)(()=>{let n=e[0],r=n?[`y:${n.year}`]:[];return t&&!r.includes(`y:${t}`)&&r.push(`y:${t}`),r},[e,t]);return e.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No applications yet`}):(0,Z.jsx)(sJ,{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 g5({label:e,count:t,strong:n}){return(0,Z.jsxs)(`span`,{style:{display:`flex`,justifyContent:`space-between`,gap:12},children:[(0,Z.jsx)($X.Text,{strong:n,children:e}),(0,Z.jsx)($X.Text,{type:`secondary`,children:t})]})}var _5={new:`green`,duplicate:`default`,error:`red`},v5={new:`New`,duplicate:`Duplicate — skipped`,error:`Error`};function y5({open:e,onClose:t}){let n=Tn(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`csv`),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null);function h(){i(null),c(null),u(null),m(null)}function g(){h(),t()}let v=e=>{let t=e.name.toLowerCase().endsWith(`.xlsx`)?`xlsx`:`csv`;return i(e),o(t),m(null),f(!0),_8.previewImport(e,t).then(c).catch(e=>m(e instanceof Error?e.message:`Could not read that file`)).finally(()=>f(!1)),!1};async function y(){if(r){f(!0),m(null);try{let e=await _8.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)(VH,{title:`Import applications`,open:e,onCancel:g,width:800,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($X.Paragraph,{type:`secondary`,children:`CSV or .xlsx with the same columns Export produces: Position, Company, Location, Date, Status, Notes — Location is optional. Rows that exactly match an application you have already logged are skipped automatically.`}),(0,Z.jsxs)(GZ.Dragger,{accept:`.csv,.xlsx`,maxCount:1,showUploadList:!1,beforeUpload:v,disabled:d,children:[(0,Z.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,Z.jsx)(hQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a CSV or Excel file here`})]})]}),p&&(0,Z.jsx)(Fp,{type:`error`,showIcon:!0,message:p}),s&&!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Rz,{wrap:!0,children:[(0,Z.jsxs)(MY,{color:`green`,children:[s.totals.new,` new`]}),(0,Z.jsxs)(MY,{children:[s.totals.duplicate,` duplicate — will be skipped`]}),s.totals.error>0&&(0,Z.jsxs)(MY,{color:`red`,children:[s.totals.error,` error`]})]}),s.fileErrors.map(e=>(0,Z.jsx)(Fp,{type:`warning`,showIcon:!0,message:e},e)),(0,Z.jsx)(yY,{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?n$[e]:`—`},{title:`Result`,dataIndex:`verdict`,width:200,render:(e,t)=>(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)(MY,{color:_5[e],children:v5[e]}),t.errors.length>0&&(0,Z.jsx)($X.Text,{type:`danger`,style:{fontSize:12},children:t.errors.join(`; `)})]})}],dataSource:s.rows,pagination:{pageSize:10},scroll:{y:320}}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:h,children:`Choose a different file`}),(0,Z.jsxs)(Gk,{type:`primary`,loading:d,disabled:s.totals.new===0,onClick:y,children:[`Import `,s.totals.new,` application`,s.totals.new===1?``:`s`]})]})]}),l&&(0,Z.jsx)(UU,{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)(Gk,{type:`primary`,onClick:g,children:`Done`})})]})})}var b5=[{value:`appliedOn`,label:`Sort: date applied`,kind:`date`},{value:`company`,label:`Sort: company`,kind:`text`},{value:`jobTitle`,label:`Sort: job title`,kind:`text`},{value:`status`,label:`Sort: status`,kind:`text`}],x5={date:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}],text:[{value:`asc`,label:`A–Z`},{value:`desc`,label:`Z–A`}]};function S5(e){return b5.find(t=>t.value===e)?.kind??`date`}function C5(e){return x5[S5(e)][0].value}function w5(){let e=Xe(),[t,n]=_n(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=t.get(`sort`)??`appliedOn`,c=t.get(`direction`)??C5(s),l=(0,_.useMemo)(()=>{let e={sort:s,direction:c};for(let n of[`q`,`source`,`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,s,c]),{data:u,isLoading:d,isFetching:f,hasNextPage:p,fetchNextPage:m,isFetchingNextPage:h}=x8(l),{data:g}=C8(),{data:v}=T8(),y=u?.pages??[],b=(0,_.useMemo)(()=>y.flatMap(e=>e.items),[y]),x=y[0];function S(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));n(r,{replace:!0})}let C=[{title:`Applied`,dataIndex:`appliedOn`,width:118,sorter:!1,render:e=>(0,Z.jsx)($X.Text,{children:e})},{title:`Company`,key:`company`,width:190,render:(t,n)=>(0,Z.jsx)(Gk,{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)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e}),t.location&&(0,Z.jsxs)($X.Text,{type:`secondary`,style:{fontSize:12},children:[t.location,` · `,i$[t.workMode]]})]})},{title:`Status`,dataIndex:`status`,width:116,render:(e,t)=>(0,Z.jsx)(Q8,{status:t.status})},{title:`Tags`,key:`tags`,width:210,render:(e,t)=>(0,Z.jsx)(Rz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(MY,{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)($X.Text,{type:`secondary`,children:`—`})}],w=t.get(`from`),T=t.get(`to`),E=w&&T?[(0,$k.default)(w),(0,$k.default)(T)]:null,D=(0,$k.default)(),O=[{label:`Today`,value:[D,D]},{label:`Yesterday`,value:[D.subtract(1,`day`),D.subtract(1,`day`)]},{label:`This week`,value:[D.startOf(`week`),D.endOf(`week`)]},{label:`This month`,value:[D.startOf(`month`),D.endOf(`month`)]},{label:`Last 7 days`,value:[D.subtract(6,`day`),D]},{label:`Last 30 days`,value:[D.subtract(29,`day`),D]}];function k(e){if(!e||!e[0]||!e[1]){S({from:``,to:``});return}S({from:e[0].format(`YYYY-MM-DD`),to:e[1].format(`YYYY-MM-DD`)})}let A=t.get(`year`)?Number(t.get(`year`)):void 0,j=t.get(`month`)?Number(t.get(`month`)):void 0,M=A&&j?`${p$(j)} ${A}`:A?String(A):`All applications`;return(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{xs:24,md:6,lg:5,children:(0,Z.jsx)(wF,{size:`small`,title:`By period`,extra:(A||j)&&(0,Z.jsx)(Gk,{size:`small`,type:`link`,onClick:()=>S({year:``,month:``}),children:`Clear`}),styles:{body:{maxHeight:`calc(100vh - 220px)`,overflowY:`auto`}},children:(0,Z.jsx)(h5,{periods:g?.periods??[],year:A,month:j,onSelect:e=>S({year:e.year??``,month:e.month??``})})})}),(0,Z.jsx)(BI,{xs:24,md:18,lg:19,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:M}),(0,Z.jsx)($X.Text,{type:`secondary`,children:x?b.length<x.total?`Showing ${b.length} of ${x.total} applications`:`${x.total} application${x.total===1?``:`s`}`:`Loading…`})]}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Bz,{menu:{items:[{key:`csv`,label:`Export as CSV`},{key:`xlsx`,label:`Export as Excel (.xlsx)`}],onClick:({key:e})=>{window.location.href=_8.exportUrl(l,e)}},children:(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(zZ,{}),children:`Export`})}),(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(ZQ,{}),onClick:()=>o(!0),children:`Import`}),(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(DX,{}),onClick:()=>e(`/applications/duplicates`),children:`Duplicates`}),(0,Z.jsx)(Gk,{type:`primary`,icon:(0,Z.jsx)(fP,{}),onClick:()=>i(!0),children:`New application`})]})]}),(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(xV,{allowClear:!0,size:`large`,prefix:(0,Z.jsx)(TE,{}),placeholder:`Search by meaning — try “server-side developer” or “remote fintech”`,defaultValue:t.get(`q`)??``,onChange:e=>{e.target.value===``&&S({q:``})},onPressEnter:e=>S({q:e.target.value})}),(0,Z.jsxs)(eB,{gap:8,wrap:!0,children:[(0,Z.jsx)(KR.RangePicker,{allowClear:!0,value:E,presets:O,format:`YYYY-MM-DD`,onChange:e=>k(e)}),(0,Z.jsx)(AE,{mode:`multiple`,allowClear:!0,placeholder:`Status`,style:{minWidth:180},suffixIcon:(0,Z.jsx)(lQ,{}),value:t.get(`status`)?.split(`,`)??[],onChange:e=>S({status:e}),options:QQ.map(e=>({value:e,label:n$[e]}))}),(0,Z.jsx)(AE,{mode:`multiple`,allowClear:!0,placeholder:`Work mode`,style:{minWidth:160},value:t.get(`workMode`)?.split(`,`)??[],onChange:e=>S({workMode:e}),options:r$.map(e=>({value:e,label:i$[e]}))}),(0,Z.jsx)(AE,{mode:`multiple`,allowClear:!0,placeholder:`Tags`,style:{minWidth:200},value:t.get(`tags`)?.split(`,`)??[],onChange:e=>S({tags:e}),options:(v?.tags??[]).map(e=>({value:e.name,label:e.name}))}),(0,Z.jsx)(AE,{style:{minWidth:170},value:s,onChange:e=>S({sort:e,direction:C5(e)}),options:b5.map(({value:e,label:t})=>({value:e,label:t}))}),(0,Z.jsx)(AE,{style:{width:130},value:c,onChange:e=>S({direction:e}),options:x5[S5(s)]})]}),x?.searched&&!x.semanticReady&&(0,Z.jsx)(Fp,{type:`info`,showIcon:!0,icon:(0,Z.jsx)(JQ,{}),message:`Results will improve shortly — the semantic model is still loading.`})]})}),(0,Z.jsx)(yY,{rowKey:`id`,columns:C,dataSource:b,loading:d||f&&!h,pagination:!1,onRow:t=>({onClick:()=>e(`/applications/${t.id}`),style:{cursor:`pointer`}}),locale:{emptyText:(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:t.get(`q`)?`Nothing matched “${t.get(`q`)}”`:`No applications for this filter`})},footer:p?()=>(0,Z.jsx)(eB,{justify:`center`,children:(0,Z.jsx)(bD,{title:`Adds the next page to the list`,children:(0,Z.jsx)(Gk,{loading:h,onClick:()=>void m(),children:`Load more`})})}):void 0})]})}),(0,Z.jsx)(a5,{open:r,onClose:()=>i(!1)}),(0,Z.jsx)(y5,{open:a,onClose:()=>o(!1)})]})}function T5({open:e,note:t,onClose:n,target:r}){let[i]=JB.useForm(),{message:a}=LC.useApp(),o=R8();return(0,Z.jsx)(VH,{open:e,title:t?`Edit note`:`New note`,okText:`Save`,destroyOnHidden:!0,onCancel:n,afterOpenChange:e=>{e&&(t?i.setFieldsValue({title:t.title,body:t.body,targetType:t.targetType,targetId:t.targetId,pinned:t.pinned}):(i.resetFields(),i.setFieldsValue({targetType:r?r.type:`standalone`,targetId:r?r.id:null,pinned:!1,body:``})))},onOk:async()=>{let e=await i.validateFields();await o.mutateAsync({...t?{id:t.id}:{},body:{title:e.title,body:e.body??``,targetType:e.targetType,targetId:e.targetType===`standalone`?null:e.targetId??null,pinned:e.pinned??!1}}),a.success(t?`Note updated`:`Note saved`),n()},children:(0,Z.jsxs)(JB,{form:i,layout:`vertical`,children:[(0,Z.jsx)(JB.Item,{name:`title`,label:`Title`,rules:[{required:!0,message:`Title is required`}],children:(0,Z.jsx)(xV,{placeholder:`Interview prep, salary research…`})}),(0,Z.jsx)(JB.Item,{name:`body`,label:`Note`,children:(0,Z.jsx)(xV.TextArea,{rows:8,placeholder:`Anything worth keeping`})}),r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JB.Item,{name:`targetType`,hidden:!0,children:(0,Z.jsx)(xV,{})}),(0,Z.jsx)(JB.Item,{name:`targetId`,hidden:!0,children:(0,Z.jsx)(xV,{})}),(0,Z.jsxs)($X.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Attached to `,r.label]})]}):(0,Z.jsx)(E5,{form:i}),(0,Z.jsx)(JB.Item,{name:`pinned`,label:`Pinned`,valuePropName:`checked`,children:(0,Z.jsx)(eG,{})})]})})}function E5({form:e}){let t=JB.useWatch(`targetType`,e)??`standalone`,{data:n}=E8(),{data:r}=b8({limit:200}),i=(0,_.useMemo)(()=>t===`company`?(n?.companies??[]).map(e=>({value:e.id,label:e.name})):t===`application`?(r?.items??[]).map(e=>({value:e.id,label:`${e.jobTitle} — ${e.company.name}`})):[],[t,n,r]);return(0,Z.jsxs)(eB,{gap:12,children:[(0,Z.jsx)(JB.Item,{name:`targetType`,label:`Attach to`,style:{flex:1},children:(0,Z.jsx)(AE,{options:[{value:`standalone`,label:`Nothing in particular`},{value:`company`,label:`A company`},{value:`application`,label:`An application`}],onChange:()=>e.setFieldValue(`targetId`,null)})}),t!==`standalone`&&(0,Z.jsx)(JB.Item,{name:`targetId`,label:t===`company`?`Company`:`Application`,style:{flex:2},rules:[{required:!0,message:`Pick what this note is about`}],children:(0,Z.jsx)(AE,{showSearch:!0,optionFilterProp:`label`,options:i})})]})}function D5(){let{id:e}=Qe(),t=Xe(),{message:n}=LC.useApp(),{data:r,isLoading:i}=S8(e),a=P8(),o=F8(),s=z8(),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(DS,{active:!0,paragraph:{rows:10}});let m=e$(r.status);async function h(t){e&&(await a.mutateAsync({id:e,body:{status:t,comment:null}}),n.success(`Moved to ${n$[t]}`))}return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`flex-start`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Gk,{type:`link`,icon:(0,Z.jsx)(JZ,{}),style:{padding:0},onClick:()=>t(`/applications`),children:`Back to applications`}),(0,Z.jsx)($X.Title,{level:3,style:{margin:0},children:r.jobTitle}),(0,Z.jsxs)(Rz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/companies/${r.company.id}`,children:r.company.name}),(0,Z.jsxs)($X.Text,{type:`secondary`,children:[`applied `,r.appliedOn]}),(0,Z.jsx)(Q8,{status:r.status})]})]}),(0,Z.jsxs)(Rz,{wrap:!0,children:[m&&(0,Z.jsxs)(Gk,{type:`primary`,onClick:()=>void h(m),children:[`Move to `,n$[m]]}),(0,Z.jsx)(AE,{style:{width:150},value:r.status,onChange:e=>void h(e),options:QQ.map(e=>({value:e,label:n$[e]}))}),(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(nX,{}),onClick:()=>l(!0),children:`Edit`}),(0,Z.jsx)(GH,{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)(Gk,{danger:!0,icon:(0,Z.jsx)($Y,{})})})]})]}),(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:24,lg:14,children:(0,Z.jsx)(wF,{title:`Details`,children:(0,Z.jsxs)(oz,{column:{xs:1,sm:2},size:`small`,bordered:!0,children:[(0,Z.jsx)(oz.Item,{label:`Company`,children:r.company.name}),(0,Z.jsx)(oz.Item,{label:`Applied on`,children:r.appliedOn}),(0,Z.jsx)(oz.Item,{label:`Location`,children:r.location??`—`}),(0,Z.jsx)(oz.Item,{label:`Work mode`,children:i$[r.workMode]}),(0,Z.jsx)(oz.Item,{label:`Source`,children:r.sourceName??`—`}),(0,Z.jsx)(oz.Item,{label:`Follow up`,children:r.followUpOn??`—`}),(0,Z.jsx)(oz.Item,{label:`Salary`,span:2,children:r.salaryMin||r.salaryMax?`${r.salaryMin?.toLocaleString()??`?`} – ${r.salaryMax?.toLocaleString()??`?`} ${r.salaryCurrency??``}`:`—`}),(0,Z.jsx)(oz.Item,{label:`Posting`,span:2,children:r.jobUrl?(0,Z.jsx)(`a`,{href:r.jobUrl,target:`_blank`,rel:`noreferrer`,children:(0,Z.jsxs)(Rz,{size:4,children:[(0,Z.jsx)(xQ,{}),r.jobUrl]})}):`—`}),(0,Z.jsx)(oz.Item,{label:`Tags`,span:2,children:r.tags.length>0?(0,Z.jsx)(Rz,{size:4,wrap:!0,children:r.tags.map(e=>(0,Z.jsx)(MY,{children:e.name},e.id))}):`—`})]})})}),(0,Z.jsx)(BI,{xs:24,lg:10,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(wF,{title:`Status history`,children:r.statusEvents.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No changes recorded`}):(0,Z.jsx)(XY,{items:r.statusEvents.map(e=>({color:e.toStatus===`offer`?`green`:e.toStatus===`rejected`?`red`:`blue`,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e.fromStatus?`${n$[e.fromStatus]} → ${n$[e.toStatus]}`:`Applied`}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:e.occurredOn}),e.comment&&(0,Z.jsx)($X.Text,{children:e.comment})]})}))})}),(0,Z.jsx)(wF,{title:`Notes (${r.notes.length})`,extra:(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(fP,{}),onClick:()=>p(!0),children:`Add note`}),children:r.notes.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No notes yet`}):(0,Z.jsx)(LH,{size:`small`,dataSource:r.notes,renderItem:e=>(0,Z.jsx)(LH.Item,{actions:[(0,Z.jsx)(Gk,{type:`text`,icon:(0,Z.jsx)(nX,{}),onClick:()=>d(e)},`edit`),(0,Z.jsx)(GH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await s.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Gk,{type:`text`,danger:!0,icon:(0,Z.jsx)($Y,{})})},`delete`)],children:(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsxs)(Rz,{size:8,children:[e.pinned&&(0,Z.jsx)(AQ,{style:{color:`#faad14`}}),(0,Z.jsx)($X.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)($X.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:4,expandable:!0,symbol:`more`},children:e.body})})})})})]})})]}),(0,Z.jsx)(a5,{open:c,onClose:()=>l(!1),application:r}),(0,Z.jsx)(T5,{open:f||u!==null,note:u,target:{type:`application`,id:r.id,label:r.jobTitle},onClose:()=>{p(!1),d(null)}})]})}function O5(e){return[...e.members.map(e=>e.id)].sort().join(`|`)}function k5(){let{message:e}=LC.useApp(),{data:t,isLoading:n,isFetching:r,refetch:i}=A8(),a=I8(),[o,s]=(0,_.useState)({}),[c,l]=(0,_.useState)(new Set),u=(0,_.useMemo)(()=>(t?.groups??[]).filter(e=>!c.has(O5(e))),[t,c]),d=e=>o[O5(e)]??e.keepId,f=e=>e.members.filter(t=>t.id!==d(e)).map(e=>e.id),p=u.filter(e=>e.kind===`exact`),m=u.length-p.length,h=p.flatMap(f);async function g(t){if(t.length!==0)try{let n=await a.mutateAsync(t);e.success(`Removed ${n.deleted} application${n.deleted===1?``:`s`}`)}catch{e.error(`Could not remove those applications`)}}return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Duplicates`}),(0,Z.jsx)($X.Text,{type:`secondary`,children:n?`Scanning…`:[`${t?.scanned??0} application${t?.scanned===1?``:`s`} scanned`,`${p.length} exact repeat${p.length===1?``:`s`}`,...m>0?[`${m} similar to review`]:[]].join(` · `)})]}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(DU,{}),loading:r,onClick:()=>void i(),children:`Rescan`}),(0,Z.jsx)(GH,{title:`Delete ${h.length} application${h.length===1?``:`s`}?`,description:`The kept record in each group stays. This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},disabled:h.length===0,onConfirm:()=>void g(h),children:(0,Z.jsxs)(Gk,{danger:!0,type:`primary`,icon:(0,Z.jsx)($Y,{}),disabled:h.length===0,loading:a.isPending,children:[`Remove `,h.length,` exact repeat`,h.length===1?``:`s`]})})]})]}),n&&(0,Z.jsx)(DS,{active:!0}),!n&&u.length===0&&(0,Z.jsx)(wF,{children:(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:(t?.scanned??0)===0?`Nothing to scan yet`:`No duplicates — every application is a distinct role or employer`})}),u.map(e=>(0,Z.jsx)(A5,{group:e,keptId:d(e),busy:a.isPending,onKeep:t=>s(n=>({...n,[O5(e)]:t})),onDismiss:()=>l(t=>new Set(t).add(O5(e))),onRemove:()=>void g(f(e))},O5(e)))]})}function A5({group:e,keptId:t,busy:n,onKeep:r,onDismiss:i,onRemove:a}){let o=e.members.length-1;return(0,Z.jsx)(wF,{size:`small`,title:(0,Z.jsxs)(Rz,{size:8,wrap:!0,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e.companyName}),(0,Z.jsx)($X.Text,{type:`secondary`,children:e.members[0]?.jobTitle}),(0,Z.jsx)(MY,{color:e.kind===`exact`?`red`:`orange`,children:e.kind===`exact`?`same title`:`similar title`})]}),extra:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{size:`small`,onClick:i,children:`Not a duplicate`}),(0,Z.jsx)(GH,{title:`Delete ${o} application${o===1?``:`s`}?`,description:`This cannot be undone.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:a,children:(0,Z.jsxs)(Gk,{size:`small`,danger:!0,icon:(0,Z.jsx)($Y,{}),loading:n,children:[`Delete `,o]})})]}),children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[e.kind===`similar`&&(0,Z.jsx)(Fp,{type:`warning`,showIcon:!0,message:`Close but not identical — two applications a year apart can look like this. Delete only if it really is the same job.`}),(0,Z.jsx)(yY,{rowKey:`id`,size:`small`,columns:[{title:`Position`,key:`jobTitle`,render:(e,n)=>(0,Z.jsxs)(Rz,{size:8,wrap:!0,children:[(0,Z.jsx)(dn,{to:`/applications/${n.id}`,children:n.jobTitle}),n.archived&&(0,Z.jsx)(MY,{children:`Archived`}),n.id===t?(0,Z.jsx)(MY,{color:`green`,children:`Keep`}):(0,Z.jsx)(MY,{color:`red`,children:`Remove`})]})},{title:`Applied`,dataIndex:`appliedOn`,width:118},{title:`Status`,key:`status`,width:120,render:(e,t)=>(0,Z.jsx)(Q8,{status:t.status})},{title:`Where`,key:`location`,width:200,render:(e,t)=>[t.location,i$[t.workMode]].filter(Boolean).join(` · `)||`—`},{title:`Notes`,key:`noteCount`,width:80,render:(e,t)=>t.noteCount>0?t.noteCount:`—`}],dataSource:e.members,pagination:!1,rowSelection:{type:`radio`,columnTitle:`Keep`,columnWidth:60,selectedRowKeys:[t],onChange:e=>r(String(e[0]))}})]})})}var j5=25;function M5(){let e=Xe(),[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(j5),a=$8(t,300),{data:o,isLoading:s}=E8(a?{q:a}:{});return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Companies`}),(0,Z.jsx)(xV,{allowClear:!0,prefix:(0,Z.jsx)(TE,{}),placeholder:`Find a company`,style:{maxWidth:320},value:t,onChange:e=>n(e.target.value)})]}),(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsx)(yY,{rowKey:`id`,size:`middle`,loading:s,columns:[{title:`Company`,dataIndex:`name`,render:(e,t)=>(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Text,{strong:!0,children:e}),t.website&&(0,Z.jsx)($X.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)($X.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)($X.Text,{type:`secondary`,children:`—`})},{title:`Tags`,key:`tags`,width:260,render:(e,t)=>(0,Z.jsx)(Rz,{size:4,wrap:!0,children:t.tags.map(e=>(0,Z.jsx)(MY,{style:{marginInlineEnd:0},children:e.name},e.id))})}],dataSource:o?.companies??[],pagination:{pageSize:r,showSizeChanger:!0,onChange:(e,t)=>i(t),hideOnSinglePage:r===j5},onRow:t=>({onClick:()=>e(`/companies/${t.id}`),style:{cursor:`pointer`}})})})]})}function N5(){let{id:e}=Qe(),t=Xe(),{message:n}=LC.useApp(),{data:r,isLoading:i}=D8(e),{data:a}=O8(e?{targetType:`company`,targetId:e}:{}),{data:o}=T8(),s=L8(),c=z8(),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);if(i||!r)return(0,Z.jsx)(DS,{active:!0,paragraph:{rows:8}});let{company:p,applications:m}=r,h=m.filter(e=>[`applied`,`screening`,`interview`].includes(e.status)).length;return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,children:[(0,Z.jsx)(Gk,{type:`link`,icon:(0,Z.jsx)(JZ,{}),style:{padding:0},onClick:()=>t(`/companies`),children:`Back to companies`}),(0,Z.jsx)($X.Title,{level:3,style:{margin:0},children:p.name}),p.website&&(0,Z.jsx)($X.Link,{href:p.website,target:`_blank`,children:p.website})]}),(0,Z.jsxs)(WU,{gutter:[16,16],children:[(0,Z.jsx)(BI,{xs:12,md:6,children:(0,Z.jsx)(wF,{children:(0,Z.jsx)(nW,{title:`Applications`,value:m.length})})}),(0,Z.jsx)(BI,{xs:12,md:6,children:(0,Z.jsx)(wF,{children:(0,Z.jsx)(nW,{title:`Still active`,value:h,valueStyle:{color:s5.accent}})})}),(0,Z.jsx)(BI,{xs:24,md:12,children:(0,Z.jsx)(wF,{children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,Z.jsx)($X.Text,{type:`secondary`,children:`Company tags`}),(0,Z.jsx)(AE,{mode:`tags`,style:{width:`100%`},placeholder:`fintech, remote-first…`,value:p.tags.map(e=>e.name),options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),onChange:t=>{e&&s.mutate({id:e,body:{tags:t}})}})]})})})]}),(0,Z.jsx)(wF,{title:`Application history`,children:(0,Z.jsx)(yY,{rowKey:`id`,size:`middle`,columns:[{title:`Applied`,dataIndex:`appliedOn`,width:120},{title:`Job title`,dataIndex:`jobTitle`,render:e=>(0,Z.jsx)($X.Text,{strong:!0,children:e})},{title:`Status`,dataIndex:`status`,width:120,render:(e,t)=>(0,Z.jsx)(Q8,{status:t.status})},{title:`Source`,dataIndex:`sourceName`,width:130}],dataSource:m,pagination:!1,onRow:e=>({onClick:()=>t(`/applications/${e.id}`),style:{cursor:`pointer`}})})}),(0,Z.jsx)(wF,{title:`Notes about ${p.name}`,extra:(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(fP,{}),onClick:()=>f(!0),children:`Add note`}),children:(a?.notes??[]).length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:`No notes about this company`}):(0,Z.jsx)(LH,{dataSource:a?.notes??[],renderItem:e=>(0,Z.jsx)(LH.Item,{actions:[(0,Z.jsx)(Gk,{type:`text`,icon:(0,Z.jsx)(nX,{}),onClick:()=>u(e)},`edit`),(0,Z.jsx)(GH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await c.mutateAsync(e.id),n.success(`Note deleted`)},children:(0,Z.jsx)(Gk,{type:`text`,danger:!0,icon:(0,Z.jsx)($Y,{})})},`delete`)],children:(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsxs)(Rz,{size:8,children:[e.pinned&&(0,Z.jsx)(AQ,{style:{color:`#faad14`}}),(0,Z.jsx)($X.Text,{strong:!0,children:e.title})]}),description:(0,Z.jsx)($X.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e.body})})})})}),(0,Z.jsx)(T5,{open:d||l!==null,note:l,target:{type:`company`,id:p.id,label:p.name},onClose:()=>{f(!1),u(null)}})]})}function P5(){let{message:e}=LC.useApp(),[t,n]=(0,_.useState)(`all`),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),{data:l,isLoading:u}=O8(t===`all`?{}:{targetType:t}),d=z8(),f=l?.notes??[],p=(0,_.useMemo)(()=>{let e=r.trim().toLowerCase();return e?f.filter(t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||(t.targetLabel?.toLowerCase().includes(e)??!1)):f},[f,r]);return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,wrap:!0,gap:12,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Notes`}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(eL,{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)(Gk,{type:`primary`,icon:(0,Z.jsx)(fP,{}),onClick:()=>c(!0),children:`New note`})]})]}),(0,Z.jsx)(xV,{allowClear:!0,prefix:(0,Z.jsx)(TE,{}),placeholder:`Search notes by title, body, or what they're attached to`,value:r,onChange:e=>i(e.target.value)}),(0,Z.jsx)(wF,{size:`small`,loading:u,children:p.length===0?(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:r?`Nothing matched “${r}”`:`No notes here yet`}):(0,Z.jsx)(LH,{dataSource:p,renderItem:t=>(0,Z.jsx)(LH.Item,{actions:[(0,Z.jsx)(Gk,{type:`text`,icon:(0,Z.jsx)(nX,{}),onClick:()=>o(t)},`edit`),(0,Z.jsx)(GH,{title:`Delete this note?`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:async()=>{await d.mutateAsync(t.id),e.success(`Note deleted`)},children:(0,Z.jsx)(Gk,{type:`text`,danger:!0,icon:(0,Z.jsx)($Y,{})})},`delete`)],children:(0,Z.jsx)(LH.Item.Meta,{title:(0,Z.jsxs)(Rz,{size:8,wrap:!0,children:[t.pinned&&(0,Z.jsx)(AQ,{style:{color:`#faad14`}}),(0,Z.jsx)($X.Text,{strong:!0,children:t.title}),(0,Z.jsx)(F5,{note:t})]}),description:(0,Z.jsx)($X.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},ellipsis:{rows:3,expandable:!0,symbol:`more`},children:t.body})})})})}),(0,Z.jsx)(T5,{open:s||a!==null,note:a,onClose:()=>{c(!1),o(null)}})]})}function F5({note:e}){if(e.targetType===`standalone`)return(0,Z.jsx)(MY,{children:`general`});if(!e.targetId)return(0,Z.jsx)(MY,{children:`unlinked`});let t=e.targetType===`company`?`/companies/${e.targetId}`:`/applications/${e.targetId}`;return(0,Z.jsx)(dn,{to:t,children:(0,Z.jsxs)(MY,{color:`blue`,children:[e.targetType,`: `,e.targetLabel??`view`]})})}function I5({open:e,onClose:t,opening:n,draft:r}){let[i]=JB.useForm(),{message:a}=LC.useApp(),o=!!n,s=H8(),c=U8(),{data:l}=j8(JB.useWatch(`companyName`,i)??``);(0,_.useEffect)(()=>{e&&(n?i.setFieldsValue({companyName:n.company.name,jobTitle:n.jobTitle,savedOn:(0,$k.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}):(i.resetFields(),i.setFieldsValue({savedOn:(0,$k.default)(),workMode:r?.workMode??`unspecified`,...r?{companyName:r.companyName,jobTitle:r.jobTitle,jobUrl:r.jobUrl??void 0,location:r.location??void 0,sourceName:r.sourceName??void 0,salaryMin:r.salaryMin,salaryMax:r.salaryMax,salaryCurrency:r.salaryCurrency??void 0,notes:r.notes??void 0}:{}})))},[e,n,r,i]);let u=(0,_.useMemo)(()=>(l?.companies??[]).map(e=>({value:e.name})),[l]);async function d(e){let r={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,...o?{}:{savedOn:e.savedOn.format(`YYYY-MM-DD`)}};try{n?(await c.mutateAsync({id:n.id,body:r}),a.success(`Opening updated`)):(await s.mutateAsync(r),a.success(`Opening saved`)),t()}catch(e){e instanceof a8&&e.fieldErrors.length>0?(i.setFields(e.fieldErrors.map(e=>({name:e.path.split(`.`),errors:[e.message]}))),a.error(`Please check the highlighted fields`)):a.error(e instanceof Error?e.message:`Could not save`)}}return(0,Z.jsxs)(kz,{title:o?`Edit opening`:`Save opening for later`,open:e,onClose:t,width:560,destroyOnHidden:!0,extra:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:t,children:`Cancel`}),(0,Z.jsx)(Gk,{type:`primary`,loading:s.isPending||c.isPending,onClick:()=>i.submit(),children:o?`Save changes`:`Save opening`})]}),children:[(0,Z.jsx)($X.Paragraph,{type:`secondary`,children:r&&!o?`Read from the posting — check it over before saving. Anything the parser could not find is blank rather than guessed.`:`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)(JB,{form:i,layout:`vertical`,onFinish:d,requiredMark:`optional`,children:[(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:12,children:(0,Z.jsx)(JB.Item,{name:`companyName`,label:`Company`,rules:[{required:!0,message:`Company is required`}],children:(0,Z.jsx)(LE,{options:u,placeholder:`Start typing — existing companies appear`,filterOption:!1,allowClear:!0})})}),(0,Z.jsx)(BI,{span:12,children:(0,Z.jsx)(JB.Item,{name:`jobTitle`,label:`Job title`,rules:[{required:!0,message:`Job title is required`}],children:(0,Z.jsx)(xV,{placeholder:`Backend Engineer`})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`savedOn`,label:`Found on`,rules:[{required:!0,message:`Date is required`}],children:(0,Z.jsx)(KR,{style:{width:`100%`},format:`YYYY-MM-DD`,disabled:o})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`workMode`,label:`Work mode`,children:(0,Z.jsx)(AE,{options:r$.map(e=>({value:e,label:i$[e]}))})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`location`,label:`Location`,children:(0,Z.jsx)(xV,{placeholder:`Stockholm`})})})]}),(0,Z.jsxs)(WU,{gutter:16,children:[(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryMin`,label:`Salary from`,children:(0,Z.jsx)(VL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryMax`,label:`Salary to`,children:(0,Z.jsx)(VL,{style:{width:`100%`},min:0,step:1e4})})}),(0,Z.jsx)(BI,{span:8,children:(0,Z.jsx)(JB.Item,{name:`salaryCurrency`,label:`Currency`,children:(0,Z.jsx)(xV,{placeholder:`SEK`,maxLength:8})})})]}),(0,Z.jsx)(JB.Item,{name:`sourceName`,label:`Source`,children:(0,Z.jsx)(xV,{placeholder:`LinkedIn, referral…`})}),(0,Z.jsx)(JB.Item,{name:`jobUrl`,label:`Job posting URL`,children:(0,Z.jsx)(xV,{placeholder:`https://…`})}),(0,Z.jsx)(JB.Item,{name:`notes`,label:`Notes`,children:(0,Z.jsx)(xV.TextArea,{rows:4,placeholder:`Why this looked interesting, what you're missing to apply…`})})]})]})}var L5=!1;function R5({open:e,onClose:t,onUse:n}){let[r,i]=(0,_.useState)(`link`),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(null);function h(){o(``),c(``),f(null),m(null),u(!1)}function g(){h(),t()}async function v(e){u(!0),f(null),m(null);try{let t=await e();(t.draft.companyName.trim()===``||t.draft.jobTitle.trim()===``)&&f(`Could not make out the company and job title. Open the form and fill them in, or paste more of the posting.`),m(t)}catch(e){f(e instanceof Error?e.message:`Could not read that posting`),e instanceof a8&&e.code===`ingest_blocked`&&i(`text`)}finally{u(!1)}}let y=p?.draft;return(0,Z.jsxs)(VH,{open:e,onCancel:g,title:`Save from a posting`,width:640,destroyOnHidden:!0,footer:(0,Z.jsxs)(eB,{justify:`end`,gap:8,children:[(0,Z.jsx)(Gk,{onClick:g,children:`Cancel`}),(0,Z.jsx)(Gk,{type:`primary`,disabled:!y,onClick:()=>{y&&(n(y),h())},children:`Review and save`})]}),children:[(0,Z.jsx)(uF,{activeKey:r,onChange:e=>{i(e),f(null),m(null)},items:[{key:`link`,label:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(xQ,{}),` Paste a link`]}),disabled:L5,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(xV.Search,{placeholder:`https://boards.greenhouse.io/…`,value:a,enterButton:`Read`,loading:l,onChange:e=>o(e.target.value),onSearch:e=>e.trim()&&void v(()=>_8.ingestUrl(e.trim()))}),(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Works on most company career pages and applicant tracking systems. LinkedIn and Indeed block automated readers — for those, copy the posting and use the other tab.`})]})},{key:`text`,label:(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(rB,{}),` Paste the text`]}),children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(xV.TextArea,{rows:8,value:s,placeholder:`Backend Engineer at Spotify
|
|
444
444
|
Stockholm — hybrid
|
|
445
|
-
Salary: SEK 55 000 - 70 000`,onChange:e=>c(e.target.value)}),(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,gap:12,wrap:!0,children:[(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Everything you paste is kept as the opening's note, so nothing is lost to a wrong guess.`}),(0,Z.jsx)(Gk,{loading:l,disabled:s.trim()===``,onClick:()=>void v(()=>_8.ingestText(s,a.trim()||void 0)),children:`Read`})]})]})}]}),d&&(0,Z.jsx)(Fp,{type:`warning`,showIcon:!0,message:d,style:{marginTop:12}}),y&&(0,Z.jsxs)(Rz,{direction:`vertical`,size:8,style:{width:`100%`,marginTop:16},children:[(0,Z.jsxs)($X.Text,{strong:!0,children:[y.jobTitle||`Untitled role`,y.companyName?` at ${y.companyName}`:``]}),(0,Z.jsx)($X.Text,{type:`secondary`,children:[y.location,y.sourceName].filter(Boolean).join(` · `)||`No location found`}),(0,Z.jsx)($8,{check:p?.duplicate})]})]})}function A5(){let e=Xe(),{message:t}=LC.useApp(),[n,r]=(0,_.useState)(`active`),{data:i,isLoading:a}=R8(n===`archived`?{archived:!0}:{}),{data:o}=T8(),s=H8(),c=U8(),l=V8(),u=(0,_.useMemo)(()=>{let e=i?.openings??[];return n===`archived`?e.filter(e=>e.archived):e},[i,n]),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(void 0),[v,y]=(0,_.useState)(void 0),[b,x]=(0,_.useState)(null),[S]=JB.useForm();function C(e){x(e),S.setFieldsValue({appliedOn:(0,$k.default)(),status:`applied`,tags:[]})}async function w(n){if(b)try{let r=await c.mutateAsync({id:b.id,body:{appliedOn:n.appliedOn.format(`YYYY-MM-DD`),status:n.status,tags:n.tags??[]}});t.success(`Converted to an application`),x(null),e(`/applications/${r.id}`)}catch(e){t.error(e instanceof Error?e.message:`Could not convert`)}}async function T(e){try{await l.mutateAsync({id:e.id,body:{archived:!1}}),t.success(`Opening restored`)}catch(e){t.error(e instanceof Error?e.message:`Could not restore`)}}let E=[{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,i$[t.workMode]].filter(Boolean).join(` · `)||(0,Z.jsx)($X.Text,{type:`secondary`,children:`—`})},{title:`Source`,dataIndex:`sourceName`,render:e=>e??`—`}],D=e=>e.jobUrl&&(0,Z.jsx)(bD,{title:`Open job posting`,children:(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(xQ,{}),href:e.jobUrl,target:`_blank`,rel:`noreferrer`})}),O=e=>(0,Z.jsx)(GH,{title:`Delete this opening?`,description:`This removes it for good and cannot be undone.`,onConfirm:()=>s.mutate(e.id),okText:`Delete`,okButtonProps:{danger:!0},children:(0,Z.jsx)(Gk,{size:`small`,danger:!0,children:`Delete`})}),k=[...E,{title:``,key:`actions`,width:260,render:(e,t)=>(0,Z.jsxs)(Rz,{onClick:e=>e.stopPropagation(),children:[D(t),(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(ZB,{}),onClick:()=>C(t),children:`Convert`}),(0,Z.jsx)(Gk,{size:`small`,onClick:()=>{y(t),g(void 0),f(!0)},children:`Edit`}),O(t)]})}],A=[...E,{title:`Archived because`,key:`reason`,width:160,render:(e,t)=>t.convertedApplicationId?(0,Z.jsx)(dn,{to:`/applications/${t.convertedApplicationId}`,children:(0,Z.jsx)(MY,{color:`blue`,children:`Converted`})}):(0,Z.jsx)(MY,{children:`Archived by hand`})},{title:``,key:`actions`,width:220,render:(e,t)=>(0,Z.jsxs)(Rz,{onClick:e=>e.stopPropagation(),children:[D(t),(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(NQ,{}),loading:l.isPending,onClick:()=>T(t),children:`Restore`}),O(t)]})}];return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Job openings`}),(0,Z.jsx)($X.Text,{type:`secondary`,children:n===`active`?`Saved for later — convert one to a real application when you're ready to apply.`:`Openings that were converted into an application or archived by hand.`})]}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(fQ,{}),onClick:()=>m(!0),children:`Save from posting`}),(0,Z.jsx)(Gk,{type:`primary`,icon:(0,Z.jsx)(fP,{}),onClick:()=>{y(void 0),g(void 0),f(!0)},children:`Save opening for later`})]})]}),(0,Z.jsx)(eL,{value:n,onChange:r,options:[{label:`Active`,value:`active`},{label:`Archived`,value:`archived`}]}),(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsx)(yY,{rowKey:`id`,columns:n===`archived`?A:k,dataSource:u,loading:a,pagination:!1,locale:{emptyText:(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:n===`active`?`Nothing saved yet — use “Save opening for later” for a role you're not ready to apply to.`:`No archived openings.`})}})}),(0,Z.jsx)(D5,{open:d,onClose:()=>{f(!1),g(void 0)},opening:v,draft:h}),(0,Z.jsx)(k5,{open:p,onClose:()=>m(!1),onUse:e=>{m(!1),y(void 0),g(e),f(!0)}}),(0,Z.jsx)(VH,{title:b?`Convert "${b.jobTitle}" at ${b.company.name}`:``,open:!!b,onCancel:()=>x(null),onOk:()=>S.submit(),okText:`Create application`,confirmLoading:c.isPending,children:(0,Z.jsxs)(JB,{form:S,layout:`vertical`,onFinish:w,children:[(0,Z.jsx)(JB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0}],children:(0,Z.jsx)(KR,{style:{width:`100%`},format:`YYYY-MM-DD`})}),(0,Z.jsx)(JB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(AE,{options:QQ.map(e=>({value:e,label:n$[e]}))})}),(0,Z.jsx)(JB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(AE,{mode:`tags`,options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),placeholder:`fintech, remote-ok…`,tokenSeparators:[`,`]})})]})})]})}var j5={companies:`Companies`,applications:`Applications`,tags:`Tags`,tagLinks:`Tag links`,notes:`Notes`,statusEvents:`Status events`,jobOpenings:`Job openings`};function M5({counts:e}){return(0,Z.jsx)(oz,{size:`small`,column:2,bordered:!0,children:Object.entries(e).map(([e,t])=>(0,Z.jsx)(oz.Item,{label:j5[e]??e,children:t},e))})}function N5(){let{message:e}=LC.useApp(),{data:t,isLoading:n}=W8(),r=G8(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{c.current&&clearInterval(c.current)},[]);function l(t){VH.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(()=>{_8.getDbTargets().then(()=>{c.current&&clearInterval(c.current),window.location.reload()}).catch(()=>{})},500)}})}if(o)return(0,Z.jsx)(wF,{title:`Database`,children:(0,Z.jsx)(UU,{icon:(0,Z.jsx)(DU,{spin:!0}),title:`Reconnecting…`,subTitle:`Waiting for the server to come back up.`})});let u=t?.targets??[];return(0,Z.jsx)(wF,{title:`Database`,loading:n,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)($X.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)(oz,{size:`small`,column:1,bordered:!0,children:(0,Z.jsx)(oz.Item,{label:`Active target`,children:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(rQ,{}),t?.active,` (`,u.find(e=>e.name===t?.active)?.driver,`)`]})})}),u.length>1&&(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(AE,{style:{width:220},value:i??t?.active,options:u.map(e=>({value:e.name,label:`${e.name} (${e.driver})`})),onChange:a}),(0,Z.jsx)(Gk,{type:`primary`,disabled:!i||i===t?.active,loading:r.isPending,onClick:()=>i&&l(i),children:`Switch`})]})]})})}function P5(){let{message:e}=LC.useApp(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);function p(){n(null),i(null),o(null),u(null)}function m(){p(),f(!1)}let h=e=>(n(e),u(null),c(!0),_8.previewBackup(e).then(i).catch(e=>u(e instanceof Error?e.message:`Could not read that file`)).finally(()=>c(!1)),!1);function g(){t&&VH.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 _8.commitBackup(t);o(e)}catch(t){e.error(t instanceof Error?t.message:`Restore failed`)}finally{c(!1)}}})}return(0,Z.jsxs)(wF,{title:`Backup & restore`,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)($X.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)(Gk,{icon:(0,Z.jsx)(rQ,{}),onClick:()=>{window.location.href=_8.backupExportUrl},children:`Export backup`}),(0,Z.jsx)(Gk,{onClick:()=>f(!0),children:`Restore from backup…`})]}),(0,Z.jsx)(VH,{title:`Restore from backup`,open:d,onCancel:m,width:600,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!r&&!a&&(0,Z.jsxs)(GZ.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)(hQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a JobTrack backup file (.jtbak) here`})]}),l&&(0,Z.jsx)(Fp,{type:`error`,showIcon:!0,message:l}),r&&!a&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($X.Text,{type:`secondary`,children:[`Backup taken `,new Date(r.exportedAt).toLocaleString(),`. Restoring will replace everything currently in the active database with:`]}),(0,Z.jsx)(M5,{counts:r.counts}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:p,children:`Choose a different file`}),(0,Z.jsx)(Gk,{type:`primary`,danger:!0,loading:s,onClick:g,children:`Restore`})]})]}),a&&(0,Z.jsx)(UU,{status:`success`,title:`Restore complete`,extra:(0,Z.jsxs)(Rz,{direction:`vertical`,style:{width:`100%`},children:[(0,Z.jsx)(M5,{counts:a.counts}),(0,Z.jsx)(Gk,{type:`primary`,onClick:()=>window.location.reload(),children:`Reload`})]})})]})})]})}var F5=`CLEAR`;function I5(){let{message:e}=LC.useApp(),{data:t,isLoading:n}=K8(),r=q8(),i=J8(),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``);function l(){o(!1),c(``)}function u(){r.mutate(void 0,{onSuccess:()=>{e.success(`Database cleared`),l()},onError:t=>e.error(t instanceof Error?t.message:`Could not clear the database`)})}function d(){i.mutate(void 0,{onSuccess:t=>e.success(`Seeded ${t.applications} applications and ${t.companies} companies`),onError:t=>e.error(t instanceof Error?t.message:`Could not seed the database`)})}let f=t?.counts??{};return(0,Z.jsxs)(wF,{title:`Reset & demo data`,loading:n,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)($X.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)(M5,{counts:f}),(0,Z.jsxs)(Rz,{wrap:!0,children:[t?.empty&&(0,Z.jsx)(Gk,{type:`primary`,icon:(0,Z.jsx)(oQ,{}),loading:i.isPending,onClick:d,children:`Seed with demo data`}),(0,Z.jsx)(Gk,{danger:!0,disabled:t?.empty,onClick:()=>o(!0),children:`Clear database…`})]})]}),(0,Z.jsx)(VH,{title:`Clear the active database?`,open:a,onCancel:l,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(Fp,{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)(M5,{counts:f}),(0,Z.jsxs)($X.Text,{children:[`Type `,(0,Z.jsx)($X.Text,{code:!0,children:F5}),` to confirm.`]}),(0,Z.jsx)(xV,{value:s,onChange:e=>c(e.target.value),placeholder:F5,onPressEnter:()=>s===F5&&u()}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:l,children:`Cancel`}),(0,Z.jsx)(Gk,{danger:!0,type:`primary`,disabled:s!==F5,loading:r.isPending,onClick:u,children:`Clear database`})]})]})})]})}function L5(){let{data:e,isLoading:t}=Y8(),n=e?`${e.name} ${e.version}`:``;return(0,Z.jsx)(wF,{title:`About`,loading:t,children:(0,Z.jsxs)(oz,{size:`small`,column:1,bordered:!0,children:[(0,Z.jsx)(oz.Item,{label:`Running`,children:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(vQ,{}),(0,Z.jsxs)($X.Text,{copyable:{text:n},children:[(0,Z.jsx)(`code`,{children:e?.name}),` `,e?.version]})]})}),(0,Z.jsx)(oz.Item,{label:`Database driver`,children:e?.driver})]})})}function R5(){return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Settings`}),(0,Z.jsx)(N5,{}),(0,Z.jsx)(P5,{}),(0,Z.jsx)(I5,{}),(0,Z.jsx)(L5,{})]})}var z5=`jobtrack.theme`,B5=[{key:`/dashboard`,icon:(0,Z.jsx)(eQ,{}),label:(0,Z.jsx)(dn,{to:`/dashboard`,children:`Dashboard`})},{key:`/applications`,icon:(0,Z.jsx)(DQ,{}),label:(0,Z.jsx)(dn,{to:`/applications`,children:`Applications`})},{key:`/openings`,icon:(0,Z.jsx)(ZZ,{}),label:(0,Z.jsx)(dn,{to:`/openings`,children:`Openings`})},{key:`/companies`,icon:(0,Z.jsx)(HQ,{}),label:(0,Z.jsx)(dn,{to:`/companies`,children:`Companies`})},{key:`/notes`,icon:(0,Z.jsx)(rB,{}),label:(0,Z.jsx)(dn,{to:`/notes`,children:`Notes`})},{key:`/settings`,icon:(0,Z.jsx)(zQ,{}),label:(0,Z.jsx)(dn,{to:`/settings`,children:`Settings`})}],V5=[{key:`light`,icon:(0,Z.jsx)(GQ,{}),label:`Light`},{key:`dark`,icon:(0,Z.jsx)(wQ,{}),label:`Dark`}];function H5(){let[e,t]=(0,_.useState)(()=>{try{let e=localStorage.getItem(z5);if(e)return e===`dark`}catch{}return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1});(0,_.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`);try{localStorage.setItem(z5,e?`dark`:`light`)}catch{}},[e]);let n=qe(),r=(0,_.useMemo)(()=>{let e=B5.find(e=>n.pathname.startsWith(e.key));return e?[e.key]:[`/dashboard`]},[n.pathname]);return(0,Z.jsx)(Lh,{theme:o5(e?`dark`:`light`),children:(0,Z.jsx)(LC,{children:(0,Z.jsxs)(AV,{style:{minHeight:`100vh`},children:[(0,Z.jsxs)(AV.Header,{style:{display:`flex`,alignItems:`center`,gap:24,paddingInline:24,borderBottom:`1px solid ${a5.border}`,position:`sticky`,top:0,zIndex:10},children:[(0,Z.jsxs)($X.Title,{level:4,style:{margin:0,whiteSpace:`nowrap`},children:[`Job`,(0,Z.jsx)(`span`,{style:{color:a5.accent},children:`Track`})]}),(0,Z.jsx)(zk,{mode:`horizontal`,selectedKeys:r,items:B5,style:{flex:1,minWidth:0,borderBottom:`none`}}),(0,Z.jsx)(Bz,{trigger:[`click`],menu:{items:V5,selectable:!0,selectedKeys:[e?`dark`:`light`],onClick:({key:e})=>t(e===`dark`)},children:(0,Z.jsx)(Gk,{icon:e?(0,Z.jsx)(wQ,{}):(0,Z.jsx)(GQ,{}),"aria-label":`Theme settings`,children:`Theme`})})]}),(0,Z.jsx)(AV.Content,{style:{padding:24},children:(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(xt,{path:`/`,element:(0,Z.jsx)(bt,{to:`/dashboard`,replace:!0})}),(0,Z.jsx)(xt,{path:`/dashboard`,element:(0,Z.jsx)(f5,{})}),(0,Z.jsx)(xt,{path:`/applications`,element:(0,Z.jsx)(v5,{})}),(0,Z.jsx)(xt,{path:`/applications/:id`,element:(0,Z.jsx)(x5,{})}),(0,Z.jsx)(xt,{path:`/openings`,element:(0,Z.jsx)(A5,{})}),(0,Z.jsx)(xt,{path:`/companies`,element:(0,Z.jsx)(C5,{})}),(0,Z.jsx)(xt,{path:`/companies/:id`,element:(0,Z.jsx)(w5,{})}),(0,Z.jsx)(xt,{path:`/notes`,element:(0,Z.jsx)(T5,{})}),(0,Z.jsx)(xt,{path:`/settings`,element:(0,Z.jsx)(R5,{})}),(0,Z.jsx)(xt,{path:`*`,element:(0,Z.jsx)(bt,{to:`/dashboard`,replace:!0})})]})})]})})})}var U5=new Lr({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});(0,v.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(_.StrictMode,{children:(0,Z.jsx)(En,{client:U5,children:(0,Z.jsx)(un,{children:(0,Z.jsx)(H5,{})})})}));
|
|
446
|
-
//# sourceMappingURL=index-
|
|
445
|
+
Salary: SEK 55 000 - 70 000`,onChange:e=>c(e.target.value)}),(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,gap:12,wrap:!0,children:[(0,Z.jsx)($X.Text,{type:`secondary`,style:{fontSize:12},children:`Everything you paste is kept as the opening's note, so nothing is lost to a wrong guess.`}),(0,Z.jsx)(Gk,{loading:l,disabled:s.trim()===``,onClick:()=>void v(()=>_8.ingestText(s,a.trim()||void 0)),children:`Read`})]})]})}]}),d&&(0,Z.jsx)(Fp,{type:`warning`,showIcon:!0,message:d,style:{marginTop:12}}),y&&(0,Z.jsxs)(Rz,{direction:`vertical`,size:8,style:{width:`100%`,marginTop:16},children:[(0,Z.jsxs)($X.Text,{strong:!0,children:[y.jobTitle||`Untitled role`,y.companyName?` at ${y.companyName}`:``]}),(0,Z.jsx)($X.Text,{type:`secondary`,children:[y.location,y.sourceName].filter(Boolean).join(` · `)||`No location found`}),(0,Z.jsx)(t5,{check:p?.duplicate})]})]})}function z5(){let e=Xe(),{message:t}=LC.useApp(),[n,r]=(0,_.useState)(`active`),{data:i,isLoading:a}=B8(n===`archived`?{archived:!0}:{}),{data:o}=T8(),s=W8(),c=G8(),l=U8(),u=(0,_.useMemo)(()=>{let e=i?.openings??[];return n===`archived`?e.filter(e=>e.archived):e},[i,n]),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(void 0),[v,y]=(0,_.useState)(void 0),[b,x]=(0,_.useState)(null),[S]=JB.useForm();function C(e){x(e),S.setFieldsValue({appliedOn:(0,$k.default)(),status:`applied`,tags:[]})}async function w(n){if(b)try{let r=await c.mutateAsync({id:b.id,body:{appliedOn:n.appliedOn.format(`YYYY-MM-DD`),status:n.status,tags:n.tags??[]}});t.success(`Converted to an application`),x(null),e(`/applications/${r.id}`)}catch(e){t.error(e instanceof Error?e.message:`Could not convert`)}}async function T(e){try{await l.mutateAsync({id:e.id,body:{archived:!1}}),t.success(`Opening restored`)}catch(e){t.error(e instanceof Error?e.message:`Could not restore`)}}let E=[{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,i$[t.workMode]].filter(Boolean).join(` · `)||(0,Z.jsx)($X.Text,{type:`secondary`,children:`—`})},{title:`Source`,dataIndex:`sourceName`,render:e=>e??`—`}],D=e=>e.jobUrl&&(0,Z.jsx)(bD,{title:`Open job posting`,children:(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(xQ,{}),href:e.jobUrl,target:`_blank`,rel:`noreferrer`})}),O=e=>(0,Z.jsx)(GH,{title:`Delete this opening?`,description:`This removes it for good and cannot be undone.`,onConfirm:()=>s.mutate(e.id),okText:`Delete`,okButtonProps:{danger:!0},children:(0,Z.jsx)(Gk,{size:`small`,danger:!0,children:`Delete`})}),k=[...E,{title:``,key:`actions`,width:260,render:(e,t)=>(0,Z.jsxs)(Rz,{onClick:e=>e.stopPropagation(),children:[D(t),(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(ZB,{}),onClick:()=>C(t),children:`Convert`}),(0,Z.jsx)(Gk,{size:`small`,onClick:()=>{y(t),g(void 0),f(!0)},children:`Edit`}),O(t)]})}],A=[...E,{title:`Archived because`,key:`reason`,width:160,render:(e,t)=>t.convertedApplicationId?(0,Z.jsx)(dn,{to:`/applications/${t.convertedApplicationId}`,children:(0,Z.jsx)(MY,{color:`blue`,children:`Converted`})}):(0,Z.jsx)(MY,{children:`Archived by hand`})},{title:``,key:`actions`,width:220,render:(e,t)=>(0,Z.jsxs)(Rz,{onClick:e=>e.stopPropagation(),children:[D(t),(0,Z.jsx)(Gk,{size:`small`,icon:(0,Z.jsx)(NQ,{}),loading:l.isPending,onClick:()=>T(t),children:`Restore`}),O(t)]})}];return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(eB,{justify:`space-between`,align:`center`,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:0,children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Job openings`}),(0,Z.jsx)($X.Text,{type:`secondary`,children:n===`active`?`Saved for later — convert one to a real application when you're ready to apply.`:`Openings that were converted into an application or archived by hand.`})]}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{icon:(0,Z.jsx)(fQ,{}),onClick:()=>m(!0),children:`Save from posting`}),(0,Z.jsx)(Gk,{type:`primary`,icon:(0,Z.jsx)(fP,{}),onClick:()=>{y(void 0),g(void 0),f(!0)},children:`Save opening for later`})]})]}),(0,Z.jsx)(eL,{value:n,onChange:r,options:[{label:`Active`,value:`active`},{label:`Archived`,value:`archived`}]}),(0,Z.jsx)(wF,{size:`small`,children:(0,Z.jsx)(yY,{rowKey:`id`,columns:n===`archived`?A:k,dataSource:u,loading:a,pagination:!1,locale:{emptyText:(0,Z.jsx)($T,{image:$T.PRESENTED_IMAGE_SIMPLE,description:n===`active`?`Nothing saved yet — use “Save opening for later” for a role you're not ready to apply to.`:`No archived openings.`})}})}),(0,Z.jsx)(I5,{open:d,onClose:()=>{f(!1),g(void 0)},opening:v,draft:h}),(0,Z.jsx)(R5,{open:p,onClose:()=>m(!1),onUse:e=>{m(!1),y(void 0),g(e),f(!0)}}),(0,Z.jsx)(VH,{title:b?`Convert "${b.jobTitle}" at ${b.company.name}`:``,open:!!b,onCancel:()=>x(null),onOk:()=>S.submit(),okText:`Create application`,confirmLoading:c.isPending,children:(0,Z.jsxs)(JB,{form:S,layout:`vertical`,onFinish:w,children:[(0,Z.jsx)(JB.Item,{name:`appliedOn`,label:`Applied on`,rules:[{required:!0}],children:(0,Z.jsx)(KR,{style:{width:`100%`},format:`YYYY-MM-DD`})}),(0,Z.jsx)(JB.Item,{name:`status`,label:`Status`,children:(0,Z.jsx)(AE,{options:QQ.map(e=>({value:e,label:n$[e]}))})}),(0,Z.jsx)(JB.Item,{name:`tags`,label:`Tags`,children:(0,Z.jsx)(AE,{mode:`tags`,options:(o?.tags??[]).map(e=>({value:e.name,label:e.name})),placeholder:`fintech, remote-ok…`,tokenSeparators:[`,`]})})]})})]})}var B5={companies:`Companies`,applications:`Applications`,tags:`Tags`,tagLinks:`Tag links`,notes:`Notes`,statusEvents:`Status events`,jobOpenings:`Job openings`};function V5({counts:e}){return(0,Z.jsx)(oz,{size:`small`,column:2,bordered:!0,children:Object.entries(e).map(([e,t])=>(0,Z.jsx)(oz.Item,{label:B5[e]??e,children:t},e))})}function H5(){let{message:e}=LC.useApp(),{data:t,isLoading:n}=K8(),r=q8(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{c.current&&clearInterval(c.current)},[]);function l(t){VH.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(()=>{_8.getDbTargets().then(()=>{c.current&&clearInterval(c.current),window.location.reload()}).catch(()=>{})},500)}})}if(o)return(0,Z.jsx)(wF,{title:`Database`,children:(0,Z.jsx)(UU,{icon:(0,Z.jsx)(DU,{spin:!0}),title:`Reconnecting…`,subTitle:`Waiting for the server to come back up.`})});let u=t?.targets??[];return(0,Z.jsx)(wF,{title:`Database`,loading:n,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsxs)($X.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)(oz,{size:`small`,column:1,bordered:!0,children:(0,Z.jsx)(oz.Item,{label:`Active target`,children:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(rQ,{}),t?.active,` (`,u.find(e=>e.name===t?.active)?.driver,`)`]})})}),u.length>1&&(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(AE,{style:{width:220},value:i??t?.active,options:u.map(e=>({value:e.name,label:`${e.name} (${e.driver})`})),onChange:a}),(0,Z.jsx)(Gk,{type:`primary`,disabled:!i||i===t?.active,loading:r.isPending,onClick:()=>i&&l(i),children:`Switch`})]})]})})}function U5(){let{message:e}=LC.useApp(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1);function p(){n(null),i(null),o(null),u(null)}function m(){p(),f(!1)}let h=e=>(n(e),u(null),c(!0),_8.previewBackup(e).then(i).catch(e=>u(e instanceof Error?e.message:`Could not read that file`)).finally(()=>c(!1)),!1);function g(){t&&VH.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 _8.commitBackup(t);o(e)}catch(t){e.error(t instanceof Error?t.message:`Restore failed`)}finally{c(!1)}}})}return(0,Z.jsxs)(wF,{title:`Backup & restore`,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)($X.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)(Gk,{icon:(0,Z.jsx)(rQ,{}),onClick:()=>{window.location.href=_8.backupExportUrl},children:`Export backup`}),(0,Z.jsx)(Gk,{onClick:()=>f(!0),children:`Restore from backup…`})]}),(0,Z.jsx)(VH,{title:`Restore from backup`,open:d,onCancel:m,width:600,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[!r&&!a&&(0,Z.jsxs)(GZ.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)(hQ,{})}),(0,Z.jsx)(`p`,{className:`ant-upload-text`,children:`Click or drag a JobTrack backup file (.jtbak) here`})]}),l&&(0,Z.jsx)(Fp,{type:`error`,showIcon:!0,message:l}),r&&!a&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($X.Text,{type:`secondary`,children:[`Backup taken `,new Date(r.exportedAt).toLocaleString(),`. Restoring will replace everything currently in the active database with:`]}),(0,Z.jsx)(V5,{counts:r.counts}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:p,children:`Choose a different file`}),(0,Z.jsx)(Gk,{type:`primary`,danger:!0,loading:s,onClick:g,children:`Restore`})]})]}),a&&(0,Z.jsx)(UU,{status:`success`,title:`Restore complete`,extra:(0,Z.jsxs)(Rz,{direction:`vertical`,style:{width:`100%`},children:[(0,Z.jsx)(V5,{counts:a.counts}),(0,Z.jsx)(Gk,{type:`primary`,onClick:()=>window.location.reload(),children:`Reload`})]})})]})})]})}var W5=`CLEAR`;function G5(){let{message:e}=LC.useApp(),{data:t,isLoading:n}=J8(),r=Y8(),i=X8(),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``);function l(){o(!1),c(``)}function u(){r.mutate(void 0,{onSuccess:()=>{e.success(`Database cleared`),l()},onError:t=>e.error(t instanceof Error?t.message:`Could not clear the database`)})}function d(){i.mutate(void 0,{onSuccess:t=>e.success(`Seeded ${t.applications} applications and ${t.companies} companies`),onError:t=>e.error(t instanceof Error?t.message:`Could not seed the database`)})}let f=t?.counts??{};return(0,Z.jsxs)(wF,{title:`Reset & demo data`,loading:n,children:[(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)($X.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)(V5,{counts:f}),(0,Z.jsxs)(Rz,{wrap:!0,children:[t?.empty&&(0,Z.jsx)(Gk,{type:`primary`,icon:(0,Z.jsx)(oQ,{}),loading:i.isPending,onClick:d,children:`Seed with demo data`}),(0,Z.jsx)(Gk,{danger:!0,disabled:t?.empty,onClick:()=>o(!0),children:`Clear database…`})]})]}),(0,Z.jsx)(VH,{title:`Clear the active database?`,open:a,onCancel:l,footer:null,destroyOnHidden:!0,children:(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(Fp,{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)(V5,{counts:f}),(0,Z.jsxs)($X.Text,{children:[`Type `,(0,Z.jsx)($X.Text,{code:!0,children:W5}),` to confirm.`]}),(0,Z.jsx)(xV,{value:s,onChange:e=>c(e.target.value),placeholder:W5,onPressEnter:()=>s===W5&&u()}),(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(Gk,{onClick:l,children:`Cancel`}),(0,Z.jsx)(Gk,{danger:!0,type:`primary`,disabled:s!==W5,loading:r.isPending,onClick:u,children:`Clear database`})]})]})})]})}function K5(){let{data:e,isLoading:t}=Z8(),n=e?`${e.name} ${e.version}`:``;return(0,Z.jsx)(wF,{title:`About`,loading:t,children:(0,Z.jsxs)(oz,{size:`small`,column:1,bordered:!0,children:[(0,Z.jsx)(oz.Item,{label:`Running`,children:(0,Z.jsxs)(Rz,{children:[(0,Z.jsx)(vQ,{}),(0,Z.jsxs)($X.Text,{copyable:{text:n},children:[(0,Z.jsx)(`code`,{children:e?.name}),` `,e?.version]})]})}),(0,Z.jsx)(oz.Item,{label:`Database driver`,children:e?.driver})]})})}function q5(){return(0,Z.jsxs)(Rz,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)($X.Title,{level:4,style:{margin:0},children:`Settings`}),(0,Z.jsx)(H5,{}),(0,Z.jsx)(U5,{}),(0,Z.jsx)(G5,{}),(0,Z.jsx)(K5,{})]})}var J5=`jobtrack.theme`,Y5=[{key:`/dashboard`,icon:(0,Z.jsx)(eQ,{}),label:(0,Z.jsx)(dn,{to:`/dashboard`,children:`Dashboard`})},{key:`/applications`,icon:(0,Z.jsx)(DQ,{}),label:(0,Z.jsx)(dn,{to:`/applications`,children:`Applications`})},{key:`/openings`,icon:(0,Z.jsx)(ZZ,{}),label:(0,Z.jsx)(dn,{to:`/openings`,children:`Openings`})},{key:`/companies`,icon:(0,Z.jsx)(HQ,{}),label:(0,Z.jsx)(dn,{to:`/companies`,children:`Companies`})},{key:`/notes`,icon:(0,Z.jsx)(rB,{}),label:(0,Z.jsx)(dn,{to:`/notes`,children:`Notes`})},{key:`/settings`,icon:(0,Z.jsx)(zQ,{}),label:(0,Z.jsx)(dn,{to:`/settings`,children:`Settings`})}],X5=[{key:`light`,icon:(0,Z.jsx)(GQ,{}),label:`Light`},{key:`dark`,icon:(0,Z.jsx)(wQ,{}),label:`Dark`}];function Z5(){let[e,t]=(0,_.useState)(()=>{try{let e=localStorage.getItem(J5);if(e)return e===`dark`}catch{}return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1});(0,_.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`);try{localStorage.setItem(J5,e?`dark`:`light`)}catch{}},[e]);let n=qe(),r=(0,_.useMemo)(()=>{let e=Y5.find(e=>n.pathname.startsWith(e.key));return e?[e.key]:[`/dashboard`]},[n.pathname]);return(0,Z.jsx)(Lh,{theme:c5(e?`dark`:`light`),children:(0,Z.jsx)(LC,{children:(0,Z.jsxs)(AV,{style:{minHeight:`100vh`},children:[(0,Z.jsxs)(AV.Header,{style:{display:`flex`,alignItems:`center`,gap:24,paddingInline:24,borderBottom:`1px solid ${s5.border}`,position:`sticky`,top:0,zIndex:10},children:[(0,Z.jsxs)($X.Title,{level:4,style:{margin:0,whiteSpace:`nowrap`},children:[`Job`,(0,Z.jsx)(`span`,{style:{color:s5.accent},children:`Track`})]}),(0,Z.jsx)(zk,{mode:`horizontal`,selectedKeys:r,items:Y5,style:{flex:1,minWidth:0,borderBottom:`none`}}),(0,Z.jsx)(Bz,{trigger:[`click`],menu:{items:X5,selectable:!0,selectedKeys:[e?`dark`:`light`],onClick:({key:e})=>t(e===`dark`)},children:(0,Z.jsx)(Gk,{icon:e?(0,Z.jsx)(wQ,{}):(0,Z.jsx)(GQ,{}),"aria-label":`Theme settings`,children:`Theme`})})]}),(0,Z.jsx)(AV.Content,{style:{padding:24},children:(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(xt,{path:`/`,element:(0,Z.jsx)(bt,{to:`/dashboard`,replace:!0})}),(0,Z.jsx)(xt,{path:`/dashboard`,element:(0,Z.jsx)(m5,{})}),(0,Z.jsx)(xt,{path:`/applications`,element:(0,Z.jsx)(w5,{})}),(0,Z.jsx)(xt,{path:`/applications/duplicates`,element:(0,Z.jsx)(k5,{})}),(0,Z.jsx)(xt,{path:`/applications/:id`,element:(0,Z.jsx)(D5,{})}),(0,Z.jsx)(xt,{path:`/openings`,element:(0,Z.jsx)(z5,{})}),(0,Z.jsx)(xt,{path:`/companies`,element:(0,Z.jsx)(M5,{})}),(0,Z.jsx)(xt,{path:`/companies/:id`,element:(0,Z.jsx)(N5,{})}),(0,Z.jsx)(xt,{path:`/notes`,element:(0,Z.jsx)(P5,{})}),(0,Z.jsx)(xt,{path:`/settings`,element:(0,Z.jsx)(q5,{})}),(0,Z.jsx)(xt,{path:`*`,element:(0,Z.jsx)(bt,{to:`/dashboard`,replace:!0})})]})})]})})})}var Q5=new Lr({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});(0,v.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(_.StrictMode,{children:(0,Z.jsx)(En,{client:Q5,children:(0,Z.jsx)(un,{children:(0,Z.jsx)(Z5,{})})})}));
|
|
446
|
+
//# sourceMappingURL=index-eY39aBQj.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-eY39aBQj.js"></script>
|
|
22
22
|
<link rel="stylesheet" crossorigin href="/assets/index-CRnClsEb.css">
|
|
23
23
|
</head>
|
|
24
24
|
<body>
|