1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9678],{83791:(e,t,r)=>{r.d(t,{LG:()=>s,O4:()=>o});var o=function(e){return e.INSUFFICIENT_CREDITS="insufficient_credits",e.NO_SUBSCRIPTION="no_subscription",e.PLUGIN_NOT_FOUND="plugin_not_found",e.PLUGIN_EXECUTION_FAILED="plugin_execution_failed",e.INVALID_PLUGIN_CONFIG="invalid_plugin_config",e.INVALID_CONNECTION="invalid_connection",e.INCOMPATIBLE_TYPES="incompatible_types",e.MISSING_REQUIRED_INPUT="missing_required_input",e.WORKFLOW_NOT_FOUND="workflow_not_found",e.NODE_NOT_FOUND="node_not_found",e.CYCLIC_DEPENDENCY="cyclic_dependency",e.RATE_LIMIT_EXCEEDED="rate_limit_exceeded",e.TIMEOUT="timeout",e.INTERNAL_SERVER_ERROR="internal_server_error",e.UNAUTHORIZED="unauthorized",e.FORBIDDEN="forbidden",e.UNKNOWN="unknown",e}({});class s extends Error{constructor(e){super(e.message),this.name="APIError",this.code=e.code,this.details=e.details,this.statusCode=e.statusCode}static fromResponse(e,t){var r;let o,i,n=e.status,a=null==t?void 0:t.details;if(422===n&&Array.isArray(null==t?void 0:t.detail))return o="invalid_plugin_config",new s({code:o,message:i=t.detail.map(e=>e.msg||e.message||JSON.stringify(e)).join(". ")||"Validation error",details:a={validation_errors:t.detail},statusCode:n});switch(i="string"==typeof(null==t||null==(r=t.error)?void 0:r.message)?t.error.message:"string"==typeof(null==t?void 0:t.detail)?t.detail:"string"==typeof(null==t?void 0:t.message)?t.message:"string"==typeof(null==t?void 0:t.error)?t.error:(null==t?void 0:t.detail)&&"object"==typeof t.detail?t.detail.msg||t.detail.message||JSON.stringify(t.detail):`Error ${n}: ${e.statusText||"Request failed"}`,n){case 400:case 413:o="invalid_plugin_config";break;case 401:o="unauthorized",i="Authentication required";break;case 402:o="insufficient_credits";break;case 403:o="forbidden",i="Access forbidden";break;case 404:o=i.toLowerCase().includes("workflow")?"workflow_not_found":i.toLowerCase().includes("node")?"node_not_found":i.toLowerCase().includes("plugin")?"plugin_not_found":"workflow_not_found";break;case 408:case 504:o="timeout",i="Request timed out. Please try again.";break;case 429:o="rate_limit_exceeded",i="Too many requests. Please wait before trying again.",a={...a,retry_after:e.headers.get("Retry-After")||"60"};break;case 500:o="internal_server_error",i="Server error. Please try again later.";break;case 503:o="internal_server_error",i="Service temporarily unavailable";break;default:o="unknown"}return new s({code:o,message:i,details:a,statusCode:n})}isRetryable(){return["timeout","rate_limit_exceeded","internal_server_error"].includes(this.code)}getRetryDelay(){var e;return"rate_limit_exceeded"===this.code&&(null==(e=this.details)?void 0:e.retry_after)?1e3*parseInt(this.details.retry_after):"timeout"===this.code?5e3:"internal_server_error"===this.code?3e3:1e3}}},89678:(e,t,r)=>{r.d(t,{uE:()=>u});var o=r(36489),s=r(83791),i=r(92727);let n=(0,i.hY)(),a=i.i3.timeout,l=i.i3.debug;class d{constructor(e=n,t=a){this.baseURL=e,this.timeout=t}async getSession(){try{let e=await fetch("/api/auth/session",{cache:"no-store"});if(!e.ok)return null;return e.json()}catch(e){return console.error("Failed to get session:",e),null}}async request(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0,i=""+e,n=`${this.baseURL}${i}
1`,a=await this.getSession();if(l){var d;console.log(`ð [API Client] Session state for ${i}:`,{hasSession:!!a,hasAccessToken:!!(null==a?void 0:a.accessToken),tokenType:null==a?void 0:a.tokenType,userEmail:null==a||null==(d=a.user)?void 0:d.email})}let u=r.signal;try{let e=AbortSignal.timeout(this.timeout);t=u&&"function"==typeof AbortSignal.any?AbortSignal.any([u,e]):e}catch(o){let e=new AbortController,r=setTimeout(()=>e.abort(),this.timeout);u&&u.addEventListener("abort",()=>{clearTimeout(r),e.abort()}),t=e.signal}let c={headers:{"Content-Type":"application/json",...(null==a?void 0:a.accessToken)&&{Authorization:`${a.tokenType||"Bearer"} ${a.accessToken}`},...r.headers},signal:t,...r};try{l&&(console.log(`ð API [${r.method||"GET"}] ${i}`),r.body&&console.log("\uD83D\uDCE4 Request body:",JSON.parse(r.body)));let t=await fetch(n,c);if(t.ok||await this.handleApiError(t,e),204===t.status||"0"===t.headers.get("content-length"))return l&&console.log(`â
API Success [${t.status}] ${i}: (no content)`),null;let s=await t.json();if(l&&console.log(`â
API Success [${t.status}] ${i}:`,s),o)try{return o.parse(s)}catch(t){l&&(console.error(`â Schema validation failed for ${e}:`,t),console.error("Received data:",s))}return s}catch(t){if(t instanceof Error&&"AbortError"===t.name||(l&&console.error(`â API Error [${e}]:`,t),t instanceof s.LG))throw t;if(t instanceof TypeError&&"Failed to fetch"===t.message)throw new s.LG({code:s.O4.INTERNAL_SERVER_ERROR,message:`ð Impossible de joindre l'API sur ${this.baseURL}. V\xe9rifiez votre connexion.`,statusCode:0});if(t instanceof Error&&"TimeoutError"===t.name)throw new s.LG({code:s.O4.TIMEOUT,message:`â° D\xe9lai d'attente d\xe9pass\xe9 (${this.timeout}ms). L'API ne r\xe9pond pas.`,statusCode:408});throw t}}async handleApiError(e,t){let r;try{r=await e.json()}catch{r={detail:`HTTP ${e.status}: ${e.statusText}`,status_code:e.status}}if(l&&console.error(`â API Error [${t}]:`,{status:e.status,data:r}),401===e.status&&(console.warn("\uD83D\uDEA8 401 Unauthorized - Session invalid or expired. Auto-logout triggered."),!window.location.pathname.startsWith("/auth"))){let e=`${window.location.origin}/auth/login?error=SessionExpired`;(0,o.signOut)({callbackUrl:e,redirect:!0}
1).catch(t=>{console.error("Failed to sign out:",t),window.location.href=e})}throw s.LG.fromResponse(e,r)}async get(e,t,r){return this.request(e,{method:"GET",signal:null==r?void 0:r.signal},t)}async post(e,t,r){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0,signal:null==r?void 0:r.signal},null==r?void 0:r.schema)}async postFormData(e,t,r){let o,i=""+e,n=`${this.baseURL}${i}`,a=await this.getSession(),d=null==r?void 0:r.signal;try{let e=AbortSignal.timeout(this.timeout);o=d&&"function"==typeof AbortSignal.any?AbortSignal.any([d,e]):e}catch(r){let e=new AbortController,t=setTimeout(()=>e.abort(),this.timeout);d&&d.addEventListener("abort",()=>{clearTimeout(t),e.abort()}),o=e.signal}let u={method:"POST",body:t,headers:{...(null==a?void 0:a.accessToken)&&{Authorization:`${a.tokenType||"Bearer"} ${a.accessToken}`}},signal:o};try{l&&console.log(`ð API [POST FormData] ${i}`);let t=await fetch(n,u);t.ok||await this.handleApiError(t,e);let r=await t.json();return l&&console.log(`â
API Success [${t.status}] ${i}:`,r),r}catch(t){if(l&&console.error(`â API Error [${e}]:`,t),t instanceof s.LG)throw t;if(t instanceof TypeError&&"Failed to fetch"===t.message)throw new s.LG({code:s.O4.INTERNAL_SERVER_ERROR,message:`ð Impossible de joindre l'API sur ${this.baseURL}. V\xe9rifiez votre connexion.`,statusCode:0});if(t instanceof Error&&("TimeoutError"===t.name||"AbortError"===t.name))throw new s.LG({code:s.O4.TIMEOUT,message:`â° D\xe9lai d'attente d\xe9pass\xe9 (${this.timeout}ms). L'API ne r\xe9pond pas.`,statusCode:408});throw t}}async put(e,t,r){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0,signal:null==r?void 0:r.signal},null==r?void 0:r.schema)}async patch(e,t,r){return this.request(e,{method:"PATCH",body:t?JSON.stringify(t):void 0,signal:null==r?void 0:r.signal},null==r?void 0:r.schema)}async delete(e,t){return this.request(e,{method:"DELETE",signal:null==t?void 0:t.signal},null==t?void 0:t.schema)}}let u=new d},92727:(e,t,r)=>{r.d(t,{hY:()=>o,i3:()=>s});let o=()=>"/api",s={get baseUrl(){return o()},timeout:parseInt("30000",10),retries:3,retryDelay:1e3,debug:!1}}}]);
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.