PageSourceSearch

https://wuxiapptec.com/_nuxt/Cj5CGfeQ.js

js wuxiapptec.com collected 2026-10-02 10:38:07 UTC 2,881 bytes, 1 lines download raw bytes

1import{j as k}from"./DfXQ21zx.js";const d="user_ip_cache",$=24*60*60*1e3,b=k(),A=b.public.IR_API64,j=async()=>{try{{const r=localStorage.getItem(d);if(r)try{const e=JSON.parse(r),n=Date.now();if(e!=null&&e.ip&&(e!=null&&e.timestamp)&&n-e.timestamp<$)return e.ip}catch(e){console.warn("IP cache parse error:",e),localStorage.removeItem(d)}}const t=await $fetch(A),o=(t==null?void 0:t.ip)||"";return o&&localStorage.setItem(d,JSON.stringify({ip:o,timestamp:Date.now()})),o}catch(t){return console.error("Error fetching Ip:",t),""}},i="visitor_id",O=60*60*24*365,S=()=>typeof globalThis<"u"&&globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`visitor_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,12)}`,_=(t,o=O)=>{typeof document>"u"||(document.cookie=[`${encodeURIComponent(i)}=${encodeURIComponent(t)}`,"Path=/",`Max-Age=${o}`,"SameSite=Lax"].join("; "))},T=()=>{if(typeof document>"u")return"";const t=`${encodeURIComponent(i)}=`,o=document.cookie?document.cookie.split("; "):[];for(const r of o)if(r.startsWith(t))return decodeURIComponent(r.slice(t.length));return""},x=()=>{if(typeof window>"u")return"";try{const t=localStorage.getItem(i);if(t)return _(t),t;const o=T();if(o)return localStorage.setItem(i,o),o;const r=S();return localStorage.setItem(i,r),_(r),r}catch(t){return console.error("getVisitorId error:",t),S()}},I="page_visit_cache",R=24*60*60*1e3;function C(){try{const t=localStorage.getItem(I);if(!t)return{};const o=JSON.parse(t);return o&&typeof o=="object"?o:{}}catch(t){return console.warn("[pv-uv] visit cache parse error:",t),localStorage.removeItem(I),{}}}function g(t){try{localStorage.setItem(I,JSON.stringify(t))}catch(o){console.warn("[pv-uv] set visit cache error:",o)}}function w(t){const o=Date.now(),r={};return Object.keys(t).forEach(e=>{const n=t[e];n!=null&&n.timestamp&&o-n.timestamp<R&&(r[e]=n)}),r}function E(t,o){const r=`${t}_${o}`;let e=C();return e=w(e),e[r]?(g(e),"pv"):(e[r]={timestamp:Date.now()},g(e),"uv")}async function D(t){var s,h,a,y;const{mark:o,id:r,locale:e,t:n,normalizeRouteId:u,getVisitorId:l,getIp:f,apiUrl:V="/api/ymkd/v1/pv-uv",enabled:P=!0}=t;if(P)try{const p=Promise.resolve(u==null?void 0:u());let v="";try{v=((h=(s=l==null?void 0:l())==null?void 0:s.trim)==null?void 0:h.call(s))||""}catch(m){console.error("[pv-uv] getVisitorId error:",m)}if(await p,!r||typeof n<"u")return;let c=v;if(!c)try{c=((y=(a=await(f==null?void 0:f()))==null?void 0:a.trim)==null?void 0:y.call(a))||""}catch(m){console.error("[pv-uv] getIp error:",m),c=""}if(!c)return;const U=E(r,c);await $fetch(V,{method:"POST",body:{mark:o,document_id:r,type:U,locale:e},query:e?{locale:e}:void 0})}catch(p){console.error("[pv-uv] report error:",p)}}function H(){return{reportPvUv:D,getVisitType:E,getVisitCache:C,setVisitCache:g,cleanExpiredVisitCache:w}}export{j as a,x as g,H as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.