@i.un/libs 0.0.62 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/linkedin/api.d.ts +3 -3
- package/dist/linkedin/dom.d.ts +61 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=Symbol("undefined");function t(e){return"function"==typeof(null==e?void 0:e.clone)}function r(e){var t=typeof e;return null===e||"string"===t||"number"===t||"boolean"===t||"undefined"===t}function n(e){return r(e)?String(e):JSON.stringify(e,function(e,t){return"object"!=typeof t||null===t||Array.isArray(t)?t:Object.keys(t).sort().reduce(function(e,r){return e[r]=t[r],e},{})})}function o(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(function(e){return o(e)});var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=o(e[n]));return r}function i(e){return new Proxy({},{get:function(t,r){return t.hasOwnProperty(r)?t[r]:e}})}var s=i(e),a=i(!1);function l(e){return s[e]}function c(t){return s[t]!==e}var u={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return h(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(null,arguments)}var v=/*#__PURE__*/function(){function e(e){this.storageKey=void 0,this.data={},this.changeCallbacks=[],this.storageKey=e}e.getInstanceKey=function(e){return"memory:"+e},e.getInstance=function(t){var r=this.getInstanceKey(t);return this.instances.has(r)||this.instances.set(r,new e(t)),this.instances.get(r)},e.create=function(e){return this.getInstance(e)},e.clearInstance=function(e){var t=this.getInstanceKey(e),r=this.instances.get(t);r&&r.clearChangeCallbacks(),this.instances.delete(t)},e.clearAllInstances=function(){this.instances.forEach(function(e){e.clearChangeCallbacks()}),this.instances.clear()};var t=e.prototype;return t.set=function(e,t){try{var r,n=this.data[e];this.data=f({},this.data,((r={})[e]=t,r)),this.triggerChange(n,t)}catch(e){throw console.error("MemoryStore.set 失败:",e),e}},t.get=function(e){try{return this.data[e]}catch(e){throw console.error("MemoryStore.get 失败:",e),e}},t.getAll=function(){return f({},this.data)},t.remove=function(e){try{if(e in this.data){var t=this.data[e],r=f({},this.data);delete r[e],this.data=r,this.triggerChange(t,void 0)}}catch(e){throw console.error("MemoryStore.remove 失败:",e),e}},t.clear=function(){try{var e=f({},this.data);this.data={},this.triggerChange(e,{})}catch(e){throw console.error("MemoryStore.clear 失败:",e),e}},t.setMultiple=function(e){try{var t=f({},this.data);this.data=f({},this.data,e),this.triggerChange(t,this.data)}catch(e){throw console.error("MemoryStore.setMultiple 失败:",e),e}},t.onChanged=function(e){this.changeCallbacks.push(e)},t.triggerChange=function(e,t){if(this.changeCallbacks.length>0){var r,n=((r={})[this.storageKey]={oldValue:e,newValue:t},r);this.changeCallbacks.forEach(function(e){try{e(n)}catch(e){console.error("MemoryStore 变化回调执行失败:",e)}})}},t.clearChangeCallbacks=function(){this.changeCallbacks=[]},t.has=function(e){try{return e in this.data}catch(e){return console.error("MemoryStore.has 失败:",e),!1}},t.getSize=function(){try{var e=JSON.stringify(this.data);return new Blob([e]).size}catch(e){return console.error("MemoryStore.getSize 失败:",e),0}},t.getStoreKey=function(){return this.storageKey},t.getStoreType=function(){return"memory"},e}();function g(e,t,r,n){if(void 0===n&&(n=!1),t in e.style)e.style[t]=r;else{var o=n?"important":"";e.style.setProperty(t,String(r),o)}}function m(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e.type);if(e.props)for(var r=0,n=Object.entries(e.props);r<n.length;r++){var o=n[r];t.setAttribute(o[0],o[1])}if("string"==typeof e.children){var i=document.createTextNode(e.children);t.appendChild(i)}else Array.isArray(e.children)&&e.children.forEach(function(e){var r=m(e);t.appendChild(r)});return t}function p(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function y(e){e&&setTimeout(function(){e.scrollTop=e.scrollHeight},0)}v.instances=new Map;var w=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t={}),this.element=void 0,this.options=void 0,this.isDragging=!1,this.startX=0,this.startY=0,this.initialX=0,this.initialY=0,this.threshold=5,this.onMouseMoveHandler=void 0,this.onMouseUpHandler=void 0,this.element=e,this.options=f({coordinate:"tl"},t);var r=getComputedStyle(this.element).position;r&&"static"!==r||(this.element.style.position="absolute"),this.options.position&&(this.element.style.position=this.options.position),this.onMouseMoveHandler=this.onMouseMove.bind(this),this.onMouseUpHandler=this.onMouseUp.bind(this),this.element.addEventListener("mousedown",this.onMouseDown.bind(this))}var t=e.prototype;return t.onMouseDown=function(e){e.preventDefault(),this.startX=e.clientX,this.startY=e.clientY,this.initialX=parseInt(window.getComputedStyle(this.element).left,10)||0,this.initialY=parseInt(window.getComputedStyle(this.element).top,10)||0,document.addEventListener("mousemove",this.onMouseMoveHandler),document.addEventListener("mouseup",this.onMouseUpHandler)},t.getBoundedPosition=function(e,t){var r,n,o=this.element.getBoundingClientRect();if("fixed"===getComputedStyle(this.element).position)r=window.innerWidth-o.width,n=window.innerHeight-o.height;else{var i=(this.element.offsetParent||document.documentElement).getBoundingClientRect();r=i.width-o.width,n=i.height-o.height}return{x:Math.min(Math.max(0,e),r),y:Math.min(Math.max(0,t),n)}},t.onMouseMove=function(e){if(!this.isDragging){var t=e.clientY-this.startY;(Math.abs(e.clientX-this.startX)>this.threshold||Math.abs(t)>this.threshold)&&(this.isDragging=!0,this.options.onDragStart&&this.options.onDragStart(e))}if(this.isDragging){var r=this.getBoundedPosition(this.initialX+(e.clientX-this.startX),this.initialY+(e.clientY-this.startY));this.element.style.right="auto",this.element.style.bottom="auto",this.element.style.left=r.x+"px",this.element.style.top=r.y+"px",this.options.onDrag&&this.options.onDrag(e)}},t.convertCoordinate=function(){var e=this.element.getBoundingClientRect(),t=getComputedStyle(this.element).position,r=null,n=null;if("fixed"===t?(r=null,n=new DOMRect(0,0,window.innerWidth,window.innerHeight)):((r=this.element.offsetParent)||(r=document.documentElement),"static"===getComputedStyle(r).position?(r=null,n=new DOMRect(0,0,window.innerWidth,window.innerHeight)):n=r.getBoundingClientRect()),n){var o,i;if("fixed"===t)o=e.left,i=e.top;else if(o=e.left-n.left,i=e.top-n.top,r instanceof HTMLElement){var s=getComputedStyle(r);o-=parseFloat(s.borderLeftWidth)||0,i-=parseFloat(s.borderTopWidth)||0}else o+=window.scrollX,i+=window.scrollY;switch(this.options.coordinate){case"tr":var a=n.width-o-e.width;this.element.style.left="auto",this.element.style.right=a+"px",this.element.style.top=i+"px",this.element.style.bottom="auto";break;case"bl":var l=n.height-i-e.height;this.element.style.left=o+"px",this.element.style.right="auto",this.element.style.top="auto",this.element.style.bottom=l+"px";break;case"br":var c=n.width-o-e.width,u=n.height-i-e.height;this.element.style.left="auto",this.element.style.right=c+"px",this.element.style.top="auto",this.element.style.bottom=u+"px";break;default:this.element.style.left=o+"px",this.element.style.right="auto",this.element.style.top=i+"px",this.element.style.bottom="auto"}}},t.onMouseUp=function(e){this.isDragging&&(this.options.coordinate&&"tl"!==this.options.coordinate&&this.convertCoordinate(),this.options.onDragEnd&&this.options.onDragEnd(e)),this.isDragging=!1,document.removeEventListener("mousemove",this.onMouseMoveHandler),document.removeEventListener("mouseup",this.onMouseUpHandler)},e}(),S=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t="local"),this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.storageKey=e,this.storeType=t}e.getInstanceKey=function(e,t){return void 0===t&&(t="local"),t+":"+e},e.getInstance=function(t,r){void 0===r&&(r="local");var n=this.getInstanceKey(t,r);return this.instances.has(n)||this.instances.set(n,new e(t,r)),this.instances.get(n)},e.local=function(e){return this.getInstance(e,"local")},e.session=function(e){return this.getInstance(e,"session")},e.clearInstance=function(e,t){void 0===t&&(t="local");var r=this.getInstanceKey(e,t);this.instances.delete(r)},e.clearAllInstances=function(){this.instances.clear()};var t=e.prototype;return t.getStore=function(){return this.store||(this.store="local"===this.storeType?localStorage:sessionStorage),this.store},t.set=function(e,t){try{var r,n=f({},this.getAll(),((r={})[e]=t,r));this.getStore().setItem(this.storageKey,JSON.stringify(n))}catch(e){throw console.error("WebStore.set 失败:",e),e}},t.get=function(e){try{var t=this.getAll();return null==t?void 0:t[e]}catch(e){throw console.error("WebStore.get 失败:",e),e}},t.getAll=function(){try{var e=this.getStore().getItem(this.storageKey);return e?JSON.parse(e):{}}catch(e){return console.error("WebStore.getAll 失败:",e),{}}},t.remove=function(e){try{var t=this.getAll();t&&e in t&&(delete t[e],this.getStore().setItem(this.storageKey,JSON.stringify(t)))}catch(e){throw console.error("WebStore.remove 失败:",e),e}},t.clear=function(){try{this.getStore().removeItem(this.storageKey)}catch(e){throw console.error("WebStore.clear 失败:",e),e}},t.setMultiple=function(e){try{var t=f({},this.getAll(),e);this.getStore().setItem(this.storageKey,JSON.stringify(t))}catch(e){throw console.error("WebStore.setMultiple 失败:",e),e}},t.onChanged=function(e){var t=this;window.addEventListener("storage",function(r){if(r.key===t.storageKey&&r.storageArea===t.getStore()){var n,o=((n={})[t.storageKey]={oldValue:r.oldValue?JSON.parse(r.oldValue):void 0,newValue:r.newValue?JSON.parse(r.newValue):void 0},n);e(o)}})},t.has=function(e){try{return void 0!==this.get(e)}catch(e){return console.error("WebStore.has 失败:",e),!1}},t.getSize=function(){try{var e=this.getStore().getItem(this.storageKey)||"";return new Blob([e]).size}catch(e){return console.error("WebStore.getSize 失败:",e),0}},t.getStoreKey=function(){return this.storageKey},e}();function b(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}S.instances=new Map;var P=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t="local"),this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.storageKey=e,this.storeType=t}e.getInstanceKey=function(e,t){return void 0===t&&(t="local"),t+":"+e},e.getInstance=function(t,r){void 0===r&&(r="local");var n=this.getInstanceKey(t,r);return this.instances.has(n)||this.instances.set(n,new e(t,r)),this.instances.get(n)},e.local=function(e){return this.getInstance(e,"local")},e.sync=function(e){return this.getInstance(e,"sync")},e.clearInstance=function(e,t){void 0===t&&(t="local");var r=this.getInstanceKey(e,t);this.instances.delete(r)},e.clearAllInstances=function(){this.instances.clear()};var t=e.prototype;return t.getStore=function(){return this.store||(this.store=chrome.storage[this.storeType]),this.store},t.set=function(e,t){try{var r=this;return Promise.resolve(b(function(){return Promise.resolve(r.getAll()).then(function(n){var o,i,s=f({},n,((o={})[e]=t,o));return Promise.resolve(r.getStore().set((i={},i[r.storageKey]=s,i))).then(function(){})})},function(e){throw console.error("ChromeStore.set 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.get=function(e){try{var t=this;return Promise.resolve(b(function(){return Promise.resolve(t.getAll()).then(function(t){return null==t?void 0:t[e]})},function(e){throw console.error("ChromeStore.get 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.getAll=function(){try{var e=this;return Promise.resolve(b(function(){return Promise.resolve(e.getStore().get(e.storageKey)).then(function(t){return t[e.storageKey]||{}})},function(e){throw console.error("ChromeStore.getAll 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.remove=function(e){try{var t=this;return Promise.resolve(b(function(){return Promise.resolve(t.getAll()).then(function(r){var n=function(){var n;if(r&&e in r)return delete r[e],Promise.resolve(t.getStore().set((n={},n[t.storageKey]=r,n))).then(function(){})}();if(n&&n.then)return n.then(function(){})})},function(e){throw console.error("ChromeStore.remove 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.clear=function(){try{var e=this;return Promise.resolve(b(function(){return Promise.resolve(e.getStore().remove(e.storageKey)).then(function(){})},function(e){throw console.error("ChromeStore.clear 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.setMultiple=function(e){try{var t=this;return Promise.resolve(b(function(){return Promise.resolve(t.getAll()).then(function(r){var n,o=f({},r,e);return Promise.resolve(t.getStore().set((n={},n[t.storageKey]=o,n))).then(function(){})})},function(e){throw console.error("ChromeStore.setMultiple 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.onChanged=function(e){var t=this;chrome.storage.onChanged.addListener(function(r,n){n===t.storeType&&r[t.storageKey]&&e(r)})},t.has=function(e){try{var t=this;return Promise.resolve(b(function(){return Promise.resolve(t.get(e)).then(function(e){return void 0!==e})},function(e){return console.error("ChromeStore.has 失败:",e),!1}))}catch(e){return Promise.reject(e)}},t.getSize=function(){try{var e=this;return Promise.resolve(b(function(){return Promise.resolve(e.getAll()).then(function(e){var t=JSON.stringify(e);return new Blob([t]).size})},function(e){return console.error("ChromeStore.getSize 失败:",e),0}))}catch(e){return Promise.reject(e)}},t.getStoreKey=function(){return this.storageKey},e}();P.instances=new Map;var x="https://www.linkedin.com/voyager/api";function C(e,t){var r,n={"csrf-token":e};return t&&(r="string"==typeof t?t:Object.entries(t).map(function(e){return e[0]+"="+e[1]}).join("; "))&&(n.Cookie=r),n}var M={searchPeoplePage:{searchEntityResult:['[data-view-name="search-entity-result-universal-template"]'],linkedinUrl:['a[data-test-app-aware-link][href^="https://www.linkedin.com/in/"]','a[data-view-name="search-result-lockup-title"]'],image:[".presence-entity img","a>div>div>figure>img"],userOccupation:['p:has(a[data-view-name="search-result-lockup-title"]) + p',".entity-result__primary-subtitle",".entity-result__divider > div div:nth-child(2)","div>div>div:nth-child(2)>div>div:nth-child(2)","figure + div p:nth-child(2)"],fullName:[".entity-result__title-text a span>span",".entity-result__title-line a span>span",".entity-result__title-line span>a>span>span","a:has(+.entity-result__badge)>span>span",".linked-area div:nth-child(2) > div:first-child > div.t-roman.t-sans a",'a[data-view-name="search-result-lockup-title"]'],resultList:[".search-results-container>div:has(.reusable-search__result-container)"],actionsDiv:[".entity-result__actions",".linked-area > div > div:last-child","div:has(figure) > div:last-child"],validResult:["[data-chameleon-result-urn] , .reusable-search__result-container"],searchResult:[".search-results-container li:has(>[data-chameleon-result-urn])",'[data-view-name="people-search-result"]'],searchResultsContainer:[".search-results-container",'[role="main"] div:has(>hr[role="presentation"])'],mainLayoutLeft:[".search-marvel-srp",'[role="main"] div:has(hr)>div>div'],howToContainer:[".hasLegacyFeedLineHeight div:has(main)",".authentication-outlet"]},searchAllPage:{peopleButton:["nav ul.search-reusables__filter-list>li>button"],toolbar:[".scaffold-layout-toolbar"]}};function I(e,t,r){switch(r){case"all":var n=e.querySelectorAll(t);return n.length>0?Array.from(n):null;case"closest":return e instanceof HTMLElement?e.closest(t):null;default:return e.querySelector(t)}}exports.ChromeStore=P,exports.Draggable=w,exports.MemoryStore=v,exports.RealUndefined=e,exports.WebStore=S,exports.cacheWrapper=function(e,t){void 0===t&&(t=u);var r=function(){var r=[].slice.call(arguments),i=n(r)+e.name+(t.identifier||"");if(c(i))return Promise.resolve(o(l(i)));if(a[i]){var h=Object.assign({},u,t);return new Promise(function(e){var t=Date.now(),r=setInterval(function(){c(i)?(clearInterval(r),e(o(l(i)))):Date.now()-t>h.timeout&&(a[i]=!1,clearInterval(r),e(o(h.timeoutResult)))},100)})}return a[i]=!0,e.apply(this,r).then(function(e){return s[i]=e,o(s[i])}).catch(function(e){throw e}).finally(function(){a[i]=!1})};return Object.defineProperty(r,"name",{value:"cacheWrapper_"+e.name,configurable:!0}),r},exports.cloneDeep=o,exports.createDefaultObject=i,exports.createElement=function e(t){var r=void 0===t?{}:t,n=r.tag,o=r.children,i=void 0===o?[]:o,s=r.props,a=void 0===s?{}:s,l=r.attrs,c=void 0===l?{}:l,u=r.styles,h=void 0===u?{}:u,f=document.createElement(void 0===n?"div":n);Object.assign(f,a);for(var v=0,m=Object.entries(c);v<m.length;v++){var p=m[v],y=p[1];!1!==y&&f.setAttribute(p[0],y)}for(var w=0,S=Object.entries(h);w<S.length;w++){var b=S[w];g(f,b[0],b[1])}for(var P,x=d(Array.isArray(i)?i:[i]);!(P=x()).done;){var C=P.value;C&&("object"==typeof C?C instanceof Element?f.appendChild(C):f.appendChild(e(C)):f.appendChild(document.createTextNode(C)))}return f},exports.createSvg=function(e){return"string"==typeof e?p(e):m(e)},exports.createSvgFromUrl=function(e){try{return Promise.resolve(function(t,r){try{var n=Promise.resolve(fetch(e)).then(function(e){if(!e.ok)throw new Error("网络请求失败: "+e.status+" "+e.statusText);return Promise.resolve(e.text()).then(p)})}catch(e){return r(e)}return n&&n.then?n.then(void 0,r):n}(0,function(e){var t=e instanceof Error?e.message:"未知错误";throw new Error("无法创建 SVG 元素: "+t)}))}catch(e){return Promise.reject(e)}},exports.debounce=function(e,t){var r=null;return function(){var n=arguments,o=this;null!==r&&clearTimeout(r),r=setTimeout(function(){e.apply(o,[].slice.call(n)),r=null},t)}},exports.decodeJWT=function(e){var t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)},exports.delayExecution=function(e,t){void 0===t&&(t=0);var r=[].slice.call(arguments,2);return new Promise(function(n){0===t?n(e.apply(void 0,r)):setTimeout(function(){n(e.apply(void 0,r))},t)})},exports.generateStableUniqueKey=n,exports.getElement=function(e){var t=e.page,r=e.key,n=e.container,o=e.mode;null!=n||(n=document);for(var i,s,a=d(t&&r?M[(i={page:t,key:r}).page][i.key]:[e.selector]);!(s=a()).done;){var l=I(n,s.value,o);if(l)return l}return null},exports.getGlobal=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this},exports.getLinkedinCompany=function(e,t){var r=t.csrfToken,n=t.cookies;try{var o="urn"in e,i=x+"/organization/companies";i+=o?"/"+e.urn:"?q=universalName&universalName="+e.universalName;var s=C(r,n);return Promise.resolve(fetch(i,{method:"GET",headers:s}).then(function(e){try{var t,r=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){if(o)return t=1,e;var r,n=(null==(r=e.elements)?void 0:r[0])||null;return t=1,n})}();return Promise.resolve(r&&r.then?r.then(function(e){return t?e:null}):t?r:null)}catch(e){return Promise.reject(e)}}).catch(function(e){return console.error(e),null}))}catch(e){return Promise.reject(e)}},exports.getLinkedinProfile=function(e,t){var r=t.csrfToken,n=t.cookies;try{var o=x+"/identity/dash/profiles?q=memberIdentity&memberIdentity="+e+"&decorationId=com.linkedin.voyager.dash.deco.identity.profile.FullProfileWithEntities-26",i=C(r,n);return Promise.resolve(fetch(o,{method:"GET",headers:i}).then(function(e){try{var t,r=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){var r,n=(null==(r=e.elements)?void 0:r[0])||null;return t=1,n})}();return Promise.resolve(r&&r.then?r.then(function(e){return t?e:null}):t?r:null)}catch(e){return Promise.reject(e)}}).catch(function(e){return console.error(e),null}))}catch(e){return Promise.reject(e)}},exports.isCloneable=t,exports.isPrimitive=r,exports.launchWebAuthFlow=function(e){var t=e.clientId,r=e.responseType,n=void 0===r?"code":r,o=e.state,i=e.nonce,s=e.interactive,a=void 0===s||s;try{var l=chrome.identity.getRedirectURL(),c=Array.isArray(n)?n:[n],u=new URL("https://accounts.google.com/o/oauth2/v2/auth");return u.searchParams.set("client_id",t),u.searchParams.set("redirect_uri",l),u.searchParams.set("response_type",c.join(" ")),u.searchParams.set("scope","openid email profile"),i&&u.searchParams.set("nonce",i),o&&u.searchParams.set("state",o),Promise.resolve(chrome.identity.launchWebAuthFlow({url:u.toString(),interactive:a}).then(function(e){if(!e)return Promise.reject(new Error("redirectUrl is null"));var t=e.includes("?")?"?":"#",r=new URLSearchParams(e.split(t)[1]),n={};return r.forEach(function(e,t){n[t]=e}),n}).catch(function(e){return console.log("error",e),Promise.reject(e)}))}catch(e){return Promise.reject(e)}},exports.scrollToBottom=y,exports.scrollToBottomIfNeeded=function(e){e&&("true"!==e.dataset.isListeningForUserScroll&&(function(e){e&&e.addEventListener("scroll",function(){!function(e,t){e.dataset.userInteracted=t?"true":"false"}(e,e.scrollTop+e.clientHeight<e.scrollHeight-5)})}(e),e.dataset.isListeningForUserScroll="true"),"true"!==e.dataset.userInteracted&&y(e))},exports.singleExecutionWrapper=function(t,r){void 0===r&&(r=0);var n=function(){if(n.isExecuting)return Promise.resolve(e);n.isExecuting=!0;var o=performance.now(),i=t.apply(this,[].slice.call(arguments));return i.finally(function(){var e=performance.now()-o;r&&r>e?setTimeout(function(){n.isExecuting=!1},r-e):n.isExecuting=!1}),i};return n.isExecuting=!1,n};
|
|
1
|
+
var e=Symbol("undefined");function t(e){return"function"==typeof(null==e?void 0:e.clone)}function n(e){var t=typeof e;return null===e||"string"===t||"number"===t||"boolean"===t||"undefined"===t}function r(e){return n(e)?String(e):JSON.stringify(e,function(e,t){return"object"!=typeof t||null===t||Array.isArray(t)?t:Object.keys(t).sort().reduce(function(e,n){return e[n]=t[n],e},{})})}function i(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(function(e){return i(e)});var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=i(e[r]));return n}function o(e){return new Proxy({},{get:function(t,n){return t.hasOwnProperty(n)?t[n]:e}})}var a=o(e),s=o(!1);function c(e){return a[e]}function l(t){return a[t]!==e}var u={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(null,arguments)}var f=/*#__PURE__*/function(){function e(e){this.storageKey=void 0,this.data={},this.changeCallbacks=[],this.storageKey=e}e.getInstanceKey=function(e){return"memory:"+e},e.getInstance=function(t){var n=this.getInstanceKey(t);return this.instances.has(n)||this.instances.set(n,new e(t)),this.instances.get(n)},e.create=function(e){return this.getInstance(e)},e.clearInstance=function(e){var t=this.getInstanceKey(e),n=this.instances.get(t);n&&n.clearChangeCallbacks(),this.instances.delete(t)},e.clearAllInstances=function(){this.instances.forEach(function(e){e.clearChangeCallbacks()}),this.instances.clear()};var t=e.prototype;return t.set=function(e,t){try{var n,r=this.data[e];this.data=p({},this.data,((n={})[e]=t,n)),this.triggerChange(r,t)}catch(e){throw console.error("MemoryStore.set 失败:",e),e}},t.get=function(e){try{return this.data[e]}catch(e){throw console.error("MemoryStore.get 失败:",e),e}},t.getAll=function(){return p({},this.data)},t.remove=function(e){try{if(e in this.data){var t=this.data[e],n=p({},this.data);delete n[e],this.data=n,this.triggerChange(t,void 0)}}catch(e){throw console.error("MemoryStore.remove 失败:",e),e}},t.clear=function(){try{var e=p({},this.data);this.data={},this.triggerChange(e,{})}catch(e){throw console.error("MemoryStore.clear 失败:",e),e}},t.setMultiple=function(e){try{var t=p({},this.data);this.data=p({},this.data,e),this.triggerChange(t,this.data)}catch(e){throw console.error("MemoryStore.setMultiple 失败:",e),e}},t.onChanged=function(e){this.changeCallbacks.push(e)},t.triggerChange=function(e,t){if(this.changeCallbacks.length>0){var n,r=((n={})[this.storageKey]={oldValue:e,newValue:t},n);this.changeCallbacks.forEach(function(e){try{e(r)}catch(e){console.error("MemoryStore 变化回调执行失败:",e)}})}},t.clearChangeCallbacks=function(){this.changeCallbacks=[]},t.has=function(e){try{return e in this.data}catch(e){return console.error("MemoryStore.has 失败:",e),!1}},t.getSize=function(){try{var e=JSON.stringify(this.data);return new Blob([e]).size}catch(e){return console.error("MemoryStore.getSize 失败:",e),0}},t.getStoreKey=function(){return this.storageKey},t.getStoreType=function(){return"memory"},e}();function m(e,t,n,r){if(void 0===r&&(r=!1),t in e.style)e.style[t]=n;else{var i=r?"important":"";e.style.setProperty(t,String(n),i)}}function v(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e.type);if(e.props)for(var n=0,r=Object.entries(e.props);n<r.length;n++){var i=r[n];t.setAttribute(i[0],i[1])}if("string"==typeof e.children){var o=document.createTextNode(e.children);t.appendChild(o)}else Array.isArray(e.children)&&e.children.forEach(function(e){var n=v(e);t.appendChild(n)});return t}function g(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function y(e){e&&setTimeout(function(){e.scrollTop=e.scrollHeight},0)}f.instances=new Map;var w=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t={}),this.element=void 0,this.options=void 0,this.isDragging=!1,this.startX=0,this.startY=0,this.initialX=0,this.initialY=0,this.threshold=5,this.onMouseMoveHandler=void 0,this.onMouseUpHandler=void 0,this.element=e,this.options=p({coordinate:"tl"},t);var n=getComputedStyle(this.element).position;n&&"static"!==n||(this.element.style.position="absolute"),this.options.position&&(this.element.style.position=this.options.position),this.onMouseMoveHandler=this.onMouseMove.bind(this),this.onMouseUpHandler=this.onMouseUp.bind(this),this.element.addEventListener("mousedown",this.onMouseDown.bind(this))}var t=e.prototype;return t.onMouseDown=function(e){e.preventDefault(),this.startX=e.clientX,this.startY=e.clientY,this.initialX=parseInt(window.getComputedStyle(this.element).left,10)||0,this.initialY=parseInt(window.getComputedStyle(this.element).top,10)||0,document.addEventListener("mousemove",this.onMouseMoveHandler),document.addEventListener("mouseup",this.onMouseUpHandler)},t.getBoundedPosition=function(e,t){var n,r,i=this.element.getBoundingClientRect();if("fixed"===getComputedStyle(this.element).position)n=window.innerWidth-i.width,r=window.innerHeight-i.height;else{var o=(this.element.offsetParent||document.documentElement).getBoundingClientRect();n=o.width-i.width,r=o.height-i.height}return{x:Math.min(Math.max(0,e),n),y:Math.min(Math.max(0,t),r)}},t.onMouseMove=function(e){if(!this.isDragging){var t=e.clientY-this.startY;(Math.abs(e.clientX-this.startX)>this.threshold||Math.abs(t)>this.threshold)&&(this.isDragging=!0,this.options.onDragStart&&this.options.onDragStart(e))}if(this.isDragging){var n=this.getBoundedPosition(this.initialX+(e.clientX-this.startX),this.initialY+(e.clientY-this.startY));this.element.style.right="auto",this.element.style.bottom="auto",this.element.style.left=n.x+"px",this.element.style.top=n.y+"px",this.options.onDrag&&this.options.onDrag(e)}},t.convertCoordinate=function(){var e=this.element.getBoundingClientRect(),t=getComputedStyle(this.element).position,n=null,r=null;if("fixed"===t?(n=null,r=new DOMRect(0,0,window.innerWidth,window.innerHeight)):((n=this.element.offsetParent)||(n=document.documentElement),"static"===getComputedStyle(n).position?(n=null,r=new DOMRect(0,0,window.innerWidth,window.innerHeight)):r=n.getBoundingClientRect()),r){var i,o;if("fixed"===t)i=e.left,o=e.top;else if(i=e.left-r.left,o=e.top-r.top,n instanceof HTMLElement){var a=getComputedStyle(n);i-=parseFloat(a.borderLeftWidth)||0,o-=parseFloat(a.borderTopWidth)||0}else i+=window.scrollX,o+=window.scrollY;switch(this.options.coordinate){case"tr":var s=r.width-i-e.width;this.element.style.left="auto",this.element.style.right=s+"px",this.element.style.top=o+"px",this.element.style.bottom="auto";break;case"bl":var c=r.height-o-e.height;this.element.style.left=i+"px",this.element.style.right="auto",this.element.style.top="auto",this.element.style.bottom=c+"px";break;case"br":var l=r.width-i-e.width,u=r.height-o-e.height;this.element.style.left="auto",this.element.style.right=l+"px",this.element.style.top="auto",this.element.style.bottom=u+"px";break;default:this.element.style.left=i+"px",this.element.style.right="auto",this.element.style.top=o+"px",this.element.style.bottom="auto"}}},t.onMouseUp=function(e){this.isDragging&&(this.options.coordinate&&"tl"!==this.options.coordinate&&this.convertCoordinate(),this.options.onDragEnd&&this.options.onDragEnd(e)),this.isDragging=!1,document.removeEventListener("mousemove",this.onMouseMoveHandler),document.removeEventListener("mouseup",this.onMouseUpHandler)},e}(),b=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t="local"),this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.storageKey=e,this.storeType=t}e.getInstanceKey=function(e,t){return void 0===t&&(t="local"),t+":"+e},e.getInstance=function(t,n){void 0===n&&(n="local");var r=this.getInstanceKey(t,n);return this.instances.has(r)||this.instances.set(r,new e(t,n)),this.instances.get(r)},e.local=function(e){return this.getInstance(e,"local")},e.session=function(e){return this.getInstance(e,"session")},e.clearInstance=function(e,t){void 0===t&&(t="local");var n=this.getInstanceKey(e,t);this.instances.delete(n)},e.clearAllInstances=function(){this.instances.clear()};var t=e.prototype;return t.getStore=function(){return this.store||(this.store="local"===this.storeType?localStorage:sessionStorage),this.store},t.set=function(e,t){try{var n,r=p({},this.getAll(),((n={})[e]=t,n));this.getStore().setItem(this.storageKey,JSON.stringify(r))}catch(e){throw console.error("WebStore.set 失败:",e),e}},t.get=function(e){try{var t=this.getAll();return null==t?void 0:t[e]}catch(e){throw console.error("WebStore.get 失败:",e),e}},t.getAll=function(){try{var e=this.getStore().getItem(this.storageKey);return e?JSON.parse(e):{}}catch(e){return console.error("WebStore.getAll 失败:",e),{}}},t.remove=function(e){try{var t=this.getAll();t&&e in t&&(delete t[e],this.getStore().setItem(this.storageKey,JSON.stringify(t)))}catch(e){throw console.error("WebStore.remove 失败:",e),e}},t.clear=function(){try{this.getStore().removeItem(this.storageKey)}catch(e){throw console.error("WebStore.clear 失败:",e),e}},t.setMultiple=function(e){try{var t=p({},this.getAll(),e);this.getStore().setItem(this.storageKey,JSON.stringify(t))}catch(e){throw console.error("WebStore.setMultiple 失败:",e),e}},t.onChanged=function(e){var t=this;window.addEventListener("storage",function(n){if(n.key===t.storageKey&&n.storageArea===t.getStore()){var r,i=((r={})[t.storageKey]={oldValue:n.oldValue?JSON.parse(n.oldValue):void 0,newValue:n.newValue?JSON.parse(n.newValue):void 0},r);e(i)}})},t.has=function(e){try{return void 0!==this.get(e)}catch(e){return console.error("WebStore.has 失败:",e),!1}},t.getSize=function(){try{var e=this.getStore().getItem(this.storageKey)||"";return new Blob([e]).size}catch(e){return console.error("WebStore.getSize 失败:",e),0}},t.getStoreKey=function(){return this.storageKey},e}();function S(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}b.instances=new Map;var P=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t="local"),this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.storageKey=e,this.storeType=t}e.getInstanceKey=function(e,t){return void 0===t&&(t="local"),t+":"+e},e.getInstance=function(t,n){void 0===n&&(n="local");var r=this.getInstanceKey(t,n);return this.instances.has(r)||this.instances.set(r,new e(t,n)),this.instances.get(r)},e.local=function(e){return this.getInstance(e,"local")},e.sync=function(e){return this.getInstance(e,"sync")},e.clearInstance=function(e,t){void 0===t&&(t="local");var n=this.getInstanceKey(e,t);this.instances.delete(n)},e.clearAllInstances=function(){this.instances.clear()};var t=e.prototype;return t.getStore=function(){return this.store||(this.store=chrome.storage[this.storeType]),this.store},t.set=function(e,t){try{var n=this;return Promise.resolve(S(function(){return Promise.resolve(n.getAll()).then(function(r){var i,o,a=p({},r,((i={})[e]=t,i));return Promise.resolve(n.getStore().set((o={},o[n.storageKey]=a,o))).then(function(){})})},function(e){throw console.error("ChromeStore.set 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.get=function(e){try{var t=this;return Promise.resolve(S(function(){return Promise.resolve(t.getAll()).then(function(t){return null==t?void 0:t[e]})},function(e){throw console.error("ChromeStore.get 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.getAll=function(){try{var e=this;return Promise.resolve(S(function(){return Promise.resolve(e.getStore().get(e.storageKey)).then(function(t){return t[e.storageKey]||{}})},function(e){throw console.error("ChromeStore.getAll 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.remove=function(e){try{var t=this;return Promise.resolve(S(function(){return Promise.resolve(t.getAll()).then(function(n){var r=function(){var r;if(n&&e in n)return delete n[e],Promise.resolve(t.getStore().set((r={},r[t.storageKey]=n,r))).then(function(){})}();if(r&&r.then)return r.then(function(){})})},function(e){throw console.error("ChromeStore.remove 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.clear=function(){try{var e=this;return Promise.resolve(S(function(){return Promise.resolve(e.getStore().remove(e.storageKey)).then(function(){})},function(e){throw console.error("ChromeStore.clear 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.setMultiple=function(e){try{var t=this;return Promise.resolve(S(function(){return Promise.resolve(t.getAll()).then(function(n){var r,i=p({},n,e);return Promise.resolve(t.getStore().set((r={},r[t.storageKey]=i,r))).then(function(){})})},function(e){throw console.error("ChromeStore.setMultiple 失败:",e),e}))}catch(e){return Promise.reject(e)}},t.onChanged=function(e){var t=this;chrome.storage.onChanged.addListener(function(n,r){r===t.storeType&&n[t.storageKey]&&e(n)})},t.has=function(e){try{var t=this;return Promise.resolve(S(function(){return Promise.resolve(t.get(e)).then(function(e){return void 0!==e})},function(e){return console.error("ChromeStore.has 失败:",e),!1}))}catch(e){return Promise.reject(e)}},t.getSize=function(){try{var e=this;return Promise.resolve(S(function(){return Promise.resolve(e.getAll()).then(function(e){var t=JSON.stringify(e);return new Blob([t]).size})},function(e){return console.error("ChromeStore.getSize 失败:",e),0}))}catch(e){return Promise.reject(e)}},t.getStoreKey=function(){return this.storageKey},e}();P.instances=new Map;var x="https://www.linkedin.com/voyager/api";function C(e,t){var n,r={"csrf-token":e};return t&&(n="string"==typeof t?t:Object.entries(t).map(function(e){return e[0]+"="+e[1]}).join("; "))&&(r.Cookie=n),r}var k={profilePage:{userPicture:[".pv-top-card__non-self-photo-wrapper img","#recent-activity-top-card img",".pv-top-card__photo-wrapper img",'div[componentkey^="com.linkedin.sdui.profile.card"] div[data-view-name="profile-top-card-member-photo"] img'],userName:['a[href^="/in"] h1',"#recent-activity-top-card h3",'div[data-view-name="profile-top-card-verified-badge"] div[role="button"]'],userOccupation:[".artdeco-entity-lockup .artdeco-entity-lockup__subtitle","#recent-activity-top-card h4"],linkedinProfileCard:[".scaffold-layout__main .artdeco-card:first-child",'div[componentkey^="com.linkedin.sdui.profile.card"]'],privateProfileInfoSection:[".pv-profile-info-section"],howToContainer:["#profile-content, header#global-nav"],companyName:[".top-card-background-hero-image+div .mt2 ul>li span",'div[componentkey^="com.linkedin.sdui.profile.card"] div:has(div[data-view-name="profile-top-card-verified-badge"]) + div div[role="button"] p'],companyLogo:[".top-card-background-hero-image+div .mt2 ul>li img"],campaignsListContainer:[".ui-row.sm.campaigns-list-container"],contactListContainer:[".ui-row.sm.contact-list-container"],location:["#profile-content .artdeco-card .top-card-background-hero-image+div .text-body-small.inline.t-black--light"],campaignsListContainerDisplay:[".ui-col.sm.campaigns-list-container-display"],contactListContainerDisplay:[".ui-col.sm.contact-list-container-display"],mainExperienceContainer:[".artdeco-card:has(#experience) li:first-child",'div[componentkey^="com.linkedin.sdui.profile.card"][componentkey$="ExperienceTopLevelSection"] div:has(h2) + div > div'],experienceCompanyLogo:['[data-field="experience_company_logo"] img','div[componentkey^="com.linkedin.sdui.profile.card"][componentkey$="ExperienceTopLevelSection"] div:has(h2) + div figure[data-view-name="image"] img'],experienceCompanyName:['div:has([data-field="experience_company_logo"])+div .t-normal span:not(.visually-hidden)'],experienceOccupation:['div:has([data-field="experience_company_logo"])+div .t-bold span:not(.visually-hidden)'],experienceMultipleCompany:["li:has([data-view-name=profile-component-entity] .pvs-entity__sub-components .pvs-entity__sub-components) .t-bold span:not(.visually-hidden)"],experienceMultipleOccupation:['[data-view-name="profile-component-entity"] li:first-child .t-bold span:not(.visually-hidden)']},salesNavProfilePage:{profileCardSection:["#profile-card-section"],userName:['#profile-card-section [data-anonymize="person-name"]'],userPicture:['#profile-card-section img[data-anonymize="headshot-photo"]'],userOccupation:['#profile-card-section [data-anonymize="headline"]'],profileUrl:['#profile-card-section a[href^="/sales/lead"]'],linkedinProfileCard:["#profile-card-section"],campaignsListContainer:[".ui-row.sm.campaigns-list-container"],contactListContainer:[".ui-row.sm.contact-list-container"],campaignsListContainerDisplay:[".ui-col.sm.campaigns-list-container-display"],contactListContainerDisplay:[".ui-col.sm.contact-list-container-display"],location:["#profile-card-section>section>div>div:last-child div:has(svg)"],companyName:['#profile-card-section a[data-anonymize="company-name"]'],companyLogo:['#profile-card-section img[data-anonymize="company-logo"]'],moreInfoButton:["#profile-card-section section[data-x--lead-actions-bar] button[data-x--lead-actions-bar-overflow-menu]",'#profile-card-section button[aria-label="Open actions overflow menu"]'],linkedinProfileLinkButton:['#hue-web-menu-outlet a[href^="https://www.linkedin.com/in/"]'],mainExperienceContainer:['[data-sn-view-name="feature-lead-experience"]'],experienceCompanyLogo:['li:first-child img[data-anonymize="company-logo"]'],experienceCompanyName:['li:first-child [data-anonymize="company-name"]'],experienceOccupation:['li:first-child [data-anonymize="job-title"]'],experienceMultipleOccupation:['ul li ul li:first-child [data-anonymize="job-title"]','ul li [data-anonymize="job-title"]'],experienceMultipleCompany:['li:first-child [data-anonymize="company-name"]']},searchPeoplePage:{searchEntityResult:['[data-view-name="search-entity-result-universal-template"]'],linkedinUrl:['a[data-test-app-aware-link][href^="https://www.linkedin.com/in/"]','a[data-view-name="search-result-lockup-title"]'],image:[".presence-entity img","a>div>div>figure>img"],userOccupation:['p:has(a[data-view-name="search-result-lockup-title"]) + p',".entity-result__primary-subtitle",".entity-result__divider > div div:nth-child(2)","div>div>div:nth-child(2)>div>div:nth-child(2)","figure + div p:nth-child(2)"],fullName:[".entity-result__title-text a span>span",".entity-result__title-line a span>span",".entity-result__title-line span>a>span>span","a:has(+.entity-result__badge)>span>span",".linked-area div:nth-child(2) > div:first-child > div.t-roman.t-sans a",'a[data-view-name="search-result-lockup-title"]'],resultList:[".search-results-container>div:has(.reusable-search__result-container)"],actionsDiv:[".entity-result__actions",".linked-area > div > div:last-child","div:has(figure) > div:last-child"],validResult:["[data-chameleon-result-urn] , .reusable-search__result-container"],searchResult:[".search-results-container li:has(>[data-chameleon-result-urn])",'[data-view-name="people-search-result"]'],searchResultsContainer:[".search-results-container",'[role="main"] div:has(>hr[role="presentation"])'],mainLayoutLeft:[".search-marvel-srp",'[role="main"] div:has(hr)>div>div'],howToContainer:[".hasLegacyFeedLineHeight div:has(main)",".authentication-outlet"]},searchAllPage:{peopleButton:["nav ul.search-reusables__filter-list>li>button"],toolbar:[".scaffold-layout-toolbar"]}};function M(e,t,n){switch(n){case"all":var r=e.querySelectorAll(t);return r.length>0?Array.from(r):null;case"closest":return e instanceof HTMLElement?e.closest(t):null;default:return e.querySelector(t)}}function I(e){var t=e.page,n=e.key,r=e.container,i=e.mode;null!=r||(r=document);for(var o,a,s=d(t&&n?k[(o={page:t,key:n}).page][o.key]:[e.selector]);!(a=s()).done;){var c=M(r,a.value,i);if(c)return c}return null}function E(e){if(!e)return"";var t=document.createElement("textarea");return t.innerHTML=e,t.value.trim()}exports.ChromeStore=P,exports.Draggable=w,exports.MemoryStore=f,exports.RealUndefined=e,exports.WebStore=b,exports.cacheWrapper=function(e,t){void 0===t&&(t=u);var n=function(){var n=[].slice.call(arguments),o=r(n)+e.name+(t.identifier||"");if(l(o))return Promise.resolve(i(c(o)));if(s[o]){var h=Object.assign({},u,t);return new Promise(function(e){var t=Date.now(),n=setInterval(function(){l(o)?(clearInterval(n),e(i(c(o)))):Date.now()-t>h.timeout&&(s[o]=!1,clearInterval(n),e(i(h.timeoutResult)))},100)})}return s[o]=!0,e.apply(this,n).then(function(e){return a[o]=e,i(a[o])}).catch(function(e){throw e}).finally(function(){s[o]=!1})};return Object.defineProperty(n,"name",{value:"cacheWrapper_"+e.name,configurable:!0}),n},exports.cloneDeep=i,exports.createDefaultObject=o,exports.createElement=function e(t){var n=void 0===t?{}:t,r=n.tag,i=n.children,o=void 0===i?[]:i,a=n.props,s=void 0===a?{}:a,c=n.attrs,l=void 0===c?{}:c,u=n.styles,h=void 0===u?{}:u,p=document.createElement(void 0===r?"div":r);Object.assign(p,s);for(var f=0,v=Object.entries(l);f<v.length;f++){var g=v[f],y=g[1];!1!==y&&p.setAttribute(g[0],y)}for(var w=0,b=Object.entries(h);w<b.length;w++){var S=b[w];m(p,S[0],S[1])}for(var P,x=d(Array.isArray(o)?o:[o]);!(P=x()).done;){var C=P.value;C&&("object"==typeof C?C instanceof Element?p.appendChild(C):p.appendChild(e(C)):p.appendChild(document.createTextNode(C)))}return p},exports.createSvg=function(e){return"string"==typeof e?g(e):v(e)},exports.createSvgFromUrl=function(e){try{return Promise.resolve(function(t,n){try{var r=Promise.resolve(fetch(e)).then(function(e){if(!e.ok)throw new Error("网络请求失败: "+e.status+" "+e.statusText);return Promise.resolve(e.text()).then(g)})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){var t=e instanceof Error?e.message:"未知错误";throw new Error("无法创建 SVG 元素: "+t)}))}catch(e){return Promise.reject(e)}},exports.debounce=function(e,t){var n=null;return function(){var r=arguments,i=this;null!==n&&clearTimeout(n),n=setTimeout(function(){e.apply(i,[].slice.call(r)),n=null},t)}},exports.decodeJWT=function(e){var t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(n)},exports.delayExecution=function(e,t){void 0===t&&(t=0);var n=[].slice.call(arguments,2);return new Promise(function(r){0===t?r(e.apply(void 0,n)):setTimeout(function(){r(e.apply(void 0,n))},t)})},exports.generateStableUniqueKey=r,exports.getContactInfo=function(){var e,t,n,r,i,o,a,s=window.location.href.includes("linkedin.com/sales")?"salesNavProfilePage":"profilePage";function c(e){return I({page:s,key:e,container:document})}var l=null==(e=c("userName"))?void 0:e.innerText;if(!l)return console.error("extractUserInfos: no userName found"),{};var u,h=null==(t=c("userPicture"))?void 0:t.src,d=null==(n=c("userOccupation"))?void 0:n.innerHTML,p=null==(r=c("companyName"))?void 0:r.innerText,f=null==(i=c("companyLogo"))?void 0:i.src,m=null==(o=c("location"))?void 0:o.innerText;return"salesNavProfilePage"===s&&(u=/linkedin\.com\/sales\/lead/i.test(window.location.href)?window.location.href:null==(a=c("profileUrl"))?void 0:a.href),{name:E(l),profileUrl:u,picture:h,occupation:E(d),companyName:p,companyPicture:f,location:m}},exports.getElement=I,exports.getGlobal=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this},exports.getLinkedinCompany=function(e,t){var n=t.csrfToken,r=t.cookies;try{var i="string"==typeof e?{universalName:e}:e,o="universalName"in i,a=x+"/organization/companies"+(o?"?q=universalName&universalName="+i.universalName:"/"+i.urn),s=C(n,r);return Promise.resolve(fetch(a,{method:"GET",headers:s}).then(function(e){try{var t,n=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){if(o){var n,r=(null==(n=e.elements)?void 0:n[0])||null;return t=1,r}return t=1,e})}();return Promise.resolve(n&&n.then?n.then(function(e){return t?e:null}):t?n:null)}catch(e){return Promise.reject(e)}}).catch(function(e){return console.error(e),null}))}catch(e){return Promise.reject(e)}},exports.getLinkedinProfile=function(e,t){var n=t.csrfToken,r=t.cookies;try{var i=x+"/identity/dash/profiles?q=memberIdentity&memberIdentity="+e+"&decorationId=com.linkedin.voyager.dash.deco.identity.profile.FullProfileWithEntities-26",o=C(n,r);return Promise.resolve(fetch(i,{method:"GET",headers:o}).then(function(e){try{var t,n=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){var n,r=(null==(n=e.elements)?void 0:n[0])||null;return t=1,r})}();return Promise.resolve(n&&n.then?n.then(function(e){return t?e:null}):t?n:null)}catch(e){return Promise.reject(e)}}).catch(function(e){return console.error(e),null}))}catch(e){return Promise.reject(e)}},exports.isCloneable=t,exports.isPrimitive=n,exports.launchWebAuthFlow=function(e){var t=e.clientId,n=e.responseType,r=void 0===n?"code":n,i=e.state,o=e.nonce,a=e.interactive,s=void 0===a||a;try{var c=chrome.identity.getRedirectURL(),l=Array.isArray(r)?r:[r],u=new URL("https://accounts.google.com/o/oauth2/v2/auth");return u.searchParams.set("client_id",t),u.searchParams.set("redirect_uri",c),u.searchParams.set("response_type",l.join(" ")),u.searchParams.set("scope","openid email profile"),o&&u.searchParams.set("nonce",o),i&&u.searchParams.set("state",i),Promise.resolve(chrome.identity.launchWebAuthFlow({url:u.toString(),interactive:s}).then(function(e){if(!e)return Promise.reject(new Error("redirectUrl is null"));var t=e.includes("?")?"?":"#",n=new URLSearchParams(e.split(t)[1]),r={};return n.forEach(function(e,t){r[t]=e}),r}).catch(function(e){return console.log("error",e),Promise.reject(e)}))}catch(e){return Promise.reject(e)}},exports.scrollToBottom=y,exports.scrollToBottomIfNeeded=function(e){e&&("true"!==e.dataset.isListeningForUserScroll&&(function(e){e&&e.addEventListener("scroll",function(){!function(e,t){e.dataset.userInteracted=t?"true":"false"}(e,e.scrollTop+e.clientHeight<e.scrollHeight-5)})}(e),e.dataset.isListeningForUserScroll="true"),"true"!==e.dataset.userInteracted&&y(e))},exports.singleExecutionWrapper=function(t,n){void 0===n&&(n=0);var r=function(){if(r.isExecuting)return Promise.resolve(e);r.isExecuting=!0;var i=performance.now(),o=t.apply(this,[].slice.call(arguments));return o.finally(function(){var e=performance.now()-i;n&&n>e?setTimeout(function(){r.isExecuting=!1},n-e):r.isExecuting=!1}),o};return r.isExecuting=!1,r};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|