diff --git a/README.md b/README.md index bd4d879..1c8397f 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,5 @@ Command: ssh root@172.16.7.48 Password: Work1234 server folder: /root/facebook-publist-server/auto-post-marketplace-facebook/server + +Chỉnh sửa liên quan đến nội dung: @lib/ultils.ts diff --git a/components.json b/components.json index 73afbdb..3eef3f0 100644 --- a/components.json +++ b/components.json @@ -8,7 +8,7 @@ "css": "src/index.css", "baseColor": "neutral", "cssVariables": true, - "prefix": "" + "prefix": "tw" }, "aliases": { "components": "@/components", @@ -18,4 +18,4 @@ "hooks": "@/hooks" }, "iconLibrary": "lucide" -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index 31d1d2a..c2f628d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,11 +17,13 @@ "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-popover": "^1.1.15", "@radix-ui/react-progress": "^1.1.7", + "@radix-ui/react-scroll-area": "^1.2.10", "@radix-ui/react-select": "^2.2.6", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tabs": "^1.1.13", "@radix-ui/react-toggle": "^1.1.10", "@radix-ui/react-toggle-group": "^1.1.11", + "@radix-ui/react-tooltip": "^1.2.8", "@tailwindcss/vite": "^4.1.12", "@tanstack/react-query": "^5.85.5", "axios": "^1.11.0", @@ -31,11 +33,13 @@ "fs-extra": "^11.3.1", "lodash": "^4.17.21", "lucide-react": "^0.540.0", + "next-themes": "^0.4.6", "p-queue": "^8.1.0", "react": "^19.1.1", "react-day-picker": "^9.9.0", "react-dom": "^19.1.1", "react-hook-form": "^7.62.0", + "sonner": "^2.0.7", "tailwind-merge": "^3.3.1", "tailwindcss": "^4.1.12", "use-debounce": "^10.0.5", @@ -1449,6 +1453,37 @@ } } }, + "node_modules/@radix-ui/react-scroll-area": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/@radix-ui/react-scroll-area/-/react-scroll-area-1.2.10.tgz", + "integrity": "sha512-tAXIa1g3sM5CGpVT0uIbUx/U3Gs5N8T52IICuCtObaos1S8fzsrPXG5WObkQN3S6NVl6wKgPhAIiBGbWnvc97A==", + "license": "MIT", + "dependencies": { + "@radix-ui/number": "1.1.1", + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-select": { "version": "2.2.6", "resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.2.6.tgz", @@ -1594,6 +1629,40 @@ } } }, + "node_modules/@radix-ui/react-tooltip": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.2.8.tgz", + "integrity": "sha512-tY7sVt1yL9ozIxvmbtN5qtmH2krXcBCfjEiCgKGLqunJHvgvZG2Pcl2oQ3kbcZARb1BGEHdkLzcYGO8ynVlieg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-dismissable-layer": "1.1.11", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-popper": "1.2.8", + "@radix-ui/react-portal": "1.1.9", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3", + "@radix-ui/react-use-controllable-state": "1.2.2", + "@radix-ui/react-visually-hidden": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-use-callback-ref": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz", @@ -5329,6 +5398,16 @@ "dev": true, "license": "MIT" }, + "node_modules/next-themes": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.6.tgz", + "integrity": "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" + } + }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -6396,6 +6475,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/sonner": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz", + "integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==", + "license": "MIT", + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", + "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", diff --git a/package.json b/package.json index 2936ffc..8acb7e0 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,13 @@ "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-popover": "^1.1.15", "@radix-ui/react-progress": "^1.1.7", + "@radix-ui/react-scroll-area": "^1.2.10", "@radix-ui/react-select": "^2.2.6", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tabs": "^1.1.13", "@radix-ui/react-toggle": "^1.1.10", "@radix-ui/react-toggle-group": "^1.1.11", + "@radix-ui/react-tooltip": "^1.2.8", "@tailwindcss/vite": "^4.1.12", "@tanstack/react-query": "^5.85.5", "axios": "^1.11.0", @@ -39,11 +41,13 @@ "fs-extra": "^11.3.1", "lodash": "^4.17.21", "lucide-react": "^0.540.0", + "next-themes": "^0.4.6", "p-queue": "^8.1.0", "react": "^19.1.1", "react-day-picker": "^9.9.0", "react-dom": "^19.1.1", "react-hook-form": "^7.62.0", + "sonner": "^2.0.7", "tailwind-merge": "^3.3.1", "tailwindcss": "^4.1.12", "use-debounce": "^10.0.5", diff --git a/public/manifest.json b/public/manifest.json index 3c0dd83..a488000 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -28,7 +28,7 @@ "matches": ["https://www.facebook.com/*"] } ], - "permissions": ["tabs", "activeTab", "scripting"], + "permissions": ["tabs", "activeTab", "scripting", "storage"], "icons": { "16": "icons/16.png", "32": "icons/32.png", diff --git a/releases/auto-post-facebook-extensions_1.2/assets/app-DW8k92tM.js b/releases/auto-post-facebook-extensions_1.2/assets/app-DW8k92tM.js new file mode 100644 index 0000000..f6251fa --- /dev/null +++ b/releases/auto-post-facebook-extensions_1.2/assets/app-DW8k92tM.js @@ -0,0 +1 @@ +function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function s(e,t=[]){return Object.entries(e).reduce((r,[n,o])=>((o||t.includes(n))&&(r[n]=o),r),{})}function u(e){return new Promise(t=>setTimeout(t,e))}function l(e,t){const r=Math.floor(Math.random()*(t-e+1))+e;return u(r)}export{u as a,l as d,a as g,s as r}; diff --git a/releases/auto-post-facebook-extensions_1.2/assets/app-DrgD6EWn.js b/releases/auto-post-facebook-extensions_1.2/assets/app-DrgD6EWn.js new file mode 100644 index 0000000..f9b0582 --- /dev/null +++ b/releases/auto-post-facebook-extensions_1.2/assets/app-DrgD6EWn.js @@ -0,0 +1 @@ +function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}async function u(e){return fetch(e).then(t=>t.blob()).then(t=>new Promise((n,o)=>{const r=new FileReader;r.onloadend=()=>{typeof r.result=="string"?n(r.result):o("Failed to convert blob to base64")},r.onerror=o,r.readAsDataURL(t)}))}function l(e,t=[]){return Object.entries(e).reduce((n,[o,r])=>((r||t.includes(o))&&(n[o]=r),n),{})}function a(e){return new Promise(t=>setTimeout(t,e))}function d(e,t){const n=Math.floor(Math.random()*(t-e+1))+e;return a(n)}export{a,d,s as g,l as r,u}; diff --git a/releases/auto-post-facebook-extensions_1.2/assets/base64-Bxt0tHTb.js b/releases/auto-post-facebook-extensions_1.2/assets/base64-Bxt0tHTb.js new file mode 100644 index 0000000..bd1ce78 --- /dev/null +++ b/releases/auto-post-facebook-extensions_1.2/assets/base64-Bxt0tHTb.js @@ -0,0 +1 @@ +async function a(n){return fetch(n).then(o=>o.blob()).then(o=>new Promise((t,r)=>{const e=new FileReader;e.onloadend=()=>{typeof e.result=="string"?t(e.result):r("Failed to convert blob to base64")},e.onerror=r,e.readAsDataURL(o)}))}export{a as u}; diff --git a/releases/auto-post-facebook-extensions_1.2/assets/button-B2hFWPp4.js b/releases/auto-post-facebook-extensions_1.2/assets/button-B2hFWPp4.js new file mode 100644 index 0000000..4d878c2 --- /dev/null +++ b/releases/auto-post-facebook-extensions_1.2/assets/button-B2hFWPp4.js @@ -0,0 +1,58 @@ +import{g as Cm}from"./app-DW8k92tM.js";function X0(i,r){for(var s=0;sc[d]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var Yr={exports:{}},Xn={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var nm;function Q0(){if(nm)return Xn;nm=1;var i=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function s(c,d,m){var h=null;if(m!==void 0&&(h=""+m),d.key!==void 0&&(h=""+d.key),"key"in d){m={};for(var A in d)A!=="key"&&(m[A]=d[A])}else m=d;return d=m.ref,{$$typeof:i,type:c,key:h,ref:d!==void 0?d:null,props:m}}return Xn.Fragment=r,Xn.jsx=s,Xn.jsxs=s,Xn}var um;function V0(){return um||(um=1,Yr.exports=Q0()),Yr.exports}var kn=V0(),Gr={exports:{}},lt={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var im;function Z0(){if(im)return lt;im=1;var i=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),h=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),w=Symbol.iterator;function G(b){return b===null||typeof b!="object"?null:(b=w&&b[w]||b["@@iterator"],typeof b=="function"?b:null)}var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B=Object.assign,L={};function q(b,N,Y){this.props=b,this.context=N,this.refs=L,this.updater=Y||I}q.prototype.isReactComponent={},q.prototype.setState=function(b,N){if(typeof b!="object"&&typeof b!="function"&&b!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,b,N,"setState")},q.prototype.forceUpdate=function(b){this.updater.enqueueForceUpdate(this,b,"forceUpdate")};function it(){}it.prototype=q.prototype;function st(b,N,Y){this.props=b,this.context=N,this.refs=L,this.updater=Y||I}var et=st.prototype=new it;et.constructor=st,B(et,q.prototype),et.isPureReactComponent=!0;var vt=Array.isArray,J={H:null,A:null,T:null,S:null,V:null},yt=Object.prototype.hasOwnProperty;function At(b,N,Y,H,X,ct){return Y=ct.ref,{$$typeof:i,type:b,key:N,ref:Y!==void 0?Y:null,props:ct}}function k(b,N){return At(b.type,N,void 0,void 0,void 0,b.props)}function _t(b){return typeof b=="object"&&b!==null&&b.$$typeof===i}function Le(b){var N={"=":"=0",":":"=2"};return"$"+b.replace(/[=:]/g,function(Y){return N[Y]})}var pe=/\/+/g;function wt(b,N){return typeof b=="object"&&b!==null&&b.key!=null?Le(""+b.key):N.toString(36)}function we(){}function _e(b){switch(b.status){case"fulfilled":return b.value;case"rejected":throw b.reason;default:switch(typeof b.status=="string"?b.then(we,we):(b.status="pending",b.then(function(N){b.status==="pending"&&(b.status="fulfilled",b.value=N)},function(N){b.status==="pending"&&(b.status="rejected",b.reason=N)})),b.status){case"fulfilled":return b.value;case"rejected":throw b.reason}}throw b}function Mt(b,N,Y,H,X){var ct=typeof b;(ct==="undefined"||ct==="boolean")&&(b=null);var P=!1;if(b===null)P=!0;else switch(ct){case"bigint":case"string":case"number":P=!0;break;case"object":switch(b.$$typeof){case i:case r:P=!0;break;case E:return P=b._init,Mt(P(b._payload),N,Y,H,X)}}if(P)return X=X(b),P=H===""?"."+wt(b,0):H,vt(X)?(Y="",P!=null&&(Y=P.replace(pe,"$&/")+"/"),Mt(X,N,Y,"",function(re){return re})):X!=null&&(_t(X)&&(X=k(X,Y+(X.key==null||b&&b.key===X.key?"":(""+X.key).replace(pe,"$&/")+"/")+P)),N.push(X)),1;P=0;var dt=H===""?".":H+":";if(vt(b))for(var Ot=0;Ot>>1,b=_[gt];if(0>>1;gtd(H,C))Xd(ct,H)?(_[gt]=ct,_[X]=C,gt=X):(_[gt]=H,_[Y]=C,gt=Y);else if(Xd(ct,C))_[gt]=ct,_[X]=C,gt=X;else break t}}return j}function d(_,j){var C=_.sortIndex-j.sortIndex;return C!==0?C:_.id-j.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;i.unstable_now=function(){return m.now()}}else{var h=Date,A=h.now();i.unstable_now=function(){return h.now()-A}}var O=[],g=[],E=1,w=null,G=3,I=!1,B=!1,L=!1,q=!1,it=typeof setTimeout=="function"?setTimeout:null,st=typeof clearTimeout=="function"?clearTimeout:null,et=typeof setImmediate<"u"?setImmediate:null;function vt(_){for(var j=s(g);j!==null;){if(j.callback===null)c(g);else if(j.startTime<=_)c(g),j.sortIndex=j.expirationTime,r(O,j);else break;j=s(g)}}function J(_){if(L=!1,vt(_),!B)if(s(O)!==null)B=!0,yt||(yt=!0,wt());else{var j=s(g);j!==null&&Mt(J,j.startTime-_)}}var yt=!1,At=-1,k=5,_t=-1;function Le(){return q?!0:!(i.unstable_now()-_t_&&Le());){var gt=w.callback;if(typeof gt=="function"){w.callback=null,G=w.priorityLevel;var b=gt(w.expirationTime<=_);if(_=i.unstable_now(),typeof b=="function"){w.callback=b,vt(_),j=!0;break e}w===s(O)&&c(O),vt(_)}else c(O);w=s(O)}if(w!==null)j=!0;else{var N=s(g);N!==null&&Mt(J,N.startTime-_),j=!1}}break t}finally{w=null,G=C,I=!1}j=void 0}}finally{j?wt():yt=!1}}}var wt;if(typeof et=="function")wt=function(){et(pe)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,_e=we.port2;we.port1.onmessage=pe,wt=function(){_e.postMessage(null)}}else wt=function(){it(pe,0)};function Mt(_,j){At=it(function(){_(i.unstable_now())},j)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(_){_.callback=null},i.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<_?Math.floor(1e3/_):5},i.unstable_getCurrentPriorityLevel=function(){return G},i.unstable_next=function(_){switch(G){case 1:case 2:case 3:var j=3;break;default:j=G}var C=G;G=j;try{return _()}finally{G=C}},i.unstable_requestPaint=function(){q=!0},i.unstable_runWithPriority=function(_,j){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var C=G;G=_;try{return j()}finally{G=C}},i.unstable_scheduleCallback=function(_,j,C){var gt=i.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0gt?(_.sortIndex=C,r(g,_),s(O)===null&&_===s(g)&&(L?(st(At),At=-1):L=!0,Mt(J,C-gt))):(_.sortIndex=b,r(O,_),B||I||(B=!0,yt||(yt=!0,wt()))),_},i.unstable_shouldYield=Le,i.unstable_wrapCallback=function(_){var j=G;return function(){var C=G;G=j;try{return _.apply(this,arguments)}finally{G=C}}}})(Qr)),Qr}var fm;function J0(){return fm||(fm=1,Xr.exports=K0()),Xr.exports}var Vr={exports:{}},Pt={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var sm;function W0(){if(sm)return Pt;sm=1;var i=uf();function r(O){var g="https://react.dev/errors/"+O;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(r){console.error(r)}}return i(),Vr.exports=W0(),Vr.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var dm;function F0(){if(dm)return Qn;dm=1;var i=J0(),r=uf(),s=$0();function c(t){var e="https://react.dev/errors/"+t;if(1b||(t.current=gt[b],gt[b]=null,b--)}function H(t,e){b++,gt[b]=t.current,t.current=e}var X=N(null),ct=N(null),P=N(null),dt=N(null);function Ot(t,e){switch(H(P,e),H(ct,t),H(X,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?Nd(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=Nd(e),t=wd(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Y(X),H(X,t)}function re(){Y(X),Y(ct),Y(P)}function nl(t){t.memoizedState!==null&&H(dt,t);var e=X.current,l=wd(e,t.type);e!==l&&(H(ct,t),H(X,l))}function ul(t){ct.current===t&&(Y(X),Y(ct)),dt.current===t&&(Y(dt),qn._currentValue=C)}var il=Object.prototype.hasOwnProperty,zi=i.unstable_scheduleCallback,xi=i.unstable_cancelCallback,Sh=i.unstable_shouldYield,Eh=i.unstable_requestPaint,Ce=i.unstable_now,Th=i.unstable_getCurrentPriorityLevel,of=i.unstable_ImmediatePriority,df=i.unstable_UserBlockingPriority,Pn=i.unstable_NormalPriority,Ah=i.unstable_LowPriority,mf=i.unstable_IdlePriority,Oh=i.log,Rh=i.unstable_setDisableYieldValue,Va=null,fe=null;function cl(t){if(typeof Oh=="function"&&Rh(t),fe&&typeof fe.setStrictMode=="function")try{fe.setStrictMode(Va,t)}catch{}}var se=Math.clz32?Math.clz32:_h,zh=Math.log,xh=Math.LN2;function _h(t){return t>>>=0,t===0?32:31-(zh(t)/xh|0)|0}var In=256,tu=4194304;function Nl(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function eu(t,e,l){var a=t.pendingLanes;if(a===0)return 0;var n=0,u=t.suspendedLanes,f=t.pingedLanes;t=t.warmLanes;var o=a&134217727;return o!==0?(a=o&~u,a!==0?n=Nl(a):(f&=o,f!==0?n=Nl(f):l||(l=o&~t,l!==0&&(n=Nl(l))))):(o=a&~u,o!==0?n=Nl(o):f!==0?n=Nl(f):l||(l=a&~t,l!==0&&(n=Nl(l)))),n===0?0:e!==0&&e!==n&&(e&u)===0&&(u=n&-n,l=e&-e,u>=l||u===32&&(l&4194048)!==0)?e:n}function Za(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function Mh(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hf(){var t=In;return In<<=1,(In&4194048)===0&&(In=256),t}function yf(){var t=tu;return tu<<=1,(tu&62914560)===0&&(tu=4194304),t}function _i(t){for(var e=[],l=0;31>l;l++)e.push(t);return e}function ka(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Dh(t,e,l,a,n,u){var f=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var o=t.entanglements,y=t.expirationTimes,T=t.hiddenUpdates;for(l=f&~l;0)":-1n||y[a]!==T[n]){var M=` +`+y[a].replace(" at new "," at ");return t.displayName&&M.includes("")&&(M=M.replace("",t.displayName)),M}while(1<=a&&0<=n);break}}}finally{Ci=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?ua(l):""}function Bh(t){switch(t.tag){case 26:case 27:case 5:return ua(t.type);case 16:return ua("Lazy");case 13:return ua("Suspense");case 19:return ua("SuspenseList");case 0:case 15:return Hi(t.type,!1);case 11:return Hi(t.type.render,!1);case 1:return Hi(t.type,!0);case 31:return ua("Activity");default:return""}}function Rf(t){try{var e="";do e+=Bh(t),t=t.return;while(t);return e}catch(l){return` +Error generating stack: `+l.message+` +`+l.stack}}function ve(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function zf(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function qh(t){var e=zf(t)?"checked":"value",l=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),a=""+t[e];if(!t.hasOwnProperty(e)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var n=l.get,u=l.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return n.call(this)},set:function(f){a=""+f,u.call(this,f)}}),Object.defineProperty(t,e,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(f){a=""+f},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function nu(t){t._valueTracker||(t._valueTracker=qh(t))}function xf(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var l=e.getValue(),a="";return t&&(a=zf(t)?t.checked?"true":"false":t.value),t=a,t!==l?(e.setValue(t),!0):!1}function uu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var jh=/[\n"\\]/g;function Se(t){return t.replace(jh,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Bi(t,e,l,a,n,u,f,o){t.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?t.type=f:t.removeAttribute("type"),e!=null?f==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+ve(e)):t.value!==""+ve(e)&&(t.value=""+ve(e)):f!=="submit"&&f!=="reset"||t.removeAttribute("value"),e!=null?qi(t,f,ve(e)):l!=null?qi(t,f,ve(l)):a!=null&&t.removeAttribute("value"),n==null&&u!=null&&(t.defaultChecked=!!u),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?t.name=""+ve(o):t.removeAttribute("name")}function _f(t,e,l,a,n,u,f,o){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),e!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||e!=null))return;l=l!=null?""+ve(l):"",e=e!=null?""+ve(e):l,o||e===t.value||(t.value=e),t.defaultValue=e}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=o?t.checked:!!a,t.defaultChecked=!!a,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(t.name=f)}function qi(t,e,l){e==="number"&&uu(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function ia(t,e,l,a){if(t=t.options,e){e={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xi=!1;if(Qe)try{var $a={};Object.defineProperty($a,"passive",{get:function(){Xi=!0}}),window.addEventListener("test",$a,$a),window.removeEventListener("test",$a,$a)}catch{Xi=!1}var fl=null,Qi=null,cu=null;function Hf(){if(cu)return cu;var t,e=Qi,l=e.length,a,n="value"in fl?fl.value:fl.textContent,u=n.length;for(t=0;t=Ia),Lf=" ",Xf=!1;function Qf(t,e){switch(t){case"keyup":return dy.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var sa=!1;function hy(t,e){switch(t){case"compositionend":return Vf(e);case"keypress":return e.which!==32?null:(Xf=!0,Lf);case"textInput":return t=e.data,t===Lf&&Xf?null:t;default:return null}}function yy(t,e){if(sa)return t==="compositionend"||!Ji&&Qf(t,e)?(t=Hf(),cu=Qi=fl=null,sa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:l,offset:e-t};t=a}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=Pf(l)}}function ts(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?ts(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function es(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=uu(t.document);e instanceof t.HTMLIFrameElement;){try{var l=typeof e.contentWindow.location.href=="string"}catch{l=!1}if(l)t=e.contentWindow;else break;e=uu(t.document)}return e}function Fi(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var Ay=Qe&&"documentMode"in document&&11>=document.documentMode,oa=null,Pi=null,an=null,Ii=!1;function ls(t,e,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ii||oa==null||oa!==uu(a)||(a=oa,"selectionStart"in a&&Fi(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),an&&ln(an,a)||(an=a,a=Fu(Pi,"onSelect"),0>=f,n-=f,Ze=1<<32-se(e)+n|l<u?u:8;var f=_.T,o={};_.T=o,jc(t,!1,e,l);try{var y=n(),T=_.S;if(T!==null&&T(o,y),y!==null&&typeof y=="object"&&typeof y.then=="function"){var M=Ny(y,a);vn(t,e,M,ge(t))}else vn(t,e,a,ge(t))}catch(U){vn(t,e,{then:function(){},status:"rejected",reason:U},ge())}finally{j.p=u,_.T=f}}function qy(){}function Bc(t,e,l,a){if(t.tag!==5)throw Error(c(476));var n=ao(t).queue;lo(t,n,e,C,l===null?qy:function(){return no(t),l(a)})}function ao(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:We,lastRenderedState:C},next:null};var l={};return e.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:We,lastRenderedState:l},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function no(t){var e=ao(t).next.queue;vn(t,e,{},ge())}function qc(){return Ft(qn)}function uo(){return jt().memoizedState}function io(){return jt().memoizedState}function jy(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var l=ge();t=dl(l);var a=ml(e,t,l);a!==null&&(be(a,e,l),mn(a,e,l)),e={cache:mc()},t.payload=e;return}e=e.return}}function Yy(t,e,l){var a=ge();l={lane:a,revertLane:0,action:l,hasEagerState:!1,eagerState:null,next:null},Uu(t)?ro(e,l):(l=ac(t,e,l,a),l!==null&&(be(l,t,a),fo(l,e,a)))}function co(t,e,l){var a=ge();vn(t,e,l,a)}function vn(t,e,l,a){var n={lane:a,revertLane:0,action:l,hasEagerState:!1,eagerState:null,next:null};if(Uu(t))ro(e,n);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=e.lastRenderedReducer,u!==null))try{var f=e.lastRenderedState,o=u(f,l);if(n.hasEagerState=!0,n.eagerState=o,oe(o,f))return hu(t,e,n,0),zt===null&&mu(),!1}catch{}finally{}if(l=ac(t,e,n,a),l!==null)return be(l,t,a),fo(l,e,a),!0}return!1}function jc(t,e,l,a){if(a={lane:2,revertLane:gr(),action:a,hasEagerState:!1,eagerState:null,next:null},Uu(t)){if(e)throw Error(c(479))}else e=ac(t,l,a,2),e!==null&&be(e,t,2)}function Uu(t){var e=t.alternate;return t===at||e!==null&&e===at}function ro(t,e){Ea=Ru=!0;var l=t.pending;l===null?e.next=e:(e.next=l.next,l.next=e),t.pending=e}function fo(t,e,l){if((l&4194048)!==0){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,bf(t,l)}}var Nu={readContext:Ft,use:xu,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct},so={readContext:Ft,use:xu,useCallback:function(t,e){return ae().memoizedState=[t,e===void 0?null:e],t},useContext:Ft,useEffect:Ks,useImperativeHandle:function(t,e,l){l=l!=null?l.concat([t]):null,Du(4194308,4,Fs.bind(null,e,t),l)},useLayoutEffect:function(t,e){return Du(4194308,4,t,e)},useInsertionEffect:function(t,e){Du(4,2,t,e)},useMemo:function(t,e){var l=ae();e=e===void 0?null:e;var a=t();if(Zl){cl(!0);try{t()}finally{cl(!1)}}return l.memoizedState=[a,e],a},useReducer:function(t,e,l){var a=ae();if(l!==void 0){var n=l(e);if(Zl){cl(!0);try{l(e)}finally{cl(!1)}}}else n=e;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=Yy.bind(null,at,t),[a.memoizedState,t]},useRef:function(t){var e=ae();return t={current:t},e.memoizedState=t},useState:function(t){t=Nc(t);var e=t.queue,l=co.bind(null,at,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:Cc,useDeferredValue:function(t,e){var l=ae();return Hc(l,t,e)},useTransition:function(){var t=Nc(!1);return t=lo.bind(null,at,t.queue,!0,!1),ae().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var a=at,n=ae();if(ht){if(l===void 0)throw Error(c(407));l=l()}else{if(l=e(),zt===null)throw Error(c(349));(ot&124)!==0||Us(a,e,l)}n.memoizedState=l;var u={value:l,getSnapshot:e};return n.queue=u,Ks(ws.bind(null,a,u,t),[t]),a.flags|=2048,Aa(9,Mu(),Ns.bind(null,a,u,l,e),null),l},useId:function(){var t=ae(),e=zt.identifierPrefix;if(ht){var l=ke,a=Ze;l=(a&~(1<<32-se(a)-1)).toString(32)+l,e="«"+e+"R"+l,l=zu++,0$?(Zt=K,K=null):Zt=K.sibling;var mt=R(v,K,S[$],D);if(mt===null){K===null&&(K=Zt);break}t&&K&&mt.alternate===null&&e(v,K),p=u(mt,p,$),ut===null?Q=mt:ut.sibling=mt,ut=mt,K=Zt}if($===S.length)return l(v,K),ht&&Yl(v,$),Q;if(K===null){for(;$$?(Zt=K,K=null):Zt=K.sibling;var Dl=R(v,K,mt.value,D);if(Dl===null){K===null&&(K=Zt);break}t&&K&&Dl.alternate===null&&e(v,K),p=u(Dl,p,$),ut===null?Q=Dl:ut.sibling=Dl,ut=Dl,K=Zt}if(mt.done)return l(v,K),ht&&Yl(v,$),Q;if(K===null){for(;!mt.done;$++,mt=S.next())mt=U(v,mt.value,D),mt!==null&&(p=u(mt,p,$),ut===null?Q=mt:ut.sibling=mt,ut=mt);return ht&&Yl(v,$),Q}for(K=a(K);!mt.done;$++,mt=S.next())mt=z(K,v,$,mt.value,D),mt!==null&&(t&&mt.alternate!==null&&K.delete(mt.key===null?$:mt.key),p=u(mt,p,$),ut===null?Q=mt:ut.sibling=mt,ut=mt);return t&&K.forEach(function(L0){return e(v,L0)}),ht&&Yl(v,$),Q}function Tt(v,p,S,D){if(typeof S=="object"&&S!==null&&S.type===B&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case G:t:{for(var Q=S.key;p!==null;){if(p.key===Q){if(Q=S.type,Q===B){if(p.tag===7){l(v,p.sibling),D=n(p,S.props.children),D.return=v,v=D;break t}}else if(p.elementType===Q||typeof Q=="object"&&Q!==null&&Q.$$typeof===k&&mo(Q)===p.type){l(v,p.sibling),D=n(p,S.props),En(D,S),D.return=v,v=D;break t}l(v,p);break}else e(v,p);p=p.sibling}S.type===B?(D=ql(S.props.children,v.mode,D,S.key),D.return=v,v=D):(D=gu(S.type,S.key,S.props,null,v.mode,D),En(D,S),D.return=v,v=D)}return f(v);case I:t:{for(Q=S.key;p!==null;){if(p.key===Q)if(p.tag===4&&p.stateNode.containerInfo===S.containerInfo&&p.stateNode.implementation===S.implementation){l(v,p.sibling),D=n(p,S.children||[]),D.return=v,v=D;break t}else{l(v,p);break}else e(v,p);p=p.sibling}D=ic(S,v.mode,D),D.return=v,v=D}return f(v);case k:return Q=S._init,S=Q(S._payload),Tt(v,p,S,D)}if(Mt(S))return F(v,p,S,D);if(wt(S)){if(Q=wt(S),typeof Q!="function")throw Error(c(150));return S=Q.call(S),W(v,p,S,D)}if(typeof S.then=="function")return Tt(v,p,wu(S),D);if(S.$$typeof===et)return Tt(v,p,Su(v,S),D);Cu(v,S)}return typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint"?(S=""+S,p!==null&&p.tag===6?(l(v,p.sibling),D=n(p,S),D.return=v,v=D):(l(v,p),D=uc(S,v.mode,D),D.return=v,v=D),f(v)):l(v,p)}return function(v,p,S,D){try{Sn=0;var Q=Tt(v,p,S,D);return Oa=null,Q}catch(K){if(K===on||K===Tu)throw K;var ut=de(29,K,null,v.mode);return ut.lanes=D,ut.return=v,ut}finally{}}}var Ra=ho(!0),yo=ho(!1),Re=N(null),Be=null;function yl(t){var e=t.alternate;H(Gt,Gt.current&1),H(Re,t),Be===null&&(e===null||Sa.current!==null||e.memoizedState!==null)&&(Be=t)}function go(t){if(t.tag===22){if(H(Gt,Gt.current),H(Re,t),Be===null){var e=t.alternate;e!==null&&e.memoizedState!==null&&(Be=t)}}else gl()}function gl(){H(Gt,Gt.current),H(Re,Re.current)}function $e(t){Y(Re),Be===t&&(Be=null),Y(Gt)}var Gt=N(0);function Hu(t){for(var e=t;e!==null;){if(e.tag===13){var l=e.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||_r(l)))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}function Yc(t,e,l,a){e=t.memoizedState,l=l(a,e),l=l==null?e:E({},e,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var Gc={enqueueSetState:function(t,e,l){t=t._reactInternals;var a=ge(),n=dl(a);n.payload=e,l!=null&&(n.callback=l),e=ml(t,n,a),e!==null&&(be(e,t,a),mn(e,t,a))},enqueueReplaceState:function(t,e,l){t=t._reactInternals;var a=ge(),n=dl(a);n.tag=1,n.payload=e,l!=null&&(n.callback=l),e=ml(t,n,a),e!==null&&(be(e,t,a),mn(e,t,a))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var l=ge(),a=dl(l);a.tag=2,e!=null&&(a.callback=e),e=ml(t,a,l),e!==null&&(be(e,t,l),mn(e,t,l))}};function bo(t,e,l,a,n,u,f){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(a,u,f):e.prototype&&e.prototype.isPureReactComponent?!ln(l,a)||!ln(n,u):!0}function po(t,e,l,a){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(l,a),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(l,a),e.state!==t&&Gc.enqueueReplaceState(e,e.state,null)}function kl(t,e){var l=e;if("ref"in e){l={};for(var a in e)a!=="ref"&&(l[a]=e[a])}if(t=t.defaultProps){l===e&&(l=E({},l));for(var n in t)l[n]===void 0&&(l[n]=t[n])}return l}var Bu=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function vo(t){Bu(t)}function So(t){console.error(t)}function Eo(t){Bu(t)}function qu(t,e){try{var l=t.onUncaughtError;l(e.value,{componentStack:e.stack})}catch(a){setTimeout(function(){throw a})}}function To(t,e,l){try{var a=t.onCaughtError;a(l.value,{componentStack:l.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function Lc(t,e,l){return l=dl(l),l.tag=3,l.payload={element:null},l.callback=function(){qu(t,e)},l}function Ao(t){return t=dl(t),t.tag=3,t}function Oo(t,e,l,a){var n=l.type.getDerivedStateFromError;if(typeof n=="function"){var u=a.value;t.payload=function(){return n(u)},t.callback=function(){To(e,l,a)}}var f=l.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(t.callback=function(){To(e,l,a),typeof n!="function"&&(Tl===null?Tl=new Set([this]):Tl.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function Ly(t,e,l,a,n){if(l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(e=l.alternate,e!==null&&rn(e,l,n,!0),l=Re.current,l!==null){switch(l.tag){case 13:return Be===null?or():l.alternate===null&&Nt===0&&(Nt=3),l.flags&=-257,l.flags|=65536,l.lanes=n,a===gc?l.flags|=16384:(e=l.updateQueue,e===null?l.updateQueue=new Set([a]):e.add(a),mr(t,a,n)),!1;case 22:return l.flags|=65536,a===gc?l.flags|=16384:(e=l.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([a])},l.updateQueue=e):(l=e.retryQueue,l===null?e.retryQueue=new Set([a]):l.add(a)),mr(t,a,n)),!1}throw Error(c(435,l.tag))}return mr(t,a,n),or(),!1}if(ht)return e=Re.current,e!==null?((e.flags&65536)===0&&(e.flags|=256),e.flags|=65536,e.lanes=n,a!==fc&&(t=Error(c(422),{cause:a}),cn(Ee(t,l)))):(a!==fc&&(e=Error(c(423),{cause:a}),cn(Ee(e,l))),t=t.current.alternate,t.flags|=65536,n&=-n,t.lanes|=n,a=Ee(a,l),n=Lc(t.stateNode,a,n),vc(t,n),Nt!==4&&(Nt=2)),!1;var u=Error(c(520),{cause:a});if(u=Ee(u,l),_n===null?_n=[u]:_n.push(u),Nt!==4&&(Nt=2),e===null)return!0;a=Ee(a,l),l=e;do{switch(l.tag){case 3:return l.flags|=65536,t=n&-n,l.lanes|=t,t=Lc(l.stateNode,a,t),vc(l,t),!1;case 1:if(e=l.type,u=l.stateNode,(l.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Tl===null||!Tl.has(u))))return l.flags|=65536,n&=-n,l.lanes|=n,n=Ao(n),Oo(n,t,l,a),vc(l,n),!1}l=l.return}while(l!==null);return!1}var Ro=Error(c(461)),Qt=!1;function kt(t,e,l,a){e.child=t===null?yo(e,null,l,a):Ra(e,t.child,l,a)}function zo(t,e,l,a,n){l=l.render;var u=e.ref;if("ref"in a){var f={};for(var o in a)o!=="ref"&&(f[o]=a[o])}else f=a;return Ql(e),a=Oc(t,e,l,f,u,n),o=Rc(),t!==null&&!Qt?(zc(t,e,n),Fe(t,e,n)):(ht&&o&&cc(e),e.flags|=1,kt(t,e,a,n),e.child)}function xo(t,e,l,a,n){if(t===null){var u=l.type;return typeof u=="function"&&!nc(u)&&u.defaultProps===void 0&&l.compare===null?(e.tag=15,e.type=u,_o(t,e,u,a,n)):(t=gu(l.type,null,a,e,e.mode,n),t.ref=e.ref,t.return=e,e.child=t)}if(u=t.child,!Wc(t,n)){var f=u.memoizedProps;if(l=l.compare,l=l!==null?l:ln,l(f,a)&&t.ref===e.ref)return Fe(t,e,n)}return e.flags|=1,t=Ve(u,a),t.ref=e.ref,t.return=e,e.child=t}function _o(t,e,l,a,n){if(t!==null){var u=t.memoizedProps;if(ln(u,a)&&t.ref===e.ref)if(Qt=!1,e.pendingProps=a=u,Wc(t,n))(t.flags&131072)!==0&&(Qt=!0);else return e.lanes=t.lanes,Fe(t,e,n)}return Xc(t,e,l,a,n)}function Mo(t,e,l){var a=e.pendingProps,n=a.children,u=t!==null?t.memoizedState:null;if(a.mode==="hidden"){if((e.flags&128)!==0){if(a=u!==null?u.baseLanes|l:l,t!==null){for(n=e.child=t.child,u=0;n!==null;)u=u|n.lanes|n.childLanes,n=n.sibling;e.childLanes=u&~a}else e.childLanes=0,e.child=null;return Do(t,e,a,l)}if((l&536870912)!==0)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&Eu(e,u!==null?u.cachePool:null),u!==null?xs(e,u):Ec(),go(e);else return e.lanes=e.childLanes=536870912,Do(t,e,u!==null?u.baseLanes|l:l,l)}else u!==null?(Eu(e,u.cachePool),xs(e,u),gl(),e.memoizedState=null):(t!==null&&Eu(e,null),Ec(),gl());return kt(t,e,n,l),e.child}function Do(t,e,l,a){var n=yc();return n=n===null?null:{parent:Yt._currentValue,pool:n},e.memoizedState={baseLanes:l,cachePool:n},t!==null&&Eu(e,null),Ec(),go(e),t!==null&&rn(t,e,a,!0),null}function ju(t,e){var l=e.ref;if(l===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(c(284));(t===null||t.ref!==l)&&(e.flags|=4194816)}}function Xc(t,e,l,a,n){return Ql(e),l=Oc(t,e,l,a,void 0,n),a=Rc(),t!==null&&!Qt?(zc(t,e,n),Fe(t,e,n)):(ht&&a&&cc(e),e.flags|=1,kt(t,e,l,n),e.child)}function Uo(t,e,l,a,n,u){return Ql(e),e.updateQueue=null,l=Ms(e,a,l,n),_s(t),a=Rc(),t!==null&&!Qt?(zc(t,e,u),Fe(t,e,u)):(ht&&a&&cc(e),e.flags|=1,kt(t,e,l,u),e.child)}function No(t,e,l,a,n){if(Ql(e),e.stateNode===null){var u=ya,f=l.contextType;typeof f=="object"&&f!==null&&(u=Ft(f)),u=new l(a,u),e.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Gc,e.stateNode=u,u._reactInternals=e,u=e.stateNode,u.props=a,u.state=e.memoizedState,u.refs={},bc(e),f=l.contextType,u.context=typeof f=="object"&&f!==null?Ft(f):ya,u.state=e.memoizedState,f=l.getDerivedStateFromProps,typeof f=="function"&&(Yc(e,l,f,a),u.state=e.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(f=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),f!==u.state&&Gc.enqueueReplaceState(u,u.state,null),yn(e,a,u,n),hn(),u.state=e.memoizedState),typeof u.componentDidMount=="function"&&(e.flags|=4194308),a=!0}else if(t===null){u=e.stateNode;var o=e.memoizedProps,y=kl(l,o);u.props=y;var T=u.context,M=l.contextType;f=ya,typeof M=="object"&&M!==null&&(f=Ft(M));var U=l.getDerivedStateFromProps;M=typeof U=="function"||typeof u.getSnapshotBeforeUpdate=="function",o=e.pendingProps!==o,M||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(o||T!==f)&&po(e,u,a,f),ol=!1;var R=e.memoizedState;u.state=R,yn(e,a,u,n),hn(),T=e.memoizedState,o||R!==T||ol?(typeof U=="function"&&(Yc(e,l,U,a),T=e.memoizedState),(y=ol||bo(e,l,y,a,R,T,f))?(M||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(e.flags|=4194308)):(typeof u.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=a,e.memoizedState=T),u.props=a,u.state=T,u.context=f,a=y):(typeof u.componentDidMount=="function"&&(e.flags|=4194308),a=!1)}else{u=e.stateNode,pc(t,e),f=e.memoizedProps,M=kl(l,f),u.props=M,U=e.pendingProps,R=u.context,T=l.contextType,y=ya,typeof T=="object"&&T!==null&&(y=Ft(T)),o=l.getDerivedStateFromProps,(T=typeof o=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(f!==U||R!==y)&&po(e,u,a,y),ol=!1,R=e.memoizedState,u.state=R,yn(e,a,u,n),hn();var z=e.memoizedState;f!==U||R!==z||ol||t!==null&&t.dependencies!==null&&vu(t.dependencies)?(typeof o=="function"&&(Yc(e,l,o,a),z=e.memoizedState),(M=ol||bo(e,l,M,a,R,z,y)||t!==null&&t.dependencies!==null&&vu(t.dependencies))?(T||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(a,z,y),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(a,z,y)),typeof u.componentDidUpdate=="function"&&(e.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof u.componentDidUpdate!="function"||f===t.memoizedProps&&R===t.memoizedState||(e.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===t.memoizedProps&&R===t.memoizedState||(e.flags|=1024),e.memoizedProps=a,e.memoizedState=z),u.props=a,u.state=z,u.context=y,a=M):(typeof u.componentDidUpdate!="function"||f===t.memoizedProps&&R===t.memoizedState||(e.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===t.memoizedProps&&R===t.memoizedState||(e.flags|=1024),a=!1)}return u=a,ju(t,e),a=(e.flags&128)!==0,u||a?(u=e.stateNode,l=a&&typeof l.getDerivedStateFromError!="function"?null:u.render(),e.flags|=1,t!==null&&a?(e.child=Ra(e,t.child,null,n),e.child=Ra(e,null,l,n)):kt(t,e,l,n),e.memoizedState=u.state,t=e.child):t=Fe(t,e,n),t}function wo(t,e,l,a){return un(),e.flags|=256,kt(t,e,l,a),e.child}var Qc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vc(t){return{baseLanes:t,cachePool:vs()}}function Zc(t,e,l){return t=t!==null?t.childLanes&~l:0,e&&(t|=ze),t}function Co(t,e,l){var a=e.pendingProps,n=!1,u=(e.flags&128)!==0,f;if((f=u)||(f=t!==null&&t.memoizedState===null?!1:(Gt.current&2)!==0),f&&(n=!0,e.flags&=-129),f=(e.flags&32)!==0,e.flags&=-33,t===null){if(ht){if(n?yl(e):gl(),ht){var o=Ut,y;if(y=o){t:{for(y=o,o=He;y.nodeType!==8;){if(!o){o=null;break t}if(y=Ue(y.nextSibling),y===null){o=null;break t}}o=y}o!==null?(e.memoizedState={dehydrated:o,treeContext:jl!==null?{id:Ze,overflow:ke}:null,retryLane:536870912,hydrationErrors:null},y=de(18,null,null,0),y.stateNode=o,y.return=e,e.child=y,te=e,Ut=null,y=!0):y=!1}y||Ll(e)}if(o=e.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return _r(o)?e.lanes=32:e.lanes=536870912,null;$e(e)}return o=a.children,a=a.fallback,n?(gl(),n=e.mode,o=Yu({mode:"hidden",children:o},n),a=ql(a,n,l,null),o.return=e,a.return=e,o.sibling=a,e.child=o,n=e.child,n.memoizedState=Vc(l),n.childLanes=Zc(t,f,l),e.memoizedState=Qc,a):(yl(e),kc(e,o))}if(y=t.memoizedState,y!==null&&(o=y.dehydrated,o!==null)){if(u)e.flags&256?(yl(e),e.flags&=-257,e=Kc(t,e,l)):e.memoizedState!==null?(gl(),e.child=t.child,e.flags|=128,e=null):(gl(),n=a.fallback,o=e.mode,a=Yu({mode:"visible",children:a.children},o),n=ql(n,o,l,null),n.flags|=2,a.return=e,n.return=e,a.sibling=n,e.child=a,Ra(e,t.child,null,l),a=e.child,a.memoizedState=Vc(l),a.childLanes=Zc(t,f,l),e.memoizedState=Qc,e=n);else if(yl(e),_r(o)){if(f=o.nextSibling&&o.nextSibling.dataset,f)var T=f.dgst;f=T,a=Error(c(419)),a.stack="",a.digest=f,cn({value:a,source:null,stack:null}),e=Kc(t,e,l)}else if(Qt||rn(t,e,l,!1),f=(l&t.childLanes)!==0,Qt||f){if(f=zt,f!==null&&(a=l&-l,a=(a&42)!==0?1:Mi(a),a=(a&(f.suspendedLanes|l))!==0?0:a,a!==0&&a!==y.retryLane))throw y.retryLane=a,ha(t,a),be(f,t,a),Ro;o.data==="$?"||or(),e=Kc(t,e,l)}else o.data==="$?"?(e.flags|=192,e.child=t.child,e=null):(t=y.treeContext,Ut=Ue(o.nextSibling),te=e,ht=!0,Gl=null,He=!1,t!==null&&(Ae[Oe++]=Ze,Ae[Oe++]=ke,Ae[Oe++]=jl,Ze=t.id,ke=t.overflow,jl=e),e=kc(e,a.children),e.flags|=4096);return e}return n?(gl(),n=a.fallback,o=e.mode,y=t.child,T=y.sibling,a=Ve(y,{mode:"hidden",children:a.children}),a.subtreeFlags=y.subtreeFlags&65011712,T!==null?n=Ve(T,n):(n=ql(n,o,l,null),n.flags|=2),n.return=e,a.return=e,a.sibling=n,e.child=a,a=n,n=e.child,o=t.child.memoizedState,o===null?o=Vc(l):(y=o.cachePool,y!==null?(T=Yt._currentValue,y=y.parent!==T?{parent:T,pool:T}:y):y=vs(),o={baseLanes:o.baseLanes|l,cachePool:y}),n.memoizedState=o,n.childLanes=Zc(t,f,l),e.memoizedState=Qc,a):(yl(e),l=t.child,t=l.sibling,l=Ve(l,{mode:"visible",children:a.children}),l.return=e,l.sibling=null,t!==null&&(f=e.deletions,f===null?(e.deletions=[t],e.flags|=16):f.push(t)),e.child=l,e.memoizedState=null,l)}function kc(t,e){return e=Yu({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function Yu(t,e){return t=de(22,t,null,e),t.lanes=0,t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},t}function Kc(t,e,l){return Ra(e,t.child,null,l),t=kc(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Ho(t,e,l){t.lanes|=e;var a=t.alternate;a!==null&&(a.lanes|=e),oc(t.return,e,l)}function Jc(t,e,l,a,n){var u=t.memoizedState;u===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:a,tail:l,tailMode:n}:(u.isBackwards=e,u.rendering=null,u.renderingStartTime=0,u.last=a,u.tail=l,u.tailMode=n)}function Bo(t,e,l){var a=e.pendingProps,n=a.revealOrder,u=a.tail;if(kt(t,e,a.children,l),a=Gt.current,(a&2)!==0)a=a&1|2,e.flags|=128;else{if(t!==null&&(t.flags&128)!==0)t:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Ho(t,l,e);else if(t.tag===19)Ho(t,l,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break t;for(;t.sibling===null;){if(t.return===null||t.return===e)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}a&=1}switch(H(Gt,a),n){case"forwards":for(l=e.child,n=null;l!==null;)t=l.alternate,t!==null&&Hu(t)===null&&(n=l),l=l.sibling;l=n,l===null?(n=e.child,e.child=null):(n=l.sibling,l.sibling=null),Jc(e,!1,n,l,u);break;case"backwards":for(l=null,n=e.child,e.child=null;n!==null;){if(t=n.alternate,t!==null&&Hu(t)===null){e.child=n;break}t=n.sibling,n.sibling=l,l=n,n=t}Jc(e,!0,l,null,u);break;case"together":Jc(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Fe(t,e,l){if(t!==null&&(e.dependencies=t.dependencies),El|=e.lanes,(l&e.childLanes)===0)if(t!==null){if(rn(t,e,l,!1),(l&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(c(153));if(e.child!==null){for(t=e.child,l=Ve(t,t.pendingProps),e.child=l,l.return=e;t.sibling!==null;)t=t.sibling,l=l.sibling=Ve(t,t.pendingProps),l.return=e;l.sibling=null}return e.child}function Wc(t,e){return(t.lanes&e)!==0?!0:(t=t.dependencies,!!(t!==null&&vu(t)))}function Xy(t,e,l){switch(e.tag){case 3:Ot(e,e.stateNode.containerInfo),sl(e,Yt,t.memoizedState.cache),un();break;case 27:case 5:nl(e);break;case 4:Ot(e,e.stateNode.containerInfo);break;case 10:sl(e,e.type,e.memoizedProps.value);break;case 13:var a=e.memoizedState;if(a!==null)return a.dehydrated!==null?(yl(e),e.flags|=128,null):(l&e.child.childLanes)!==0?Co(t,e,l):(yl(e),t=Fe(t,e,l),t!==null?t.sibling:null);yl(e);break;case 19:var n=(t.flags&128)!==0;if(a=(l&e.childLanes)!==0,a||(rn(t,e,l,!1),a=(l&e.childLanes)!==0),n){if(a)return Bo(t,e,l);e.flags|=128}if(n=e.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),H(Gt,Gt.current),a)break;return null;case 22:case 23:return e.lanes=0,Mo(t,e,l);case 24:sl(e,Yt,t.memoizedState.cache)}return Fe(t,e,l)}function qo(t,e,l){if(t!==null)if(t.memoizedProps!==e.pendingProps)Qt=!0;else{if(!Wc(t,l)&&(e.flags&128)===0)return Qt=!1,Xy(t,e,l);Qt=(t.flags&131072)!==0}else Qt=!1,ht&&(e.flags&1048576)!==0&&ds(e,pu,e.index);switch(e.lanes=0,e.tag){case 16:t:{t=e.pendingProps;var a=e.elementType,n=a._init;if(a=n(a._payload),e.type=a,typeof a=="function")nc(a)?(t=kl(a,t),e.tag=1,e=No(null,e,a,t,l)):(e.tag=0,e=Xc(null,e,a,t,l));else{if(a!=null){if(n=a.$$typeof,n===vt){e.tag=11,e=zo(null,e,a,t,l);break t}else if(n===At){e.tag=14,e=xo(null,e,a,t,l);break t}}throw e=_e(a)||a,Error(c(306,e,""))}}return e;case 0:return Xc(t,e,e.type,e.pendingProps,l);case 1:return a=e.type,n=kl(a,e.pendingProps),No(t,e,a,n,l);case 3:t:{if(Ot(e,e.stateNode.containerInfo),t===null)throw Error(c(387));a=e.pendingProps;var u=e.memoizedState;n=u.element,pc(t,e),yn(e,a,null,l);var f=e.memoizedState;if(a=f.cache,sl(e,Yt,a),a!==u.cache&&dc(e,[Yt],l,!0),hn(),a=f.element,u.isDehydrated)if(u={element:a,isDehydrated:!1,cache:f.cache},e.updateQueue.baseState=u,e.memoizedState=u,e.flags&256){e=wo(t,e,a,l);break t}else if(a!==n){n=Ee(Error(c(424)),e),cn(n),e=wo(t,e,a,l);break t}else{switch(t=e.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ut=Ue(t.firstChild),te=e,ht=!0,Gl=null,He=!0,l=yo(e,null,a,l),e.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(un(),a===n){e=Fe(t,e,l);break t}kt(t,e,a,l)}e=e.child}return e;case 26:return ju(t,e),t===null?(l=Ld(e.type,null,e.pendingProps,null))?e.memoizedState=l:ht||(l=e.type,t=e.pendingProps,a=Iu(P.current).createElement(l),a[$t]=e,a[ee]=t,Jt(a,l,t),Xt(a),e.stateNode=a):e.memoizedState=Ld(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return nl(e),t===null&&ht&&(a=e.stateNode=jd(e.type,e.pendingProps,P.current),te=e,He=!0,n=Ut,Rl(e.type)?(Mr=n,Ut=Ue(a.firstChild)):Ut=n),kt(t,e,e.pendingProps.children,l),ju(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&ht&&((n=a=Ut)&&(a=g0(a,e.type,e.pendingProps,He),a!==null?(e.stateNode=a,te=e,Ut=Ue(a.firstChild),He=!1,n=!0):n=!1),n||Ll(e)),nl(e),n=e.type,u=e.pendingProps,f=t!==null?t.memoizedProps:null,a=u.children,Rr(n,u)?a=null:f!==null&&Rr(n,f)&&(e.flags|=32),e.memoizedState!==null&&(n=Oc(t,e,Cy,null,null,l),qn._currentValue=n),ju(t,e),kt(t,e,a,l),e.child;case 6:return t===null&&ht&&((t=l=Ut)&&(l=b0(l,e.pendingProps,He),l!==null?(e.stateNode=l,te=e,Ut=null,t=!0):t=!1),t||Ll(e)),null;case 13:return Co(t,e,l);case 4:return Ot(e,e.stateNode.containerInfo),a=e.pendingProps,t===null?e.child=Ra(e,null,a,l):kt(t,e,a,l),e.child;case 11:return zo(t,e,e.type,e.pendingProps,l);case 7:return kt(t,e,e.pendingProps,l),e.child;case 8:return kt(t,e,e.pendingProps.children,l),e.child;case 12:return kt(t,e,e.pendingProps.children,l),e.child;case 10:return a=e.pendingProps,sl(e,e.type,a.value),kt(t,e,a.children,l),e.child;case 9:return n=e.type._context,a=e.pendingProps.children,Ql(e),n=Ft(n),a=a(n),e.flags|=1,kt(t,e,a,l),e.child;case 14:return xo(t,e,e.type,e.pendingProps,l);case 15:return _o(t,e,e.type,e.pendingProps,l);case 19:return Bo(t,e,l);case 31:return a=e.pendingProps,l=e.mode,a={mode:a.mode,children:a.children},t===null?(l=Yu(a,l),l.ref=e.ref,e.child=l,l.return=e,e=l):(l=Ve(t.child,a),l.ref=e.ref,e.child=l,l.return=e,e=l),e;case 22:return Mo(t,e,l);case 24:return Ql(e),a=Ft(Yt),t===null?(n=yc(),n===null&&(n=zt,u=mc(),n.pooledCache=u,u.refCount++,u!==null&&(n.pooledCacheLanes|=l),n=u),e.memoizedState={parent:a,cache:n},bc(e),sl(e,Yt,n)):((t.lanes&l)!==0&&(pc(t,e),yn(e,null,null,l),hn()),n=t.memoizedState,u=e.memoizedState,n.parent!==a?(n={parent:a,cache:a},e.memoizedState=n,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=n),sl(e,Yt,a)):(a=u.cache,sl(e,Yt,a),a!==n.cache&&dc(e,[Yt],l,!0))),kt(t,e,e.pendingProps.children,l),e.child;case 29:throw e.pendingProps}throw Error(c(156,e.tag))}function Pe(t){t.flags|=4}function jo(t,e){if(e.type!=="stylesheet"||(e.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!kd(e)){if(e=Re.current,e!==null&&((ot&4194048)===ot?Be!==null:(ot&62914560)!==ot&&(ot&536870912)===0||e!==Be))throw dn=gc,Ss;t.flags|=8192}}function Gu(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?yf():536870912,t.lanes|=e,Ma|=e)}function Tn(t,e){if(!ht)switch(t.tailMode){case"hidden":e=t.tail;for(var l=null;e!==null;)e.alternate!==null&&(l=e),e=e.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var a=null;l!==null;)l.alternate!==null&&(a=l),l=l.sibling;a===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:a.sibling=null}}function Dt(t){var e=t.alternate!==null&&t.alternate.child===t.child,l=0,a=0;if(e)for(var n=t.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags&65011712,a|=n.flags&65011712,n.return=t,n=n.sibling;else for(n=t.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags,a|=n.flags,n.return=t,n=n.sibling;return t.subtreeFlags|=a,t.childLanes=l,e}function Qy(t,e,l){var a=e.pendingProps;switch(rc(e),e.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(e),null;case 1:return Dt(e),null;case 3:return l=e.stateNode,a=null,t!==null&&(a=t.memoizedState.cache),e.memoizedState.cache!==a&&(e.flags|=2048),Je(Yt),re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(nn(e)?Pe(e):t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,ys())),Dt(e),null;case 26:return l=e.memoizedState,t===null?(Pe(e),l!==null?(Dt(e),jo(e,l)):(Dt(e),e.flags&=-16777217)):l?l!==t.memoizedState?(Pe(e),Dt(e),jo(e,l)):(Dt(e),e.flags&=-16777217):(t.memoizedProps!==a&&Pe(e),Dt(e),e.flags&=-16777217),null;case 27:ul(e),l=P.current;var n=e.type;if(t!==null&&e.stateNode!=null)t.memoizedProps!==a&&Pe(e);else{if(!a){if(e.stateNode===null)throw Error(c(166));return Dt(e),null}t=X.current,nn(e)?ms(e):(t=jd(n,a,l),e.stateNode=t,Pe(e))}return Dt(e),null;case 5:if(ul(e),l=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==a&&Pe(e);else{if(!a){if(e.stateNode===null)throw Error(c(166));return Dt(e),null}if(t=X.current,nn(e))ms(e);else{switch(n=Iu(P.current),t){case 1:t=n.createElementNS("http://www.w3.org/2000/svg",l);break;case 2:t=n.createElementNS("http://www.w3.org/1998/Math/MathML",l);break;default:switch(l){case"svg":t=n.createElementNS("http://www.w3.org/2000/svg",l);break;case"math":t=n.createElementNS("http://www.w3.org/1998/Math/MathML",l);break;case"script":t=n.createElement("div"),t.innerHTML=" - + - + diff --git a/releases/auto-post-facebook-extensions_1.2/manifest.json b/releases/auto-post-facebook-extensions_1.2/manifest.json index 3c0dd83..a488000 100644 --- a/releases/auto-post-facebook-extensions_1.2/manifest.json +++ b/releases/auto-post-facebook-extensions_1.2/manifest.json @@ -28,7 +28,7 @@ "matches": ["https://www.facebook.com/*"] } ], - "permissions": ["tabs", "activeTab", "scripting"], + "permissions": ["tabs", "activeTab", "scripting", "storage"], "icons": { "16": "icons/16.png", "32": "icons/32.png", diff --git a/server/data.json b/server/data.json index 2070a3b..947de47 100644 --- a/server/data.json +++ b/server/data.json @@ -1,20 +1,30 @@ [ { - "title": "Cisco FPR2K-SLIDE-RAILS Mounting Rail Kit for FirePower FPR 2100 Series", - "price": 995, + "title": "Cisco C9120AXI-E 802.11ax Internal Antennas 4x4:4 MIMO Bluetooth 5 Reg E AP", + "price": 862, "el": {}, - "date": "2025-08-23T01:38:28.591Z" + "url_info": "https://www.facebook.com/profile.php?id=61578035566295", + "date": "2025-08-26T08:31:36.498Z" + }, + { + "title": "HP DL380 G9 2U Server 2x CPU E5-2650V3 32Gb RAM 600Gb HDD Dual PSU Rail Kit - DL380 G9, server", + "price": 2245, + "el": {}, + "url_info": "https://www.facebook.com/profile.php?id=61578035566295", + "date": "2025-08-26T08:31:36.498Z" }, { "title": "Cisco AIR-PWRINJ6 Power Injector 8023at for Aironet Access Points", "price": 95, "el": {}, - "date": "2025-08-23T01:38:28.591Z" + "url_info": "https://www.facebook.com/profile.php?id=61578035566295", + "date": "2025-08-26T08:31:36.498Z" }, { - "title": "Cisco NM-1CE1T1-PRI - Fully Tested - 6 Month Warranty - Tax Invoice included", - "price": 75, + "title": "Cisco AIR-AP1542D-Z-K9 802.11ac W2 Value Outdoor AP, Direct. Ant, Z Reg Dom.", + "price": 2563, "el": {}, - "date": "2025-08-23T01:38:28.591Z" + "url_info": "https://www.facebook.com/profile.php?id=61578035566295", + "date": "2025-08-26T08:31:36.498Z" } ] \ No newline at end of file diff --git a/server/server.js b/server/server.js index ba961e6..7fbb665 100644 --- a/server/server.js +++ b/server/server.js @@ -97,7 +97,8 @@ app.post("/", async (req, res) => { // ===== Meta ===== let meta = readJSON(metaPath, { total: 4000 }); - const filter = req.body?.filter || {}; + + const { info, ...filter } = req.body?.filter || {}; const originalFilter = { ...filter }; const status = filter?.where?.status_listing; @@ -137,28 +138,22 @@ app.post("/", async (req, res) => { const skip = originalFilter.skip || 0; const limit = originalFilter.limit || data.data.length; - // const listedCodes = new Set( - // publistedData.map((i) => (i.title + i.price || "").trim().toLowerCase()) - // ); - - // let filteredData = data.data.filter((item) => { - // const key = `${item.title} - ${item.code}${item.price}`.toLowerCase(); - // return status === "listed" - // ? listedCodes.has(key) - // : !listedCodes.has(key); - // }); let filteredData = data.data.filter((item) => { const key = item?.title.includes(item.code) ? `${item.title}`.toLowerCase() : `${item.title} - ${item.code}`.toLowerCase(); if (status === "listed") { - return publistedData.some((i) => - `${i.title}`.toLowerCase().includes(key) + return publistedData.some( + (i) => + `${i.title}`.toLowerCase().includes(key) && + i?.url_info == info?.url ); } else { - return !publistedData.some((i) => - `${i.title}`.toLowerCase().includes(key) + return !publistedData.some( + (i) => + `${i.title}`.toLowerCase().includes(key) && + i?.url_info == info?.url ); } }); diff --git a/src/api/product-api.service.ts b/src/api/product-api.service.ts index 8996eb1..73cc749 100644 --- a/src/api/product-api.service.ts +++ b/src/api/product-api.service.ts @@ -9,6 +9,7 @@ class ProductApiService { limit?: number; order?: string; where?: Record; + info?: any; }) { const defaultFilter = { skip: 0, @@ -75,7 +76,8 @@ class ProductApiService { | "createBlobUrl" | "publist" | "unlist" - | "sync", + | "sync" + | "dequeue", body: Record ) { return new Promise((resolve, reject) => { diff --git a/src/components/btn/trigger-open-model.tsx b/src/components/btn/trigger-open-model.tsx new file mode 100644 index 0000000..fc3102d --- /dev/null +++ b/src/components/btn/trigger-open-model.tsx @@ -0,0 +1,13 @@ +import { DoorOpenIcon } from "lucide-react"; +import { Button } from "../ui/button"; +import { PopoverTrigger } from "../ui/popover"; + +export default function TrigerOpenModal() { + return ( + + + + ); +} diff --git a/src/components/product-modal.tsx b/src/components/product-modal.tsx index 21f7e62..10a354b 100644 --- a/src/components/product-modal.tsx +++ b/src/components/product-modal.tsx @@ -4,7 +4,13 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { Plus, X } from "lucide-react"; -import { useCallback, useEffect, useState, type ReactNode } from "react"; +import { + useCallback, + useEffect, + useLayoutEffect, + useState, + type ReactNode, +} from "react"; import { useForm } from "react-hook-form"; import { Badge } from "@/components/ui/badge"; @@ -110,7 +116,7 @@ export default function ProductModal({ const conditions = ["New", "Used - like new", "Used - good", "Used - fair"]; const categories = ["Tools", "Electronics & computers"]; - const { ...query } = usePost(data); + const { refetch, ...query } = usePost(data); const addTag = () => { if (tagInput.trim() && !watchedTags?.includes(tagInput.trim())) { @@ -417,13 +423,6 @@ export default function ProductModal({ } }} /> - {watchedTags && watchedTags?.length > 0 && (
diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 68abd16..5d8190b 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -5,27 +5,27 @@ import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", + "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-neutral-950 focus-visible:ring-neutral-950/50 focus-visible:ring-[3px] aria-invalid:ring-red-500/20 dark:aria-invalid:ring-red-500/40 aria-invalid:border-red-500 dark:focus-visible:border-neutral-300 dark:focus-visible:ring-neutral-300/50 dark:aria-invalid:ring-red-900/20 dark:dark:aria-invalid:ring-red-900/40 dark:aria-invalid:border-red-900", { variants: { variant: { default: - "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90", + "bg-neutral-900 text-neutral-50 shadow-xs hover:bg-neutral-900/90 dark:bg-neutral-50 dark:text-neutral-900 dark:hover:bg-neutral-50/90", destructive: - "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", + "bg-red-500 text-white shadow-xs hover:bg-red-500/90 focus-visible:ring-red-500/20 dark:focus-visible:ring-red-500/40 dark:bg-red-500/60 dark:bg-red-900 dark:hover:bg-red-900/90 dark:focus-visible:ring-red-900/20 dark:dark:focus-visible:ring-red-900/40 dark:dark:bg-red-900/60", outline: - "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50", + "border bg-white shadow-xs hover:bg-neutral-100 hover:text-neutral-900 dark:bg-neutral-200/30 dark:border-neutral-200 dark:hover:bg-neutral-200/50 dark:bg-neutral-950 dark:hover:bg-neutral-800 dark:hover:text-neutral-50 dark:dark:bg-neutral-800/30 dark:dark:border-neutral-800 dark:dark:hover:bg-neutral-800/50", secondary: - "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80", + "bg-neutral-100 text-neutral-900 shadow-xs hover:bg-neutral-100/80 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800/80", ghost: - "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", - link: "text-primary underline-offset-4 hover:underline", + "hover:bg-neutral-100 hover:text-neutral-900 dark:hover:bg-neutral-100/50 dark:hover:bg-neutral-800 dark:hover:text-neutral-50 dark:dark:hover:bg-neutral-800/50", + link: "text-neutral-900 underline-offset-4 hover:underline dark:text-neutral-50", }, size: { default: "h-9 px-4 py-2 has-[>svg]:px-3", sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5", - xs: "h-7 rounded-md gap-1 px-2.5 has-[>svg]:px-2", lg: "h-10 rounded-md px-6 has-[>svg]:px-4", + xs: "h-7 rounded-md gap-1 px-2.5 has-[>svg]:px-2", icon: "size-9", }, }, diff --git a/src/components/ui/scroll-area.tsx b/src/components/ui/scroll-area.tsx new file mode 100644 index 0000000..9376f59 --- /dev/null +++ b/src/components/ui/scroll-area.tsx @@ -0,0 +1,56 @@ +import * as React from "react" +import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area" + +import { cn } from "@/lib/utils" + +function ScrollArea({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + + {children} + + + + + ) +} + +function ScrollBar({ + className, + orientation = "vertical", + ...props +}: React.ComponentProps) { + return ( + + + + ) +} + +export { ScrollArea, ScrollBar } diff --git a/src/components/ui/sonner.tsx b/src/components/ui/sonner.tsx new file mode 100644 index 0000000..cd62aff --- /dev/null +++ b/src/components/ui/sonner.tsx @@ -0,0 +1,23 @@ +import { useTheme } from "next-themes" +import { Toaster as Sonner, ToasterProps } from "sonner" + +const Toaster = ({ ...props }: ToasterProps) => { + const { theme = "system" } = useTheme() + + return ( + + ) +} + +export { Toaster } diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsx new file mode 100644 index 0000000..71ee0fe --- /dev/null +++ b/src/components/ui/tooltip.tsx @@ -0,0 +1,59 @@ +import * as React from "react" +import * as TooltipPrimitive from "@radix-ui/react-tooltip" + +import { cn } from "@/lib/utils" + +function TooltipProvider({ + delayDuration = 0, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function Tooltip({ + ...props +}: React.ComponentProps) { + return ( + + + + ) +} + +function TooltipTrigger({ + ...props +}: React.ComponentProps) { + return +} + +function TooltipContent({ + className, + sideOffset = 0, + children, + ...props +}: React.ComponentProps) { + return ( + + + {children} + + + + ) +} + +export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } diff --git a/src/content/content.ts b/src/content/content.tsx similarity index 73% rename from src/content/content.ts rename to src/content/content.tsx index d0d31b2..d9bbf9c 100644 --- a/src/content/content.ts +++ b/src/content/content.tsx @@ -1,13 +1,20 @@ // content.ts import { productApi } from "@/api/product-api.service"; -import { delayRD, removeFalsyValues } from "@/features/app"; +import { delayRD } from "@/features/app"; import { Contants } from "@/lib/contants"; +import { Queue } from "@/lib/queue"; import type { IPost } from "@/lib/utils"; import { facebookService } from "@/services/facebook.service"; import MessageService from "@/services/message.service"; import { thiefService } from "@/services/thief.service"; - const msgService = new MessageService("content"); +export type ToastType = "success" | "error" | "info" | "warning" | "loading"; + +export type Noti = { title: string; message: string; type: ToastType }; + +const pushNoti = async (data: Noti) => { + await (window as any).QUEUE.enqueue(data); +}; const injectApp = () => { const id = Contants.ID_EXTENSION; @@ -41,8 +48,19 @@ msgService.on<{ data: IPost }>( await delayRD(800, 1000); await facebookService.handlePublist(payload.data); + + pushNoti({ + title: "Publist Completed !", + message: "Please review", + type: "success", + }); } catch (error) { console.log({ error }); + pushNoti({ + title: `Publist Error - ${payload.data.title || "Unknow"}`, + message: (error as any)?.message, + type: "error", + }); } finally { // Gửi ngược lại bacground msgService.send("background", "content-to-background-publish", { @@ -73,9 +91,20 @@ msgService.on<{ data: IPost }>( await delayRD(800, 1000); - productApi.sync(products); + await productApi.sync(products); + + pushNoti({ + title: "Unlist Completed !", + message: "Please review", + type: "success", + }); } catch (error) { console.log({ error }); + pushNoti({ + title: `Unlist Error - ${payload.data.title || ""}`, + message: (error as any)?.message, + type: "error", + }); } finally { // Gửi ngược lại bacground msgService.send("background", "content-to-background-unlist", { @@ -101,6 +130,11 @@ msgService.on<{ data: IPost }>( await facebookService.handleRePublist(payload.data); } catch (error) { console.log({ error }); + pushNoti({ + title: "Re-Publist Error", + message: (error as any)?.message, + type: "error", + }); } finally { // Gửi ngược lại bacground msgService.send("background", "content-to-background-re-publist", { @@ -118,14 +152,16 @@ window.addEventListener("message", async (event) => { const fn = event.data.fn; const { requestId } = event.data; - console.log({ requestId, event, body }); - try { let data = null; switch (fn) { case "index": { - const response = await productApi.index(body); + const info = await facebookService.getInfo(); + + console.log(info, body); + + const response = await productApi.index({ info, ...body }); data = response.data; break; } @@ -176,8 +212,6 @@ window.addEventListener("message", async (event) => { data: body, }); - console.log({ body }); - data = await msgService.waitForMessage( "background-to-content-actions" ); @@ -188,13 +222,13 @@ window.addEventListener("message", async (event) => { } case "sync": { const el = await thiefService.waitForElement( - '[aria-label="Collection of your Marketplace items"]' + facebookService.selectors.collection_marketplace ); console.log("Element đã xuất hiện:", el); await facebookService.waitForPageReady( facebookService.sellingPath, - '[aria-label="Collection of your Marketplace items"]' + facebookService.selectors.collection_marketplace ); await delayRD(800, 1000); @@ -204,6 +238,11 @@ window.addEventListener("message", async (event) => { await productApi.sync(products); + break; + } + case "dequeue": { + data = await (window as any).QUEUE.dequeue(); + break; } } @@ -229,27 +268,49 @@ window.addEventListener("message", async (event) => { } }); +const runSync = () => { + const interval = setInterval(async () => { + try { + const products = await facebookService.getProducts(); + await productApi.sync(products); + } catch (err) { + console.error("Sync error:", err); + clearInterval(interval); // dừng interval nếu có lỗi + + pushNoti({ + title: "Sync Error", + message: (err as any).message, + type: "error", + }); + } + }, 10000); // 10 giây +}; + (async () => { + (window as any).QUEUE = await Queue.create<{ + message: string; + type: string; + }>(); + + await facebookService.getInfo(); + await delayRD(800, 1000); if (window.location.href.includes(facebookService.sellingPath)) { try { const el = await thiefService.waitForElement( - '[aria-label="Collection of your Marketplace items"]' + facebookService.selectors.collection_marketplace ); console.log("Element đã xuất hiện:", el); - await facebookService.waitForPageReady( - facebookService.sellingPath, - '[aria-label="Collection of your Marketplace items"]' - ); + // await facebookService.waitForPageReady( + // facebookService.sellingPath, + // facebookService.selectors.collection_marketplace + // ); await delayRD(800, 1000); - const products = await facebookService.getProducts(); - console.log({ products }); - - await productApi.sync(products); + runSync(); } catch (err) { console.error(err); } finally { diff --git a/src/content/inject-ui.tsx b/src/content/inject-ui.tsx index dcaacce..0d6374d 100644 --- a/src/content/inject-ui.tsx +++ b/src/content/inject-ui.tsx @@ -1,3 +1,4 @@ +import { Toaster } from "@/components/ui/sonner"; import "@/index.css"; import { Contants } from "@/lib/contants"; import { queryClient } from "@/lib/react-query"; @@ -13,6 +14,7 @@ if (container) {
+ ); diff --git a/src/lib/queue.ts b/src/lib/queue.ts new file mode 100644 index 0000000..34d8bfd --- /dev/null +++ b/src/lib/queue.ts @@ -0,0 +1,54 @@ +export class Queue { + private items: T[] = []; + private storageKey = "notiQueue"; + + private constructor(items: T[]) { + this.items = items; + + // Lắng nghe thay đổi từ tab khác + chrome.storage.onChanged.addListener((changes, areaName) => { + if (areaName === "local" && changes[this.storageKey]) { + this.items = changes[this.storageKey].newValue + ? JSON.parse(changes[this.storageKey].newValue) + : []; + console.log("Queue updated from another tab:", this.items); + } + }); + } + + static async create(): Promise> { + const storageKey = "notiQueue"; + const res = await chrome.storage.local.get(storageKey); + const items = res[storageKey] ? JSON.parse(res[storageKey]) : []; + return new Queue(items); + } + + private async save() { + await chrome.storage.local.set({ + [this.storageKey]: JSON.stringify(this.items), + }); + } + + async enqueue(item: T) { + this.items.push(item); + await this.save(); + } + + async dequeue(): Promise { + const item = this.items.shift(); + await this.save(); + return item; + } + + peek(): T | undefined { + return this.items[0]; + } + + isEmpty(): boolean { + return this.items.length === 0; + } + + size(): number { + return this.items.length; + } +} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 4494626..77ffd8c 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -23,6 +23,7 @@ export interface ISyncItem { title: string; price: number; el: HTMLElement; + url_info: string; } export function cn(...inputs: ClassValue[]) { @@ -63,6 +64,7 @@ export function mapToIPost(raw: any): IPost { (typeof raw?.category === "string" ? raw.category : raw?.category?.name) || "", packageContainText, + `Join the "Prology | Latest Products & Deals" group for more products.`, ] .filter(Boolean) // loại bỏ cái rỗng .join("\n\n"); // cách 1 dòng giữa các block diff --git a/src/popup/popup.tsx b/src/popup/popup.tsx index f155594..553f5d0 100644 --- a/src/popup/popup.tsx +++ b/src/popup/popup.tsx @@ -1,4 +1,5 @@ import { productApi } from "@/api/product-api.service"; +import TrigerOpenModal from "@/components/btn/trigger-open-model"; import { ImprovedToggleFilter } from "@/components/improved-toggle-filter"; import Loader from "@/components/loader"; import ProductModal from "@/components/product-modal"; @@ -11,11 +12,8 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Input } from "@/components/ui/input"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/components/ui/popover"; +import { Popover, PopoverContent } from "@/components/ui/popover"; +import { ScrollArea } from "@/components/ui/scroll-area"; import { Table, TableBody, @@ -24,21 +22,21 @@ import { TableHeader, TableRow, } from "@/components/ui/table"; +import type { Noti } from "@/content/content"; import { removeFalsyValues } from "@/features/app"; import { mapToIPost, type IPost } from "@/lib/utils"; import { useMutation, useQuery } from "@tanstack/react-query"; import { ChevronLeft, ChevronRight, - DoorOpenIcon, Edit, Eye, EyeOff, MoreHorizontal, - RefreshCcwIcon, Search, } from "lucide-react"; -import { useMemo, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; +import { toast } from "sonner"; import { useDebounce } from "use-debounce"; export default function Popup() { @@ -54,11 +52,7 @@ export default function Popup() { ); // --- React Query fetch --- - const { - data: rawProducts, - isFetching, - ...dataQuery - } = useQuery({ + const { data: rawProducts, isFetching } = useQuery({ queryKey, queryFn: async () => { const data = await productApi.apiRequest( @@ -76,7 +70,7 @@ export default function Popup() { }, }); - const { data: publistedProducts, ...publistQuery } = useQuery({ + const { data: publistedProducts } = useQuery({ queryKey: ["publised-products"], queryFn: async () => { const data = await productApi.apiRequest("getPublistedProducts", {}); @@ -151,15 +145,31 @@ export default function Popup() { actionMutation.mutate(data); }; + useEffect(() => { + const interval = setInterval(async () => { + try { + // chỉ chạy khi tab đang active + if (!document.hidden) { + const data = (await productApi.apiRequest("dequeue", {})) as Noti; + + if (data) { + toast[data.type](data.title, { description: data.message }); + } + } + } catch (err) { + console.error("Error in interval:", err); + } + }, 1000); + + return () => clearInterval(interval); + }, []); + return ( - - - - -
+ + + +
@@ -290,127 +300,129 @@ export default function Popup() {
- - - - Name - Price - Status - - Actions - - - - - - {isFetching && ( + +
+ - -
- -
-
+ Name + Price + Status + + Actions +
- )} +
- {data.length === 0 && !isFetching ? ( - - -
- No products found -
-
-
- ) : ( - data.map((post) => { - const status = (publistedProducts as any)?.some( - (item: any) => item.title.includes(post.sku) - ); + + {isFetching && ( + + +
+ +
+
+
+ )} - post.status = status; + {data.length === 0 && !isFetching ? ( + + +
+ No products found +
+
+
+ ) : ( + data.map((post) => { + const status = (publistedProducts as any)?.some( + (item: any) => item.title.includes(post.sku) + ); - return ( - - -
- {post.title} -
-
- {post.description} -
-
- - {formatPrice(post.price)} - - - - {post?.status ? "Listed" : "Unlisted"} - - + post.status = status; - - - -
- -
-
- - + return ( + + +
+ {post.title} +
+
+ {post.description} +
+
+ + {formatPrice(post.price)} + + + + {post?.status ? "Listed" : "Unlisted"} + + + + + + +
+ +
+
+ + + { + e.preventDefault(); // Ngăn dropdown đóng lại + e.stopPropagation(); + }} + > + Review + + { - e.preventDefault(); // Ngăn dropdown đóng lại - e.stopPropagation(); - }} + onClick={() => handleActionListing(post)} > - Edit - -
- handleActionListing(post)} - > - {post.status ? ( - - ) : ( - - )} - {post.status ? "Unlist" : "List"} + {post.status ? ( + + ) : ( + + )} + {post.status ? "Unlist" : "List"} - {/* {actionMutation.isPending && } */} - - {/* handleUnListing(post)}> - unList - - handleRePublist(post)}> - re publist - */} -
-
-
-
- ); - }) - )} -
-
+ {/* {actionMutation.isPending && } */} + + {/* handleUnListing(post)}> + unList + + handleRePublist(post)}> + re publist + */} + + + + + ); + }) + )} + + +
diff --git a/src/services/background.service.ts b/src/services/background.service.ts index d76e40e..c5b840b 100644 --- a/src/services/background.service.ts +++ b/src/services/background.service.ts @@ -47,14 +47,19 @@ export class BackgroundService { }); }; // Tạo tab mới - chrome.tabs.create({ url: facebookService.createItem }, (tab) => { - if (!tab?.id) { - reject(new Error("Không mở được tab")); - return; + chrome.tabs.create( + { + url: facebookService.createItem, + }, + (tab) => { + if (!tab?.id) { + reject(new Error("Không mở được tab")); + return; + } + console.log("Đã mở tab mới:", tab.id); + openAndSend(tab.id); } - console.log("Đã mở tab mới:", tab.id); - openAndSend(tab.id); - }); + ); }); }); } diff --git a/src/services/facebook.service.ts b/src/services/facebook.service.ts index c0b068b..4150d42 100644 --- a/src/services/facebook.service.ts +++ b/src/services/facebook.service.ts @@ -18,7 +18,7 @@ class FacebookService { 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", products: - "/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[2]/div/div/div[2]/div[1]/div/div[2]/div[2]/div", + "/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[2]/div/div/div[2]/div[1]/div/div[2]/div/div/span/div/div", products_fallback: "/html/body/div[1]/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[2]/div/div/div[2]/div[1]/div/div[3]/div/div/span/div[2]/div", option_btn: @@ -37,8 +37,9 @@ class FacebookService { "/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]/a/div", item_for_sell: "/html/body/div[1]/div/div[1]/div/div[5]/div/div/div[3]/div[2]/div[2]/div/div/div[2]/div[1]/div/span/div/div/div[1]/div/div", - market_container: '[aria-label="Marketplace"]', + collection_marketplace: + '[aria-label="Collection of your Marketplace items"]', }; findInputByTitle(title: string, type: "input" | "textarea" = "input") { @@ -362,6 +363,46 @@ class FacebookService { return true; }; + async getInfo(): Promise { + const TTL = 2 * 60 * 60 * 1000; // 2 tiếng + + try { + const now = Date.now(); + + // 1. Lấy cache từ storage + const cached: { data: any; timestamp: number } | null = await new Promise( + (resolve) => { + chrome.storage.local.get("meCache", (res) => { + resolve(res.meCache ? JSON.parse(res.meCache) : null); + }); + } + ); + + // 2. Nếu cache còn hạn thì trả về ngay + if (cached && now - cached.timestamp < TTL) { + return cached.data; + } + + // 3. Nếu không có cache hoặc hết hạn, fetch API + const response = await fetch("/me"); + if (!response.ok) + throw new Error(`HTTP error! status: ${response.status}`); + + // 4. Lưu cache vào storage + chrome.storage.local.set({ + meCache: JSON.stringify({ + data: { url: response.url }, + timestamp: now, + }), + }); + + return response; + } catch (err) { + console.error("Failed to get /me:", err); + return null; + } + } + getProducts = async () => { const products1 = await thiefService.getElementByXPath( this.selectors.products @@ -370,7 +411,9 @@ class FacebookService { this.selectors.products_fallback ); - console.log({ products1, products2 }); + if (!products1 && !products2) { + throw new Error("List element has changed. Please connect to DEV"); + } // Gom 2 cái vào một mảng, bỏ null const allProductsEls = [products1, products2].filter( @@ -379,13 +422,17 @@ class FacebookService { if (allProductsEls.length === 0) return []; + const info = await this.getInfo(); + + console.log({ info }); + // Nối tất cả kết quả extractListings từ mỗi element return allProductsEls.flatMap((el) => - this.extractListings(el) + this.extractListings(el, info) ) as ISyncItem[]; }; - extractListings(productsEl: HTMLElement) { + extractListings(productsEl: HTMLElement, info?: Response | null) { const children = Array.from(productsEl.children); return children.map((child) => { @@ -407,7 +454,7 @@ class FacebookService { ? parseFloat(priceMatch[0].replace(/,/g, "")) : 0; - return { title, price, el: productsEl }; + return { title, price, el: productsEl, url_info: info?.url }; }); } diff --git a/vite.config.content.ts b/vite.config.content.ts index 48a0420..74e5986 100644 --- a/vite.config.content.ts +++ b/vite.config.content.ts @@ -12,7 +12,7 @@ export default defineConfig({ outDir: "dist-content", emptyOutDir: false, // giữ dist gốc rollupOptions: { - input: path.resolve(__dirname, "src/content/content.ts"), + input: path.resolve(__dirname, "src/content/content.tsx"), output: { entryFileNames: "content/content.js", format: "iife", diff --git a/vite.config.popup.ts b/vite.config.popup.ts index 7ec84df..be69285 100644 --- a/vite.config.popup.ts +++ b/vite.config.popup.ts @@ -19,7 +19,7 @@ export default defineConfig({ rollupOptions: { input: { popup: resolve(__dirname, "index.html"), - content: resolve(__dirname, "src/content/content.ts"), + content: resolve(__dirname, "src/content/content.tsx"), "inject-ui": resolve(__dirname, "src/content/inject-ui.tsx"), background: resolve(__dirname, "src/background/background.ts"), },