1import{Jt as e}from"./CLLDXjUq.js";import{t}from"./BRiNof1Z.js";import{t as n}from"./AMXocpBF.js";var r=`adeptads_signup_referrer`,i=`adeptads_signup_source_v1`,a=2592e3,o=`adeptads.ai`,s=[`utm_source`,`utm_medium`,`utm_campaign`];function c(e){if(!e||typeof e!=`object`)return{};let t=e,n={};for(let e of s){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=64&&!/[^a-z0-9_-]/.test(r)&&(n[e]=r)}let r=t.landing_path;return typeof r==`string`&&r.length<=512&&r.startsWith(`/`)&&!r.startsWith(`//`)&&!/[?#\\]/.test(r)&&[...r].every(e=>e.charCodeAt(0)>=32&&e.charCodeAt(0)!==127)&&(n.landing_path=r),n}function l(e){return e===o||e.endsWith(`.${o}`)}function u(e){if(!e)return``;let t=new URL(e);if(t.protocol!==`https:`&&t.protocol!==`http:`)throw Error(`Invalid signup referrer protocol`);return t.origin}function d(e){if(typeof document>`u`)return null;let t=document.cookie.split(`; `).find(t=>t.startsWith(`${e}=`));if(!t)return null;try{return JSON.parse(decodeURIComponent(t.slice(e.length+1)))}catch(e){return null}}function f(){let e=d(r);try{return typeof e==`string`?{referrer:u(e),source:{}}:!e||typeof e!=`object`||!(`referrer`in e)||typeof e.referrer!=`string`?null:{referrer:u(e.referrer),source:c(`source`in e?e.source:null)}}catch(e){return null}}function p(){var e,t;return(e=(t=f())==null?void 0:t.referrer)==null?null:e}function m(){var e,t;let n=c((e=d(i))==null?(t=f())==null?void 0:t.source:e);return Object.keys(n).length?n:null}function h(e,t){let n=l(window.location.hostname)?`; Domain=${o}`:``,r=window.location.protocol===`https:`?`; Secure`:``;document.cookie=`${e}=${encodeURIComponent(JSON.stringify(t))}; Path=/; Max-Age=${a}; SameSite=Lax${n}${r}`}function g(){var e,t;if(typeof window>`u`||window.location.pathname.startsWith(`/auth/oauth/`))return;let n=f(),a=new URLSearchParams(window.location.search),o=c(Object.fromEntries(s.map(e=>[e,a.get(e)]))),p=(e=m())==null?{}:e,g=``;try{let e=u(document.referrer);if(e){let t=new URL(e).hostname;t!==window.location.hostname&&!l(t)&&(g=e)}}catch(e){console.warn(`â ï¸ Could not parse signup referrer`)}if(!n||typeof d(r)!=`string`){var _;h(r,(_=n==null?void 0:n.referrer)==null?g:_)}let v=d(i)!==null;if(s.some(e=>p[e])||Object.keys(p).length&&!Object.keys(o).length){v||h(i,p);return}h(i,c({...o,landing_path:(t=p.landing_path)==null?window.location.pathname:t}))}function _(){let{api:r,rawFetch:i}=n(),a=e().public.apiUrl;return{async login(e,n,r){let o=new URLSearchParams;o.append(`username`,e),o.append(`password`,n);try{r&&o.append(`captcha_token`,r),t.info(`ð Sending login request to:`,`${a}/api/v1/auth/login`);let e=await i(`${a}/api/v1/auth/login`,{method:`POST`,body:o.toString(),headers:{"Content-Type":`application/x-www-form-urlencoded`}});if(!e||typeof e!=`object`)throw Error(`Invalid response format from login API`);return e}catch(e){var s;let n=e;throw t.error(`â Login API error:`,n.message||e),t.error(`â Error details:`,{name:n==null?void 0:n.name,message:n==null?void 0:n.message,response:n==null?void 0:n.response,data:n==null?void 0:n.data,cause:n==null?void 0:n.cause}),n!=null&&(s=n.message)!=null&&s.includes(`timeout`)?Error(`Login request timed out. Please check your network connection and API server.`,{cause:e}):e}},async register(e,n){return t.info(`â¶ï¸ [AuthAPI] Sending register request`,{traceId:n}),await r(`/auth/register`,{method:`POST`,body:{...e,registration_referrer:p(),registration_source:m()},retry:0,headers:n?{"X-Client-Trace-Id":n}:void 0})},async refreshToken(e,t){return await r(`/auth/refresh`,{method:`POST`,body:{refresh_token:e},timeout:t==null?void 0:t.timeout})},async getUserProfile(e){return await r(`/auth/me`,{timeout:e==null?void 0:e.timeout})},async requestPasswordReset(e){return await r(`/auth/reset-password/request`,{method:`POST`,body:{email:e}})},async confirmPasswordReset(e,t){return await r(`/auth/reset-password/confirm`,{method:`POST`,body:{token:e,new_password:t}})},async changePassword(e,t){return await r(`/auth/me/password`,{method:`PUT`,body:{current_password:e,new_password:t}})},async setInitialPassword(e){return await r(`/auth/me/set-password`,{method:`POST`,body:{new_password:e}})},async deleteAccount(){return await r(`/auth/me`,{method:`DELETE`})}}}export{m as i,g as n,p as r,_ as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.