From 802fbd23e3d84f6a4e59a1714faf530c4e3d03f1 Mon Sep 17 00:00:00 2001 From: Admin Date: Thu, 14 Aug 2025 08:03:21 +0700 Subject: [PATCH] update delay pushlist time --- .../auto-listing-facebook-marketplace/content.js | 2 +- auto-listing-facebook-marketplace/src/content.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/auto-listing-facebook-marketplace/auto-listing-facebook-marketplace/content.js b/auto-listing-facebook-marketplace/auto-listing-facebook-marketplace/content.js index dfb5161..b5da055 100644 --- a/auto-listing-facebook-marketplace/auto-listing-facebook-marketplace/content.js +++ b/auto-listing-facebook-marketplace/auto-listing-facebook-marketplace/content.js @@ -3,4 +3,4 @@ function g(e){return new Promise(t=>setTimeout(t,e))}function ke(e,t){return fun `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const i=new this(t);return n.forEach(r=>i.set(r)),i}static accessor(t){const i=(this[Ee]=this[Ee]={accessors:{}}).accessors,r=this.prototype;function s(o){const d=q(o);i[d]||(un(r,o),i[d]=!0)}return a.isArray(t)?t.forEach(s):s(t),this}};C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(C.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[n]=i}}});a.freezeMethods(C);function re(e,t){const n=this||$,i=t||n,r=C.from(i.headers);let s=i.data;return a.forEach(e,function(d){s=d.call(n,s,r.normalize(),t?t.status:void 0)}),r.normalize(),s}function Ve(e){return!!(e&&e.__CANCEL__)}function I(e,t,n){v.call(this,e??"canceled",v.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(I,v,{__CANCEL__:!0});function Ke(e,t,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):t(new v("Request failed with status code "+n.status,[v.ERR_BAD_REQUEST,v.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function fn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function pn(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r=0,s=0,o;return t=t!==void 0?t:1e3,function(u){const c=Date.now(),l=i[s];o||(o=c),n[r]=u,i[r]=c;let p=s,w=0;for(;p!==r;)w+=n[p++],p=p%e;if(r=(r+1)%e,r===s&&(s=(s+1)%e),c-o{n=l,r=null,s&&(clearTimeout(s),s=null),e.apply(null,c)};return[(...c)=>{const l=Date.now(),p=l-n;p>=i?o(c,l):(r=c,s||(s=setTimeout(()=>{s=null,o(r)},i-p)))},()=>r&&o(r)]}const W=(e,t,n=3)=>{let i=0;const r=pn(50,250);return hn(s=>{const o=s.loaded,d=s.lengthComputable?s.total:void 0,u=o-i,c=r(u),l=o<=d;i=o;const p={loaded:o,total:d,progress:d?o/d:void 0,bytes:u,rate:c||void 0,estimated:c&&d&&l?(d-o)/c:void 0,event:s,lengthComputable:d!=null,[t?"download":"upload"]:!0};e(p)},n)},ge=(e,t)=>{const n=e!=null;return[i=>t[0]({lengthComputable:n,total:e,loaded:i}),t[1]]},Re=e=>(...t)=>a.asap(()=>e(...t)),vn=O.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,O.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(O.origin),O.navigator&&/(msie|trident)/i.test(O.navigator.userAgent)):()=>!0,mn=O.hasStandardBrowserEnv?{write(e,t,n,i,r,s){const o=[e+"="+encodeURIComponent(t)];a.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),a.isString(i)&&o.push("path="+i),a.isString(r)&&o.push("domain="+r),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function wn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function bn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function We(e,t,n){let i=!wn(t);return e&&(i||n==!1)?bn(e,t):t}const Se=e=>e instanceof C?{...e}:e;function D(e,t){t=t||{};const n={};function i(c,l,p,w){return a.isPlainObject(c)&&a.isPlainObject(l)?a.merge.call({caseless:w},c,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function r(c,l,p,w){if(a.isUndefined(l)){if(!a.isUndefined(c))return i(void 0,c,p,w)}else return i(c,l,p,w)}function s(c,l){if(!a.isUndefined(l))return i(void 0,l)}function o(c,l){if(a.isUndefined(l)){if(!a.isUndefined(c))return i(void 0,c)}else return i(void 0,l)}function d(c,l,p){if(p in t)return i(c,l);if(p in e)return i(void 0,c)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:d,headers:(c,l,p)=>r(Se(c),Se(l),p,!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(l){const p=u[l]||r,w=p(e[l],t[l],l);a.isUndefined(w)&&p!==d||(n[l]=w)}),n}const Xe=e=>{const t=D({},e);let{data:n,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:s,headers:o,auth:d}=t;t.headers=o=C.from(o),t.url=$e(We(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),d&&o.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):"")));let u;if(a.isFormData(n)){if(O.hasStandardBrowserEnv||O.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[c,...l]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...l].join("; "))}}if(O.hasStandardBrowserEnv&&(i&&a.isFunction(i)&&(i=i(t)),i||i!==!1&&vn(t.url))){const c=r&&s&&mn.read(s);c&&o.set(r,c)}return t},yn=typeof XMLHttpRequest<"u",En=yn&&function(e){return new Promise(function(n,i){const r=Xe(e);let s=r.data;const o=C.from(r.headers).normalize();let{responseType:d,onUploadProgress:u,onDownloadProgress:c}=r,l,p,w,R,f;function m(){R&&R(),f&&f(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function y(){if(!h)return;const T=C.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),_={data:!d||d==="text"||d==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:T,config:e,request:h};Ke(function(L){n(L),m()},function(L){i(L),m()},_),h=null}"onloadend"in h?h.onloadend=y:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(y)},h.onabort=function(){h&&(i(new v("Request aborted",v.ECONNABORTED,e,h)),h=null)},h.onerror=function(){i(new v("Network Error",v.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let N=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const _=r.transitional||ze;r.timeoutErrorMessage&&(N=r.timeoutErrorMessage),i(new v(N,_.clarifyTimeoutError?v.ETIMEDOUT:v.ECONNABORTED,e,h)),h=null},s===void 0&&o.setContentType(null),"setRequestHeader"in h&&a.forEach(o.toJSON(),function(N,_){h.setRequestHeader(_,N)}),a.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),d&&d!=="json"&&(h.responseType=r.responseType),c&&([w,f]=W(c,!0),h.addEventListener("progress",w)),u&&h.upload&&([p,R]=W(u),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",R)),(r.cancelToken||r.signal)&&(l=T=>{h&&(i(!T||T.type?new I(null,e,h):T),h.abort(),h=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const S=fn(r.url);if(S&&O.protocols.indexOf(S)===-1){i(new v("Unsupported protocol "+S+":",v.ERR_BAD_REQUEST,e));return}h.send(s||null)})},gn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let i=new AbortController,r;const s=function(c){if(!r){r=!0,d();const l=c instanceof Error?c:this.reason;i.abort(l instanceof v?l:new I(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,s(new v(`timeout ${t} of ms exceeded`,v.ETIMEDOUT))},t);const d=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:u}=i;return u.unsubscribe=()=>a.asap(d),u}},Rn=function*(e,t){let n=e.byteLength;if(n{const r=Sn(e,t);let s=0,o,d=u=>{o||(o=!0,i&&i(u))};return new ReadableStream({async pull(u){try{const{done:c,value:l}=await r.next();if(c){d(),u.close();return}let p=l.byteLength;if(n){let w=s+=p;n(w)}u.enqueue(new Uint8Array(l))}catch(c){throw d(c),c}},cancel(u){return d(u),r.return()}},{highWaterMark:2})},te=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ge=te&&typeof ReadableStream=="function",On=te&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Ze=(e,...t)=>{try{return!!e(...t)}catch{return!1}},An=Ge&&Ze(()=>{let e=!1;const t=new Request(O.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Oe=64*1024,ce=Ge&&Ze(()=>a.isReadableStream(new Response("").body)),X={stream:ce&&(e=>e.body)};te&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!X[t]&&(X[t]=a.isFunction(e[t])?n=>n[t]():(n,i)=>{throw new v(`Response type '${t}' is not supported`,v.ERR_NOT_SUPPORT,i)})})})(new Response);const _n=async e=>{if(e==null)return 0;if(a.isBlob(e))return e.size;if(a.isSpecCompliantForm(e))return(await new Request(O.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(a.isArrayBufferView(e)||a.isArrayBuffer(e))return e.byteLength;if(a.isURLSearchParams(e)&&(e=e+""),a.isString(e))return(await On(e)).byteLength},xn=async(e,t)=>{const n=a.toFiniteNumber(e.getContentLength());return n??_n(t)},Cn=te&&(async e=>{let{url:t,method:n,data:i,signal:r,cancelToken:s,timeout:o,onDownloadProgress:d,onUploadProgress:u,responseType:c,headers:l,withCredentials:p="same-origin",fetchOptions:w}=Xe(e);c=c?(c+"").toLowerCase():"text";let R=gn([r,s&&s.toAbortSignal()],o),f;const m=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let h;try{if(u&&An&&n!=="get"&&n!=="head"&&(h=await xn(l,i))!==0){let _=new Request(t,{method:"POST",body:i,duplex:"half"}),B;if(a.isFormData(i)&&(B=_.headers.get("content-type"))&&l.setContentType(B),_.body){const[L,z]=ge(h,W(Re(u)));i=Te(_.body,Oe,L,z)}}a.isString(p)||(p=p?"include":"omit");const y="credentials"in Request.prototype;f=new Request(t,{...w,signal:R,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:i,duplex:"half",credentials:y?p:void 0});let S=await fetch(f,w);const T=ce&&(c==="stream"||c==="response");if(ce&&(d||T&&m)){const _={};["status","statusText","headers"].forEach(ve=>{_[ve]=S[ve]});const B=a.toFiniteNumber(S.headers.get("content-length")),[L,z]=d&&ge(B,W(Re(d),!0))||[];S=new Response(Te(S.body,Oe,L,()=>{z&&z(),m&&m()}),_)}c=c||"text";let N=await X[a.findKey(X,c)||"text"](S,e);return!T&&m&&m(),await new Promise((_,B)=>{Ke(_,B,{data:N,headers:C.from(S.headers),status:S.status,statusText:S.statusText,config:e,request:f})})}catch(y){throw m&&m(),y&&y.name==="TypeError"&&/Load failed|fetch/i.test(y.message)?Object.assign(new v("Network Error",v.ERR_NETWORK,e,f),{cause:y.cause||y}):v.from(y,y&&y.code,e,f)}}),le={http:$t,xhr:En,fetch:Cn};a.forEach(le,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ae=e=>`- ${e}`,Pn=e=>a.isFunction(e)||e===null||e===!1,Qe={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let n,i;const r={};for(let s=0;s`adapter ${d} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since : `+s.map(Ae).join(` `):" "+Ae(s[0]):"as no adapter specified";throw new v("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i},adapters:le};function se(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new I(null,e)}function _e(e){return se(e),e.headers=C.from(e.headers),e.data=re.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Qe.getAdapter(e.adapter||$.adapter)(e).then(function(i){return se(e),i.data=re.call(e,e.transformResponse,i),i.headers=C.from(i.headers),i},function(i){return Ve(i)||(se(e),i&&i.response&&(i.response.data=re.call(e,e.transformResponse,i.response),i.response.headers=C.from(i.response.headers))),Promise.reject(i)})}const Ye="1.10.0",ne={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ne[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});const xe={};ne.transitional=function(t,n,i){function r(s,o){return"[Axios v"+Ye+"] Transitional option '"+s+"'"+o+(i?". "+i:"")}return(s,o,d)=>{if(t===!1)throw new v(r(o," has been removed"+(n?" in "+n:"")),v.ERR_DEPRECATED);return n&&!xe[o]&&(xe[o]=!0,console.warn(r(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,d):!0}};ne.spelling=function(t){return(n,i)=>(console.warn(`${i} is likely a misspelling of ${t}`),!0)};function kn(e,t,n){if(typeof e!="object")throw new v("options must be an object",v.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let r=i.length;for(;r-- >0;){const s=i[r],o=t[s];if(o){const d=e[s],u=d===void 0||o(d,s,e);if(u!==!0)throw new v("option "+s+" must be "+u,v.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new v("Unknown option "+s,v.ERR_BAD_OPTION)}}const K={assertOptions:kn,validators:ne},k=K.validators;let U=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ye,response:new ye}}async request(t,n){try{return await this._request(t,n)}catch(i){if(i instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const s=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?s&&!String(i.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(i.stack+=` -`+s):i.stack=s}catch{}}throw i}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=D(this.defaults,n);const{transitional:i,paramsSerializer:r,headers:s}=n;i!==void 0&&K.assertOptions(i,{silentJSONParsing:k.transitional(k.boolean),forcedJSONParsing:k.transitional(k.boolean),clarifyTimeoutError:k.transitional(k.boolean)},!1),r!=null&&(a.isFunction(r)?n.paramsSerializer={serialize:r}:K.assertOptions(r,{encode:k.function,serialize:k.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),K.assertOptions(n,{baseUrl:k.spelling("baseURL"),withXsrfToken:k.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&a.merge(s.common,s[n.method]);s&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete s[f]}),n.headers=C.concat(o,s);const d=[];let u=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(u=u&&m.synchronous,d.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let l,p=0,w;if(!u){const f=[_e.bind(this),void 0];for(f.unshift.apply(f,d),f.push.apply(f,c),w=f.length,l=Promise.resolve(n);p{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s;const o=new Promise(d=>{i.subscribe(d),s=d}).then(r);return o.cancel=function(){i.unsubscribe(s)},o},t(function(s,o,d){i.reason||(i.reason=new I(s,o,d),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=i=>{t.abort(i)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new et(function(r){t=r}),cancel:t}}};function Bn(e){return function(n){return e.apply(null,n)}}function Ln(e){return a.isObject(e)&&e.isAxiosError===!0}const ue={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ue).forEach(([e,t])=>{ue[t]=e});function tt(e){const t=new U(e),n=ke(U.prototype.request,t);return a.extend(n,U.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return tt(D(e,r))},n}const E=tt($);E.Axios=U;E.CanceledError=I;E.CancelToken=Nn;E.isCancel=Ve;E.VERSION=Ye;E.toFormData=ee;E.AxiosError=v;E.Cancel=E.CanceledError;E.all=function(t){return Promise.all(t)};E.spread=Bn;E.isAxiosError=Ln;E.mergeConfig=D;E.AxiosHeaders=C;E.formToJSON=e=>Je(a.isHTMLForm(e)?new FormData(e):e);E.getAdapter=Qe.getAdapter;E.HttpStatusCode=ue;E.default=E;const{Axios:Vn,AxiosError:Kn,CanceledError:Wn,isCancel:Xn,CancelToken:Gn,VERSION:Zn,all:Qn,Cancel:Yn,isAxiosError:ei,spread:ti,toFormData:ni,AxiosHeaders:ii,HttpStatusCode:ri,formToJSON:si,getAdapter:oi,mergeConfig:ai}=E,nt=E.create({baseURL:"http://localhost:4000/api/v1",headers:{"Content-Type":"application/json"}});class Fn{base64ToFile(t,n,i){const r=t.includes(",")?t.split(",")[1]:t,s=atob(r),o=new ArrayBuffer(s.length),d=new Uint8Array(o);for(let c=0;c{let o=0,d=!1;const u=()=>{const c=document.evaluate(d&&r?r:t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;if(c instanceof HTMLElement){s(c);return}o++,o{const o=new FileReader;o.onloadend=()=>{typeof o.result=="string"?r(o.result.split(",")[1]):s("Không thể đọc dữ liệu ảnh")},o.onerror=s,o.readAsDataURL(i)})}getImageExtension(t){try{const i=new URL(t).pathname.match(/\.([a-zA-Z0-9]+)$/);return i?i[1].toLowerCase():null}catch{const r=t.split("?")[0].match(/\.([a-zA-Z0-9]+)$/);return r?r[1].toLowerCase():null}}imageLocalToBase64(t){return new Promise((n,i)=>{try{const r=chrome.runtime.getURL(`${t}`);fetch(r).then(s=>s.blob()).then(s=>{const o=new FileReader;o.onloadend=()=>n(o.result),o.onerror=i,o.readAsDataURL(s)}).catch(i)}catch(r){i(r)}})}scrollToElement(t,n="smooth"){t&&t.scrollIntoView({behavior:n,block:"center",inline:"nearest"})}getElementPointCoores(t){if(!t)return null;const n=t.getBoundingClientRect(),i=n.left+n.width/2,r=n.top+n.height/2;return{x:i,y:r}}setInputValue(t,n){t&&(t.value=n,t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))}writeToInput=async(t,n,i)=>{const r=await this.getElementByXPath(n,{xpathFallback:i});if(!r)throw new Error("Xpath is not found with value: "+t);this.scrollToElement(r),this.clickByPoint(r),this.setInputValue(r,t)};pressEnter(t){if(!t)throw new Error("Textarea not found:",t);t.focus(),["keydown","keypress","keyup"].forEach(n=>{t.dispatchEvent(new KeyboardEvent(n,{key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0}))})}}const b=new Fn,A={file__image_input:'input[type="file"]',title_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[2]/div[1]/div[2]/div/div/div[5]/div/div/div/label/div/input",price_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[6]/div/div/div/label/div/input",brand_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[2]/div/div/div/label/div/input",brand_input_fallback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[2]/div/div/div/label/div/input",description_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[3]/div/div/div/label/div/div/textarea",description_input_falback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[3]/div/div/div/label/div/div/textarea",sku_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[6]/div/div/div[1]/label/div/input",sku_input_fallback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[6]/div/div/div[1]/label/div/input",category_select:{wraper:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[7]/div/div/div/div",container:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[2]/div/div/div[1]/div[1]/div/div/div/div/div/span/div"},condition_select:{wraper:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[8]/div/div/div/div",container:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[2]/div/div/div[1]/div[1]/div/div/div/div/div[1]/div"},tags_input:{input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[5]/div/div/div/div[1]/label/div/div/div[2]/div/textarea",input_falback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[5]/div/div/div/div[1]/label/div/div/div[2]/div/textarea"},location_select:{input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[7]/div/div/div/div/div/div/div/div/label/div[2]/input",input_fallback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[7]/div/div/div/div/div/div/div/div/label/div[2]/input",wraper:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[7]/div/div/div/div/div/div/div/div",container:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[2]/div/div/div[1]/div[1]/div/ul",container_fallback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[2]/div/div/div[1]/div[1]/div/ul"},next_btn:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[5]/div/div/div",publish_btn:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[4]/div[2]/div/div"},Un=async e=>{const t=new DataTransfer;for(const i of e.images){const r=await b.imageUrlToBase64(i);console.log("Base64:",i.slice(0,50)+"...");const s=b.base64ToFile(r,e.sku,b.getImageExtension(i)||"jpg");t.items.add(s)}const n=document.querySelector(A.file__image_input);n?(n.files=t.files,n.dispatchEvent(new Event("change",{bubbles:!0}))):console.error("Không tìm thấy input[type='file']")},Ce=async(e,t)=>{const n=await b.getElementByXPath(t.wraper);if(!n)throw new Error("Wrapper xpath not found");b.scrollToElement(n),b.clickByPoint(n),await g(200);const i=await b.getElementByXPath(t.container);if(!i)throw new Error("Container xpath not found");const r=Array.from(i.children).find(s=>s.textContent?.trim().toLocaleLowerCase().replace(/–/g,"-").includes(e.toLocaleLowerCase()));if(!r)throw new Error(`No child found with text "${e}"`);b.scrollToElement(r),await g(200),b.clickByPoint(r)},Dn=async(e,{input:t,...n})=>{await b.writeToInput(e,t,n.input_fallback),await g(200);const i=await b.getElementByXPath(n.container,{xpathFallback:n.container_fallback});if(!i)throw new Error("Container xpath not found");b.scrollToElement(i);const r=Array.from(i.children).find(s=>s.textContent?.trim().toLocaleLowerCase().includes(e.toLocaleLowerCase()));if(!r)throw new Error(`No child found with text "${e}"`);b.scrollToElement(r),await g(200),b.clickByPoint(r)},jn=async(e,t)=>{const n=await b.getElementByXPath(t.input,{xpathFallback:t?.input_falback});if(!n)throw new Error("Input is not found");b.scrollToElement(n),await g(200);for(const i of e)await b.writeToInput(i,t.input,t?.input_falback),await g(200),b.pressEnter(n)},Pe=async(e,t)=>{const{data:n}=await nt({url:"products/publist-finish/"+e.id,method:"POST",data:t});return n},In=async()=>{const e=await b.getElementByXPath(A.next_btn);if(!e)throw new Error("Next button is not found");b.clickByPoint(e)},qn=async()=>{const e=await b.getElementByXPath(A.publish_btn);if(!e)throw new Error("Publist button is not found");b.clickByPoint(e)},it=async e=>(console.log({item:e}),await g(1e3),await Un(e),await g(200),b.writeToInput(e.title,A.title_input),await g(200),b.writeToInput(String(e.price),A.price_input),await g(200),await Ce(e.category,A.category_select),await g(200),await Ce(e.condition,A.condition_select),e.brand&&(await g(200),await b.writeToInput(e.brand,A.brand_input,A.brand_input_fallback)),await g(200),await b.writeToInput(e.description,A.description_input,A.description_input_falback),await g(200),await jn(e.tags,A.tags_input),await g(200),await b.writeToInput(e.sku,A.sku_input,A.sku_input_fallback),e?.location&&(await g(200),await Dn(e.location,A.location_select)),await g(200),await In(),await g(200),await qn(),!0),Mn=async e=>{chrome.runtime.sendMessage({type:"close-tab",payload:e})},Hn=chrome.runtime.connect();Hn.onMessage.addListener(async e=>{if(e.type==="publist-event"){const t=e.payload;if(!t)return;console.log("Received new product event:",t);try{await g(500),await it(t)}catch(n){await Pe(t,{error:n.message,published:!1})}finally{await Pe(t,{published:!0}),await g(2e3),await Mn(t)}}});async function $n(){const{data:e}=await nt.get("products/27");if(!e.data)return;const t=e.data;await it(t)}$n(); +`+s):i.stack=s}catch{}}throw i}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=D(this.defaults,n);const{transitional:i,paramsSerializer:r,headers:s}=n;i!==void 0&&K.assertOptions(i,{silentJSONParsing:k.transitional(k.boolean),forcedJSONParsing:k.transitional(k.boolean),clarifyTimeoutError:k.transitional(k.boolean)},!1),r!=null&&(a.isFunction(r)?n.paramsSerializer={serialize:r}:K.assertOptions(r,{encode:k.function,serialize:k.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),K.assertOptions(n,{baseUrl:k.spelling("baseURL"),withXsrfToken:k.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&a.merge(s.common,s[n.method]);s&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete s[f]}),n.headers=C.concat(o,s);const d=[];let u=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(u=u&&m.synchronous,d.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let l,p=0,w;if(!u){const f=[_e.bind(this),void 0];for(f.unshift.apply(f,d),f.push.apply(f,c),w=f.length,l=Promise.resolve(n);p{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s;const o=new Promise(d=>{i.subscribe(d),s=d}).then(r);return o.cancel=function(){i.unsubscribe(s)},o},t(function(s,o,d){i.reason||(i.reason=new I(s,o,d),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=i=>{t.abort(i)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new et(function(r){t=r}),cancel:t}}};function Bn(e){return function(n){return e.apply(null,n)}}function Ln(e){return a.isObject(e)&&e.isAxiosError===!0}const ue={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ue).forEach(([e,t])=>{ue[t]=e});function tt(e){const t=new U(e),n=ke(U.prototype.request,t);return a.extend(n,U.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return tt(D(e,r))},n}const E=tt($);E.Axios=U;E.CanceledError=I;E.CancelToken=Nn;E.isCancel=Ve;E.VERSION=Ye;E.toFormData=ee;E.AxiosError=v;E.Cancel=E.CanceledError;E.all=function(t){return Promise.all(t)};E.spread=Bn;E.isAxiosError=Ln;E.mergeConfig=D;E.AxiosHeaders=C;E.formToJSON=e=>Je(a.isHTMLForm(e)?new FormData(e):e);E.getAdapter=Qe.getAdapter;E.HttpStatusCode=ue;E.default=E;const{Axios:Vn,AxiosError:Kn,CanceledError:Wn,isCancel:Xn,CancelToken:Gn,VERSION:Zn,all:Qn,Cancel:Yn,isAxiosError:ei,spread:ti,toFormData:ni,AxiosHeaders:ii,HttpStatusCode:ri,formToJSON:si,getAdapter:oi,mergeConfig:ai}=E,nt=E.create({baseURL:"http://localhost:4000/api/v1",headers:{"Content-Type":"application/json"}});class Fn{base64ToFile(t,n,i){const r=t.includes(",")?t.split(",")[1]:t,s=atob(r),o=new ArrayBuffer(s.length),d=new Uint8Array(o);for(let c=0;c{let o=0,d=!1;const u=()=>{const c=document.evaluate(d&&r?r:t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;if(c instanceof HTMLElement){s(c);return}o++,o{const o=new FileReader;o.onloadend=()=>{typeof o.result=="string"?r(o.result.split(",")[1]):s("Không thể đọc dữ liệu ảnh")},o.onerror=s,o.readAsDataURL(i)})}getImageExtension(t){try{const i=new URL(t).pathname.match(/\.([a-zA-Z0-9]+)$/);return i?i[1].toLowerCase():null}catch{const r=t.split("?")[0].match(/\.([a-zA-Z0-9]+)$/);return r?r[1].toLowerCase():null}}imageLocalToBase64(t){return new Promise((n,i)=>{try{const r=chrome.runtime.getURL(`${t}`);fetch(r).then(s=>s.blob()).then(s=>{const o=new FileReader;o.onloadend=()=>n(o.result),o.onerror=i,o.readAsDataURL(s)}).catch(i)}catch(r){i(r)}})}scrollToElement(t,n="smooth"){t&&t.scrollIntoView({behavior:n,block:"center",inline:"nearest"})}getElementPointCoores(t){if(!t)return null;const n=t.getBoundingClientRect(),i=n.left+n.width/2,r=n.top+n.height/2;return{x:i,y:r}}setInputValue(t,n){t&&(t.value=n,t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))}writeToInput=async(t,n,i)=>{const r=await this.getElementByXPath(n,{xpathFallback:i});if(!r)throw new Error("Xpath is not found with value: "+t);this.scrollToElement(r),this.clickByPoint(r),this.setInputValue(r,t)};pressEnter(t){if(!t)throw new Error("Textarea not found:",t);t.focus(),["keydown","keypress","keyup"].forEach(n=>{t.dispatchEvent(new KeyboardEvent(n,{key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0}))})}}const b=new Fn,A={file__image_input:'input[type="file"]',title_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[2]/div[1]/div[2]/div/div/div[5]/div/div/div/label/div/input",price_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[6]/div/div/div/label/div/input",brand_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[2]/div/div/div/label/div/input",brand_input_fallback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[2]/div/div/div/label/div/input",description_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[3]/div/div/div/label/div/div/textarea",description_input_falback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[3]/div/div/div/label/div/div/textarea",sku_input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[6]/div/div/div[1]/label/div/input",sku_input_fallback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[6]/div/div/div[1]/label/div/input",category_select:{wraper:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[7]/div/div/div/div",container:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[2]/div/div/div[1]/div[1]/div/div/div/div/div/span/div"},condition_select:{wraper:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[8]/div/div/div/div",container:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[2]/div/div/div[1]/div[1]/div/div/div/div/div[1]/div"},tags_input:{input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[5]/div/div/div/div[1]/label/div/div/div[2]/div/textarea",input_falback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[5]/div/div/div/div[1]/label/div/div/div[2]/div/textarea"},location_select:{input:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[7]/div/div/div/div/div/div/div/div/label/div[2]/input",input_fallback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[10]/div/div/div[7]/div/div/div/div/div/div/div/div/label/div[2]/input",wraper:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div/div[9]/div/div/div[7]/div/div/div/div/div/div/div/div",container:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[2]/div/div/div[1]/div[1]/div/ul",container_fallback:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[2]/div/div/div[1]/div[1]/div/ul"},next_btn:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[5]/div/div/div",publish_btn:"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div/div[4]/div[2]/div/div"},Un=async e=>{const t=new DataTransfer;for(const i of e.images){const r=await b.imageUrlToBase64(i);console.log("Base64:",i.slice(0,50)+"...");const s=b.base64ToFile(r,e.sku,b.getImageExtension(i)||"jpg");t.items.add(s)}const n=document.querySelector(A.file__image_input);n?(n.files=t.files,n.dispatchEvent(new Event("change",{bubbles:!0}))):console.error("Không tìm thấy input[type='file']")},Ce=async(e,t)=>{const n=await b.getElementByXPath(t.wraper);if(!n)throw new Error("Wrapper xpath not found");b.scrollToElement(n),b.clickByPoint(n),await g(200);const i=await b.getElementByXPath(t.container);if(!i)throw new Error("Container xpath not found");const r=Array.from(i.children).find(s=>s.textContent?.trim().toLocaleLowerCase().replace(/–/g,"-").includes(e.toLocaleLowerCase()));if(!r)throw new Error(`No child found with text "${e}"`);b.scrollToElement(r),await g(200),b.clickByPoint(r)},Dn=async(e,{input:t,...n})=>{await b.writeToInput(e,t,n.input_fallback),await g(200);const i=await b.getElementByXPath(n.container,{xpathFallback:n.container_fallback});if(!i)throw new Error("Container xpath not found");b.scrollToElement(i);const r=Array.from(i.children).find(s=>s.textContent?.trim().toLocaleLowerCase().includes(e.toLocaleLowerCase()));if(!r)throw new Error(`No child found with text "${e}"`);b.scrollToElement(r),await g(200),b.clickByPoint(r)},jn=async(e,t)=>{const n=await b.getElementByXPath(t.input,{xpathFallback:t?.input_falback});if(!n)throw new Error("Input is not found");b.scrollToElement(n),await g(200);for(const i of e)await b.writeToInput(i,t.input,t?.input_falback),await g(200),b.pressEnter(n)},Pe=async(e,t)=>{const{data:n}=await nt({url:"products/publist-finish/"+e.id,method:"POST",data:t});return n},In=async()=>{const e=await b.getElementByXPath(A.next_btn);if(!e)throw new Error("Next button is not found");b.clickByPoint(e)},qn=async()=>{const e=await b.getElementByXPath(A.publish_btn);if(!e)throw new Error("Publist button is not found");b.clickByPoint(e)},it=async e=>(console.log({item:e}),await g(1e3),await Un(e),await g(200),b.writeToInput(e.title,A.title_input),await g(200),b.writeToInput(String(e.price),A.price_input),await g(200),await Ce(e.category,A.category_select),await g(200),await Ce(e.condition,A.condition_select),e.brand&&(await g(200),await b.writeToInput(e.brand,A.brand_input,A.brand_input_fallback)),await g(200),await b.writeToInput(e.description,A.description_input,A.description_input_falback),await g(200),await jn(e.tags,A.tags_input),await g(200),await b.writeToInput(e.sku,A.sku_input,A.sku_input_fallback),e?.location&&(await g(200),await Dn(e.location,A.location_select)),await g(200),await In(),await g(200),await qn(),!0),Mn=async e=>{chrome.runtime.sendMessage({type:"close-tab",payload:e})},Hn=chrome.runtime.connect();Hn.onMessage.addListener(async e=>{if(e.type==="publist-event"){const t=e.payload;if(!t)return;console.log("Received new product event:",t);try{await g(500),await it(t)}catch(n){await Pe(t,{error:n.message,published:!1})}finally{await Pe(t,{published:!0}),await g(5e3),await Mn(t)}}});async function $n(){const{data:e}=await nt.get("products/27");if(!e.data)return;const t=e.data;await it(t)}$n(); diff --git a/auto-listing-facebook-marketplace/src/content.ts b/auto-listing-facebook-marketplace/src/content.ts index 9bc60de..12d0c18 100644 --- a/auto-listing-facebook-marketplace/src/content.ts +++ b/auto-listing-facebook-marketplace/src/content.ts @@ -338,7 +338,7 @@ port.onMessage.addListener(async (message) => { } finally { await finistPublist(data, { published: true }); - await delay(2000); + await delay(5000); await closeTab(data); }