@i.un/libs 1.0.2 → 1.0.3

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.
@@ -1,2 +1,2 @@
1
- const e=Symbol("undefined");function t(e){return"function"==typeof(null==e?void 0:e.clone)}function n(e){const t=typeof e;return null===e||"string"===t||"number"===t||"boolean"===t||"undefined"===t}function i(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function o(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((e,n)=>(e[n]=t[n],e),{})})}function r(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(e=>r(e));const n={};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=r(e[t]));return n}function s(e,t){let n=null;return function(...i){const o=this;null!==n&&clearTimeout(n),n=setTimeout(()=>{e.apply(o,i),n=null},t)}}function a(e,t=0,...n){return new Promise(i=>{0===t?i(e(...n)):setTimeout(()=>{i(e(...n))},t)})}function c(e){return new Proxy({},{get:(t,n)=>t.hasOwnProperty(n)?t[n]:e})}const l=c(e),h=c(!1);function d(e){return l[e]}function u(t){return l[t]!==e}const p={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function m(e,t=p){const n=function(...n){const i=o(n)+e.name+(t.identifier||"");if(u(i))return Promise.resolve(r(d(i)));if(h[i]){const e=Object.assign({},p,t);return new Promise(t=>{const n=Date.now(),o=setInterval(()=>{u(i)?(clearInterval(o),t(r(d(i)))):Date.now()-n>e.timeout&&(h[i]=!1,clearInterval(o),t(r(e.timeoutResult)))},100)})}return h[i]=!0,e.apply(this,n).then(e=>(l[i]=e,r(l[i]))).catch(e=>{throw e}).finally(()=>{h[i]=!1})};return Object.defineProperty(n,"name",{value:`cacheWrapper_${e.name}`,configurable:!0}),n}function g(t,n=0){const i=function i(...o){if(i.isExecuting)return Promise.resolve(e);i.isExecuting=!0;const r=performance.now(),s=t.apply(this,o);return s.finally(()=>{const e=performance.now()-r;n&&n>e?setTimeout(()=>{i.isExecuting=!1},n-e):i.isExecuting=!1}),s};return i.isExecuting=!1,i}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y.apply(null,arguments)}class f{constructor(e){this.storageKey=void 0,this.data={},this.changeCallbacks=[],this.storageKey=e}static getInstanceKey(e){return`memory:${e}`}static getInstance(e){const t=this.getInstanceKey(e);return this.instances.has(t)||this.instances.set(t,new f(e)),this.instances.get(t)}static create(e){return this.getInstance(e)}static clearInstance(e){const t=this.getInstanceKey(e),n=this.instances.get(t);n&&n.clearChangeCallbacks(),this.instances.delete(t)}static clearAllInstances(){this.instances.forEach(e=>{e.clearChangeCallbacks()}),this.instances.clear()}set(e,t){try{const n=this.data[e];this.data=y({},this.data,{[e]:t}),this.triggerChange(n,t)}catch(e){throw console.error("MemoryStore.set 失败:",e),e}}get(e){try{return this.data[e]}catch(e){throw console.error("MemoryStore.get 失败:",e),e}}getAll(){return y({},this.data)}remove(e){try{if(e in this.data){const t=this.data[e],n=y({},this.data);delete n[e],this.data=n,this.triggerChange(t,void 0)}}catch(e){throw console.error("MemoryStore.remove 失败:",e),e}}clear(){try{const e=y({},this.data);this.data={},this.triggerChange(e,{})}catch(e){throw console.error("MemoryStore.clear 失败:",e),e}}setMultiple(e){try{const t=y({},this.data);this.data=y({},this.data,e),this.triggerChange(t,this.data)}catch(e){throw console.error("MemoryStore.setMultiple 失败:",e),e}}onChanged(e){this.changeCallbacks.push(e)}triggerChange(e,t){if(this.changeCallbacks.length>0){const n={[this.storageKey]:{oldValue:e,newValue:t}};this.changeCallbacks.forEach(e=>{try{e(n)}catch(e){console.error("MemoryStore 变化回调执行失败:",e)}})}}clearChangeCallbacks(){this.changeCallbacks=[]}has(e){try{return e in this.data}catch(e){return console.error("MemoryStore.has 失败:",e),!1}}getSize(){try{const e=JSON.stringify(this.data);return new Blob([e]).size}catch(e){return console.error("MemoryStore.getSize 失败:",e),0}}getStoreKey(){return this.storageKey}getStoreType(){return"memory"}}function v(e,t,n,i=!1){if(t in e.style)e.style[t]=n;else{const o=i?"important":"";e.style.setProperty(t,String(n),o)}}function w({tag:e="div",children:t=[],props:n={},attrs:i={},styles:o={}}={}){const r=document.createElement(e);Object.assign(r,n);for(const[e,t]of Object.entries(i))!1!==t&&r.setAttribute(e,t);for(const[e,t]of Object.entries(o))v(r,e,t);const s=Array.isArray(t)?t:[t];for(const e of s)e&&("object"==typeof e?e instanceof Element?r.appendChild(e):r.appendChild(w(e)):r.appendChild(document.createTextNode(e)));return r}function b(e){const t=document.createElementNS("http://www.w3.org/2000/svg",e.type);if(e.props)for(const[n,i]of Object.entries(e.props))t.setAttribute(n,i);if("string"==typeof e.children){const n=document.createTextNode(e.children);t.appendChild(n)}else Array.isArray(e.children)&&e.children.forEach(e=>{const n=b(e);t.appendChild(n)});return t}function S(e){const t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function k(e){return"string"==typeof e?S(e):b(e)}async function C(e){try{const t=await fetch(e);if(!t.ok)throw new Error(`网络请求失败: ${t.status} ${t.statusText}`);return S(await t.text())}catch(e){const t=e instanceof Error?e.message:"未知错误";throw new Error(`无法创建 SVG 元素: ${t}`)}}function M(e){e&&setTimeout(()=>{e.scrollTop=e.scrollHeight},0)}function x(e){e&&("true"!==e.dataset.isListeningForUserScroll&&(function(e){e&&e.addEventListener("scroll",()=>{!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&&M(e))}f.instances=new Map;class _{constructor(e,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=y({coordinate:"tl"},t);let 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))}onMouseDown(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)}getBoundedPosition(e,t){const n=this.element.getBoundingClientRect();let i,o;if("fixed"===getComputedStyle(this.element).position)i=window.innerWidth-n.width,o=window.innerHeight-n.height;else{const e=(this.element.offsetParent||document.documentElement).getBoundingClientRect();i=e.width-n.width,o=e.height-n.height}return{x:Math.min(Math.max(0,e),i),y:Math.min(Math.max(0,t),o)}}onMouseMove(e){if(!this.isDragging){const 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){const t=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=t.x+"px",this.element.style.top=t.y+"px",this.options.onDrag&&this.options.onDrag(e)}}convertCoordinate(){const e=this.element.getBoundingClientRect(),t=getComputedStyle(this.element).position;let n,i,o=null,r=null;if("fixed"===t?(o=null,r=new DOMRect(0,0,window.innerWidth,window.innerHeight)):(o=this.element.offsetParent,o||(o=document.documentElement),"static"===getComputedStyle(o).position?(o=null,r=new DOMRect(0,0,window.innerWidth,window.innerHeight)):r=o.getBoundingClientRect()),r){if("fixed"===t)n=e.left,i=e.top;else if(n=e.left-r.left,i=e.top-r.top,o instanceof HTMLElement){const e=getComputedStyle(o);n-=parseFloat(e.borderLeftWidth)||0,i-=parseFloat(e.borderTopWidth)||0}else n+=window.scrollX,i+=window.scrollY;switch(this.options.coordinate){case"tr":const t=r.width-n-e.width;this.element.style.left="auto",this.element.style.right=`${t}px`,this.element.style.top=`${i}px`,this.element.style.bottom="auto";break;case"bl":const o=r.height-i-e.height;this.element.style.left=`${n}px`,this.element.style.right="auto",this.element.style.top="auto",this.element.style.bottom=`${o}px`;break;case"br":const s=r.width-n-e.width,a=r.height-i-e.height;this.element.style.left="auto",this.element.style.right=`${s}px`,this.element.style.top="auto",this.element.style.bottom=`${a}px`;break;default:this.element.style.left=`${n}px`,this.element.style.right="auto",this.element.style.top=`${i}px`,this.element.style.bottom="auto"}}}onMouseUp(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)}}class I{constructor(e,t="local"){this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.storageKey=e,this.storeType=t}static getInstanceKey(e,t="local"){return`${t}:${e}`}static getInstance(e,t="local"){const n=this.getInstanceKey(e,t);return this.instances.has(n)||this.instances.set(n,new I(e,t)),this.instances.get(n)}static local(e){return this.getInstance(e,"local")}static session(e){return this.getInstance(e,"session")}static clearInstance(e,t="local"){const n=this.getInstanceKey(e,t);this.instances.delete(n)}static clearAllInstances(){this.instances.clear()}getStore(){return this.store||(this.store="local"===this.storeType?localStorage:sessionStorage),this.store}set(e,t){try{const n=y({},this.getAll(),{[e]:t});this.getStore().setItem(this.storageKey,JSON.stringify(n))}catch(e){throw console.error("WebStore.set 失败:",e),e}}get(e){try{const t=this.getAll();return null==t?void 0:t[e]}catch(e){throw console.error("WebStore.get 失败:",e),e}}getAll(){try{const e=this.getStore().getItem(this.storageKey);return e?JSON.parse(e):{}}catch(e){return console.error("WebStore.getAll 失败:",e),{}}}remove(e){try{const 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}}clear(){try{this.getStore().removeItem(this.storageKey)}catch(e){throw console.error("WebStore.clear 失败:",e),e}}setMultiple(e){try{const t=y({},this.getAll(),e);this.getStore().setItem(this.storageKey,JSON.stringify(t))}catch(e){throw console.error("WebStore.setMultiple 失败:",e),e}}onChanged(e){window.addEventListener("storage",t=>{if(t.key===this.storageKey&&t.storageArea===this.getStore()){const n={[this.storageKey]:{oldValue:t.oldValue?JSON.parse(t.oldValue):void 0,newValue:t.newValue?JSON.parse(t.newValue):void 0}};e(n)}})}has(e){try{return void 0!==this.get(e)}catch(e){return console.error("WebStore.has 失败:",e),!1}}getSize(){try{const e=this.getStore().getItem(this.storageKey)||"";return new Blob([e]).size}catch(e){return console.error("WebStore.getSize 失败:",e),0}}getStoreKey(){return this.storageKey}}I.instances=new Map;class L{constructor(e,t="local"){this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.storageKey=e,this.storeType=t}static getInstanceKey(e,t="local"){return`${t}:${e}`}static getInstance(e,t="local"){const n=this.getInstanceKey(e,t);return this.instances.has(n)||this.instances.set(n,new L(e,t)),this.instances.get(n)}static local(e){return this.getInstance(e,"local")}static sync(e){return this.getInstance(e,"sync")}static clearInstance(e,t="local"){const n=this.getInstanceKey(e,t);this.instances.delete(n)}static clearAllInstances(){this.instances.clear()}getStore(){return this.store||(this.store=chrome.storage[this.storeType]),this.store}async set(e,t){try{const n=y({},await this.getAll(),{[e]:t});await this.getStore().set({[this.storageKey]:n})}catch(e){throw console.error("ChromeStore.set 失败:",e),e}}async get(e){try{const t=await this.getAll();return null==t?void 0:t[e]}catch(e){throw console.error("ChromeStore.get 失败:",e),e}}async getAll(){try{return(await this.getStore().get(this.storageKey))[this.storageKey]||{}}catch(e){throw console.error("ChromeStore.getAll 失败:",e),e}}async remove(e){try{const t=await this.getAll();t&&e in t&&(delete t[e],await this.getStore().set({[this.storageKey]:t}))}catch(e){throw console.error("ChromeStore.remove 失败:",e),e}}async clear(){try{await this.getStore().remove(this.storageKey)}catch(e){throw console.error("ChromeStore.clear 失败:",e),e}}async setMultiple(e){try{const t=y({},await this.getAll(),e);await this.getStore().set({[this.storageKey]:t})}catch(e){throw console.error("ChromeStore.setMultiple 失败:",e),e}}onChanged(e){chrome.storage.onChanged.addListener((t,n)=>{n===this.storeType&&t[this.storageKey]&&e(t)})}async has(e){try{return void 0!==await this.get(e)}catch(e){return console.error("ChromeStore.has 失败:",e),!1}}async getSize(){try{const e=await this.getAll(),t=JSON.stringify(e);return new Blob([t]).size}catch(e){return console.error("ChromeStore.getSize 失败:",e),0}}getStoreKey(){return this.storageKey}}async function E({clientId:e,responseType:t="code",state:n,nonce:i,interactive:o=!0}){const r=chrome.identity.getRedirectURL(),s=Array.isArray(t)?t:[t],a=new URL("https://accounts.google.com/o/oauth2/v2/auth");return a.searchParams.set("client_id",e),a.searchParams.set("redirect_uri",r),a.searchParams.set("response_type",s.join(" ")),a.searchParams.set("scope","openid email profile"),i&&a.searchParams.set("nonce",i),n&&a.searchParams.set("state",n),chrome.identity.launchWebAuthFlow({url:a.toString(),interactive:o}).then(e=>{if(!e)return Promise.reject(new Error("redirectUrl is null"));const t=e.includes("?")?"?":"#",n=new URLSearchParams(e.split(t)[1]),i={};return n.forEach((e,t)=>{i[t]=e}),i}).catch(e=>(console.log("error",e),Promise.reject(e)))}function P(e){let 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)}function T(e,t,n=!1){return chrome.cookies.get({url:e,name:t}).then(e=>{var t;return n?(null==e||null==(t=e.value)?void 0:t.replace(/"/g,""))||"":null!=e?e:void 0})}function A(e,t=!1){return chrome.cookies.getAll({url:e}).then(e=>t?function(e){return e.map(e=>`${e.name}=${e.value}`).join("; ")}(e):e)}function O(){var e,t,n;return{locale:null==(e=chrome.i18n)?void 0:e.getUILanguage(),extId:null==(t=chrome.runtime)?void 0:t.id,version:null==(n=chrome.runtime)?void 0:n.getManifest().version}}function K(e){return"object"==typeof e&&null!==e&&"__error"in e&&!0===e.__error}function $(e={}){const{debug:t=!1,logPrefix:n="[MessageBus]"}=e,i=new Map;let o=!1;function r(e,...i){t&&console.error(`${n} ${e}`,...i)}function s(){o||(chrome.runtime.onMessage.addListener((e,t,n)=>{if(!e||"string"!=typeof e.type)return;const o=i.get(e.type);if(o)try{const i=o(e.payload,t);return i instanceof Promise?(i.then(n).catch(t=>{r(`Error handling "${String(e.type)}":`,t),n({__error:!0,message:t instanceof Error?t.message:String(t)})}),!0):(n(i),!1)}catch(t){return r(`Error handling "${String(e.type)}":`,t),n({__error:!0,message:t instanceof Error?t.message:String(t)}),!1}}),o=!0)}return{send:(e,t)=>chrome.runtime.sendMessage({type:e,payload:t}),sendToTab:(e,t,n)=>chrome.tabs.sendMessage(e,{type:t,payload:n}),on:(e,t)=>(s(),i.set(e,t),()=>{i.delete(e)}),onMany(e){s();const t=[];for(const[n,o]of Object.entries(e))o&&(i.set(n,o),t.push(n));return()=>{for(const e of t)i.delete(e)}},hasHandler:e=>i.has(e),getRegisteredTypes:()=>Array.from(i.keys()),clearAllHandlers(){i.clear()}}}L.instances=new Map;const N="https://www.linkedin.com/voyager/api";async function j({csrfToken:e,cookies:t}){const n=`${N}/me`,i=U(e,t);return fetch(n,{method:"GET",headers:i}).then(async e=>e.ok?e.json():null).catch(e=>(console.error(e),null))}function U(e,t){const n={"csrf-token":e};if(t){let e="";e="string"==typeof t?t:Object.entries(t).map(([e,t])=>`${e}=${t}`).join("; "),e&&(n.Cookie=e)}return n}async function R(e,{csrfToken:t,cookies:n}){const i=`${N}/identity/dash/profiles?q=memberIdentity&memberIdentity=${e}&decorationId=com.linkedin.voyager.dash.deco.identity.profile.FullProfileWithEntities-26`,o=U(t,n);return fetch(i,{method:"GET",headers:o}).then(async e=>{var t;return e.ok&&(null==(t=(await e.json()).elements)?void 0:t[0])||null}).catch(e=>(console.error(e),null))}async function D(e,{csrfToken:t,cookies:n}){let i="";const o="string"==typeof e?{universalName:e}:e,r="universalName"in o;i=r?`?q=universalName&universalName=${o.universalName}`:`/${o.urn}`;const s=`${N}/organization/companies${i}`,a=U(t,n);return fetch(s,{method:"GET",headers:a}).then(async e=>{if(e.ok){const n=await e.json();var t;return r?(null==(t=n.elements)?void 0:t[0])||null:n}return null}).catch(e=>(console.error(e),null))}const z={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 H(e,t,n){switch(n){case"all":const 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)}}function W({page:e,key:t,selector:n,container:i,mode:o}){null!=i||(i=document);const r=e&&t?function({page:e,key:t}){return z[e][t]}({page:e,key:t}):[n];for(const e of r){const t=H(i,e,o);if(t)return t}return null}function B(e){if(!e)return"";const t=document.createElement("textarea");return t.innerHTML=e,t.value.trim()}function V(){var e,t,n,i,o,r,s;const a=window.location.href.includes("linkedin.com/sales")?"salesNavProfilePage":"profilePage";function c(e){return W({page:a,key:e,container:document})}const l=null==(e=c("userName"))?void 0:e.innerText;if(!l)return console.error("extractUserInfos: no userName found"),{};const h=null==(t=c("userPicture"))?void 0:t.src,d=null==(n=c("userOccupation"))?void 0:n.innerHTML,u=null==(i=c("companyName"))?void 0:i.innerText,p=null==(o=c("companyLogo"))?void 0:o.src,m=null==(r=c("location"))?void 0:r.innerText;let g;return"salesNavProfilePage"===a&&(g=/linkedin\.com\/sales\/lead/i.test(window.location.href)?window.location.href:null==(s=c("profileUrl"))?void 0:s.href),{name:B(l),profileUrl:g,picture:h,occupation:B(d),companyName:u,companyPicture:p,location:m}}function X(e){return/^https?:\/\/(www|.{2})\.linkedin\.com/.test(e)}const Y={"":0,chrome:1,"chrome-extension":2,"view-source":3,ftp:4,file:5,data:6,blob:7,about:8};function J(e=""){let t="";const n=e.split("#")[0].toLocaleLowerCase();return/^https\:\/\/(www|.{2})\.linkedin\.com\/in\/[^/?]+(\/recent-activity\/|\/details\/|\/overlay\/|\/?\?[^/]*|\/?$)/.test(n)||/^https\:\/\/(www|.{2})\.linkedin\.com\/sales\/people\/(.+?),/.test(n)||/^https\:\/\/(www|.{2})\.linkedin\.com\/sales\/(profile|lead)\/([^,]{39}),/.test(n)?t="profile":n.includes("linkedin.com/feed")?t="feed":n.includes("linkedin.com/posts/")?t="post":n.includes("linkedin.com/login")||n.includes("linkedin.com/checkpoint")||n.includes("linkedin.com/authwall")?t="login":n.includes("linkedin.com/company/")?t="company":n.includes("linkedin.com/messaging/thread/")?t="messages":n.includes("linkedin.com/search/results/people/?")||n.includes("linkedin.com/sales/search/people")?t="search-people":n.includes("linkedin.com/search/results/all")?t="search-all":n.includes("linkedin.com/mynetwork/")&&(t="connections"),t}function F(e=""){var t;const n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/in\/([^?/]+)/)||[])[1]||(e.match(/linkedin\.com\/sales\/people\/(.+?),/)||[])[1]||(e.match(/linkedin\.com\/sales\/(?:profile|lead)\/([^,]{39}),/)||[])[1]||"";return decodeURIComponent(n)}function G(e=""){var t;const n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/posts\/([^\/]+)\//)||[])[1]||"";return decodeURIComponent(n)}function q(e=""){var t;const n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/company\/([^?/]+)/)||[])[1]||"";return decodeURIComponent(n)}function Q(e=""){var t;return F(e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL)||q(e)||""}function Z(e=""){if(!e)return"";const t=Object.keys(Y),n=new URL(e).protocol.replace(":","");return t.includes(n)?n:J(e)}export{L as ChromeStore,_ as Draggable,f as MemoryStore,e as RealUndefined,I as WebStore,m as cacheWrapper,r as cloneDeep,c as createDefaultObject,w as createElement,$ as createMessageBus,k as createSvg,C as createSvgFromUrl,s as debounce,P as decodeJWT,a as delayExecution,o as generateStableUniqueKey,q as getCompanyPublicId,V as getContactInfo,T as getCookie,A as getCookies,W as getElement,O as getExtensionInfo,i as getGlobal,D as getLinkedinCompany,j as getLinkedinMe,J as getLinkedinPageType,R as getLinkedinProfile,Q as getLinkedinPublicId,Z as getPageType,G as getPostPublicId,F as getProfilePublicId,t as isCloneable,K as isErrorResponse,X as isLinkedInUrl,n as isPrimitive,E as launchWebAuthFlow,Y as pageTypeMap,M as scrollToBottom,x as scrollToBottomIfNeeded,g as singleExecutionWrapper};
1
+ const e=Symbol("undefined");function t(e){return"function"==typeof(null==e?void 0:e.clone)}function n(e){const t=typeof e;return null===e||"string"===t||"number"===t||"boolean"===t||"undefined"===t}function i(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function o(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((e,n)=>(e[n]=t[n],e),{})})}function r(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(e=>r(e));const n={};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=r(e[t]));return n}function s(e,t){let n=null;return function(...i){const o=this;null!==n&&clearTimeout(n),n=setTimeout(()=>{e.apply(o,i),n=null},t)}}function a(e,t=0,...n){return new Promise(i=>{0===t?i(e(...n)):setTimeout(()=>{i(e(...n))},t)})}function c(e){return new Proxy({},{get:(t,n)=>t.hasOwnProperty(n)?t[n]:e})}const l=c(e),h=c(!1);function d(e){return l[e]}function u(t){return l[t]!==e}const p={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function m(e,t=p){const n=function(...n){const i=o(n)+e.name+(t.identifier||"");if(u(i))return Promise.resolve(r(d(i)));if(h[i]){const e=Object.assign({},p,t);return new Promise(t=>{const n=Date.now(),o=setInterval(()=>{u(i)?(clearInterval(o),t(r(d(i)))):Date.now()-n>e.timeout&&(h[i]=!1,clearInterval(o),t(r(e.timeoutResult)))},100)})}return h[i]=!0,e.apply(this,n).then(e=>(l[i]=e,r(l[i]))).catch(e=>{throw e}).finally(()=>{h[i]=!1})};return Object.defineProperty(n,"name",{value:`cacheWrapper_${e.name}`,configurable:!0}),n}function g(t,n=0){const i=function i(...o){if(i.isExecuting)return Promise.resolve(e);i.isExecuting=!0;const r=performance.now(),s=t.apply(this,o);return s.finally(()=>{const e=performance.now()-r;n&&n>e?setTimeout(()=>{i.isExecuting=!1},n-e):i.isExecuting=!1}),s};return i.isExecuting=!1,i}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y.apply(null,arguments)}class f{constructor(e){this.storageKey=void 0,this.data={},this.changeCallbacks=[],this.storageKey=e}static getInstanceKey(e){return`memory:${e}`}static getInstance(e){const t=this.getInstanceKey(e);return this.instances.has(t)||this.instances.set(t,new f(e)),this.instances.get(t)}static create(e){return this.getInstance(e)}static clearInstance(e){const t=this.getInstanceKey(e),n=this.instances.get(t);n&&n.clearChangeCallbacks(),this.instances.delete(t)}static clearAllInstances(){this.instances.forEach(e=>{e.clearChangeCallbacks()}),this.instances.clear()}set(e,t){try{const n=this.data[e];this.data=y({},this.data,{[e]:t}),this.triggerChange(n,t)}catch(e){throw console.error("MemoryStore.set 失败:",e),e}}get(e){try{return this.data[e]}catch(e){throw console.error("MemoryStore.get 失败:",e),e}}getAll(){return y({},this.data)}remove(e){try{if(e in this.data){const t=this.data[e],n=y({},this.data);delete n[e],this.data=n,this.triggerChange(t,void 0)}}catch(e){throw console.error("MemoryStore.remove 失败:",e),e}}clear(){try{const e=y({},this.data);this.data={},this.triggerChange(e,{})}catch(e){throw console.error("MemoryStore.clear 失败:",e),e}}setMultiple(e){try{const t=y({},this.data);this.data=y({},this.data,e),this.triggerChange(t,this.data)}catch(e){throw console.error("MemoryStore.setMultiple 失败:",e),e}}onChanged(e){this.changeCallbacks.push(e)}triggerChange(e,t){if(this.changeCallbacks.length>0){const n={[this.storageKey]:{oldValue:e,newValue:t}};this.changeCallbacks.forEach(e=>{try{e(n)}catch(e){console.error("MemoryStore 变化回调执行失败:",e)}})}}clearChangeCallbacks(){this.changeCallbacks=[]}has(e){try{return e in this.data}catch(e){return console.error("MemoryStore.has 失败:",e),!1}}getSize(){try{const e=JSON.stringify(this.data);return new Blob([e]).size}catch(e){return console.error("MemoryStore.getSize 失败:",e),0}}getStoreKey(){return this.storageKey}getStoreType(){return"memory"}}function v(e,t,n,i=!1){if(t in e.style)e.style[t]=n;else{const o=i?"important":"";e.style.setProperty(t,String(n),o)}}function w({tag:e="div",children:t=[],props:n={},attrs:i={},styles:o={}}={}){const r=document.createElement(e);Object.assign(r,n);for(const[e,t]of Object.entries(i))!1!==t&&r.setAttribute(e,t);for(const[e,t]of Object.entries(o))v(r,e,t);const s=Array.isArray(t)?t:[t];for(const e of s)e&&("object"==typeof e?e instanceof Element?r.appendChild(e):r.appendChild(w(e)):r.appendChild(document.createTextNode(e)));return r}function b(e){const t=document.createElementNS("http://www.w3.org/2000/svg",e.type);if(e.props)for(const[n,i]of Object.entries(e.props))t.setAttribute(n,i);if("string"==typeof e.children){const n=document.createTextNode(e.children);t.appendChild(n)}else Array.isArray(e.children)&&e.children.forEach(e=>{const n=b(e);t.appendChild(n)});return t}function S(e){const t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function k(e){return"string"==typeof e?S(e):b(e)}async function C(e){try{const t=await fetch(e);if(!t.ok)throw new Error(`网络请求失败: ${t.status} ${t.statusText}`);return S(await t.text())}catch(e){const t=e instanceof Error?e.message:"未知错误";throw new Error(`无法创建 SVG 元素: ${t}`)}}function M(e){e&&setTimeout(()=>{e.scrollTop=e.scrollHeight},0)}function x(e){e&&("true"!==e.dataset.isListeningForUserScroll&&(function(e){e&&e.addEventListener("scroll",()=>{!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&&M(e))}f.instances=new Map;class _{constructor(e,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=y({coordinate:"tl"},t);let 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))}onMouseDown(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)}getBoundedPosition(e,t){const n=this.element.getBoundingClientRect();let i,o;if("fixed"===getComputedStyle(this.element).position)i=window.innerWidth-n.width,o=window.innerHeight-n.height;else{const e=(this.element.offsetParent||document.documentElement).getBoundingClientRect();i=e.width-n.width,o=e.height-n.height}return{x:Math.min(Math.max(0,e),i),y:Math.min(Math.max(0,t),o)}}onMouseMove(e){if(!this.isDragging){const 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){const t=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=t.x+"px",this.element.style.top=t.y+"px",this.options.onDrag&&this.options.onDrag(e)}}convertCoordinate(){const e=this.element.getBoundingClientRect(),t=getComputedStyle(this.element).position;let n,i,o=null,r=null;if("fixed"===t?(o=null,r=new DOMRect(0,0,window.innerWidth,window.innerHeight)):(o=this.element.offsetParent,o||(o=document.documentElement),"static"===getComputedStyle(o).position?(o=null,r=new DOMRect(0,0,window.innerWidth,window.innerHeight)):r=o.getBoundingClientRect()),r){if("fixed"===t)n=e.left,i=e.top;else if(n=e.left-r.left,i=e.top-r.top,o instanceof HTMLElement){const e=getComputedStyle(o);n-=parseFloat(e.borderLeftWidth)||0,i-=parseFloat(e.borderTopWidth)||0}else n+=window.scrollX,i+=window.scrollY;switch(this.options.coordinate){case"tr":const t=r.width-n-e.width;this.element.style.left="auto",this.element.style.right=`${t}px`,this.element.style.top=`${i}px`,this.element.style.bottom="auto";break;case"bl":const o=r.height-i-e.height;this.element.style.left=`${n}px`,this.element.style.right="auto",this.element.style.top="auto",this.element.style.bottom=`${o}px`;break;case"br":const s=r.width-n-e.width,a=r.height-i-e.height;this.element.style.left="auto",this.element.style.right=`${s}px`,this.element.style.top="auto",this.element.style.bottom=`${a}px`;break;default:this.element.style.left=`${n}px`,this.element.style.right="auto",this.element.style.top=`${i}px`,this.element.style.bottom="auto"}}}onMouseUp(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)}}class I{constructor(e,t="local"){this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.storageKey=e,this.storeType=t}static getInstanceKey(e,t="local"){return`${t}:${e}`}static getInstance(e,t="local"){const n=this.getInstanceKey(e,t);return this.instances.has(n)||this.instances.set(n,new I(e,t)),this.instances.get(n)}static local(e){return this.getInstance(e,"local")}static session(e){return this.getInstance(e,"session")}static clearInstance(e,t="local"){const n=this.getInstanceKey(e,t);this.instances.delete(n)}static clearAllInstances(){this.instances.clear()}getStore(){return this.store||(this.store="local"===this.storeType?localStorage:sessionStorage),this.store}set(e,t){try{const n=y({},this.getAll(),{[e]:t});this.getStore().setItem(this.storageKey,JSON.stringify(n))}catch(e){throw console.error("WebStore.set 失败:",e),e}}get(e){try{const t=this.getAll();return null==t?void 0:t[e]}catch(e){throw console.error("WebStore.get 失败:",e),e}}getAll(){try{const e=this.getStore().getItem(this.storageKey);return e?JSON.parse(e):{}}catch(e){return console.error("WebStore.getAll 失败:",e),{}}}remove(e){try{const 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}}clear(){try{this.getStore().removeItem(this.storageKey)}catch(e){throw console.error("WebStore.clear 失败:",e),e}}setMultiple(e){try{const t=y({},this.getAll(),e);this.getStore().setItem(this.storageKey,JSON.stringify(t))}catch(e){throw console.error("WebStore.setMultiple 失败:",e),e}}onChanged(e){window.addEventListener("storage",t=>{if(t.key===this.storageKey&&t.storageArea===this.getStore()){const n={[this.storageKey]:{oldValue:t.oldValue?JSON.parse(t.oldValue):void 0,newValue:t.newValue?JSON.parse(t.newValue):void 0}};e(n)}})}has(e){try{return void 0!==this.get(e)}catch(e){return console.error("WebStore.has 失败:",e),!1}}getSize(){try{const e=this.getStore().getItem(this.storageKey)||"";return new Blob([e]).size}catch(e){return console.error("WebStore.getSize 失败:",e),0}}getStoreKey(){return this.storageKey}}I.instances=new Map;class L{constructor(e,t="local"){this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.storageKey=e,this.storeType=t}static getInstanceKey(e,t="local"){return`${t}:${e}`}static getInstance(e,t="local"){const n=this.getInstanceKey(e,t);return this.instances.has(n)||this.instances.set(n,new L(e,t)),this.instances.get(n)}static local(e){return this.getInstance(e,"local")}static sync(e){return this.getInstance(e,"sync")}static clearInstance(e,t="local"){const n=this.getInstanceKey(e,t);this.instances.delete(n)}static clearAllInstances(){this.instances.clear()}getStore(){return this.store||(this.store=chrome.storage[this.storeType]),this.store}async set(e,t){try{const n=y({},await this.getAll(),{[e]:t});await this.getStore().set({[this.storageKey]:n})}catch(e){throw console.error("ChromeStore.set 失败:",e),e}}async get(e){try{const t=await this.getAll();return null==t?void 0:t[e]}catch(e){throw console.error("ChromeStore.get 失败:",e),e}}async getAll(){try{return(await this.getStore().get(this.storageKey))[this.storageKey]||{}}catch(e){throw console.error("ChromeStore.getAll 失败:",e),e}}async remove(e){try{const t=await this.getAll();t&&e in t&&(delete t[e],await this.getStore().set({[this.storageKey]:t}))}catch(e){throw console.error("ChromeStore.remove 失败:",e),e}}async clear(){try{await this.getStore().remove(this.storageKey)}catch(e){throw console.error("ChromeStore.clear 失败:",e),e}}async setMultiple(e){try{const t=y({},await this.getAll(),e);await this.getStore().set({[this.storageKey]:t})}catch(e){throw console.error("ChromeStore.setMultiple 失败:",e),e}}onChanged(e){chrome.storage.onChanged.addListener((t,n)=>{n===this.storeType&&t[this.storageKey]&&e(t)})}async has(e){try{return void 0!==await this.get(e)}catch(e){return console.error("ChromeStore.has 失败:",e),!1}}async getSize(){try{const e=await this.getAll(),t=JSON.stringify(e);return new Blob([t]).size}catch(e){return console.error("ChromeStore.getSize 失败:",e),0}}getStoreKey(){return this.storageKey}}async function E({clientId:e,responseType:t="code",state:n,nonce:i,interactive:o=!0}){const r=chrome.identity.getRedirectURL(),s=Array.isArray(t)?t:[t],a=new URL("https://accounts.google.com/o/oauth2/v2/auth");return a.searchParams.set("client_id",e),a.searchParams.set("redirect_uri",r),a.searchParams.set("response_type",s.join(" ")),a.searchParams.set("scope","openid email profile"),i&&a.searchParams.set("nonce",i),n&&a.searchParams.set("state",n),chrome.identity.launchWebAuthFlow({url:a.toString(),interactive:o}).then(e=>{if(!e)return Promise.reject(new Error("redirectUrl is null"));const t=e.includes("?")?"?":"#",n=new URLSearchParams(e.split(t)[1]),i={};return n.forEach((e,t)=>{i[t]=e}),i}).catch(e=>(console.log("error",e),Promise.reject(e)))}function P(e){let 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)}function T(e,t,n=!1){return chrome.cookies.get({url:e,name:t}).then(e=>{var t;return n?(null==e||null==(t=e.value)?void 0:t.replace(/"/g,""))||"":null!=e?e:void 0})}function A(e,t=!1){return chrome.cookies.getAll({url:e}).then(e=>t?function(e){return e.map(e=>`${e.name}=${e.value}`).join("; ")}(e):e)}function O(){var e,t,n;return{locale:null==(e=chrome.i18n)?void 0:e.getUILanguage(),extId:null==(t=chrome.runtime)?void 0:t.id,version:null==(n=chrome.runtime)?void 0:n.getManifest().version}}function K(e){return"object"==typeof e&&null!==e&&"__error"in e&&!0===e.__error}function $(e={}){const{debug:t=!1,logPrefix:n="[MessageBus]"}=e,i=new Map;let o=!1;function r(e,...i){t&&console.error(`${n} ${e}`,...i)}function s(){o||(chrome.runtime.onMessage.addListener((e,t,n)=>{if(!e||"string"!=typeof e.type)return;const o=i.get(e.type);if(o)try{const i=o(e.payload,t);return i instanceof Promise?(i.then(n).catch(t=>{r(`Error handling "${String(e.type)}":`,t),n({__error:!0,message:t instanceof Error?t.message:String(t)})}),!0):(n(i),!1)}catch(t){return r(`Error handling "${String(e.type)}":`,t),n({__error:!0,message:t instanceof Error?t.message:String(t)}),!1}}),o=!0)}return{send:(e,...t)=>chrome.runtime.sendMessage({type:e,payload:t[0]}),sendToTab:(e,t,...n)=>chrome.tabs.sendMessage(e,{type:t,payload:n[0]}),on:(e,t)=>(s(),i.set(e,t),()=>{i.delete(e)}),onMany(e){s();const t=[];for(const[n,o]of Object.entries(e))o&&(i.set(n,o),t.push(n));return()=>{for(const e of t)i.delete(e)}},hasHandler:e=>i.has(e),getRegisteredTypes:()=>Array.from(i.keys()),clearAllHandlers(){i.clear()}}}L.instances=new Map;const N="https://www.linkedin.com/voyager/api";async function j({csrfToken:e,cookies:t}){const n=`${N}/me`,i=U(e,t);return fetch(n,{method:"GET",headers:i}).then(async e=>e.ok?e.json():null).catch(e=>(console.error(e),null))}function U(e,t){const n={"csrf-token":e};if(t){let e="";e="string"==typeof t?t:Object.entries(t).map(([e,t])=>`${e}=${t}`).join("; "),e&&(n.Cookie=e)}return n}async function R(e,{csrfToken:t,cookies:n}){const i=`${N}/identity/dash/profiles?q=memberIdentity&memberIdentity=${e}&decorationId=com.linkedin.voyager.dash.deco.identity.profile.FullProfileWithEntities-26`,o=U(t,n);return fetch(i,{method:"GET",headers:o}).then(async e=>{var t;return e.ok&&(null==(t=(await e.json()).elements)?void 0:t[0])||null}).catch(e=>(console.error(e),null))}async function D(e,{csrfToken:t,cookies:n}){let i="";const o="string"==typeof e?{universalName:e}:e,r="universalName"in o;i=r?`?q=universalName&universalName=${o.universalName}`:`/${o.urn}`;const s=`${N}/organization/companies${i}`,a=U(t,n);return fetch(s,{method:"GET",headers:a}).then(async e=>{if(e.ok){const n=await e.json();var t;return r?(null==(t=n.elements)?void 0:t[0])||null:n}return null}).catch(e=>(console.error(e),null))}const z={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 H(e,t,n){switch(n){case"all":const 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)}}function W({page:e,key:t,selector:n,container:i,mode:o}){null!=i||(i=document);const r=e&&t?function({page:e,key:t}){return z[e][t]}({page:e,key:t}):[n];for(const e of r){const t=H(i,e,o);if(t)return t}return null}function B(e){if(!e)return"";const t=document.createElement("textarea");return t.innerHTML=e,t.value.trim()}function V(){var e,t,n,i,o,r,s;const a=window.location.href.includes("linkedin.com/sales")?"salesNavProfilePage":"profilePage";function c(e){return W({page:a,key:e,container:document})}const l=null==(e=c("userName"))?void 0:e.innerText;if(!l)return console.error("extractUserInfos: no userName found"),{};const h=null==(t=c("userPicture"))?void 0:t.src,d=null==(n=c("userOccupation"))?void 0:n.innerHTML,u=null==(i=c("companyName"))?void 0:i.innerText,p=null==(o=c("companyLogo"))?void 0:o.src,m=null==(r=c("location"))?void 0:r.innerText;let g;return"salesNavProfilePage"===a&&(g=/linkedin\.com\/sales\/lead/i.test(window.location.href)?window.location.href:null==(s=c("profileUrl"))?void 0:s.href),{name:B(l),profileUrl:g,picture:h,occupation:B(d),companyName:u,companyPicture:p,location:m}}function X(e){return/^https?:\/\/(www|.{2})\.linkedin\.com/.test(e)}const Y={"":0,chrome:1,"chrome-extension":2,"view-source":3,ftp:4,file:5,data:6,blob:7,about:8};function J(e=""){let t="";const n=e.split("#")[0].toLocaleLowerCase();return/^https\:\/\/(www|.{2})\.linkedin\.com\/in\/[^/?]+(\/recent-activity\/|\/details\/|\/overlay\/|\/?\?[^/]*|\/?$)/.test(n)||/^https\:\/\/(www|.{2})\.linkedin\.com\/sales\/people\/(.+?),/.test(n)||/^https\:\/\/(www|.{2})\.linkedin\.com\/sales\/(profile|lead)\/([^,]{39}),/.test(n)?t="profile":n.includes("linkedin.com/feed")?t="feed":n.includes("linkedin.com/posts/")?t="post":n.includes("linkedin.com/login")||n.includes("linkedin.com/checkpoint")||n.includes("linkedin.com/authwall")?t="login":n.includes("linkedin.com/company/")?t="company":n.includes("linkedin.com/messaging/thread/")?t="messages":n.includes("linkedin.com/search/results/people/?")||n.includes("linkedin.com/sales/search/people")?t="search-people":n.includes("linkedin.com/search/results/all")?t="search-all":n.includes("linkedin.com/mynetwork/")&&(t="connections"),t}function F(e=""){var t;const n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/in\/([^?/]+)/)||[])[1]||(e.match(/linkedin\.com\/sales\/people\/(.+?),/)||[])[1]||(e.match(/linkedin\.com\/sales\/(?:profile|lead)\/([^,]{39}),/)||[])[1]||"";return decodeURIComponent(n)}function G(e=""){var t;const n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/posts\/([^\/]+)\//)||[])[1]||"";return decodeURIComponent(n)}function q(e=""){var t;const n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/company\/([^?/]+)/)||[])[1]||"";return decodeURIComponent(n)}function Q(e=""){var t;return F(e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL)||q(e)||""}function Z(e=""){if(!e)return"";const t=Object.keys(Y),n=new URL(e).protocol.replace(":","");return t.includes(n)?n:J(e)}export{L as ChromeStore,_ as Draggable,f as MemoryStore,e as RealUndefined,I as WebStore,m as cacheWrapper,r as cloneDeep,c as createDefaultObject,w as createElement,$ as createMessageBus,k as createSvg,C as createSvgFromUrl,s as debounce,P as decodeJWT,a as delayExecution,o as generateStableUniqueKey,q as getCompanyPublicId,V as getContactInfo,T as getCookie,A as getCookies,W as getElement,O as getExtensionInfo,i as getGlobal,D as getLinkedinCompany,j as getLinkedinMe,J as getLinkedinPageType,R as getLinkedinProfile,Q as getLinkedinPublicId,Z as getPageType,G as getPostPublicId,F as getProfilePublicId,t as isCloneable,K as isErrorResponse,X as isLinkedInUrl,n as isPrimitive,E as launchWebAuthFlow,Y as pageTypeMap,M as scrollToBottom,x as scrollToBottomIfNeeded,g as singleExecutionWrapper};
2
2
  //# sourceMappingURL=index.modern.js.map