var e,t;"function"==typeof(e=globalThis.define)&&(t=e,e=null),function(t,r,o,n,a){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof s[n]&&s[n],l=i.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,r){if(!l[e]){if(!t[e]){var o="function"==typeof s[n]&&s[n];if(!r&&o)return o(e,!0);if(i)return i(e,!0);if(c&&"string"==typeof e)return c(e);var a=Error("Cannot find module '"+e+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(r){var o=t[e][1][r];return null!=o?o:r},p.cache={};var d=l[e]=new u.Module(e);t[e][0].call(d.exports,p,d,d.exports,this)}return l[e].exports;function p(e){var t=p.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=t,u.cache=l,u.parent=i,u.register=function(e,r){t[e]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return s[n]}}),s[n]=u;for(var d=0;d<r.length;d++)u(r[d]);if(o){var p=u(o);"object"==typeof exports&&"undefined"!=typeof module?module.exports=p:"function"==typeof e&&e.amd?e(function(){return p}):a&&(this[a]=p)}}({l17v3:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"config",()=>l);var n=e("../background/types"),a=e("../constants/partnerCode"),s=e("../services/api"),i=e("../utils/partnerContextClient");let l={matches:["https://*.noon.com/*","https://noon.com/*"],all_frames:!1},c="store-ops-noon-collector",u="__storeOpsNoonCollectorRouteWatch",d="__storeOpsNoonCollectorStorageWatch",p=null,CSS=`
:host { all: initial; }
* { box-sizing: border-box; }
.root {
  position: fixed;
  right: 20px;
  bottom: 120px;
  z-index: 2147483647;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.panel {
  width: 286px;
  background: #ffffff;
  color: #111827;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: #111827;
}
.badge {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: #FEEE00;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.12);
}
.collapse {
  border: 0;
  background: transparent;
  color: rgba(17,24,39,0.65);
  cursor: pointer;
  font-size: 16px;
  line-height: 16px;
  padding: 4px 6px;
}
.collapse:hover { color: rgba(17,24,39,0.9); }
.desc {
  margin: 8px 0 10px;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(17,24,39,0.72);
}
.btn {
  width: 100%;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.btn:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-primary {
  border: 0;
  background: #FEEE00;
  color: #111827;
}
.btn-primary:hover { filter: brightness(0.98); }
.btn-secondary {
  margin-top: 8px;
  background: #ffffff;
  color: #111827;
  border: 1px solid rgba(17,24,39,0.18);
}
.btn-secondary:hover { background: rgba(17,24,39,0.03); }
.status {
  margin-top: 8px;
  min-height: 16px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(17,24,39,0.75);
  word-break: break-word;
  text-align: center;
}
.status[data-type="success"] { color: #059669; }
.status[data-type="error"] { color: #dc2626; }
.fab {
  width: 52px;
  height: 52px;
  border-radius: 26px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #FEEE00;
  color: #111827;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}
.hidden { display: none !important; }
`;function h(e){if(e instanceof Error)return e.message;try{return String(e)}catch{return"\u672a\u77e5\u9519\u8bef"}}function m(e){try{let t=new URL(e),r=t.pathname.split("/").filter(Boolean),o=r.findIndex(e=>"p"===e);if(o>0){let e=r[o-1];if(e&&/^[A-Z0-9]{8,}$/.test(e))return e}return null}catch{return null}}function f(){try{let e=document.body;if(!e)return!1;let t=e.querySelector('[class*="emptyOffer"]')||e.querySelector('[class*="EmptyOffer"]'),r=(t??e).innerText??"";return r.includes("Sorry! This product is not available")}catch{return!1}}function g(e){let t=window.open("about:blank","_blank");if(!t)throw Error("\u65e0\u6cd5\u6253\u5f00\u65b0\u6807\u7b7e\u9875\uff0c\u8bf7\u68c0\u67e5\u6d4f\u89c8\u5668\u5f39\u7a97\u62e6\u622a\u8bbe\u7f6e");try{let r=JSON.stringify(e);if(r.length>2097152){let e=r.length/1048576;throw Error(`\u6570\u636e\u8fc7\u5927\uff08${e.toFixed(2)}MB\uff09\uff0c\u65e0\u6cd5\u4f20\u9012\u3002\u8bf7\u8054\u7cfb\u6280\u672f\u652f\u6301\u3002`)}t.name=r,t.location.href="https://noon-catalog.noon.partners/"}catch(e){try{t.close()}catch{}throw e}}async function y(){let e=window.location.href;if(!e.includes("noon.com")||!e.includes("/p/"))throw Error("\u5f53\u524d\u9875\u9762\u4e0d\u662f\u6709\u6548\u7684 Noon \u5546\u54c1\u8be6\u60c5\u9875");let t=await (0,s.fetchProductDetails)(e);return g({src:"store-ops-noon-collector",flow:"noon",ts:Date.now(),baseUrl:e,data:t}),t}async function w(){let e=window.location.href;if(!e.includes("noon.com")||!e.includes("/p/"))throw Error("\u5f53\u524d\u9875\u9762\u4e0d\u662f\u6709\u6548\u7684 Noon \u5546\u54c1\u8be6\u60c5\u9875");let t=await (0,s.fetchProductDetails)(e);if(t.sku?.toLowerCase().startsWith("z"))throw Error("\u8be5\u5546\u54c1\u4e0d\u652f\u6301 NA \u8ddf\u5356");return g({src:"store-ops-noon-follow-sell",flow:"noon-follow-sell",ts:Date.now(),baseUrl:e,data:t}),t}function E(){if(p)try{p.destroy()}finally{p=null}}function b(e){let t=document.getElementById(c);if(t)try{t.remove()}catch{}let r=document.createElement("div");r.id=c,r.style.cssText="position: fixed; inset: auto; right: 20px; bottom: 120px; z-index: 2147483647;";let o=r.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=CSS;let a=document.createElement("div");a.className="root";let s=document.createElement("div");s.className="panel";let l=document.createElement("div");l.className="header";let u=document.createElement("div");u.className="title";let d=document.createElement("span");d.className="badge";let p=document.createElement("span");p.textContent="Noon \u91c7\u96c6",u.appendChild(d),u.appendChild(p);let m=document.createElement("button");m.className="collapse",m.type="button",m.title="\u7f29\u5c0f",m.textContent="\u2014",l.appendChild(u),l.appendChild(m);let g=document.createElement("div");g.className="desc",g.textContent="\u91c7\u96c6\u5546\u54c1\u8be6\u60c5\u5e76\u8df3\u8f6c\u5230 Noon Catalog\u3002";let E=document.createElement("button");E.className="btn btn-primary",E.type="button",E.textContent="\u70b9\u51fb\u91c7\u96c6";let b=document.createElement("button");b.className="btn btn-secondary",b.type="button",b.textContent="NA \u8ddf\u5356";let x=document.createElement("div");x.className="status",x.dataset.type="info",s.appendChild(l),s.appendChild(g),s.appendChild(E);let S=!!e&&e.toLowerCase().startsWith("z");S||s.appendChild(b),s.appendChild(x);let A=document.createElement("button");A.className="fab hidden",A.type="button",A.title="\u5c55\u5f00\u91c7\u96c6\u5de5\u5177",A.textContent="\u91c7",a.appendChild(s),a.appendChild(A),o.appendChild(n),o.appendChild(a),(document.body||document.documentElement).appendChild(r);let T=()=>document.getElementById(c)===r,v=!1,_=null,C=null,I=null,U=!1,O=!1,k=e=>{T()&&(v=e,s.classList.toggle("hidden",v),A.classList.toggle("hidden",!v))},R=e=>{T()&&(_=e,E.disabled=null!==e||!U||O,b.disabled=null!==e||!U||O,E.textContent="collect"===e?"\u91c7\u96c6\u4e2d\u2026":"\u70b9\u51fb\u91c7\u96c6",b.textContent="sell"===e?"\u63d0\u4ea4\u4e2d\u2026":"NA \u8ddf\u5356")},P=(e,t,r=3500)=>{T()&&(x.dataset.type=e,x.textContent=t,C&&(window.clearTimeout(C),C=null),r>0&&(C=window.setTimeout(()=>{T()&&(x.textContent="",x.dataset.type="info",C=null)},r)))},L=async()=>{if(T()){E.disabled=!0,b.disabled=!0;try{let e=await (0,i.getPartnerContext)();if(!T())return;let t=(0,i.canUseCollectors)(e);(U=t.allowed)?P("success",t.message,t.showNoonCatalogHint?2500:1200):P("error",t.message,0)}catch(e){U=!1,P("error",h(e),0)}finally{T()&&(E.disabled=null!==_||!U||O,b.disabled=null!==_||!U||O)}}},N=()=>{O=!0,E.disabled=!0,b.disabled=!0,P("error","\u8be5\u5546\u54c1\u5f53\u524d\u4e0d\u53ef\u7528",0),D()},D=()=>{null!==I&&(window.clearInterval(I),I=null)};return m.addEventListener("click",()=>k(!0)),A.addEventListener("click",()=>k(!1)),E.addEventListener("click",async()=>{if(T()&&!_&&(U||(await L(),T()&&U))){R("collect"),P("info","\u6b63\u5728\u91c7\u96c6\u2026",0);try{let e=await y();P("success",`\u91c7\u96c6\u6210\u529f\uff1a${e.title||"\u672a\u77e5"}\uff0c\u6b63\u5728\u6253\u5f00 Noon Catalog\u2026`,2500)}catch(e){P("error",h(e),5e3)}finally{R(null)}}}),S||b.addEventListener("click",async()=>{if(T()&&!_&&(U||(await L(),T()&&U))){R("sell"),P("info","\u6b63\u5728\u51c6\u5907\u8ddf\u5356\u2026",0);try{let e=await w();P("success",`\u8ddf\u5356\u6570\u636e\u51c6\u5907\u6210\u529f\uff1a${e.title||"\u672a\u77e5"}\uff0c\u6b63\u5728\u6253\u5f00 Noon Catalog\u2026`,2500)}catch(e){P("error",h(e),5e3)}finally{R(null)}}}),k(!1),L(),(()=>{if(!T())return;if(f()){N();return}let e=0;I=window.setInterval(()=>{if(e+=500,!T()||O){D();return}if(f()){N();return}e>=1e4&&D()},500)})(),{sku:e,applyPermission:L,destroy:()=>{if(D(),C){try{window.clearTimeout(C)}catch{}C=null}try{r.remove()}catch{}}}}let x=Promise.resolve(),S=()=>x=x.then(A).catch(A);async function A(){let e=m(window.location.href);if(!e){E();let e=document.getElementById(c);if(e)try{e.remove()}catch{}return}if(p?.sku===e){let t=document.getElementById(c);t||(E(),p=b(e));return}E(),p=b(e)}function T(){(function(){let e=window;if(!e[d]){e[d]=!0;try{chrome.storage.local.onChanged.addListener(e=>{let t=!!e[a.NOON_PARTNER_CODE_STORAGE_KEY]||!!e[n.STORAGE_KEYS.AUTH_TOKEN]||!!e[n.STORAGE_KEYS.USER_INFO]||!!e[n.STORAGE_KEYS.IS_AUTHENTICATED]||!!e[n.STORAGE_KEYS.LOGIN_TIME];t&&p?.applyPermission()})}catch{}}})(),function(){let e=window;if(e[u])return;let t=window.location.href,r=()=>{S()};window.addEventListener("popstate",r),window.addEventListener("hashchange",r);let o=window.setInterval(()=>{let e=window.location.href,r=m(e),o=!!r&&!document.getElementById(c);(e!==t||o)&&(t=e,S())},700);e[u]=o,S()}()}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",T,{once:!0}):T()},{"../background/types":"PieoM","../constants/partnerCode":"j19Rj","../services/api":"kD7wG","../utils/partnerContextClient":"44yHH","@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}],PieoM:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"STORAGE_KEYS",()=>n),o.export(r,"AUTH_CONFIG",()=>a),o.export(r,"API_CONFIG",()=>s);let n={AUTH_TOKEN:"authToken",USER_INFO:"userInfo",LOGIN_TIME:"loginTime",IS_AUTHENTICATED:"isAuthenticated"},a={TOKEN_EXPIRY_HOURS:720},s={CATALOG_BASE_URL:"https://noon-catalog.noon.partners"}},{"@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}],e86qr:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],j19Rj:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"NOON_PARTNER_CODE_STORAGE_KEY",()=>n);let n="NOON_PARTNER_CODE"},{"@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}],kD7wG:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"API_ENDPOINTS",()=>c),o.export(r,"NoonAPIClient",()=>d),o.export(r,"ApiError",()=>p),o.export(r,"extractSkuFromNoonUrl",()=>h),o.export(r,"fetchProductDetails",()=>f),o.export(r,"fetchProductDetailsWithHeaders",()=>g),o.export(r,"fetchProductTitle",()=>y),o.export(r,"fetchProductVariants",()=>w),o.export(r,"convertNoonUrlToApiUrl",()=>E),o.export(r,"haleemyRequest",()=>b),o.export(r,"submitAlibabaHtmlDetail",()=>x),o.export(r,"submitProductDetailHtml",()=>S),o.export(r,"submitAmazonProductDetailHtml",()=>A),o.export(r,"haleemyRequestSW",()=>T),o.export(r,"PROCESSING_TIME_OPTIONS",()=>v),o.export(r,"fetchFBPWarehouse",()=>_),o.export(r,"getCategoryList",()=>C),o.export(r,"recommendCate",()=>I),o.export(r,"apiClient",()=>U);var n=e("../background/storage"),a=e("../background/types"),s=e("../utils/debug"),i=e("../utils/messaging"),l=e("../utils/security");let c={LOGIN:"https://super.haleemy.com/api/customer/login",CUSTOMER_DETAIL:"https://super.haleemy.com/api/customer/detail",WAREHOUSE:"https://super.haleemy.com/api/customer/warehouse",GPT_SKU_TITLE:"https://super.haleemy.com/api/gpt/v1/chat/skutitle",GPT_TRANSLATE:"https://super.haleemy.com/api/gpt/v1/chat/batch_translate",ALIBABA_HTML_DETAIL:"https://super.haleemy.com/api/alibaba/html_detail",ALIBABA_TRANSLATE_IMG:"https://super.haleemy.com/api/alibaba/translate_img",AMAZON_HTML_DETAIL:"https://super.haleemy.com/api/amazon/html_msg",SKU_LIST:"https://api.noon.partners/v1/sku/list",SKU_UPDATE:"https://api.noon.partners/v1/sku/update",SKU_STATUS:"https://api.noon.partners/v1/sku/status"},u={"Content-Type":"application/json","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",Accept:"application/json, text/plain, */*","Accept-Language":"en-US,en;q=0.9","Cache-Control":"no-cache",Pragma:"no-cache"};class d{constructor(){this.authToken=null,this.loadAuthToken()}async loadAuthToken(){(0,s.debugLog)("API Client: \u52a0\u8f7d\u8ba4\u8bc1token");try{let e=await (0,l.secureRetrieve)(a.STORAGE_KEYS.AUTH_TOKEN);this.authToken=e||null,(0,s.debugLog)("API Client: token\u52a0\u8f7d\u6210\u529f",{hasToken:!!this.authToken})}catch(e){(0,s.debugError)("API Client: \u52a0\u8f7dtoken\u5931\u8d25",e)}}setAuthToken(e){this.authToken=e}getHeaders(e=!0){let t={...u};return e&&this.authToken&&(t.Authorization=`Bearer ${this.authToken}`),t}async request(e,t={},r=!0){return(0,s.debugLog)("API \u8bf7\u6c42\u5f00\u59cb",{url:e,method:t.method||"GET",includeAuth:r}),(0,s.measurePerformance)(`API-${t.method||"GET"}-${e}`,async()=>{try{let o=await (0,s.debugFetch)(e,{...t,headers:{...this.getHeaders(r),...t.headers}}),n=await o.json();if(!o.ok)throw(0,s.debugError)("API \u8bf7\u6c42\u5931\u8d25",{url:e,status:o.status,statusText:o.statusText,data:(0,s.safeLog)(n)}),new p(n.message||`HTTP ${o.status}: ${o.statusText}`,o.status,n);return(0,s.debugLog)("API \u8bf7\u6c42\u6210\u529f",{url:e,status:o.status}),{success:!0,data:n,status:o.status}}catch(t){if((0,s.debugError)("API \u8bf7\u6c42\u5f02\u5e38",{url:e,error:t}),t instanceof p)throw t;throw new p(t instanceof Error?t.message:"Unknown error occurred",0,null)}})}async getSKUList(e){let t=new URLSearchParams;e&&Object.entries(e).forEach(([e,r])=>{null!=r&&t.append(e,String(r))});let r=`${c.SKU_LIST}?${t.toString()}`;return this.request(r)}async updateSKUStatus(e,t){return this.request(c.SKU_STATUS,{method:"PUT",body:JSON.stringify({sku_id:e,status:t})})}async batchUpdateSKUStatus(e){return this.request(`${c.SKU_STATUS}/batch`,{method:"PUT",body:JSON.stringify({updates:e})})}}class p extends Error{constructor(e,t,r){super(e),this.status=t,this.data=r,this.name="ApiError"}}function h(e){try{let t=new URL(e),r=t.pathname,o=r.replace(/^\//,"").replace(/\/p\/?$/,"");o=o.replace(/^[a-z]+-[a-z]{2}\//,"");let n=o.split("/");if(n.length<2)throw Error("URL\u683c\u5f0f\u4e0d\u6b63\u786e\uff0c\u65e0\u6cd5\u63d0\u53d6SKU");let a=n[n.length-1],s=n.slice(0,-1).join("/");if(!/^[A-Z0-9]+$/.test(a))throw Error(`\u63d0\u53d6\u7684SKU\u683c\u5f0f\u4e0d\u6b63\u786e: ${a}`);return{sku:a,productName:s,fullPath:o}}catch(e){throw Error(`SKU\u63d0\u53d6\u5931\u8d25: ${e instanceof Error?e.message:"Unknown error"}`)}}function m(e){try{let t=new URL(e).pathname,r=t.split("/").filter(Boolean)[0]||"",o=r.match(/^([a-z]+)-([a-z]{2})$/);if(o){let e=o[1],t=o[2],r={uae:"ae",saudi:"sa"}[e];if(r)return`${t}-${r}`}}catch{}return"en-sa"}async function f(e){return g(e)}async function g(t,r){try{if(!t.includes("noon.com")||!t.includes("/p/"))throw Error("\u8bf7\u8f93\u5165\u6709\u6548\u7684 Noon \u4ea7\u54c1\u9875\u9762 URL");let o=new URL(t),n=o.pathname,a=o.searchParams,s=n.replace(/^\//,"").replace(/\/p\/?$/,"");s=s.replace(/^[a-z]+-[a-z]{2}\//,"");let i=`https://noon-catalog.noon.partners/_svc/catalog/api/u/${s}/p`,l=new URL(i);a.forEach((e,t)=>{l.searchParams.set(t,e)});let{sendMessage:c}=await e("4105d7b7f9c4a16f"),u={Accept:"application/json","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","X-Platform":"web","X-Lang":"en","X-Locale":m(t)},d={...u,...r},p=await c({action:"httpRequest",url:l.toString(),method:"GET",headers:d});if(!p.success)throw Error(`API \u8bf7\u6c42\u5931\u8d25: ${p.error}`);let h=p.data;if(!h.product)throw Error("\u65e0\u6cd5\u4ece\u54cd\u5e94\u4e2d\u83b7\u53d6\u4ea7\u54c1\u4fe1\u606f");let f=h.product,g=f.product_title,y=f.sku,w=f.brand,E=f.groups||[];if(!g)throw Error("\u65e0\u6cd5\u4ece\u54cd\u5e94\u4e2d\u83b7\u53d6\u4ea7\u54c1\u6807\u9898");let b=null,x=null;if(f.variants&&f.variants.length>0){let e=f.variants[0];if(e.offers&&e.offers.length>0){let t=e.offers[0];b=t.price||null,x=t.sale_price||null}}let S=function(e){let t=[];if(!e||0===e.length)return console.log("\u4ea7\u54c1\u6ca1\u6709 groups \u6570\u636e"),t;let r=e.find(e=>"color"===e.code);return r&&r.options&&r.options.length>0?(console.log(`\u627e\u5230\u989c\u8272\u53d8\u4f53\u7ec4: ${r.name}\uff0c\u5305\u542b ${r.options.length} \u4e2a\u9009\u9879`),r.options.forEach(e=>{t.push({name:e.name,sku:e.sku,attributes:{color:e.name,isAvailable:1===e.is_available,url:e.url,offerCode:e.offer_code,imageUrl:e.image_key?`https://f.nooncdn.com/p/${e.image_key}`:null}})}),console.log("\u63d0\u53d6\u5230\u7684\u989c\u8272\u53d8\u4f53:",t.map(e=>`${e.name} (${e.sku})`))):(console.log('\u672a\u627e\u5230 code \u4e3a "color" \u7684\u53d8\u4f53\u7ec4'),e.forEach(e=>{console.log(`\u53ef\u7528\u7684\u53d8\u4f53\u7ec4: ${e.name} (code: ${e.code})`)})),t}(E),A=[];f.feature_bullets&&Array.isArray(f.feature_bullets)&&f.feature_bullets.forEach(e=>{e&&"string"==typeof e&&e.trim()&&A.push(e.trim())});let T=[];return f.image_keys&&Array.isArray(f.image_keys)&&f.image_keys.forEach(e=>{if(e&&"string"==typeof e){let t;t=e.startsWith("http")?e:`https://f.nooncdn.com/p/${e}`,T.push(function(e){if(!e||"string"!=typeof e)return e;try{let t=new URL(e),r=t.pathname,o=[".jpg",".jpeg",".png",".webp",".gif"].some(e=>r.toLowerCase().endsWith(e));o||(t.pathname=r+".jpg");let n=t.searchParams;return n.set("width","660"),t.toString()}catch(o){console.warn("[normalizeNoonImageUrl] URL \u89e3\u6790\u5931\u8d25\uff0c\u4f7f\u7528\u7b80\u5355\u5904\u7406:",o);let t=[".jpg",".jpeg",".png",".webp",".gif"].some(t=>e.toLowerCase().includes(t)),r=e;if(!t){let[t,o]=e.split("?");r=t+".jpg",o&&(r+="?"+o)}if(r.includes("?")){let[e,t]=r.split("?"),o=new URLSearchParams(t);o.set("width","660"),r=e+"?"+o.toString()}else r+="?width=660";return r}}(t))}}),{title:g,price:b,salePrice:x,sku:y,brand:w,groups:E,variants:S,rawData:h,featureBullets:A.length>0?A:void 0,productImages:T.length>0?T:void 0}}catch(e){throw console.error("\u83b7\u53d6\u4ea7\u54c1\u8be6\u7ec6\u4fe1\u606f\u5931\u8d25:",e),e instanceof Error?e:Error("\u83b7\u53d6\u4ea7\u54c1\u8be6\u7ec6\u4fe1\u606f\u65f6\u53d1\u751f\u672a\u77e5\u9519\u8bef")}}async function y(e){try{let t=await f(e);return t.title}catch(e){throw console.error("\u83b7\u53d6\u4ea7\u54c1\u6807\u9898\u5931\u8d25:",e),e instanceof Error?e:Error("\u83b7\u53d6\u4ea7\u54c1\u6807\u9898\u65f6\u53d1\u751f\u672a\u77e5\u9519\u8bef")}}async function w(e){try{if(!e.includes("noon.com")||!e.includes("/p/"))throw Error("\u8bf7\u8f93\u5165\u6709\u6548\u7684 Noon \u4ea7\u54c1\u9875\u9762 URL");let t=new URL(e),r=t.pathname,o=t.searchParams,n=r.replace(/^\//,"").replace(/\/p\/?$/,"");n=n.replace(/^[a-z]+-[a-z]{2}\//,"");let a=`https://noon-catalog.noon.partners/_svc/catalog/api/u/${n}/p`,s=new URL(a);o.forEach((e,t)=>{s.searchParams.set(t,e)});let i={Accept:"application/json","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Accept-Language":"en-US,en;q=0.9","Cache-Control":"no-cache",Pragma:"no-cache","X-Platform":"web","X-Lang":"en","X-Locale":m(e)},l=await fetch(s.toString(),{method:"GET",headers:i});if(!l.ok)throw Error(`API \u8bf7\u6c42\u5931\u8d25: ${l.status} ${l.statusText}`);let c=await l.json(),u=[],d=c.product;return d.groups&&d.groups.length>0&&d.groups.forEach(e=>{e.options&&e.options.length>0&&e.options.forEach(t=>{u.push({variantId:t.sku,variantName:t.name,variantType:e.name,variantCode:e.code,isAvailable:1===t.is_available,url:t.url,offerCode:t.offer_code,imageUrl:t.image_key?`https://f.nooncdn.com/p/${t.image_key}`:null})})}),0===u.length&&d.variants&&d.variants.length>0&&d.variants.forEach(e=>{u.push({variantId:e.sku,variantName:e.variant||"\u9ed8\u8ba4\u53d8\u4f53",variantType:"default",variantCode:"default",isAvailable:!0,url:null,offerCode:null,imageUrl:null})}),{success:!0,productInfo:{sku:d.sku,title:d.product_title,brand:d.brand,brandCode:d.brand_code,category:d.category_code,breadcrumbs:d.breadcrumbs||[]},variants:u,totalVariants:u.length,apiUrl:s.toString(),originalUrl:e}}catch(e){throw console.error("\u83b7\u53d6\u5546\u54c1\u53d8\u4f53\u5931\u8d25:",e),e instanceof Error?e:Error("\u83b7\u53d6\u5546\u54c1\u53d8\u4f53\u65f6\u53d1\u751f\u672a\u77e5\u9519\u8bef")}}function E(e){try{let t=new URL(e),r=t.pathname,o=t.searchParams,n=r.replace(/^\//,"").replace(/\/p\/?$/,"");n=n.replace(/^[a-z]+-[a-z]{2}\//,"");let a=`https://noon-catalog.noon.partners/_svc/catalog/api/u/${n}/p`,s={};o.forEach((e,t)=>{s[t]=e});let i=new URL(a);return o.forEach((e,t)=>{i.searchParams.set(t,e)}),{success:!0,apiUrl:a,apiUrlWithParams:i.toString(),queryParams:s,originalUrl:e,productPath:n}}catch(e){throw Error(`URL\u89e3\u6790\u5931\u8d25: ${e instanceof Error?e.message:"\u672a\u77e5\u9519\u8bef"}`)}}async function b(e,t={}){let r=await (0,l.secureRetrieve)("authToken");if(!r)throw Error("\u8bf7\u5148\u767b\u5f55\u540e\u518d\u4f7f\u7528");let o=await (0,i.sendMessage)({action:"httpRequest",url:e,method:t.method||"GET",headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",Token:r,...t.headers},body:t.body});if(!o.success)throw Error(`API\u8bf7\u6c42\u5931\u8d25: ${o.error}`);return o.data}async function x(e){return S(e)}async function S(e){return b(c.ALIBABA_HTML_DETAIL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:e})})}async function A(e){return b(c.AMAZON_HTML_DETAIL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:e})})}async function T(e,t,r={}){let o=await (0,n.getAuthStatus)();if(o.expired)throw await (0,n.clearAuthData)(),Error("\u767b\u5f55\u5df2\u8fc7\u671f\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55");let a=await fetch(e,{method:r.method||"GET",headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",Token:t,...r.headers},body:r.body,cache:"no-store",referrerPolicy:"no-referrer"});if(!a.ok)throw Error(`API\u8bf7\u6c42\u5931\u8d25: ${a.status}`);let s=await a.json();if(401===s.code&&s.msg?.includes("expired"))throw await (0,n.clearAuthData)(),Error("\u767b\u5f55\u5df2\u8fc7\u671f\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55");return s}let v=[{value:0,label:"same day"},{value:1,label:"1 Day"},{value:2,label:"2 Day"},{value:3,label:"3 Day"},{value:4,label:"4 Day"},{value:5,label:"5 Day"},{value:6,label:"6 Day"},{value:7,label:"7 Day"},{value:8,label:"8 Day"},{value:9,label:"9 Day"},{value:10,label:"10 Day"},{value:11,label:"11 Day"},{value:12,label:"12 Day"},{value:13,label:"13 Day"},{value:14,label:"14 Day"},{value:15,label:"15 Day"},{value:16,label:"16 Day"},{value:17,label:"17 Day"},{value:18,label:"18 Day"},{value:19,label:"19 Day"},{value:20,label:"20 Day"},{value:21,label:"21 Day"},{value:22,label:"22 Day"},{value:23,label:"23 Day"},{value:24,label:"24 Day"},{value:25,label:"25 Day"},{value:26,label:"26 Day"},{value:27,label:"27 Day"},{value:28,label:"28 Day"},{value:29,label:"29 Day"},{value:30,label:"30 Day"}];async function _(e,t){try{let r=`${c.WAREHOUSE}?cid=${e}&country=${{sa:"saudi",ae:"uae"}[t]||t}`,o=await b(r);if(0!==o.code)throw Error(`\u83b7\u53d6FBP\u4ed3\u5e93\u5931\u8d25: ${o.msg}`);return o.data.Rows}catch(e){throw console.error("[fetchFBPWarehouse] \u83b7\u53d6FBP\u4ed3\u5e93\u5217\u8868\u5931\u8d25:",e),e instanceof Error?e:Error("\u83b7\u53d6FBP\u4ed3\u5e93\u65f6\u53d1\u751f\u672a\u77e5\u9519\u8bef")}}async function C(e={}){let t=new URLSearchParams;t.append("keyword",e.keyword||""),t.append("page_index",String(e.page_index||1)),t.append("page_size",String(e.page_size||30));let r=`https://super.haleemy.com/api/cate/list?${t.toString()}`;return b(r)}async function I(e){return b("https://super.haleemy.com/api/amazon/recommend_cate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}let U=new d},{"../background/storage":"d5Ogk","../background/types":"PieoM","../utils/debug":"joY53","../utils/messaging":"c8pCH","../utils/security":"cYUCX","4105d7b7f9c4a16f":"c8pCH","@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}],d5Ogk:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"setAuthData",()=>s),o.export(r,"updateUserInfo",()=>i),o.export(r,"getAuthStatus",()=>l),o.export(r,"getAuthToken",()=>c),o.export(r,"clearAuthData",()=>u),o.export(r,"isAuthenticated",()=>d),o.export(r,"setStorageData",()=>p),o.export(r,"getStorageData",()=>h),o.export(r,"removeStorageData",()=>m);var n=e("../utils/security"),a=e("./types");async function s(e){try{let t=Date.now();await Promise.all([(0,n.secureStore)(a.STORAGE_KEYS.AUTH_TOKEN,e.token),(0,n.secureStore)(a.STORAGE_KEYS.USER_INFO,e.userInfo),(0,n.secureStore)(a.STORAGE_KEYS.LOGIN_TIME,t),(0,n.secureStore)(a.STORAGE_KEYS.IS_AUTHENTICATED,!0)]),console.log("Authentication data stored successfully with timestamp:",t)}catch(e){throw console.error("Failed to store authentication data:",e),e}}async function i(e){try{await (0,n.secureStoreIfChanged)(a.STORAGE_KEYS.USER_INFO,e)}catch(e){throw console.error("Failed to update user info:",e),e}}async function l(){try{let[e,t,r,o]=await Promise.all([(0,n.secureRetrieve)(a.STORAGE_KEYS.AUTH_TOKEN),(0,n.secureRetrieve)(a.STORAGE_KEYS.USER_INFO),(0,n.secureRetrieve)(a.STORAGE_KEYS.LOGIN_TIME),(0,n.secureRetrieve)(a.STORAGE_KEYS.IS_AUTHENTICATED)]),s=!!r&&Date.now()-r>36e5*a.AUTH_CONFIG.TOKEN_EXPIRY_HOURS;if(s)return await u(),{isAuthenticated:!1,expired:!0};return{isAuthenticated:!!o&&!!e&&!!t,userInfo:t||null,loginTime:r||null}}catch(e){throw console.error("Failed to get authentication status:",e),e}}async function c(){try{let e=await (0,n.secureRetrieve)(a.STORAGE_KEYS.AUTH_TOKEN);return e||null}catch(e){return console.error("Failed to get auth token:",e),null}}async function u(){try{await Promise.all([(0,n.secureRemove)(a.STORAGE_KEYS.AUTH_TOKEN),(0,n.secureRemove)(a.STORAGE_KEYS.USER_INFO),(0,n.secureRemove)(a.STORAGE_KEYS.LOGIN_TIME),(0,n.secureRemove)(a.STORAGE_KEYS.IS_AUTHENTICATED)]),console.log("Authentication data cleared successfully")}catch(e){throw console.error("Failed to clear authentication data:",e),e}}async function d(){let e=await l();return e.isAuthenticated&&!e.expired}async function p(e,t){try{await (0,n.secureStore)(e,t)}catch(t){throw console.error(`Failed to set storage data for key: ${e}`,t),t}}async function h(e){try{let t=await (0,n.secureRetrieve)(e);return t||null}catch(t){return console.error(`Failed to get storage data for key: ${e}`,t),null}}async function m(e){try{await (0,n.secureRemove)(e)}catch(t){throw console.error(`Failed to remove storage data for key: ${e}`,t),t}}},{"../utils/security":"cYUCX","./types":"PieoM","@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}],cYUCX:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function n(e){try{return btoa(encodeURIComponent(e))}catch(t){return console.error("Encode error:",t),e}}function a(e){try{return decodeURIComponent(atob(e))}catch(t){return console.error("Decode error:",t),e}}function s(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}async function i(e,t){try{let r=new TextEncoder,o=r.encode(e+t),n=await crypto.subtle.digest("SHA-256",o),a=Array.from(new Uint8Array(n));return a.map(e=>e.toString(16).padStart(2,"0")).join("")}catch(t){return console.error("Hash password error:",t),e}}async function l(e,t,r){try{let o=await i(e,r);return o===t}catch(e){return console.error("Verify password error:",e),!1}}async function c(e,t){try{let r=JSON.stringify(t),o=n(r),a=await h(r);await chrome.storage.local.set({[e]:{data:o,timestamp:Date.now(),checksum:a}})}catch(e){throw console.error("Secure store error:",e),Error("Failed to store data securely")}}async function u(e,t){try{let r=JSON.stringify(t),o=await h(r);if(!o)return await c(e,t),!0;let a=await chrome.storage.local.get([e]),s=a[e];if(s?.checksum&&s.checksum===o)return!1;let i=n(r);return await chrome.storage.local.set({[e]:{data:i,timestamp:Date.now(),checksum:o}}),!0}catch(e){throw console.error("Secure store-if-changed error:",e),Error("Failed to store data securely")}}async function d(e){try{let t=await chrome.storage.local.get([e]),r=t[e];if(!r||!r.data)return null;let o=a(r.data),n=await h(o);if(r.checksum!==n)return console.warn("Data integrity check failed for key:",e),await chrome.storage.local.remove([e]),null;return JSON.parse(o)}catch(e){return console.error("Secure retrieve error:",e),null}}async function p(e){try{await chrome.storage.local.remove([e])}catch(e){console.error("Secure remove error:",e)}}async function h(e){try{let t=new TextEncoder,r=t.encode(e),o=await crypto.subtle.digest("SHA-256",r),n=Array.from(new Uint8Array(o));return n.map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return console.error("Generate checksum error:",e),""}}function m(e){return e.trim().replace(/[<>"'&]/g,"").substring(0,1e3)}function f(e){try{let t=new URL(e);if("https:"!==t.protocol)return!1;return["noon.com","noon.partners","login.noon.partners","api.noon.partners"].some(e=>t.hostname===e||t.hostname.endsWith("."+e))}catch{return!1}}function g(e=!1,t){let r={"Content-Type":"application/json",Accept:"application/json","Cache-Control":"no-cache",Pragma:"no-cache","X-Requested-With":"XMLHttpRequest"};return e&&t&&(r.Authorization=`Bearer ${t}`),r}function y(e){if(!e||"object"!=typeof e)return!1;let t=JSON.stringify(e);return![/<script/i,/javascript:/i,/on\w+\s*=/i,/eval\s*\(/i,/function\s*\(/i].some(e=>e.test(t))}o.defineInteropFlag(r),o.export(r,"encodeString",()=>n),o.export(r,"decodeString",()=>a),o.export(r,"generateSalt",()=>s),o.export(r,"hashPassword",()=>i),o.export(r,"verifyPassword",()=>l),o.export(r,"secureStore",()=>c),o.export(r,"secureStoreIfChanged",()=>u),o.export(r,"secureRetrieve",()=>d),o.export(r,"secureRemove",()=>p),o.export(r,"sanitizeInput",()=>m),o.export(r,"isSecureUrl",()=>f),o.export(r,"generateSecureHeaders",()=>g),o.export(r,"validateApiResponse",()=>y),o.export(r,"RateLimiter",()=>w),o.export(r,"loginRateLimiter",()=>E),o.export(r,"maskSensitiveData",()=>b),o.export(r,"secureLog",()=>x),o.export(r,"logError",()=>S);class w{constructor(e=5,t=9e5){this.maxAttempts=e,this.windowMs=t,this.attempts=new Map}isAllowed(e){let t=Date.now(),r=this.attempts.get(e)||[],o=r.filter(e=>t-e<this.windowMs);return!(o.length>=this.maxAttempts)&&(o.push(t),this.attempts.set(e,o),!0)}reset(e){this.attempts.delete(e)}getRemainingAttempts(e){let t=this.attempts.get(e)||[],r=Date.now(),o=t.filter(e=>r-e<this.windowMs);return Math.max(0,this.maxAttempts-o.length)}getTimeUntilReset(e){let t=this.attempts.get(e)||[];if(0===t.length)return 0;let r=Math.min(...t)+this.windowMs;return Math.max(0,r-Date.now())}}let E=new w(5,9e5);function b(e){if("object"!=typeof e||null===e)return e;let t=["password","token","secret","key","auth"],r={...e};for(let e in r)t.some(t=>e.toLowerCase().includes(t))?"string"==typeof r[e]&&r[e].length>0&&(r[e]="*".repeat(Math.min(r[e].length,8))):"object"==typeof r[e]&&(r[e]=b(r[e]));return r}function x(e,t){let r=t?b(t):void 0;console.log(`[Noon Extension] ${e}`,r)}function S(e,t){let r=e instanceof Error?e.message:String(e),o={error:r,context:t||"Unknown",timestamp:new Date().toISOString(),userAgent:navigator.userAgent};console.error("[Noon Extension Error]",o)}},{"@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}],joY53:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"DEBUG",()=>n),o.export(r,"debugLog",()=>a),o.export(r,"debugError",()=>s),o.export(r,"debugWarn",()=>i),o.export(r,"logDebugInfo",()=>l),o.export(r,"measurePerformance",()=>c),o.export(r,"measurePerformanceSync",()=>u),o.export(r,"logMemoryUsage",()=>d),o.export(r,"safeLog",()=>p),o.export(r,"debugFetch",()=>h),o.export(r,"debugSendMessage",()=>m),o.export(r,"createComponentDebugger",()=>f),o.export(r,"isDebugMode",()=>g),o.export(r,"assertDebugMode",()=>y);let n=!1;function a(e,t){if(n){let r=new Date().toISOString();console.log(`[DEBUG ${r}] ${e}`,t)}}function s(e,t){if(n){let r=new Date().toISOString();console.error(`[ERROR ${r}] ${e}`,t)}}function i(e,t){if(n){let r=new Date().toISOString();console.warn(`[WARN ${r}] ${e}`,t)}}function l(e){n&&console.log("[\u8c03\u8bd5\u4fe1\u606f]",{...e,timestamp:new Date(e.timestamp).toISOString()})}function c(e,t){if(!n)return t();let r=performance.now();return t().finally(()=>{let t=performance.now()-r;a(`[\u6027\u80fd] ${e}: ${t.toFixed(2)}ms`)})}function u(e,t){if(!n)return t();let r=performance.now();try{let o=t(),n=performance.now()-r;return a(`[\u6027\u80fd] ${e}: ${n.toFixed(2)}ms`),o}catch(o){let t=performance.now()-r;throw s(`[\u6027\u80fd\u5f02\u5e38] ${e}: ${t.toFixed(2)}ms`,o),o}}function d(){if(n&&performance.memory){let e={used:Math.round(performance.memory.usedJSHeapSize/1024/1024),total:Math.round(performance.memory.totalJSHeapSize/1024/1024),limit:Math.round(performance.memory.jsHeapSizeLimit/1024/1024)};a("\u5185\u5b58\u4f7f\u7528\u60c5\u51b5 (MB)",e)}}function p(e){if(!n)return{};let t={...e};return["password","token","apiKey","secret","auth"].forEach(e=>{t[e]&&(t[e]="***")}),console.log("[\u5b89\u5168\u65e5\u5fd7]",t),t}async function h(e,t={}){n&&a("API\u8bf7\u6c42\u5f00\u59cb",{url:e,method:t.method||"GET"});let r=performance.now();try{let o=await fetch(e,t),s=performance.now()-r;return n&&a("API\u8bf7\u6c42\u5b8c\u6210",{url:e,status:o.status,statusText:o.statusText,duration:`${s.toFixed(2)}ms`,headers:Object.fromEntries(o.headers.entries())}),o}catch(o){let t=performance.now()-r;throw s("API\u8bf7\u6c42\u5931\u8d25",{url:e,duration:`${t.toFixed(2)}ms`,error:o.message}),o}}async function m(e){n&&a("\u53d1\u9001Chrome\u6d88\u606f",p(e));try{let t=await chrome.runtime.sendMessage(e);return n&&a("\u6536\u5230Chrome\u6d88\u606f\u54cd\u5e94",p(t)),t}catch(t){throw s("Chrome\u6d88\u606f\u53d1\u9001\u5931\u8d25",{message:p(e),error:t}),t}}function f(e){return{logAction:(t,r)=>{l({component:e,action:t,data:p(r),timestamp:Date.now()})},logError:(t,r)=>{s(`[${e}] ${t}`,r)},measureAction:(t,r)=>c(`${e}.${t}`,r)}}function g(){return n}function y(){if(!n)throw Error("\u6b64\u529f\u80fd\u4ec5\u5728\u8c03\u8bd5\u6a21\u5f0f\u4e0b\u53ef\u7528")}},{"@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}],c8pCH:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"sendMessage",()=>a),o.export(r,"sendMessageToTab",()=>s),o.export(r,"getCurrentTab",()=>i),o.export(r,"isNoonSite",()=>l),o.export(r,"setStorage",()=>c),o.export(r,"getStorage",()=>u),o.export(r,"removeStorage",()=>d),o.export(r,"clearStorage",()=>p),o.export(r,"onStorageChanged",()=>h),o.export(r,"formatError",()=>m),o.export(r,"delay",()=>f),o.export(r,"retry",()=>g),o.export(r,"isValidEmail",()=>y),o.export(r,"validatePassword",()=>w),o.export(r,"isExtensionContextValid",()=>E),o.export(r,"isContextInvalidationError",()=>b),o.export(r,"getEnhancedErrorMessage",()=>x),o.export(r,"sendMessageWithRetry",()=>S),o.export(r,"generateId",()=>A),o.export(r,"safeJsonParse",()=>T),o.export(r,"formatDate",()=>v);var n=e("./debug");async function a(e){return(0,n.debugLog)("\u53d1\u9001Chrome\u6d88\u606f",(0,n.safeLog)(e)),(0,n.measurePerformance)("sendMessage",async()=>new Promise(t=>{if(!chrome?.runtime?.id){t({success:!1,error:"Extension context invalidated. Please reload the extension."});return}try{chrome.runtime.sendMessage(e,r=>{if(chrome.runtime.lastError){let r=chrome.runtime.lastError.message;(0,n.debugError)("\u6d88\u606f\u53d1\u9001\u5931\u8d25",{request:(0,n.safeLog)(e),error:r}),r.includes("Extension context invalidated")||r.includes("message port closed")||r.includes("Receiving end does not exist")?t({success:!1,error:"\u6269\u5c55\u4e0a\u4e0b\u6587\u5df2\u5931\u6548\uff0c\u8bf7\u91cd\u65b0\u52a0\u8f7d\u6269\u5c55\u3002\u5982\u679c\u95ee\u9898\u6301\u7eed\u5b58\u5728\uff0c\u8bf7\u91cd\u542f\u6d4f\u89c8\u5668\u3002"}):t({success:!1,error:r})}else(0,n.debugLog)("\u6536\u5230Chrome\u6d88\u606f\u54cd\u5e94",(0,n.safeLog)(r)),t(r||{success:!1,error:"No response received"})})}catch(o){let r=o instanceof Error?o.message:String(o);(0,n.debugError)("\u6d88\u606f\u53d1\u9001\u5f02\u5e38",{request:(0,n.safeLog)(e),error:r}),t({success:!1,error:`\u6d88\u606f\u53d1\u9001\u5f02\u5e38: ${r}`})}}))}async function s(e,t){return new Promise(r=>{chrome.tabs.sendMessage(e,t,e=>{chrome.runtime.lastError?r({success:!1,error:chrome.runtime.lastError.message}):r(e||{success:!1,error:"No response received"})})})}async function i(){return new Promise(e=>{chrome.tabs.query({active:!0,currentWindow:!0},t=>{e(t[0]||null)})})}function l(e){try{let t=new URL(e);return t.hostname.includes("noon.com")||t.hostname.includes("noon.partners")}catch{return!1}}async function c(e){return(0,n.debugLog)("\u5b58\u50a8\u6570\u636e\u5230Chrome Storage",(0,n.safeLog)(e)),(0,n.measurePerformance)("setStorage",async()=>new Promise((t,r)=>{chrome.storage.local.set(e,()=>{if(chrome.runtime.lastError){let t=Error(chrome.runtime.lastError.message);(0,n.debugError)("\u5b58\u50a8\u6570\u636e\u5931\u8d25",{data:(0,n.safeLog)(e),error:t}),r(t)}else(0,n.debugLog)("\u6570\u636e\u5b58\u50a8\u6210\u529f"),t()})}))}async function u(e){return(0,n.debugLog)("\u4ece Chrome Storage \u83b7\u53d6\u6570\u636e",{keys:e}),(0,n.measurePerformance)("getStorage",async()=>new Promise((t,r)=>{chrome.storage.local.get(e,o=>{if(chrome.runtime.lastError){let t=Error(chrome.runtime.lastError.message);(0,n.debugError)("\u83b7\u53d6\u6570\u636e\u5931\u8d25",{keys:e,error:t}),r(t)}else(0,n.debugLog)("\u6570\u636e\u83b7\u53d6\u6210\u529f",(0,n.safeLog)(o)),t(o)})}))}async function d(e){return new Promise((t,r)=>{chrome.storage.local.remove(e,()=>{chrome.runtime.lastError?r(Error(chrome.runtime.lastError.message)):t()})})}async function p(){return new Promise((e,t)=>{chrome.storage.local.clear(()=>{chrome.runtime.lastError?t(Error(chrome.runtime.lastError.message)):e()})})}function h(e){chrome.storage.onChanged.addListener((t,r)=>{"local"===r&&e(t)})}function m(e){return e instanceof Error?e.message:"string"==typeof e?e:"Unknown error occurred"}function f(e){return new Promise(t=>setTimeout(t,e))}async function g(e,t=3,r=1e3){let o;for(let n=1;n<=t;n++)try{return await e()}catch(e){if(o=e,n===t)break;await f(r*n)}throw o}function y(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function w(e){let t=[];return e.length<6&&t.push("\u5bc6\u7801\u957f\u5ea6\u81f3\u5c116\u4f4d"),e.length>128&&t.push("\u5bc6\u7801\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7128\u4f4d"),{isValid:0===t.length,errors:t}}function E(){try{return!!chrome?.runtime?.id}catch{return!1}}function b(e){return["Extension context invalidated","message port closed","Receiving end does not exist","Could not establish connection","The message port closed before a response was received","\u6269\u5c55\u4e0a\u4e0b\u6587\u5df2\u5931\u6548"].some(t=>e.toLowerCase().includes(t.toLowerCase()))}function x(e){return b(e)?"\u6269\u5c55\u5df2\u91cd\u65b0\u52a0\u8f7d\uff0c\u8bf7\u5237\u65b0\u9875\u9762\u540e\u91cd\u8bd5\u3002\u5982\u679c\u95ee\u9898\u6301\u7eed\u5b58\u5728\uff0c\u8bf7\uff1a\n1. \u5173\u95ed\u5e76\u91cd\u65b0\u6253\u5f00\u6b64\u6807\u7b7e\u9875\n2. \u5728 chrome://extensions/ \u4e2d\u91cd\u65b0\u52a0\u8f7d\u6269\u5c55\n3. \u91cd\u542f\u6d4f\u89c8\u5668":e}async function S(e,t=2,r=1e3){let o="";for(let n=0;n<=t;n++)try{if(!E())throw Error("Extension context invalidated");let s=await a(e);if(s.success||!b(s.error||""))return s;if(o=s.error||"Unknown error",n===t)break;await f(r)}catch(e){if(o=e instanceof Error?e.message:String(e),n===t)break;await f(r)}return{success:!1,error:x(o)}}function A(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function T(e,t){try{return JSON.parse(e)}catch{return t}}function v(e){let t="string"==typeof e?new Date(e):e;return t.toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}},{"./debug":"joY53","@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}],"44yHH":[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"getPartnerContext",()=>a),o.export(r,"canUseCollectors",()=>s);var n=e("./messaging");async function a(){let e=await (0,n.sendMessage)({action:"getPartnerContext"});return e.success&&e.data?e.data:{isAuthenticated:!1,currentPartnerCode:null,nextStep:e.error||"\u65e0\u6cd5\u83b7\u53d6\u4e0a\u4e0b\u6587\u4fe1\u606f"}}function s(e){if(!e.isAuthenticated)return{allowed:!1,message:e.nextStep||"\u8bf7\u5148\u767b\u5f55\u540e\u518d\u4f7f\u7528",showNoonCatalogHint:!1};let t=!e.currentPartnerCode;return{allowed:!0,message:"\u5df2\u767b\u5f55\uff0c\u53ef\u4ee5\u91c7\u96c6",showNoonCatalogHint:t}}},{"./messaging":"c8pCH","@parcel/transformer-js/src/esmodule-helpers.js":"e86qr"}]},["l17v3"],"l17v3","parcelRequiredb96"),globalThis.define=t;