PageSourceSearch

https://enhancephoto.ai/_nuxt/BQtdwQZ9.js

js enhancephoto.ai collected 2026-10-05 11:58:04 UTC 2,606 bytes, 1 lines download raw bytes

1import{bN as T,bO as E,bi as p,bP as I,b2 as h}from"./DCl1RZj4.js";import{f as w,g as A,h as _}from"./BWgG2Omh.js";async function b(t,r,n,e=T.DEFAULT){let i=0;const u=Date.now(),f=new Promise((s,a)=>{setTimeout(()=>{a(new Error(`Polling timeout: task not completed within ${e.TIMEOUT}ms`))},e.TIMEOUT)}),c=new Promise(async(s,a)=>{for(;i<e.MAX_ATTEMPTS;)try{if(Date.now()-u>e.MAX_DURATION){a(new Error(`轮询达到最大持续时间:${e.MAX_DURATION}ms`));return}const P=await t(),o=r(P);if(o.completed)if(o.data!==void 0){s(o.data);return}else{a(new Error("轮询完成但未返回数据"));return}if(o.failed){const m=new Error(o.error||"Polling failed");o.data!==void 0&&(m.data=o.data),a(m);return}n&&o.progress!==void 0&&o.status&&n(o.progress,o.status,o.data),await new Promise(m=>setTimeout(m,e.INTERVAL)),i++}catch(l){if(i++,i>=e.MAX_ATTEMPTS){a(l);return}await new Promise(d=>setTimeout(d,e.INTERVAL))}a(new Error(`轮询达到最大尝试次数:${e.MAX_ATTEMPTS} 次`))});try{return await Promise.race([c,f])}catch(s){throw s}}function y(t){const r=T[t];return typeof r=="object"&&"INTERVAL"in r?r:T.DEFAULT}function N(t,r,n,e){const i=y(t);return b(r,n,e,i)}function g(t){return w(t)?"completed":A(t)?"failed":_(t)?"processing":"unknown"}function F(t){if(I(t.code)){if(t.result){const{status:f,progress:c=0}=t.result,s=g(f);return{completed:!1,failed:!1,progress:c,status:s,data:t}}return{completed:!1,failed:!1,progress:0,status:"processing",data:t}}if(!h(t.code))return{completed:!1,failed:!0,error:`API error: ${t.code} - ${JSON.stringify(t.message)}`,data:t};if(!t.result)return{completed:!1,failed:!0,error:"Response format error: missing result field"};const{status:r,progress:n=0,output_url:e,error_message:i}=t.result,u=g(r);return w(r)?!e||!Array.isArray(e)||e.length===0?{completed:!1,failed:!0,progress:n,status:u,error:"Task completed but no output image URL returned"}:{completed:!0,failed:!1,progress:100,status:u,data:t}:A(r)?{completed:!1,failed:!0,progress:n,status:u,error:i||"Task processing failed",data:t}:{completed:!1,failed:!1,progress:n,status:u,data:t}}function C(t){const{serviceName:r,pollingConfigKey:n}=t,e=E.SERVICES[r];if(!e)throw new Error(`Service ${r} not found in API_CONFIG`);async function i(c,s){const{$http:a}=p(),l=new FormData;return l.append("original_image_file",c),s(l),await a.post(e.CREATE_JOB,l,{headers:{"Content-Type":"multipart/form-data"}})}async function u(c){const{$http:s}=p(),a=`${e.GET_JOB}/${c}`;return await s.get(a)}async function f(c,s){return await N(n,()=>u(c),d=>F(d),s)}return{createJob:i,getJob:u,pollJob:f}}export{C as c};

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.