customer-chat-sdk 1.0.28 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("modern-screenshot")):"function"==typeof define&&define.amd?define(["exports","modern-screenshot"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CustomerSDK={},t.modernScreenshot)}(this,function(t,e){"use strict";class n{constructor(t){this.iconElement=null,this.badgeElement=null,this.onClickCallback=null,this.notificationCallback=null,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.iconStartX=0,this.iconStartY=0,this.dragMoveHandler=null,this.dragEndHandler=null,this.iconPosition=null,this.iconPosition=t||null}async show(){if(this.iconElement)return;this.iconElement=document.createElement("div"),this.iconElement.className="customer-sdk-icon";const t={position:"fixed",width:"30px",height:"30px",backgroundColor:"transparent",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:"999999",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",userSelect:"none",transition:"transform 0.2s ease",border:"none",outline:"none",overflow:"visible"};this.iconPosition?(void 0!==this.iconPosition.x?(t.left="number"==typeof this.iconPosition.x?`${this.iconPosition.x}px`:this.iconPosition.x,t.right="auto"):t.right="20px",void 0!==this.iconPosition.y?(t.top="number"==typeof this.iconPosition.y?`${this.iconPosition.y}px`:this.iconPosition.y,t.bottom="auto"):t.bottom="80px"):(t.bottom="80px",t.right="20px"),Object.assign(this.iconElement.style,t);const e=document.createElement("img");e.src="data:image/png;base64,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",e.style.width="100%",e.style.height="100%",e.style.objectFit="cover",e.style.display="block",e.alt="Customer Service",e.onload=()=>{this.iconElement&&(e.style.opacity="1",e.style.visibility="visible")},e.onerror=t=>{},e.style.opacity="1",e.style.visibility="visible";const n=document.createElement("div");Object.assign(n.style,{width:"100%",height:"100%",borderRadius:"50%",overflow:"hidden",position:"relative"}),n.appendChild(e),this.iconElement.appendChild(n),this.setupDragEvents(),document.body.appendChild(this.iconElement)}forceCleanupDragEvents(){if(this.dragMoveHandler)try{document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)}catch(t){}if(this.dragEndHandler)try{document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)}catch(t){}this.isDragging=!1,this.iconElement&&(this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer")}hide(){this.forceCleanupDragEvents(),this.iconElement&&(this.iconElement.remove(),this.iconElement=null,this.onClickCallback=null,this.dragMoveHandler=null,this.dragEndHandler=null)}setPosition(t){}setIconPosition(t){if(this.iconPosition=t,this.iconElement){void 0!==t.x&&(this.iconElement.style.left="number"==typeof t.x?`${t.x}px`:t.x,this.iconElement.style.right="auto"),void 0!==t.y&&(this.iconElement.style.top="number"==typeof t.y?`${t.y}px`:t.y,this.iconElement.style.bottom="auto");const e=this.iconElement.getBoundingClientRect();this.iconStartX=e.left,this.iconStartY=e.top}}setStyle(t){}onClick(t){this.onClickCallback=t}onNotification(t){this.notificationCallback=t}showNotification(t){if(!this.iconElement)return;const{showBadge:e=!0,badgeCount:n=0,badgeText:i="",pulse:o=!1}=t;(e||n>0)&&this.createBadge(n,i,o),this.notificationCallback&&this.notificationCallback({badgeCount:n,badgeText:i,pulse:o})}clearNotification(){this.badgeElement&&(this.badgeElement.remove(),this.badgeElement=null)}setupDragEvents(){this.iconElement&&(this.dragMoveHandler=this.handleDragMove.bind(this),this.dragEndHandler=this.handleDragEnd.bind(this),this.iconElement.addEventListener("mousedown",this.handleDragStart.bind(this)),this.iconElement.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!1}))}handleDragStart(t){if(!this.iconElement)return;if(t.target!==this.iconElement&&!this.iconElement.contains(t.target))return;t.preventDefault(),t.stopPropagation();const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY;this.isDragging=!1,this.dragStartX=e,this.dragStartY=n;const i=this.iconElement.getBoundingClientRect();this.iconStartX=i.left,this.iconStartY=i.top,this.iconElement.style.transition="none",this.iconElement.style.cursor="grabbing";const o=t=>{const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY,i=e-this.dragStartX,r=n-this.dragStartY;(Math.abs(i)>5||Math.abs(r)>5)&&(this.isDragging=!0,"touches"in t?document.removeEventListener("touchmove",o):document.removeEventListener("mousemove",o),this.dragMoveHandler&&this.dragEndHandler&&("touches"in t?(document.addEventListener("touchmove",this.dragMoveHandler,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",this.dragMoveHandler),document.addEventListener("mouseup",this.dragEndHandler))))};"touches"in t?(document.addEventListener("touchmove",o,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",o),document.addEventListener("mouseup",this.dragEndHandler))}handleDragMove(t){if(!this.iconElement||!this.isDragging)return;const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY,i=t.target;if(i&&i!==this.iconElement&&!this.iconElement.contains(i)){if("IFRAME"===i.tagName||i.closest("iframe")||i.closest(".customer-sdk-container")||i.closest(".customer-sdk-overlay"))return void this.handleDragEnd()}const o=e-this.dragStartX,r=n-this.dragStartY,a=this.iconElement.getBoundingClientRect(),s=a.left+a.width/2,c=a.top+a.height/2;if(Math.sqrt(Math.pow(e-s,2)+Math.pow(n-c,2))>3*Math.max(a.width,a.height))return void this.handleDragEnd();t.preventDefault(),t.stopPropagation();const l=this.iconStartX+o,u=this.iconStartY+r,h=window.innerWidth-this.iconElement.offsetWidth,d=window.innerHeight-this.iconElement.offsetHeight,m=Math.max(0,Math.min(l,h)),f=Math.max(0,Math.min(u,d));this.iconElement.style.left=`${m}px`,this.iconElement.style.top=`${f}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto"}handleDragEnd(t){this.iconElement&&(this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)),this.dragEndHandler&&(document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)),this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer",this.isDragging||this.handleClick(),this.isDragging=!1)}handleClick(){this.onClickCallback&&this.onClickCallback()}createBadge(t,e="",n=!1){this.clearNotification(),this.badgeElement=document.createElement("div"),this.badgeElement.className="customer-sdk-icon-badge",this.badgeElement.textContent=t>0?t>99?"99+":t.toString():e||"",Object.assign(this.badgeElement.style,{position:"absolute",top:"-4px",left:"-4px",right:"auto",minWidth:"18px",height:"18px",borderRadius:"50%",backgroundColor:"#ff4444",color:"#ffffff",fontSize:"10px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000001",boxShadow:"0 -1px 4px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15)",...0===t&&""===e&&{width:"12px",height:"12px",minWidth:"12px",top:"-2px",left:"-2px"},...n&&{animation:"sdk-badge-pulse 1.5s infinite"}}),this.iconElement&&this.iconElement.appendChild(this.badgeElement)}}class i{constructor(t={}){this.iframeElement=null,this.overlayElement=null,this.containerElement=null,this.isOpen=!1,this.isCreated=!1,this.config={src:"",mode:"auto",width:400,height:600,allowClose:!0,...t},this.setupMessageListener()}async init(){try{this.createIframe(),this.isCreated=!0}catch(t){throw t}}show(){if(!this.isOpen){if(!this.isCreated)throw new Error("Iframe not initialized. Call init() first.");try{const t="popup"===this.getActualMode();t&&this.createOverlay(),this.containerElement&&(t?(Object.assign(this.containerElement.style,{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",visibility:"visible",opacity:"1",display:"block"}),this.overlayElement?.appendChild(this.containerElement)):(Object.assign(this.containerElement.style,{position:"fixed",visibility:"visible",opacity:"1",display:"block"}),this.preventBodyScroll(!0))),this.isOpen=!0}catch(t){}}}open(){this.show()}hide(){if(!this.isOpen)return;this.containerElement&&Object.assign(this.containerElement.style,{visibility:"hidden",opacity:"0",display:"none"}),this.overlayElement&&(this.overlayElement.remove(),this.overlayElement=null);"fullscreen"===this.getActualMode()&&this.preventBodyScroll(!1),this.isOpen=!1,this.config.onClose&&this.config.onClose()}close(){this.hide()}destroy(){this.hide(),this.containerElement&&(this.containerElement.remove(),this.containerElement=null,this.iframeElement=null),this.isCreated=!1}isIframeOpen(){return this.isOpen}sendToIframe(t){this.iframeElement&&this.iframeElement.contentWindow&&this.iframeElement.contentWindow.postMessage(t,"*")}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.className="customer-sdk-overlay",Object.assign(this.overlayElement.style,{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"999998",display:"flex",alignItems:"center",justifyContent:"center",cursor:this.config.allowClose?"pointer":"default"}),this.config.allowClose&&this.overlayElement.addEventListener("click",t=>{t.target===this.overlayElement&&this.close()}),document.body.appendChild(this.overlayElement)}createIframe(){this.containerElement=document.createElement("div"),this.containerElement.className="customer-sdk-container",this.iframeElement=document.createElement("iframe"),this.iframeElement.className="customer-sdk-iframe",this.iframeElement.src=this.config.src||"",this.iframeElement.frameBorder="0",this.iframeElement.setAttribute("allow",["microphone","camera","geolocation","clipboard-read","clipboard-write","fullscreen","autoplay","encrypted-media"].join("; ")),this.iframeElement.setAttribute("sandbox",["allow-same-origin","allow-scripts","allow-forms","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-storage-access-by-user-activation"].join(" "));const t="popup"===this.getActualMode();this.iframeElement.scrolling=t?"auto":"no";const e={width:t?`${this.config.width}px`:"100%",height:t?`${this.config.height}px`:"100%",maxWidth:t?"450px":"100%",maxHeight:t?"700px":"100%",backgroundColor:"#ffffff",borderRadius:t?"12px":"12px 12px 0 0",boxShadow:t?"0 20px 40px rgba(0, 0, 0, 0.15)":"0 -4px 16px rgba(0, 0, 0, 0.25)",border:"none",position:"fixed",zIndex:"999999",...t?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:"0",left:"0",bottom:"0",right:"0",transform:"none",overflow:"hidden",position:"fixed"},visibility:"hidden",opacity:"0",display:"none"};Object.assign(this.containerElement.style,e);const n={width:"100%",height:"100%",border:"none",borderRadius:"inherit",...t?{}:{overflow:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitScrollbar:"none"}};Object.assign(this.iframeElement.style,n),this.containerElement.appendChild(this.iframeElement),this.iframeElement.addEventListener("load",()=>{t||this.injectMobileStyles()}),document.body.appendChild(this.containerElement)}injectMobileStyles(){if(this.iframeElement)try{const t=this.iframeElement.contentDocument||this.iframeElement.contentWindow?.document;if(t){const e=t.createElement("style");e.textContent="\n /* 移动端iframe全屏样式优化 */\n * {\n -webkit-overflow-scrolling: touch !important;\n }\n \n body, html, #app, .container {\n overflow: auto !important;\n -webkit-overflow-scrolling: touch !important;\n }\n \n /* 隐藏所有滚动条 */\n ::-webkit-scrollbar {\n width: 0px !important;\n height: 0px !important;\n background: transparent !important;\n }\n \n /* Firefox */\n html {\n scrollbar-width: none !important;\n }\n \n /* IE/Edge */\n body {\n -ms-overflow-style: none !important;\n }\n \n /* 确保内容可以滚动 */\n body {\n overflow: auto !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n ",t.head?.appendChild(e)}}catch(t){}}preventBodyScroll(t){if(t){const t=window.scrollY;Object.assign(document.body.style,{position:"fixed",top:`-${t}px`,width:"100%",overflow:"hidden"}),document.body.setAttribute("data-scroll-position",t.toString())}else{const t=parseInt(document.body.getAttribute("data-scroll-position")||"0");Object.assign(document.body.style,{position:"",top:"",width:"",overflow:""}),document.body.removeAttribute("data-scroll-position"),window.scrollTo(0,t)}}isMobileDevice(){return window.innerWidth<=768||/Android|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(navigator.userAgent)}getActualMode(){return"auto"===this.config.mode?this.isMobileDevice()?"fullscreen":"popup":this.config.mode}setupMessageListener(){window.addEventListener("message",t=>{this.config.src&&t.origin!==new URL(this.config.src).origin||this.handleIframeMessage(t.data)},!1)}handleIframeMessage(t){let e;if("string"==typeof t)e=t;else{if(!t||!t.type)return;e=t.type}switch(e){case"iframe_ready":break;case"close_iframe":case"close":this.close();break;case"resize_iframe":case"resize":t.width&&t.height&&this.resizeIframe(t.width,t.height);break;case"new-message":this.config.onMessage&&this.config.onMessage(e,t)}}resizeIframe(t,e){this.iframeElement&&(this.iframeElement.style.width=`${t}px`,this.iframeElement.style.height=`${e}px`)}}let o;class r{constructor(t,e={}){this.targetElement=null,this.isRunning=!1,this.screenshotCount=0,this.screenshotHistory=[],this.lastScreenshotTime=0,this.error=null,this.isEnabled=!1,this.isUploading=!1,this.uploadError=null,this.uploadProgress={success:0,failed:0},this.currentUploadConfig=null,this.worker=null,this.screenshotTimer=null,this.screenshotContext=null,this.messageHandler=null,this.dynamicInterval=null,this.expirationTimer=null,this.imageProxyCache=new Map,this.globalErrorHandler=null,this.globalRejectionHandler=null,this.targetElement=t,this.options={interval:e.interval??5e3,quality:e.quality??.4,scale:e.scale??1,maxHistory:e.maxHistory??10,compress:e.compress??!1,maxWidth:e.maxWidth??1600,maxHeight:e.maxHeight??900,outputFormat:e.outputFormat??"webp",enableCORS:e.enableCORS??!0,proxyUrl:e.proxyUrl??"",engine:e.engine??"modern-screenshot",corsMode:e.corsMode??"canvas-proxy",silentMode:e.silentMode??!1,maxRetries:e.maxRetries??2,preloadImages:e.preloadImages??!1,maxConcurrentDownloads:e.maxConcurrentDownloads??10,onlyVisibleImages:e.onlyVisibleImages??!0},this.setupMessageListener(),this.setupVisibilityChangeListener()}setTargetElement(t){if(this.targetElement!==t&&this.screenshotContext){try{e.destroyContext(this.screenshotContext)}catch(t){}this.screenshotContext=null}this.targetElement=t}setupMessageListener(){this.messageHandler||(this.messageHandler=t=>{this.handleIframeMessage(t)},window.addEventListener("message",this.messageHandler))}setupVisibilityChangeListener(){document.addEventListener("visibilitychange",()=>{document.hidden,this.options.silentMode})}handleIframeMessage(t){try{if(!t.data||"checkScreenshot"!==t.data.type)return;this.options.silentMode;const e=this.parseUploadConfig(t.data.data);if(!e)return void(this.uploadError="解析上传配置失败");this.currentUploadConfig=e;const n=Date.now();if(!(e.ttl>0&&e.ttl>n))return this.options.silentMode||e.ttl,this.stopScreenshot(),this.isEnabled=!1,this.currentUploadConfig=null,void(this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null));{this.isEnabled||(this.options.silentMode,this.isEnabled=!0),this.dynamicInterval=e.duration||this.options.interval;const t=e.ttl-n;if(!this.options.silentMode){Math.ceil(t/6e4)}this.takeScreenshotAndUpload(e),this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null),this.expirationTimer=setTimeout(()=>{this.options.silentMode,this.stopScreenshot(),this.isEnabled=!1,this.currentUploadConfig=null,this.expirationTimer=null},t)}}catch(t){this.uploadError=t instanceof Error?t.message:String(t)}}async takeScreenshotAndUpload(t){this.isRunning&&(this.options.silentMode,this.stopScreenshot()),this.startScreenshot(this.dynamicInterval||t.duration||this.options.interval);try{if(await this.takeScreenshot()){await new Promise(t=>setTimeout(t,100));const e=this.getLatestScreenshot();e?(this.isUploading=!0,this.uploadError=null,this.uploadScreenshot(e,t).then(t=>{t&&this.options.silentMode}).catch(t=>{this.uploadError=t instanceof Error?t.message:String(t)}).finally(()=>{this.isUploading=!1})):this.options.silentMode}}catch(t){this.uploadError=t instanceof Error?t.message:String(t)}}parseUploadConfig(t){try{const e="string"==typeof t?t:JSON.stringify(t),n=JSON.parse(e);return n.uploadUrl&&n.contentType?(("number"!=typeof n.duration||n.duration<=0)&&(n.duration=this.options.interval),"number"!=typeof n.ttl&&("number"==typeof n.expirationMinutes&&n.expirationMinutes>0?n.ttl=Date.now()+60*n.expirationMinutes*1e3:n.ttl=0),n):null}catch(t){return null}}startScreenshot(t){if(!this.isEnabled)return;const e=t||this.dynamicInterval||this.options.interval;this.isRunning&&(this.options.silentMode,this.stopScreenshot()),this.options.silentMode,this.isRunning=!0,!this.worker&&this.options.compress&&(this.worker=this.createWorker()),this.screenshotTimer=setInterval(async()=>{if(this.isRunning&&this.isEnabled&&!document.hidden&&(await this.takeScreenshot(),this.currentUploadConfig)){const t=this.getLatestScreenshot();t&&!this.isUploading&&this.uploadScreenshot(t,this.currentUploadConfig).catch(t=>{})}},e)}stopScreenshot(){this.isRunning&&(this.options.silentMode,this.isRunning=!1,this.screenshotTimer&&(clearInterval(this.screenshotTimer),this.screenshotTimer=null))}async captureOnce(){return!!this.isEnabled&&await this.takeScreenshot()}async takeScreenshot(){if(!this.targetElement)return!1;this.setupGlobalErrorHandlers();try{this.options.silentMode,await Promise.all([this.waitForStylesAndFonts(),this.waitForFonts()]);let t;this.options.silentMode,this.options.preloadImages&&this.options.enableCORS&&(await this.preprocessNetworkImages(this.targetElement),await this.waitForImagesToLoad(this.targetElement)),await new Promise(t=>setTimeout(t,50)),t=await this.takeScreenshotWithModernScreenshot(this.targetElement);const e=Date.now();this.screenshotCount++,this.lastScreenshotTime=e,this.screenshotHistory.length>=this.options.maxHistory&&this.screenshotHistory.shift(),this.screenshotHistory.push(t);t.split(",")[1];this.options.silentMode;const n=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),i=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4;return this.options.compress&&!n&&!i&&this.worker&&(this.options.silentMode,this.worker.postMessage({type:"COMPRESS_IMAGE",data:{dataUrl:t,maxWidth:this.options.maxWidth,maxHeight:this.options.maxHeight,quality:this.options.quality,outputFormat:this.options.outputFormat,timestamp:e,count:this.screenshotCount}})),this.error=null,!0}catch(t){const e=t instanceof Error?t.message:String(t);return e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin")||e.includes("XMLHttpRequest")||e.includes("Status:0")?this.options.silentMode:this.error=e,!1}finally{this.removeGlobalErrorHandlers()}}async takeScreenshotWithModernScreenshot(t){this.options.silentMode;const{width:n,height:i}=this.calculateCompressedSize(t.scrollWidth,t.scrollHeight,this.options.maxWidth,this.options.maxHeight),r=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),a=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4,s=r||a?Math.max(.7*this.options.quality,.3):this.options.quality,c=r?Math.min(n,1280):n,l=r?Math.min(i,720):i,u=async t=>{if(t.startsWith("data:")||t.startsWith("blob:"))return t;try{if(new URL(t,window.location.href).origin===window.location.origin)return t}catch(t){}if(this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){if(this.imageProxyCache.has(t))return this.imageProxyCache.get(t);try{const e=new URLSearchParams({url:t,maxWidth:String(this.options.maxWidth||1600),maxHeight:String(this.options.maxHeight||900),quality:String(Math.round(100*(this.options.quality||.4))),format:this.options.outputFormat||"webp"});let n=this.options.proxyUrl;n=n.replace(/[?&]$/,"");const i=`${n}?${e.toString()}`,o=new AbortController,r=setTimeout(()=>o.abort(),1e4);try{const e=await fetch(i,{method:"GET",mode:"cors",credentials:"omit",headers:{Accept:"image/*"},cache:"no-cache",signal:o.signal});if(clearTimeout(r),!e.ok)throw new Error(`代理请求失败: ${e.status}`);const n=await e.blob(),a=await this.blobToDataUrl(n);return this.imageProxyCache.set(t,a),a}catch(t){throw clearTimeout(r),t}}catch(e){return this.options.silentMode,t}}return this.options.enableCORS,t};if(!this.screenshotContext){const n={workerNumber:r||a?1:2,quality:s,fetchFn:u,fetch:{requestInit:{cache:"no-cache"},bypassingCache:!0}};c&&l&&(n.width=c,n.height=l),1!==this.options.scale&&(n.scale=r?.8:this.options.scale);const i=await async function(){if(o)return o;try{const t=await import("modern-screenshot/worker?url");return o=t.default||t,o}catch{return}}();i&&(n.workerUrl=i),this.screenshotContext=await e.createContext(t,n)}try{const t=await e.domToPng(this.screenshotContext);if("png"!==this.options.outputFormat){const e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("无法获取 canvas context");const i=new Image;await new Promise((o,r)=>{i.onload=()=>{e.width=i.width,e.height=i.height,n.drawImage(i,0,0),o()},i.onerror=r,i.src=t});let o="image/jpeg",a=s;if("webp"===this.options.outputFormat&&!r)try{const t=document.createElement("canvas");t.width=1,t.height=1;-1!==t.toDataURL("image/webp").indexOf("webp")&&(o="image/webp")}catch{o="image/jpeg"}return"image/png"===o?e.toDataURL(o):e.toDataURL(o,a)}return t}catch(t){if(this.screenshotContext){try{e.destroyContext(this.screenshotContext)}catch(t){}this.screenshotContext=null}throw t}}isElementVisible(t,e){if(!this.options.onlyVisibleImages)return!0;try{const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();return!(n.bottom<i.top||n.top>i.bottom||n.right<i.left||n.left>i.right)&&n.width>0&&n.height>0&&"none"!==window.getComputedStyle(t).display&&"hidden"!==window.getComputedStyle(t).visibility&&"0"!==window.getComputedStyle(t).opacity}catch{return!0}}async preprocessNetworkImages(t){const e=t.querySelectorAll("img"),n=Array.from(e).filter(e=>{const n=e.src.startsWith("blob:"),i=e.src.startsWith("data:"),o=e.src.startsWith(window.location.origin),r=this.isElementVisible(e,t);return!n&&!i&&!o&&r});if(0!==n.length){if(!this.options.silentMode){e.length}if(this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){this.options.silentMode;const t=this.options.maxConcurrentDownloads||10,e=[];for(let i=0;i<n.length;i+=t)e.push(n.slice(i,i+t));await Promise.all(e.map(async t=>{await Promise.all(t.map(async t=>{const e=t.src;if(!this.imageProxyCache.has(e))try{const t=await this.proxyImage(e);t&&this.imageProxyCache.set(e,t)}catch(t){this.options.silentMode}}))})),this.options.silentMode}}}async proxyImage(t){if(!this.options.proxyUrl||""===this.options.proxyUrl.trim())throw new Error("proxyUrl 未配置");const e=new URLSearchParams({url:t,maxWidth:String(this.options.maxWidth||1600),maxHeight:String(this.options.maxHeight||900),quality:String(Math.round(100*(this.options.quality||.4))),format:this.options.outputFormat||"webp"});let n=this.options.proxyUrl;n=n.replace(/[?&]$/,"");const i=`${n}?${e.toString()}`;this.options.silentMode;const o=await fetch(i,{method:"GET",mode:"cors",credentials:"omit",headers:{Accept:"image/*"}});if(!o.ok){const t=await o.text().catch(()=>"");throw new Error(`代理请求失败: ${o.status} ${o.statusText}${t?` - ${t.substring(0,200)}`:""}`)}const r=await o.blob(),a=await this.blobToDataUrl(r);return this.options.silentMode,a}blobToDataUrl(t){return new Promise((e,n)=>{const i=new FileReader,o=setTimeout(()=>{n(new Error("图片转换超时"))},1e4);i.onload=()=>{clearTimeout(o),e(i.result)},i.onerror=t=>{clearTimeout(o),n(t)},i.readAsDataURL(t)})}async waitForImagesToLoad(t){const e=t.querySelectorAll("img"),n=[];Array.from(e).forEach(t=>{t.complete||n.push(new Promise(e=>{const n=setTimeout(()=>{e()},5e3);t.onload=()=>{clearTimeout(n),e()},t.onerror=()=>{clearTimeout(n),e()}}))}),n.length>0&&await Promise.all(n)}async waitForStylesAndFonts(){return new Promise(t=>{setTimeout(()=>{t()},100)})}async waitForFonts(){if(!document.fonts)return Promise.resolve();try{await document.fonts.ready,await new Promise(t=>setTimeout(t,100))}catch{}}calculateCompressedSize(t,e,n,i){let o=t,r=e;if(o>n||r>i){const t=n/o,e=i/r,a=Math.min(t,e);o=Math.round(o*a),r=Math.round(r*a)}return{width:o,height:r}}createWorker(){if("undefined"==typeof Worker||"undefined"==typeof OffscreenCanvas)return null;try{const t=new Blob(["\n self.onmessage = function(e) {\n const { type, data } = e.data;\n if (type === 'COMPRESS_IMAGE') {\n // 压缩逻辑(简化版)\n self.postMessage({\n type: 'SCREENSHOT_RESULT',\n data: { compressed: { dataUrl: data.dataUrl } }\n });\n }\n };\n "],{type:"application/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);return n.onmessage=t=>{const{type:e,data:n}=t.data;"SCREENSHOT_RESULT"===e&&n?.compressed&&this.screenshotHistory.length>0&&(this.screenshotHistory[this.screenshotHistory.length-1]=n.compressed.dataUrl)},n.onerror=t=>{},n}catch(t){return null}}setupGlobalErrorHandlers(){this.globalErrorHandler=t=>{const e=t.message||t.error?.message||"";return!(e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin"))||(t.preventDefault(),t.stopPropagation(),!1)},this.globalRejectionHandler=t=>{const e=t.reason?.message||String(t.reason)||"";return!(e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin"))||(t.preventDefault(),!1)},window.addEventListener("error",this.globalErrorHandler,!0),window.addEventListener("unhandledrejection",this.globalRejectionHandler,!0)}removeGlobalErrorHandlers(){this.globalErrorHandler&&(window.removeEventListener("error",this.globalErrorHandler,!0),this.globalErrorHandler=null),this.globalRejectionHandler&&(window.removeEventListener("unhandledrejection",this.globalRejectionHandler,!0),this.globalRejectionHandler=null)}async uploadScreenshot(t,e){try{this.options.silentMode;const n=this.dataUrlToBlob(t,e.contentType),i=await fetch(e.uploadUrl,{method:"PUT",body:n,headers:{"Content-Type":e.contentType}});if(200===i.status||204===i.status)return this.options.silentMode,this.uploadProgress.success++,!0;{const t=await i.text().catch(()=>""),e=`上传失败: HTTP ${i.status} ${i.statusText}${t?` - ${t.substring(0,200)}`:""}`;return this.uploadError=e,this.uploadProgress.failed++,!1}}catch(t){const e=t instanceof Error?t.message:String(t);return this.uploadError=`上传异常: ${e}`,this.uploadProgress.failed++,!1}}dataUrlToBlob(t,e){const n=t.split(","),i=n[0].match(/:(.*?);/),o=i?i[1]:e,r=atob(n[1]);let a=r.length;const s=new Uint8Array(a);for(;a--;)s[a]=r.charCodeAt(a);return new Blob([s],{type:o})}getLatestScreenshot(){return this.screenshotHistory[this.screenshotHistory.length-1]||null}enable(t){this.isEnabled=t,!t&&this.isRunning&&this.stopScreenshot()}destroy(){if(this.stopScreenshot(),this.worker&&(this.worker.terminate(),this.worker=null),this.screenshotContext){try{e.destroyContext(this.screenshotContext)}catch(t){}this.screenshotContext=null}this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.removeGlobalErrorHandlers(),this.imageProxyCache.clear()}getState(){return{isRunning:this.isRunning,screenshotCount:this.screenshotCount,lastScreenshotTime:this.lastScreenshotTime,error:this.error,isEnabled:this.isEnabled,isUploading:this.isUploading,uploadError:this.uploadError,uploadProgress:{...this.uploadProgress},currentUploadConfig:this.currentUploadConfig}}}var a=function(){return a=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)};function s(t,e,n,i){return new(n||(n=Promise))(function(o,r){function a(t){try{c(i.next(t))}catch(t){r(t)}}function s(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((i=i.apply(t,e||[])).next())})}function c(t,e){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&s[0]?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(t){s=[6,t],i=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function l(t,e,n){if(n||2===arguments.length)for(var i,o=0,r=e.length;o<r;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var u="4.6.2";function h(t,e){return new Promise(function(n){return setTimeout(n,t,e)})}function d(t){return!!t&&"function"==typeof t.then}function m(t,e){try{var n=t();d(n)?n.then(function(t){return e(!0,t)},function(t){return e(!1,t)}):e(!0,n)}catch(t){e(!1,t)}}function f(t,e,n){return void 0===n&&(n=16),s(this,void 0,void 0,function(){var i,o,r,a;return c(this,function(s){switch(s.label){case 0:i=Array(t.length),o=Date.now(),r=0,s.label=1;case 1:return r<t.length?(i[r]=e(t[r],r),(a=Date.now())>=o+n?(o=a,[4,new Promise(function(t){var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(null)})]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++r,[3,1];case 4:return[2,i]}})})}function p(t){return t.then(void 0,function(){}),t}function g(t){return parseInt(t)}function v(t){return parseFloat(t)}function y(t,e){return"number"==typeof t&&isNaN(t)?e:t}function b(t){return t.reduce(function(t,e){return t+(e?1:0)},0)}function w(t,e){if(void 0===e&&(e=1),Math.abs(e)>=1)return Math.round(t/e)*e;var n=1/e;return Math.round(t*n)/n}function E(t,e){var n=t[0]>>>16,i=65535&t[0],o=t[1]>>>16,r=65535&t[1],a=e[0]>>>16,s=65535&e[0],c=e[1]>>>16,l=0,u=0,h=0,d=0;h+=(d+=r+(65535&e[1]))>>>16,d&=65535,u+=(h+=o+c)>>>16,h&=65535,l+=(u+=i+s)>>>16,u&=65535,l+=n+a,l&=65535,t[0]=l<<16|u,t[1]=h<<16|d}function x(t,e){var n=t[0]>>>16,i=65535&t[0],o=t[1]>>>16,r=65535&t[1],a=e[0]>>>16,s=65535&e[0],c=e[1]>>>16,l=65535&e[1],u=0,h=0,d=0,m=0;d+=(m+=r*l)>>>16,m&=65535,h+=(d+=o*l)>>>16,d&=65535,h+=(d+=r*c)>>>16,d&=65535,u+=(h+=i*l)>>>16,h&=65535,u+=(h+=o*c)>>>16,h&=65535,u+=(h+=r*s)>>>16,h&=65535,u+=n*l+i*c+o*s+r*a,u&=65535,t[0]=u<<16|h,t[1]=d<<16|m}function S(t,e){var n=t[0];32===(e%=64)?(t[0]=t[1],t[1]=n):e<32?(t[0]=n<<e|t[1]>>>32-e,t[1]=t[1]<<e|n>>>32-e):(e-=32,t[0]=t[1]<<e|n>>>32-e,t[1]=n<<e|t[1]>>>32-e)}function C(t,e){0!==(e%=64)&&(e<32?(t[0]=t[1]>>>32-e,t[1]=t[1]<<e):(t[0]=t[1]<<e-32,t[1]=0))}function L(t,e){t[0]^=e[0],t[1]^=e[1]}var M=[4283543511,3981806797],k=[3301882366,444984403];function I(t){var e=[0,t[0]>>>1];L(t,e),x(t,M),e[1]=t[0]>>>1,L(t,e),x(t,k),e[1]=t[0]>>>1,L(t,e)}var R=[2277735313,289559509],V=[1291169091,658871167],H=[0,5],W=[0,1390208809],P=[0,944331445];function T(t,e){var n=function(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++){var i=t.charCodeAt(n);if(i>127)return(new TextEncoder).encode(t);e[n]=i}return e}(t);e=e||0;var i,o=[0,n.length],r=o[1]%16,a=o[1]-r,s=[0,e],c=[0,e],l=[0,0],u=[0,0];for(i=0;i<a;i+=16)l[0]=n[i+4]|n[i+5]<<8|n[i+6]<<16|n[i+7]<<24,l[1]=n[i]|n[i+1]<<8|n[i+2]<<16|n[i+3]<<24,u[0]=n[i+12]|n[i+13]<<8|n[i+14]<<16|n[i+15]<<24,u[1]=n[i+8]|n[i+9]<<8|n[i+10]<<16|n[i+11]<<24,x(l,R),S(l,31),x(l,V),L(s,l),S(s,27),E(s,c),x(s,H),E(s,W),x(u,V),S(u,33),x(u,R),L(c,u),S(c,31),E(c,s),x(c,H),E(c,P);l[0]=0,l[1]=0,u[0]=0,u[1]=0;var h=[0,0];switch(r){case 15:h[1]=n[i+14],C(h,48),L(u,h);case 14:h[1]=n[i+13],C(h,40),L(u,h);case 13:h[1]=n[i+12],C(h,32),L(u,h);case 12:h[1]=n[i+11],C(h,24),L(u,h);case 11:h[1]=n[i+10],C(h,16),L(u,h);case 10:h[1]=n[i+9],C(h,8),L(u,h);case 9:h[1]=n[i+8],L(u,h),x(u,V),S(u,33),x(u,R),L(c,u);case 8:h[1]=n[i+7],C(h,56),L(l,h);case 7:h[1]=n[i+6],C(h,48),L(l,h);case 6:h[1]=n[i+5],C(h,40),L(l,h);case 5:h[1]=n[i+4],C(h,32),L(l,h);case 4:h[1]=n[i+3],C(h,24),L(l,h);case 3:h[1]=n[i+2],C(h,16),L(l,h);case 2:h[1]=n[i+1],C(h,8),L(l,h);case 1:h[1]=n[i],L(l,h),x(l,R),S(l,31),x(l,V),L(s,l)}return L(s,o),L(c,o),E(s,c),E(c,s),I(s),I(c),E(s,c),E(c,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)}function A(t,e,n,i){var o=Object.keys(t).filter(function(t){return!function(t,e){for(var n=0,i=t.length;n<i;++n)if(t[n]===e)return!0;return!1}(n,t)}),r=p(f(o,function(n){return function(t,e){var n=p(new Promise(function(n){var i=Date.now();m(t.bind(null,e),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var o=Date.now()-i;if(!t[0])return n(function(){return{error:t[1],duration:o}});var r=t[1];if(function(t){return"function"!=typeof t}(r))return n(function(){return{value:r,duration:o}});n(function(){return new Promise(function(t){var e=Date.now();m(r,function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var r=o+Date.now()-e;if(!n[0])return t({error:n[1],duration:r});t({value:n[1],duration:r})})})})})}));return function(){return n.then(function(t){return t()})}}(t[n],e)},i));return function(){return s(this,void 0,void 0,function(){var t,e,n,a;return c(this,function(s){switch(s.label){case 0:return[4,r];case 1:return[4,f(s.sent(),function(t){return p(t())},i)];case 2:return t=s.sent(),[4,Promise.all(t)];case 3:for(e=s.sent(),n={},a=0;a<o.length;++a)n[o[a]]=e[a];return[2,n]}})})}}function F(){var t=window,e=navigator;return b(["MSCSSMatrix"in t,"msSetImmediate"in t,"msIndexedDB"in t,"msMaxTouchPoints"in e,"msPointerEnabled"in e])>=4}function Z(){var t=window,e=navigator;return b(["webkitPersistentStorage"in e,"webkitTemporaryStorage"in e,0===(e.vendor||"").indexOf("Google"),"webkitResolveLocalFileSystemURL"in t,"BatteryManager"in t,"webkitMediaStream"in t,"webkitSpeechGrammar"in t])>=5}function j(){var t=window;return b(["ApplePayError"in t,"CSSPrimitiveValue"in t,"Counter"in t,0===navigator.vendor.indexOf("Apple"),"RGBColor"in t,"WebKitMediaKeys"in t])>=4}function G(){var t=window,e=t.HTMLElement,n=t.Document;return b(["safari"in t,!("ongestureend"in t),!("TouchEvent"in t),!("orientation"in t),e&&!("autocapitalize"in e.prototype),n&&"pointerLockElement"in n.prototype])>=4}function D(){var t,e=window;return t=e.print,/^function\s.*?\{\s*\[native code]\s*}$/.test(String(t))&&"[object WebPageNamespace]"===String(e.browser)}function X(){var t,e,n=window;return b(["buildID"in navigator,"MozAppearance"in(null!==(e=null===(t=document.documentElement)||void 0===t?void 0:t.style)&&void 0!==e?e:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function Y(){var t=window,e=navigator,n=t.CSS,i=t.HTMLButtonElement;return b([!("getStorageUpdates"in e),i&&"popover"in i.prototype,"CSSCounterStyleRule"in t,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function O(){var t=document;return(t.exitFullscreen||t.msExitFullscreen||t.mozCancelFullScreen||t.webkitExitFullscreen).call(t)}function N(){var t=Z(),e=X(),n=window,i=navigator,o="connection";return t?b([!("SharedWorker"in n),i[o]&&"ontypechange"in i[o],!("sinkId"in new Audio)])>=2:!!e&&b(["onorientationchange"in n,"orientation"in n,/android/i.test(i.appVersion)])>=2}function U(t){var e=new Error(t);return e.name=t,e}function B(t,e,n){var i,o,r;return void 0===n&&(n=50),s(this,void 0,void 0,function(){var a,s;return c(this,function(c){switch(c.label){case 0:a=document,c.label=1;case 1:return a.body?[3,3]:[4,h(n)];case 2:return c.sent(),[3,1];case 3:s=a.createElement("iframe"),c.label=4;case 4:return c.trys.push([4,,10,11]),[4,new Promise(function(t,n){var i=!1,o=function(){i=!0,t()};s.onload=o,s.onerror=function(t){i=!0,n(t)};var r=s.style;r.setProperty("display","block","important"),r.position="absolute",r.top="0",r.left="0",r.visibility="hidden",e&&"srcdoc"in s?s.srcdoc=e:s.src="about:blank",a.body.appendChild(s);var c=function(){var t,e;i||("complete"===(null===(e=null===(t=s.contentWindow)||void 0===t?void 0:t.document)||void 0===e?void 0:e.readyState)?o():setTimeout(c,10))};c()})];case 5:c.sent(),c.label=6;case 6:return(null===(o=null===(i=s.contentWindow)||void 0===i?void 0:i.document)||void 0===o?void 0:o.body)?[3,8]:[4,h(n)];case 7:return c.sent(),[3,6];case 8:return[4,t(s,s.contentWindow)];case 9:return[2,c.sent()];case 10:return null===(r=s.parentNode)||void 0===r||r.removeChild(s),[7];case 11:return[2]}})})}function J(t){for(var e=function(t){for(var e,n,i="Unexpected syntax '".concat(t,"'"),o=/^\s*([a-z-]*)(.*)$/i.exec(t),r=o[1]||void 0,a={},s=/([.:#][\w-]+|\[.+?\])/gi,c=function(t,e){a[t]=a[t]||[],a[t].push(e)};;){var l=s.exec(o[2]);if(!l)break;var u=l[0];switch(u[0]){case".":c("class",u.slice(1));break;case"#":c("id",u.slice(1));break;case"[":var h=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(!h)throw new Error(i);c(h[1],null!==(n=null!==(e=h[4])&&void 0!==e?e:h[5])&&void 0!==n?n:"");break;default:throw new Error(i)}}return[r,a]}(t),n=e[0],i=e[1],o=document.createElement(null!=n?n:"div"),r=0,a=Object.keys(i);r<a.length;r++){var s=a[r],c=i[s].join(" ");"style"===s?z(o.style,c):o.setAttribute(s,c)}return o}function z(t,e){for(var n=0,i=e.split(";");n<i.length;n++){var o=i[n],r=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(o);if(r){var a=r[1],s=r[2],c=r[4];t.setProperty(a,s,c||"")}}}var Q=["monospace","sans-serif","serif"],K=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function q(t){return t.toDataURL()}var _,$;function tt(){var t=this;return function(){if(void 0===$){var t=function(){var e=et();nt(e)?$=setTimeout(t,2500):(_=e,$=void 0)};t()}}(),function(){return s(t,void 0,void 0,function(){var t;return c(this,function(e){switch(e.label){case 0:return nt(t=et())?_?[2,l([],_,!0)]:(n=document).fullscreenElement||n.msFullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement?[4,O()]:[3,2]:[3,2];case 1:e.sent(),t=et(),e.label=2;case 2:return nt(t)||(_=t),[2,t]}var n})})}}function et(){var t=screen;return[y(v(t.availTop),null),y(v(t.width)-v(t.availWidth)-y(v(t.availLeft),0),null),y(v(t.height)-v(t.availHeight)-y(v(t.availTop),0),null),y(v(t.availLeft),null)]}function nt(t){for(var e=0;e<4;++e)if(t[e])return!1;return!0}function it(t){var e;return s(this,void 0,void 0,function(){var n,i,o,r,a,s,l;return c(this,function(c){switch(c.label){case 0:for(n=document,i=n.createElement("div"),o=new Array(t.length),r={},ot(i),l=0;l<t.length;++l)"DIALOG"===(a=J(t[l])).tagName&&a.show(),ot(s=n.createElement("div")),s.appendChild(a),i.appendChild(s),o[l]=a;c.label=1;case 1:return n.body?[3,3]:[4,h(50)];case 2:return c.sent(),[3,1];case 3:n.body.appendChild(i);try{for(l=0;l<t.length;++l)o[l].offsetParent||(r[t[l]]=!0)}finally{null===(e=i.parentNode)||void 0===e||e.removeChild(i)}return[2,r]}})})}function ot(t){t.style.setProperty("visibility","hidden","important"),t.style.setProperty("display","block","important")}function rt(t){return matchMedia("(inverted-colors: ".concat(t,")")).matches}function at(t){return matchMedia("(forced-colors: ".concat(t,")")).matches}function st(t){return matchMedia("(prefers-contrast: ".concat(t,")")).matches}function ct(t){return matchMedia("(prefers-reduced-motion: ".concat(t,")")).matches}function lt(t){return matchMedia("(prefers-reduced-transparency: ".concat(t,")")).matches}function ut(t){return matchMedia("(dynamic-range: ".concat(t,")")).matches}var ht=Math,dt=function(){return 0};var mt={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};var ft=function(){for(var t=window;;){var e=t.parent;if(!e||e===t)return!1;try{if(e.location.origin!==t.location.origin)return!0}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return!0;throw t}t=e}};var pt=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),gt=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),vt=["FRAGMENT_SHADER","VERTEX_SHADER"],yt=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],bt="WEBGL_debug_renderer_info";function wt(t){if(t.webgl)return t.webgl.context;var e,n=document.createElement("canvas");n.addEventListener("webglCreateContextError",function(){return e=void 0});for(var i=0,o=["webgl","experimental-webgl"];i<o.length;i++){var r=o[i];try{e=n.getContext(r)}catch(t){}if(e)break}return t.webgl={context:e},e}function Et(t,e,n){var i=t.getShaderPrecisionFormat(t[e],t[n]);return i?[i.rangeMin,i.rangeMax,i.precision]:[]}function xt(t){return Object.keys(t.__proto__).filter(St)}function St(t){return"string"==typeof t&&!t.match(/[^A-Z0-9_x]/)}function Ct(){return X()}function Lt(){return Z()||j()}function Mt(t){return"function"==typeof t.getParameter}var kt={fonts:function(){var t=this;return B(function(e,n){var i=n.document;return s(t,void 0,void 0,function(){var t,e,n,o,r,a,s,l,u,h,d;return c(this,function(c){for((t=i.body).style.fontSize="48px",(e=i.createElement("div")).style.setProperty("visibility","hidden","important"),n={},o={},r=function(t){var n=i.createElement("span"),o=n.style;return o.position="absolute",o.top="0",o.left="0",o.fontFamily=t,n.textContent="mmMwWLliI0O&1",e.appendChild(n),n},a=function(t,e){return r("'".concat(t,"',").concat(e))},s=function(){for(var t={},e=function(e){t[e]=Q.map(function(t){return a(e,t)})},n=0,i=K;n<i.length;n++){e(i[n])}return t},l=function(t){return Q.some(function(e,i){return t[i].offsetWidth!==n[e]||t[i].offsetHeight!==o[e]})},u=function(){return Q.map(r)}(),h=s(),t.appendChild(e),d=0;d<Q.length;d++)n[Q[d]]=u[d].offsetWidth,o[Q[d]]=u[d].offsetHeight;return[2,K.filter(function(t){return l(h[t])})]})})})},domBlockers:function(t){var e=(void 0===t?{}:t).debug;return s(this,void 0,void 0,function(){var t,n,i,o,r;return c(this,function(a){switch(a.label){case 0:return j()||N()?(s=atob,t={abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',s("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",s("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",s("LnNwb25zb3JpdA=="),".ylamainos",s("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",s("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",s("LmhlYWRlci1ibG9ja2VkLWFk"),s("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",s("I2FkXzMwMFgyNTA="),s("I2Jhbm5lcmZsb2F0MjI="),s("I2NhbXBhaWduLWJhbm5lcg=="),s("I0FkLUNvbnRlbnQ=")],adGuardChinese:[s("LlppX2FkX2FfSA=="),s("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",s("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),s("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",s("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",s("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",s("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),s("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),s("LmFkZ29vZ2xl"),s("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[s("YW1wLWF1dG8tYWRz"),s("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",s("I2FkX2ludmlld19hcmVh")],adGuardRussian:[s("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),s("LnJlY2xhbWE="),'div[id^="smi2adblock"]',s("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[s("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),s("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",s("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),s("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),s("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",s("I3Jla2xhbWk="),s("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),s("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),s("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[s("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",s("LndpZGdldF9wb19hZHNfd2lkZ2V0"),s("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",s("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[s("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),s("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",s("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",s("I3Jla2xhbW5pLWJveA=="),s("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",s("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[s("I2FkdmVydGVudGll"),s("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",s("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",s("LnNwb25zb3JsaW5rZ3J1ZW4="),s("I3dlcmJ1bmdza3k="),s("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),s("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[s("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",s("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[s("LnJla2xhbW9zX3RhcnBhcw=="),s("LnJla2xhbW9zX251b3JvZG9z"),s("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),s("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),s("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[s("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[s("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),s("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",s("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[s("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),s("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),s("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",s("LmFkX19tYWlu"),s("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[s("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[s("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),s("I2xpdmVyZUFkV3JhcHBlcg=="),s("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),s("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[s("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",s("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),s("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),s("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[s("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),s("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),s("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",s("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),s("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),s("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),s("ZGl2I3NrYXBpZWNfYWQ=")],ro:[s("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),s("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[s("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),s("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),s("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",s("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),s("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",s("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]},n=Object.keys(t),[4,it((r=[]).concat.apply(r,n.map(function(e){return t[e]})))]):[2,void 0];case 1:return i=a.sent(),e&&function(t,e){for(var n=0,i=Object.keys(t);n<i.length;n++){var o=i[n];"\n".concat(o,":");for(var r=0,a=t[o];r<a.length;r++){var s=a[r];"\n ".concat(e[s]?"🚫":"➡️"," ").concat(s)}}}(t,i),(o=n.filter(function(e){var n=t[e];return b(n.map(function(t){return i[t]}))>.6*n.length})).sort(),[2,o]}var s})})},fontPreferences:function(){return function(t,e){void 0===e&&(e=4e3);return B(function(n,i){var o=i.document,r=o.body,a=r.style;a.width="".concat(e,"px"),a.webkitTextSizeAdjust=a.textSizeAdjust="none",Z()?r.style.zoom="".concat(1/i.devicePixelRatio):j()&&(r.style.zoom="reset");var s=o.createElement("div");return s.textContent=l([],Array(e/20|0),!0).map(function(){return"word"}).join(" "),r.appendChild(s),t(o,r)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}(function(t,e){for(var n={},i={},o=0,r=Object.keys(mt);o<r.length;o++){var a=r[o],s=mt[a],c=s[0],l=void 0===c?{}:c,u=s[1],h=void 0===u?"mmMwWLliI0fiflO&1":u,d=t.createElement("span");d.textContent=h,d.style.whiteSpace="nowrap";for(var m=0,f=Object.keys(l);m<f.length;m++){var p=f[m],g=l[p];void 0!==g&&(d.style[p]=g)}n[a]=d,e.append(t.createElement("br"),d)}for(var v=0,y=Object.keys(mt);v<y.length;v++){i[a=y[v]]=n[a].getBoundingClientRect().width}return i})},audio:function(){return j()&&Y()&&D()||Z()&&(t=navigator,e=window,n=Audio.prototype,i=e.visualViewport,b(["srLatency"in n,"srChannelCount"in n,"devicePosture"in t,i&&"segments"in i,"getTextInformation"in Image.prototype])>=3)&&function(){var t=window,e=t.URLPattern;return b(["union"in Set.prototype,"Iterator"in t,e&&"hasRegExpGroups"in e.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}()?-4:function(){var t=window,e=t.OfflineAudioContext||t.webkitOfflineAudioContext;if(!e)return-2;if(j()&&!G()&&!function(){var t=window;return b(["DOMRectList"in t,"RTCPeerConnectionIceEvent"in t,"SVGGeometryElement"in t,"ontransitioncancel"in t])>=3}())return-1;var n=4500,i=new e(1,5e3,44100),o=i.createOscillator();o.type="triangle",o.frequency.value=1e4;var r=i.createDynamicsCompressor();r.threshold.value=-50,r.knee.value=40,r.ratio.value=12,r.attack.value=0,r.release.value=.25,o.connect(r),r.connect(i.destination),o.start(0);var a=function(t){var e=3,n=500,i=500,o=5e3,r=function(){},a=new Promise(function(a,s){var c=!1,l=0,u=0;t.oncomplete=function(t){return a(t.renderedBuffer)};var h=function(){setTimeout(function(){return s(U("timeout"))},Math.min(i,u+o-Date.now()))},m=function(){try{var i=t.startRendering();switch(d(i)&&p(i),t.state){case"running":u=Date.now(),c&&h();break;case"suspended":document.hidden||l++,c&&l>=e?s(U("suspended")):setTimeout(m,n)}}catch(t){s(t)}};m(),r=function(){c||(c=!0,u>0&&h())}});return[a,r]}(i),s=a[0],c=a[1],l=p(s.then(function(t){return function(t){for(var e=0,n=0;n<t.length;++n)e+=Math.abs(t[n]);return e}(t.getChannelData(0).subarray(n))},function(t){if("timeout"===t.name||"suspended"===t.name)return-3;throw t}));return function(){return c(),l}}();var t,e,n,i},screenFrame:function(){var t=this;if(j()&&Y()&&D())return function(){return Promise.resolve(void 0)};var e=tt();return function(){return s(t,void 0,void 0,function(){var t,n;return c(this,function(i){switch(i.label){case 0:return[4,e()];case 1:return t=i.sent(),[2,[(n=function(t){return null===t?null:w(t,10)})(t[0]),n(t[1]),n(t[2]),n(t[3])]]}})})}},canvas:function(){return function(t){var e,n,i,o=!1,r=function(){var t=document.createElement("canvas");return t.width=1,t.height=1,[t,t.getContext("2d")]}(),a=r[0],s=r[1];!function(t,e){return!(!e||!t.toDataURL)}(a,s)?n=i="unsupported":(o=function(t){return t.rect(0,0,10,10),t.rect(2,2,6,6),!t.isPointInPath(5,5,"evenodd")}(s),t?n=i="skipped":(e=function(t,e){!function(t,e){t.width=240,t.height=60,e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(100,1,62,20),e.fillStyle="#069",e.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat(String.fromCharCode(55357,56835));e.fillText(n,2,15),e.fillStyle="rgba(102, 204, 0, 0.2)",e.font="18pt Arial",e.fillText(n,4,45)}(t,e);var n=q(t),i=q(t);if(n!==i)return["unstable","unstable"];!function(t,e){t.width=122,t.height=110,e.globalCompositeOperation="multiply";for(var n=0,i=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<i.length;n++){var o=i[n],r=o[0],a=o[1],s=o[2];e.fillStyle=r,e.beginPath(),e.arc(a,s,40,0,2*Math.PI,!0),e.closePath(),e.fill()}e.fillStyle="#f9c",e.arc(60,60,60,0,2*Math.PI,!0),e.arc(60,60,20,0,2*Math.PI,!0),e.fill("evenodd")}(t,e);var o=q(t);return[o,n]}(a,s),n=e[0],i=e[1]));return{winding:o,geometry:n,text:i}}(j()&&Y()&&D())},osCpu:function(){return navigator.oscpu},languages:function(){var t,e=navigator,n=[],i=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(void 0!==i&&n.push([i]),Array.isArray(e.languages))Z()&&b([!("MediaSettingsRange"in(t=window)),"RTCEncodedAudioFrame"in t,""+t.Intl=="[object Intl]",""+t.Reflect=="[object Reflect]"])>=3||n.push(e.languages);else if("string"==typeof e.languages){var o=e.languages;o&&n.push(o.split(","))}return n},colorDepth:function(){return window.screen.colorDepth},deviceMemory:function(){return y(v(navigator.deviceMemory),void 0)},screenResolution:function(){var t,e,n;if(!(j()&&Y()&&D()))return t=screen,(n=[(e=function(t){return y(g(t),null)})(t.width),e(t.height)]).sort().reverse(),n},hardwareConcurrency:function(){return y(g(navigator.hardwareConcurrency),void 0)},timezone:function(){var t,e=null===(t=window.Intl)||void 0===t?void 0:t.DateTimeFormat;if(e){var n=(new e).resolvedOptions().timeZone;if(n)return n}var i,o=(i=(new Date).getFullYear(),-Math.max(v(new Date(i,0,1).getTimezoneOffset()),v(new Date(i,6,1).getTimezoneOffset())));return"UTC".concat(o>=0?"+":"").concat(o)},sessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},localStorage:function(){try{return!!window.localStorage}catch(t){return!0}},indexedDB:function(){var t,e;if(!(F()||(t=window,e=navigator,b(["msWriteProfilerMark"in t,"MSStream"in t,"msLaunchUri"in e,"msSaveBlob"in e])>=3&&!F())))try{return!!window.indexedDB}catch(t){return!0}},openDatabase:function(){return!!window.openDatabase},cpuClass:function(){return navigator.cpuClass},platform:function(){var t=navigator.platform;return"MacIntel"===t&&j()&&!G()?function(){if("iPad"===navigator.platform)return!0;var t=screen,e=t.width/t.height;return b(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,e>.65&&e<1.53])>=2}()?"iPad":"iPhone":t},plugins:function(){var t=navigator.plugins;if(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];if(i){for(var o=[],r=0;r<i.length;++r){var a=i[r];o.push({type:a.type,suffixes:a.suffixes})}e.push({name:i.name,description:i.description,mimeTypes:o})}}return e}},touchSupport:function(){var t,e=navigator,n=0;void 0!==e.maxTouchPoints?n=g(e.maxTouchPoints):void 0!==e.msMaxTouchPoints&&(n=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){t=!1}return{maxTouchPoints:n,touchEvent:t,touchStart:"ontouchstart"in window}},vendor:function(){return navigator.vendor||""},vendorFlavors:function(){for(var t=[],e=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];e<n.length;e++){var i=n[e],o=window[i];o&&"object"==typeof o&&t.push(i)}return t.sort()},cookiesEnabled:function(){var t=document;try{t.cookie="cookietest=1; SameSite=Strict;";var e=-1!==t.cookie.indexOf("cookietest=");return t.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(t){return!1}},colorGamut:function(){for(var t=0,e=["rec2020","p3","srgb"];t<e.length;t++){var n=e[t];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}},invertedColors:function(){return!!rt("inverted")||!rt("none")&&void 0},forcedColors:function(){return!!at("active")||!at("none")&&void 0},monochrome:function(){if(matchMedia("(min-monochrome: 0)").matches){for(var t=0;t<=100;++t)if(matchMedia("(max-monochrome: ".concat(t,")")).matches)return t;throw new Error("Too high value")}},contrast:function(){return st("no-preference")?0:st("high")||st("more")?1:st("low")||st("less")?-1:st("forced")?10:void 0},reducedMotion:function(){return!!ct("reduce")||!ct("no-preference")&&void 0},reducedTransparency:function(){return!!lt("reduce")||!lt("no-preference")&&void 0},hdr:function(){return!!ut("high")||!ut("standard")&&void 0},math:function(){var t,e=ht.acos||dt,n=ht.acosh||dt,i=ht.asin||dt,o=ht.asinh||dt,r=ht.atanh||dt,a=ht.atan||dt,s=ht.sin||dt,c=ht.sinh||dt,l=ht.cos||dt,u=ht.cosh||dt,h=ht.tan||dt,d=ht.tanh||dt,m=ht.exp||dt,f=ht.expm1||dt,p=ht.log1p||dt;return{acos:e(.12312423423423424),acosh:n(1e308),acoshPf:(t=1e154,ht.log(t+ht.sqrt(t*t-1))),asin:i(.12312423423423424),asinh:o(1),asinhPf:function(t){return ht.log(t+ht.sqrt(t*t+1))}(1),atanh:r(.5),atanhPf:function(t){return ht.log((1+t)/(1-t))/2}(.5),atan:a(.5),sin:s(-1e300),sinh:c(1),sinhPf:function(t){return ht.exp(t)-1/ht.exp(t)/2}(1),cos:l(10.000000000123),cosh:u(1),coshPf:function(t){return(ht.exp(t)+1/ht.exp(t))/2}(1),tan:h(-1e300),tanh:d(1),tanhPf:function(t){return(ht.exp(2*t)-1)/(ht.exp(2*t)+1)}(1),exp:m(1),expm1:f(1),expm1Pf:function(t){return ht.exp(t)-1}(1),log1p:p(10),log1pPf:function(t){return ht.log(1+t)}(10),powPI:function(t){return ht.pow(ht.PI,t)}(-100)}},pdfViewerEnabled:function(){return navigator.pdfViewerEnabled},architecture:function(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=1/0,t[0]=t[0]-t[0],e[3]},applePay:function(){var t=window.ApplePaySession;if("function"!=typeof(null==t?void 0:t.canMakePayments))return-1;if(ft())return-3;try{return t.canMakePayments()?1:0}catch(t){return function(t){if(t instanceof Error&&"InvalidAccessError"===t.name&&/\bfrom\b.*\binsecure\b/i.test(t.message))return-2;throw t}(t)}},privateClickMeasurement:function(){var t,e=document.createElement("a"),n=null!==(t=e.attributionSourceId)&&void 0!==t?t:e.attributionsourceid;return void 0===n?void 0:String(n)},audioBaseLatency:function(){if(!(N()||j()))return-2;if(!window.AudioContext)return-1;var t=(new AudioContext).baseLatency;return null==t?-1:isFinite(t)?t:-3},dateTimeLocale:function(){if(!window.Intl)return-1;var t=window.Intl.DateTimeFormat;if(!t)return-2;var e=t().resolvedOptions().locale;return e||""===e?e:-3},webGlBasics:function(t){var e,n,i,o,r,a,s=wt(t.cache);if(!s)return-1;if(!Mt(s))return-2;var c=Ct()?null:s.getExtension(bt);return{version:(null===(e=s.getParameter(s.VERSION))||void 0===e?void 0:e.toString())||"",vendor:(null===(n=s.getParameter(s.VENDOR))||void 0===n?void 0:n.toString())||"",vendorUnmasked:c?null===(i=s.getParameter(c.UNMASKED_VENDOR_WEBGL))||void 0===i?void 0:i.toString():"",renderer:(null===(o=s.getParameter(s.RENDERER))||void 0===o?void 0:o.toString())||"",rendererUnmasked:c?null===(r=s.getParameter(c.UNMASKED_RENDERER_WEBGL))||void 0===r?void 0:r.toString():"",shadingLanguageVersion:(null===(a=s.getParameter(s.SHADING_LANGUAGE_VERSION))||void 0===a?void 0:a.toString())||""}},webGlExtensions:function(t){var e=wt(t.cache);if(!e)return-1;if(!Mt(e))return-2;var n=e.getSupportedExtensions(),i=e.getContextAttributes(),o=[],r=[],a=[],s=[],c=[];if(i)for(var l=0,u=Object.keys(i);l<u.length;l++){var h=u[l];r.push("".concat(h,"=").concat(i[h]))}for(var d=0,m=xt(e);d<m.length;d++){var f=e[E=m[d]];a.push("".concat(E,"=").concat(f).concat(pt.has(f)?"=".concat(e.getParameter(f)):""))}if(n)for(var p=0,g=n;p<g.length;p++){var v=g[p];if(!(v===bt&&Ct()||"WEBGL_polygon_mode"===v&&Lt())){var y=e.getExtension(v);if(y)for(var b=0,w=xt(y);b<w.length;b++){var E;f=y[E=w[b]];s.push("".concat(E,"=").concat(f).concat(gt.has(f)?"=".concat(e.getParameter(f)):""))}else o.push(v)}}for(var x=0,S=vt;x<S.length;x++)for(var C=S[x],L=0,M=yt;L<M.length;L++){var k=M[L],I=Et(e,C,k);c.push("".concat(C,".").concat(k,"=").concat(I.join(",")))}return s.sort(),a.sort(),{contextAttributes:r,parameters:a,shaderPrecisions:c,extensions:n,extensionParameters:s,unsupportedExtensions:o}}};function It(t){var e=function(t){if(N())return.4;if(j())return!G()||Y()&&D()?.3:.5;var e="value"in t.platform?t.platform.value:"";if(/^Win/.test(e))return.6;if(/^Mac/.test(e))return.5;return.7}(t),n=function(t){return w(.99+.01*t,1e-4)}(e);return{score:e,comment:"$ if upgrade to Pro: https://fpjs.dev/pro".replace(/\$/g,"".concat(n))}}function Rt(t){return T(function(t){for(var e="",n=0,i=Object.keys(t).sort();n<i.length;n++){var o=i[n],r=t[o],a="error"in r?"error":JSON.stringify(r.value);e+="".concat(e?"|":"").concat(o.replace(/([:|\\])/g,"\\$1"),":").concat(a)}return e}(t))}function Vt(t){return void 0===t&&(t=50),function(t,e){void 0===e&&(e=1/0);var n=window.requestIdleCallback;return n?new Promise(function(t){return n.call(window,function(){return t()},{timeout:e})}):h(Math.min(t,e))}(t,2*t)}function Ht(t,e){Date.now();return{get:function(n){return s(this,void 0,void 0,function(){var i,o;return c(this,function(r){switch(r.label){case 0:return Date.now(),[4,t()];case 1:return i=r.sent(),o=function(t){var e,n=It(t);return{get visitorId(){return void 0===e&&(e=Rt(this.components)),e},set visitorId(t){e=t},confidence:n,components:t,version:u}}(i),e||null==n||n.debug,[2,o]}})})}}}var Wt={load:function(t){var e;return void 0===t&&(t={}),s(this,void 0,void 0,function(){var n,i,o;return c(this,function(r){switch(r.label){case 0:return(null===(e=t.monitoring)||void 0===e||e)&&function(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var t=new XMLHttpRequest;t.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(u,"/npm-monitoring"),!0),t.send()}catch(t){}}(),n=t.delayFallback,i=t.debug,[4,Vt(n)];case 1:return r.sent(),o=function(t){return A(kt,t,[])}({cache:{},debug:i}),[2,Ht(o,i)]}})})},hashComponents:Rt,componentsToDebugString:function(t){return JSON.stringify(t,function(t,e){return e instanceof Error?a({name:(n=e).name,message:n.message,stack:null===(i=n.stack)||void 0===i?void 0:i.split("\n")},n):e;var n,i},2)}};class Pt{constructor(){this.iconManager=null,this.iframeManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1}async init(t,e){if(!this.isInitialized){this.config=t;try{const o=await this.getDeviceId(),a=this.buildIframeUrl(t,o),s=e?.iconPosition||void 0;if(this.iconManager=new n(s),await this.iconManager.show(),this.iframeManager=new i({src:a,mode:"auto",width:400,height:600,allowClose:!0,onMessage:(t,e)=>{"new-message"===t&&this.showNotification(0,{pulse:!0})},onClose:()=>{this.iconManager?.forceCleanupDragEvents()},...e}),await this.iframeManager.init(),this.iconManager.onClick(()=>{this.clearNotification(),this.iframeManager?.show()}),t.screenshot){const e=document.body;this.screenshotManager=new r(e,t.screenshot)}this.isInitialized=!0}catch(t){throw t}}}showIcon(){this.iconManager?.show()}hideIcon(){this.iconManager?.hide()}setIconPosition(t){this.iconManager?.setPosition(t)}setIconCoordinates(t){this.iconManager?.setIconPosition(t)}setIconStyle(t){this.iconManager?.setStyle(t)}openChat(){this.clearNotification(),this.iframeManager?.open()}closeChat(){this.iconManager?.forceCleanupDragEvents(),this.iframeManager?.close()}isChatOpen(){return this.iframeManager?.isIframeOpen()||!1}sendToIframe(t){this.iframeManager?.sendToIframe(t)}getConnectionStatus(){return this.isInitialized}showNotification(t=1,e={}){this.iconManager&&(this.iconManager.showNotification({badgeCount:"string"==typeof t?0:t,badgeText:"string"==typeof t?t:"",pulse:e.pulse||!1}),e.autoHide&&e.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},e.autoHide))}clearNotification(){this.iconManager?.clearNotification()}setScreenshotTarget(t){this.screenshotManager?.setTargetElement(t)}async captureScreenshot(){return!!this.screenshotManager&&await this.screenshotManager.captureOnce()}getScreenshotState(){return this.screenshotManager?.getState()||null}destroy(){this.iconManager?.hide(),this.iframeManager?.close(),this.screenshotManager?.destroy(),this.iconManager=null,this.iframeManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1}async getDeviceId(){try{const t=await Wt.load();return(await t.get()).visitorId}catch(t){return"device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}}buildIframeUrl(t,e){const n=t.iframeUrl;if(!n||""===n.trim())throw new Error("iframeUrl is required but not provided or is empty");const i=new URL(n);return t.agent&&""!==t.agent.trim()&&i.searchParams.set("Agent",t.agent),t.token&&""!==t.token.trim()&&i.searchParams.set("Authorization",t.token),i.searchParams.set("DeviceSign",e),i.searchParams.set("Referrer",document.referrer),i.toString()}}let Tt=null;const At=async(t,e)=>{Tt||(Tt=new Pt),await Tt.init(t,e)},Ft=()=>{if(!Tt)throw new Error("SDK not initialized. Call init() first.");return Tt},Zt=()=>{Ft().showIcon()},jt=()=>{Ft().hideIcon()},Gt=t=>{Ft().setIconPosition(t)},Dt=t=>{Ft().setIconCoordinates(t)},Xt=t=>{Ft().setIconStyle(t)},Yt=()=>{Ft().openChat()},Ot=()=>{Ft().closeChat()},Nt=()=>Ft().isChatOpen(),Ut=t=>{Ft().sendToIframe(t)},Bt=()=>Ft().getConnectionStatus(),Jt=(t=1,e={})=>{Ft().showNotification(t,e)},zt=()=>{Ft().clearNotification()},Qt=()=>{Ft().destroy(),Tt=null},Kt=t=>{Ft().setScreenshotTarget(t)},qt=async()=>{const t=Ft();return await t.captureScreenshot()},_t=()=>Ft().getScreenshotState();var $t={init:At,getInstance:Ft,showIcon:Zt,hideIcon:jt,setIconPosition:Gt,setIconCoordinates:Dt,setIconStyle:Xt,openChat:Yt,closeChat:Ot,isChatOpen:Nt,sendToIframe:Ut,getConnectionStatus:Bt,showNotification:Jt,clearNotification:zt,setScreenshotTarget:Kt,captureScreenshot:qt,getScreenshotState:_t,destroy:Qt};t.CustomerServiceSDK=Pt,t.captureScreenshot=qt,t.clearNotification=zt,t.closeChat=Ot,t.default=$t,t.destroy=Qt,t.getConnectionStatus=Bt,t.getInstance=Ft,t.getScreenshotState=_t,t.hideIcon=jt,t.init=At,t.isChatOpen=Nt,t.openChat=Yt,t.sendToIframe=Ut,t.setIconCoordinates=Dt,t.setIconPosition=Gt,t.setIconStyle=Xt,t.setScreenshotTarget=Kt,t.showIcon=Zt,t.showNotification=Jt,Object.defineProperty(t,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("modern-screenshot"),require("@zumer/snapdom")):"function"==typeof define&&define.amd?define(["exports","modern-screenshot","@zumer/snapdom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CustomerSDK={},e.modernScreenshot,e.snapdom)}(this,function(e,t,n){"use strict";class i{constructor(e){this.iconElement=null,this.badgeElement=null,this.onClickCallback=null,this.notificationCallback=null,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.iconStartX=0,this.iconStartY=0,this.dragMoveHandler=null,this.dragEndHandler=null,this.iconPosition=null,this.iconPosition=e||null}async show(){if(this.iconElement)return;this.iconElement=document.createElement("div"),this.iconElement.className="customer-sdk-icon";const e={position:"fixed",width:"30px",height:"30px",backgroundColor:"transparent",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:"999999",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",userSelect:"none",transition:"transform 0.2s ease",border:"none",outline:"none",overflow:"visible"};this.iconPosition?(void 0!==this.iconPosition.x?(e.left="number"==typeof this.iconPosition.x?`${this.iconPosition.x}px`:this.iconPosition.x,e.right="auto"):e.right="20px",void 0!==this.iconPosition.y?(e.top="number"==typeof this.iconPosition.y?`${this.iconPosition.y}px`:this.iconPosition.y,e.bottom="auto"):e.bottom="80px"):(e.bottom="80px",e.right="20px"),Object.assign(this.iconElement.style,e);const t=document.createElement("img");t.src="data:image/png;base64,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",t.style.width="100%",t.style.height="100%",t.style.objectFit="cover",t.style.display="block",t.alt="Customer Service",t.onload=()=>{this.iconElement&&(t.style.opacity="1",t.style.visibility="visible")},t.onerror=e=>{},t.style.opacity="1",t.style.visibility="visible";const n=document.createElement("div");Object.assign(n.style,{width:"100%",height:"100%",borderRadius:"50%",overflow:"hidden",position:"relative"}),n.appendChild(t),this.iconElement.appendChild(n),this.setupDragEvents(),document.body.appendChild(this.iconElement)}forceCleanupDragEvents(){if(this.dragMoveHandler)try{document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)}catch(e){}if(this.dragEndHandler)try{document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)}catch(e){}this.isDragging=!1,this.iconElement&&(this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer")}hide(){this.forceCleanupDragEvents(),this.iconElement&&(this.iconElement.remove(),this.iconElement=null,this.onClickCallback=null,this.dragMoveHandler=null,this.dragEndHandler=null)}setPosition(e){}setIconPosition(e){if(this.iconPosition=e,this.iconElement){void 0!==e.x&&(this.iconElement.style.left="number"==typeof e.x?`${e.x}px`:e.x,this.iconElement.style.right="auto"),void 0!==e.y&&(this.iconElement.style.top="number"==typeof e.y?`${e.y}px`:e.y,this.iconElement.style.bottom="auto");const t=this.iconElement.getBoundingClientRect();this.iconStartX=t.left,this.iconStartY=t.top}}setStyle(e){}onClick(e){this.onClickCallback=e}onNotification(e){this.notificationCallback=e}showNotification(e){if(!this.iconElement)return;const{showBadge:t=!0,badgeCount:n=0,badgeText:i="",pulse:o=!1}=e;(t||n>0)&&this.createBadge(n,i,o),this.notificationCallback&&this.notificationCallback({badgeCount:n,badgeText:i,pulse:o})}clearNotification(){this.badgeElement&&(this.badgeElement.remove(),this.badgeElement=null)}setupDragEvents(){this.iconElement&&(this.dragMoveHandler=this.handleDragMove.bind(this),this.dragEndHandler=this.handleDragEnd.bind(this),this.iconElement.addEventListener("mousedown",this.handleDragStart.bind(this)),this.iconElement.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!1}))}handleDragStart(e){if(!this.iconElement)return;if(e.target!==this.iconElement&&!this.iconElement.contains(e.target))return;e.preventDefault(),e.stopPropagation();const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;this.isDragging=!1,this.dragStartX=t,this.dragStartY=n;const i=this.iconElement.getBoundingClientRect();this.iconStartX=i.left,this.iconStartY=i.top,this.iconElement.style.transition="none",this.iconElement.style.cursor="grabbing";const o=e=>{const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY,i=t-this.dragStartX,r=n-this.dragStartY;(Math.abs(i)>5||Math.abs(r)>5)&&(this.isDragging=!0,"touches"in e?document.removeEventListener("touchmove",o):document.removeEventListener("mousemove",o),this.dragMoveHandler&&this.dragEndHandler&&("touches"in e?(document.addEventListener("touchmove",this.dragMoveHandler,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",this.dragMoveHandler),document.addEventListener("mouseup",this.dragEndHandler))))};"touches"in e?(document.addEventListener("touchmove",o,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",o),document.addEventListener("mouseup",this.dragEndHandler))}handleDragMove(e){if(!this.iconElement||!this.isDragging)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY,i=e.target;if(i&&i!==this.iconElement&&!this.iconElement.contains(i)){if("IFRAME"===i.tagName||i.closest("iframe")||i.closest(".customer-sdk-container")||i.closest(".customer-sdk-overlay"))return void this.handleDragEnd()}const o=t-this.dragStartX,r=n-this.dragStartY,a=this.iconElement.getBoundingClientRect(),s=a.left+a.width/2,c=a.top+a.height/2;if(Math.sqrt(Math.pow(t-s,2)+Math.pow(n-c,2))>3*Math.max(a.width,a.height))return void this.handleDragEnd();e.preventDefault(),e.stopPropagation();const l=this.iconStartX+o,h=this.iconStartY+r,d=window.innerWidth-this.iconElement.offsetWidth,u=window.innerHeight-this.iconElement.offsetHeight,m=Math.max(0,Math.min(l,d)),p=Math.max(0,Math.min(h,u));this.iconElement.style.left=`${m}px`,this.iconElement.style.top=`${p}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto"}handleDragEnd(e){this.iconElement&&(this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)),this.dragEndHandler&&(document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)),this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer",this.isDragging||this.handleClick(),this.isDragging=!1)}handleClick(){this.onClickCallback&&this.onClickCallback()}createBadge(e,t="",n=!1){this.clearNotification(),this.badgeElement=document.createElement("div"),this.badgeElement.className="customer-sdk-icon-badge",this.badgeElement.textContent=e>0?e>99?"99+":e.toString():t||"",Object.assign(this.badgeElement.style,{position:"absolute",top:"-4px",left:"-4px",right:"auto",minWidth:"18px",height:"18px",borderRadius:"50%",backgroundColor:"#ff4444",color:"#ffffff",fontSize:"10px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000001",boxShadow:"0 -1px 4px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15)",...0===e&&""===t&&{width:"12px",height:"12px",minWidth:"12px",top:"-2px",left:"-2px"},...n&&{animation:"sdk-badge-pulse 1.5s infinite"}}),this.iconElement&&this.iconElement.appendChild(this.badgeElement)}}class o{constructor(e={}){this.iframeElement=null,this.overlayElement=null,this.containerElement=null,this.isOpen=!1,this.isCreated=!1,this.config={src:"",mode:"auto",width:400,height:600,allowClose:!0,...e},this.setupMessageListener()}async init(){try{this.createIframe(),this.isCreated=!0}catch(e){throw e}}show(){if(!this.isOpen){if(!this.isCreated)throw new Error("Iframe not initialized. Call init() first.");try{const e="popup"===this.getActualMode();e&&this.createOverlay(),this.containerElement&&(e?(Object.assign(this.containerElement.style,{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",visibility:"visible",opacity:"1",display:"block"}),this.overlayElement?.appendChild(this.containerElement)):(Object.assign(this.containerElement.style,{position:"fixed",visibility:"visible",opacity:"1",display:"block"}),this.preventBodyScroll(!0))),this.isOpen=!0}catch(e){}}}open(){this.show()}hide(){if(!this.isOpen)return;this.containerElement&&Object.assign(this.containerElement.style,{visibility:"hidden",opacity:"0",display:"none"}),this.overlayElement&&(this.overlayElement.remove(),this.overlayElement=null);"fullscreen"===this.getActualMode()&&this.preventBodyScroll(!1),this.isOpen=!1,this.config.onClose&&this.config.onClose()}close(){this.hide()}destroy(){this.hide(),this.containerElement&&(this.containerElement.remove(),this.containerElement=null,this.iframeElement=null),this.isCreated=!1}isIframeOpen(){return this.isOpen}sendToIframe(e){this.iframeElement&&this.iframeElement.contentWindow&&this.iframeElement.contentWindow.postMessage(e,"*")}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.className="customer-sdk-overlay",Object.assign(this.overlayElement.style,{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"999998",display:"flex",alignItems:"center",justifyContent:"center",cursor:this.config.allowClose?"pointer":"default"}),this.config.allowClose&&this.overlayElement.addEventListener("click",e=>{e.target===this.overlayElement&&this.close()}),document.body.appendChild(this.overlayElement)}createIframe(){this.containerElement=document.createElement("div"),this.containerElement.className="customer-sdk-container",this.iframeElement=document.createElement("iframe"),this.iframeElement.className="customer-sdk-iframe",this.iframeElement.src=this.config.src||"",this.iframeElement.frameBorder="0",this.iframeElement.setAttribute("allow",["microphone","camera","geolocation","clipboard-read","clipboard-write","fullscreen","autoplay","encrypted-media"].join("; ")),this.iframeElement.setAttribute("sandbox",["allow-same-origin","allow-scripts","allow-forms","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-storage-access-by-user-activation"].join(" "));const e="popup"===this.getActualMode();this.iframeElement.scrolling=e?"auto":"no";const t={width:e?`${this.config.width}px`:"100%",height:e?`${this.config.height}px`:"100%",maxWidth:e?"450px":"100%",maxHeight:e?"700px":"100%",backgroundColor:"#ffffff",borderRadius:e?"12px":"12px 12px 0 0",boxShadow:e?"0 20px 40px rgba(0, 0, 0, 0.15)":"0 -4px 16px rgba(0, 0, 0, 0.25)",border:"none",position:"fixed",zIndex:"999999",...e?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:"0",left:"0",bottom:"0",right:"0",transform:"none",overflow:"hidden",position:"fixed"},visibility:"hidden",opacity:"0",display:"none"};Object.assign(this.containerElement.style,t);const n={width:"100%",height:"100%",border:"none",borderRadius:"inherit",...e?{}:{overflow:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitScrollbar:"none"}};Object.assign(this.iframeElement.style,n),this.containerElement.appendChild(this.iframeElement),this.iframeElement.addEventListener("load",()=>{e||this.injectMobileStyles()}),document.body.appendChild(this.containerElement)}injectMobileStyles(){if(this.iframeElement)try{const e=this.iframeElement.contentDocument||this.iframeElement.contentWindow?.document;if(e){const t=e.createElement("style");t.textContent="\n /* 移动端iframe全屏样式优化 */\n * {\n -webkit-overflow-scrolling: touch !important;\n }\n \n body, html, #app, .container {\n overflow: auto !important;\n -webkit-overflow-scrolling: touch !important;\n }\n \n /* 隐藏所有滚动条 */\n ::-webkit-scrollbar {\n width: 0px !important;\n height: 0px !important;\n background: transparent !important;\n }\n \n /* Firefox */\n html {\n scrollbar-width: none !important;\n }\n \n /* IE/Edge */\n body {\n -ms-overflow-style: none !important;\n }\n \n /* 确保内容可以滚动 */\n body {\n overflow: auto !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n ",e.head?.appendChild(t)}}catch(e){}}preventBodyScroll(e){if(e){const e=window.scrollY;Object.assign(document.body.style,{position:"fixed",top:`-${e}px`,width:"100%",overflow:"hidden"}),document.body.setAttribute("data-scroll-position",e.toString())}else{const e=parseInt(document.body.getAttribute("data-scroll-position")||"0");Object.assign(document.body.style,{position:"",top:"",width:"",overflow:""}),document.body.removeAttribute("data-scroll-position"),window.scrollTo(0,e)}}isMobileDevice(){return window.innerWidth<=768||/Android|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(navigator.userAgent)}getActualMode(){return"auto"===this.config.mode?this.isMobileDevice()?"fullscreen":"popup":this.config.mode}setupMessageListener(){window.addEventListener("message",e=>{this.config.src&&e.origin!==new URL(this.config.src).origin||this.handleIframeMessage(e.data)},!1)}handleIframeMessage(e){let t;if("string"==typeof e)t=e;else{if(!e||!e.type)return;t=e.type}switch(t){case"iframe_ready":break;case"close_iframe":case"close":this.close();break;case"resize_iframe":case"resize":e.width&&e.height&&this.resizeIframe(e.width,e.height);break;case"new-message":this.config.onMessage&&this.config.onMessage(t,e)}}resizeIframe(e,t){this.iframeElement&&(this.iframeElement.style.width=`${e}px`,this.iframeElement.style.height=`${t}px`)}}class r{constructor(e,t={}){this.targetElement=null,this.isRunning=!1,this.screenshotCount=0,this.screenshotHistory=[],this.lastScreenshotTime=0,this.error=null,this.isEnabled=!1,this.isUploading=!1,this.uploadError=null,this.uploadProgress={success:0,failed:0},this.currentUploadConfig=null,this.worker=null,this.screenshotTimer=null,this.screenshotContext=null,this.messageHandler=null,this.dynamicInterval=null,this.expirationTimer=null,this.imageProxyCache=new Map,this.indexedDBCache=null,this.indexedDBReady=!1,this.intersectionObserver=null,this.visibleElementsCache=new Set,this.preconnected=!1,this.globalErrorHandler=null,this.globalRejectionHandler=null,this.targetElement=e,this.options={interval:t.interval??5e3,quality:t.quality??.4,scale:t.scale??1,maxHistory:t.maxHistory??10,compress:t.compress??!1,maxWidth:t.maxWidth??1600,maxHeight:t.maxHeight??900,outputFormat:t.outputFormat??"webp",enableCORS:t.enableCORS??!0,proxyUrl:t.proxyUrl??"",engine:t.engine??"modern-screenshot",corsMode:t.corsMode??"canvas-proxy",silentMode:t.silentMode??!1,maxRetries:t.maxRetries??2,preloadImages:t.preloadImages??!1,maxConcurrentDownloads:t.maxConcurrentDownloads??10,onlyVisibleImages:t.onlyVisibleImages??!0,imageCacheTTL:t.imageCacheTTL??6e5,useIndexedDB:t.useIndexedDB??!0,usePreconnect:t.usePreconnect??!0,imageLoadTimeout:t.imageLoadTimeout??5e3,useIntersectionObserver:t.useIntersectionObserver??!0,fetchPriority:t.fetchPriority??"high",maxCacheSize:t.maxCacheSize??50,maxCacheAge:t.maxCacheAge??864e5},this.setupMessageListener(),this.setupVisibilityChangeListener(),this.startCacheCleanup(),this.options.usePreconnect&&this.options.proxyUrl&&this.preconnectProxy(),this.options.useIntersectionObserver&&this.options.onlyVisibleImages&&this.initIntersectionObserver(),this.options.useIndexedDB&&this.initIndexedDB().catch(()=>{this.options.silentMode})}setTargetElement(e){if(this.targetElement!==e&&this.screenshotContext){try{t.destroyContext(this.screenshotContext)}catch(e){}this.screenshotContext=null}this.targetElement=e}setupMessageListener(){this.messageHandler||(this.messageHandler=e=>{this.handleIframeMessage(e)},window.addEventListener("message",this.messageHandler))}setupVisibilityChangeListener(){document.addEventListener("visibilitychange",()=>{document.hidden,this.options.silentMode})}handleIframeMessage(e){try{if(!e.data||"checkScreenshot"!==e.data.type)return;this.options.silentMode;const t=this.parseUploadConfig(e.data.data);if(!t)return void(this.uploadError="解析上传配置失败");this.currentUploadConfig=t;const n=Date.now();if(!(t.ttl>0&&t.ttl>n))return this.options.silentMode||t.ttl,this.stopScreenshot(),this.isEnabled=!1,this.currentUploadConfig=null,void(this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null));{this.isEnabled||(this.options.silentMode,this.isEnabled=!0),this.dynamicInterval=t.duration||this.options.interval;const e=t.ttl-n;if(!this.options.silentMode){Math.ceil(e/6e4)}this.takeScreenshotAndUpload(t),this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null),this.expirationTimer=setTimeout(()=>{this.options.silentMode,this.stopScreenshot(),this.isEnabled=!1,this.currentUploadConfig=null,this.expirationTimer=null},e)}}catch(e){this.uploadError=e instanceof Error?e.message:String(e)}}async takeScreenshotAndUpload(e){this.isRunning&&(this.options.silentMode,this.stopScreenshot()),this.startScreenshot(this.dynamicInterval||e.duration||this.options.interval);try{if(await this.takeScreenshot()){await new Promise(e=>setTimeout(e,100));const t=this.getLatestScreenshot();t?(this.isUploading=!0,this.uploadError=null,this.uploadScreenshot(t,e).then(e=>{e&&this.options.silentMode}).catch(e=>{this.uploadError=e instanceof Error?e.message:String(e)}).finally(()=>{this.isUploading=!1})):this.options.silentMode}}catch(e){this.uploadError=e instanceof Error?e.message:String(e)}}parseUploadConfig(e){try{const t="string"==typeof e?e:JSON.stringify(e),n=JSON.parse(t);return n.uploadUrl&&n.contentType?(("number"!=typeof n.duration||n.duration<=0)&&(n.duration=this.options.interval),"number"!=typeof n.ttl&&("number"==typeof n.expirationMinutes&&n.expirationMinutes>0?n.ttl=Date.now()+60*n.expirationMinutes*1e3:n.ttl=0),n):null}catch(e){return null}}startScreenshot(e){if(!this.isEnabled)return;const t=e||this.dynamicInterval||this.options.interval;this.isRunning&&(this.options.silentMode,this.stopScreenshot()),this.options.silentMode,this.isRunning=!0,!this.worker&&this.options.compress&&(this.worker=this.createWorker()),this.screenshotTimer=setInterval(async()=>{if(this.isRunning&&this.isEnabled&&!document.hidden&&(await this.takeScreenshot(),this.currentUploadConfig)){const e=this.getLatestScreenshot();e&&!this.isUploading&&this.uploadScreenshot(e,this.currentUploadConfig).catch(e=>{})}},t)}stopScreenshot(){this.isRunning&&(this.options.silentMode,this.isRunning=!1,this.screenshotTimer&&(clearInterval(this.screenshotTimer),this.screenshotTimer=null))}async captureOnce(){return!!this.isEnabled&&await this.takeScreenshot()}async takeScreenshot(){if(!this.targetElement)return!1;this.setupGlobalErrorHandlers();try{this.options.silentMode,await Promise.all([this.waitForStylesAndFonts(),this.waitForFonts()]);const e=this.options.engine||"modern-screenshot";let t;this.options.silentMode,this.options.preloadImages&&this.options.enableCORS&&"modern-screenshot"===e?(this.cleanExpiredCache(),this.options.useIndexedDB&&await this.cleanIndexedDBCache(),await this.preprocessNetworkImages(this.targetElement),await this.waitForImagesToLoad(this.targetElement)):(this.cleanExpiredCache(),this.options.useIndexedDB&&await this.cleanIndexedDBCache()),await new Promise(e=>setTimeout(e,50)),t="snapdom"===e?await this.takeScreenshotWithSnapdom(this.targetElement):await this.takeScreenshotWithModernScreenshot(this.targetElement);const n=Date.now();this.screenshotCount++,this.lastScreenshotTime=n,this.screenshotHistory.length>=this.options.maxHistory&&this.screenshotHistory.shift(),this.screenshotHistory.push(t);t.split(",")[1];this.options.silentMode;const i=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),o=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4;return this.options.compress&&!i&&!o&&this.worker&&(this.options.silentMode,this.worker.postMessage({type:"COMPRESS_IMAGE",data:{dataUrl:t,maxWidth:this.options.maxWidth,maxHeight:this.options.maxHeight,quality:this.options.quality,outputFormat:this.options.outputFormat,timestamp:n,count:this.screenshotCount}})),this.error=null,!0}catch(e){const t=e instanceof Error?e.message:String(e);return t.includes("CORS")||t.includes("Access-Control-Allow-Origin")||t.includes("cross-origin")||t.includes("XMLHttpRequest")||t.includes("Status:0")?this.options.silentMode:this.error=t,!1}finally{this.removeGlobalErrorHandlers()}}async takeScreenshotWithSnapdom(e){this.options.silentMode;try{const t=e.getBoundingClientRect();if(0===t.width||0===t.height)throw new Error("元素尺寸为 0,无法截图");const i={};if(this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){let e=this.options.proxyUrl.trim();e.includes("?url=")||(e=e.endsWith("?")?e+"url=":e+"?url="),i.useProxy=e,this.options.silentMode}else this.options.silentMode;let o;switch(this.options.outputFormat||"png"){case"jpeg":o=await n.toJpg(e,i);break;case"webp":o=await n.toWebp(e,i);break;default:o=await n.toPng(e,i)}const r=o.src;if(!r||r.length<100)throw new Error("生成的 base64 数据无效或过短");return this.options.silentMode,r}catch(e){const t=e instanceof Error?e.message:String(e);throw("EncodingError"===(e instanceof Error?e.name:"Unknown")||t.includes("cannot be decoded")||t.includes("CORS")||t.includes("cross-origin"))&&this.options.silentMode,e}}async takeScreenshotWithModernScreenshot(e){this.options.silentMode;const{width:n,height:i}=this.calculateCompressedSize(e.scrollWidth,e.scrollHeight,this.options.maxWidth,this.options.maxHeight),o=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),r=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4,a=o||r?Math.max(.7*this.options.quality,.3):this.options.quality,s=o?Math.min(n,1280):n,c=o?Math.min(i,720):i,l=async e=>{if(e.startsWith("data:")||e.startsWith("blob:"))return e;try{if(new URL(e,window.location.href).origin===window.location.origin)return e}catch(e){}if(this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){const t=this.getCachedImage(e);if(t)return this.options.silentMode,t;if(this.options.useIndexedDB){const t=await this.getIndexedDBCache(e);if(t)return this.setCachedImage(e,t),this.options.silentMode,t}try{const t=new URLSearchParams({url:e,maxWidth:String(this.options.maxWidth||1600),maxHeight:String(this.options.maxHeight||900),quality:String(Math.round(100*(this.options.quality||.4))),format:this.options.outputFormat||"webp"});let n=this.options.proxyUrl;n=n.replace(/[?&]$/,"");const i=`${n}?${t.toString()}`,o=new AbortController,r=setTimeout(()=>o.abort(),this.options.imageLoadTimeout);try{const t={method:"GET",mode:"cors",credentials:"omit",headers:{Accept:"image/*"},cache:"no-cache",signal:o.signal};"priority"in t&&(t.priority=this.options.fetchPriority);const n=await fetch(i,t);if(clearTimeout(r),!n.ok)throw new Error(`代理请求失败: ${n.status}`);const a=await n.blob(),s=await this.blobToDataUrl(a);return this.setCachedImage(e,s),this.options.useIndexedDB&&await this.setIndexedDBCache(e,s),s}catch(e){throw clearTimeout(r),e}}catch(t){return this.options.silentMode,e}}return this.options.enableCORS,e};if(!this.screenshotContext){const n={workerNumber:o||r?1:2,quality:a,fetchFn:l,fetch:{requestInit:{cache:"no-cache"},bypassingCache:!0}};s&&c&&(n.width=s,n.height=c),1!==this.options.scale&&(n.scale=o?.8:this.options.scale),this.screenshotContext=await t.createContext(e,n)}try{const e=await t.domToPng(this.screenshotContext);if("png"!==this.options.outputFormat){const t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("无法获取 canvas context");const i=new Image;await new Promise((o,r)=>{i.onload=()=>{t.width=i.width,t.height=i.height,n.drawImage(i,0,0),o()},i.onerror=r,i.src=e});let r="image/jpeg",s=a;if("webp"===this.options.outputFormat&&!o)try{const e=document.createElement("canvas");e.width=1,e.height=1;-1!==e.toDataURL("image/webp").indexOf("webp")&&(r="image/webp")}catch{r="image/jpeg"}return"image/png"===r?t.toDataURL(r):t.toDataURL(r,s)}return e}catch(e){if(this.screenshotContext){try{t.destroyContext(this.screenshotContext)}catch(e){}this.screenshotContext=null}throw e}}preconnectProxy(){if(!this.preconnected&&this.options.proxyUrl)try{const e=new URL(this.options.proxyUrl).origin,t=document.createElement("link");t.rel="preconnect",t.href=e,t.crossOrigin="anonymous",document.head.appendChild(t),this.preconnected=!0,this.options.silentMode}catch(e){}}initIntersectionObserver(){"IntersectionObserver"in window&&(this.intersectionObserver=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting?this.visibleElementsCache.add(e.target):this.visibleElementsCache.delete(e.target)})},{root:null,rootMargin:"50px",threshold:.01}))}async initIndexedDB(){return new Promise((e,t)=>{const n=indexedDB.open("screenshot-cache",1);n.onerror=()=>t(n.error),n.onsuccess=()=>{this.indexedDBCache=n.result,this.indexedDBReady=!0,this.cleanIndexedDBCache().catch(()=>{}),e()},n.onupgradeneeded=e=>{const t=e.target.result;if(!t.objectStoreNames.contains("images")){t.createObjectStore("images",{keyPath:"url"}).createIndex("timestamp","timestamp",{unique:!1})}}})}async getIndexedDBCache(e){if(!this.indexedDBReady||!this.indexedDBCache)return null;try{const t=this.indexedDBCache.transaction(["images"],"readonly"),n=t.objectStore("images").get(e);return new Promise(t=>{n.onsuccess=()=>{const i=n.result;if(i){if(Date.now()-i.timestamp>this.options.maxCacheAge)return this.deleteIndexedDBCache(e),void t(null);t(i.dataUrl)}else t(null)},n.onerror=()=>t(null)})}catch{return null}}async setIndexedDBCache(e,t){if(this.indexedDBReady&&this.indexedDBCache)try{const n=await this.getIndexedDBCacheSize(),i=this.estimateDataUrlSize(t),o=1024*(this.options.maxCacheSize||50)*1024;n+i>o&&await this.cleanIndexedDBCacheBySize(o-i);const r=this.indexedDBCache.transaction(["images"],"readwrite");r.objectStore("images").put({url:e,dataUrl:t,timestamp:Date.now()})}catch{}}estimateDataUrlSize(e){const t=e.split(",")[1]||"";return Math.ceil(.75*t.length)+30}async getIndexedDBCacheSize(){if(!this.indexedDBReady||!this.indexedDBCache)return 0;try{const e=this.indexedDBCache.transaction(["images"],"readonly"),t=e.objectStore("images").getAll();return new Promise(e=>{t.onsuccess=()=>{const n=t.result||[];let i=0;n.forEach(e=>{i+=this.estimateDataUrlSize(e.dataUrl)}),e(i)},t.onerror=()=>e(0)})}catch{return 0}}async cleanIndexedDBCache(){if(this.indexedDBReady&&this.indexedDBCache)try{const e=this.indexedDBCache.transaction(["images"],"readwrite").objectStore("images"),t=e.index("timestamp").getAll();return new Promise(n=>{t.onsuccess=()=>{const i=t.result||[],o=Date.now(),r=[];let a=0;const s=1024*(this.options.maxCacheSize||50)*1024;i.sort((e,t)=>e.timestamp-t.timestamp),i.forEach(e=>{o-e.timestamp>this.options.maxCacheAge?r.push(e.url):a+=this.estimateDataUrlSize(e.dataUrl)});const c=[...r];if(a>s)for(const e of i)if(!r.includes(e.url)&&(a-=this.estimateDataUrlSize(e.dataUrl),c.push(e.url),a<=s))break;c.forEach(t=>{e.delete(t)}),c.length>0&&this.options.silentMode,n()},t.onerror=()=>n()})}catch{}}async cleanIndexedDBCacheBySize(e){if(this.indexedDBReady&&this.indexedDBCache)try{const t=this.indexedDBCache.transaction(["images"],"readwrite").objectStore("images"),n=t.index("timestamp").getAll();return new Promise(i=>{n.onsuccess=()=>{const o=n.result||[];o.sort((e,t)=>e.timestamp-t.timestamp);let r=0;const a=[];if(o.forEach(e=>{r+=this.estimateDataUrlSize(e.dataUrl)}),r>e)for(const t of o){if(r<=e)break;r-=this.estimateDataUrlSize(t.dataUrl),a.push(t.url)}a.forEach(e=>{t.delete(e)}),a.length>0&&this.options.silentMode,i()},n.onerror=()=>i()})}catch{}}async deleteIndexedDBCache(e){if(this.indexedDBReady&&this.indexedDBCache)try{const t=this.indexedDBCache.transaction(["images"],"readwrite");t.objectStore("images").delete(e)}catch{}}isElementVisible(e,t){if(!this.options.onlyVisibleImages)return!0;if(this.options.useIntersectionObserver&&this.intersectionObserver){if(this.visibleElementsCache.has(e))return!0;this.intersectionObserver.observe(e)}try{const n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=!(n.bottom<i.top||n.top>i.bottom||n.right<i.left||n.left>i.right)&&n.width>0&&n.height>0&&"none"!==window.getComputedStyle(e).display&&"hidden"!==window.getComputedStyle(e).visibility&&"0"!==window.getComputedStyle(e).opacity;return this.options.useIntersectionObserver&&this.intersectionObserver&&(o?this.visibleElementsCache.add(e):this.visibleElementsCache.delete(e)),o}catch{return!0}}async preprocessNetworkImages(e){const t=e.querySelectorAll("img"),n=Array.from(t).filter(t=>{const n=t.src.startsWith("blob:"),i=t.src.startsWith("data:"),o=t.src.startsWith(window.location.origin),r=this.isElementVisible(t,e);return!n&&!i&&!o&&r});if(0!==n.length){if(!this.options.silentMode){t.length}if(this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){this.options.silentMode;const e=this.options.maxConcurrentDownloads||10,t=[];for(let i=0;i<n.length;i+=e)t.push(n.slice(i,i+e));await Promise.all(t.map(async e=>{await Promise.all(e.map(async e=>{const t=e.src;if(!this.getCachedImage(t))try{const e=await this.proxyImage(t);e&&this.setCachedImage(t,e)}catch(e){this.options.silentMode}}))})),this.options.silentMode}}}async proxyImage(e){if(!this.options.proxyUrl||""===this.options.proxyUrl.trim())throw new Error("proxyUrl 未配置");const t=new URLSearchParams({url:e,maxWidth:String(this.options.maxWidth||1600),maxHeight:String(this.options.maxHeight||900),quality:String(Math.round(100*(this.options.quality||.4))),format:this.options.outputFormat||"webp"});let n=this.options.proxyUrl;n=n.replace(/[?&]$/,"");const i=`${n}?${t.toString()}`;this.options.silentMode;const o=await fetch(i,{method:"GET",mode:"cors",credentials:"omit",headers:{Accept:"image/*"}});if(!o.ok){const e=await o.text().catch(()=>"");throw new Error(`代理请求失败: ${o.status} ${o.statusText}${e?` - ${e.substring(0,200)}`:""}`)}const r=await o.blob(),a=await this.blobToDataUrl(r);return this.options.silentMode,a}blobToDataUrl(e){return new Promise((t,n)=>{const i=new FileReader,o=setTimeout(()=>{n(new Error("图片转换超时"))},1e4);i.onload=()=>{clearTimeout(o),t(i.result)},i.onerror=e=>{clearTimeout(o),n(e)},i.readAsDataURL(e)})}async waitForImagesToLoad(e){const t=e.querySelectorAll("img"),n=[];Array.from(t).forEach(e=>{if(e.complete)return;const t=this.options.imageLoadTimeout||5e3;n.push(Promise.race([new Promise(t=>{e.onload=()=>t(),e.onerror=()=>t()}),new Promise(e=>{setTimeout(()=>e(),t)})]))}),n.length>0&&await Promise.all(n)}async waitForStylesAndFonts(){return new Promise(e=>{requestAnimationFrame(()=>{setTimeout(()=>{e()},30)})})}async waitForFonts(){if(!document.fonts)return Promise.resolve();try{await document.fonts.ready,await new Promise(e=>setTimeout(e,100))}catch{}}calculateCompressedSize(e,t,n,i){let o=e,r=t;if(o>n||r>i){const e=n/o,t=i/r,a=Math.min(e,t);o=Math.round(o*a),r=Math.round(r*a)}return{width:o,height:r}}createWorker(){if("undefined"==typeof Worker||"undefined"==typeof OffscreenCanvas)return null;try{const e=new Blob(["\n self.onmessage = function(e) {\n const { type, data } = e.data;\n if (type === 'COMPRESS_IMAGE') {\n // 压缩逻辑(简化版)\n self.postMessage({\n type: 'SCREENSHOT_RESULT',\n data: { compressed: { dataUrl: data.dataUrl } }\n });\n }\n };\n "],{type:"application/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return n.onmessage=e=>{const{type:t,data:n}=e.data;"SCREENSHOT_RESULT"===t&&n?.compressed&&this.screenshotHistory.length>0&&(this.screenshotHistory[this.screenshotHistory.length-1]=n.compressed.dataUrl)},n.onerror=e=>{},n}catch(e){return null}}setupGlobalErrorHandlers(){this.globalErrorHandler=e=>{const t=e.message||e.error?.message||"";return!(t.includes("CORS")||t.includes("Access-Control-Allow-Origin")||t.includes("cross-origin"))||(e.preventDefault(),e.stopPropagation(),!1)},this.globalRejectionHandler=e=>{const t=e.reason?.message||String(e.reason)||"";return!(t.includes("CORS")||t.includes("Access-Control-Allow-Origin")||t.includes("cross-origin"))||(e.preventDefault(),!1)},window.addEventListener("error",this.globalErrorHandler,!0),window.addEventListener("unhandledrejection",this.globalRejectionHandler,!0)}removeGlobalErrorHandlers(){this.globalErrorHandler&&(window.removeEventListener("error",this.globalErrorHandler,!0),this.globalErrorHandler=null),this.globalRejectionHandler&&(window.removeEventListener("unhandledrejection",this.globalRejectionHandler,!0),this.globalRejectionHandler=null)}async uploadScreenshot(e,t){try{this.options.silentMode;const n=this.dataUrlToBlob(e,t.contentType),i=await fetch(t.uploadUrl,{method:"PUT",body:n,headers:{"Content-Type":t.contentType}});if(200===i.status||204===i.status)return this.options.silentMode,this.uploadProgress.success++,!0;{const e=await i.text().catch(()=>""),t=`上传失败: HTTP ${i.status} ${i.statusText}${e?` - ${e.substring(0,200)}`:""}`;return this.uploadError=t,this.uploadProgress.failed++,!1}}catch(e){const t=e instanceof Error?e.message:String(e);return this.uploadError=`上传异常: ${t}`,this.uploadProgress.failed++,!1}}dataUrlToBlob(e,t){const n=e.split(","),i=n[0].match(/:(.*?);/),o=i?i[1]:t,r=atob(n[1]);let a=r.length;const s=new Uint8Array(a);for(;a--;)s[a]=r.charCodeAt(a);return new Blob([s],{type:o})}getLatestScreenshot(){return this.screenshotHistory[this.screenshotHistory.length-1]||null}enable(e){this.isEnabled=e,!e&&this.isRunning&&this.stopScreenshot()}destroy(){if(this.stopScreenshot(),this.worker&&(this.worker.terminate(),this.worker=null),this.screenshotContext){try{t.destroyContext(this.screenshotContext)}catch(e){}this.screenshotContext=null}this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.removeGlobalErrorHandlers(),this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null,this.visibleElementsCache.clear()),this.indexedDBCache&&(this.indexedDBCache.close(),this.indexedDBCache=null,this.indexedDBReady=!1),this.imageProxyCache.clear()}getCachedImage(e){const t=this.imageProxyCache.get(e);if(!t)return null;return Date.now()-t.timestamp>this.options.imageCacheTTL?(this.imageProxyCache.delete(e),null):t.dataUrl}setCachedImage(e,t){this.imageProxyCache.set(e,{dataUrl:t,timestamp:Date.now()})}cleanExpiredCache(){const e=Date.now(),t=[];this.imageProxyCache.forEach((n,i)=>{e-n.timestamp>this.options.imageCacheTTL&&t.push(i)}),t.forEach(e=>{this.imageProxyCache.delete(e)}),t.length>0&&this.options.silentMode}startCacheCleanup(){setInterval(()=>{if(this.cleanExpiredCache(),this.options.useIndexedDB&&this.cleanIndexedDBCache().catch(()=>{}),!this.options.silentMode){this.imageProxyCache.size}},3e5)}getState(){return{isRunning:this.isRunning,screenshotCount:this.screenshotCount,lastScreenshotTime:this.lastScreenshotTime,error:this.error,isEnabled:this.isEnabled,isUploading:this.isUploading,uploadError:this.uploadError,uploadProgress:{...this.uploadProgress},currentUploadConfig:this.currentUploadConfig}}}var a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function s(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((i=i.apply(e,t||[])).next())})}function c(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&s[0]?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],i=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var h="4.6.2";function d(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function u(e){return!!e&&"function"==typeof e.then}function m(e,t){try{var n=e();u(n)?n.then(function(e){return t(!0,e)},function(e){return t(!1,e)}):t(!0,n)}catch(e){t(!1,e)}}function p(e,t,n){return void 0===n&&(n=16),s(this,void 0,void 0,function(){var i,o,r,a;return c(this,function(s){switch(s.label){case 0:i=Array(e.length),o=Date.now(),r=0,s.label=1;case 1:return r<e.length?(i[r]=t(e[r],r),(a=Date.now())>=o+n?(o=a,[4,new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++r,[3,1];case 4:return[2,i]}})})}function f(e){return e.then(void 0,function(){}),e}function g(e){return parseInt(e)}function v(e){return parseFloat(e)}function y(e,t){return"number"==typeof e&&isNaN(e)?t:e}function b(e){return e.reduce(function(e,t){return e+(t?1:0)},0)}function w(e,t){if(void 0===t&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function x(e,t){var n=e[0]>>>16,i=65535&e[0],o=e[1]>>>16,r=65535&e[1],a=t[0]>>>16,s=65535&t[0],c=t[1]>>>16,l=0,h=0,d=0,u=0;d+=(u+=r+(65535&t[1]))>>>16,u&=65535,h+=(d+=o+c)>>>16,d&=65535,l+=(h+=i+s)>>>16,h&=65535,l+=n+a,l&=65535,e[0]=l<<16|h,e[1]=d<<16|u}function E(e,t){var n=e[0]>>>16,i=65535&e[0],o=e[1]>>>16,r=65535&e[1],a=t[0]>>>16,s=65535&t[0],c=t[1]>>>16,l=65535&t[1],h=0,d=0,u=0,m=0;u+=(m+=r*l)>>>16,m&=65535,d+=(u+=o*l)>>>16,u&=65535,d+=(u+=r*c)>>>16,u&=65535,h+=(d+=i*l)>>>16,d&=65535,h+=(d+=o*c)>>>16,d&=65535,h+=(d+=r*s)>>>16,d&=65535,h+=n*l+i*c+o*s+r*a,h&=65535,e[0]=h<<16|d,e[1]=u<<16|m}function C(e,t){var n=e[0];32===(t%=64)?(e[0]=e[1],e[1]=n):t<32?(e[0]=n<<t|e[1]>>>32-t,e[1]=e[1]<<t|n>>>32-t):(t-=32,e[0]=e[1]<<t|n>>>32-t,e[1]=n<<t|e[1]>>>32-t)}function S(e,t){0!==(t%=64)&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function L(e,t){e[0]^=t[0],e[1]^=t[1]}var M=[4283543511,3981806797],I=[3301882366,444984403];function k(e){var t=[0,e[0]>>>1];L(e,t),E(e,M),t[1]=e[0]>>>1,L(e,t),E(e,I),t[1]=e[0]>>>1,L(e,t)}var R=[2277735313,289559509],D=[1291169091,658871167],P=[0,5],V=[0,1390208809],W=[0,944331445];function H(e,t){var n=function(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++){var i=e.charCodeAt(n);if(i>127)return(new TextEncoder).encode(e);t[n]=i}return t}(e);t=t||0;var i,o=[0,n.length],r=o[1]%16,a=o[1]-r,s=[0,t],c=[0,t],l=[0,0],h=[0,0];for(i=0;i<a;i+=16)l[0]=n[i+4]|n[i+5]<<8|n[i+6]<<16|n[i+7]<<24,l[1]=n[i]|n[i+1]<<8|n[i+2]<<16|n[i+3]<<24,h[0]=n[i+12]|n[i+13]<<8|n[i+14]<<16|n[i+15]<<24,h[1]=n[i+8]|n[i+9]<<8|n[i+10]<<16|n[i+11]<<24,E(l,R),C(l,31),E(l,D),L(s,l),C(s,27),x(s,c),E(s,P),x(s,V),E(h,D),C(h,33),E(h,R),L(c,h),C(c,31),x(c,s),E(c,P),x(c,W);l[0]=0,l[1]=0,h[0]=0,h[1]=0;var d=[0,0];switch(r){case 15:d[1]=n[i+14],S(d,48),L(h,d);case 14:d[1]=n[i+13],S(d,40),L(h,d);case 13:d[1]=n[i+12],S(d,32),L(h,d);case 12:d[1]=n[i+11],S(d,24),L(h,d);case 11:d[1]=n[i+10],S(d,16),L(h,d);case 10:d[1]=n[i+9],S(d,8),L(h,d);case 9:d[1]=n[i+8],L(h,d),E(h,D),C(h,33),E(h,R),L(c,h);case 8:d[1]=n[i+7],S(d,56),L(l,d);case 7:d[1]=n[i+6],S(d,48),L(l,d);case 6:d[1]=n[i+5],S(d,40),L(l,d);case 5:d[1]=n[i+4],S(d,32),L(l,d);case 4:d[1]=n[i+3],S(d,24),L(l,d);case 3:d[1]=n[i+2],S(d,16),L(l,d);case 2:d[1]=n[i+1],S(d,8),L(l,d);case 1:d[1]=n[i],L(l,d),E(l,R),C(l,31),E(l,D),L(s,l)}return L(s,o),L(c,o),x(s,c),x(c,s),k(s),k(c),x(s,c),x(c,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)}function T(e,t,n,i){var o=Object.keys(e).filter(function(e){return!function(e,t){for(var n=0,i=e.length;n<i;++n)if(e[n]===t)return!0;return!1}(n,e)}),r=f(p(o,function(n){return function(e,t){var n=f(new Promise(function(n){var i=Date.now();m(e.bind(null,t),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=Date.now()-i;if(!e[0])return n(function(){return{error:e[1],duration:o}});var r=e[1];if(function(e){return"function"!=typeof e}(r))return n(function(){return{value:r,duration:o}});n(function(){return new Promise(function(e){var t=Date.now();m(r,function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var r=o+Date.now()-t;if(!n[0])return e({error:n[1],duration:r});e({value:n[1],duration:r})})})})})}));return function(){return n.then(function(e){return e()})}}(e[n],t)},i));return function(){return s(this,void 0,void 0,function(){var e,t,n,a;return c(this,function(s){switch(s.label){case 0:return[4,r];case 1:return[4,p(s.sent(),function(e){return f(e())},i)];case 2:return e=s.sent(),[4,Promise.all(e)];case 3:for(t=s.sent(),n={},a=0;a<o.length;++a)n[o[a]]=t[a];return[2,n]}})})}}function A(){var e=window,t=navigator;return b(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function B(){var e=window,t=navigator;return b(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,0===(t.vendor||"").indexOf("Google"),"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function F(){var e=window;return b(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,0===navigator.vendor.indexOf("Apple"),"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function j(){var e=window,t=e.HTMLElement,n=e.Document;return b(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),n&&"pointerLockElement"in n.prototype])>=4}function Z(){var e,t=window;return e=t.print,/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))&&"[object WebPageNamespace]"===String(t.browser)}function O(){var e,t,n=window;return b(["buildID"in navigator,"MozAppearance"in(null!==(t=null===(e=document.documentElement)||void 0===e?void 0:e.style)&&void 0!==t?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function U(){var e=window,t=navigator,n=e.CSS,i=e.HTMLButtonElement;return b([!("getStorageUpdates"in t),i&&"popover"in i.prototype,"CSSCounterStyleRule"in e,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function G(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function X(){var e=B(),t=O(),n=window,i=navigator,o="connection";return e?b([!("SharedWorker"in n),i[o]&&"ontypechange"in i[o],!("sinkId"in new Audio)])>=2:!!t&&b(["onorientationchange"in n,"orientation"in n,/android/i.test(i.appVersion)])>=2}function Y(e){var t=new Error(e);return t.name=e,t}function N(e,t,n){var i,o,r;return void 0===n&&(n=50),s(this,void 0,void 0,function(){var a,s;return c(this,function(c){switch(c.label){case 0:a=document,c.label=1;case 1:return a.body?[3,3]:[4,d(n)];case 2:return c.sent(),[3,1];case 3:s=a.createElement("iframe"),c.label=4;case 4:return c.trys.push([4,,10,11]),[4,new Promise(function(e,n){var i=!1,o=function(){i=!0,e()};s.onload=o,s.onerror=function(e){i=!0,n(e)};var r=s.style;r.setProperty("display","block","important"),r.position="absolute",r.top="0",r.left="0",r.visibility="hidden",t&&"srcdoc"in s?s.srcdoc=t:s.src="about:blank",a.body.appendChild(s);var c=function(){var e,t;i||("complete"===(null===(t=null===(e=s.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.readyState)?o():setTimeout(c,10))};c()})];case 5:c.sent(),c.label=6;case 6:return(null===(o=null===(i=s.contentWindow)||void 0===i?void 0:i.document)||void 0===o?void 0:o.body)?[3,8]:[4,d(n)];case 7:return c.sent(),[3,6];case 8:return[4,e(s,s.contentWindow)];case 9:return[2,c.sent()];case 10:return null===(r=s.parentNode)||void 0===r||r.removeChild(s),[7];case 11:return[2]}})})}function z(e){for(var t=function(e){for(var t,n,i="Unexpected syntax '".concat(e,"'"),o=/^\s*([a-z-]*)(.*)$/i.exec(e),r=o[1]||void 0,a={},s=/([.:#][\w-]+|\[.+?\])/gi,c=function(e,t){a[e]=a[e]||[],a[e].push(t)};;){var l=s.exec(o[2]);if(!l)break;var h=l[0];switch(h[0]){case".":c("class",h.slice(1));break;case"#":c("id",h.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(h);if(!d)throw new Error(i);c(d[1],null!==(n=null!==(t=d[4])&&void 0!==t?t:d[5])&&void 0!==n?n:"");break;default:throw new Error(i)}}return[r,a]}(e),n=t[0],i=t[1],o=document.createElement(null!=n?n:"div"),r=0,a=Object.keys(i);r<a.length;r++){var s=a[r],c=i[s].join(" ");"style"===s?J(o.style,c):o.setAttribute(s,c)}return o}function J(e,t){for(var n=0,i=t.split(";");n<i.length;n++){var o=i[n],r=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(o);if(r){var a=r[1],s=r[2],c=r[4];e.setProperty(a,s,c||"")}}}var Q=["monospace","sans-serif","serif"],q=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function K(e){return e.toDataURL()}var _,$;function ee(){var e=this;return function(){if(void 0===$){var e=function(){var t=te();ne(t)?$=setTimeout(e,2500):(_=t,$=void 0)};e()}}(),function(){return s(e,void 0,void 0,function(){var e;return c(this,function(t){switch(t.label){case 0:return ne(e=te())?_?[2,l([],_,!0)]:(n=document).fullscreenElement||n.msFullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement?[4,G()]:[3,2]:[3,2];case 1:t.sent(),e=te(),t.label=2;case 2:return ne(e)||(_=e),[2,e]}var n})})}}function te(){var e=screen;return[y(v(e.availTop),null),y(v(e.width)-v(e.availWidth)-y(v(e.availLeft),0),null),y(v(e.height)-v(e.availHeight)-y(v(e.availTop),0),null),y(v(e.availLeft),null)]}function ne(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function ie(e){var t;return s(this,void 0,void 0,function(){var n,i,o,r,a,s,l;return c(this,function(c){switch(c.label){case 0:for(n=document,i=n.createElement("div"),o=new Array(e.length),r={},oe(i),l=0;l<e.length;++l)"DIALOG"===(a=z(e[l])).tagName&&a.show(),oe(s=n.createElement("div")),s.appendChild(a),i.appendChild(s),o[l]=a;c.label=1;case 1:return n.body?[3,3]:[4,d(50)];case 2:return c.sent(),[3,1];case 3:n.body.appendChild(i);try{for(l=0;l<e.length;++l)o[l].offsetParent||(r[e[l]]=!0)}finally{null===(t=i.parentNode)||void 0===t||t.removeChild(i)}return[2,r]}})})}function oe(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function re(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function ae(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}function se(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function ce(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function le(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function he(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var de=Math,ue=function(){return 0};var me={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};var pe=function(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return!0;throw e}e=t}};var fe=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),ge=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),ve=["FRAGMENT_SHADER","VERTEX_SHADER"],ye=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],be="WEBGL_debug_renderer_info";function we(e){if(e.webgl)return e.webgl.context;var t,n=document.createElement("canvas");n.addEventListener("webglCreateContextError",function(){return t=void 0});for(var i=0,o=["webgl","experimental-webgl"];i<o.length;i++){var r=o[i];try{t=n.getContext(r)}catch(e){}if(t)break}return e.webgl={context:t},t}function xe(e,t,n){var i=e.getShaderPrecisionFormat(e[t],e[n]);return i?[i.rangeMin,i.rangeMax,i.precision]:[]}function Ee(e){return Object.keys(e.__proto__).filter(Ce)}function Ce(e){return"string"==typeof e&&!e.match(/[^A-Z0-9_x]/)}function Se(){return O()}function Le(){return B()||F()}function Me(e){return"function"==typeof e.getParameter}var Ie={fonts:function(){var e=this;return N(function(t,n){var i=n.document;return s(e,void 0,void 0,function(){var e,t,n,o,r,a,s,l,h,d,u;return c(this,function(c){for((e=i.body).style.fontSize="48px",(t=i.createElement("div")).style.setProperty("visibility","hidden","important"),n={},o={},r=function(e){var n=i.createElement("span"),o=n.style;return o.position="absolute",o.top="0",o.left="0",o.fontFamily=e,n.textContent="mmMwWLliI0O&1",t.appendChild(n),n},a=function(e,t){return r("'".concat(e,"',").concat(t))},s=function(){for(var e={},t=function(t){e[t]=Q.map(function(e){return a(t,e)})},n=0,i=q;n<i.length;n++){t(i[n])}return e},l=function(e){return Q.some(function(t,i){return e[i].offsetWidth!==n[t]||e[i].offsetHeight!==o[t]})},h=function(){return Q.map(r)}(),d=s(),e.appendChild(t),u=0;u<Q.length;u++)n[Q[u]]=h[u].offsetWidth,o[Q[u]]=h[u].offsetHeight;return[2,q.filter(function(e){return l(d[e])})]})})})},domBlockers:function(e){var t=(void 0===e?{}:e).debug;return s(this,void 0,void 0,function(){var e,n,i,o,r;return c(this,function(a){switch(a.label){case 0:return F()||X()?(s=atob,e={abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',s("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",s("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",s("LnNwb25zb3JpdA=="),".ylamainos",s("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",s("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",s("LmhlYWRlci1ibG9ja2VkLWFk"),s("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",s("I2FkXzMwMFgyNTA="),s("I2Jhbm5lcmZsb2F0MjI="),s("I2NhbXBhaWduLWJhbm5lcg=="),s("I0FkLUNvbnRlbnQ=")],adGuardChinese:[s("LlppX2FkX2FfSA=="),s("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",s("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),s("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",s("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",s("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",s("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),s("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),s("LmFkZ29vZ2xl"),s("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[s("YW1wLWF1dG8tYWRz"),s("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",s("I2FkX2ludmlld19hcmVh")],adGuardRussian:[s("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),s("LnJlY2xhbWE="),'div[id^="smi2adblock"]',s("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[s("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),s("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",s("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),s("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),s("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",s("I3Jla2xhbWk="),s("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),s("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),s("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[s("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",s("LndpZGdldF9wb19hZHNfd2lkZ2V0"),s("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",s("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[s("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),s("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",s("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",s("I3Jla2xhbW5pLWJveA=="),s("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",s("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[s("I2FkdmVydGVudGll"),s("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",s("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",s("LnNwb25zb3JsaW5rZ3J1ZW4="),s("I3dlcmJ1bmdza3k="),s("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),s("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[s("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",s("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[s("LnJla2xhbW9zX3RhcnBhcw=="),s("LnJla2xhbW9zX251b3JvZG9z"),s("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),s("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),s("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[s("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[s("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),s("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",s("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[s("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),s("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),s("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",s("LmFkX19tYWlu"),s("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[s("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[s("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),s("I2xpdmVyZUFkV3JhcHBlcg=="),s("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),s("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[s("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",s("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),s("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),s("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[s("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),s("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),s("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",s("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),s("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),s("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),s("ZGl2I3NrYXBpZWNfYWQ=")],ro:[s("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),s("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[s("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),s("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),s("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",s("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),s("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",s("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]},n=Object.keys(e),[4,ie((r=[]).concat.apply(r,n.map(function(t){return e[t]})))]):[2,void 0];case 1:return i=a.sent(),t&&function(e,t){for(var n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];"\n".concat(o,":");for(var r=0,a=e[o];r<a.length;r++){var s=a[r];"\n ".concat(t[s]?"🚫":"➡️"," ").concat(s)}}}(e,i),(o=n.filter(function(t){var n=e[t];return b(n.map(function(e){return i[e]}))>.6*n.length})).sort(),[2,o]}var s})})},fontPreferences:function(){return function(e,t){void 0===t&&(t=4e3);return N(function(n,i){var o=i.document,r=o.body,a=r.style;a.width="".concat(t,"px"),a.webkitTextSizeAdjust=a.textSizeAdjust="none",B()?r.style.zoom="".concat(1/i.devicePixelRatio):F()&&(r.style.zoom="reset");var s=o.createElement("div");return s.textContent=l([],Array(t/20|0),!0).map(function(){return"word"}).join(" "),r.appendChild(s),e(o,r)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}(function(e,t){for(var n={},i={},o=0,r=Object.keys(me);o<r.length;o++){var a=r[o],s=me[a],c=s[0],l=void 0===c?{}:c,h=s[1],d=void 0===h?"mmMwWLliI0fiflO&1":h,u=e.createElement("span");u.textContent=d,u.style.whiteSpace="nowrap";for(var m=0,p=Object.keys(l);m<p.length;m++){var f=p[m],g=l[f];void 0!==g&&(u.style[f]=g)}n[a]=u,t.append(e.createElement("br"),u)}for(var v=0,y=Object.keys(me);v<y.length;v++){i[a=y[v]]=n[a].getBoundingClientRect().width}return i})},audio:function(){return F()&&U()&&Z()||B()&&(e=navigator,t=window,n=Audio.prototype,i=t.visualViewport,b(["srLatency"in n,"srChannelCount"in n,"devicePosture"in e,i&&"segments"in i,"getTextInformation"in Image.prototype])>=3)&&function(){var e=window,t=e.URLPattern;return b(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}()?-4:function(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(F()&&!j()&&!function(){var e=window;return b(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}())return-1;var n=4500,i=new t(1,5e3,44100),o=i.createOscillator();o.type="triangle",o.frequency.value=1e4;var r=i.createDynamicsCompressor();r.threshold.value=-50,r.knee.value=40,r.ratio.value=12,r.attack.value=0,r.release.value=.25,o.connect(r),r.connect(i.destination),o.start(0);var a=function(e){var t=3,n=500,i=500,o=5e3,r=function(){},a=new Promise(function(a,s){var c=!1,l=0,h=0;e.oncomplete=function(e){return a(e.renderedBuffer)};var d=function(){setTimeout(function(){return s(Y("timeout"))},Math.min(i,h+o-Date.now()))},m=function(){try{var i=e.startRendering();switch(u(i)&&f(i),e.state){case"running":h=Date.now(),c&&d();break;case"suspended":document.hidden||l++,c&&l>=t?s(Y("suspended")):setTimeout(m,n)}}catch(e){s(e)}};m(),r=function(){c||(c=!0,h>0&&d())}});return[a,r]}(i),s=a[0],c=a[1],l=f(s.then(function(e){return function(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}(e.getChannelData(0).subarray(n))},function(e){if("timeout"===e.name||"suspended"===e.name)return-3;throw e}));return function(){return c(),l}}();var e,t,n,i},screenFrame:function(){var e=this;if(F()&&U()&&Z())return function(){return Promise.resolve(void 0)};var t=ee();return function(){return s(e,void 0,void 0,function(){var e,n;return c(this,function(i){switch(i.label){case 0:return[4,t()];case 1:return e=i.sent(),[2,[(n=function(e){return null===e?null:w(e,10)})(e[0]),n(e[1]),n(e[2]),n(e[3])]]}})})}},canvas:function(){return function(e){var t,n,i,o=!1,r=function(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}(),a=r[0],s=r[1];!function(e,t){return!(!t||!e.toDataURL)}(a,s)?n=i="unsupported":(o=function(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}(s),e?n=i="skipped":(t=function(e,t){!function(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat(String.fromCharCode(55357,56835));t.fillText(n,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(n,4,45)}(e,t);var n=K(e),i=K(e);if(n!==i)return["unstable","unstable"];!function(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var n=0,i=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<i.length;n++){var o=i[n],r=o[0],a=o[1],s=o[2];t.fillStyle=r,t.beginPath(),t.arc(a,s,40,0,2*Math.PI,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,2*Math.PI,!0),t.arc(60,60,20,0,2*Math.PI,!0),t.fill("evenodd")}(e,t);var o=K(e);return[o,n]}(a,s),n=t[0],i=t[1]));return{winding:o,geometry:n,text:i}}(F()&&U()&&Z())},osCpu:function(){return navigator.oscpu},languages:function(){var e,t=navigator,n=[],i=t.language||t.userLanguage||t.browserLanguage||t.systemLanguage;if(void 0!==i&&n.push([i]),Array.isArray(t.languages))B()&&b([!("MediaSettingsRange"in(e=window)),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3||n.push(t.languages);else if("string"==typeof t.languages){var o=t.languages;o&&n.push(o.split(","))}return n},colorDepth:function(){return window.screen.colorDepth},deviceMemory:function(){return y(v(navigator.deviceMemory),void 0)},screenResolution:function(){var e,t,n;if(!(F()&&U()&&Z()))return e=screen,(n=[(t=function(e){return y(g(e),null)})(e.width),t(e.height)]).sort().reverse(),n},hardwareConcurrency:function(){return y(g(navigator.hardwareConcurrency),void 0)},timezone:function(){var e,t=null===(e=window.Intl)||void 0===e?void 0:e.DateTimeFormat;if(t){var n=(new t).resolvedOptions().timeZone;if(n)return n}var i,o=(i=(new Date).getFullYear(),-Math.max(v(new Date(i,0,1).getTimezoneOffset()),v(new Date(i,6,1).getTimezoneOffset())));return"UTC".concat(o>=0?"+":"").concat(o)},sessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},localStorage:function(){try{return!!window.localStorage}catch(e){return!0}},indexedDB:function(){var e,t;if(!(A()||(e=window,t=navigator,b(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!A())))try{return!!window.indexedDB}catch(e){return!0}},openDatabase:function(){return!!window.openDatabase},cpuClass:function(){return navigator.cpuClass},platform:function(){var e=navigator.platform;return"MacIntel"===e&&F()&&!j()?function(){if("iPad"===navigator.platform)return!0;var e=screen,t=e.width/e.height;return b(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}()?"iPad":"iPhone":e},plugins:function(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var i=e[n];if(i){for(var o=[],r=0;r<i.length;++r){var a=i[r];o.push({type:a.type,suffixes:a.suffixes})}t.push({name:i.name,description:i.description,mimeTypes:o})}}return t}},touchSupport:function(){var e,t=navigator,n=0;void 0!==t.maxTouchPoints?n=g(t.maxTouchPoints):void 0!==t.msMaxTouchPoints&&(n=t.msMaxTouchPoints);try{document.createEvent("TouchEvent"),e=!0}catch(t){e=!1}return{maxTouchPoints:n,touchEvent:e,touchStart:"ontouchstart"in window}},vendor:function(){return navigator.vendor||""},vendorFlavors:function(){for(var e=[],t=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<n.length;t++){var i=n[t],o=window[i];o&&"object"==typeof o&&e.push(i)}return e.sort()},cookiesEnabled:function(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=-1!==e.cookie.indexOf("cookietest=");return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch(e){return!1}},colorGamut:function(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}},invertedColors:function(){return!!re("inverted")||!re("none")&&void 0},forcedColors:function(){return!!ae("active")||!ae("none")&&void 0},monochrome:function(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=100;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}},contrast:function(){return se("no-preference")?0:se("high")||se("more")?1:se("low")||se("less")?-1:se("forced")?10:void 0},reducedMotion:function(){return!!ce("reduce")||!ce("no-preference")&&void 0},reducedTransparency:function(){return!!le("reduce")||!le("no-preference")&&void 0},hdr:function(){return!!he("high")||!he("standard")&&void 0},math:function(){var e,t=de.acos||ue,n=de.acosh||ue,i=de.asin||ue,o=de.asinh||ue,r=de.atanh||ue,a=de.atan||ue,s=de.sin||ue,c=de.sinh||ue,l=de.cos||ue,h=de.cosh||ue,d=de.tan||ue,u=de.tanh||ue,m=de.exp||ue,p=de.expm1||ue,f=de.log1p||ue;return{acos:t(.12312423423423424),acosh:n(1e308),acoshPf:(e=1e154,de.log(e+de.sqrt(e*e-1))),asin:i(.12312423423423424),asinh:o(1),asinhPf:function(e){return de.log(e+de.sqrt(e*e+1))}(1),atanh:r(.5),atanhPf:function(e){return de.log((1+e)/(1-e))/2}(.5),atan:a(.5),sin:s(-1e300),sinh:c(1),sinhPf:function(e){return de.exp(e)-1/de.exp(e)/2}(1),cos:l(10.000000000123),cosh:h(1),coshPf:function(e){return(de.exp(e)+1/de.exp(e))/2}(1),tan:d(-1e300),tanh:u(1),tanhPf:function(e){return(de.exp(2*e)-1)/(de.exp(2*e)+1)}(1),exp:m(1),expm1:p(1),expm1Pf:function(e){return de.exp(e)-1}(1),log1p:f(10),log1pPf:function(e){return de.log(1+e)}(10),powPI:function(e){return de.pow(de.PI,e)}(-100)}},pdfViewerEnabled:function(){return navigator.pdfViewerEnabled},architecture:function(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]},applePay:function(){var e=window.ApplePaySession;if("function"!=typeof(null==e?void 0:e.canMakePayments))return-1;if(pe())return-3;try{return e.canMakePayments()?1:0}catch(e){return function(e){if(e instanceof Error&&"InvalidAccessError"===e.name&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}(e)}},privateClickMeasurement:function(){var e,t=document.createElement("a"),n=null!==(e=t.attributionSourceId)&&void 0!==e?e:t.attributionsourceid;return void 0===n?void 0:String(n)},audioBaseLatency:function(){if(!(X()||F()))return-2;if(!window.AudioContext)return-1;var e=(new AudioContext).baseLatency;return null==e?-1:isFinite(e)?e:-3},dateTimeLocale:function(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return t||""===t?t:-3},webGlBasics:function(e){var t,n,i,o,r,a,s=we(e.cache);if(!s)return-1;if(!Me(s))return-2;var c=Se()?null:s.getExtension(be);return{version:(null===(t=s.getParameter(s.VERSION))||void 0===t?void 0:t.toString())||"",vendor:(null===(n=s.getParameter(s.VENDOR))||void 0===n?void 0:n.toString())||"",vendorUnmasked:c?null===(i=s.getParameter(c.UNMASKED_VENDOR_WEBGL))||void 0===i?void 0:i.toString():"",renderer:(null===(o=s.getParameter(s.RENDERER))||void 0===o?void 0:o.toString())||"",rendererUnmasked:c?null===(r=s.getParameter(c.UNMASKED_RENDERER_WEBGL))||void 0===r?void 0:r.toString():"",shadingLanguageVersion:(null===(a=s.getParameter(s.SHADING_LANGUAGE_VERSION))||void 0===a?void 0:a.toString())||""}},webGlExtensions:function(e){var t=we(e.cache);if(!t)return-1;if(!Me(t))return-2;var n=t.getSupportedExtensions(),i=t.getContextAttributes(),o=[],r=[],a=[],s=[],c=[];if(i)for(var l=0,h=Object.keys(i);l<h.length;l++){var d=h[l];r.push("".concat(d,"=").concat(i[d]))}for(var u=0,m=Ee(t);u<m.length;u++){var p=t[x=m[u]];a.push("".concat(x,"=").concat(p).concat(fe.has(p)?"=".concat(t.getParameter(p)):""))}if(n)for(var f=0,g=n;f<g.length;f++){var v=g[f];if(!(v===be&&Se()||"WEBGL_polygon_mode"===v&&Le())){var y=t.getExtension(v);if(y)for(var b=0,w=Ee(y);b<w.length;b++){var x;p=y[x=w[b]];s.push("".concat(x,"=").concat(p).concat(ge.has(p)?"=".concat(t.getParameter(p)):""))}else o.push(v)}}for(var E=0,C=ve;E<C.length;E++)for(var S=C[E],L=0,M=ye;L<M.length;L++){var I=M[L],k=xe(t,S,I);c.push("".concat(S,".").concat(I,"=").concat(k.join(",")))}return s.sort(),a.sort(),{contextAttributes:r,parameters:a,shaderPrecisions:c,extensions:n,extensionParameters:s,unsupportedExtensions:o}}};function ke(e){var t=function(e){if(X())return.4;if(F())return!j()||U()&&Z()?.3:.5;var t="value"in e.platform?e.platform.value:"";if(/^Win/.test(t))return.6;if(/^Mac/.test(t))return.5;return.7}(e),n=function(e){return w(.99+.01*e,1e-4)}(t);return{score:t,comment:"$ if upgrade to Pro: https://fpjs.dev/pro".replace(/\$/g,"".concat(n))}}function Re(e){return H(function(e){for(var t="",n=0,i=Object.keys(e).sort();n<i.length;n++){var o=i[n],r=e[o],a="error"in r?"error":JSON.stringify(r.value);t+="".concat(t?"|":"").concat(o.replace(/([:|\\])/g,"\\$1"),":").concat(a)}return t}(e))}function De(e){return void 0===e&&(e=50),function(e,t){void 0===t&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(e){return n.call(window,function(){return e()},{timeout:t})}):d(Math.min(e,t))}(e,2*e)}function Pe(e,t){Date.now();return{get:function(n){return s(this,void 0,void 0,function(){var i,o;return c(this,function(r){switch(r.label){case 0:return Date.now(),[4,e()];case 1:return i=r.sent(),o=function(e){var t,n=ke(e);return{get visitorId(){return void 0===t&&(t=Re(this.components)),t},set visitorId(e){t=e},confidence:n,components:e,version:h}}(i),t||null==n||n.debug,[2,o]}})})}}}var Ve={load:function(e){var t;return void 0===e&&(e={}),s(this,void 0,void 0,function(){var n,i,o;return c(this,function(r){switch(r.label){case 0:return(null===(t=e.monitoring)||void 0===t||t)&&function(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(h,"/npm-monitoring"),!0),e.send()}catch(e){}}(),n=e.delayFallback,i=e.debug,[4,De(n)];case 1:return r.sent(),o=function(e){return T(Ie,e,[])}({cache:{},debug:i}),[2,Pe(o,i)]}})})},hashComponents:Re,componentsToDebugString:function(e){return JSON.stringify(e,function(e,t){return t instanceof Error?a({name:(n=t).name,message:n.message,stack:null===(i=n.stack)||void 0===i?void 0:i.split("\n")},n):t;var n,i},2)}};class We{constructor(){this.iconManager=null,this.iframeManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1}async init(e,t){if(!this.isInitialized){this.config=e;try{const n=await this.getDeviceId(),a=this.buildIframeUrl(e,n),s=t?.iconPosition||void 0;if(this.iconManager=new i(s),await this.iconManager.show(),this.iframeManager=new o({src:a,mode:"auto",width:400,height:600,allowClose:!0,onMessage:(e,t)=>{"new-message"===e&&this.showNotification(0,{pulse:!0})},onClose:()=>{this.iconManager?.forceCleanupDragEvents()},...t}),await this.iframeManager.init(),this.iconManager.onClick(()=>{this.clearNotification(),this.iframeManager?.show()}),e.screenshot){const t=document.body;this.screenshotManager=new r(t,e.screenshot)}this.isInitialized=!0}catch(e){throw e}}}showIcon(){this.iconManager?.show()}hideIcon(){this.iconManager?.hide()}setIconPosition(e){this.iconManager?.setPosition(e)}setIconCoordinates(e){this.iconManager?.setIconPosition(e)}setIconStyle(e){this.iconManager?.setStyle(e)}openChat(){this.clearNotification(),this.iframeManager?.open()}closeChat(){this.iconManager?.forceCleanupDragEvents(),this.iframeManager?.close()}isChatOpen(){return this.iframeManager?.isIframeOpen()||!1}sendToIframe(e){this.iframeManager?.sendToIframe(e)}getConnectionStatus(){return this.isInitialized}showNotification(e=1,t={}){this.iconManager&&(this.iconManager.showNotification({badgeCount:"string"==typeof e?0:e,badgeText:"string"==typeof e?e:"",pulse:t.pulse||!1}),t.autoHide&&t.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},t.autoHide))}clearNotification(){this.iconManager?.clearNotification()}setScreenshotTarget(e){this.screenshotManager?.setTargetElement(e)}async captureScreenshot(){return!!this.screenshotManager&&await this.screenshotManager.captureOnce()}getScreenshotState(){return this.screenshotManager?.getState()||null}destroy(){this.iconManager?.hide(),this.iframeManager?.close(),this.screenshotManager?.destroy(),this.iconManager=null,this.iframeManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1}async getDeviceId(){try{const e=await Ve.load();return(await e.get()).visitorId}catch(e){return"device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}}buildIframeUrl(e,t){const n=e.iframeUrl;if(!n||""===n.trim())throw new Error("iframeUrl is required but not provided or is empty");const i=new URL(n);return e.agent&&""!==e.agent.trim()&&i.searchParams.set("Agent",e.agent),e.token&&""!==e.token.trim()&&i.searchParams.set("Authorization",e.token),i.searchParams.set("DeviceSign",t),i.searchParams.set("Referrer",document.referrer),i.toString()}}let He=null;const Te=async(e,t)=>{He||(He=new We),await He.init(e,t)},Ae=()=>{if(!He)throw new Error("SDK not initialized. Call init() first.");return He},Be=()=>{Ae().showIcon()},Fe=()=>{Ae().hideIcon()},je=e=>{Ae().setIconPosition(e)},Ze=e=>{Ae().setIconCoordinates(e)},Oe=e=>{Ae().setIconStyle(e)},Ue=()=>{Ae().openChat()},Ge=()=>{Ae().closeChat()},Xe=()=>Ae().isChatOpen(),Ye=e=>{Ae().sendToIframe(e)},Ne=()=>Ae().getConnectionStatus(),ze=(e=1,t={})=>{Ae().showNotification(e,t)},Je=()=>{Ae().clearNotification()},Qe=()=>{Ae().destroy(),He=null},qe=e=>{Ae().setScreenshotTarget(e)},Ke=async()=>{const e=Ae();return await e.captureScreenshot()},_e=()=>Ae().getScreenshotState();var $e={init:Te,getInstance:Ae,showIcon:Be,hideIcon:Fe,setIconPosition:je,setIconCoordinates:Ze,setIconStyle:Oe,openChat:Ue,closeChat:Ge,isChatOpen:Xe,sendToIframe:Ye,getConnectionStatus:Ne,showNotification:ze,clearNotification:Je,setScreenshotTarget:qe,captureScreenshot:Ke,getScreenshotState:_e,destroy:Qe};e.CustomerServiceSDK=We,e.captureScreenshot=Ke,e.clearNotification=Je,e.closeChat=Ge,e.default=$e,e.destroy=Qe,e.getConnectionStatus=Ne,e.getInstance=Ae,e.getScreenshotState=_e,e.hideIcon=Fe,e.init=Te,e.isChatOpen=Xe,e.openChat=Ue,e.sendToIframe=Ye,e.setIconCoordinates=Ze,e.setIconPosition=je,e.setIconStyle=Oe,e.setScreenshotTarget=qe,e.showIcon=Be,e.showNotification=ze,Object.defineProperty(e,"__esModule",{value:!0})});
@@ -16,10 +16,21 @@ export interface ScreenshotOptions {
16
16
  outputFormat?: 'webp' | 'jpeg' | 'png';
17
17
  enableCORS?: boolean;
18
18
  proxyUrl?: string;
19
- engine?: 'modern-screenshot';
19
+ engine?: 'modern-screenshot' | 'snapdom';
20
20
  corsMode?: 'simple' | 'smart' | 'proxy' | 'blob' | 'canvas-proxy' | 'ignore' | 'test-first';
21
21
  silentMode?: boolean;
22
22
  maxRetries?: number;
23
+ preloadImages?: boolean;
24
+ maxConcurrentDownloads?: number;
25
+ onlyVisibleImages?: boolean;
26
+ imageCacheTTL?: number;
27
+ useIndexedDB?: boolean;
28
+ usePreconnect?: boolean;
29
+ imageLoadTimeout?: number;
30
+ useIntersectionObserver?: boolean;
31
+ fetchPriority?: 'high' | 'low' | 'auto';
32
+ maxCacheSize?: number;
33
+ maxCacheAge?: number;
23
34
  }
24
35
  export interface UploadConfig {
25
36
  uploadUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,iBAAiB,CAAA;CAC/B;AAGD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;IACtC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAA;IAC3F,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAGD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;CACjB;AAGD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAA;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAGD,MAAM,WAAW,YAAY;IAC3B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACpB;AAGD,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;IACpE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,iBAAiB,CAAA;CAC/B;AAGD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;IACtC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAA;IACxC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAA;IAC3F,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAGD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;CACjB;AAGD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAA;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAGD,MAAM,WAAW,YAAY;IAC3B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACpB;AAGD,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;IACpE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customer-chat-sdk",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Customer Service SDK - One-line integration for customer support chat",
5
5
  "main": "dist/customer-sdk.cjs.js",
6
6
  "module": "dist/customer-sdk.esm.js",
@@ -57,7 +57,8 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@fingerprintjs/fingerprintjs": "^4.6.2",
60
- "modern-screenshot": "^4.6.6"
60
+ "modern-screenshot": "^4.6.6",
61
+ "@zumer/snapdom": "^1.9.14"
61
62
  },
62
63
  "engines": {
63
64
  "node": ">=18.0.0",