Sorry, the diff of this file is too big to display
| var tradingviewBridge=(function(){"use strict";var ie=Object.defineProperty;var ae=(v,b,p)=>b in v?ie(v,b,{enumerable:!0,configurable:!0,writable:!0,value:p}):v[b]=p;var y=(v,b,p)=>ae(v,typeof b!="symbol"?b+"":b,p);function v(i){return i}function b(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var p={exports:{}},D=p.exports,j;function V(){return j||(j=1,(function(i,e){(function(r,n){n(i)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:D,function(r){if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)r.exports=globalThis.browser;else{const n="The message port closed before a response was received.",m=l=>{const u={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(u).length===0)throw new Error("api-metadata.json has not been included in browser-polyfill");class w extends WeakMap{constructor(t,g=void 0){super(g),this.createItem=t}get(t){return this.has(t)||this.set(t,this.createItem(t)),super.get(t)}}const ee=s=>s&&typeof s=="object"&&typeof s.then=="function",O=(s,t)=>(...g)=>{l.runtime.lastError?s.reject(new Error(l.runtime.lastError.message)):t.singleCallbackArg||g.length<=1&&t.singleCallbackArg!==!1?s.resolve(g[0]):s.resolve(g)},_=s=>s==1?"argument":"arguments",re=(s,t)=>function(o,...c){if(c.length<t.minArgs)throw new Error(`Expected at least ${t.minArgs} ${_(t.minArgs)} for ${s}(), got ${c.length}`);if(c.length>t.maxArgs)throw new Error(`Expected at most ${t.maxArgs} ${_(t.maxArgs)} for ${s}(), got ${c.length}`);return new Promise((d,x)=>{if(t.fallbackToNoCallback)try{o[s](...c,O({resolve:d,reject:x},t))}catch(a){console.warn(`${s} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,a),o[s](...c),t.fallbackToNoCallback=!1,t.noCallback=!0,d()}else t.noCallback?(o[s](...c),d()):o[s](...c,O({resolve:d,reject:x},t))})},q=(s,t,g)=>new Proxy(t,{apply(o,c,d){return g.call(c,s,...d)}});let N=Function.call.bind(Object.prototype.hasOwnProperty);const I=(s,t={},g={})=>{let o=Object.create(null),c={has(x,a){return a in s||a in o},get(x,a,h){if(a in o)return o[a];if(!(a in s))return;let A=s[a];if(typeof A=="function")if(typeof t[a]=="function")A=q(s,s[a],t[a]);else if(N(g,a)){let E=re(a,g[a]);A=q(s,s[a],E)}else A=A.bind(s);else if(typeof A=="object"&&A!==null&&(N(t,a)||N(g,a)))A=I(A,t[a],g[a]);else if(N(g,"*"))A=I(A,t[a],g["*"]);else return Object.defineProperty(o,a,{configurable:!0,enumerable:!0,get(){return s[a]},set(E){s[a]=E}}),A;return o[a]=A,A},set(x,a,h,A){return a in o?o[a]=h:s[a]=h,!0},defineProperty(x,a,h){return Reflect.defineProperty(o,a,h)},deleteProperty(x,a){return Reflect.deleteProperty(o,a)}},d=Object.create(s);return new Proxy(d,c)},K=s=>({addListener(t,g,...o){t.addListener(s.get(g),...o)},hasListener(t,g){return t.hasListener(s.get(g))},removeListener(t,g){t.removeListener(s.get(g))}}),se=new w(s=>typeof s!="function"?s:function(g){const o=I(g,{},{getContent:{minArgs:0,maxArgs:0}});s(o)}),U=new w(s=>typeof s!="function"?s:function(g,o,c){let d=!1,x,a=new Promise(k=>{x=function(f){d=!0,k(f)}}),h;try{h=s(g,o,x)}catch(k){h=Promise.reject(k)}const A=h!==!0&&ee(h);if(h!==!0&&!A&&!d)return!1;const E=k=>{k.then(f=>{c(f)},f=>{let B;f&&(f instanceof Error||typeof f.message=="string")?B=f.message:B="An unexpected error occurred",c({__mozWebExtensionPolyfillReject__:!0,message:B})}).catch(f=>{console.error("Failed to send onMessage rejected reply",f)})};return E(A?h:a),!0}),te=({reject:s,resolve:t},g)=>{l.runtime.lastError?l.runtime.lastError.message===n?t():s(new Error(l.runtime.lastError.message)):g&&g.__mozWebExtensionPolyfillReject__?s(new Error(g.message)):t(g)},W=(s,t,g,...o)=>{if(o.length<t.minArgs)throw new Error(`Expected at least ${t.minArgs} ${_(t.minArgs)} for ${s}(), got ${o.length}`);if(o.length>t.maxArgs)throw new Error(`Expected at most ${t.maxArgs} ${_(t.maxArgs)} for ${s}(), got ${o.length}`);return new Promise((c,d)=>{const x=te.bind(null,{resolve:c,reject:d});o.push(x),g.sendMessage(...o)})},ne={devtools:{network:{onRequestFinished:K(se)}},runtime:{onMessage:K(U),onMessageExternal:K(U),sendMessage:W.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:W.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},L={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return u.privacy={network:{"*":L},services:{"*":L},websites:{"*":L}},I(l,ne,u)};r.exports=m(chrome)}})})(p)),p.exports}var H=V();const S=b(H),z={matches:["https://*.tradingview.com/*"],runAt:"document_idle",main(){window.addEventListener("message",i=>{var r;if(i.source!==window)return;const e=i.data;if(!(!e||e.source!=="zesty-tv"))try{(r=S.runtime.sendMessage({type:"tv-detected",exchangeSymbol:e.exchangeSymbol??null}))==null||r.catch(()=>{})}catch{}})}};function C(i,...e){}const G={debug:(...i)=>C(console.debug,...i),log:(...i)=>C(console.log,...i),warn:(...i)=>C(console.warn,...i),error:(...i)=>C(console.error,...i)},M=class M extends Event{constructor(e,r){super(M.EVENT_NAME,{}),this.newUrl=e,this.oldUrl=r}};y(M,"EVENT_NAME",R("wxt:locationchange"));let F=M;function R(i){var e;return`${(e=S==null?void 0:S.runtime)==null?void 0:e.id}:tradingview-bridge:${i}`}function Z(i){let e,r;return{run(){e==null&&(r=new URL(location.href),e=i.setInterval(()=>{let n=new URL(location.href);n.href!==r.href&&(window.dispatchEvent(new F(n,r)),r=n)},1e3))}}}const T=class T{constructor(e,r){y(this,"isTopFrame",window.self===window.top);y(this,"abortController");y(this,"locationWatcher",Z(this));y(this,"receivedMessageIds",new Set);this.contentScriptName=e,this.options=r,this.abortController=new AbortController,this.isTopFrame?(this.listenForNewerScripts({ignoreFirstEvent:!0}),this.stopOldScripts()):this.listenForNewerScripts()}get signal(){return this.abortController.signal}abort(e){return this.abortController.abort(e)}get isInvalid(){return S.runtime.id==null&&this.notifyInvalidated(),this.signal.aborted}get isValid(){return!this.isInvalid}onInvalidated(e){return this.signal.addEventListener("abort",e),()=>this.signal.removeEventListener("abort",e)}block(){return new Promise(()=>{})}setInterval(e,r){const n=setInterval(()=>{this.isValid&&e()},r);return this.onInvalidated(()=>clearInterval(n)),n}setTimeout(e,r){const n=setTimeout(()=>{this.isValid&&e()},r);return this.onInvalidated(()=>clearTimeout(n)),n}requestAnimationFrame(e){const r=requestAnimationFrame((...n)=>{this.isValid&&e(...n)});return this.onInvalidated(()=>cancelAnimationFrame(r)),r}requestIdleCallback(e,r){const n=requestIdleCallback((...m)=>{this.signal.aborted||e(...m)},r);return this.onInvalidated(()=>cancelIdleCallback(n)),n}addEventListener(e,r,n,m){var l;r==="wxt:locationchange"&&this.isValid&&this.locationWatcher.run(),(l=e.addEventListener)==null||l.call(e,r.startsWith("wxt:")?R(r):r,n,{...m,signal:this.signal})}notifyInvalidated(){this.abort("Content script context invalidated"),G.debug(`Content script "${this.contentScriptName}" context invalidated`)}stopOldScripts(){window.postMessage({type:T.SCRIPT_STARTED_MESSAGE_TYPE,contentScriptName:this.contentScriptName,messageId:Math.random().toString(36).slice(2)},"*")}verifyScriptStartedEvent(e){var l,u,w;const r=((l=e.data)==null?void 0:l.type)===T.SCRIPT_STARTED_MESSAGE_TYPE,n=((u=e.data)==null?void 0:u.contentScriptName)===this.contentScriptName,m=!this.receivedMessageIds.has((w=e.data)==null?void 0:w.messageId);return r&&n&&m}listenForNewerScripts(e){let r=!0;const n=m=>{if(this.verifyScriptStartedEvent(m)){this.receivedMessageIds.add(m.data.messageId);const l=r;if(r=!1,l&&(e!=null&&e.ignoreFirstEvent))return;this.notifyInvalidated()}};addEventListener("message",n),this.onInvalidated(()=>removeEventListener("message",n))}};y(T,"SCRIPT_STARTED_MESSAGE_TYPE",R("wxt:content-script-started"));let $=T;const Y=Symbol("null");let J=0;class Q extends Map{constructor(...e){super(),this._objectHashes=new WeakMap,this._symbolHashes=new Map,this._publicKeys=new Map;const[r]=e;if(r!=null){if(typeof r[Symbol.iterator]!="function")throw new TypeError(typeof r+" is not iterable (cannot read property Symbol(Symbol.iterator))");for(const[n,m]of r)this.set(n,m)}}_getPublicKeys(e,r=!1){if(!Array.isArray(e))throw new TypeError("The keys parameter must be an array");const n=this._getPrivateKey(e,r);let m;return n&&this._publicKeys.has(n)?m=this._publicKeys.get(n):r&&(m=[...e],this._publicKeys.set(n,m)),{privateKey:n,publicKey:m}}_getPrivateKey(e,r=!1){const n=[];for(const m of e){const l=m===null?Y:m;let u;if(typeof l=="object"||typeof l=="function"?u="_objectHashes":typeof l=="symbol"?u="_symbolHashes":u=!1,!u)n.push(l);else if(this[u].has(l))n.push(this[u].get(l));else if(r){const w=`@@mkm-ref-${J++}@@`;this[u].set(l,w),n.push(w)}else return!1}return JSON.stringify(n)}set(e,r){const{publicKey:n}=this._getPublicKeys(e,!0);return super.set(n,r)}get(e){const{publicKey:r}=this._getPublicKeys(e);return super.get(r)}has(e){const{publicKey:r}=this._getPublicKeys(e);return super.has(r)}delete(e){const{publicKey:r,privateKey:n}=this._getPublicKeys(e);return!!(r&&super.delete(r)&&this._publicKeys.delete(n))}clear(){super.clear(),this._symbolHashes.clear(),this._publicKeys.clear()}get[Symbol.toStringTag](){return"ManyKeysMap"}get size(){return super.size}}new Q;function oe(){}function P(i,...e){}const X={debug:(...i)=>P(console.debug,...i),log:(...i)=>P(console.log,...i),warn:(...i)=>P(console.warn,...i),error:(...i)=>P(console.error,...i)};return(async()=>{try{const{main:i,...e}=z,r=new $("tradingview-bridge",e);return await i(r)}catch(i){throw X.error('The content script "tradingview-bridge" crashed on startup!',i),i}})()})(); | ||
| tradingviewBridge; |
| var tradingviewMain=(function(){"use strict";function h(t){return t}const d={matches:["https://*.tradingview.com/*"],runAt:"document_idle",world:"MAIN",main(){let t;function s(){var l;const e=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT),m=/\b([A-Z]{2,8}):([A-Z][A-Z0-9.\-_]*)\b/;let a;for(;a=e.nextNode();){const o=a.nodeValue;if(!o||o.length<4||o.length>200)continue;const i=o.match(m);if(i)return`${i[1]}:${i[2]}`}const r=(l=document.querySelector('meta[property="og:title"]'))==null?void 0:l.getAttribute("content"),c=r==null?void 0:r.match(/\b([A-Z]{2,8}):([A-Z][A-Z0-9.\-_]*)\b/);return c?`${c[1]}:${c[2]}`:null}function u(){const e=s();e!==t&&(t=e,window.postMessage({source:"zesty-tv",exchangeSymbol:e},"*"))}setInterval(u,1e3),u()}};function f(){}function n(t,...s){}const g={debug:(...t)=>n(console.debug,...t),log:(...t)=>n(console.log,...t),warn:(...t)=>n(console.warn,...t),error:(...t)=>n(console.error,...t)};return(async()=>{try{return await d.main()}catch(t){throw g.error('The content script "tradingview-main" crashed on startup!',t),t}})()})(); | ||
| tradingviewMain; |
+1
-1
@@ -1,2 +0,2 @@ | ||
| var background=(function(){"use strict";function H(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P={exports:{}},K=P.exports,F;function Q(){return F||(F=1,(function(e,n){(function(t,o){o(e)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:K,function(t){if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)t.exports=globalThis.browser;else{const o="The message port closed before a response was received.",l=x=>{const f={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(f).length===0)throw new Error("api-metadata.json has not been included in browser-polyfill");class E extends WeakMap{constructor(s,i=void 0){super(i),this.createItem=s}get(s){return this.has(s)||this.set(s,this.createItem(s)),super.get(s)}}const v=r=>r&&typeof r=="object"&&typeof r.then=="function",A=(r,s)=>(...i)=>{x.runtime.lastError?r.reject(new Error(x.runtime.lastError.message)):s.singleCallbackArg||i.length<=1&&s.singleCallbackArg!==!1?r.resolve(i[0]):r.resolve(i)},y=r=>r==1?"argument":"arguments",xe=(r,s)=>function(g,...c){if(c.length<s.minArgs)throw new Error(`Expected at least ${s.minArgs} ${y(s.minArgs)} for ${r}(), got ${c.length}`);if(c.length>s.maxArgs)throw new Error(`Expected at most ${s.maxArgs} ${y(s.maxArgs)} for ${r}(), got ${c.length}`);return new Promise((d,b)=>{if(s.fallbackToNoCallback)try{g[r](...c,A({resolve:d,reject:b},s))}catch(a){console.warn(`${r} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,a),g[r](...c),s.fallbackToNoCallback=!1,s.noCallback=!0,d()}else s.noCallback?(g[r](...c),d()):g[r](...c,A({resolve:d,reject:b},s))})},q=(r,s,i)=>new Proxy(s,{apply(g,c,d){return i.call(c,r,...d)}});let R=Function.call.bind(Object.prototype.hasOwnProperty);const L=(r,s={},i={})=>{let g=Object.create(null),c={has(b,a){return a in r||a in g},get(b,a,h){if(a in g)return g[a];if(!(a in r))return;let m=r[a];if(typeof m=="function")if(typeof s[a]=="function")m=q(r,r[a],s[a]);else if(R(i,a)){let S=xe(a,i[a]);m=q(r,r[a],S)}else m=m.bind(r);else if(typeof m=="object"&&m!==null&&(R(s,a)||R(i,a)))m=L(m,s[a],i[a]);else if(R(i,"*"))m=L(m,s[a],i["*"]);else return Object.defineProperty(g,a,{configurable:!0,enumerable:!0,get(){return r[a]},set(S){r[a]=S}}),m;return g[a]=m,m},set(b,a,h,m){return a in g?g[a]=h:r[a]=h,!0},defineProperty(b,a,h){return Reflect.defineProperty(g,a,h)},deleteProperty(b,a){return Reflect.deleteProperty(g,a)}},d=Object.create(r);return new Proxy(d,c)},_=r=>({addListener(s,i,...g){s.addListener(r.get(i),...g)},hasListener(s,i){return s.hasListener(r.get(i))},removeListener(s,i){s.removeListener(r.get(i))}}),fe=new E(r=>typeof r!="function"?r:function(i){const g=L(i,{},{getContent:{minArgs:0,maxArgs:0}});r(g)}),V=new E(r=>typeof r!="function"?r:function(i,g,c){let d=!1,b,a=new Promise(k=>{b=function(p){d=!0,k(p)}}),h;try{h=r(i,g,b)}catch(k){h=Promise.reject(k)}const m=h!==!0&&v(h);if(h!==!0&&!m&&!d)return!1;const S=k=>{k.then(p=>{c(p)},p=>{let D;p&&(p instanceof Error||typeof p.message=="string")?D=p.message:D="An unexpected error occurred",c({__mozWebExtensionPolyfillReject__:!0,message:D})}).catch(p=>{console.error("Failed to send onMessage rejected reply",p)})};return S(m?h:a),!0}),de=({reject:r,resolve:s},i)=>{x.runtime.lastError?x.runtime.lastError.message===o?s():r(new Error(x.runtime.lastError.message)):i&&i.__mozWebExtensionPolyfillReject__?r(new Error(i.message)):s(i)},X=(r,s,i,...g)=>{if(g.length<s.minArgs)throw new Error(`Expected at least ${s.minArgs} ${y(s.minArgs)} for ${r}(), got ${g.length}`);if(g.length>s.maxArgs)throw new Error(`Expected at most ${s.maxArgs} ${y(s.maxArgs)} for ${r}(), got ${g.length}`);return new Promise((c,d)=>{const b=de.bind(null,{resolve:c,reject:d});g.push(b),i.sendMessage(...g)})},be={devtools:{network:{onRequestFinished:_(fe)}},runtime:{onMessage:_(V),onMessageExternal:_(V),sendMessage:X.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:X.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},$={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return f.privacy={network:{"*":$},services:{"*":$},websites:{"*":$}},L(x,be,f)};t.exports=l(chrome)}})})(P)),P.exports}var z=Q();const u=H(z);function Y(e){return e==null||typeof e=="function"?{main:e}:e}const J=[ne,oe,se,re];function ee(e){let n;try{n=atob(e)}catch{return null}const t=n.split(".");if(t.length<3)return null;const o=t[t.length-1],l=t.slice(1,-1).join(".");return l?o==="BCS"?{symbol:l.toUpperCase(),rawSymbol:n,market:"cl",source:"BTG Pactual"}:o==="INFBOL"?{symbol:(l.length>2?l.replace(/^[A-Z]{2}/,""):l).toUpperCase(),rawSymbol:n,market:"us",source:"BTG Pactual"}:null:null}function re({url:e}){if(e.hostname!=="web.trii.cl")return null;const n=e.pathname.match(/^\/stock\/([^/?#]+)/i);if(!n)return null;const t=decodeURIComponent(n[1]).toUpperCase();return{symbol:t,rawSymbol:t,market:"cl",source:"Trii"}}function se({url:e}){if(!/(^|\.)bolsadesantiago\.com$/.test(e.hostname))return null;const n=e.pathname.match(/^\/resumen_instrumento\/([^/?#]+)/i);if(!n)return null;const t=decodeURIComponent(n[1]).toUpperCase();return{symbol:t,rawSymbol:t,market:"cl",source:"Bolsa de Santiago"}}function ne({url:e}){if(e.hostname!=="finance.yahoo.com")return null;const n=e.pathname.match(/^\/quote\/([^/?#]+)/);if(!n)return null;const t=decodeURIComponent(n[1]),o=t.toUpperCase().endsWith(".SN");return{symbol:t.replace(/\.[A-Z]+$/i,""),rawSymbol:t,market:o?"cl":"us",source:"Yahoo Finance"}}const j=new Set(["NASDAQ","NYSE","AMEX","ARCA","BATS","OTC","PINK","CBOE"]),G=new Set(["BCS"]),te=new Set(["NSE","BSE","LSE","AIM","TSX","TSXV","JSE","EURONEXT","XETRA","FWB","BMV","B3","BVMF","HKEX","SSE","SZSE","TSE","OSE","ASX","KRX","SGX","BIST"]),ae=new Set(["AESANDES","AGUAS-A","ANDINA-A","ANDINA-B","BCI","BICECORP","BSANTANDER","CAP","CCU","CENCOSHOPP","CENCOSUD","CHILE","CMPC","COLBUN","CONCHATORO","COPEC","ECL","ENELAM","ENELCHILE","ENGIE","ENTEL","FALABELLA","GASCO","IAM","ITAUCL","ITAUCORP","LTM","MALLPLAZA","ORO BLANCO","PARAUCO","PILMAIQUEN","QUINENCO","RIPLEY","SECURITY","SK","SMSAAM","SONDA","SQM-A","SQM-B","TANNER","VAPORES","VINASANPEDRO"]);function oe({url:e,title:n}){if(!/(^|\.)tradingview\.com$/.test(e.hostname))return null;const t=e.pathname.match(/^\/symbols\/([A-Z]+)-([^/?#]+)/i);if(t)return w(t[1],t[2]);let o=null,l=null;const x=e.searchParams.get("symbol");if(x){const f=x.match(/^([^:]+):(.+)$/);f&&(o=f[1],l=f[2])}if(n){for(const A of te)if(new RegExp(`\\b${A}\\b`).test(n))return null;let f=null;for(const A of j)if(new RegExp(`\\b${A}\\b`).test(n)){f=A;break}if(!f){for(const A of G)if(new RegExp(`\\b${A}\\b`).test(n)){f=A;break}}const E=n.match(/\b([A-Z]{2,6}):([A-Z][A-Z0-9.]*)\b/);if(E)return w(E[1],E[2]);const v=n.match(/^([A-Z]+(?:[-._][A-Z0-9]+)*)(?=\s|\d|[^\w]|$)/);if(v){const A=v[1].toUpperCase();if(f)return w(f,A);const y=l!=null&&A!==l.toUpperCase();return o&&!y?w(o,A):ae.has(A)?w("BCS",A):w("NASDAQ",A)}}return o&&l?w(o,l):null}function w(e,n){const t=e.toUpperCase();let o;if(j.has(t))o="us";else if(G.has(t))o="cl";else return null;return{symbol:n.toUpperCase().replace(/_/g,"-"),rawSymbol:`${t}:${n}`,market:o,source:"TradingView"}}function ie(e,n){if(!e)return null;let t;try{t=new URL(e)}catch{return null}for(const o of J){const l=o({url:t,title:n});if(l)return l}return null}const ge="#7051db",le="#00e5aa",me=800;let T=null,N=null,C=null,O=!1;function W(){T&&(clearInterval(T),T=null),N=null,C=null}async function Z(){if(!(C==null||N==null))try{await u.action.setBadgeText({text:N.slice(0,3),tabId:C}),u.action.setBadgeBackgroundColor&&await u.action.setBadgeBackgroundColor({color:O?le:ge,tabId:C})}catch{W()}}function M(e){return`btg_${e}`}async function Ae(e){const n=M(e),o=(await u.storage.session.get(n))[n];return typeof o!="string"?null:ee(o)}async function I(e){let n,t;try{const l=await u.tabs.get(e);n=l.url,t=l.title}catch{return}let o=null;if(n!=null&&n.includes("app.btgpactual.cl")&&(o=await Ae(e)),o||(o=ie(n,t)),o)N=o.symbol,C=e,await Z(),T||(T=setInterval(()=>{O=!O,Z()},me));else{C===e&&W();try{await u.action.setBadgeText({text:"",tabId:e})}catch{}}}const ce=Y(()=>{"sidePanel"in chrome&&chrome.sidePanel.setPanelBehavior({openPanelOnActionClick:!0}).catch(e=>console.error("sidePanel.setPanelBehavior:",e)),u.tabs.onActivated.addListener(({tabId:e})=>{I(e)}),u.tabs.onUpdated.addListener((e,n,t)=>{t.active&&(n.url||n.title||n.status==="complete")&&I(e)}),u.tabs.onRemoved.addListener(e=>{u.storage.session.remove(M(e))}),u.runtime.onMessage.addListener((e,n)=>{var l;if(typeof e!="object"||e===null||e.type!=="btg-detected")return;const t=(l=n.tab)==null?void 0:l.id;if(typeof t!="number")return;const o=e.encoded;(async()=>{const x=M(t);typeof o=="string"&&o.length>0?await u.storage.session.set({[x]:o}):await u.storage.session.remove(x),I(t)})()})});function pe(){}function B(e,...n){}const ue={debug:(...e)=>B(console.debug,...e),log:(...e)=>B(console.log,...e),warn:(...e)=>B(console.warn,...e),error:(...e)=>B(console.error,...e)};let U;try{U=ce.main(),U instanceof Promise&&console.warn("The background's main() function return a promise, but it must be synchronous")}catch(e){throw ue.error("The background crashed on startup!"),e}return U})(); | ||
| var background=(function(){"use strict";function G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var C={exports:{}},z=C.exports,O;function K(){return O||(O=1,(function(e,n){(function(i,a){a(e)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:z,function(i){if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)i.exports=globalThis.browser;else{const a="The message port closed before a response was received.",l=u=>{const h={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(h).length===0)throw new Error("api-metadata.json has not been included in browser-polyfill");class q extends WeakMap{constructor(s,o=void 0){super(o),this.createItem=s}get(s){return this.has(s)||this.set(s,this.createItem(s)),super.get(s)}}const Ae=r=>r&&typeof r=="object"&&typeof r.then=="function",D=(r,s)=>(...o)=>{u.runtime.lastError?r.reject(new Error(u.runtime.lastError.message)):s.singleCallbackArg||o.length<=1&&s.singleCallbackArg!==!1?r.resolve(o[0]):r.resolve(o)},S=r=>r==1?"argument":"arguments",ue=(r,s)=>function(g,...c){if(c.length<s.minArgs)throw new Error(`Expected at least ${s.minArgs} ${S(s.minArgs)} for ${r}(), got ${c.length}`);if(c.length>s.maxArgs)throw new Error(`Expected at most ${s.maxArgs} ${S(s.maxArgs)} for ${r}(), got ${c.length}`);return new Promise((x,d)=>{if(s.fallbackToNoCallback)try{g[r](...c,D({resolve:x,reject:d},s))}catch(t){console.warn(`${r} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,t),g[r](...c),s.fallbackToNoCallback=!1,s.noCallback=!0,x()}else s.noCallback?(g[r](...c),x()):g[r](...c,D({resolve:x,reject:d},s))})},I=(r,s,o)=>new Proxy(s,{apply(g,c,x){return o.call(c,r,...x)}});let E=Function.call.bind(Object.prototype.hasOwnProperty);const B=(r,s={},o={})=>{let g=Object.create(null),c={has(d,t){return t in r||t in g},get(d,t,f){if(t in g)return g[t];if(!(t in r))return;let m=r[t];if(typeof m=="function")if(typeof s[t]=="function")m=I(r,r[t],s[t]);else if(E(o,t)){let y=ue(t,o[t]);m=I(r,r[t],y)}else m=m.bind(r);else if(typeof m=="object"&&m!==null&&(E(s,t)||E(o,t)))m=B(m,s[t],o[t]);else if(E(o,"*"))m=B(m,s[t],o["*"]);else return Object.defineProperty(g,t,{configurable:!0,enumerable:!0,get(){return r[t]},set(y){r[t]=y}}),m;return g[t]=m,m},set(d,t,f,m){return t in g?g[t]=f:r[t]=f,!0},defineProperty(d,t,f){return Reflect.defineProperty(g,t,f)},deleteProperty(d,t){return Reflect.deleteProperty(g,t)}},x=Object.create(r);return new Proxy(x,c)},U=r=>({addListener(s,o,...g){s.addListener(r.get(o),...g)},hasListener(s,o){return s.hasListener(r.get(o))},removeListener(s,o){s.removeListener(r.get(o))}}),xe=new q(r=>typeof r!="function"?r:function(o){const g=B(o,{},{getContent:{minArgs:0,maxArgs:0}});r(g)}),W=new q(r=>typeof r!="function"?r:function(o,g,c){let x=!1,d,t=new Promise(k=>{d=function(b){x=!0,k(b)}}),f;try{f=r(o,g,d)}catch(k){f=Promise.reject(k)}const m=f!==!0&&Ae(f);if(f!==!0&&!m&&!x)return!1;const y=k=>{k.then(b=>{c(b)},b=>{let N;b&&(b instanceof Error||typeof b.message=="string")?N=b.message:N="An unexpected error occurred",c({__mozWebExtensionPolyfillReject__:!0,message:N})}).catch(b=>{console.error("Failed to send onMessage rejected reply",b)})};return y(m?f:t),!0}),de=({reject:r,resolve:s},o)=>{u.runtime.lastError?u.runtime.lastError.message===a?s():r(new Error(u.runtime.lastError.message)):o&&o.__mozWebExtensionPolyfillReject__?r(new Error(o.message)):s(o)},V=(r,s,o,...g)=>{if(g.length<s.minArgs)throw new Error(`Expected at least ${s.minArgs} ${S(s.minArgs)} for ${r}(), got ${g.length}`);if(g.length>s.maxArgs)throw new Error(`Expected at most ${s.maxArgs} ${S(s.maxArgs)} for ${r}(), got ${g.length}`);return new Promise((c,x)=>{const d=de.bind(null,{resolve:c,reject:x});g.push(d),o.sendMessage(...g)})},fe={devtools:{network:{onRequestFinished:U(xe)}},runtime:{onMessage:U(W),onMessageExternal:U(W),sendMessage:V.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:V.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},F={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return h.privacy={network:{"*":F},services:{"*":F},websites:{"*":F}},B(u,fe,h)};i.exports=l(chrome)}})})(C)),C.exports}var H=K();const A=G(H);function Y(e){return e==null||typeof e=="function"?{main:e}:e}const J=[se,ne,re,ee];function _(e){return e.toUpperCase()==="BCS"?"cl":"us"}function Q(e){let n;try{n=atob(e)}catch{return null}const i=n.split(".");if(i.length<3)return null;const a=i[i.length-1],l=i.slice(1,-1).join(".");return l?a==="BCS"?{symbol:l.toUpperCase(),market:"cl",source:"BTG Pactual"}:a==="INFBOL"?{symbol:(l.length>2?l.replace(/^[A-Z]{2}/,""):l).toUpperCase(),market:"us",source:"BTG Pactual"}:null:null}function X(e){const n=e.match(/^([A-Z]{2,8}):([A-Z][A-Z0-9.\-_]*)$/);if(!n)return null;const i=n[1];return{symbol:n[2].toUpperCase().replace(/_/g,"-"),market:_(i),source:"TradingView"}}function ee({url:e}){if(e.hostname!=="web.trii.cl")return null;const n=e.pathname.match(/^\/stock\/([^/?#]+)/i);return n?{symbol:decodeURIComponent(n[1]).toUpperCase(),market:"cl",source:"Trii"}:null}function re({url:e}){if(!/(^|\.)bolsadesantiago\.com$/.test(e.hostname))return null;const n=e.pathname.match(/^\/resumen_instrumento\/([^/?#]+)/i);return n?{symbol:decodeURIComponent(n[1]).toUpperCase(),market:"cl",source:"Bolsa de Santiago"}:null}function se({url:e}){if(e.hostname!=="finance.yahoo.com")return null;const n=e.pathname.match(/^\/quote\/([^/?#]+)/);if(!n)return null;const i=decodeURIComponent(n[1]),a=i.toUpperCase().endsWith(".SN");return{symbol:i.replace(/\.[A-Z]+$/i,""),market:a?"cl":"us",source:"Yahoo Finance"}}function ne({url:e,title:n}){if(!/(^|\.)tradingview\.com$/.test(e.hostname))return null;const i=e.pathname.match(/^\/symbols\/([A-Z]+)-([^/?#]+)/i);if(i)return{symbol:i[2].toUpperCase().replace(/_/g,"-"),market:_(i[1]),source:"TradingView"};if(!n)return null;const a=n.match(/\b([A-Z]{2,8}):([A-Z][A-Z0-9.\-_]*)\b/);if(a)return{symbol:a[2].toUpperCase().replace(/_/g,"-"),market:_(a[1]),source:"TradingView"};const l=n.match(/^([A-Z]+(?:[-._][A-Z0-9]+)*)(?=\s|\d|[^\w]|$)/);return l?{symbol:l[1].toUpperCase().replace(/_/g,"-"),market:"us",source:"TradingView"}:null}function te(e,n){if(!e)return null;let i;try{i=new URL(e)}catch{return null}for(const a of J){const l=a({url:i,title:n});if(l)return l}return null}const ae="#7051db",oe="#00e5aa",ie=800;let w=null,T=null,p=null,M=!1;function j(){w&&(clearInterval(w),w=null),T=null,p=null}async function Z(){if(!(p==null||T==null))try{await A.action.setBadgeText({text:T.slice(0,3),tabId:p}),A.action.setBadgeBackgroundColor&&await A.action.setBadgeBackgroundColor({color:M?oe:ae,tabId:p})}catch{j()}}function $(e){return`btg_${e}`}function R(e){return`tv_${e}`}async function ge(e){const n=$(e),a=(await A.storage.session.get(n))[n];return typeof a!="string"?null:Q(a)}async function le(e){const n=R(e),a=(await A.storage.session.get(n))[n];return typeof a!="string"?null:X(a)}async function v(e){let n,i;try{const l=await A.tabs.get(e);n=l.url,i=l.title}catch{return}let a=null;if(n!=null&&n.includes("app.btgpactual.cl")?a=await ge(e):n&&/(^|\.)tradingview\.com\//.test(n)&&(a=await le(e)),a||(a=te(n,i)),a)T=a.symbol,p=e,await Z(),w||(w=setInterval(()=>{M=!M,Z()},ie));else{p===e&&j();try{await A.action.setBadgeText({text:"",tabId:e})}catch{}}}const me=Y(()=>{"sidePanel"in chrome&&chrome.sidePanel.setPanelBehavior({openPanelOnActionClick:!0}).catch(e=>console.error("sidePanel.setPanelBehavior:",e)),A.tabs.onActivated.addListener(({tabId:e})=>{v(e)}),A.tabs.onUpdated.addListener((e,n,i)=>{i.active&&(n.url||n.title||n.status==="complete")&&v(e)}),A.tabs.onRemoved.addListener(e=>{A.storage.session.remove([$(e),R(e)])}),A.runtime.onMessage.addListener((e,n)=>{var l;if(typeof e!="object"||e===null)return;const i=e.type,a=(l=n.tab)==null?void 0:l.id;if(typeof a=="number"){if(i==="btg-detected"){const u=e.encoded,h=$(a);(async()=>(typeof u=="string"&&u.length>0?await A.storage.session.set({[h]:u}):await A.storage.session.remove(h),v(a)))();return}if(i==="tv-detected"){const u=e.exchangeSymbol,h=R(a);(async()=>(typeof u=="string"&&u.length>0?await A.storage.session.set({[h]:u}):await A.storage.session.remove(h),v(a)))()}}})});function he(){}function P(e,...n){}const ce={debug:(...e)=>P(console.debug,...e),log:(...e)=>P(console.log,...e),warn:(...e)=>P(console.warn,...e),error:(...e)=>P(console.error,...e)};let L;try{L=me.main(),L instanceof Promise&&console.warn("The background's main() function return a promise, but it must be synchronous")}catch(e){throw ce.error("The background crashed on startup!"),e}return L})(); | ||
| background; |
+22
-2
@@ -5,3 +5,3 @@ { | ||
| "description": "Compra y vende en tu cuenta Zesty desde cualquier sitio de inversiones", | ||
| "version": "0.0.4", | ||
| "version": "0.0.5", | ||
| "icons": { | ||
@@ -20,3 +20,4 @@ "16": "icon/16.png", | ||
| "https://api.zestyfinance.com/*", | ||
| "https://app.btgpactual.cl/*" | ||
| "https://app.btgpactual.cl/*", | ||
| "https://*.tradingview.com/*" | ||
| ], | ||
@@ -64,2 +65,21 @@ "browser_specific_settings": { | ||
| "world": "MAIN" | ||
| }, | ||
| { | ||
| "matches": [ | ||
| "https://*.tradingview.com/*" | ||
| ], | ||
| "run_at": "document_idle", | ||
| "js": [ | ||
| "content-scripts/tradingview-bridge.js" | ||
| ] | ||
| }, | ||
| { | ||
| "matches": [ | ||
| "https://*.tradingview.com/*" | ||
| ], | ||
| "run_at": "document_idle", | ||
| "js": [ | ||
| "content-scripts/tradingview-main.js" | ||
| ], | ||
| "world": "MAIN" | ||
| } | ||
@@ -66,0 +86,0 @@ ], |
+1
-1
@@ -7,3 +7,3 @@ <!DOCTYPE html> | ||
| <title>Zesty</title> | ||
| <script type="module" crossorigin src="/chunks/sidepanel-Dw2slzHl.js"></script> | ||
| <script type="module" crossorigin src="/chunks/sidepanel-BHmPAIU8.js"></script> | ||
| <link rel="stylesheet" crossorigin href="/assets/sidepanel-DlvQ5roU.css"> | ||
@@ -10,0 +10,0 @@ </head> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet