@i.un/libs 1.0.7 → 1.0.8
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/common/Mutex.d.ts +86 -0
- package/dist/common/coalesce.d.ts +89 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/singleExecutionWrapper.d.ts +28 -1
- package/dist/common/singleFlight.d.ts +82 -0
- 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/dom.d.ts +132 -0
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { KeyResolver } from "./singleFlight";
|
|
2
|
+
/**
|
|
3
|
+
* 互斥锁:挂在同一个实例上的任务串行执行,前一个完全结束后下一个才开始。
|
|
4
|
+
*
|
|
5
|
+
* 典型场景是「读-改-写」共享资源。读和写各是一次异步调用,中间可以被其他
|
|
6
|
+
* 调用插入,导致后写的覆盖先写的(lost update);把整段操作放进同一把锁里
|
|
7
|
+
* 就不会交错。
|
|
8
|
+
*
|
|
9
|
+
* 与 {@link serialize} 的区别:`Mutex` 是**可共享的对象**,多个不同的函数
|
|
10
|
+
* 可以挂在同一把锁上。读-改-写同一份资源的一组函数(读取 / 写入 / 删除)
|
|
11
|
+
* 必须共用一把锁,各自包一层 `serialize` 是挡不住的。
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ 锁内的任务不能再次调用同一把锁的 `run`,会排在自己后面造成死锁。
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const storageLock = new Mutex();
|
|
18
|
+
* const take = (id: string) => storageLock.run(async () => { ... });
|
|
19
|
+
* const drop = (id: string) => storageLock.run(async () => { ... });
|
|
20
|
+
* // take 与 drop 并发时也不会交错
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class Mutex {
|
|
24
|
+
/**
|
|
25
|
+
* 队尾。始终保持为「永不 reject」的分支,
|
|
26
|
+
* 否则某次任务失败且无人接手时会冒出 unhandled rejection。
|
|
27
|
+
*/
|
|
28
|
+
private tail;
|
|
29
|
+
private running;
|
|
30
|
+
/** 排队中与执行中的任务总数。 */
|
|
31
|
+
get size(): number;
|
|
32
|
+
/** 队列是否已排空。 */
|
|
33
|
+
get idle(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 排队执行一个任务。
|
|
36
|
+
*
|
|
37
|
+
* @param func - 需要串行执行的任务,同步函数也可以。
|
|
38
|
+
* @returns 任务的结果;任务抛出的异常会原样传给调用方。
|
|
39
|
+
*/
|
|
40
|
+
run<T>(func: () => T | Promise<T>): Promise<T>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 按 key 分组的互斥锁:相同 key 串行,不同 key 互不阻塞。
|
|
44
|
+
*
|
|
45
|
+
* 队列排空后会自动回收对应的锁对象,key 不会无限增长。
|
|
46
|
+
*
|
|
47
|
+
* 注意分组的语义:它保护的是「同一个 key 对应的资源」。如果多个 key 的
|
|
48
|
+
* 任务操作的其实是同一份共享资源,分组反而挡不住竞态,这种情况应当用
|
|
49
|
+
* 单个 {@link Mutex}。
|
|
50
|
+
*/
|
|
51
|
+
export declare class KeyedMutex {
|
|
52
|
+
private locks;
|
|
53
|
+
/** 当前持有锁的 key 数量。 */
|
|
54
|
+
get size(): number;
|
|
55
|
+
/**
|
|
56
|
+
* 在指定 key 的队列上排队执行任务。
|
|
57
|
+
*
|
|
58
|
+
* @param key - 并发槽位。
|
|
59
|
+
* @param func - 需要串行执行的任务。
|
|
60
|
+
* @returns 任务的结果;任务抛出的异常会原样传给调用方。
|
|
61
|
+
*/
|
|
62
|
+
run<T>(key: string, func: () => T | Promise<T>): Promise<T>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 把一个函数包成「调用自动排队」的版本,是 {@link KeyedMutex} 的语法糖。
|
|
66
|
+
*
|
|
67
|
+
* 只需要串行化**单个函数**时用它;多个函数共享一份资源时请直接共用一个
|
|
68
|
+
* {@link Mutex} 实例。
|
|
69
|
+
*
|
|
70
|
+
* ⚠️ 被包装的函数不能通过包装后的入口调用自己,会死锁。
|
|
71
|
+
*
|
|
72
|
+
* @param func - 需要串行化的函数,同步函数也可以。
|
|
73
|
+
* @param options - 配置项,可通过 `key` 按入参分组。
|
|
74
|
+
* @returns 包装后的函数,调用会自动排队。
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const writeProfile = serialize(
|
|
79
|
+
* async (id: string, patch: object) => { ... },
|
|
80
|
+
* { key: (id) => id }
|
|
81
|
+
* );
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function serialize<Args extends any[], T>(func: (...args: Args) => T | Promise<T>, options?: {
|
|
85
|
+
key?: KeyResolver<Args>;
|
|
86
|
+
}): (...args: Args) => Promise<T>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { KeyResolver } from "./singleFlight";
|
|
2
|
+
/**
|
|
3
|
+
* 合并包装的配置项。
|
|
4
|
+
*/
|
|
5
|
+
export interface CoalesceOptions<Args extends any[]> {
|
|
6
|
+
/**
|
|
7
|
+
* 从入参派生并发槽位的 key。不同 key 互不影响。
|
|
8
|
+
* 不传则所有调用共用一个槽位。
|
|
9
|
+
*/
|
|
10
|
+
key?: KeyResolver<Args>;
|
|
11
|
+
/**
|
|
12
|
+
* 每一轮执行失败时的回调。
|
|
13
|
+
*
|
|
14
|
+
* 本函数返回的 Promise **永远不会 reject**(详见函数说明),
|
|
15
|
+
* 想观察失败必须通过这个回调。
|
|
16
|
+
*/
|
|
17
|
+
onError?: (error: unknown, args: Args) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 合并包装后的函数类型,附带若干只读的状态查询。
|
|
21
|
+
*/
|
|
22
|
+
export type CoalesceFunction<Args extends any[]> = ((...args: Args) => Promise<void>) & {
|
|
23
|
+
/** 对应槽位当前是否有执行在进行中。 */
|
|
24
|
+
isRunning(...args: Args): boolean;
|
|
25
|
+
/** 对应槽位当前是否已排了一次补跑。 */
|
|
26
|
+
hasPending(...args: Args): boolean;
|
|
27
|
+
/** 进行中的槽位数量。 */
|
|
28
|
+
readonly size: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 创建一个「合并尾部」函数:执行期间的多次触发合并成一次补跑。
|
|
32
|
+
*
|
|
33
|
+
* 首次调用立即执行。执行期间再次触发时,既不丢弃也不共享结果,而是记一个
|
|
34
|
+
* 标记;当前这轮结束后,用**最新一次**的入参再跑一遍。期间触发多少次都只
|
|
35
|
+
* 补跑一次 —— 这就是「合并」。
|
|
36
|
+
*
|
|
37
|
+
* ## 什么时候需要它
|
|
38
|
+
*
|
|
39
|
+
* 当**触发本身意味着「状态变了」,而进行中那轮读到的是旧状态**时:
|
|
40
|
+
*
|
|
41
|
+
* ```text
|
|
42
|
+
* t0 状态 = A → 触发 → 开始跑,读到 A
|
|
43
|
+
* t1 状态 = B → 触发
|
|
44
|
+
* t2 这一轮跑完,结果基于 A
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* - {@link singleExecutionWrapper}:t1 被丢弃 → **B 永久丢失**
|
|
48
|
+
* - {@link singleFlight}:t1 拿到基于 A 的结果 → 同样丢失 B
|
|
49
|
+
* - 本函数:t1 记标记 → t2 之后补跑一次,读到 B
|
|
50
|
+
*
|
|
51
|
+
* 前两者的隐含前提是「这一轮的结果对后来者同样成立」。一旦触发携带新信息,
|
|
52
|
+
* 这个前提就不成立了。
|
|
53
|
+
*
|
|
54
|
+
* ## 与 debounce 的区别
|
|
55
|
+
*
|
|
56
|
+
* 两者正好相反:`debounce` 把首次响应**延迟**到静默期之后;本函数首次
|
|
57
|
+
* **立即**执行,把合并放在尾部。二者可以叠加 —— 先用 `debounce` 压掉密集
|
|
58
|
+
* 触发,再用本函数保证「跑的时候状态又变了」不丢。
|
|
59
|
+
*
|
|
60
|
+
* ## 错误处理
|
|
61
|
+
*
|
|
62
|
+
* 返回的 Promise **永远不会 reject**,某一轮失败也不会中断后面的补跑 ——
|
|
63
|
+
* 这个原语的目的是「最终收敛到最新状态」,一次失败不该让整条链停摆。
|
|
64
|
+
* 想观察失败请传 `onError`。
|
|
65
|
+
*
|
|
66
|
+
* 这个取舍也避免了事件监听器里的常见坑:
|
|
67
|
+
* `listener(() => syncUser())` 若返回会 reject 的 Promise 且无人接手,
|
|
68
|
+
* 就会冒出 unhandled rejection。
|
|
69
|
+
*
|
|
70
|
+
* ⚠️ 被包装的函数不能通过包装后的入口调用自己,会无限补跑下去。
|
|
71
|
+
*
|
|
72
|
+
* @param func - 需要包裹的函数,同步函数也可以。它的返回值会被忽略。
|
|
73
|
+
* @param options - 配置项,可通过 `key` 按入参分组、`onError` 观察失败。
|
|
74
|
+
* @returns 包装后的函数。返回的 Promise 在「本次触发已被某一轮执行覆盖」
|
|
75
|
+
* 之后 resolve:首次调用等自己这轮,被合并的调用等到补跑结束。
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const syncState = coalesce(async () => {
|
|
80
|
+
* const latest = await readState();
|
|
81
|
+
* await push(latest);
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* // 密集触发时:立即跑一轮,期间的触发合并成结束后的一次补跑,
|
|
85
|
+
* // 保证最后一次状态变化一定被处理到
|
|
86
|
+
* store.subscribe(() => syncState());
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function coalesce<Args extends any[]>(func: (...args: Args) => unknown, options?: CoalesceOptions<Args>): CoalesceFunction<Args>;
|
package/dist/common/index.d.ts
CHANGED
|
@@ -8,7 +8,34 @@ export type SingleExecutionFunction<F extends AsyncFunction<any[], any>> = F ext
|
|
|
8
8
|
/**
|
|
9
9
|
* 创建一个有执行状态的函数,该函数在前一次调用未完成时不会被再次调用。
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* 前一次还没结束时,后来的调用**立刻**返回 {@link RealUndefined},
|
|
12
|
+
* 既不等待也不执行。被包装的函数在同一时刻只会跑一份。
|
|
13
|
+
*
|
|
14
|
+
* ## 与 {@link singleFlight} 怎么选
|
|
15
|
+
*
|
|
16
|
+
* 分水岭是**后来的调用方要不要结果**:
|
|
17
|
+
* 不要、且希望它立刻脱身 → 本函数;要结果 → `singleFlight`。
|
|
18
|
+
*
|
|
19
|
+
* 本函数独有、`singleFlight` 表达不了的三点:
|
|
20
|
+
*
|
|
21
|
+
* - **`minTime`**:任务结束后仍锁定一段时间,用于防连点、保证 loading
|
|
22
|
+
* 最短展示时长这类需求。
|
|
23
|
+
* - **不会级联挂起**:首次调用卡住时,后来者立刻拿到 `RealUndefined`
|
|
24
|
+
* 脱身,不会陪着一起挂。
|
|
25
|
+
* - **能区分「我发起的」**:拿到 `RealUndefined` 就说明这次被挡掉了,
|
|
26
|
+
* 适合「只有真正发起的那次才弹提示」这类逻辑。
|
|
27
|
+
*
|
|
28
|
+
* 反过来,一次失败**不会**传播给被挡掉的调用方;需要所有调用方都感知
|
|
29
|
+
* 成败时应当用 `singleFlight`。
|
|
30
|
+
*
|
|
31
|
+
* 注意本函数是「丢弃」而非「合并尾部」:进行中被丢掉的那次触发不会在
|
|
32
|
+
* 结束后补跑。若触发本身携带新状态(当前这次跑的是旧状态),丢弃会让
|
|
33
|
+
* 新状态永久丢失,这种场景两者都不适用。
|
|
34
|
+
*
|
|
35
|
+
* @param func - 需要包裹的函数。同步抛出的异常会转成 rejected Promise,
|
|
36
|
+
* 并正常释放执行状态。
|
|
37
|
+
* @param minTime - 最短锁定时长(毫秒)。任务快于该时长时,
|
|
38
|
+
* `isExecuting` 会保持到满足时长为止。默认 0,即结束即释放。
|
|
12
39
|
* @returns 一个增强版的函数,该函数具有 isExecuting 属性。
|
|
13
40
|
*/
|
|
14
41
|
export declare function singleExecutionWrapper<T extends AsyncFunction<any[], any>>(func: T, minTime?: number): T & {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 从入参派生并发槽位的函数。
|
|
3
|
+
*
|
|
4
|
+
* @template Args - 被包装函数的参数类型。
|
|
5
|
+
*/
|
|
6
|
+
export type KeyResolver<Args extends any[]> = (...args: Args) => string;
|
|
7
|
+
/**
|
|
8
|
+
* 单飞包装的配置项。
|
|
9
|
+
*/
|
|
10
|
+
export interface SingleFlightOptions<Args extends any[]> {
|
|
11
|
+
/**
|
|
12
|
+
* 从入参派生并发槽位的 key。不同 key 互不影响。
|
|
13
|
+
* 不传则所有调用共用一个槽位。
|
|
14
|
+
*/
|
|
15
|
+
key?: KeyResolver<Args>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 单飞包装后的函数类型,附带若干只读的状态查询。
|
|
19
|
+
*/
|
|
20
|
+
export type SingleFlightFunction<Args extends any[], T> = ((...args: Args) => Promise<T>) & {
|
|
21
|
+
/** 对应槽位当前是否有调用正在进行中。 */
|
|
22
|
+
isRunning(...args: Args): boolean;
|
|
23
|
+
/** 进行中的槽位数量。 */
|
|
24
|
+
readonly size: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 创建一个「单飞」函数:并发调用共享同一次执行。
|
|
28
|
+
*
|
|
29
|
+
* 前一次调用还没结束时,后来的调用者拿到的是**同一个 Promise**,
|
|
30
|
+
* 因此能拿到结果、也能感知异常。执行结束(无论成败)后槽位立即释放,
|
|
31
|
+
* 下一次调用会真正执行。
|
|
32
|
+
*
|
|
33
|
+
* 常用于同一份数据被多处同时请求的场景,避免重复发起。
|
|
34
|
+
*
|
|
35
|
+
* ## 与 {@link singleExecutionWrapper} 怎么选
|
|
36
|
+
*
|
|
37
|
+
* 分水岭是**后来的调用方要不要结果**:
|
|
38
|
+
* 要 → 本函数;不要、且希望它立刻脱身 → `singleExecutionWrapper`。
|
|
39
|
+
*
|
|
40
|
+
* | | `singleExecutionWrapper` | `singleFlight` |
|
|
41
|
+
* | --- | --- | --- |
|
|
42
|
+
* | 被挡住的调用 | 立刻返回 `RealUndefined` | 返回进行中那个 Promise,跟着等 |
|
|
43
|
+
* | 拿得到结果 | 否 | 是 |
|
|
44
|
+
* | 首次调用**失败**时 | 后来者不受影响 | 后来者一起收到同一个异常 |
|
|
45
|
+
* | 首次调用**卡住**时 | 后来者立刻返回 | 后来者一起挂住 |
|
|
46
|
+
* | 能区分「我发起的」 | 能,靠 `RealUndefined` | 不能 |
|
|
47
|
+
* | 最短锁定时长 `minTime` | 支持 | 不支持 |
|
|
48
|
+
*
|
|
49
|
+
* 两条容易被忽略的实际差别:
|
|
50
|
+
*
|
|
51
|
+
* - **失败传播范围**:本函数会把一次失败传给 N 个调用方。若每个调用点的
|
|
52
|
+
* catch 里都弹提示,一次网络错误会弹 N 次。
|
|
53
|
+
* - **级联挂起**:首次调用卡住时,后续调用者会陪着一起挂。高频事件驱动
|
|
54
|
+
* (cookie 变化、DOM 变化)的场景下,`singleExecutionWrapper` 让它们
|
|
55
|
+
* 立刻脱身通常更合适。
|
|
56
|
+
*
|
|
57
|
+
* 另外两者都**不提供**「合并尾部」语义 —— 进行中时既不丢弃也不共享,
|
|
58
|
+
* 而是记一个标记、跑完再补一次。触发本身携带新状态时(当前这次跑的是
|
|
59
|
+
* 旧状态)需要的是那个,这两个都会丢掉新状态。
|
|
60
|
+
*
|
|
61
|
+
* 本函数只负责「同一时刻」的并发,**不做结果缓存**。跨次调用要不要重复
|
|
62
|
+
* 执行属于缓存层的职责,需要缓存请配合 {@link cacheWrapper}。
|
|
63
|
+
*
|
|
64
|
+
* ⚠️ 被包装的函数不能通过包装后的入口调用自己,否则会拿到自己那个尚未
|
|
65
|
+
* settle 的 Promise,永远等下去。需要递归时把真正的逻辑抽成内部函数,
|
|
66
|
+
* 只在最外层入口做包装。
|
|
67
|
+
*
|
|
68
|
+
* @param func - 需要包裹的函数,同步函数也可以。
|
|
69
|
+
* @param options - 配置项,可通过 `key` 按入参分组。
|
|
70
|
+
* @returns 包装后的函数,附带 `isRunning()` 与 `size`。
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const fetchProfile = singleFlight(
|
|
75
|
+
* (id: string) => http.get(`/profile/${id}`),
|
|
76
|
+
* { key: (id) => id }
|
|
77
|
+
* );
|
|
78
|
+
* // 同一个 id 并发调用只发一个请求,两个调用方拿到同一份结果
|
|
79
|
+
* const [a, b] = await Promise.all([fetchProfile("x"), fetchProfile("x")]);
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare function singleFlight<Args extends any[], T>(func: (...args: Args) => T | Promise<T>, options?: SingleFlightOptions<Args>): SingleFlightFunction<Args, T>;
|
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 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 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 n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=o(e[r]));return n}function i(e){return new Proxy({},{get:function(t,n){return t.hasOwnProperty(n)?t[n]:e}})}function a(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var s=i[o];if(!r.includes(s)||!a(e[s],t[s]))return!1}return!0}var s=i(e),l=i(!1);function c(e){return s[e]}function u(t){return s[t]!==e}var d={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 f(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 m(){return m=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},m.apply(null,arguments)}var p=/*#__PURE__*/function(){function e(e){this.storageKey=void 0,this.data={},this.listeners=[],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=m({},this.data);this.data=m({},this.data,((n={})[e]=t,n)),this.triggerChange(r,this.data)}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 m({},this.data)},t.remove=function(e){try{if(e in this.data){var t=m({},this.data),n=m({},this.data);delete n[e],this.data=n,this.triggerChange(t,this.data)}}catch(e){throw console.error("MemoryStore.remove 失败:",e),e}},t.clear=function(){try{var e=m({},this.data);this.data={},this.triggerChange(e,this.data)}catch(e){throw console.error("MemoryStore.clear 失败:",e),e}},t.setMultiple=function(e){try{var t=m({},this.data);this.data=m({},this.data,e),this.triggerChange(t,this.data)}catch(e){throw console.error("MemoryStore.setMultiple 失败:",e),e}},t.onChanged=function(e,t){this.listeners.push({prop:"string"==typeof e?e:void 0,callback:"string"==typeof e?t:e})},t.offChanged=function(e,t){var n="string"==typeof e?e:void 0,r="string"==typeof e?t:e;this.listeners=this.listeners.filter(function(e){return!(e.prop===n&&e.callback===r)})},t.triggerChange=function(e,t){this.listeners.length>0&&this.listeners.forEach(function(n){var r=n.prop,o=n.callback;try{if(r)a(t[r],e[r])||o(t[r],e[r]);else{var i={};new Set([].concat(Object.keys(t),Object.keys(e))).forEach(function(n){var r=n;a(t[r],e[r])||(i[r]={newValue:t[r],oldValue:e[r]})}),Object.keys(i).length>0&&o(i)}}catch(e){console.error("MemoryStore 变化回调执行失败:",e)}})},t.clearChangeCallbacks=function(){this.listeners=[]},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 v(e,t,n,r){if(void 0===r&&(r=!1),t in e.style)e.style[t]=n;else{var o=r?"important":"";e.style.setProperty(t,String(n),o)}}function g(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 o=r[n];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 n=g(e);t.appendChild(n)});return t}function y(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function b(e){e&&setTimeout(function(){e.scrollTop=e.scrollHeight},0)}p.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=m({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,o=this.element.getBoundingClientRect();if("fixed"===getComputedStyle(this.element).position)n=window.innerWidth-o.width,r=window.innerHeight-o.height;else{var i=(this.element.offsetParent||document.documentElement).getBoundingClientRect();n=i.width-o.width,r=i.height-o.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 o,i;if("fixed"===t)o=e.left,i=e.top;else if(o=e.left-r.left,i=e.top-r.top,n instanceof HTMLElement){var a=getComputedStyle(n);o-=parseFloat(a.borderLeftWidth)||0,i-=parseFloat(a.borderTopWidth)||0}else o+=window.scrollX,i+=window.scrollY;switch(this.options.coordinate){case"tr":var s=r.width-o-e.width;this.element.style.left="auto",this.element.style.right=s+"px",this.element.style.top=i+"px",this.element.style.bottom="auto";break;case"bl":var l=r.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=r.width-o-e.width,u=r.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}(),k=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t="local"),this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.listeners=[],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=m({},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=m({},this.getAll(),e);this.getStore().setItem(this.storageKey,JSON.stringify(t))}catch(e){throw console.error("WebStore.setMultiple 失败:",e),e}},e.setupGlobalListener=function(){var e=this;this.isGlobalListenerInitialized||(this.isGlobalListenerInitialized=!0,window.addEventListener("storage",function(t){e.instances.forEach(function(e){if(t.key===e.storageKey&&t.storageArea===e.getStore()){var n=t.oldValue?JSON.parse(t.oldValue):{},r=t.newValue?JSON.parse(t.newValue):{};e.dispatchChange(r,n)}})}))},t.dispatchChange=function(e,t){var n=e||{},r=t||{};this.listeners.forEach(function(e){var t=e.prop,o=e.callback;if(t)a(n[t],r[t])||o(n[t],r[t]);else{var i={};new Set([].concat(Object.keys(n),Object.keys(r))).forEach(function(e){var t=e;a(n[t],r[t])||(i[t]={newValue:n[t],oldValue:r[t]})}),Object.keys(i).length>0&&o(i)}})},t.onChanged=function(t,n){e.setupGlobalListener(),this.listeners.push({prop:"string"==typeof t?t:void 0,callback:"string"==typeof t?n:t})},t.offChanged=function(e,t){var n="string"==typeof e?e:void 0,r="string"==typeof e?t:e;this.listeners=this.listeners.filter(function(e){return!(e.prop===n&&e.callback===r)})},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 P(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}k.instances=new Map,k.isGlobalListenerInitialized=!1;var 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.listeners=[],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(P(function(){return Promise.resolve(n.getAll()).then(function(r){var o,i,a=m({},r,((o={})[e]=t,o));return Promise.resolve(n.getStore().set((i={},i[n.storageKey]=a,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(P(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(P(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(P(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(P(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(P(function(){return Promise.resolve(t.getAll()).then(function(n){var r,o=m({},n,e);return Promise.resolve(t.getStore().set((r={},r[t.storageKey]=o,r))).then(function(){})})},function(e){throw console.error("ChromeStore.setMultiple 失败:",e),e}))}catch(e){return Promise.reject(e)}},e.setupGlobalListener=function(){var e=this;this.isGlobalListenerInitialized||(this.isGlobalListenerInitialized=!0,chrome.storage.onChanged.addListener(function(t,n){e.instances.forEach(function(e){if(e.storeType===n&&t[e.storageKey]){var r=t[e.storageKey];e.dispatchChange(r.newValue,r.oldValue)}})}))},t.dispatchChange=function(e,t){var n=e||{},r=t||{};this.listeners.forEach(function(e){var t=e.prop,o=e.callback;if(t)a(n[t],r[t])||o(n[t],r[t]);else{var i={};new Set([].concat(Object.keys(n),Object.keys(r))).forEach(function(e){var t=e;a(n[t],r[t])||(i[t]={newValue:n[t],oldValue:r[t]})}),Object.keys(i).length>0&&o(i)}})},t.onChanged=function(t,n){e.setupGlobalListener(),this.listeners.push({prop:"string"==typeof t?t:void 0,callback:"string"==typeof t?n:t})},t.offChanged=function(e,t){var n="string"==typeof e?e:void 0,r="string"==typeof e?t:e;this.listeners=this.listeners.filter(function(e){return!(e.prop===n&&e.callback===r)})},t.has=function(e){try{var t=this;return Promise.resolve(P(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(P(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}();S.instances=new Map,S.isGlobalListenerInitialized=!1;var C="https://www.linkedin.com/voyager/api";function x(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 L={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 I(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 j(e){var t=e.page,n=e.key,r=e.container,o=e.mode;null!=r||(r=document);for(var i,a,s=f(t&&n?L[(i={page:t,key:n}).page][i.key]:[e.selector]);!(a=s()).done;){var l=I(r,a.value,o);if(l)return l}return null}function E(e){if(!e)return"";var t=document.createElement("textarea");return t.innerHTML=e,t.value.trim()}var O,N,M={"":0,chrome:1,"chrome-extension":2,"view-source":3,ftp:4,file:5,data:6,blob:7,about:8};function U(e){void 0===e&&(e="");var t="",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 T(e){var t;void 0===e&&(e="");var 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 A(e){var t;void 0===e&&(e="");var n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/company\/([^?/]+)/)||[])[1]||"";return decodeURIComponent(n)}function R(e){if(e){var t=e.match(/:(\d+)$/);return t?t[1]:void 0}}function _(e){if(e){var t=e.match(/,(\d+)\)$/);return t?t[1]:void 0}}function D(e){if(null!=e&&e.year)return{year:e.year,month:e.month}}function K(e,t,n){if(!e||0===Object.keys(e).length)return n||"";if(t&&e[t])return e[t];var r=Object.keys(e),o=r.find(function(e){return e.startsWith("en")});return o?e[o]:e[r[0]]||n||""}function z(e,t){if(!e||!t)return{};for(var n={},r=0,o=Object.entries(e);r<o.length;r++){var i=o[r],a=i[0],s=i[1];a!==t&&s&&(n[a]=s)}return n}function H(e){return W(e)}function W(e){var t,n,r;if(e){var o=(e.rootUrl&&e.artifacts?e:null)||e.vectorImage||(null==(t=e.image)?void 0:t["com.linkedin.common.VectorImage"])||e["com.linkedin.common.VectorImage"]||(null==(n=e.displayImageReference)?void 0:n.vectorImage);if(null!=o&&o.rootUrl&&null!=o&&null!=(r=o.artifacts)&&r.length){var i=o.artifacts,a=i.reduce(function(e,t){return((null==t?void 0:t.width)||0)>((null==e?void 0:e.width)||0)?t:e},i[0]);if(null!=a&&a.fileIdentifyingUrlPathSegment)return o.rootUrl+a.fileIdentifyingUrlPathSegment}}}exports.ContactInfoSource=void 0,(O=exports.ContactInfoSource||(exports.ContactInfoSource={})).PUBLIC="public",O.MANUAL="manual",O.APOLLO="apollo",O.LUSHA="lusha",O.HUNTER="hunter",O.ROCKETREACH="rocketreach",O.SNOV="snov",O.CLEARBIT="clearbit",exports.QueryType=void 0,(N=exports.QueryType||(exports.QueryType={})).EMAIL="email",N.PHONE="phone",N.BOTH="both",exports.ChromeStore=S,exports.Draggable=w,exports.MemoryStore=p,exports.RealUndefined=e,exports.WebStore=k,exports.cacheWrapper=function(e,t){void 0===t&&(t=d);var n=function(){var n=[].slice.call(arguments),i=r(n)+e.name+(t.identifier||"");if(u(i))return Promise.resolve(o(c(i)));if(l[i]){var a=Object.assign({},d,t);return new Promise(function(e){var t=Date.now(),n=setInterval(function(){u(i)?(clearInterval(n),e(o(c(i)))):Date.now()-t>a.timeout&&(l[i]=!1,clearInterval(n),e(o(a.timeoutResult)))},100)})}return l[i]=!0,e.apply(this,n).then(function(e){return s[i]=e,o(s[i])}).catch(function(e){throw e}).finally(function(){l[i]=!1})};return Object.defineProperty(n,"name",{value:"cacheWrapper_"+e.name,configurable:!0}),n},exports.cloneDeep=o,exports.createDefaultObject=i,exports.createElement=function e(t){var n=void 0===t?{}:t,r=n.tag,o=n.children,i=void 0===o?[]:o,a=n.props,s=void 0===a?{}:a,l=n.attrs,c=void 0===l?{}:l,u=n.styles,d=void 0===u?{}:u,h=document.createElement(void 0===r?"div":r);Object.assign(h,s);for(var m=0,p=Object.entries(c);m<p.length;m++){var g=p[m],y=g[1];!1!==y&&h.setAttribute(g[0],y)}for(var b=0,w=Object.entries(d);b<w.length;b++){var k=w[b];v(h,k[0],k[1])}for(var P,S=f(Array.isArray(i)?i:[i]);!(P=S()).done;){var C=P.value;C&&("object"==typeof C?C instanceof Element?h.appendChild(C):h.appendChild(e(C)):h.appendChild(document.createTextNode(C)))}return h},exports.createMessageBus=function(e){void 0===e&&(e={});var t=e.debug,n=void 0!==t&&t,r=e.logPrefix,o=void 0===r?"[MessageBus]":r,i=new Map,a=!1;function s(e){var t;n&&(t=console).error.apply(t,[o+" "+e].concat([].slice.call(arguments,1)))}function l(){a||(chrome.runtime.onMessage.addListener(function(e,t,n){if(e&&"string"==typeof e.type){var r=i.get(e.type);if(r)try{var o=r(e.payload,t);return o instanceof Promise?(o.then(n).catch(function(t){s('Error handling "'+String(e.type)+'":',t),n({__error:!0,message:t instanceof Error?t.message:String(t)})}),!0):(n(o),!1)}catch(t){return s('Error handling "'+String(e.type)+'":',t),n({__error:!0,message:t instanceof Error?t.message:String(t)}),!1}}}),a=!0)}return{send:function(e){return chrome.runtime.sendMessage({type:e,payload:[].slice.call(arguments,1)[0]})},sendToTab:function(e,t){return chrome.tabs.sendMessage(e,{type:t,payload:[].slice.call(arguments,2)[0]})},on:function(e,t){return l(),i.set(e,t),function(){i.delete(e)}},onMany:function(e){l();for(var t=[],n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],a=o[0],s=o[1];s&&(i.set(a,s),t.push(a))}return function(){for(var e=0,n=t;e<n.length;e++)i.delete(n[e])}},hasHandler:function(e){return i.has(e)},getRegisteredTypes:function(){return Array.from(i.keys())},clearAllHandlers:function(){i.clear()}}},exports.createSvg=function(e){return"string"==typeof e?y(e):g(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(y)})}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,o=this;null!==n&&clearTimeout(n),n=setTimeout(function(){e.apply(o,[].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.extractCompaniesFromRawProfile=function(e){var t,n=new Map;return null==(t=e.profilePositionGroups)||null==(t=t.elements)||t.forEach(function(e){var t;[e.company].concat((null==(t=e.profilePositionInPositionGroup)||null==(t=t.elements)?void 0:t.map(function(e){return e.company}))||[]).filter(Boolean).forEach(function(e){var t,r=R(e.entityUrn);if(r&&!n.has(r)){var o;if(e.industry&&null!=(t=e.industryUrns)&&t.length){var i=e.industry[e.industryUrns[0]];o=null==i?void 0:i.name}n.set(r,{linkedinId:r,universalName:e.universalName,name:e.name||"",industry:o,employeeCountRange:e.employeeCountRange?{start:e.employeeCountRange.start,end:e.employeeCountRange.end}:void 0,logoUrl:H(e.logo)})}})}),Array.from(n.values())},exports.generateStableUniqueKey=r,exports.getCompanyPublicId=A,exports.getContactInfo=function(){var e,t,n,r,o,i,a,s=window.location.href.includes("linkedin.com/sales")?"salesNavProfilePage":"profilePage";function l(e){return j({page:s,key:e,container:document})}var c=null==(e=l("userName"))?void 0:e.innerText;if(!c)return console.error("extractUserInfos: no userName found"),{};var u,d=null==(t=l("userPicture"))?void 0:t.src,h=null==(n=l("userOccupation"))?void 0:n.innerHTML,f=null==(r=l("companyName"))?void 0:r.innerText,m=null==(o=l("companyLogo"))?void 0:o.src,p=null==(i=l("location"))?void 0:i.innerText;return"salesNavProfilePage"===s&&(u=/linkedin\.com\/sales\/lead/i.test(window.location.href)?window.location.href:null==(a=l("profileUrl"))?void 0:a.href),{name:E(c),profileUrl:u,picture:d,occupation:E(h),companyName:f,companyPicture:m,location:p}},exports.getCookie=function(e,t,n){return void 0===n&&(n=!1),chrome.cookies.get({url:e,name:t}).then(function(e){var t;return n?(null==e||null==(t=e.value)?void 0:t.replace(/"/g,""))||"":null!=e?e:void 0})},exports.getCookies=function(e,t){return void 0===t&&(t=!1),chrome.cookies.getAll({url:e}).then(function(e){return t?function(e){return e.map(function(e){return e.name+"="+e.value}).join("; ")}(e):e})},exports.getElement=j,exports.getExtensionInfo=function(){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}},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 o="string"==typeof e?{universalName:e}:e,i="universalName"in o,a=C+"/organization/companies"+(i?"?q=universalName&universalName="+o.universalName:"/"+o.urn),s=x(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(i){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.getLinkedinMe=function(e){var t=e.csrfToken,n=e.cookies;try{var r=C+"/me",o=x(t,n);return Promise.resolve(fetch(r,{method:"GET",headers:o}).then(function(e){try{return Promise.resolve(e.ok?e.json():null)}catch(e){return Promise.reject(e)}}).catch(function(e){return console.error(e),null}))}catch(e){return Promise.reject(e)}},exports.getLinkedinPageType=U,exports.getLinkedinProfile=function(e,t){var n=t.csrfToken,r=t.cookies;try{var o=C+"/identity/dash/profiles?q=memberIdentity&memberIdentity="+e+"&decorationId=com.linkedin.voyager.dash.deco.identity.profile.FullProfileWithEntities-26",i=x(n,r);return Promise.resolve(fetch(o,{method:"GET",headers:i}).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.getLinkedinPublicId=function(e){var t;return void 0===e&&(e=""),T(e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL)||A(e)||""},exports.getPageType=function(e){if(void 0===e&&(e=""),!e)return"";var t=Object.keys(M),n=new URL(e).protocol.replace(":","");return t.includes(n)?n:U(e)},exports.getPostPublicId=function(e){var t;void 0===e&&(e="");var n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/posts\/([^\/]+)\//)||[])[1]||"";return decodeURIComponent(n)},exports.getProfilePublicId=T,exports.isCloneable=t,exports.isEqual=a,exports.isErrorResponse=function(e){return"object"==typeof e&&null!==e&&"__error"in e&&!0===e.__error},exports.isLinkedInUrl=function(e){return/^https?:\/\/(www|.{2})\.linkedin\.com/.test(e)},exports.isPrimitive=n,exports.launchWebAuthFlow=function(e){var t=e.clientId,n=e.responseType,r=void 0===n?"code":n,o=e.state,i=e.nonce,a=e.interactive,s=void 0===a||a;try{var l=chrome.identity.getRedirectURL(),c=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",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: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.pageTypeMap=M,exports.scrollToBottom=b,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&&b(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 o=performance.now(),i=t.apply(this,[].slice.call(arguments));return i.finally(function(){var e=performance.now()-o;n&&n>e?setTimeout(function(){r.isExecuting=!1},n-e):r.isExecuting=!1}),i};return r.isExecuting=!1,r},exports.transformRawCompany=function(e){var t,n,r,o,i,a,s,l,c,u,d=(null==(t=e.elements)?void 0:t[0])||e,h=R(d.entityUrn);if(!h)throw new Error("Cannot extract linkedinId from company data");for(var m,p=(null!=(n=d.defaultLocale)&&n.language&&null!=(r=d.defaultLocale)&&r.country?d.defaultLocale.language+"_"+d.defaultLocale.country:null)||(null!=(o=d.multiLocaleNames)&&o.localized?Object.keys(d.multiLocaleNames.localized)[0]:null)||"en_US",v=null==(i=d.multiLocaleNames)?void 0:i.localized,g=K(v,p,d.name),y=null==(a=d.multiLocaleDescriptions)?void 0:a.localized,b=K(y,p,"string"==typeof d.description?d.description:void 0)||void 0,w={},k=z(v,p),P=z(y,p),S=new Set([].concat(Object.keys(k),Object.keys(P))),C=f(S);!(m=C()).done;){var x=m.value,L={};k[x]&&(L.name=k[x]),P[x]&&(L.description=P[x]),Object.keys(L).length>0&&(w[x]=L)}var I=d.headquarter||(null==(s=d.confirmedLocations)?void 0:s.find(function(e){return e.headquarter})),j=W(d.logo)||W(null==(l=d.logos)?void 0:l.logo),E=W(d.backgroundCoverImage),O=d.jobSearchPageUrl||void 0,N=null==(c=d.companyIndustries)||null==(c=c[0])?void 0:c.localizedName,M=S.size>0?[p].concat(Array.from(S)):void 0;return{linkedinId:h,universalName:d.universalName,name:g,description:b,industry:N,employeeCountRange:d.staffCount?{start:d.staffCount,end:d.staffCount}:d.staffCountRange?{start:d.staffCountRange.start,end:d.staffCountRange.end}:void 0,headquarters:I?{country:I.country,city:I.city,geographicArea:I.geographicArea,postalCode:I.postalCode,line1:I.line1}:void 0,logoUrl:j,backgroundCoverUrl:E,specialities:d.specialities,companyType:d.type,foundedYear:null==(u=d.foundedOn)?void 0:u.year,websiteUrl:d.companyPageUrl,jobSearchPageUrl:O,primaryLocale:p,supportedLocales:M,translations:Object.keys(w).length>0?w:void 0}},exports.transformRawProfile=function(e){var t,n,r,o,i,a,s,l,c=R(e.objectUrn);if(!c)throw new Error("Cannot extract memberId from rawProfile");for(var u,d=function(e){if(e)return e.language+"_"+e.country}(e.primaryLocale),h=function(e){if(null!=e&&e.length)return e.map(function(e){return e.language+"_"+e.country})}(e.supportedLocales),m=K(e.multiLocaleFirstName,d,e.firstName),p=K(e.multiLocaleLastName,d,e.lastName),v=K(e.multiLocaleHeadline,d,e.headline),g=K(e.multiLocaleSummary,d,e.summary),y={},b=(null==h?void 0:h.filter(function(e){return e!==d}))||[],w=f(b);!(u=w()).done;){var k,P,S,C,x=u.value,L={},I=null==(k=e.multiLocaleFirstName)?void 0:k[x],j=null==(P=e.multiLocaleLastName)?void 0:P[x],E=null==(S=e.multiLocaleHeadline)?void 0:S[x],O=null==(C=e.multiLocaleSummary)?void 0:C[x];I&&(L.firstName=I),j&&(L.lastName=j),E&&(L.headline=E),O&&(L.summary=O),Object.keys(L).length>0&&(y[x]=L)}var N=(null==(t=e.profileSkills)||null==(t=t.elements)?void 0:t.map(function(e){return e.name}))||[],M=(null==(n=e.profileLanguages)||null==(n=n.elements)?void 0:n.map(function(e){return{name:e.name,proficiency:e.proficiency}}))||[],U=(null==(r=e.profileHonors)||null==(r=r.elements)?void 0:r.map(function(e){return{title:e.title,issuer:e.issuer,issuedOn:D(e.issuedOn)}}))||[],T=(null==(o=e.profileEducations)||null==(o=o.elements)?void 0:o.map(function(e){var t,n,r;return{school:K(e.multiLocaleSchoolName,d,e.schoolName||(null==(t=e.school)?void 0:t.name)),degree:K(e.multiLocaleDegreeName,d,e.degreeName)||void 0,fieldOfStudy:K(e.multiLocaleFieldOfStudy,d,e.fieldOfStudy)||void 0,startDate:D(null==(n=e.dateRange)?void 0:n.start),endDate:D(null==(r=e.dateRange)?void 0:r.end)}}))||[],A=(null==(i=e.profileCertifications)||null==(i=i.elements)?void 0:i.map(function(e){var t,n;return{name:K(e.multiLocaleName,d,e.name),authority:K(e.multiLocaleAuthority,d,e.authority)||void 0,startDate:D(null==(t=e.dateRange)?void 0:t.start),endDate:D(null==(n=e.dateRange)?void 0:n.end),licenseNumber:e.licenseNumber,url:e.url}}))||[],z=[];null==(a=e.profilePositionGroups)||null==(a=a.elements)||a.forEach(function(e){var t;((null==(t=e.profilePositionInPositionGroup)?void 0:t.elements)||[]).forEach(function(t){for(var n,r,o,i,a,s,l=t.company||e.company,c=R(t.companyUrn||(null==l?void 0:l.entityUrn)),u=K(t.multiLocaleTitle,d,t.title),h=K(t.multiLocaleCompanyName,d,t.companyName||(null==l?void 0:l.name)),m=K(t.multiLocaleDescription,d,t.description)||void 0,p={},v=f(b);!(a=v()).done;){var g,y,w,k=a.value,P={},S=null==(g=t.multiLocaleTitle)?void 0:g[k],C=null==(y=t.multiLocaleDescription)?void 0:y[k],x=null==(w=t.multiLocaleCompanyName)?void 0:w[k];S&&(P.title=S),C&&(P.description=C),x&&(P.companyName=x),Object.keys(P).length>0&&(p[k]=P)}if(null!=l&&l.industry&&null!=l&&null!=(n=l.industryUrns)&&n.length){var L=l.industry[l.industryUrns[0]];s=null==L?void 0:L.name}z.push({linkedinPositionId:_(t.entityUrn),companyName:h,companyLinkedinId:c,companyUniversalName:null==l?void 0:l.universalName,title:u,description:m,startDate:D(null==(r=t.dateRange)?void 0:r.start),endDate:D(null==(o=t.dateRange)?void 0:o.end),isCurrent:!(null!=(i=t.dateRange)&&i.end),companyLogoUrl:H(null==l?void 0:l.logo),companyIndustry:s,companyEmployeeCountRange:null!=l&&l.employeeCountRange?{start:l.employeeCountRange.start,end:l.employeeCountRange.end}:void 0,translations:Object.keys(p).length>0?p:void 0})})});var G,B,V=(null==(s=e.geoLocation)||null==(s=s.geo)?void 0:s.defaultLocalizedName)||void 0,F=null==(l=e.industry)?void 0:l.name;return{memberId:c,publicIdentifier:e.publicIdentifier,firstName:m,lastName:p,headline:v||void 0,summary:g||void 0,location:V,pictureUrl:(B=e.profilePicture,W(B)),backgroundPictureUrl:(G=e.backgroundPicture,W(G)),isPremium:!0===e.premium,industry:F,primaryLocale:d,supportedLocales:h,skills:N,languages:M.length>0?M:void 0,honors:U.length>0?U:void 0,educations:T.length>0?T:void 0,certifications:A.length>0?A:void 0,positions:z.length>0?z:void 0,translations:Object.keys(y).length>0?y:void 0}};
|
|
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 i(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 r(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 r(e)});var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=r(e[i]));return n}function o(e){return new Proxy({},{get:function(t,n){return t.hasOwnProperty(n)?t[n]:e}})}function a(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0,o=n;r<o.length;r++){var l=o[r];if(!i.includes(l)||!a(e[l],t[l]))return!1}return!0}var l=o(e),s=o(!1);function c(e){return l[e]}function u(t){return l[t]!==e}var d={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,g(i.key),i)}}function p(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(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 i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 v(){return v=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},v.apply(null,arguments)}function g(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}var y=function(){},b=/*#__PURE__*/function(){function e(){this.tail=Promise.resolve(),this.running=0}return e.prototype.run=function(e){var t=this;this.running++;var n=this.tail.then(e,e),i=function(){t.running--};return this.tail=n.then(i,i),n},p(e,[{key:"size",get:function(){return this.running}},{key:"idle",get:function(){return 0===this.running}}])}(),k=/*#__PURE__*/function(){function e(){this.locks=new Map}return e.prototype.run=function(e,t){var n=this,i=this.locks.get(e);i||(i=new b,this.locks.set(e,i));var r=i,o=r.run(t);return o.then(y,y).then(function(){r.idle&&n.locks.get(e)===r&&n.locks.delete(e)}),o},p(e,[{key:"size",get:function(){return this.locks.size}}])}();function w(e,t,n){if(!e.s){if(n instanceof C){if(!n.s)return void(n.o=w.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(w.bind(null,e,t),w.bind(null,e,2));e.s=t,e.v=n;const i=e.o;i&&i(e)}}var C=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var i=new e,r=this.s;if(r){var o=1&r?t:n;if(o){try{w(i,1,o(this.v))}catch(e){w(i,2,e)}return i}return this}return this.o=function(e){try{var r=e.v;1&e.s?w(i,1,t?t(r):r):n?w(i,1,n(r)):w(i,2,r)}catch(e){w(i,2,e)}},i},e}();function P(e){return e instanceof C&&1&e.s}var x=/*#__PURE__*/function(){function e(e){this.storageKey=void 0,this.data={},this.listeners=[],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,i=v({},this.data);this.data=v({},this.data,((n={})[e]=t,n)),this.triggerChange(i,this.data)}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 v({},this.data)},t.remove=function(e){try{if(e in this.data){var t=v({},this.data),n=v({},this.data);delete n[e],this.data=n,this.triggerChange(t,this.data)}}catch(e){throw console.error("MemoryStore.remove 失败:",e),e}},t.clear=function(){try{var e=v({},this.data);this.data={},this.triggerChange(e,this.data)}catch(e){throw console.error("MemoryStore.clear 失败:",e),e}},t.setMultiple=function(e){try{var t=v({},this.data);this.data=v({},this.data,e),this.triggerChange(t,this.data)}catch(e){throw console.error("MemoryStore.setMultiple 失败:",e),e}},t.onChanged=function(e,t){this.listeners.push({prop:"string"==typeof e?e:void 0,callback:"string"==typeof e?t:e})},t.offChanged=function(e,t){var n="string"==typeof e?e:void 0,i="string"==typeof e?t:e;this.listeners=this.listeners.filter(function(e){return!(e.prop===n&&e.callback===i)})},t.triggerChange=function(e,t){this.listeners.length>0&&this.listeners.forEach(function(n){var i=n.prop,r=n.callback;try{if(i)a(t[i],e[i])||r(t[i],e[i]);else{var o={};new Set([].concat(Object.keys(t),Object.keys(e))).forEach(function(n){var i=n;a(t[i],e[i])||(o[i]={newValue:t[i],oldValue:e[i]})}),Object.keys(o).length>0&&r(o)}}catch(e){console.error("MemoryStore 变化回调执行失败:",e)}})},t.clearChangeCallbacks=function(){this.listeners=[]},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 S(e,t,n,i){if(void 0===i&&(i=!1),t in e.style)e.style[t]=n;else{var r=i?"important":"";e.style.setProperty(t,String(n),r)}}function L(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e.type);if(e.props)for(var n=0,i=Object.entries(e.props);n<i.length;n++){var r=i[n];t.setAttribute(r[0],r[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=L(e);t.appendChild(n)});return t}function I(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;if(!(t instanceof SVGElement))throw new Error("解析失败,结果不是有效的 SVG 元素");return t}function E(e){e&&setTimeout(function(){e.scrollTop=e.scrollHeight},0)}x.instances=new Map;var _=/*#__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=v({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,i,r=this.element.getBoundingClientRect();if("fixed"===getComputedStyle(this.element).position)n=window.innerWidth-r.width,i=window.innerHeight-r.height;else{var o=(this.element.offsetParent||document.documentElement).getBoundingClientRect();n=o.width-r.width,i=o.height-r.height}return{x:Math.min(Math.max(0,e),n),y:Math.min(Math.max(0,t),i)}},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,i=null;if("fixed"===t?(n=null,i=new DOMRect(0,0,window.innerWidth,window.innerHeight)):((n=this.element.offsetParent)||(n=document.documentElement),"static"===getComputedStyle(n).position?(n=null,i=new DOMRect(0,0,window.innerWidth,window.innerHeight)):i=n.getBoundingClientRect()),i){var r,o;if("fixed"===t)r=e.left,o=e.top;else if(r=e.left-i.left,o=e.top-i.top,n instanceof HTMLElement){var a=getComputedStyle(n);r-=parseFloat(a.borderLeftWidth)||0,o-=parseFloat(a.borderTopWidth)||0}else r+=window.scrollX,o+=window.scrollY;switch(this.options.coordinate){case"tr":var l=i.width-r-e.width;this.element.style.left="auto",this.element.style.right=l+"px",this.element.style.top=o+"px",this.element.style.bottom="auto";break;case"bl":var s=i.height-o-e.height;this.element.style.left=r+"px",this.element.style.right="auto",this.element.style.top="auto",this.element.style.bottom=s+"px";break;case"br":var c=i.width-r-e.width,u=i.height-o-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=r+"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}(),O=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t="local"),this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.listeners=[],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 i=this.getInstanceKey(t,n);return this.instances.has(i)||this.instances.set(i,new e(t,n)),this.instances.get(i)},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,i=v({},this.getAll(),((n={})[e]=t,n));this.getStore().setItem(this.storageKey,JSON.stringify(i))}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=v({},this.getAll(),e);this.getStore().setItem(this.storageKey,JSON.stringify(t))}catch(e){throw console.error("WebStore.setMultiple 失败:",e),e}},e.setupGlobalListener=function(){var e=this;this.isGlobalListenerInitialized||(this.isGlobalListenerInitialized=!0,window.addEventListener("storage",function(t){e.instances.forEach(function(e){if(t.key===e.storageKey&&t.storageArea===e.getStore()){var n=t.oldValue?JSON.parse(t.oldValue):{},i=t.newValue?JSON.parse(t.newValue):{};e.dispatchChange(i,n)}})}))},t.dispatchChange=function(e,t){var n=e||{},i=t||{};this.listeners.forEach(function(e){var t=e.prop,r=e.callback;if(t)a(n[t],i[t])||r(n[t],i[t]);else{var o={};new Set([].concat(Object.keys(n),Object.keys(i))).forEach(function(e){var t=e;a(n[t],i[t])||(o[t]={newValue:n[t],oldValue:i[t]})}),Object.keys(o).length>0&&r(o)}})},t.onChanged=function(t,n){e.setupGlobalListener(),this.listeners.push({prop:"string"==typeof t?t:void 0,callback:"string"==typeof t?n:t})},t.offChanged=function(e,t){var n="string"==typeof e?e:void 0,i="string"==typeof e?t:e;this.listeners=this.listeners.filter(function(e){return!(e.prop===n&&e.callback===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 j(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}O.instances=new Map,O.isGlobalListenerInitialized=!1;var T=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t="local"),this.storageKey=void 0,this.storeType=void 0,this.store=void 0,this.listeners=[],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 i=this.getInstanceKey(t,n);return this.instances.has(i)||this.instances.set(i,new e(t,n)),this.instances.get(i)},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(j(function(){return Promise.resolve(n.getAll()).then(function(i){var r,o,a=v({},i,((r={})[e]=t,r));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(j(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(j(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(j(function(){return Promise.resolve(t.getAll()).then(function(n){var i=function(){var i;if(n&&e in n)return delete n[e],Promise.resolve(t.getStore().set((i={},i[t.storageKey]=n,i))).then(function(){})}();if(i&&i.then)return i.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(j(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(j(function(){return Promise.resolve(t.getAll()).then(function(n){var i,r=v({},n,e);return Promise.resolve(t.getStore().set((i={},i[t.storageKey]=r,i))).then(function(){})})},function(e){throw console.error("ChromeStore.setMultiple 失败:",e),e}))}catch(e){return Promise.reject(e)}},e.setupGlobalListener=function(){var e=this;this.isGlobalListenerInitialized||(this.isGlobalListenerInitialized=!0,chrome.storage.onChanged.addListener(function(t,n){e.instances.forEach(function(e){if(e.storeType===n&&t[e.storageKey]){var i=t[e.storageKey];e.dispatchChange(i.newValue,i.oldValue)}})}))},t.dispatchChange=function(e,t){var n=e||{},i=t||{};this.listeners.forEach(function(e){var t=e.prop,r=e.callback;if(t)a(n[t],i[t])||r(n[t],i[t]);else{var o={};new Set([].concat(Object.keys(n),Object.keys(i))).forEach(function(e){var t=e;a(n[t],i[t])||(o[t]={newValue:n[t],oldValue:i[t]})}),Object.keys(o).length>0&&r(o)}})},t.onChanged=function(t,n){e.setupGlobalListener(),this.listeners.push({prop:"string"==typeof t?t:void 0,callback:"string"==typeof t?n:t})},t.offChanged=function(e,t){var n="string"==typeof e?e:void 0,i="string"==typeof e?t:e;this.listeners=this.listeners.filter(function(e){return!(e.prop===n&&e.callback===i)})},t.has=function(e){try{var t=this;return Promise.resolve(j(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(j(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}();T.instances=new Map,T.isGlobalListenerInitialized=!1;var A="https://www.linkedin.com/voyager/api";function N(e,t){var n,i={"csrf-token":e};return t&&(n="string"==typeof t?t:Object.entries(t).map(function(e){return e[0]+"="+e[1]}).join("; "))&&(i.Cookie=n),i}var M={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"]','a[href^="https://www.linkedin.com/in"] h2','div[componentKey$="Topcard"] a[href^="https://www.linkedin.com"] h2','div[componentkey$="Topcard"] h2'],userOccupation:[".artdeco-entity-lockup .artdeco-entity-lockup__subtitle","#recent-activity-top-card h4"],lemlistProfileCardLeadName:[".lemlist-profile-card .lead-name"],linkedinProfileCard:[".scaffold-layout__main .artdeco-card:first-child","main .artdeco-card:first-child:not(.lemlist-header)",'div[componentkey^="com.linkedin.sdui.profile.card"]'],lemlistProfileCard:[".lemlist-profile-card"],alreadyInLemlistTag:[".lemlist-profile-card .already-in-lemlist"],notInLemlistTag:[".lemlist-profile-card .not-in-lemlist"],findEmailTag:[".lemlist-profile-card .find-email"],findPhoneTag:[".lemlist-profile-card .find-phone"],lemlistEmailFound:[".lemlist-profile-card .lemlist-email-found"],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"],howToTippyContainer:["#lemlist-sidebar .sidebar"],lemlistListContainer:[".ui-row.lemlist-list-container"],campaignsListContainer:[".ui-row.sm.campaigns-list-container"],contactListContainer:[".ui-row.sm.contact-list-container"],addButtonText:[".lemlist-add-button-text"],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"],notInLemlistButton:[".lemlist-profile-card .action-primary.not-in-lemlist"],alreadyInLemlistButton:[".lemlist-profile-card .action-primary.already-in-lemlist"],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)'],memberId:["[data-member-id]"],lemlistHowToOverlay:[".lemlist-how-to-overlay"]},salesNavListsPeoplePage:{fullName:['[data-anonymize="person-name"]'],userOccupation:['[data-anonymize="job-title"]'],companyName:['[data-anonymize="company-name"]'],userPicture:['img[data-anonymize="headshot-photo"]'],linkedinUrl:['a[href^="/sales/lead/"]'],lemlistAlreadyInCampaign:[".lemlist-already-in-campaign"],lastCell:["td:last-child"],lastHeader:["th:last-child"],linkedinCheckbox:['.artdeco-list__item input[type="checkbox"]'],linkedinCheckbox2:['[data-scroll-into-view] input[type="checkbox"]'],linkedinCheckbox3:['table input[type="checkbox"]'],linkedinCheckbox3Checked:['table input[type="checkbox"]'],linkedinCheckboxSelectAll:['input[id="bulk-actions-select"]'],bulkToolbar:['.list-detail div:has(input[type="checkbox"])'],mainContainer:["#content-main"],lemlistTableHeader:["th.lemlist-already-in-campaign"],profileSideContainer:["#inline-sidesheet-outlet"],checkboxContainer:["tr"],paginationControls:[".artdeco-pagination"]},salesNavProfilePage:{profileCardSection:["#profile-card-section"],userName:['#profile-card-section [data-anonymize="person-name"]','h1[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"],lemlistProfileCard:[".lemlist-profile-card"],findEmailTag:[".lemlist-profile-card .find-email"],findPhoneTag:[".lemlist-profile-card .find-phone"],lemlistEmailFound:[".lemlist-profile-card .lemlist-email-found"],alreadyInLemlistTag:[".lemlist-profile-card .already-in-lemlist"],notInLemlistTag:[".lemlist-profile-card .not-in-lemlist"],lemlistListContainer:[".ui-row.lemlist-list-container"],campaignsListContainer:[".ui-row.sm.campaigns-list-container"],contactListContainer:[".ui-row.sm.contact-list-container"],addButtonText:[".lemlist-add-button-text"],campaignsListContainerDisplay:[".ui-col.sm.campaigns-list-container-display"],contactListContainerDisplay:[".ui-col.sm.contact-list-container-display"],notInLemlistButton:[".lemlist-profile-card .action-primary.not-in-lemlist"],alreadyInLemlistButton:[".lemlist-profile-card .action-primary.already-in-lemlist"],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"]']},salesNavSearchPeoplePage:{linkedinUrl:['a[href^="/sales/lead/"]'],fullName:['[data-anonymize="person-name"]'],userOccupation:['[data-anonymize="title"]'],companyName:['a[data-anonymize="company-name"]'],userPicture:['img[data-anonymize="headshot-photo"]'],actionsDiv:["ul:has(li [data-anchor-send-message])"],linkedinCheckbox:['.artdeco-list__item input[type="checkbox"]'],linkedinCheckboxChecked:['.artdeco-list__item input[type="checkbox"]:checked'],linkedinCheckbox2:['[data-scroll-into-view] input[type="checkbox"]'],linkedinCheckboxSelectAll:['input[id^="multi-selector-checkbox-ember"]','li input#bulk-actions-select[type="checkbox"]'],lemlistAlreadyInCampaignTagContainer:[".artdeco-list__item ul:has(li [data-anchor-send-message])"],lemlistHeaderContainer:["div:has(+ #search-results-container)"],entityLockup:[".artdeco-entity-lockup"],listItem:[".artdeco-list__item"],checkbox:['input[type="checkbox"]'],listItemArticle:[".artdeco-list__item article"],dataScrollIntoView:["[data-scroll-into-view]"],leadSearchResults:['[data-sn-view-name="module-lead-search-results"]'],completeCheckboxes:['[data-scroll-into-view]:has(+:not(:is(article))) input[type="checkbox"]'],incompleteCheckboxes:['[data-scroll-into-view]:has(+article) input[type="checkbox"]'],profileSideContainer:["#inline-sidesheet-outlet"],linkedinSearchPageContainer:[".lemlist-header + #search-results-container"],howToContainer:["header.application-header"],howToScrollToElement:[".lemlist-header"],selectAllCheckbox:[".lemlist-checkbox-all"],selectAllCheckboxLabel:["span.lemlist-select-all-text"],selectCheckboxChecked:[".lemlist-checkbox:not(.lemlist-checkbox-all).checked"],paginationControls:[".artdeco-pagination"]},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"]','a[href^="https://www.linkedin.com/in/"]'],image:["a>div>div>figure>img, a>div>div>figure>svg, .presence-entity 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"]','p a[href^="https://www.linkedin.com/in/"]'],resultList:[".search-results-container>div:has(.reusable-search__result-container)"],actionsDiv:[".entity-result__actions",".linked-area > div > div:last-child",'div:has(>div[data-view-name="relationship-building-button"])',"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"]','[data-sdui-screen="com.linkedin.sdui.flagshipnav.search.SearchResultsPeople"] [role="list"] [role="listitem"] > div[data-display-contents="true"]:has(a[href^="https://www.linkedin.com/in/"])'],searchResultsContainer:[".search-results-container",'[role="main"] div:has(>hr[role="presentation"])','[data-sdui-screen="com.linkedin.sdui.flagshipnav.search.SearchResultsPeople"] [data-testid="lazy-column"]','[data-sdui-screen="com.linkedin.sdui.flagshipnav.search.SearchResultsPeople"] [role="list"]'],searchResultsContainerParent:['div[componentkey="SemanticPeopleSearchResultsPEOPLE_SEARCH"]','[data-sdui-screen="com.linkedin.sdui.flagshipnav.search.SearchResultsPeople"] [data-testid="lazy-column"]'],searchResultsContainerRemovedParent:['div[data-sdui-component="com.linkedin.sdui.generated.search.dsl.impl.spsInvokePserpAfterReasoning"]'],mainLayoutLeft:[".search-marvel-srp",'[role="main"] div:has(hr)>div>div','[data-sdui-screen="com.linkedin.sdui.flagshipnav.search.SearchResultsPeople"] section'],howToContainer:[".hasLegacyFeedLineHeight div:has(main)",".authentication-outlet"],howToScrollToElement:[".lemlist-header"],selectAllCheckbox:[".lemlist-checkbox-all"],selectAllCheckboxLabel:["span.lemlist-select-all-text"],selectCheckboxChecked:[".lemlist-checkbox:not(.lemlist-checkbox-all).checked"],paginationControls:['[data-testid="pagination-controls-list"]',".artdeco-pagination"],peopleButton:['div[data-view-name="search-filters"] label',"nav ul.search-reusables__filter-list>li>button",'[componentkey="SearchResults_SearchResultsFilterBar"] label']},searchAllPage:{peopleButton:['div[data-view-name="search-filters"] label',"nav ul.search-reusables__filter-list>li>button",'[componentkey="SearchResults_SearchResultsFilterBar"] label'],toolbar:[".scaffold-layout-toolbar"]},linkedinComposerPage:{composerWrapper:[".msg-convo-wrapper"],textareaSelector:[".msg-form__contenteditable"],footer:[".msg-form__message-texteditor"],messagingOverlay:["#msg-overlay"],form:[".msg-form"],formContainer:["form.msg-form.msg-form--thread-footer-feature"],composerEvent:[".msg-s-event-listitem"],composerEventBody:[".msg-s-event-listitem__body"],composerEventName:[".msg-s-message-group__name"],composerEventDate:[".msg-s-message-group__timestamp"],interOPOutlet:["#interop-outlet"]},hubspot:{tableExternalId:["[data-table-external-id]"],avatarDisplay:['[data-test-id="AvatarDisplay-switchComponent"]'],flexContainer:['[class*="Flex__StyledFlex"]'],frameworkDataTable:['[data-test-id="framework-data-table"]'],companyAssocCard:['[data-card-type="ASSOCIATION_TABLE"]'],avatarContainerClass:["AvatarContainer__AvatarWrapper-"],privateButtonClasses:["PrivateButton__StyledButton-eRHhiA","jzJlvZ"],leadRowCell:['[data-table-external-id^="cell-0-136-"]'],leadPrimaryContactLink:['[data-test-id^="association-link-0-1-"]'],leadPrimaryContactHeader:['[data-table-external-id="header-0-136-associations.0-578"]']},gmail:{userEmailElm:[".gb_A.gb_Xa.gb_Z"],userEmailElmFallback:[".gb_Bc .gb_g + div"]},gmailComposerPage:{gmailComposerForm:["form input[name=composeid]"],gmailComposer:["div.M9"],previousMessagesButton:[".ajR"],previousMessages:[".gmail_quote_container blockquote"],lemlistActionBar:[".gmail-action-bar"],lemlistActionBarAskAIElements:[".gmail-ask-ai-elements"],lemlistActionBarTemplatesButton:[".gmail-action-bar .templates"],previousEmail:['form > input[name="rm"]'],body:[".editable.LW-avf"]},gmailSidebarPage:{appIconsContainer:['div[role="tablist"]'],appIconsActiveIcon:["div[role=tablist] div[data-guest-app-id].aT5-aOt-I-KO .aT5-aOt-I-JX-Jw"],appIcons:['div[role="tablist"] div[data-guest-app-id]']},gmailEmailPage:{topBarDate:[".gH.bAk",".gH.VYc0jb"],body:[".a3s.aiL > div[dir]"]}};function R(e,t,n){switch(n){case"all":var i=e.querySelectorAll(t);return i.length>0?Array.from(i):null;case"closest":return e instanceof HTMLElement?e.closest(t):null;default:return e.querySelector(t)}}function U(e){var t=e.page,n=e.key,i=e.container,r=e.mode;null!=i||(i=document);for(var o,a,l=f(t&&n?M[(o={page:t,key:n}).page][o.key]:[e.selector]);!(a=l()).done;){var s=R(i,a.value,r);if(s)return s}return null}function z(e){if(!e)return"";var t=document.createElement("textarea");return t.innerHTML=e,t.value.trim()}function D(){var e,t,n,i,r,o,a,l=window.location.href.includes("linkedin.com/sales")?"salesNavProfilePage":"profilePage";function s(e){return U({page:l,key:e,container:document})}var c=null==(e=s("userName"))?void 0:e.innerText;if(!c)return console.error("extractUserInfos: no userName found"),{};var u,d=null==(t=s("userPicture"))?void 0:t.src,h=null==(n=s("userOccupation"))?void 0:n.innerHTML,m=null==(i=s("companyName"))?void 0:i.innerText,p=null==(r=s("companyLogo"))?void 0:r.src,f=null==(o=s("location"))?void 0:o.innerText;return"salesNavProfilePage"===l&&(u=/linkedin\.com\/sales\/lead/i.test(window.location.href)?window.location.href:null==(a=s("profileUrl"))?void 0:a.href),{name:z(c),profileUrl:u,picture:d,occupation:z(h),companyName:m,companyPicture:p,location:f}}window.getContactInfo=D,window.getElement=U;var B,K,H={"":0,chrome:1,"chrome-extension":2,"view-source":3,ftp:4,file:5,data:6,blob:7,about:8};function W(e){void 0===e&&(e="");var t="",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;void 0===e&&(e="");var 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;void 0===e&&(e="");var n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/company\/([^?/]+)/)||[])[1]||"";return decodeURIComponent(n)}function V(e){if(e){var t=e.match(/:(\d+)$/);return t?t[1]:void 0}}function J(e){if(e){var t=e.match(/,(\d+)\)$/);return t?t[1]:void 0}}function X(e){if(null!=e&&e.year)return{year:e.year,month:e.month}}function Y(e,t,n){if(!e||0===Object.keys(e).length)return n||"";if(t&&e[t])return e[t];var i=Object.keys(e),r=i.find(function(e){return e.startsWith("en")});return r?e[r]:e[i[0]]||n||""}function q(e,t){if(!e||!t)return{};for(var n={},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],a=o[0],l=o[1];a!==t&&l&&(n[a]=l)}return n}function $(e){return Q(e)}function Q(e){var t,n,i;if(e){var r=(e.rootUrl&&e.artifacts?e:null)||e.vectorImage||(null==(t=e.image)?void 0:t["com.linkedin.common.VectorImage"])||e["com.linkedin.common.VectorImage"]||(null==(n=e.displayImageReference)?void 0:n.vectorImage);if(null!=r&&r.rootUrl&&null!=r&&null!=(i=r.artifacts)&&i.length){var o=r.artifacts,a=o.reduce(function(e,t){return((null==t?void 0:t.width)||0)>((null==e?void 0:e.width)||0)?t:e},o[0]);if(null!=a&&a.fileIdentifyingUrlPathSegment)return r.rootUrl+a.fileIdentifyingUrlPathSegment}}}exports.ContactInfoSource=void 0,(B=exports.ContactInfoSource||(exports.ContactInfoSource={})).PUBLIC="public",B.MANUAL="manual",B.APOLLO="apollo",B.LUSHA="lusha",B.HUNTER="hunter",B.ROCKETREACH="rocketreach",B.SNOV="snov",B.CLEARBIT="clearbit",exports.QueryType=void 0,(K=exports.QueryType||(exports.QueryType={})).EMAIL="email",K.PHONE="phone",K.BOTH="both",exports.ChromeStore=T,exports.Draggable=_,exports.KeyedMutex=k,exports.MemoryStore=x,exports.Mutex=b,exports.RealUndefined=e,exports.WebStore=O,exports.cacheWrapper=function(e,t){void 0===t&&(t=d);var n=function(){var n=[].slice.call(arguments),o=i(n)+e.name+(t.identifier||"");if(u(o))return Promise.resolve(r(c(o)));if(s[o]){var a=Object.assign({},d,t);return new Promise(function(e){var t=Date.now(),n=setInterval(function(){u(o)?(clearInterval(n),e(r(c(o)))):Date.now()-t>a.timeout&&(s[o]=!1,clearInterval(n),e(r(a.timeoutResult)))},100)})}return s[o]=!0,e.apply(this,n).then(function(e){return l[o]=e,r(l[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=r,exports.coalesce=function(e,t){var n;void 0===t&&(t={});var i=new Map,r=null!=(n=t.key)?n:function(){return""},o=t.onError,a=function(){var t=[].slice.call(arguments),n=r.apply(void 0,t),a=i.get(n);if(a)return a.pending=t,a.hasPending=!0,a.running;var l={running:Promise.resolve(),pending:null,hasPending:!1};return i.set(n,l),l.running=Promise.resolve().then(function(){return function(t,n,r){try{var a=function(){i.delete(t)},l=r,s=function(e,t,n){for(var i;;){var r=e();if(P(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!P(o)){i=1;break}o=o.s}}var a=new C,l=w.bind(null,a,2);return(0===i?r.then(c):1===i?o.then(s):(void 0).then(function(){(r=e())?r.then?r.then(c).then(void 0,l):c(r):w(a,1,o)})).then(void 0,l),a;function s(t){o=t;do{if(!(r=e())||P(r)&&!r.v)return void w(a,1,o);if(r.then)return void r.then(c).then(void 0,l);P(o=n())&&(o=o.v)}while(!o||!o.then);o.then(s).then(void 0,l)}function c(e){e?(o=n())&&o.then?o.then(s).then(void 0,l):s(o):w(a,1,o)}}(function(){return!!l},0,function(){function t(){l=n.pending,n.pending=null,n.hasPending=!1}var i=function(t,n){try{var i=Promise.resolve(e.apply(void 0,l)).then(function(){})}catch(e){return n(e)}return i&&i.then?i.then(void 0,n):i}(0,function(e){!function(e,t){if(o)try{o(e,t)}catch(e){}}(e,l)});return i&&i.then?i.then(t):t()});return Promise.resolve(s&&s.then?s.then(a):a())}catch(e){return Promise.reject(e)}}(n,l,t)}),l.running};return a.isRunning=function(){return i.has(r.apply(void 0,[].slice.call(arguments)))},a.hasPending=function(){var e,t;return null!=(e=null==(t=i.get(r.apply(void 0,[].slice.call(arguments))))?void 0:t.hasPending)&&e},Object.defineProperty(a,"size",{get:function(){return i.size}}),a},exports.createDefaultObject=o,exports.createElement=function e(t){var n=void 0===t?{}:t,i=n.tag,r=n.children,o=void 0===r?[]:r,a=n.props,l=void 0===a?{}:a,s=n.attrs,c=void 0===s?{}:s,u=n.styles,d=void 0===u?{}:u,h=document.createElement(void 0===i?"div":i);Object.assign(h,l);for(var m=0,p=Object.entries(c);m<p.length;m++){var v=p[m],g=v[1];!1!==g&&h.setAttribute(v[0],g)}for(var y=0,b=Object.entries(d);y<b.length;y++){var k=b[y];S(h,k[0],k[1])}for(var w,C=f(Array.isArray(o)?o:[o]);!(w=C()).done;){var P=w.value;P&&("object"==typeof P?P instanceof Element?h.appendChild(P):h.appendChild(e(P)):h.appendChild(document.createTextNode(P)))}return h},exports.createMessageBus=function(e){void 0===e&&(e={});var t=e.debug,n=void 0!==t&&t,i=e.logPrefix,r=void 0===i?"[MessageBus]":i,o=new Map,a=!1;function l(e){var t;n&&(t=console).error.apply(t,[r+" "+e].concat([].slice.call(arguments,1)))}function s(){a||(chrome.runtime.onMessage.addListener(function(e,t,n){if(e&&"string"==typeof e.type){var i=o.get(e.type);if(i)try{var r=i(e.payload,t);return r instanceof Promise?(r.then(n).catch(function(t){l('Error handling "'+String(e.type)+'":',t),n({__error:!0,message:t instanceof Error?t.message:String(t)})}),!0):(n(r),!1)}catch(t){return l('Error handling "'+String(e.type)+'":',t),n({__error:!0,message:t instanceof Error?t.message:String(t)}),!1}}}),a=!0)}return{send:function(e){return chrome.runtime.sendMessage({type:e,payload:[].slice.call(arguments,1)[0]})},sendToTab:function(e,t){return chrome.tabs.sendMessage(e,{type:t,payload:[].slice.call(arguments,2)[0]})},on:function(e,t){return s(),o.set(e,t),function(){o.delete(e)}},onMany:function(e){s();for(var t=[],n=0,i=Object.entries(e);n<i.length;n++){var r=i[n],a=r[0],l=r[1];l&&(o.set(a,l),t.push(a))}return function(){for(var e=0,n=t;e<n.length;e++)o.delete(n[e])}},hasHandler:function(e){return o.has(e)},getRegisteredTypes:function(){return Array.from(o.keys())},clearAllHandlers:function(){o.clear()}}},exports.createSvg=function(e){return"string"==typeof e?I(e):L(e)},exports.createSvgFromUrl=function(e){try{return Promise.resolve(function(t,n){try{var i=Promise.resolve(fetch(e)).then(function(e){if(!e.ok)throw new Error("网络请求失败: "+e.status+" "+e.statusText);return Promise.resolve(e.text()).then(I)})}catch(e){return n(e)}return i&&i.then?i.then(void 0,n):i}(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 i=arguments,r=this;null!==n&&clearTimeout(n),n=setTimeout(function(){e.apply(r,[].slice.call(i)),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(i){0===t?i(e.apply(void 0,n)):setTimeout(function(){i(e.apply(void 0,n))},t)})},exports.extractCompaniesFromRawProfile=function(e){var t,n=new Map;return null==(t=e.profilePositionGroups)||null==(t=t.elements)||t.forEach(function(e){var t;[e.company].concat((null==(t=e.profilePositionInPositionGroup)||null==(t=t.elements)?void 0:t.map(function(e){return e.company}))||[]).filter(Boolean).forEach(function(e){var t,i=V(e.entityUrn);if(i&&!n.has(i)){var r;if(e.industry&&null!=(t=e.industryUrns)&&t.length){var o=e.industry[e.industryUrns[0]];r=null==o?void 0:o.name}n.set(i,{linkedinId:i,universalName:e.universalName,name:e.name||"",industry:r,employeeCountRange:e.employeeCountRange?{start:e.employeeCountRange.start,end:e.employeeCountRange.end}:void 0,logoUrl:$(e.logo)})}})}),Array.from(n.values())},exports.generateStableUniqueKey=i,exports.getCompanyPublicId=G,exports.getContactInfo=D,exports.getCookie=function(e,t,n){return void 0===n&&(n=!1),chrome.cookies.get({url:e,name:t}).then(function(e){var t;return n?(null==e||null==(t=e.value)?void 0:t.replace(/"/g,""))||"":null!=e?e:void 0})},exports.getCookies=function(e,t){return void 0===t&&(t=!1),chrome.cookies.getAll({url:e}).then(function(e){return t?function(e){return e.map(function(e){return e.name+"="+e.value}).join("; ")}(e):e})},exports.getElement=U,exports.getExtensionInfo=function(){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}},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,i=t.cookies;try{var r="string"==typeof e?{universalName:e}:e,o="universalName"in r,a=A+"/organization/companies"+(o?"?q=universalName&universalName="+r.universalName:"/"+r.urn),l=N(n,i);return Promise.resolve(fetch(a,{method:"GET",headers:l}).then(function(e){try{var t,n=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){if(o){var n,i=(null==(n=e.elements)?void 0:n[0])||null;return t=1,i}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.getLinkedinMe=function(e){var t=e.csrfToken,n=e.cookies;try{var i=A+"/me",r=N(t,n);return Promise.resolve(fetch(i,{method:"GET",headers:r}).then(function(e){try{return Promise.resolve(e.ok?e.json():null)}catch(e){return Promise.reject(e)}}).catch(function(e){return console.error(e),null}))}catch(e){return Promise.reject(e)}},exports.getLinkedinPageType=W,exports.getLinkedinProfile=function(e,t){var n=t.csrfToken,i=t.cookies;try{var r=A+"/identity/dash/profiles?q=memberIdentity&memberIdentity="+e+"&decorationId=com.linkedin.voyager.dash.deco.identity.profile.FullProfileWithEntities-26",o=N(n,i);return Promise.resolve(fetch(r,{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,i=(null==(n=e.elements)?void 0:n[0])||null;return t=1,i})}();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.getLinkedinPublicId=function(e){var t;return void 0===e&&(e=""),F(e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL)||G(e)||""},exports.getPageType=function(e){if(void 0===e&&(e=""),!e)return"";var t=Object.keys(H),n=new URL(e).protocol.replace(":","");return t.includes(n)?n:W(e)},exports.getPostPublicId=function(e){var t;void 0===e&&(e="");var n=((e=e||(null==(t=window.top)?void 0:t.location.href)||document.URL).match(/linkedin\.com\/posts\/([^\/]+)\//)||[])[1]||"";return decodeURIComponent(n)},exports.getProfilePublicId=F,exports.isCloneable=t,exports.isEqual=a,exports.isErrorResponse=function(e){return"object"==typeof e&&null!==e&&"__error"in e&&!0===e.__error},exports.isLinkedInUrl=function(e){return/^https?:\/\/(www|.{2})\.linkedin\.com/.test(e)},exports.isPrimitive=n,exports.launchWebAuthFlow=function(e){var t=e.clientId,n=e.responseType,i=void 0===n?"code":n,r=e.state,o=e.nonce,a=e.interactive,l=void 0===a||a;try{var s=chrome.identity.getRedirectURL(),c=Array.isArray(i)?i:[i],u=new URL("https://accounts.google.com/o/oauth2/v2/auth");return u.searchParams.set("client_id",t),u.searchParams.set("redirect_uri",s),u.searchParams.set("response_type",c.join(" ")),u.searchParams.set("scope","openid email profile"),o&&u.searchParams.set("nonce",o),r&&u.searchParams.set("state",r),Promise.resolve(chrome.identity.launchWebAuthFlow({url:u.toString(),interactive:l}).then(function(e){if(!e)return Promise.reject(new Error("redirectUrl is null"));var t=e.includes("?")?"?":"#",n=new URLSearchParams(e.split(t)[1]),i={};return n.forEach(function(e,t){i[t]=e}),i}).catch(function(e){return console.log("error",e),Promise.reject(e)}))}catch(e){return Promise.reject(e)}},exports.pageTypeMap=H,exports.scrollToBottom=E,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&&E(e))},exports.serialize=function(e,t){var n;void 0===t&&(t={});var i=new k,r=null!=(n=t.key)?n:function(){return""};return function(){var t=[].slice.call(arguments);return i.run(r.apply(void 0,t),function(){return e.apply(void 0,t)})}},exports.singleExecutionWrapper=function(t,n){void 0===n&&(n=0);var i=function(){if(i.isExecuting)return Promise.resolve(e);i.isExecuting=!0;var r,o=performance.now(),a=function(){var e=performance.now()-o;n&&n>e?setTimeout(function(){i.isExecuting=!1},n-e):i.isExecuting=!1};try{r=Promise.resolve(t.apply(this,[].slice.call(arguments)))}catch(e){return a(),Promise.reject(e)}return r.then(a,a),r};return i.isExecuting=!1,i},exports.singleFlight=function(e,t){var n;void 0===t&&(t={});var i=new Map,r=null!=(n=t.key)?n:function(){return""},o=function(){var t=[].slice.call(arguments),n=r.apply(void 0,t),o=i.get(n);if(o)return o;var a=function(e,t){try{return Promise.resolve(e.apply(void 0,t))}catch(e){return Promise.reject(e)}}(e,t).finally(function(){i.delete(n)});return i.set(n,a),a};return o.isRunning=function(){return i.has(r.apply(void 0,[].slice.call(arguments)))},Object.defineProperty(o,"size",{get:function(){return i.size}}),o},exports.transformRawCompany=function(e){var t,n,i,r,o,a,l,s,c,u,d=(null==(t=e.elements)?void 0:t[0])||e,h=V(d.entityUrn);if(!h)throw new Error("Cannot extract linkedinId from company data");for(var m,p=(null!=(n=d.defaultLocale)&&n.language&&null!=(i=d.defaultLocale)&&i.country?d.defaultLocale.language+"_"+d.defaultLocale.country:null)||(null!=(r=d.multiLocaleNames)&&r.localized?Object.keys(d.multiLocaleNames.localized)[0]:null)||"en_US",v=null==(o=d.multiLocaleNames)?void 0:o.localized,g=Y(v,p,d.name),y=null==(a=d.multiLocaleDescriptions)?void 0:a.localized,b=Y(y,p,"string"==typeof d.description?d.description:void 0)||void 0,k={},w=q(v,p),C=q(y,p),P=new Set([].concat(Object.keys(w),Object.keys(C))),x=f(P);!(m=x()).done;){var S=m.value,L={};w[S]&&(L.name=w[S]),C[S]&&(L.description=C[S]),Object.keys(L).length>0&&(k[S]=L)}var I=d.headquarter||(null==(l=d.confirmedLocations)?void 0:l.find(function(e){return e.headquarter})),E=Q(d.logo)||Q(null==(s=d.logos)?void 0:s.logo),_=Q(d.backgroundCoverImage),O=d.jobSearchPageUrl||void 0,j=null==(c=d.companyIndustries)||null==(c=c[0])?void 0:c.localizedName,T=P.size>0?[p].concat(Array.from(P)):void 0;return{linkedinId:h,universalName:d.universalName,name:g,description:b,industry:j,employeeCountRange:d.staffCount?{start:d.staffCount,end:d.staffCount}:d.staffCountRange?{start:d.staffCountRange.start,end:d.staffCountRange.end}:void 0,headquarters:I?{country:I.country,city:I.city,geographicArea:I.geographicArea,postalCode:I.postalCode,line1:I.line1}:void 0,logoUrl:E,backgroundCoverUrl:_,specialities:d.specialities,companyType:d.type,foundedYear:null==(u=d.foundedOn)?void 0:u.year,websiteUrl:d.companyPageUrl,jobSearchPageUrl:O,primaryLocale:p,supportedLocales:T,translations:Object.keys(k).length>0?k:void 0}},exports.transformRawProfile=function(e){var t,n,i,r,o,a,l,s,c=V(e.objectUrn);if(!c)throw new Error("Cannot extract memberId from rawProfile");for(var u,d=function(e){if(e)return e.language+"_"+e.country}(e.primaryLocale),h=function(e){if(null!=e&&e.length)return e.map(function(e){return e.language+"_"+e.country})}(e.supportedLocales),m=Y(e.multiLocaleFirstName,d,e.firstName),p=Y(e.multiLocaleLastName,d,e.lastName),v=Y(e.multiLocaleHeadline,d,e.headline),g=Y(e.multiLocaleSummary,d,e.summary),y={},b=(null==h?void 0:h.filter(function(e){return e!==d}))||[],k=f(b);!(u=k()).done;){var w,C,P,x,S=u.value,L={},I=null==(w=e.multiLocaleFirstName)?void 0:w[S],E=null==(C=e.multiLocaleLastName)?void 0:C[S],_=null==(P=e.multiLocaleHeadline)?void 0:P[S],O=null==(x=e.multiLocaleSummary)?void 0:x[S];I&&(L.firstName=I),E&&(L.lastName=E),_&&(L.headline=_),O&&(L.summary=O),Object.keys(L).length>0&&(y[S]=L)}var j=(null==(t=e.profileSkills)||null==(t=t.elements)?void 0:t.map(function(e){return e.name}))||[],T=(null==(n=e.profileLanguages)||null==(n=n.elements)?void 0:n.map(function(e){return{name:e.name,proficiency:e.proficiency}}))||[],A=(null==(i=e.profileHonors)||null==(i=i.elements)?void 0:i.map(function(e){return{title:e.title,issuer:e.issuer,issuedOn:X(e.issuedOn)}}))||[],N=(null==(r=e.profileEducations)||null==(r=r.elements)?void 0:r.map(function(e){var t,n,i;return{school:Y(e.multiLocaleSchoolName,d,e.schoolName||(null==(t=e.school)?void 0:t.name)),degree:Y(e.multiLocaleDegreeName,d,e.degreeName)||void 0,fieldOfStudy:Y(e.multiLocaleFieldOfStudy,d,e.fieldOfStudy)||void 0,startDate:X(null==(n=e.dateRange)?void 0:n.start),endDate:X(null==(i=e.dateRange)?void 0:i.end)}}))||[],M=(null==(o=e.profileCertifications)||null==(o=o.elements)?void 0:o.map(function(e){var t,n;return{name:Y(e.multiLocaleName,d,e.name),authority:Y(e.multiLocaleAuthority,d,e.authority)||void 0,startDate:X(null==(t=e.dateRange)?void 0:t.start),endDate:X(null==(n=e.dateRange)?void 0:n.end),licenseNumber:e.licenseNumber,url:e.url}}))||[],R=[];null==(a=e.profilePositionGroups)||null==(a=a.elements)||a.forEach(function(e){var t;((null==(t=e.profilePositionInPositionGroup)?void 0:t.elements)||[]).forEach(function(t){for(var n,i,r,o,a,l,s=t.company||e.company,c=V(t.companyUrn||(null==s?void 0:s.entityUrn)),u=Y(t.multiLocaleTitle,d,t.title),h=Y(t.multiLocaleCompanyName,d,t.companyName||(null==s?void 0:s.name)),m=Y(t.multiLocaleDescription,d,t.description)||void 0,p={},v=f(b);!(a=v()).done;){var g,y,k,w=a.value,C={},P=null==(g=t.multiLocaleTitle)?void 0:g[w],x=null==(y=t.multiLocaleDescription)?void 0:y[w],S=null==(k=t.multiLocaleCompanyName)?void 0:k[w];P&&(C.title=P),x&&(C.description=x),S&&(C.companyName=S),Object.keys(C).length>0&&(p[w]=C)}if(null!=s&&s.industry&&null!=s&&null!=(n=s.industryUrns)&&n.length){var L=s.industry[s.industryUrns[0]];l=null==L?void 0:L.name}R.push({linkedinPositionId:J(t.entityUrn),companyName:h,companyLinkedinId:c,companyUniversalName:null==s?void 0:s.universalName,title:u,description:m,startDate:X(null==(i=t.dateRange)?void 0:i.start),endDate:X(null==(r=t.dateRange)?void 0:r.end),isCurrent:!(null!=(o=t.dateRange)&&o.end),companyLogoUrl:$(null==s?void 0:s.logo),companyIndustry:l,companyEmployeeCountRange:null!=s&&s.employeeCountRange?{start:s.employeeCountRange.start,end:s.employeeCountRange.end}:void 0,translations:Object.keys(p).length>0?p:void 0})})});var U,z,D=(null==(l=e.geoLocation)||null==(l=l.geo)?void 0:l.defaultLocalizedName)||void 0,B=null==(s=e.industry)?void 0:s.name;return{memberId:c,publicIdentifier:e.publicIdentifier,firstName:m,lastName:p,headline:v||void 0,summary:g||void 0,location:D,pictureUrl:(z=e.profilePicture,Q(z)),backgroundPictureUrl:(U=e.backgroundPicture,Q(U)),isPremium:!0===e.premium,industry:B,primaryLocale:d,supportedLocales:h,skills:j,languages:T.length>0?T:void 0,honors:A.length>0?A:void 0,educations:N.length>0?N:void 0,certifications:M.length>0?M:void 0,positions:R.length>0?R:void 0,translations:Object.keys(y).length>0?y:void 0}};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|