var foxBridge=(function(){var e,t=!((e=globalThis.browser)==null||(e=e.runtime)==null)&&e.id?globalThis.browser:globalThis.chrome;function n(e){"@babel/helpers - typeof";return n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n(e)}function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}function a(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=function(e){return e[e.DEBUG=0]=`DEBUG`,e[e.INFO=1]=`INFO`,e[e.WARN=2]=`WARN`,e[e.ERROR=3]=`ERROR`,e}({}),s={[o.DEBUG]:`#9E9E9E`,[o.INFO]:`#2196F3`,[o.WARN]:`#FF9800`,[o.ERROR]:`#F44336`},c={[o.DEBUG]:`DEBUG`,[o.INFO]:`INFO`,[o.WARN]:`WARN`,[o.ERROR]:`ERROR`},l=new class{constructor(){a(this,`level`,o.ERROR)}debug(...e){this.log(o.DEBUG,e)}info(...e){this.log(o.INFO,e)}warn(...e){this.log(o.WARN,e)}error(...e){this.log(o.ERROR,e)}log(e,t){if(e<this.level)return;let n=new Date().toLocaleTimeString(),r=[`color: ${s[e]}`,`font-weight: bold`,`padding: 2px 4px`,`border-radius: 2px`].join(`;`),i=`%c[${n}] ${c[e]}:`;this.getConsoleMethod(e).call(console,i,r,...t),o.ERROR}getConsoleMethod(e){switch(e){case o.DEBUG:return console.debug;case o.INFO:return console.info;case o.WARN:return console.warn;case o.ERROR:return console.error;default:return console.log}}};function u(e){return e==null||typeof e==`function`?{main:e}:e}var d=u(()=>{let e=`jlmkillmemkjkinffglnffekacoogndm`;function n(n){try{return t.runtime.connect(e,{name:`LF-${n}`})}catch(e){l.error(`connectToExtension failed: `+JSON.stringify(e));return}}function r(n,r){return new Promise((i,a)=>{try{if(n===`LF-analytics`){window.postMessage({evt:n,src:`lfx-chrome-widget`,dst:`lfx-chrome-content`,dat:r});return}t.runtime.sendMessage(e,{evt:n,src:`lfx-chrome-widget`,dst:`lfx-chrome-content`,dat:r},function(e){i(e)})}catch(e){a(`foxBridge ${n} error ${e}`)}})}window.addEventListener(`message`,e=>{if(e.data&&e.data.name===`LF-page-msg-response`){let t=window.foxBridge.messageQueue.get(e.data.msgId);t&&(t(e.data.response),window.foxBridge.messageQueue.delete(e.data.msgId))}});let i={messageQueue:new Map,connect:e=>n(e),getEnvironment:()=>r(`LF-getEnvironment`),switchWidget:(e,t,n)=>r(`LF-widgetSwitch`,{enable:e,sceneId:t,widgetId:n}),widgetsReady:()=>r(`LF-widgetsReady`),detectScene:e=>r(`LF-detectScene`,e),getLocale:()=>r(`LF-getLocale`),getDeviceId:()=>r(`LF-getDeviceId`),getOpenId:e=>r(`LF-getOpenId`,e),getFingerPrint:e=>r(`LF-getFingerPrint`,e),getVipFlag:()=>r(`LF-getVipFlag`),getUnionId:()=>r(`LF-getUnionId`),getScene:e=>r(`LF-getScene`,{sceneId:e}),setStorage:(e,t,n)=>r(`LF-setStorage`,{key:`${e}-${t}`,value:n}),getStorage:(e,t)=>r(`LF-getStorage`,`${e}-${t}`),removeWidget:e=>r(`LF-removeWidget`,e),getWidgetData:(e,t)=>r(`LF-getWidgetData`,{sid:e,wid:t}),request:(e,t,n=`raw`)=>r(`LF-request`,{wid:e,data:t,type:n}),amazonFav:(e,t,n)=>r(``,{wid:e,sid:t,asinId:n}),checkLogin:(e,t)=>r(`LF-checkLogin`,{sid:t,wid:e}),analytics:(e,t,n)=>r(`LF-analytics`,{event:e,params:t,method:n}),uploadFileTo1688:e=>r(`LF-upload-file-to-1688`,e),imageQueryFrom1688:e=>r(`LF-image-query-from-1688`,e),imageQueryFromAmz:e=>r(`LF-image-query-from-amz`,e),getStorageKV:(e,t)=>r(`LF-getStorageKeyValue`,{type:e,key:t})};return window.foxBridge=i,i}),f={debug:(...e)=>([...e],void 0),log:(...e)=>([...e],void 0),warn:(...e)=>([...e],void 0),error:(...e)=>([...e],void 0)};return(()=>{let e;try{e=d.main(),e instanceof Promise&&(e=e.catch(e=>{throw f.error(`The unlisted script "fox-bridge" crashed on startup!`,e),e}))}catch(e){throw f.error(`The unlisted script "fox-bridge" crashed on startup!`,e),e}return e})()})();
foxBridge;