customer-chat-sdk 1.3.8 → 1.3.9

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
- {"version":3,"file":"IconManager.d.ts","sourceRoot":"","sources":["../../src/core/IconManager.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"IconManager.d.ts","sourceRoot":"","sources":["../../src/core/IconManager.ts"],"names":[],"mappings":"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"}
@@ -1908,6 +1908,8 @@ class IconManager {
1908
1908
  }
1909
1909
  // 清除自动吸附定时器(用户有操作)
1910
1910
  this.clearAutoAttachTimer();
1911
+ // 点击图标时清除红点
1912
+ this.clearNotification();
1911
1913
  if (this.onClickCallback) {
1912
1914
  this.onClickCallback();
1913
1915
  }
@@ -29628,11 +29630,11 @@ class CustomerServiceSDK {
29628
29630
  /**
29629
29631
  * 初始化 SDK
29630
29632
  * @param config SDK配置
29631
- * @param options UI选项(可选)
29633
+ * @param options UI选项(可选,保留用于兼容性,当前未使用)
29632
29634
  * @param forceReinit 是否强制重新初始化(用于更新token等配置)
29633
29635
  * @returns 返回初始化信息(包含设备ID等)
29634
29636
  */
29635
- async init(config, options, forceReinit = false) {
29637
+ async init(config, _options, forceReinit = false) {
29636
29638
  // 防止并发初始化
29637
29639
  if (this.isInitializing) {
29638
29640
  throw new Error('SDK is already initializing. Please wait for the current initialization to complete.');
@@ -29952,10 +29954,41 @@ class CustomerServiceSDK {
29952
29954
  }
29953
29955
  /**
29954
29956
  * 获取初始化信息(设备ID等)
29957
+ * 如果已初始化,返回保存的结果;否则返回 null
29955
29958
  */
29956
29959
  getInitResult() {
29957
29960
  return this.initResult;
29958
29961
  }
29962
+ /**
29963
+ * 生成初始化信息(设备ID等)
29964
+ * 可以在任何时候调用,即使没有初始化也能获取 deviceId 等信息
29965
+ * @param agent 代理商ID(可选,如果不传则从已保存的配置中获取)
29966
+ * @returns 返回初始化信息(包含设备ID等)
29967
+ */
29968
+ async generateInitResult(agent) {
29969
+ // 获取设备指纹ID
29970
+ const rawDeviceId = await this.getDeviceId();
29971
+ // 获取 referrer(优先使用已保存的配置,否则使用当前页面的 referrer)
29972
+ const referrer = this.config?.referrer || this.getReferrer(this.config || {});
29973
+ // 计算返回给前端的 deviceId:md5(deviceId + getReferrer())
29974
+ const deviceId = cryptoJsExports.MD5(rawDeviceId + referrer).toString();
29975
+ // 使用传入的 agent 或已保存的配置中的 agent
29976
+ const finalAgent = agent || this.config?.agent;
29977
+ if (this.debug) {
29978
+ console.log('Generated InitResult:', {
29979
+ deviceId,
29980
+ referrer,
29981
+ agent: finalAgent,
29982
+ timestamp: Date.now()
29983
+ });
29984
+ }
29985
+ return {
29986
+ deviceId,
29987
+ referrer,
29988
+ agent: finalAgent,
29989
+ timestamp: Date.now()
29990
+ };
29991
+ }
29959
29992
  /**
29960
29993
  * 获取设备指纹ID
29961
29994
  */
@@ -30094,6 +30127,16 @@ const getInitResult = () => {
30094
30127
  const sdk = getInstance();
30095
30128
  return sdk.getInitResult();
30096
30129
  };
30130
+ /**
30131
+ * 生成初始化信息(设备ID等)
30132
+ * 可以在任何时候调用,即使没有初始化也能获取 deviceId 等信息
30133
+ * @param agent 代理商ID(可选,如果不传则从已保存的配置中获取)
30134
+ * @returns 返回初始化信息(包含设备ID等)
30135
+ */
30136
+ const generateInitResult = async (agent) => {
30137
+ const sdk = getInstance();
30138
+ return await sdk.generateInitResult(agent);
30139
+ };
30097
30140
  /**
30098
30141
  * 消息通知API
30099
30142
  */
@@ -30146,6 +30189,7 @@ var index = {
30146
30189
  init,
30147
30190
  getInstance,
30148
30191
  getInitResult,
30192
+ generateInitResult,
30149
30193
  showIcon,
30150
30194
  hideIcon,
30151
30195
  setIconPosition,
@@ -30171,6 +30215,7 @@ exports.clearNotification = clearNotification;
30171
30215
  exports.default = index;
30172
30216
  exports.destroy = destroy;
30173
30217
  exports.enableScreenshot = enableScreenshot;
30218
+ exports.generateInitResult = generateInitResult;
30174
30219
  exports.getConnectionStatus = getConnectionStatus;
30175
30220
  exports.getInitResult = getInitResult;
30176
30221
  exports.getInstance = getInstance;
@@ -1904,6 +1904,8 @@ class IconManager {
1904
1904
  }
1905
1905
  // 清除自动吸附定时器(用户有操作)
1906
1906
  this.clearAutoAttachTimer();
1907
+ // 点击图标时清除红点
1908
+ this.clearNotification();
1907
1909
  if (this.onClickCallback) {
1908
1910
  this.onClickCallback();
1909
1911
  }
@@ -29624,11 +29626,11 @@ class CustomerServiceSDK {
29624
29626
  /**
29625
29627
  * 初始化 SDK
29626
29628
  * @param config SDK配置
29627
- * @param options UI选项(可选)
29629
+ * @param options UI选项(可选,保留用于兼容性,当前未使用)
29628
29630
  * @param forceReinit 是否强制重新初始化(用于更新token等配置)
29629
29631
  * @returns 返回初始化信息(包含设备ID等)
29630
29632
  */
29631
- async init(config, options, forceReinit = false) {
29633
+ async init(config, _options, forceReinit = false) {
29632
29634
  // 防止并发初始化
29633
29635
  if (this.isInitializing) {
29634
29636
  throw new Error('SDK is already initializing. Please wait for the current initialization to complete.');
@@ -29948,10 +29950,41 @@ class CustomerServiceSDK {
29948
29950
  }
29949
29951
  /**
29950
29952
  * 获取初始化信息(设备ID等)
29953
+ * 如果已初始化,返回保存的结果;否则返回 null
29951
29954
  */
29952
29955
  getInitResult() {
29953
29956
  return this.initResult;
29954
29957
  }
29958
+ /**
29959
+ * 生成初始化信息(设备ID等)
29960
+ * 可以在任何时候调用,即使没有初始化也能获取 deviceId 等信息
29961
+ * @param agent 代理商ID(可选,如果不传则从已保存的配置中获取)
29962
+ * @returns 返回初始化信息(包含设备ID等)
29963
+ */
29964
+ async generateInitResult(agent) {
29965
+ // 获取设备指纹ID
29966
+ const rawDeviceId = await this.getDeviceId();
29967
+ // 获取 referrer(优先使用已保存的配置,否则使用当前页面的 referrer)
29968
+ const referrer = this.config?.referrer || this.getReferrer(this.config || {});
29969
+ // 计算返回给前端的 deviceId:md5(deviceId + getReferrer())
29970
+ const deviceId = cryptoJsExports.MD5(rawDeviceId + referrer).toString();
29971
+ // 使用传入的 agent 或已保存的配置中的 agent
29972
+ const finalAgent = agent || this.config?.agent;
29973
+ if (this.debug) {
29974
+ console.log('Generated InitResult:', {
29975
+ deviceId,
29976
+ referrer,
29977
+ agent: finalAgent,
29978
+ timestamp: Date.now()
29979
+ });
29980
+ }
29981
+ return {
29982
+ deviceId,
29983
+ referrer,
29984
+ agent: finalAgent,
29985
+ timestamp: Date.now()
29986
+ };
29987
+ }
29955
29988
  /**
29956
29989
  * 获取设备指纹ID
29957
29990
  */
@@ -30090,6 +30123,16 @@ const getInitResult = () => {
30090
30123
  const sdk = getInstance();
30091
30124
  return sdk.getInitResult();
30092
30125
  };
30126
+ /**
30127
+ * 生成初始化信息(设备ID等)
30128
+ * 可以在任何时候调用,即使没有初始化也能获取 deviceId 等信息
30129
+ * @param agent 代理商ID(可选,如果不传则从已保存的配置中获取)
30130
+ * @returns 返回初始化信息(包含设备ID等)
30131
+ */
30132
+ const generateInitResult = async (agent) => {
30133
+ const sdk = getInstance();
30134
+ return await sdk.generateInitResult(agent);
30135
+ };
30093
30136
  /**
30094
30137
  * 消息通知API
30095
30138
  */
@@ -30142,6 +30185,7 @@ var index = {
30142
30185
  init,
30143
30186
  getInstance,
30144
30187
  getInitResult,
30188
+ generateInitResult,
30145
30189
  showIcon,
30146
30190
  hideIcon,
30147
30191
  setIconPosition,
@@ -30160,4 +30204,4 @@ var index = {
30160
30204
  destroy
30161
30205
  };
30162
30206
 
30163
- export { CustomerSDK, CustomerServiceSDK, captureScreenshot, clearNotification, index as default, destroy, enableScreenshot, getConnectionStatus, getInitResult, getInstance, getScreenshotState, hideIcon, init, onIconClick, setIconCoordinates, setIconPosition, setIconStyle, setScreenshotTarget, showIcon, showNotification, triggerScreenshotConfig, updateScreenshotOptions };
30207
+ export { CustomerSDK, CustomerServiceSDK, captureScreenshot, clearNotification, index as default, destroy, enableScreenshot, generateInitResult, getConnectionStatus, getInitResult, getInstance, getScreenshotState, hideIcon, init, onIconClick, setIconCoordinates, setIconPosition, setIconStyle, setScreenshotTarget, showIcon, showNotification, triggerScreenshotConfig, updateScreenshotOptions };
@@ -1,4 +1,4 @@
1
- !function(A,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((A="undefined"!=typeof globalThis?globalThis:A||self).CustomerSDK={})}(this,function(A){"use strict";class e{constructor(A,e=!1,t,n){this.iconElement=null,this.badgeElement=null,this.onClickCallback=null,this.notificationCallback=null,this.iconPosition=null,this.debug=!1,this.isClickEnabled=!0,this.target=null,this.isDragging=!1,this.dragStarted=!1,this.dragIntent=!1,this.hasMoved=!1,this.dragOffset={x:0,y:0},this.lastTouchPosition={x:0,y:0},this.touchStartTime=0,this.clickThreshold=15,this.stoppedByIframe=!1,this.cachedContainer=null,this.cachedContainerRect=null,this.cachedIconSize={width:0,height:0},this.lastContainerUpdateTime=0,this.containerUpdateInterval=100,this.cachedIframes=[],this.lastIframeUpdateTime=0,this.iframeUpdateInterval=16,this.rafId=null,this.pendingPosition={x:0,y:0,needsUpdate:!1},this.activeDetectionRafId=null,this.activeDetectionTimeoutId=null,this.lastMousePosition={x:0,y:0,timestamp:0},this.mouseVelocity={vx:0,vy:0},this.onDragHandler=null,this.stopDragHandler=null,this.startDragHandler=null,this.mouseLeaveHandler=null,this.pointerLeaveHandler=null,this.blurHandler=null,this.dragTimeoutId=null,this.mouseLeaveTimeout=null,this.pointerLeaveTimeout=null,this.isStoppingDrag=!1,this.hasLoggedIframeWarning=!1,this.sideAttach=!0,this.sideHideRatio=.5,this.magnetic=!0,this.magneticDirection="x",this.margin=10,this.isAttachedToSide=!1,this.attachedSide="",this.autoAttachDelay=3e3,this.autoAttachTimer=null,this.iconPosition=A||null,this.debug=e,this.target=t||null,n&&(this.sideAttach=void 0===n.sideAttach||n.sideAttach,this.sideHideRatio=void 0!==n.sideHideRatio?n.sideHideRatio:.5,this.magnetic=void 0===n.magnetic||n.magnetic,this.magneticDirection=n.magneticDirection||"x",this.margin=void 0!==n.margin?n.margin:10,this.autoAttachDelay=void 0!==n.autoAttachDelay?n.autoAttachDelay:3e3)}async show(){if(this.iconElement)return;this.iconElement=document.createElement("div"),this.iconElement.className="customer-sdk-icon";const A={position:"absolute",width:"30px",height:"30px",backgroundColor:"transparent",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:"1000002",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",userSelect:"none",transition:"transform 0.2s ease",border:"none",outline:"none",overflow:"visible",pointerEvents:"none"};if(this.iconPosition)void 0!==this.iconPosition.x?(A.left="number"==typeof this.iconPosition.x?`${this.iconPosition.x}px`:this.iconPosition.x,A.right="auto"):A.right="20px",void 0!==this.iconPosition.y?(A.top="number"==typeof this.iconPosition.y?`${this.iconPosition.y}px`:this.iconPosition.y,A.bottom="auto"):A.bottom="80px";else if(this.sideAttach&&this.magnetic){const e=30*this.sideHideRatio;A.right=`-${e}px`,A.left="auto",A.bottom="80px",A.transform="translateX(0)",this.isAttachedToSide=!0,this.attachedSide="right"}else A.bottom="80px",A.right="20px";if(this.sideAttach&&this.isAttachedToSide&&this.attachedSide){const e=30*this.sideHideRatio;"left"===this.attachedSide?(A.left=`-${e}px`,A.right="auto",A.transform="translateX(0)"):"right"===this.attachedSide&&(A.right=`-${e}px`,A.left="auto",A.transform="translateX(0)")}Object.assign(this.iconElement.style,A);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.debug&&console.log("Icon image loaded successfully"),this.iconElement&&(e.style.opacity="1",e.style.visibility="visible")},e.onerror=A=>{console.error("Failed to load icon image",A)},e.style.opacity="1",e.style.visibility="visible";const t=document.createElement("div");Object.assign(t.style,{width:"100%",height:"100%",borderRadius:"50%",overflow:"hidden",position:"relative",pointerEvents:"auto"}),t.appendChild(e),this.iconElement.appendChild(t);const n=this.getTargetElement();if(this.debug&&console.log("[IconManager] Target element for icon:",{target:this.target,targetElement:n,targetElementId:n.id,targetElementClass:n.className,isBody:n===document.body}),this.sideAttach&&n!==document.body){const A=window.getComputedStyle(n),e=A.overflowX,t=A.overflowY;"hidden"!==e&&(n.dataset.originalOverflowX||(n.dataset.originalOverflowX=e||"visible",n.dataset.originalOverflowY=t||"visible"),n.style.overflowX="hidden","visible"===t&&(n.style.overflowY="auto"),this.debug&&console.log("[IconManager] Set overflow-x: hidden on target container",{target:this.target,originalOverflowX:e,originalOverflowY:t}))}n?(n.appendChild(this.iconElement),this.debug&&console.log("[IconManager] Icon added to target element:",{target:this.target,targetElement:n,targetElementId:n.id,targetElementClass:n.className})):(document.body.appendChild(this.iconElement),this.debug&&console.warn("[IconManager] Target element not found, icon added to document.body")),this.setupDragEvents(),this.magnetic&&!this.iconPosition&&setTimeout(()=>{if(this.iconElement){const A=this.getTargetElement();if(A){const e=A.getBoundingClientRect(),t=this.iconElement.offsetWidth||30,n=this.iconElement.offsetHeight||30,r=20,o=80,i=e.width-t-r,s=e.height-n-o;if(this.iconElement.style.left=`${i}px`,this.iconElement.style.top=`${s}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.sideAttach){this.isAttachedToSide=!0,this.attachedSide="right";const A=t*this.sideHideRatio;this.iconElement.style.right=`-${A}px`,this.iconElement.style.left="auto",this.iconElement.style.bottom=`${o}px`,this.iconElement.style.top="auto",this.iconElement.style.transform="translateX(0)",this.iconElement.style.transition="all 0.3s ease",this.debug&&console.log("[IconManager] Auto side attach on init",{isAttachedToSide:this.isAttachedToSide,attachedSide:this.attachedSide,hideDistance:A,right:`-${A}px`})}else this.magneticSnap(),this.debug&&console.log("[IconManager] Auto magnetic snap on init",{isAttachedToSide:this.isAttachedToSide,attachedSide:this.attachedSide})}}},200),this.sideAttach&&this.autoAttachDelay>0&&!this.isAttachedToSide&&setTimeout(()=>{this.startAutoAttachTimer()},300),this.debug&&console.log("CustomerSDK icon displayed")}forceCleanupDragEvents(){this.cleanupDragEvents()}hide(){if(this.cleanupDragEvents(),this.clearAutoAttachTimer(),this.iconElement){const A=window.getComputedStyle(this.iconElement),e=A.left,t=A.top;if("auto"!==e&&"auto"!==t&&""!==e&&""!==t){const A=parseFloat(e),n=parseFloat(t);isNaN(A)||isNaN(n)||(this.iconPosition={x:A,y:n},this.debug&&console.log("Icon position saved before hide:",this.iconPosition))}this.iconElement.remove(),this.iconElement=null,this.debug&&console.log("CustomerSDK icon hidden")}}setPosition(A){}setIconPosition(A){this.iconPosition=A,this.iconElement&&(void 0!==A.x&&(this.iconElement.style.left="number"==typeof A.x?`${A.x}px`:A.x,this.iconElement.style.right="auto"),void 0!==A.y&&(this.iconElement.style.top="number"==typeof A.y?`${A.y}px`:A.y,this.iconElement.style.bottom="auto"))}setStyle(A){}startAutoAttachTimer(){this.clearAutoAttachTimer(),this.isAttachedToSide||(this.autoAttachTimer=window.setTimeout(()=>{!this.iconElement||this.isDragging||this.dragStarted||this.autoAttachToSide(),this.autoAttachTimer=null},this.autoAttachDelay),this.debug&&console.log(`[IconManager] Auto attach timer started, will attach in ${this.autoAttachDelay}ms`))}clearAutoAttachTimer(){null!==this.autoAttachTimer&&(window.clearTimeout(this.autoAttachTimer),this.autoAttachTimer=null,this.debug&&console.log("[IconManager] Auto attach timer cleared"))}autoAttachToSide(){if(this.iconElement&&this.sideAttach)try{const A=this.getTargetElement();if(!A)return;const e=A.getBoundingClientRect(),t=this.iconElement.offsetWidth||30,n=window.getComputedStyle(this.iconElement),r=parseFloat(n.left)||0,o=n.right,i=e.width;let s=!0;if("auto"!==o&&""!==o){const A=parseFloat(o);if(!isNaN(A)){s=i-t-A>=i/2}}else s=r>=i/2;if(s){this.isAttachedToSide=!0,this.attachedSide="right";const A=t*this.sideHideRatio;this.iconElement.style.right=`-${A}px`,this.iconElement.style.left="auto"}else{this.isAttachedToSide=!0,this.attachedSide="left";const A=t*this.sideHideRatio;this.iconElement.style.left=`-${A}px`,this.iconElement.style.right="auto"}const a=window.getComputedStyle(this.iconElement);"auto"!==a.top&&""!==a.top?(this.iconElement.style.top=a.top,this.iconElement.style.bottom="auto"):"auto"!==a.bottom&&""!==a.bottom&&(this.iconElement.style.bottom=a.bottom,this.iconElement.style.top="auto"),this.iconElement.style.transform="translateX(0)",this.iconElement.style.transition="all 0.3s ease",this.debug&&console.log("[IconManager] Auto attached to side",{attachedSide:this.attachedSide,hideDistance:t*this.sideHideRatio})}catch(A){this.debug&&console.error("[IconManager] Error in autoAttachToSide:",A)}}onClick(A){this.onClickCallback=A}onNotification(A){this.notificationCallback=A}showNotification(A){if(!this.iconElement)return void(this.debug&&console.warn("Icon not displayed, cannot show notification"));const{showBadge:e=!0,badgeCount:t=0,badgeText:n="",pulse:r=!1}=A;(e||t>0)&&this.createBadge(t,n,r),this.notificationCallback&&this.notificationCallback({badgeCount:t,badgeText:n,pulse:r}),this.debug&&console.log("Notification shown:",{badgeCount:t,badgeText:n})}clearNotification(){this.badgeElement&&(this.badgeElement.remove(),this.badgeElement=null),this.debug&&console.log("Notification cleared")}setupDragEvents(){this.iconElement&&(this.startDragHandler=this.startDrag.bind(this),this.onDragHandler=this.onDrag.bind(this),this.stopDragHandler=this.stopDrag.bind(this),this.iconElement.addEventListener("mousedown",this.startDragHandler),this.iconElement.addEventListener("touchstart",this.startDragHandler,{passive:!1}))}isSDKIframeOpen(){if(!(window.innerWidth>768))return!1;const A=document.querySelector(".customer-sdk-container");if(!A)return this.debug&&console.log("[IconManager] [PC+iframe] SDK iframe container not found"),!1;const e=window.getComputedStyle(A),t=e.visibility,n=e.opacity,r=e.display,o="visible"===t&&parseFloat(n)>0&&"none"!==r;return this.debug&&console.log("[IconManager] [PC+iframe] Checking SDK iframe visibility:",{visibility:t,opacity:n,display:r,isVisible:o,parsedOpacity:parseFloat(n)}),o}startDrag(A){if(!this.iconElement||!this.isClickEnabled)return;const e="touches"in A?A.touches[0].clientX:A.clientX,t="touches"in A?A.touches[0].clientY:A.clientY;if(this.isSDKIframeOpen())return this.debug&&console.log("[IconManager] [PC+iframe] SDK iframe is open, icon dragging disabled, but click is allowed"),this.touchStartTime=Date.now(),this.lastTouchPosition.x=e,this.lastTouchPosition.y=t,this.hasMoved=!1,this.dragIntent=!1,this.dragStarted=!1,this.isDragging=!1,void(this.stopDragHandler&&(document.addEventListener("mouseup",this.stopDragHandler),document.addEventListener("touchend",this.stopDragHandler)));const n=window.innerWidth>768;if(n&&this.isMouseOverIframe(e,t))return this.debug&&console.log("[IconManager] [PC+iframe] Mouse is over iframe, icon dragging disabled, but click is allowed",{clientX:e,clientY:t,isPC:n}),this.touchStartTime=Date.now(),this.lastTouchPosition.x=e,this.lastTouchPosition.y=t,this.hasMoved=!1,this.dragIntent=!1,this.dragStarted=!1,this.isDragging=!1,void(this.stopDragHandler&&(document.addEventListener("mouseup",this.stopDragHandler),document.addEventListener("touchend",this.stopDragHandler)));if(this.clearAutoAttachTimer(),this.isStoppingDrag)return void(this.debug&&console.warn("[IconManager] startDrag called while stopping, ignoring"));if(this.isDragging||this.dragStarted)return void(this.debug&&console.warn("[IconManager] startDrag called but already dragging, ignoring",{isDragging:this.isDragging,dragStarted:this.dragStarted}));this.hasLoggedIframeWarning=!1,null===this.dragTimeoutId&&null===this.activeDetectionRafId&&null===this.rafId||(this.debug&&console.warn("[IconManager] startDrag found leftover resources, cleaning up",{hasTimeout:null!==this.dragTimeoutId,hasActiveDetection:null!==this.activeDetectionRafId,hasRaf:null!==this.rafId}),this.cleanupDragEvents());const r=A.target;if(!r||!("IFRAME"===r.tagName||r.closest("iframe")||r.closest(".customer-sdk-container")||r.closest(".customer-sdk-overlay"))){if(this.iconElement){const A=this.iconElement.getBoundingClientRect(),n=A.left+A.width/2,r=A.top+A.height/2,o=Math.min(A.width,A.height)/2,i=Math.sqrt(Math.pow(e-n,2)+Math.pow(t-r,2));if(i>o+10)return void(this.debug&&console.log("[IconManager] Touch point outside icon circle, allowing event to pass through",{distance:i,radius:o,touchPoint:{x:e,y:t},iconCenter:{x:n,y:r}}))}A.preventDefault(),A.stopPropagation(),this.iconElement&&(this.iconElement.style.pointerEvents="auto"),this.hasMoved=!1,this.dragStarted=!1,this.isDragging=!1,this.dragIntent=!0,this.touchStartTime=Date.now(),this.lastMousePosition={x:e,y:t,timestamp:Date.now()},this.lastTouchPosition.x=e,this.lastTouchPosition.y=t;try{const A=this.iconElement.getBoundingClientRect();if(!this.getTargetElement())return void(this.debug&&console.warn("Container not found"));this.dragOffset.x=e-A.left,this.dragOffset.y=t-A.top;const n=document.querySelectorAll("iframe");this.cachedIframes=Array.from(n).filter(A=>!A.closest(".customer-sdk-container")).map(A=>({element:A,rect:A.getBoundingClientRect()})),this.lastIframeUpdateTime=Date.now(),this.debug&&console.log(`[IconManager] Drag start - Found ${this.cachedIframes.length} iframe(s) (excluding SDK iframes)`,{iframes:this.cachedIframes.map(({rect:A})=>({left:A.left,top:A.top,right:A.right,bottom:A.bottom,width:A.width,height:A.height}))}),this.onDragHandler&&(document.addEventListener("mousemove",this.onDragHandler),document.addEventListener("touchmove",this.onDragHandler,{passive:!1})),this.stopDragHandler&&(document.addEventListener("mouseup",this.stopDragHandler),document.addEventListener("touchend",this.stopDragHandler)),this.mouseLeaveHandler=A=>{(A.clientY<-10||A.clientX<-10||A.clientX>window.innerWidth+10||A.clientY>window.innerHeight+10)&&!this.isMouseOverIframe(A.clientX,A.clientY)&&(this.mouseLeaveTimeout&&clearTimeout(this.mouseLeaveTimeout),this.mouseLeaveTimeout=window.setTimeout(()=>{!this.isDragging&&!this.dragStarted||this.isStoppingDrag||this.isMouseOverIframe(A.clientX,A.clientY)||(this.debug&&console.log("[IconManager] Mouse left window, stopping drag"),this.stopDrag()),this.mouseLeaveTimeout=null},100))},this.pointerLeaveHandler=A=>{(A.clientY<-10||A.clientX<-10||A.clientX>window.innerWidth+10||A.clientY>window.innerHeight+10)&&!this.isMouseOverIframe(A.clientX,A.clientY)&&(this.pointerLeaveTimeout&&clearTimeout(this.pointerLeaveTimeout),this.pointerLeaveTimeout=window.setTimeout(()=>{!this.isDragging&&!this.dragStarted||this.isStoppingDrag||this.isMouseOverIframe(A.clientX,A.clientY)||(this.debug&&console.log("[IconManager] Pointer left window, stopping drag"),this.stopDrag()),this.pointerLeaveTimeout=null},100))},document.addEventListener("mouseleave",this.mouseLeaveHandler),document.addEventListener("pointerleave",this.pointerLeaveHandler),this.blurHandler=()=>{this.isStoppingDrag||(this.isDragging||this.dragStarted)&&(this.debug&&console.log("[IconManager] Window lost focus, stopping drag"),this.stopDrag())},window.addEventListener("blur",this.blurHandler);const r=window.innerWidth>768,o=this.isMouseOverIframe(e,t);if(r)if(o){const A=()=>{const e=this.lastMousePosition;if(e&&this.isMouseOverIframe(e.x,e.y)&&(this.dragIntent||this.dragStarted||this.isDragging)){if(this.debug){const A=Date.now()-this.lastMousePosition.timestamp;console.log("[IconManager] [PC+iframe] Drag timeout but mouse is over iframe, keeping drag active (waiting for mouseup)",{timeSinceLastMove:A,lastMousePosition:this.lastMousePosition})}this.dragTimeoutId=window.setTimeout(A,5e3)}else(this.isDragging||this.dragStarted)&&this.dragStarted&&(this.debug&&console.warn("[IconManager] [PC+iframe] Drag timeout triggered, stopping drag"),this.stopDrag())};this.dragTimeoutId=window.setTimeout(A,5e3)}else this.dragTimeoutId=window.setTimeout(()=>{this.isDragging&&this.dragStarted&&(this.debug&&console.log("Drag timeout, stopping drag (likely mouse moved over iframe)"),this.stopDrag())},50);else if(o){const A=()=>{const e=this.lastMousePosition;if(e&&this.isMouseOverIframe(e.x,e.y)&&(this.dragIntent||this.dragStarted||this.isDragging)){if(this.debug){const A=Date.now()-this.lastMousePosition.timestamp;console.log("[IconManager] [Mobile+iframe] Drag timeout but mouse is over iframe, keeping drag active (waiting for mouseup)",{timeSinceLastMove:A,lastMousePosition:this.lastMousePosition})}this.dragTimeoutId=window.setTimeout(A,3e3)}else(this.isDragging||this.dragStarted)&&this.dragStarted&&(this.debug&&console.warn("[IconManager] [Mobile+iframe] Drag timeout triggered, stopping drag"),this.stopDrag())};this.dragTimeoutId=window.setTimeout(A,3e3)}else this.dragTimeoutId=window.setTimeout(()=>{this.isDragging&&this.dragStarted&&(this.debug&&console.log("Drag timeout, stopping drag (likely mouse moved over iframe)"),this.stopDrag())},50);this.startActiveDetection(),this.debug&&console.log("[IconManager] Drag start",{startPosition:{x:e,y:t},iconRect:{left:A.left,top:A.top,width:A.width,height:A.height},dragOffset:this.dragOffset})}catch(A){this.debug&&console.error("Error in startDrag:",A)}}}onDrag(A){if(!this.iconElement)return;const e="touches"in A?A.touches[0].clientX:A.clientX,t="touches"in A?A.touches[0].clientY:A.clientY,n=this.isSDKIframeOpen();if(this.debug&&console.log("[IconManager] [PC+iframe] Checking SDK iframe status:",{isSDKOpen:n,windowWidth:window.innerWidth,isPC:window.innerWidth>768}),n)return void(this.debug&&console.log("[IconManager] [PC+iframe] SDK iframe is open, blocking drag - returning immediately"));const r=window.innerWidth>768;if(r&&this.isMouseOverIframe(e,t))return void(this.debug&&console.log("[IconManager] [PC+iframe] Mouse is over iframe, blocking drag - returning immediately",{clientX:e,clientY:t,isPC:r}));if(A.preventDefault(),this.debug&&console.log("[IconManager] onDrag called",{clientPosition:{x:e,y:t},isDragging:this.isDragging,dragStarted:this.dragStarted}),this.isDragging||this.dragIntent||this.dragStarted){const A=Date.now();if(0===this.cachedIframes.length||A-this.lastIframeUpdateTime>this.iframeUpdateInterval){const e=document.querySelectorAll("iframe"),t=this.cachedIframes.length;this.cachedIframes=Array.from(e).filter(A=>!A.closest(".customer-sdk-container")).map(A=>({element:A,rect:A.getBoundingClientRect()})),this.lastIframeUpdateTime=A,this.debug&&this.cachedIframes.length!==t&&console.log(`[IconManager] Iframe cache updated - Found ${this.cachedIframes.length} iframe(s) (excluding SDK iframes)`,{iframes:this.cachedIframes.map(({rect:A})=>({left:A.left,top:A.top,right:A.right,bottom:A.bottom}))})}}const o=Date.now(),i=o-this.lastMousePosition.timestamp,s=this.lastMousePosition.x,a=this.lastMousePosition.y,c=this.lastMousePosition.timestamp;if(this.lastMousePosition={x:e,y:t,timestamp:o},c>0&&i>0&&i<100){const A=i/1e3;this.mouseVelocity.vx=(e-s)/A,this.mouseVelocity.vy=(t-a)/A,this.mouseVelocity.vx=Math.max(-2e3,Math.min(2e3,this.mouseVelocity.vx)),this.mouseVelocity.vy=Math.max(-2e3,Math.min(2e3,this.mouseVelocity.vy))}if(this.debug&&i>50&&this.lastMousePosition.timestamp>0&&console.warn(`[IconManager] Long gap between mousemove events: ${i}ms`,{lastPosition:{x:s,y:a},currentPosition:{x:e,y:t},velocity:{vx:this.mouseVelocity.vx,vy:this.mouseVelocity.vy}}),null!==this.dragTimeoutId){window.clearTimeout(this.dragTimeoutId);const A=window.innerWidth>768,n=this.isMouseOverIframe(e,t);if(A);else if(n){const A=()=>{const e=this.lastMousePosition;if(e&&this.isMouseOverIframe(e.x,e.y)&&(this.dragIntent||this.dragStarted||this.isDragging)){if(this.debug){const A=Date.now()-this.lastMousePosition.timestamp;console.log("[IconManager] [Mobile+iframe] Drag timeout but mouse is over iframe, keeping drag active (waiting for mouseup)",{timeSinceLastMove:A,lastMousePosition:this.lastMousePosition})}this.dragTimeoutId=window.setTimeout(A,3e3)}else(this.isDragging||this.dragStarted)&&(this.debug&&console.warn("[IconManager] [Mobile+iframe] Drag timeout triggered, stopping drag"),this.stopDrag())};this.dragTimeoutId=window.setTimeout(A,3e3)}else this.dragTimeoutId=window.setTimeout(()=>{if(this.isDragging){if(this.debug){const A=Date.now()-this.lastMousePosition.timestamp;console.warn("[IconManager] [Mobile] Drag timeout triggered, stopping drag",{timeSinceLastMove:A,lastMousePosition:this.lastMousePosition,iframeCount:this.cachedIframes.length})}this.stopDrag()}},200)}const l=Math.abs(e-this.lastTouchPosition.x),u=Math.abs(t-this.lastTouchPosition.y);if(Math.sqrt(l*l+u*u)>this.clickThreshold&&(this.hasMoved=!0,!this.dragStarted)){this.dragStarted=!0,this.isDragging=!0,this.isAttachedToSide&&(this.isAttachedToSide=!1,this.attachedSide="",this.iconElement&&(this.iconElement.style.transform=""));const A=window.getComputedStyle(this.iconElement);if("auto"!==A.right||"auto"!==A.bottom){const A=this.iconElement.getBoundingClientRect(),n=this.getTargetElement();if(n){const r=n.getBoundingClientRect(),o=A.left-r.left,i=A.top-r.top;this.iconElement.style.left=`${o}px`,this.iconElement.style.top=`${i}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.dragOffset.x=e-A.left,this.dragOffset.y=t-A.top}}this.iconElement.style.transition="none",this.iconElement.style.cursor="grabbing",this.debug&&console.log("Drag started (moved > threshold)")}if(this.isDragging||this.dragIntent||this.dragStarted)try{const A=Date.now(),n=this.getTargetElement();if(!n)return;(!this.cachedContainer||this.cachedContainer!==n||A-this.lastContainerUpdateTime>this.containerUpdateInterval)&&(this.cachedContainer=n,this.cachedContainerRect=n.getBoundingClientRect(),this.cachedIconSize={width:this.iconElement.offsetWidth,height:this.iconElement.offsetHeight},this.lastContainerUpdateTime=A);const r=this.cachedContainerRect,o=this.cachedIconSize.width,i=this.cachedIconSize.height,s=window.getComputedStyle(n).maxWidth,a=s&&"none"!==s?Math.min(r.width,parseFloat(s)||r.width):r.width,c=r.height;if(0===this.dragOffset.x&&0===this.dragOffset.y&&(this.dragIntent||this.dragStarted)&&this.iconElement&&!this.dragStarted){const A=this.iconElement.getBoundingClientRect();this.dragOffset.x=e-A.left,this.dragOffset.y=t-A.top,this.debug&&console.log("[IconManager] Calculated dragOffset in onDrag (fallback)",{dragOffset:this.dragOffset,clientPosition:{x:e,y:t},iconRect:A,dragStarted:this.dragStarted,dragIntent:this.dragIntent})}let l=e-this.dragOffset.x-r.left,u=t-this.dragOffset.y-r.top;const h=5-o,g=n===document.body?window.innerWidth-5:a+o-5,d=5-i,B=n===document.body?window.innerHeight-5:c+i-5;l=Math.max(h,Math.min(l,g)),u=Math.max(d,Math.min(u,B));const f=window.innerWidth>768,w=this.isMouseOverIframe(e,t);if(this.iconElement){if(this.dragIntent&&0===this.dragOffset.x&&0===this.dragOffset.y){const A=this.iconElement.getBoundingClientRect(),n={x:this.dragOffset.x,y:this.dragOffset.y};this.dragOffset.x=e-A.left,this.dragOffset.y=t-A.top,this.debug&&f&&console.log("[IconManager] [PC+iframe] Calculated dragOffset",{oldDragOffset:n,newDragOffset:{x:this.dragOffset.x,y:this.dragOffset.y},clientPosition:{x:e,y:t},iconRect:A,isOverIframe:w})}else this.debug&&f&&this.dragStarted&&0===this.dragOffset.x&&0===this.dragOffset.y&&console.warn("[IconManager] [PC] dragOffset is 0 but dragStarted is true! This should not happen.",{dragStarted:this.dragStarted,dragIntent:this.dragIntent,isDragging:this.isDragging,isOverIframe:w});if(w&&this.dragIntent&&!this.dragStarted&&(this.dragStarted=!0,this.isDragging=!0,this.hasMoved=!0),this.iconElement.style.left=`${l}px`,this.iconElement.style.top=`${u}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.debug&&f){const A=e-this.dragOffset.x-r.left,n=t-this.dragOffset.y-r.top;console.log("[IconManager] [PC+iframe] Icon position:",{x:l,y:u,isOverIframe:w,clientX:e,clientY:t,dragOffset:{x:this.dragOffset.x,y:this.dragOffset.y},containerLeft:r.left,containerTop:r.top,calculatedX:A,calculatedY:n,minX:h,maxX:g,actualWidth:a}),(Math.abs(A-l)>1||Math.abs(n-u)>1)&&console.warn("[IconManager] [PC+iframe] Position calculation mismatch!",{calculated:{x:A,y:n},actual:{x:l,y:u},dragOffset:{x:this.dragOffset.x,y:this.dragOffset.y},containerRect:{left:r.left,top:r.top},clientPosition:{x:e,y:t}})}}f?this.dragTimeoutId=w?window.setTimeout(()=>{this.isDragging&&this.dragStarted&&this.stopDrag()},5e3):window.setTimeout(()=>{this.isDragging&&this.dragStarted&&this.stopDrag()},50):w?this.iconElement&&(this.iconElement.style.left=`${l}px`,this.iconElement.style.top=`${u}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto"):(this.pendingPosition.x=l,this.pendingPosition.y=u,this.pendingPosition.needsUpdate=!0,null===this.rafId&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.pendingPosition.needsUpdate&&this.iconElement&&this.isDragging&&(this.iconElement.style.left=`${this.pendingPosition.x}px`,this.iconElement.style.top=`${this.pendingPosition.y}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.pendingPosition.needsUpdate=!1)}))),this.lastTouchPosition.x=e,this.lastTouchPosition.y=t,this.lastMousePosition.x=e,this.lastMousePosition.y=t,this.lastMousePosition.timestamp=Date.now()}catch(A){this.debug&&console.error("Error in onDrag:",A)}}updateIconPositionFromMouse(A,e){if(this.iconElement&&(this.isDragging||this.dragIntent||this.dragStarted)){if(0===this.dragOffset.x&&0===this.dragOffset.y){if(!this.dragStarted||!this.iconElement)return;{const t=this.iconElement.getBoundingClientRect();this.dragOffset.x=A-t.left,this.dragOffset.y=e-t.top}}try{const t=this.getTargetElement();if(!t)return;const n=t.getBoundingClientRect(),r=this.iconElement.offsetWidth,o=this.iconElement.offsetHeight,i=t===document.body?window.innerWidth:t.offsetWidth,s=t===document.body?window.innerHeight:t.offsetHeight;let a=A-this.dragOffset.x-n.left,c=e-this.dragOffset.y-n.top;const l=5-r,u=t===document.body?window.innerWidth-5:i+r-5,h=5-o,g=t===document.body?window.innerHeight-5:s+o-5;if(a=Math.max(l,Math.min(a,u)),c=Math.max(h,Math.min(c,g)),this.iconElement&&(this.iconElement.style.left=`${a}px`,this.iconElement.style.top=`${c}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.debug)){const t=Date.now()-this.lastMousePosition.timestamp;console.log("[IconManager] [PC+iframe] Updated icon position in startActiveDetection",{mousePosition:{x:A,y:e},iconPosition:{x:a,y:c},timeSinceLastMove:t,lastMousePosition:this.lastMousePosition})}}catch(A){this.debug&&console.error("[IconManager] Error in updateIconPositionFromMouse:",A)}}}stopDrag(A){if(this.isStoppingDrag)return void(this.debug&&console.warn("[IconManager] stopDrag already in progress, ignoring duplicate call"));const e=this.touchStartTime>0&&!this.isDragging&&!this.dragStarted&&!this.hasMoved;if(!(this.isDragging||this.dragStarted||this.dragTimeoutId||this.activeDetectionRafId||e))return this.debug&&console.warn("[IconManager] stopDrag called but not dragging and not a click, ignoring"),void(this.stopDragHandler&&(document.removeEventListener("mouseup",this.stopDragHandler),document.removeEventListener("touchend",this.stopDragHandler)));if(this.isStoppingDrag=!0,A&&this.dragStarted&&this.iconElement){const e="clientX"in A?A.clientX:A.touches?.[0]?.clientX??A.changedTouches?.[0]?.clientX??0,t="clientY"in A?A.clientY:A.touches?.[0]?.clientY??A.changedTouches?.[0]?.clientY??0;if(e>0&&t>0){this.isMouseOverIframe(e,t)&&(this.lastMousePosition={x:e,y:t,timestamp:Date.now()},this.updateIconPositionFromMouse(e,t),this.debug&&console.log("[IconManager] [PC+iframe] Updated icon position from mouseup event",{mousePosition:{x:e,y:t},iconPosition:this.iconElement?{left:this.iconElement.style.left,top:this.iconElement.style.top}:null}))}}const t=this.isDragging?"drag_stopped":"not_dragging",n=this.iconElement?{left:this.iconElement.style.left,top:this.iconElement.style.top,computed:"auto"!==window.getComputedStyle(this.iconElement).left?{left:window.getComputedStyle(this.iconElement).left,top:window.getComputedStyle(this.iconElement).top}:null}:null;if(this.cleanupDragEvents(),!this.iconElement)return this.hasMoved=!1,this.isDragging=!1,this.dragStarted=!1,this.dragIntent=!1,void(this.isStoppingDrag=!1);this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer",this.iconElement.style.pointerEvents="none";const r=Date.now()-this.touchStartTime,o=!this.hasMoved&&r<1e3&&!this.dragStarted&&!this.isDragging&&(!this.dragIntent||r<200);this.debug&&console.log("[IconManager] Drag end",{stopReason:t,hasMoved:this.hasMoved,dragStarted:this.dragStarted,touchDuration:r,isValidClick:o,finalPosition:n,lastMousePosition:this.lastMousePosition});const i=o,s=this.stoppedByIframe;if(this.stoppedByIframe)this.debug&&console.log("[IconManager] Drag stopped by iframe, skipping magnetic snap and auto attach");else if(this.dragStarted&&this.magnetic&&this.iconElement&&this.magneticSnap(),this.dragStarted&&this.isDragging&&this.iconElement){const A=window.getComputedStyle(this.iconElement),e=A.left,t=A.top;if("auto"!==e&&"auto"!==t){const A=parseFloat(e),n=parseFloat(t);isNaN(A)||isNaN(n)||(this.iconPosition={x:A,y:n},this.debug&&console.log("Icon position saved:",this.iconPosition))}}this.hasMoved=!1,this.isDragging=!1,this.dragStarted=!1,this.dragIntent=!1,this.isStoppingDrag=!1,this.stoppedByIframe=!1,this.hasLoggedIframeWarning=!1,!s&&!this.isAttachedToSide&&this.sideAttach&&this.autoAttachDelay>0&&this.startAutoAttachTimer(),i&&setTimeout(()=>{!this.isClickEnabled||this.dragStarted||this.hasMoved||this.isDragging||this.handleClick()},100)}startActiveDetection(){if(null!==this.activeDetectionRafId)return void(this.debug&&console.log("[IconManager] Active detection already running"));this.debug&&console.log("[IconManager] Starting active detection mechanism");const A=()=>{if(this.isStoppingDrag||!this.isDragging&&!this.dragStarted&&!this.dragIntent)return this.debug&&console.log("[IconManager] Active detection stopped (drag ended or stopping)",{isDragging:this.isDragging,dragStarted:this.dragStarted,dragIntent:this.dragIntent,isStoppingDrag:this.isStoppingDrag}),this.activeDetectionRafId=null,void(null!==this.activeDetectionTimeoutId&&(window.clearTimeout(this.activeDetectionTimeoutId),this.activeDetectionTimeoutId=null));const e=Date.now(),t=e-this.lastMousePosition.timestamp;if(t>100){const A=this.lastMousePosition.x,n=this.lastMousePosition.y;if(0===this.cachedIframes.length||e-this.lastIframeUpdateTime>this.iframeUpdateInterval){const A=document.querySelectorAll("iframe");this.cachedIframes=Array.from(A).filter(A=>!A.closest(".customer-sdk-container")).map(A=>({element:A,rect:A.getBoundingClientRect()})),this.lastIframeUpdateTime=e}this.isMouseOverIframe(A,n)&&(!this.isDragging&&this.dragStarted&&(this.isDragging=!0,this.debug&&console.log("[IconManager] [PC+iframe] Active detection: Mouse over iframe, keeping drag state active (waiting for mouseup)")),this.debug&&t>500&&!this.hasLoggedIframeWarning&&(console.warn("[IconManager] [PC+iframe] Mouse entered iframe - mousemove events lost. Icon position frozen at last known position. Will update on mouseup.",{timeSinceLastMove:t,lastMousePosition:{x:this.lastMousePosition.x,y:this.lastMousePosition.y},note:"This is a browser security limitation. Icon will update to final position when mouse is released (mouseup event)."}),this.hasLoggedIframeWarning=!0))}const n=t>100&&this.isMouseOverIframe(this.lastMousePosition.x,this.lastMousePosition.y)?16:100;this.activeDetectionTimeoutId=window.setTimeout(()=>{this.activeDetectionTimeoutId=null,requestAnimationFrame(A)},n)};this.activeDetectionRafId=requestAnimationFrame(A)}stopActiveDetection(){null!==this.activeDetectionRafId&&(this.debug&&console.log("[IconManager] Stopping active detection mechanism"),cancelAnimationFrame(this.activeDetectionRafId),this.activeDetectionRafId=null)}isMouseOverIframe(A,e){const t=Date.now();if(0===this.cachedIframes.length||t-this.lastIframeUpdateTime>this.iframeUpdateInterval){const A=document.querySelectorAll("iframe");this.cachedIframes=Array.from(A).filter(A=>!A.closest(".customer-sdk-container")).map(A=>({element:A,rect:A.getBoundingClientRect()})),this.lastIframeUpdateTime=t}for(const{rect:t}of this.cachedIframes)if(A>=t.left&&A<=t.right&&e>=t.top&&e<=t.bottom)return!0;return!1}cleanupDragEvents(){this.onDragHandler&&(document.removeEventListener("mousemove",this.onDragHandler),document.removeEventListener("touchmove",this.onDragHandler)),this.stopDragHandler&&(document.removeEventListener("mouseup",this.stopDragHandler),document.removeEventListener("touchend",this.stopDragHandler)),this.mouseLeaveHandler&&(document.removeEventListener("mouseleave",this.mouseLeaveHandler),this.mouseLeaveHandler=null),this.pointerLeaveHandler&&(document.removeEventListener("pointerleave",this.pointerLeaveHandler),this.pointerLeaveHandler=null),this.blurHandler&&(window.removeEventListener("blur",this.blurHandler),this.blurHandler=null),null!==this.mouseLeaveTimeout&&(window.clearTimeout(this.mouseLeaveTimeout),this.mouseLeaveTimeout=null),null!==this.pointerLeaveTimeout&&(window.clearTimeout(this.pointerLeaveTimeout),this.pointerLeaveTimeout=null),null!==this.dragTimeoutId&&(window.clearTimeout(this.dragTimeoutId),this.dragTimeoutId=null),null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.stopActiveDetection(),null!==this.activeDetectionRafId&&(this.debug&&console.warn("[IconManager] Active detection RAF ID still exists, force cleaning"),cancelAnimationFrame(this.activeDetectionRafId),this.activeDetectionRafId=null),this.cachedContainer=null,this.cachedContainerRect=null,this.cachedIframes=[],this.pendingPosition.needsUpdate=!1,this.debug&&console.log("[IconManager] Cleanup completed",{isDragging:this.isDragging,dragStarted:this.dragStarted,isStoppingDrag:this.isStoppingDrag,hasTimeout:null!==this.dragTimeoutId,hasActiveDetection:null!==this.activeDetectionRafId,hasRaf:null!==this.rafId})}handleClick(){this.isClickEnabled&&(this.clearAutoAttachTimer(),this.onClickCallback&&this.onClickCallback())}disableClick(){this.isClickEnabled=!1,this.iconElement&&this.startDragHandler&&(this.iconElement.removeEventListener("mousedown",this.startDragHandler),this.iconElement.removeEventListener("touchstart",this.startDragHandler)),this.iconElement&&(this.iconElement.style.pointerEvents="none",this.iconElement.style.cursor="default"),this.forceCleanupDragEvents()}enableClick(){this.isClickEnabled=!0,this.iconElement&&this.startDragHandler?(this.iconElement.addEventListener("mousedown",this.startDragHandler),this.iconElement.addEventListener("touchstart",this.startDragHandler,{passive:!1})):this.iconElement&&this.setupDragEvents(),this.iconElement&&(this.iconElement.style.pointerEvents="auto",this.iconElement.style.cursor="pointer")}magneticSnap(){if(this.iconElement)try{const A=this.getTargetElement();if(!A)return;const e=A.getBoundingClientRect(),t=this.iconElement.offsetWidth||30,n=this.iconElement.offsetHeight||30,r=window.getComputedStyle(A).maxWidth,o=r&&"none"!==r?Math.min(e.width,parseFloat(r)||e.width):e.width,i=window.getComputedStyle(this.iconElement),s=parseFloat(i.left)||0,a=parseFloat(i.top)||0;let c=s,l=a;if("x"===this.magneticDirection||"both"===this.magneticDirection){const A=o;if(s<A/2)if(c=this.margin,this.sideAttach&&s<t/2){this.isAttachedToSide=!0,this.attachedSide="left";c=-(t*this.sideHideRatio)}else this.isAttachedToSide=!1,this.attachedSide="";else if(c=A-t-this.margin,this.sideAttach){if(A-s-t<t/2||isNaN(s)||0===s||s>=A-t-this.margin-t/2){this.isAttachedToSide=!0,this.attachedSide="right";c=A-t*(1-this.sideHideRatio)}else this.isAttachedToSide=!1,this.attachedSide=""}else this.isAttachedToSide=!1,this.attachedSide=""}if("y"===this.magneticDirection||"both"===this.magneticDirection){const A=e.height;l=a<A/2?this.margin:A-n-this.margin}if(this.isAttachedToSide&&"right"===this.attachedSide){const A=t*this.sideHideRatio;this.iconElement.style.right=`-${A}px`,this.iconElement.style.left="auto"}else if(this.isAttachedToSide&&"left"===this.attachedSide){const A=t*this.sideHideRatio;this.iconElement.style.left=`-${A}px`,this.iconElement.style.right="auto"}else this.iconElement.style.left=`${c}px`,this.iconElement.style.right="auto";this.iconElement.style.top=`${l}px`,this.iconElement.style.bottom="auto",this.isAttachedToSide&&this.attachedSide?(this.iconElement.style.transform="translateX(0)",this.iconElement.style.transition="all 0.3s ease"):this.iconElement.style.transform="",this.isAttachedToSide&&"right"===this.attachedSide?this.iconPosition=null:this.iconPosition={x:c,y:l},this.debug&&console.log("[IconManager] Magnetic snap applied",{newPosition:{x:c,y:l},isAttachedToSide:this.isAttachedToSide,attachedSide:this.attachedSide})}catch(A){this.debug&&console.error("[IconManager] Error in magneticSnap:",A)}}getTargetElement(){if(!this.target)return document.body;if("string"==typeof this.target){const A=document.querySelector(this.target);return A||(this.debug&&console.warn(`Target element not found: ${this.target}, falling back to document.body`),document.body)}return this.target instanceof HTMLElement?document.body.contains(this.target)?this.target:(this.debug&&console.warn("Target element no longer in DOM, falling back to document.body"),document.body):document.body}createBadge(A,e="",t=!1){this.clearNotification(),this.badgeElement=document.createElement("div"),this.badgeElement.className="customer-sdk-icon-badge",this.badgeElement.textContent=A>0?A>99?"99+":A.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)",pointerEvents:"auto",...0===A&&""===e&&{width:"12px",height:"12px",minWidth:"12px",top:"-2px",left:"-2px"},...t&&{animation:"sdk-badge-pulse 1.5s infinite"}}),this.iconElement&&this.iconElement.appendChild(this.badgeElement)}}const t="p".charCodeAt(0),n="H".charCodeAt(0),r="Y".charCodeAt(0),o="s".charCodeAt(0);let i;function s(A){let e=-1;i||(i=function(){const A=new Int32Array(256);for(let e=0;e<256;e++){let t=e;for(let A=0;A<8;A++)t=1&t?3988292384^t>>>1:t>>>1;A[e]=t}return A}());for(let t=0;t<A.length;t++)e=i[255&(e^A[t])]^e>>>8;return-1^e}function a(A,e,i=!1){const a=new Uint8Array(13);e*=39.3701,a[0]=t,a[1]=n,a[2]=r,a[3]=o,a[4]=e>>>24,a[5]=e>>>16,a[6]=e>>>8,a[7]=255&e,a[8]=a[4],a[9]=a[5],a[10]=a[6],a[11]=a[7],a[12]=1;const c=s(a),l=new Uint8Array(4);if(l[0]=c>>>24,l[1]=c>>>16,l[2]=c>>>8,l[3]=255&c,i){const e=function(A){for(let e=A.length-1;e>=4;e--)if(9===A[e-4]&&A[e-3]===t&&A[e-2]===n&&A[e-1]===r&&A[e]===o)return e-3;return 0}(A);return A.set(a,e),A.set(l,e+13),A}{const e=new Uint8Array(4);e[0]=0,e[1]=0,e[2]=0,e[3]=9;const t=new Uint8Array(54);return t.set(A,0),t.set(e,33),t.set(a,37),t.set(l,50),t}}const c="[modern-screenshot]",l="undefined"!=typeof window,u=l&&"Worker"in window,h=l&&"atob"in window,g=l&&"btoa"in window,d=l?window.navigator?.userAgent:"",B=d.includes("Chrome"),f=d.includes("AppleWebKit")&&!B,w=d.includes("Firefox"),p=A=>1===A.nodeType,m=A=>"object"==typeof A.className,C=A=>"image"===A.tagName,Q=A=>p(A)&&void 0!==A.style&&!m(A),y=A=>8===A.nodeType,U=A=>"IMG"===A.tagName,F=A=>"VIDEO"===A.tagName,b=A=>"SLOT"===A.tagName;function v(A){const e=A?.createElement?.("canvas");return e&&(e.height=e.width=1),Boolean(e)&&"toDataURL"in e&&Boolean(e.toDataURL("image/webp").includes("image/webp"))}const E=A=>A.startsWith("data:");function H(A,e){if(A.match(/^[a-z]+:\/\//i))return A;if(l&&A.match(/^\/\//))return window.location.protocol+A;if(A.match(/^[a-z]+:/i))return A;if(!l)return A;const t=I().implementation.createHTMLDocument(),n=t.createElement("base"),r=t.createElement("a");return t.head.appendChild(n),t.body.appendChild(r),e&&(n.href=e),r.href=A,r.href}function I(A){return(A&&p(A)?A?.ownerDocument:A)??window.document}const x="http://www.w3.org/2000/svg";const S=A=>function(A,e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.onabort=()=>n(new Error(`Failed read blob to ${e}`)),r.readAsDataURL(A)})}(A,"dataUrl");function L(A,e){const t=I(e).createElement("img");return t.decoding="sync",t.loading="eager",t.src=A,t}function D(A,e){return new Promise(t=>{const{timeout:n,ownerDocument:r,onError:o,onWarn:i}=e??{},s="string"==typeof A?L(A,I(r)):A;let a=null,c=null;function l(){t(s),a&&clearTimeout(a),c?.()}if(n&&(a=setTimeout(l,n)),F(s)){const A=s.currentSrc||s.src;if(!A)return s.poster?D(s.poster,e).then(t):l();if(s.readyState>=2)return l();const n=l,r=e=>{i?.("Failed video load",A,e),o?.(e),l()};c=()=>{s.removeEventListener("loadeddata",n),s.removeEventListener("error",r)},s.addEventListener("loadeddata",n,{once:!0}),s.addEventListener("error",r,{once:!0})}else{const A=C(s)?s.href.baseVal:s.currentSrc||s.src;if(!A)return l();const e=async()=>{if(U(s)&&"decode"in s)try{await s.decode()}catch(e){i?.("Failed to decode image, trying to render anyway",s.dataset.originalSrc||A,e)}l()},t=e=>{i?.("Failed image load",s.dataset.originalSrc||A,e),l()};if(U(s)&&s.complete)return e();c=()=>{s.removeEventListener("load",e),s.removeEventListener("error",t)},s.addEventListener("load",e,{once:!0}),s.addEventListener("error",t,{once:!0})}})}const M=function(){let A=0;return()=>(A+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${A}`)}();function k(A){return A?.split(",").map(A=>A.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}let K=0;function T(A){const e=`${c}[#${K}]`;return K++,{time:t=>A&&console.time(`${e} ${t}`),timeEnd:t=>A&&console.timeEnd(`${e} ${t}`),warn:(...e)=>A&&((...A)=>console.warn(c,...A))(...e)}}async function R(A,e){return(t=A)&&"__CONTEXT__"in t?A:P(A,{...e,autoDestruct:!0});var t}async function P(A,e){const{scale:t=1,workerUrl:n,workerNumber:r=1}=e||{},o=Boolean(e?.debug),i=e?.features??!0,s=A.ownerDocument??(l?window.document:void 0),a=A.ownerDocument?.defaultView??(l?window:void 0),c=new Map,h={width:0,height:0,quality:1,type:"image/png",scale:t,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:o,fetch:{requestInit:(g=e?.fetch?.bypassingCache,{cache:g?"no-cache":"force-cache"}),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...e?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:r,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...e,__CONTEXT__:!0,log:T(o),node:A,ownerDocument:s,ownerWindow:a,dpi:1===t?null:96*t,svgStyleElement:O(s),svgDefsElement:s?.createElementNS(x,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:u&&n&&r?r:0})].map(()=>{try{const A=new Worker(n);return A.onmessage=async A=>{const{url:e,result:t}=A.data;t?c.get(e)?.resolve?.(t):c.get(e)?.reject?.(new Error(`Error receiving message from worker: ${e}`))},A.onmessageerror=A=>{const{url:e}=A.data;c.get(e)?.reject?.(new Error(`Error receiving message from worker: ${e}`))},A}catch(A){return h.log.warn("Failed to new Worker",A),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[v(s)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:c,drawImageCount:0,tasks:[],features:i,isEnable:A=>"restoreScrollPosition"===A?"boolean"!=typeof i&&(i[A]??!1):"boolean"==typeof i?i:i[A]??!0,shadowRoots:[]};var g;h.log.time("wait until load"),await async function(A,e){Q(A)&&(U(A)||F(A)?await D(A,e):await Promise.all(["img","video"].flatMap(t=>Array.from(A.querySelectorAll(t)).map(A=>D(A,e)))))}(A,{timeout:h.timeout,onWarn:h.log.warn}),h.log.timeEnd("wait until load");const{width:d,height:B}=function(A,e){let{width:t,height:n}=e;if(p(A)&&(!t||!n)){const e=A.getBoundingClientRect();t=t||e.width||Number(A.getAttribute("width"))||0,n=n||e.height||Number(A.getAttribute("height"))||0}return{width:t,height:n}}(A,h);return h.width=d,h.height=B,h}function O(A){if(!A)return;const e=A.createElement("style"),t=e.ownerDocument.createTextNode("\n.______background-clip--text {\n background-clip: text;\n -webkit-background-clip: text;\n}\n");return e.appendChild(t),e}async function V(A,e){const{log:t,timeout:n,drawImageCount:r,drawImageInterval:o}=e;t.time("image to canvas");const i=await D(A,{timeout:n,onWarn:e.log.warn}),{canvas:s,context2d:a}=function(A,e){const{width:t,height:n,scale:r,backgroundColor:o,maximumCanvasSize:i}=e,s=A.createElement("canvas");s.width=Math.floor(t*r),s.height=Math.floor(n*r),s.style.width=`${t}px`,s.style.height=`${n}px`,i&&(s.width>i||s.height>i)&&(s.width>i&&s.height>i?s.width>s.height?(s.height*=i/s.width,s.width=i):(s.width*=i/s.height,s.height=i):s.width>i?(s.height*=i/s.width,s.width=i):(s.width*=i/s.height,s.height=i));const a=s.getContext("2d");a&&o&&(a.fillStyle=o,a.fillRect(0,0,s.width,s.height));return{canvas:s,context2d:a}}(A.ownerDocument,e),c=()=>{try{a?.drawImage(i,0,0,s.width,s.height)}catch(A){e.log.warn("Failed to drawImage",A)}};if(c(),e.isEnable("fixSvgXmlDecode"))for(let A=0;A<r;A++)await new Promise(e=>{setTimeout(()=>{a?.clearRect(0,0,s.width,s.height),c(),e()},A+o)});return e.drawImageCount=0,t.timeEnd("image to canvas"),s}function N(A,e){if(A.ownerDocument)try{const e=A.toDataURL();if("data:,"!==e)return L(e,A.ownerDocument)}catch(A){e.log.warn("Failed to clone canvas",A)}const t=A.cloneNode(!1),n=A.getContext("2d"),r=t.getContext("2d");try{return n&&r&&r.putImageData(n.getImageData(0,0,A.width,A.height),0,0),t}catch(A){e.log.warn("Failed to clone canvas",A)}return t}function G(A,e){return(A=>"CANVAS"===A.tagName)(A)?N(A,e):(A=>"IFRAME"===A.tagName)(A)?function(A,e){try{if(A?.contentDocument?.body)return AA(A.contentDocument.body,e)}catch(A){e.log.warn("Failed to clone iframe",A)}return A.cloneNode(!1)}(A,e):U(A)?function(A){const e=A.cloneNode(!1);return A.currentSrc&&A.currentSrc!==A.src&&(e.src=A.currentSrc,e.srcset=""),"lazy"===e.loading&&(e.loading="eager"),e}(A):F(A)?async function(A,e){if(A.ownerDocument&&!A.currentSrc&&A.poster)return L(A.poster,A.ownerDocument);const t=A.cloneNode(!1);t.crossOrigin="anonymous",A.currentSrc&&A.currentSrc!==A.src&&(t.src=A.currentSrc);const n=t.ownerDocument;if(n){let r=!0;if(await D(t,{onError:()=>r=!1,onWarn:e.log.warn}),!r)return A.poster?L(A.poster,A.ownerDocument):t;t.currentTime=A.currentTime,await new Promise(A=>{t.addEventListener("seeked",A,{once:!0})});const o=n.createElement("canvas");o.width=A.offsetWidth,o.height=A.offsetHeight;try{const A=o.getContext("2d");A&&A.drawImage(t,0,0,o.width,o.height)}catch(n){return e.log.warn("Failed to clone video",n),A.poster?L(A.poster,A.ownerDocument):t}return N(o,e)}return t}(A,e):A.cloneNode(!1)}const W=["width","height","-webkit-text-fill-color"],_=["stroke","fill"];function X(A,e,t){const{defaultComputedStyles:n}=t,r=A.nodeName.toLowerCase(),o=m(A)&&"svg"!==r,i=o?_.map(e=>[e,A.getAttribute(e)]).filter(([,A])=>null!==A):[],s=[o&&"svg",r,i.map((A,e)=>`${A}=${e}`).join(","),e].filter(Boolean).join(":");if(n.has(s))return n.get(s);const a=function(A){let e=A.sandbox;if(!e){const{ownerDocument:t}=A;try{t&&(e=t.createElement("iframe"),e.id=`__SANDBOX__${M()}`,e.width="0",e.height="0",e.style.visibility="hidden",e.style.position="fixed",t.body.appendChild(e),e.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',A.sandbox=e)}catch(e){A.log.warn("Failed to getSandBox",e)}}return e}(t),c=a?.contentWindow;if(!c)return new Map;const l=c?.document;let u,h;o?(u=l.createElementNS(x,"svg"),h=u.ownerDocument.createElementNS(u.namespaceURI,r),i.forEach(([A,e])=>{h.setAttributeNS(null,A,e)}),u.appendChild(h)):u=h=l.createElement(r),h.textContent=" ",l.body.appendChild(u);const g=c.getComputedStyle(h,e),d=new Map;for(let A=g.length,e=0;e<A;e++){const A=g.item(e);W.includes(A)||d.set(A,g.getPropertyValue(A))}return l.body.removeChild(u),n.set(s,d),d}function J(A,e,t){const n=new Map,r=[],o=new Map;if(t)for(const A of t)i(A);else for(let e=A.length,t=0;t<e;t++){i(A.item(t))}for(let A=r.length,e=0;e<A;e++)o.get(r[e])?.forEach((A,e)=>n.set(e,A));function i(t){const i=A.getPropertyValue(t),s=A.getPropertyPriority(t),a=t.lastIndexOf("-"),c=a>-1?t.substring(0,a):void 0;if(c){let A=o.get(c);A||(A=new Map,o.set(c,A)),A.set(t,[i,s])}(e.get(t)!==i||s)&&(c?r.push(c):n.set(t,[i,s]))}return n}const Y=[":before",":after"],$=[":-webkit-scrollbar",":-webkit-scrollbar-button",":-webkit-scrollbar-thumb",":-webkit-scrollbar-track",":-webkit-scrollbar-track-piece",":-webkit-scrollbar-corner",":-webkit-resizer"];const Z=new Set(["symbol"]);async function z(A,e,t,n,r){if(p(t)&&((A=>"STYLE"===A.tagName)(t)||(A=>"SCRIPT"===A.tagName)(t)))return;if(n.filter&&!n.filter(t))return;Z.has(e.nodeName)||Z.has(t.nodeName)?n.currentParentNodeStyle=void 0:n.currentParentNodeStyle=n.currentNodeStyle;const o=await AA(t,n,!1,r);n.isEnable("restoreScrollPosition")&&function(A,e){if(!Q(A)||!Q(e))return;const{scrollTop:t,scrollLeft:n}=A;if(!t&&!n)return;const{transform:r}=e.style,o=new DOMMatrix(r),{a:i,b:s,c:a,d:c}=o;o.a=1,o.b=0,o.c=0,o.d=1,o.translateSelf(-n,-t),o.a=i,o.b=s,o.c=a,o.d=c,e.style.transform=o.toString()}(A,o),e.appendChild(o)}async function j(A,e,t,n){let r=A.firstChild;p(A)&&A.shadowRoot&&(r=A.shadowRoot?.firstChild,t.shadowRoots.push(A.shadowRoot));for(let o=r;o;o=o.nextSibling)if(!y(o))if(p(o)&&b(o)&&"function"==typeof o.assignedNodes){const r=o.assignedNodes();for(let o=0;o<r.length;o++)await z(A,e,r[o],t,n)}else await z(A,e,o,t,n)}const q=/^[\w-:]+$/;async function AA(A,e,t=!1,n){const{ownerDocument:r,ownerWindow:o,fontFamilies:i,onCloneEachNode:s}=e;if(r&&(A=>3===A.nodeType)(A))return n&&/\S/.test(A.data)&&n(A.data),r.createTextNode(A.data);if(r&&o&&p(A)&&(Q(A)||m(A))){const n=await G(A,e);if(e.isEnable("removeAbnormalAttributes")){const A=n.getAttributeNames();for(let e=A.length,t=0;t<e;t++){const e=A[t];q.test(e)||n.removeAttribute(e)}}const r=e.currentNodeStyle=function(A,e,t,n){const{ownerWindow:r,includeStyleProperties:o,currentParentNodeStyle:i}=n,s=e.style,a=r.getComputedStyle(A),c=X(A,null,n);i?.forEach((A,e)=>{c.delete(e)});const l=J(a,c,o);l.delete("transition-property"),l.delete("all"),l.delete("d"),l.delete("content"),t&&(l.delete("margin-top"),l.delete("margin-right"),l.delete("margin-bottom"),l.delete("margin-left"),l.delete("margin-block-start"),l.delete("margin-block-end"),l.delete("margin-inline-start"),l.delete("margin-inline-end"),l.set("box-sizing",["border-box",""])),"text"===l.get("background-clip")?.[0]&&e.classList.add("______background-clip--text"),B&&(l.has("font-kerning")||l.set("font-kerning",["normal",""]),"hidden"!==l.get("overflow-x")?.[0]&&"hidden"!==l.get("overflow-y")?.[0]||"ellipsis"!==l.get("text-overflow")?.[0]||A.scrollWidth!==A.clientWidth||l.set("text-overflow",["clip",""]));for(let A=s.length,e=0;e<A;e++)s.removeProperty(s.item(e));return l.forEach(([A,e],t)=>{s.setProperty(t,A,e)}),l}(A,n,t,e);t&&function(A,e){const{backgroundColor:t,width:n,height:r,style:o}=e,i=A.style;if(t&&i.setProperty("background-color",t,"important"),n&&i.setProperty("width",`${n}px`,"important"),r&&i.setProperty("height",`${r}px`,"important"),o)for(const A in o)i[A]=o[A]}(n,e);let o=!1;if(e.isEnable("copyScrollbar")){const e=[r.get("overflow-x")?.[0],r.get("overflow-y")?.[0]];o=e.includes("scroll")||(e.includes("auto")||e.includes("overlay"))&&(A.scrollHeight>A.clientHeight||A.scrollWidth>A.clientWidth)}const a=r.get("text-transform")?.[0],c=k(r.get("font-family")?.[0]),l=c?A=>{"uppercase"===a?A=A.toUpperCase():"lowercase"===a?A=A.toLowerCase():"capitalize"===a&&(A=A[0].toUpperCase()+A.substring(1)),c.forEach(e=>{let t=i.get(e);t||i.set(e,t=new Set),A.split("").forEach(A=>t.add(A))})}:void 0;return function(A,e,t,n,r){const{ownerWindow:o,svgStyleElement:i,svgStyles:s,currentNodeStyle:a}=n;function c(t){const i=o.getComputedStyle(A,t);let c=i.getPropertyValue("content");if(!c||"none"===c)return;r?.(c),c=c.replace(/(')|(")|(counter\(.+\))/g,"");const l=[M()],u=X(A,t,n);a?.forEach((A,e)=>{u.delete(e)});const h=J(i,u,n.includeStyleProperties);h.delete("content"),h.delete("-webkit-locale"),"text"===h.get("background-clip")?.[0]&&e.classList.add("______background-clip--text");const g=[`content: '${c}';`];if(h.forEach(([A,e],t)=>{g.push(`${t}: ${A}${e?" !important":""};`)}),1===g.length)return;try{e.className=[e.className,...l].join(" ")}catch(A){return void n.log.warn("Failed to copyPseudoClass",A)}const d=g.join("\n ");let B=s.get(d);B||(B=[],s.set(d,B)),B.push(`.${l[0]}:${t}`)}i&&o&&(Y.forEach(c),t&&$.forEach(c))}(A,n,o,e,l),function(A,e){((A=>"TEXTAREA"===A.tagName)(A)||(A=>"INPUT"===A.tagName)(A)||(A=>"SELECT"===A.tagName)(A))&&e.setAttribute("value",A.value)}(A,n),F(A)||await j(A,n,e,l),await(s?.(n)),n}const a=A.cloneNode(!1);return await j(A,a,e),await(s?.(a)),a}function eA(A){if(A.ownerDocument=void 0,A.ownerWindow=void 0,A.svgStyleElement=void 0,A.svgDefsElement=void 0,A.svgStyles.clear(),A.defaultComputedStyles.clear(),A.sandbox){try{A.sandbox.remove()}catch(e){A.log.warn("Failed to destroyContext",e)}A.sandbox=void 0}A.workers=[],A.fontFamilies.clear(),A.fontCssTexts.clear(),A.requests.clear(),A.tasks=[],A.shadowRoots=[]}function tA(A,e){const{url:t,requestType:n="text",responseType:r="text",imageDom:o}=e;let i=t;const{timeout:s,acceptOfImage:a,requests:c,fetchFn:l,fetch:{requestInit:u,bypassingCache:h,placeholderImage:g},font:d,workers:B,fontFamilies:p}=A;"image"===n&&(f||w)&&A.drawImageCount++;let m=c.get(t);if(!m){h&&h instanceof RegExp&&h.test(i)&&(i+=(/\?/.test(i)?"&":"?")+(new Date).getTime());const e=n.startsWith("font")&&d&&d.minify,w=new Set;if(e){n.split(";")[1].split(",").forEach(A=>{p.has(A)&&p.get(A).forEach(A=>w.add(A))})}const C=e&&w.size,Q={url:i,timeout:s,responseType:C?"arrayBuffer":r,headers:"image"===n?{accept:a}:void 0,...u};m={type:n,resolve:void 0,reject:void 0,response:null},m.response=(async()=>{if(l&&"image"===n){const A=await l(t);if(A)return A}return!f&&t.startsWith("http")&&B.length?new Promise((A,e)=>{B[c.size&B.length-1].postMessage({rawUrl:t,...Q}),m.resolve=A,m.reject=e}):function(A){const{url:e,timeout:t,responseType:n,...r}=A,o=new AbortController,i=t?setTimeout(()=>o.abort(),t):void 0;return fetch(e,{signal:o.signal,...r}).then(A=>{if(!A.ok)throw new Error("Failed fetch, not 2xx response",{cause:A});switch(n){case"arrayBuffer":return A.arrayBuffer();case"dataUrl":return A.blob().then(S);default:return A.text()}}).finally(()=>clearTimeout(i))}(Q)})().catch(e=>{if(c.delete(t),"image"===n&&g)return A.log.warn("Failed to fetch image base64, trying to use placeholder image",i),"string"==typeof g?g:g(o);throw e}),c.set(t,m)}return m.response}async function nA(A,e,t,n){if(!rA(A))return A;for(const[r,o]of function(A,e){const t=[];return A.replace(oA,(A,n,r)=>(t.push([r,H(r,e)]),A)),t.filter(([A])=>!E(A))}(A,e))try{const e=await tA(t,{url:o,requestType:n?"image":"text",responseType:"dataUrl"});A=A.replace(iA(r),`$1${e}$3`)}catch(A){t.log.warn("Failed to fetch css data url",r,A)}return A}function rA(A){return/url\((['"]?)([^'"]+?)\1\)/.test(A)}const oA=/url\((['"]?)([^'"]+?)\1\)/g;function iA(A){const e=A.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}const sA=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function aA(A,e){const{tasks:t}=e;p(A)&&((U(A)||C(A))&&t.push(...function(A,e){if(U(A)){const t=A.currentSrc||A.src;if(!E(t))return[tA(e,{url:t,imageDom:A,requestType:"image",responseType:"dataUrl"}).then(e=>{e&&(A.srcset="",A.dataset.originalSrc=t,A.src=e||"")})];(f||w)&&e.drawImageCount++}else if(m(A)&&!E(A.href.baseVal)){const t=A.href.baseVal;return[tA(e,{url:t,imageDom:A,requestType:"image",responseType:"dataUrl"}).then(e=>{e&&(A.dataset.originalSrc=t,A.href.baseVal=e||"")})]}return[]}(A,e)),"use"===A.tagName&&t.push(...function(A,e){const{ownerDocument:t,svgDefsElement:n}=e,r=A.getAttribute("href")??A.getAttribute("xlink:href");if(!r)return[];const[o,i]=r.split("#");if(i){const r=`#${i}`,s=e.shadowRoots.reduce((A,e)=>A??e.querySelector(`svg ${r}`),t?.querySelector(`svg ${r}`));if(o&&A.setAttribute("href",r),n?.querySelector(r))return[];if(s)return n?.appendChild(s.cloneNode(!0)),[];if(o)return[tA(e,{url:o,responseType:"text"}).then(A=>{n?.insertAdjacentHTML("beforeend",A)})]}return[]}(A,e))),Q(A)&&t.push(...function(A,e){return sA.map(t=>{const n=A.getPropertyValue(t);return n&&"none"!==n?((f||w)&&e.drawImageCount++,nA(n,null,e,!0).then(e=>{e&&n!==e&&A.setProperty(t,e,A.getPropertyPriority(t))})):null}).filter(Boolean)}(A.style,e)),A.childNodes.forEach(A=>{aA(A,e)})}async function cA(A,e){const{ownerDocument:t,svgStyleElement:n,fontFamilies:r,fontCssTexts:o,tasks:i,font:s}=e;if(t&&n&&r.size)if(s&&s.cssText){const A=dA(s.cssText,e);n.appendChild(t.createTextNode(`${A}\n`))}else{const A=Array.from(t.styleSheets).filter(A=>{try{return"cssRules"in A&&Boolean(A.cssRules.length)}catch(t){return e.log.warn(`Error while reading CSS rules from ${A.href}`,t),!1}});await Promise.all(A.flatMap(A=>Array.from(A.cssRules).map(async(t,n)=>{if("CSSImportRule"===t.constructor.name){let r=n+1;const o=t.href;let i="";try{i=await tA(e,{url:o,requestType:"text",responseType:"text"})}catch(A){e.log.warn(`Error fetch remote css import from ${o}`,A)}const s=i.replace(oA,(A,e,t)=>A.replace(t,H(t,o)));for(const t of function(A){if(null==A)return[];const e=[];let t=A.replace(lA,"");for(;;){const A=uA.exec(t);if(!A)break;e.push(A[0])}t=t.replace(uA,"");const n=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,r=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let A=n.exec(t);if(A)r.lastIndex=n.lastIndex;else{if(A=r.exec(t),!A)break;n.lastIndex=r.lastIndex}e.push(A[0])}return e}(s))try{A.insertRule(t,t.startsWith("@import")?r+=1:A.cssRules.length)}catch(A){e.log.warn("Error inserting rule from remote css import",{rule:t,error:A})}}})));A.flatMap(A=>Array.from(A.cssRules)).filter(A=>"CSSFontFaceRule"===A.constructor.name&&rA(A.style.getPropertyValue("src"))&&k(A.style.getPropertyValue("font-family"))?.some(A=>r.has(A))).forEach(A=>{const r=A,s=o.get(r.cssText);s?n.appendChild(t.createTextNode(`${s}\n`)):i.push(nA(r.cssText,r.parentStyleSheet?r.parentStyleSheet.href:null,e).then(A=>{A=dA(A,e),o.set(r.cssText,A),n.appendChild(t.createTextNode(`${A}\n`))}))})}}const lA=/(\/\*[\s\S]*?\*\/)/g,uA=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;const hA=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,gA=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function dA(A,e){const{font:t}=e,n=t?t?.preferredFormat:void 0;return n?A.replace(gA,A=>{for(;;){const[e,,t]=hA.exec(A)||[];if(!t)return"";if(t===n)return`src: ${e};`}}):A}async function BA(A,e){const t=await R(A,e);if(p(t.node)&&m(t.node))return t.node;const{ownerDocument:n,log:r,tasks:o,svgStyleElement:i,svgDefsElement:s,svgStyles:a,font:c,progress:l,autoDestruct:u,onCloneNode:h,onEmbedNode:g,onCreateForeignObjectSvg:d}=t;r.time("clone node");const B=await AA(t.node,t,!0);if(i&&n){let A="";a.forEach((e,t)=>{A+=`${e.join(",\n")} {\n ${t}\n}\n`}),i.appendChild(n.createTextNode(A))}r.timeEnd("clone node"),await(h?.(B)),!1!==c&&p(B)&&(r.time("embed web font"),await cA(0,t),r.timeEnd("embed web font")),r.time("embed node"),aA(B,t);const f=o.length;let w=0;l?.(w,f),await Promise.all([...Array.from({length:4})].map(async()=>{for(;;){const A=o.pop();if(!A)break;try{await A}catch(A){t.log.warn("Failed to run task",A)}l?.(++w,f)}})),r.timeEnd("embed node"),await(g?.(B));const C=function(A,e){const{width:t,height:n}=e,r=function(A,e,t){const n=I(t).createElementNS(x,"svg");return n.setAttributeNS(null,"width",A.toString()),n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"viewBox",`0 0 ${A} ${e}`),n}(t,n,A.ownerDocument),o=r.ownerDocument.createElementNS(r.namespaceURI,"foreignObject");return o.setAttributeNS(null,"x","0%"),o.setAttributeNS(null,"y","0%"),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.append(A),r.appendChild(o),r}(B,t);return s&&C.insertBefore(s,C.children[0]),i&&C.insertBefore(i,C.children[0]),u&&eA(t),await(d?.(C)),C}async function fA(A,e){const t=await R(A,e),n=await BA(t),r=function(A,e){let t=(new XMLSerializer).serializeToString(A);return e&&(t=t.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}(n,t.isEnable("removeControlCharacter"));t.autoDestruct||(t.svgStyleElement=O(t.ownerDocument),t.svgDefsElement=t.ownerDocument?.createElementNS(x,"defs"),t.svgStyles.clear());const o=L(r,n.ownerDocument);return await V(o,t)}async function wA(A,e){const t=await R(A,e),{log:n,quality:r,type:o,dpi:i}=t,s=await fA(t);n.time("canvas to data url");let c=s.toDataURL(o,r);if(["image/png","image/jpeg"].includes(o)&&i&&h&&g){const[A,e]=c.split(",");let t=0,n=!1;if("image/png"===o){const A=function(A){let e=A.indexOf("AAlwSFlz");return-1===e&&(e=A.indexOf("AAAJcEhZ")),-1===e&&(e=A.indexOf("AAAACXBI")),e}(e);A>=0?(t=4*Math.ceil((A+28)/3),n=!0):t=44}else"image/jpeg"===o&&(t=24);const r=e.substring(0,t),s=e.substring(t),l=window.atob(r),u=new Uint8Array(l.length);for(let A=0;A<u.length;A++)u[A]=l.charCodeAt(A);const h="image/png"===o?a(u,i,n):function(A,e){return A[13]=1,A[14]=e>>8,A[15]=255&e,A[16]=e>>8,A[17]=255&e,A}(u,i);c=[A,",",window.btoa(String.fromCharCode(...h)),s].join("")}return n.timeEnd("canvas to data url"),c}async function pA(A,e){return wA(await R(A,{...e,type:"image/jpeg"}))}async function mA(A,e){return wA(await R(A,{...e,type:"image/png"}))}async function CA(A,e){return wA(await R(A,{...e,type:"image/webp"}))}var QA={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function yA(A){const e=A.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;const t=e[2].trim();return t.startsWith("#")?null:t}function UA(A){if(/%[0-9A-Fa-f]{2}/.test(A))return A;try{return encodeURI(A)}catch{return A}}var FA=function(A="[snapDOM]",{ttlMs:e=3e5,maxEntries:t=12}={}){const n=new Map;let r=0;function o(o,i,s){if(r>=t)return;const a=Date.now();(n.get(i)||0)>a||(n.set(i,a+e),r++,"warn"===o&&console&&console.warn?console.warn(`${A} ${s}`):console&&console.error&&console.error(`${A} ${s}`))}return{warnOnce(A,e){o("warn",A,e)},errorOnce(A,e){o("error",A,e)},reset(){n.clear(),r=0}}}("[snapDOM]",{ttlMs:18e4,maxEntries:10}),bA=new Map,vA=new Map;function EA(A,e){if(!e)return!1;if(function(A){return/^data:|^blob:|^about:blank$/i.test(A)}(A))return!1;if(function(A,e){try{const t="undefined"!=typeof location&&location.href?location.href:"http://localhost/",n=e.includes("{url}")?e.split("{url}")[0]:e,r=new URL(n||".",t),o=new URL(A,t);if(o.origin===r.origin)return!0;const i=o.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}(A,e))return!1;try{const e="undefined"!=typeof location&&location.href?location.href:"http://localhost/",t=new URL(A,e);return"undefined"==typeof location||t.origin!==location.origin}catch{return!!e}}function HA(A){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>e(String(n.result||"")),n.onerror=()=>t(new Error("read_failed")),n.readAsDataURL(A)})}async function IA(A,e={}){const t=e.as??"blob",n=e.timeout??3e3,r=e.useProxy||"",o=e.errorTTL??8e3,i=e.headers||{},s=!!e.silent;if(/^data:/i.test(A))try{if("text"===t)return{ok:!0,data:String(A),status:200,url:A,fromCache:!1};if("dataURL"===t)return{ok:!0,data:String(A),status:200,url:A,fromCache:!1,mime:String(A).slice(5).split(";")[0]||""};const[,e="",n=""]=String(A).match(/^data:([^,]*),(.*)$/)||[],r=/;base64/i.test(e)?atob(n):decodeURIComponent(n),o=new Uint8Array([...r].map(A=>A.charCodeAt(0))),i=new Blob([o],{type:(e||"").split(";")[0]||""});return{ok:!0,data:i,status:200,url:A,fromCache:!1,mime:i.type||""}}catch{return{ok:!1,data:null,status:0,url:A,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(A))try{const e=await fetch(A);if(!e.ok)return{ok:!1,data:null,status:e.status,url:A,fromCache:!1,reason:"http_error"};const n=await e.blob(),r=n.type||e.headers.get("content-type")||"";if("dataURL"===t){return{ok:!0,data:await HA(n),status:e.status,url:A,fromCache:!1,mime:r}}if("text"===t){return{ok:!0,data:await n.text(),status:e.status,url:A,fromCache:!1,mime:r}}return{ok:!0,data:n,status:e.status,url:A,fromCache:!1,mime:r}}catch{return{ok:!1,data:null,status:0,url:A,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(A))return"dataURL"===t?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:A,fromCache:!1,mime:"image/png"}:{ok:!0,data:"text"===t?"":new Blob([]),status:200,url:A,fromCache:!1};const a=function(A,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,A].join("|")}(A,{as:t,timeout:n,useProxy:r,errorTTL:o}),c=vA.get(a);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&vA.delete(a);const l=bA.get(a);if(l)return l;const u=EA(A,r)?function(A,e){if(!e)return A;if(e.includes("{url}"))return e.replace("{urlRaw}",UA(A)).replace("{url}",encodeURIComponent(A));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(A)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(A)}`;if(e.endsWith("/"))return`${e}${UA(A)}`;const t=e.includes("?")?"&":"?";return`${e}${t}url=${encodeURIComponent(A)}`}(A,r):A;let h=e.credentials;if(!h)try{const e="undefined"!=typeof location&&location.href?location.href:"http://localhost/",t=new URL(A,e),n="undefined"!=typeof location&&t.origin===location.origin;h=n?"include":"omit"}catch{h="omit"}const g=new AbortController,d=setTimeout(()=>g.abort("timeout"),n),B=(async()=>{try{const n=await fetch(u,{signal:g.signal,credentials:h,headers:i});if(!n.ok){const r={ok:!1,data:null,status:n.status,url:u,fromCache:!1,reason:"http_error"};if(o>0&&vA.set(a,{until:Date.now()+o,result:r}),!s){const e=`${n.status} ${n.statusText||""}`.trim();FA.warnOnce(`http:${n.status}:${t}:${new URL(A,location?.href??"http://localhost/").origin}`,`HTTP error ${e} while fetching ${t} ${A}`)}return e.onError&&e.onError(r),r}if("text"===t){return{ok:!0,data:await n.text(),status:n.status,url:u,fromCache:!1}}const r=await n.blob(),c=r.type||n.headers.get("content-type")||"";if("dataURL"===t){return{ok:!0,data:await HA(r),status:n.status,url:u,fromCache:!1,mime:c}}return{ok:!0,data:r,status:n.status,url:u,fromCache:!1,mime:c}}catch(r){const i=r&&"object"==typeof r&&"name"in r&&"AbortError"===r.name?String(r.message||"").includes("timeout")?"timeout":"abort":"network",c={ok:!1,data:null,status:0,url:u,fromCache:!1,reason:i};if(!/^blob:/i.test(A)&&o>0&&vA.set(a,{until:Date.now()+o,result:c}),!s){const e=`${i}:${t}:${new URL(A,location?.href??"http://localhost/").origin}`,r="timeout"===i?`Timeout after ${n}ms. Consider increasing timeout or using a proxy for ${A}`:"abort"===i?`Request aborted while fetching ${t} ${A}`:`Network/CORS issue while fetching ${t} ${A}. A proxy may be required`;FA.errorOnce(e,r)}return e.onError&&e.onError(c),c}finally{clearTimeout(d),bA.delete(a)}})();return bA.set(a,B),B}function xA(A,e){if(!e||!A.width||!A.height)return A;const t=document.createElement("canvas");t.width=A.width,t.height=A.height;const n=t.getContext("2d");return n.fillStyle=e,n.fillRect(0,0,t.width,t.height),n.drawImage(A,0,0),t}async function SA(A,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(A)||"none"===A.trim())return A;const t=yA(A);if(!t)return A;const n=UA(t);if(QA.background.has(n)){const A=QA.background.get(n);return A?`url("${A}")`:"none"}try{const A=await IA(n,{as:"dataURL",useProxy:e.useProxy});return A.ok?(QA.background.set(n,A.data),`url("${A.data}")`):(QA.background.set(n,null),"none")}catch{return QA.background.set(n,null),"none"}}var LA=new Set(["meta","script","noscript","title","link","template"]),DA=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]);var MA=/(?:^|-)(animation|transition)(?:-|$)/i,kA=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,KA=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function TA(A){const e=String(A).toLowerCase();return!!KA.has(e)||(!!kA.test(e)||!!MA.test(e))}function RA(A,e){if(e=String(e||"").toLowerCase(),DA.has(e))return"";const t=[],n=function(A){if(A=String(A).toLowerCase(),DA.has(A)){const e={};return QA.defaultStyle.set(A,e),e}if(QA.defaultStyle.has(A))return QA.defaultStyle.get(A);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));const t=document.createElement(A);t.style.all="initial",e.appendChild(t);const n=getComputedStyle(t),r={};for(let A of n){if(TA(A))continue;const e=n.getPropertyValue(A);r[A]=e}return e.removeChild(t),QA.defaultStyle.set(A,r),r}(e);for(let[e,r]of Object.entries(A)){if(TA(e))continue;const A=n[e];r&&r!==A&&t.push(`${e}:${r}`)}return t.sort(),t.join(";")}function PA(A,e=null){if(!(A instanceof Element))return window.getComputedStyle(A,e);let t=QA.computedStyle.get(A);if(t||(t=new Map,QA.computedStyle.set(A,t)),!t.has(e)){const n=window.getComputedStyle(A,e);t.set(e,n)}return t.get(e)}function OA(A){const e={};for(let t of A)e[t]=A.getPropertyValue(t);return e}function VA(A){const e=[];let t=0,n=0;for(let r=0;r<A.length;r++){const o=A[r];"("===o&&t++,")"===o&&t--,","===o&&0===t&&(e.push(A.slice(n,r).trim()),n=r+1)}return e.push(A.slice(n).trim()),e}function NA(A,{fast:e=!1}={}){if(e)return A();"requestIdleCallback"in window?requestIdleCallback(A,{timeout:50}):setTimeout(A,1)}function GA(){const A="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(A),t=/AppleWebKit/i.test(A)&&/Mobile/i.test(A)&&!/Safari/i.test(A),n=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(A);return e||t||n}var WA=new WeakMap,_A=new Map,XA=0;function JA(){XA++}var YA=!1;var $A=new WeakMap;function ZA(A,e=null,t={}){const n=WA.get(A);if(n&&n.epoch===XA)return n.snapshot;const r=e||getComputedStyle(A),o=function(A,e={}){const t={},n=A.getPropertyValue("visibility");for(let e=0;e<A.length;e++){const n=A[e];let r=A.getPropertyValue(n);"background-image"!==n&&"content"!==n||!r.includes("url(")||r.includes("data:")||(r="none"),t[n]=r}if(e.embedFonts){const e=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(const n of e)if(!t[n])try{const e=A.getPropertyValue(n);e&&(t[n]=e)}catch{}}return"hidden"===n&&(t.opacity="0"),t}(r,t);return function(A,e,t){if(A instanceof HTMLElement&&A.style&&A.style.height)return;const n=e.display||"";if(n.includes("flex")||n.includes("grid"))return;if(function(A){return A instanceof HTMLImageElement||A instanceof HTMLCanvasElement||A instanceof HTMLVideoElement||A instanceof HTMLIFrameElement||A instanceof SVGElement||A instanceof HTMLObjectElement||A instanceof HTMLEmbedElement}(A))return;const r=e.position;if("absolute"===r||"fixed"===r||"sticky"===r)return;if("none"!==e.transform)return;if(function(A){if(A.backgroundImage&&"none"!==A.backgroundImage)return!0;if(A.backgroundColor&&"rgba(0, 0, 0, 0)"!==A.backgroundColor&&"transparent"!==A.backgroundColor)return!0;if((parseFloat(A.borderTopWidth)||0)>0)return!0;if((parseFloat(A.borderBottomWidth)||0)>0)return!0;if((parseFloat(A.paddingTop)||0)>0)return!0;if((parseFloat(A.paddingBottom)||0)>0)return!0;const e=A.overflowBlock||A.overflowY||"visible";return"visible"!==e}(e))return;if(function(A){const e=A.parentElement;if(!e)return!1;const t=getComputedStyle(e).display||"";return t.includes("flex")||t.includes("grid")}(A))return;if(!function(A,e){if(A.textContent&&/\S/.test(A.textContent))return!0;const t=A.firstElementChild,n=A.lastElementChild;if(t&&"BR"===t.tagName||n&&"BR"===n.tagName)return!0;const r=A.scrollHeight;if(0===r)return!1;const o=parseFloat(e.paddingTop)||0,i=parseFloat(e.paddingBottom)||0;return r>o+i}(A,e))return;delete t.height,delete t["block-size"]}(A,r,o),WA.set(A,{epoch:XA,snapshot:o}),o}async function zA(A,e,t,n){if("STYLE"===A.tagName)return;const r=function(A,e){return A&&A.session&&A.persist?A:A&&(A.styleMap||A.styleCache||A.nodeMap)?{session:A,persist:{snapshotKeyCache:_A,defaultStyle:QA.defaultStyle,baseStyle:QA.baseStyle,image:QA.image,resource:QA.resource,background:QA.background,font:QA.font},options:e||{}}:{session:QA.session,persist:{snapshotKeyCache:_A,defaultStyle:QA.defaultStyle,baseStyle:QA.baseStyle,image:QA.image,resource:QA.resource,background:QA.background,font:QA.font},options:A||e||{}}}(t,n),o=r.options&&r.options.cache||"auto";if("disabled"!==o&&function(A=document.documentElement){if(!YA){YA=!0;try{new MutationObserver(()=>JA()).observe(A,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>JA()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{const A=document.fonts;A&&(A.addEventListener?.("loadingdone",JA),A.ready?.then(()=>JA()).catch(()=>{}))}catch{}}}(document.documentElement),"disabled"!==o||r.session.__bumpedForDisabled||(JA(),_A.clear(),r.session.__bumpedForDisabled=!0),DA.has(A.tagName?.toLowerCase())){const t=A.getAttribute?.("style");t&&e.setAttribute("style",t)}const{session:i,persist:s}=r;i.styleCache.has(A)||i.styleCache.set(A,getComputedStyle(A));const a=ZA(A,i.styleCache.get(A),r.options),c=function(A){let e=$A.get(A);return e||(e=Object.entries(A).sort((A,e)=>A[0]<e[0]?-1:A[0]>e[0]?1:0).map(([A,e])=>`${A}:${e}`).join(";"),$A.set(A,e),e)}(a);let l=s.snapshotKeyCache.get(c);if(!l){l=RA(a,A.tagName?.toLowerCase()||"div"),s.snapshotKeyCache.set(c,l)}i.styleMap.set(e,l)}function jA(A,e,t){return Promise.all(A.map(A=>new Promise(n=>{!function r(){NA(t=>{!t||"function"!=typeof t.timeRemaining||t.timeRemaining()>0?e(A,n):r()},{fast:t})}()})))}function qA(A,e){return A?A=(A=(A=(A=(A=A.replace(/:host\(([^)]+)\)/g,(A,t)=>`:where(${e}:is(${t.trim()}))`)).replace(/:host\b/g,`:where(${e})`)).replace(/:host-context\(([^)]+)\)/g,(A,t)=>`:where(:where(${t.trim()}) ${e})`)).replace(/::slotted\(([^)]+)\)/g,(A,t)=>`:where(${e} ${t.trim()})`)).replace(/(^|})(\s*)([^@}{]+){/g,(A,t,n,r)=>{const o=function(A,e,t=!0){return A.split(",").map(A=>A.trim()).filter(Boolean).map(A=>{if(A.startsWith(":where("))return A;if(A.startsWith("@"))return A;const n=t?(r=(r=A).trim())?/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(r)?r:`${r}:not([data-sd-slotted])`:r:A;var r;return`:where(${e} ${n})`}).join(", ")}(r,e,!0);return`${t}${n}${o}{`}):""}function Ae(A,e){try{let t=getComputedStyle(A).getPropertyValue(e).trim();if(t)return t}catch{}try{let A=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(A)return A}catch{}return""}async function ee(A,e,t){const n=await async function(A,e=3){const t=()=>{try{return A.contentDocument||A.contentWindow?.document||null}catch{return null}};let n=t(),r=0;for(;r<e&&(!n||!n.body&&!n.documentElement);)await new Promise(A=>setTimeout(A,0)),n=t(),r++;return n&&(n.body||n.documentElement)?n:null}(A,3);if(!n)throw new Error("iframe document not accessible/ready");const{contentWidth:r,contentHeight:o,rect:i}=function(A){const e=A.getBoundingClientRect();let t=0,n=0,r=0,o=0;try{const e=getComputedStyle(A);t=parseFloat(e.borderLeftWidth)||0,n=parseFloat(e.borderRightWidth)||0,r=parseFloat(e.borderTopWidth)||0,o=parseFloat(e.borderBottomWidth)||0}catch{}return{contentWidth:Math.max(0,Math.round(e.width-(t+n))),contentHeight:Math.max(0,Math.round(e.height-(r+o))),rect:e}}(A),s=t?.snap;if(!s||"function"!=typeof s.toPng)throw new Error("snapdom.toPng not available in iframe or window");const a={...t,scale:1},c=function(A,e,t){const n=A.createElement("style");return n.setAttribute("data-sd-iframe-pin",""),n.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${t}px !important;min-width: ${e}px !important;min-height: ${t}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(A.head||A.documentElement).appendChild(n),()=>{try{n.remove()}catch{}}}(n,r,o);let l;try{l=await s.toPng(n.documentElement,a)}finally{c()}l.style.display="block",l.style.width=`${r}px`,l.style.height=`${o}px`;const u=document.createElement("div");return e.nodeMap.set(u,A),zA(A,u,e,t),u.style.overflow="hidden",u.style.display="block",u.style.width||(u.style.width=`${Math.round(i.width)}px`),u.style.height||(u.style.height=`${Math.round(i.height)}px`),u.appendChild(l),u}async function te(A,e,t){if(!A)throw new Error("Invalid node");const n=new Set;let r,o=null,i=null;if(A.nodeType===Node.ELEMENT_NODE){const e=(A.localName||A.tagName||"").toLowerCase();if("snapdom-sandbox"===A.id||A.hasAttribute("data-snapdom-sandbox"))return null;if(LA.has(e))return null}if(A.nodeType===Node.TEXT_NODE)return A.cloneNode(!0);if(A.nodeType!==Node.ELEMENT_NODE)return A.cloneNode(!0);if("exclude"===A.getAttribute("data-capture")){if("hide"===t.excludeMode){const e=document.createElement("div"),t=A.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${t.width}px;height:${t.height}px;visibility:hidden;`,e}if("remove"===t.excludeMode)return null}if(t.exclude&&Array.isArray(t.exclude))for(const e of t.exclude)try{if(A.matches?.(e)){if("hide"===t.excludeMode){const e=document.createElement("div"),t=A.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${t.width}px;height:${t.height}px;visibility:hidden;`,e}if("remove"===t.excludeMode)return null}}catch(A){console.warn(`Invalid selector in exclude option: ${e}`,A)}if("function"==typeof t.filter)try{if(!t.filter(A)){if("hide"===t.filterMode){const e=document.createElement("div"),t=A.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${t.width}px;height:${t.height}px;visibility:hidden;`,e}if("remove"===t.filterMode)return null}}catch(A){console.warn("Error in filter function:",A)}if("IFRAME"===A.tagName){let n=!1;try{n=!(!A.contentDocument&&!A.contentWindow?.document)}catch{n=!1}if(n)try{return await ee(A,e,t)}catch(A){console.warn("[SnapDOM] iframe rasterization failed, fallback:",A)}if(t.placeholders){const n=document.createElement("div");return n.style.cssText=`width:${A.offsetWidth}px;height:${A.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,zA(A,n,e,t),n}{const n=A.getBoundingClientRect(),r=document.createElement("div");return r.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,zA(A,r,e,t),r}}if("placeholder"===A.getAttribute("data-capture")){const n=A.cloneNode(!1);e.nodeMap.set(n,A),zA(A,n,e,t);const r=document.createElement("div");return r.textContent=A.getAttribute("data-placeholder-text")||"",r.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",n.appendChild(r),n}if("CANVAS"===A.tagName){const n=A.toDataURL(),r=document.createElement("img");return r.src=n,r.width=A.width,r.height=A.height,e.nodeMap.set(r,A),zA(A,r,e,t),r}try{if(r=A.cloneNode(!1),function(A,e){if(!(A instanceof Element&&e instanceof Element))return;const t=A.getAttribute?.("style");let n,r=!(!t||!t.includes("var("));if(!r&&A.attributes?.length){const e=A.attributes;for(let A=0;A<e.length;A++){const t=e[A];if(t&&"string"==typeof t.value&&t.value.includes("var(")){r=!0;break}}}if(!r)return;try{n=getComputedStyle(A)}catch{return}const o=A.style;if(o&&o.length)for(let A=0;A<o.length;A++){const t=o[A],r=o.getPropertyValue(t);if(!r||!r.includes("var("))continue;const i=n.getPropertyValue(t);if(i)try{e.style.setProperty(t,i.trim(),o.getPropertyPriority(t))}catch{}}if(A.attributes?.length){const t=A.attributes;for(let A=0;A<t.length;A++){const r=t[A];if(!r||"string"!=typeof r.value||!r.value.includes("var("))continue;const o=r.name;let i="";try{i=n.getPropertyValue(o)}catch{}if(i)try{e.style.setProperty(o,i.trim())}catch{}}}}(A,r),e.nodeMap.set(r,A),"IMG"===A.tagName){!function(A,e){try{const t=A.currentSrc||A.src||"";if(!t)return;e.setAttribute("src",t),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}(A,r);try{const e=A.getBoundingClientRect();let t=Math.round(e.width||0),n=Math.round(e.height||0);if(!t||!n){const e=window.getComputedStyle(A),r=parseFloat(e.width)||0,o=parseFloat(e.height)||0,i=parseInt(A.getAttribute("width")||"",10)||0,s=parseInt(A.getAttribute("height")||"",10)||0,a=A.width||A.naturalWidth||0,c=A.height||A.naturalHeight||0;t=Math.round(t||r||i||a||0),n=Math.round(n||o||s||c||0)}t&&(r.dataset.snapdomWidth=String(t)),n&&(r.dataset.snapdomHeight=String(n))}catch{}}}catch(e){throw console.error("[Snapdom] Failed to clone node:",A,e),e}if(A instanceof HTMLTextAreaElement){const e=A.getBoundingClientRect();r.style.width=`${e.width}px`,r.style.height=`${e.height}px`}if(A instanceof HTMLInputElement&&(r.value=A.value,r.setAttribute("value",A.value),void 0!==A.checked&&(r.checked=A.checked,A.checked&&r.setAttribute("checked",""),A.indeterminate&&(r.indeterminate=A.indeterminate))),A instanceof HTMLSelectElement&&(o=A.value),A instanceof HTMLTextAreaElement&&(i=A.value),zA(A,r,e,t),A.shadowRoot){let o=function(A,n){if(A.nodeType===Node.ELEMENT_NODE&&"STYLE"===A.tagName)return n(null);te(A,e,t).then(A=>{n(A||null)}).catch(()=>{n(null)})};try{const e=A.shadowRoot.querySelectorAll("slot");for(const A of e){let e=[];try{e=A.assignedNodes?.({flatten:!0})||A.assignedNodes?.()||[]}catch{e=A.assignedNodes?.()||[]}for(const A of e)n.add(A)}}catch{}const i=function(A){return A.shadowScopeSeq=(A.shadowScopeSeq||0)+1,`s${A.shadowScopeSeq}`}(e),s=`[data-sd="${i}"]`;try{r.setAttribute("data-sd",i)}catch{}const a=function(A){let e="";try{A.querySelectorAll("style").forEach(A=>{e+=(A.textContent||"")+"\n"});const t=A.adoptedStyleSheets||[];for(const A of t)try{if(A&&A.cssRules)for(const t of A.cssRules)e+=t.cssText+"\n"}catch{}}catch{}return e}(A.shadowRoot),c=qA(a,s),l=function(A,e,t){const n=[];for(const t of e){const e=Ae(A,t);e&&n.push(`${t}: ${e};`)}return n.length?`${t}{${n.join("")}}\n`:""}(A,function(A){const e=new Set;if(!A)return e;const t=/var\(\s*(--[A-Za-z0-9_-]+)\b/g;let n;for(;n=t.exec(A);)e.add(n[1]);return e}(a),s);!function(A,e,t){if(!e)return;const n=document.createElement("style");n.setAttribute("data-sd",t),n.textContent=e,A.insertBefore(n,A.firstChild||null)}(r,l+c,i);const u=document.createDocumentFragment(),h=await jA(Array.from(A.shadowRoot.childNodes),o,t.fast);u.append(...h.filter(A=>!!A)),r.appendChild(u)}if("SLOT"===A.tagName){let n=function(A,n){te(A,e,t).then(A=>{var e;A&&(e=A)&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(A=>A.setAttribute("data-sd-slotted",""))),n(A||null)}).catch(()=>{n(null)})};const r=A.assignedNodes?.({flatten:!0})||[],o=r.length>0?r:Array.from(A.childNodes),i=document.createDocumentFragment(),s=await jA(Array.from(o),n,t.fast);return i.append(...s.filter(A=>!!A)),i}const s=await jA(Array.from(A.childNodes),function(A,r){if(n.has(A))return r(null);te(A,e,t).then(A=>{r(A||null)}).catch(()=>{r(null)})},t.fast);if(r.append(...s.filter(A=>!!A)),null!==o&&r instanceof HTMLSelectElement){r.value=o;for(const A of r.options)A.value===o?A.setAttribute("selected",""):A.removeAttribute("selected")}return null!==i&&r instanceof HTMLTextAreaElement&&(r.textContent=i),r}var ne=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],re=[];function oe(A){const e="string"==typeof A?A:"",t=[...ne,...re];for(const A of t)if(A instanceof RegExp&&A.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function ie(A,e,t,n=32,r="#000"){e=e.replace(/^['"]+|['"]+$/g,"");const o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}const i=document.createElement("span");i.textContent=A,i.style.position="absolute",i.style.visibility="hidden",i.style.fontFamily=`"${e}"`,i.style.fontWeight=t||"normal",i.style.fontSize=`${n}px`,i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.padding="0",i.style.margin="0",document.body.appendChild(i);const s=i.getBoundingClientRect(),a=Math.ceil(s.width),c=Math.ceil(s.height);document.body.removeChild(i);const l=document.createElement("canvas");l.width=Math.max(1,a*o),l.height=Math.max(1,c*o);const u=l.getContext("2d");return u.scale(o,o),u.font=t?`${t} ${n}px "${e}"`:`${n}px "${e}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=r,u.fillText(A,0,0),{dataUrl:l.toDataURL(),width:a,height:c}}var se=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function ae(A){if(!A)return"";for(let e of A.split(",")){let A=e.trim().replace(/^['"]+|['"]+$/g,"");if(A&&!se.has(A.toLowerCase()))return A}return""}function ce(A){const e=String(A??"400").trim().toLowerCase();if("normal"===e)return 400;if("bold"===e)return 700;const t=parseInt(e,10);return Number.isFinite(t)?Math.min(900,Math.max(100,t)):400}function le(A){const e=String(A??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function ue(A,e){if(!A)return!1;try{const t=new URL(A,location.href);if(t.origin===location.origin)return!0;const n=t.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(A=>n.endsWith(A)))return!0;const r=(t.pathname+t.search).toLowerCase();if(/\bfont(s)?\b/.test(r)||/\.woff2?(\b|$)/.test(r))return!0;for(const A of e){const e=A.toLowerCase().replace(/\s+/g,"+"),t=A.toLowerCase().replace(/\s+/g,"-");if(r.includes(e)||r.includes(t))return!0}return!1}catch{return!1}}function he(A,e){return A?A.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(A,t,n)=>{const r=(n||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return A;let o=r;try{o=new URL(r,e||location.href).href}catch{}return`url("${o}")`}):A}var ge=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g;async function de(A,e,t){if(!A)return A;const n=new Set;function r(A,e){try{return new URL(A,e||location.href).href}catch{return A}}let o=he(A,e||location.href);return o=await async function A(e,o,i=0){if(i>4)return console.warn(`[snapDOM] @import depth exceeded (4) at ${o}`),e;let s,a="",c=0;for(;s=ge.exec(e);){a+=e.slice(c,s.index),c=ge.lastIndex;const l=r((s[2]||s[4]||"").trim(),o);if(n.has(l)){console.warn(`[snapDOM] Skipping circular @import: ${l}`);continue}n.add(l);let u="";try{const A=await IA(l,{as:"text",useProxy:t,silent:!0});A.ok&&"string"==typeof A.data&&(u=A.data)}catch{}u?(u=he(u,l),u=await A(u,l,i+1),a+=`\n/* inlined: ${l} */\n${u}\n`):a+=s[0]}return a+=e.slice(c),a}(o,e||location.href,0),o}var Be=/url\((["']?)([^"')]+)\1\)/g,fe=/@font-face[^{}]*\{[^}]*\}/g;function we(A){if(!A)return[];const e=[],t=A.split(",").map(A=>A.trim()).filter(Boolean);for(const A of t){const t=A.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!t)continue;const n=t[1],r=t[2],o=A=>{if(!A.includes("?"))return parseInt(A,16);return[parseInt(A.replace(/\?/g,"0"),16),parseInt(A.replace(/\?/g,"F"),16)]};if(r){const A=o(n),t=o(r),i=Array.isArray(A)?A[0]:A,s=Array.isArray(t)?t[1]:t;e.push([Math.min(i,s),Math.max(i,s)])}else{const A=o(n);Array.isArray(A)?e.push([A[0],A[1]]):e.push([A,A])}}return e}function pe(A,e){if(!e.length)return!0;if(!A||0===A.size)return!0;for(const t of A)for(const[A,n]of e)if(t>=A&&t<=n)return!0;return!1}function me(A,e){const t=[];if(!A)return t;for(const n of A.matchAll(Be)){let A=(n[2]||"").trim();if(A&&!A.startsWith("data:")){if(!/^https?:/i.test(A))try{A=new URL(A,e||location.href).href}catch{}t.push(A)}}return t}async function Ce(A,e,t=""){let n=A;for(const r of A.matchAll(Be)){const A=yA(r[0]);if(!A)continue;let o=A;if(!o.startsWith("http")&&!o.startsWith("data:"))try{o=new URL(o,e||location.href).href}catch{}if(!oe(o))if(QA.resource?.has(o))QA.font?.add(o),n=n.replace(r[0],`url(${QA.resource.get(o)})`);else if(!QA.font?.has(o))try{const A=await IA(o,{as:"dataURL",useProxy:t,silent:!0});if(A.ok&&"string"==typeof A.data){const e=A.data;QA.resource?.set(o,e),QA.font?.add(o),n=n.replace(r[0],`url(${e})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",o)}}return n}function Qe(A={}){const e=new Set((A.families||[]).map(A=>String(A).toLowerCase())),t=new Set((A.domains||[]).map(A=>String(A).toLowerCase())),n=new Set((A.subsets||[]).map(A=>String(A).toLowerCase()));return(A,r)=>{if(e.size&&e.has(A.family.toLowerCase()))return!0;if(t.size)for(const e of A.srcUrls)try{if(t.has(new URL(e).host.toLowerCase()))return!0}catch{}if(n.size){const A=function(A){if(!A.length)return null;const e=(e,t)=>A.some(([A,n])=>!(n<e||A>t)),t=e(0,255)||e(305,305),n=e(256,591)||e(7680,7935),r=e(880,1023),o=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":o?"cyrillic":r?"greek":n?"latin-ext":t?"latin":null}(r);if(A&&n.has(A))return!0}return!1}}async function ye(A,e,t,n){let r;try{r=A.cssRules||[]}catch{return}const o=(A,e)=>{try{return new URL(A,e||location.href).href}catch{return A}};for(const A of r){if(A.type===CSSRule.IMPORT_RULE&&A.styleSheet){const r=A.href?o(A.href,e):e;if(n.depth>=4){console.warn(`[snapDOM] CSSOM import depth exceeded (4) at ${r}`);continue}if(r&&n.visitedSheets.has(r)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${r}`);continue}r&&n.visitedSheets.add(r);const i={...n,depth:(n.depth||0)+1};await ye(A.styleSheet,r,t,i);continue}if(A.type===CSSRule.FONT_FACE_RULE){const r=ae((A.style.getPropertyValue("font-family")||"").trim());if(!r||oe(r))continue;const o=(A.style.getPropertyValue("font-weight")||"400").trim(),i=(A.style.getPropertyValue("font-style")||"normal").trim(),s=(A.style.getPropertyValue("font-stretch")||"100%").trim(),a=(A.style.getPropertyValue("src")||"").trim(),c=(A.style.getPropertyValue("unicode-range")||"").trim();if(!n.faceMatchesRequired(r,i,o,s))continue;const l=we(c);if(!pe(n.usedCodepoints,l))continue;const u={family:r,weightSpec:o,styleSpec:i,stretchSpec:s,unicodeRange:c,srcRaw:a,srcUrls:me(a,e||location.href),href:e||location.href};if(n.simpleExcluder&&n.simpleExcluder(u,l))continue;if(/url\(/i.test(a)){const A=await Ce(a,e||location.href,n.useProxy);await t(`@font-face{font-family:${r};src:${A};font-style:${i};font-weight:${o};font-stretch:${s};${c?`unicode-range:${c};`:""}}`)}else await t(`@font-face{font-family:${r};src:${a};font-style:${i};font-weight:${o};font-stretch:${s};${c?`unicode-range:${c};`:""}}`)}}}async function Ue({required:A,usedCodepoints:e,exclude:t,localFonts:n=[],useProxy:r=""}={}){A instanceof Set||(A=new Set),e instanceof Set||(e=new Set);const o=new Map;for(const e of A){const[A,t,n,r]=String(e).split("__");if(!A)continue;const i=o.get(A)||[];i.push({w:parseInt(t,10),s:n,st:parseInt(r,10)}),o.set(A,i)}function i(A,e,t,n){if(!o.has(A))return!1;const r=o.get(A),i=function(A){const e=String(A||"400").trim(),t=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(t){const A=ce(t[1]),e=ce(t[2]);return{min:Math.min(A,e),max:Math.max(A,e)}}const n=ce(e);return{min:n,max:n}}(t),s=function(A){const e=String(A||"normal").trim().toLowerCase();return"italic"===e?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}(e),a=function(A){const e=String(A||"100%").trim(),t=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(t){const A=parseFloat(t[1]),e=parseFloat(t[2]);return{min:Math.min(A,e),max:Math.max(A,e)}}const n=e.match(/(\d+(?:\.\d+)?)\s*%/),r=n?parseFloat(n[1]):100;return{min:r,max:r}}(n),c=i.min!==i.max,l=i.min,u=A=>"normal"===s.kind&&"normal"===A||"normal"!==s.kind&&("italic"===A||"oblique"===A);let h=!1;for(const A of r){const e=c?A.w>=i.min&&A.w<=i.max:A.w===l,t=u(le(A.s)),n=A.st>=a.min&&A.st<=a.max;if(e&&t&&n){h=!0;break}}if(h)return!0;if(!c)for(const A of r){const e=u(le(A.s)),t=A.st>=a.min&&A.st<=a.max;if(Math.abs(l-A.w)<=300&&e&&t)return!0}return!1}const s=Qe(t),a=function(A,e,t,n){return`fonts-embed-css::req=${Array.from(A||[]).sort().join("|")}::ex=${e?JSON.stringify({families:(e.families||[]).map(A=>String(A).toLowerCase()).sort(),domains:(e.domains||[]).map(A=>String(A).toLowerCase()).sort(),subsets:(e.subsets||[]).map(A=>String(A).toLowerCase()).sort()}):""}::lf=${(t||[]).map(A=>`${(A.family||"").toLowerCase()}::${A.weight||"normal"}::${A.style||"normal"}::${A.src||""}`).sort().join("|")}::px=${n||""}`}(A,t,n,r);if(QA.resource?.has(a))return QA.resource.get(a);const c=function(A){const e=new Set;for(const t of A||[]){const A=String(t).split("__")[0]?.trim();A&&e.add(A)}return e}(A),l=[],u=ge;for(const A of document.querySelectorAll("style")){const e=A.textContent||"";for(const A of e.matchAll(u)){const e=(A[2]||A[4]||"").trim();if(!e||oe(e))continue;!!document.querySelector(`link[rel="stylesheet"][href="${e}"]`)||l.push(e)}}l.length&&await Promise.all(l.map(A=>new Promise(e=>{if(document.querySelector(`link[rel="stylesheet"][href="${A}"]`))return e(null);const t=document.createElement("link");t.rel="stylesheet",t.href=A,t.setAttribute("data-snapdom","injected-import"),t.onload=()=>e(t),t.onerror=()=>e(null),document.head.appendChild(t)})));let h="";const g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(A=>!!A.href);for(const A of g)try{if(oe(A.href))continue;let n="",o=!1;try{o=new URL(A.href,location.href).origin===location.origin}catch{}if(!o&&!ue(A.href,c))continue;if(o){const e=Array.from(document.styleSheets).find(e=>e.href===A.href);if(e)try{const A=e.cssRules||[];n=Array.from(A).map(A=>A.cssText).join("")}catch{}}if(!n){if(n=(await IA(A.href,{as:"text",useProxy:r})).data,oe(A.href))continue}n=await de(n,A.href,r);let a="";for(const o of n.match(fe)||[]){const n=ae((o.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim());if(!n||oe(n))continue;const c=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),l=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),h=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),g=(o.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),d=me(g,A.href);if(!i(n,l,c,u))continue;const B=we(h);if(!pe(e,B))continue;const f={family:n,weightSpec:c,styleSpec:l,stretchSpec:u,unicodeRange:h,srcRaw:g,srcUrls:d,href:A.href};if(t&&s(f,B))continue;a+=/url\(/i.test(g)?await Ce(o,A.href,r):o}a.trim()&&(h+=a)}catch{console.warn("[snapDOM] Failed to process stylesheet:",A.href)}const d={requiredIndex:o,usedCodepoints:e,faceMatchesRequired:i,simpleExcluder:t?Qe(t):null,useProxy:r,visitedSheets:new Set,depth:0};for(const A of document.styleSheets)if(!A.href||!g.some(e=>e.href===A.href))try{const e=A.href||location.href;e&&d.visitedSheets.add(e),await ye(A,e,async A=>{h+=A},d)}catch{}try{for(const A of document.fonts||[]){if(!A||!A.family||"loaded"!==A.status||!A._snapdomSrc)continue;const e=String(A.family).replace(/^['"]+|['"]+$/g,"");if(oe(e))continue;if(!o.has(e))continue;if(t?.families&&t.families.some(A=>String(A).toLowerCase()===e.toLowerCase()))continue;let n=A._snapdomSrc;if(!String(n).startsWith("data:"))if(QA.resource?.has(A._snapdomSrc))n=QA.resource.get(A._snapdomSrc),QA.font?.add(A._snapdomSrc);else if(!QA.font?.has(A._snapdomSrc))try{const e=await IA(A._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(!e.ok||"string"!=typeof e.data)continue;n=e.data,QA.resource?.set(A._snapdomSrc,n),QA.font?.add(A._snapdomSrc)}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",A._snapdomSrc);continue}h+=`@font-face{font-family:'${e}';src:url(${n});font-style:${A.style||"normal"};font-weight:${A.weight||"normal"};}`}}catch{}for(const A of n){if(!A||"object"!=typeof A)continue;const e=String(A.family||"").replace(/^['"]+|['"]+$/g,"");if(!e||oe(e))continue;if(!o.has(e))continue;if(t?.families&&t.families.some(A=>String(A).toLowerCase()===e.toLowerCase()))continue;const n=null!=A.weight?String(A.weight):"normal",i=null!=A.style?String(A.style):"normal",s=null!=A.stretchPct?`${A.stretchPct}%`:"100%",a=String(A.src||"");let c=a;if(!c.startsWith("data:"))if(QA.resource?.has(a))c=QA.resource.get(a),QA.font?.add(a);else if(!QA.font?.has(a))try{const A=await IA(a,{as:"dataURL",useProxy:r,silent:!0});if(!A.ok||"string"!=typeof A.data)continue;c=A.data,QA.resource?.set(a,c),QA.font?.add(a)}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",a);continue}h+=`@font-face{font-family:'${e}';src:url(${c});font-style:${i};font-weight:${n};font-stretch:${s};}`}return h&&(h=function(A){if(!A)return A;const e=/@font-face[^{}]*\{[^}]*\}/gi,t=new Set,n=[];for(const r of A.match(e)||[]){const A=ae(r.match(/font-family:\s*([^;]+);/i)?.[1]||""),e=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),o=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),i=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),s=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),a=(r.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),c=me(a,location.href),l=c.length?c.map(A=>String(A).toLowerCase()).sort().join("|"):a.toLowerCase(),u=[String(A||"").toLowerCase(),e,o,i,s.toLowerCase(),l].join("|");t.has(u)||(t.add(u),n.push(r))}if(0===n.length)return A;let r=0;return A.replace(e,()=>n[r++]||"")}(h),QA.resource?.set(a,h)),h}function Fe(A){const e=new Set;if(!A)return e;const t=document.createTreeWalker(A,NodeFilter.SHOW_ELEMENT,null),n=A=>{const t=ae(A.fontFamily);if(!t)return;var n,r,o;e.add((n=A.fontWeight,r=A.fontStyle,o=A.fontStretch,`${t}__${ce(n)}__${le(r)}__${function(A){const e=String(A??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}(o)}`))};n(getComputedStyle(A));const r=getComputedStyle(A,"::before");r&&r.content&&"none"!==r.content&&n(r);const o=getComputedStyle(A,"::after");for(o&&o.content&&"none"!==o.content&&n(o);t.nextNode();){const A=t.currentNode;n(getComputedStyle(A));const e=getComputedStyle(A,"::before");e&&e.content&&"none"!==e.content&&n(e);const r=getComputedStyle(A,"::after");r&&r.content&&"none"!==r.content&&n(r)}return e}function be(A,e=!1){let t="",n=Math.max(1,A);for(;n>0;)n--,t=String.fromCharCode(97+n%26)+t,n=Math.floor(n/26);return e?t.toUpperCase():t}function ve(A,e=!0){const t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let n=Math.max(1,Math.min(3999,A)),r="";for(const[A,e]of t)for(;n>=A;)r+=e,n-=A;return e?r:r.toLowerCase()}function Ee(A,e){switch((e||"decimal").toLowerCase()){case"decimal":default:return String(Math.max(0,A));case"decimal-leading-zero":return(A<10?"0":"")+String(Math.max(0,A));case"lower-alpha":return be(A,!1);case"upper-alpha":return be(A,!0);case"lower-roman":return ve(A,!1);case"upper-roman":return ve(A,!0)}}function He(A){const e=new WeakMap,t=A instanceof Document?A.documentElement:A,n=A=>{let e=0,t=A?.parentElement;if(!t)return 0;for(const n of t.children){if(n===A)break;"LI"===n.tagName&&e++}return e},r=(A,e,t)=>{const r=(A=>{const e=new Map;for(const[t,n]of A)e.set(t,n.slice());return e})(A);let o,i;try{o=t.style?.counterReset||getComputedStyle(t).counterReset}catch{}if(o&&"none"!==o)for(const A of o.split(",")){const t=A.trim().split(/\s+/),n=t[0],o=Number.isFinite(Number(t[1]))?Number(t[1]):0;if(!n)continue;const i=e.get(n);if(i&&i.length){const A=i.slice();A.push(o),r.set(n,A)}else r.set(n,[o])}try{i=t.style?.counterIncrement||getComputedStyle(t).counterIncrement}catch{}if(i&&"none"!==i)for(const A of i.split(",")){const e=A.trim().split(/\s+/),t=e[0],n=Number.isFinite(Number(e[1]))?Number(e[1]):1;if(!t)continue;const o=r.get(t)||[];0===o.length&&o.push(0),o[o.length-1]+=n,r.set(t,o)}try{if("list-item"===getComputedStyle(t).display&&(A=>A&&"LI"===A.tagName)(t)){const A=t.parentElement;let e=1;if(A&&"OL"===A.tagName){const r=A.getAttribute("start"),o=Number.isFinite(Number(r))?Number(r):1,i=n(t),s=t.getAttribute("value");e=Number.isFinite(Number(s))?Number(s):o+i}else e=1+n(t);const o=r.get("list-item")||[];0===o.length&&o.push(0),o[o.length-1]=e,r.set("list-item",o)}}catch{}return r},o=(A,t,n)=>{const i=r(n,t,A);e.set(A,i);let s=i;for(const e of A.children){s=o(e,i,s)}return i},i=new Map;return o(t,i,i),{get(A,t){const n=e.get(A)?.get(t);return n&&n.length?n[n.length-1]:0},getStack(A,t){const n=e.get(A)?.get(t);return n?n.slice():[]}}}var Ie=null,xe=new WeakMap;function Se(A,e){const t=A.parentElement,n=t?xe.get(t):null;return n?{get(A,t){const r=e.get(A,t),o=n.get(t);return"number"==typeof o?Math.max(r,o):r},getStack(A,t){const r=e.getStack(A,t);if(!r.length)return r;const o=n.get(t);if("number"==typeof o){const A=r.slice();return A[A.length-1]=Math.max(A[A.length-1],o),A}return r}}:e}function Le(A,e,t){const n=new Map;function r(A){const e=[];if(!A||"none"===A)return e;for(const t of String(A).split(",")){const A=t.trim().split(/\s+/),n=A[0],r=Number.isFinite(Number(A[1]))?Number(A[1]):void 0;n&&e.push({name:n,num:r})}return e}const o=r(e?.counterReset),i=r(e?.counterIncrement);function s(e){if(n.has(e))return n.get(e).slice();let r=t.getStack(A,e);r=r.length?r.slice():[];const s=o.find(A=>A.name===e);if(s){const A=Number.isFinite(s.num)?s.num:0;r=r.length?[...r,A]:[A]}const a=i.find(A=>A.name===e);if(a){const A=Number.isFinite(a.num)?a.num:1;0===r.length&&(r=[0]),r[r.length-1]+=A}return n.set(e,r.slice()),r}return{get(A,e){const t=s(e);return t.length?t[t.length-1]:0},getStack:(A,e)=>s(e),__incs:i}}function De(A,e,t){let n;try{n=getComputedStyle(A,e)}catch{}const r=n?.content;if(!r||"none"===r||"normal"===r)return{text:"",incs:[]};const o=Le(A,n,Se(A,t));let i=/\bcounter\s*\(|\bcounters\s*\(/.test(r||"")?function(A,e,t){if(!A||"none"===A)return A;try{const n=/\b(counter|counters)\s*\(([^)]+)\)/g;return(A.replace(n,(A,n,r)=>{const o=String(r).split(",").map(A=>A.trim());if("counter"===n){const A=o[0]?.replace(/^["']|["']$/g,""),n=(o[1]||"decimal").toLowerCase();return Ee(t.get(e,A),n)}{const A=o[0]?.replace(/^["']|["']$/g,""),n=o[1]?.replace(/^["']|["']$/g,"")??"",r=(o[2]||"decimal").toLowerCase(),i=t.getStack(e,A);return i.length?i.map(A=>Ee(A,r)).join(n):""}})||"").replace(/"([^"]*)"/g,"$1")}catch{return"- "}}(r,A,o):r;const s=function(A){if(!A)return"";const e=[],t=/"([^"]*)"/g;let n;for(;n=t.exec(A);)e.push(n[1]);return e.length?e.join(""):(A||"").replace(/"([^"]*)"/g,"$1")}(i);return{text:s,incs:o.__incs||[]}}async function Me(A,e,t,n){if(!(A instanceof Element&&e instanceof Element))return;if(!Ie)try{Ie=He(A.ownerDocument||document)}catch{}for(const r of["::before","::after","::first-letter"])try{const o=PA(A,r);if(!o||"function"!=typeof o[Symbol.iterator])continue;if(!("none"!==o.content||"none"!==o.backgroundImage||"transparent"!==o.backgroundColor||"none"!==o.borderStyle&&0!==parseFloat(o.borderWidth)||o.transform&&"none"!==o.transform||"inline"!==o.display))continue;if("::first-letter"===r){const n=getComputedStyle(A);if(!(o.color!==n.color||o.fontSize!==n.fontSize||o.fontWeight!==n.fontWeight))continue;const r=Array.from(e.childNodes).find(A=>A.nodeType===Node.TEXT_NODE&&A.textContent?.trim().length>0);if(!r)continue;const i=r.textContent,s=i.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u),a=s?.[0],c=i.slice(a?.length||0);if(!a||/[\uD800-\uDFFF]/.test(a))continue;const l=document.createElement("span");l.textContent=a,l.dataset.snapdomPseudo="::first-letter";const u=RA(OA(o),"span");t.styleMap.set(l,u);const h=document.createTextNode(c);e.replaceChild(h,r),e.insertBefore(l,h);continue}const i=o.content,{text:s,incs:a}=De(A,r,Ie),c=o.backgroundImage,l=o.backgroundColor,u=o.fontFamily,h=parseInt(o.fontSize)||32,g=parseInt(o.fontWeight)||!1,d=o.color||"#000",B=o.borderStyle,f=parseFloat(o.borderWidth),w=o.transform,p=oe(u),m="none"!==i&&""!==s,C=c&&"none"!==c,Q=l&&"transparent"!==l&&"rgba(0, 0, 0, 0)"!==l,y=B&&"none"!==B&&f>0,U=w&&"none"!==w;if(!(m||C||Q||y||U)){if(a&&a.length&&A.parentElement){const e=xe.get(A.parentElement)||new Map;for(const{name:t}of a){if(!t)continue;const n=Se(A,Ie),o=Le(A,getComputedStyle(A,r),n).get(A,t);e.set(t,o)}xe.set(A.parentElement,e)}continue}const F=document.createElement("span");F.dataset.snapdomPseudo=r,F.style.verticalAlign="middle",F.style.pointerEvents="none";const b=RA(OA(o),"span");if(t.styleMap.set(F,b),p&&s&&1===s.length){const{dataUrl:A,width:t,height:n}=await ie(s,u,g,h,d),r=document.createElement("img");r.src=A,r.style=`height:${h}px;width:${t/n*h}px;object-fit:contain;`,F.appendChild(r),e.dataset.snapdomHasIcon="true"}else if(s&&s.startsWith("url(")){const e=yA(s);if(e?.trim())try{const A=document.createElement("img"),t=await IA(UA(e),{as:"dataURL",useProxy:n.useProxy});A.src=t.data,A.style=`width:${h}px;height:auto;object-fit:contain;`,F.appendChild(A)}catch(e){console.error(`[snapdom] Error in pseudo ${r} for`,A,e)}}else!p&&m&&(F.textContent=s);if(F.style.background="none","mask"in F.style&&(F.style.mask="none"),C)try{const A=VA(c),e=await Promise.all(A.map(SA));F.style.backgroundImage=e.join(", ")}catch(A){console.warn(`[snapdom] Failed to inline background-image for ${r}`,A)}Q&&(F.style.backgroundColor=l);const v=F.childNodes.length>0||""!==F.textContent?.trim()||C||Q||y||U;if(a&&a.length&&A.parentElement){const e=xe.get(A.parentElement)||new Map,t=Se(A,Ie),n=Le(A,getComputedStyle(A,r),t);for(const{name:t}of a){if(!t)continue;const r=n.get(A,t);e.set(t,r)}xe.set(A.parentElement,e)}if(!v)continue;"::before"===r?e.insertBefore(F,e.firstChild):e.appendChild(F)}catch(e){console.warn(`[snapdom] Failed to capture ${r} for`,A,e)}const r=Array.from(A.children),o=Array.from(e.children).filter(A=>!A.dataset.snapdomPseudo);for(let A=0;A<Math.min(r.length,o.length);A++)await Me(r[A],o[A],t,n)}function ke(A){if(!A||"auto"===A)return null;const e=Number.parseFloat(A);return Number.isFinite(e)?e:null}function Ke(A,e){const t=[];for(let n=A;n&&n!==e;){const A=n.parentElement;if(!A)break;t.push(Array.prototype.indexOf.call(A.children,n)),n=A}return t.reverse()}function Te(A,e,t){let n=A;for(let A=0;A<e.length;A++){if(n=Re(n,t)[e[A]],!n)return null}return n instanceof HTMLElement?n:null}function Re(A,e){const t=[],n=A.children;for(let A=0;A<n.length;A++){const r=n[A];r.hasAttribute(e)||t.push(r)}return t}async function Pe(A,e={}){const t={styleMap:QA.session.styleMap,styleCache:QA.session.styleCache,nodeMap:QA.session.nodeMap};let n,r="",o="";!function(A){const e=getComputedStyle(A),t=e.outlineStyle,n=e.outlineWidth,r=e.borderStyle,o=e.borderWidth,i="none"!==t&&parseFloat(n)>0,s="none"===r||0===parseFloat(o);i&&s&&(A.style.border=`${n} solid transparent`)}(A);try{!function(A){if(!A)return;const e=new Set;if(A.querySelectorAll("use").forEach(A=>{const t=A.getAttribute("xlink:href")||A.getAttribute("href");t&&t.startsWith("#")&&e.add(t.slice(1))}),!e.size)return;const t=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),n=t.filter(A=>"symbol"===A.tagName.toLowerCase()),r=t.filter(A=>"defs"===A.tagName.toLowerCase());let o=A.querySelector("svg.inline-defs-container");o||(o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("aria-hidden","true"),o.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),o.classList.add("inline-defs-container"),A.insertBefore(o,A.firstChild));const i=new Set;A.querySelectorAll("symbol[id], defs > *[id]").forEach(A=>{i.add(A.id)}),e.forEach(A=>{if(i.has(A))return;const e=n.find(e=>e.id===A);if(e)return o.appendChild(e.cloneNode(!0)),void i.add(A);for(const e of r){const t=e.querySelector(`#${CSS.escape(A)}`);if(t){let e=o.querySelector("defs");e||(e=document.createElementNS("http://www.w3.org/2000/svg","defs"),o.appendChild(e)),e.appendChild(t.cloneNode(!0)),i.add(A);break}}})}(A)}catch(A){console.warn("inlineExternal defs or symbol failed:",A)}try{n=await te(A,t,e)}catch(A){throw console.warn("deepClone failed:",A),A}try{await Me(A,n,t,e)}catch(A){console.warn("inlinePseudoElements failed:",A)}await async function(A){if(!A)return;const e=A.querySelectorAll?A.querySelectorAll("img"):[];for(const A of e)try{const e=A.getAttribute("src")||A.currentSrc||"";if(We(e)){const t=await Ve(e);A.setAttribute("src",t)}const t=A.getAttribute("srcset");if(t&&t.includes("blob:")){const e=_e(t);let n=!1;for(const A of e)if(We(A.url))try{A.url=await Ve(A.url),n=!0}catch{}n&&A.setAttribute("srcset",Xe(e))}}catch{}const t=A.querySelectorAll?A.querySelectorAll("image"):[];for(const A of t)try{const e="http://www.w3.org/1999/xlink",t=A.getAttribute("href")||A.getAttributeNS?.(e,"href");if(We(t)){const n=await Ve(t);A.setAttribute("href",n),A.removeAttributeNS?.(e,"href")}}catch{}const n=A.querySelectorAll?A.querySelectorAll("[style*='blob:']"):[];for(const A of n)try{const e=A.getAttribute("style");if(e&&e.includes("blob:")){const t=await Ge(e);A.setAttribute("style",t)}}catch{}const r=A.querySelectorAll?A.querySelectorAll("style"):[];for(const A of r)try{const e=A.textContent||"";e.includes("blob:")&&(A.textContent=await Ge(e))}catch{}const o=["poster"];for(const e of o){const t=A.querySelectorAll?A.querySelectorAll(`[${e}^='blob:']`):[];for(const A of t)try{const t=A.getAttribute(e);We(t)&&A.setAttribute(e,await Ve(t))}catch{}}}(n);try{const A=n.querySelectorAll("style[data-sd]");for(const e of A)o+=e.textContent||"",e.remove()}catch{}const i=function(A){const e=Array.from(new Set(A.values())).filter(Boolean).sort(),t=new Map;let n=1;for(const A of e)t.set(A,"c"+n++);return t}(t.styleMap);r=Array.from(i.entries()).map(([A,e])=>`.${e}{${A}}`).join(""),r=o+r;for(const[A,e]of t.styleMap.entries()){if("STYLE"===A.tagName)continue;if(A.getRootNode&&A.getRootNode()instanceof ShadowRoot){A.setAttribute("style",e.replace(/;/g,"; "));continue}const t=i.get(e);t&&A.classList.add(t);const n=A.style?.backgroundImage,r=A.dataset?.snapdomHasIcon;n&&"none"!==n&&(A.style.backgroundImage=n),r&&(A.style.verticalAlign="middle",A.style.display="inline")}for(const[A,e]of t.nodeMap.entries()){const t=e.scrollLeft,n=e.scrollTop;if((t||n)&&A instanceof HTMLElement){A.style.overflow="hidden",A.style.scrollbarWidth="none",A.style.msOverflowStyle="none";const e=document.createElement("div");for(e.style.transform=`translate(${-t}px, ${-n}px)`,e.style.willChange="transform",e.style.display="inline-block",e.style.width="100%";A.firstChild;)e.appendChild(A.firstChild);A.appendChild(e)}}if(function(A,e){if(!A||!e)return;const t=A.scrollTop||0;if(!t)return;"static"===getComputedStyle(e).position&&(e.style.position="relative");const n=A.getBoundingClientRect(),r=A.clientHeight,o="data-snap-ph",i=document.createTreeWalker(A,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){const s=i.currentNode,a=getComputedStyle(s),c=a.position;if("sticky"!==c&&"-webkit-sticky"!==c)continue;const l=ke(a.top),u=ke(a.bottom);if(null==l&&null==u)continue;const h=Te(e,Ke(s,A),o);if(!h)continue;const g=s.getBoundingClientRect(),d=g.width,B=g.height,f=g.left-n.left;if(!(d>0&&B>0))continue;if(!Number.isFinite(f))continue;const w=null!=l?l+t:t+(r-B-u);if(!Number.isFinite(w))continue;const p=Number.parseInt(a.zIndex,10),m=Number.isFinite(p),C=m?Math.max(p,1)+1:2,Q=m?p-1:0,y=h.cloneNode(!1);y.setAttribute(o,"1"),y.style.position="sticky",y.style.left=`${f}px`,y.style.top=`${w}px`,y.style.width=`${d}px`,y.style.height=`${B}px`,y.style.visibility="hidden",y.style.zIndex=String(Q),y.style.overflow="hidden",y.style.background="transparent",y.style.boxShadow="none",y.style.filter="none",h.parentElement?.insertBefore(y,h),h.style.position="absolute",h.style.left=`${f}px`,h.style.top=`${w}px`,h.style.bottom="auto",h.style.zIndex=String(C),h.style.pointerEvents="none"}}(A,n instanceof HTMLElement&&n.firstElementChild instanceof HTMLElement?n.firstElementChild:n),A===t.nodeMap.get(n)){const e=t.styleCache.get(A)||window.getComputedStyle(A);t.styleCache.set(A,e);const r=function(A){if(!A||"none"===A)return"";let e=A.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(A,e)=>{const t=e.split(",").map(A=>A.trim());return 6!==t.length?`matrix(${e})`:(t[4]="0",t[5]="0",`matrix(${t.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(A,e)=>{const t=e.split(",").map(A=>A.trim());return 16!==t.length?`matrix3d(${e})`:(t[12]="0",t[13]="0",`matrix3d(${t.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}(e.transform);n.style.margin="0",n.style.top="auto",n.style.left="auto",n.style.right="auto",n.style.bottom="auto",n.style.animation="none",n.style.transition="none",n.style.willChange="auto",n.style.float="none",n.style.clear="none",n.style.transform=r||""}for(const[A,e]of t.nodeMap.entries())"PRE"===e.tagName&&(A.style.marginTop="0",A.style.marginBlockStart="0");return{clone:n,classCSS:r,styleCache:t.styleCache}}var Oe=new Map;async function Ve(A){if(QA.resource?.has(A))return QA.resource.get(A);if(Oe.has(A))return Oe.get(A);const e=(async()=>{const e=await IA(A,{as:"dataURL",silent:!0});if(!e.ok||"string"!=typeof e.data)throw new Error(`[snapDOM] Failed to read blob URL: ${A}`);return QA.resource?.set(A,e.data),e.data})();Oe.set(A,e);try{const t=await e;return Oe.set(A,t),t}catch(e){throw Oe.delete(A),e}}var Ne=/\bblob:[^)"'\s]+/g;async function Ge(A){if(!A||-1===A.indexOf("blob:"))return A;const e=Array.from(new Set(A.match(Ne)||[]));if(0===e.length)return A;let t=A;for(const A of e)try{const e=await Ve(A);t=t.split(A).join(e)}catch{}return t}function We(A){return"string"==typeof A&&A.startsWith("blob:")}function _e(A){return(A||"").split(",").map(A=>A.trim()).filter(Boolean).map(A=>{const e=A.match(/^(\S+)(\s+.+)?$/);return e?{url:e[1],desc:e[2]||""}:null}).filter(Boolean)}function Xe(A){return A.map(A=>A.desc?`${A.url} ${A.desc.trim()}`:A.url).join(", ")}function Je(A){if(!A)return()=>{};const e=function(A){const e=getComputedStyle(A);let t=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");t=(t||"").trim();const n=parseInt(t,10);return Number.isFinite(n)&&n>0?n:0}(A);if(e<=0)return()=>{};if(!function(A){return!(A.childElementCount>0)&&Array.from(A.childNodes).some(A=>A.nodeType===Node.TEXT_NODE)}(A))return()=>{};const t=getComputedStyle(A),n=Math.round(function(A){const e=(A.lineHeight||"").trim(),t=parseFloat(A.fontSize)||16;return e&&"normal"!==e?e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*t):e.endsWith("%")?Math.round(parseFloat(e)/100*t):Math.round(1.2*t):Math.round(1.2*t)}(t)*e+function(A){return(parseFloat(A.paddingTop)||0)+(parseFloat(A.paddingBottom)||0)}(t)),r=A.textContent??"",o=r;if(A.scrollHeight<=n+.5)return()=>{};let i=0,s=r.length,a=-1;for(;i<=s;){const e=i+s>>1;A.textContent=r.slice(0,e)+"…",A.scrollHeight<=n+.5?(a=e,i=e+1):s=e-1}return A.textContent=(a>=0?r.slice(0,a):"")+"…",()=>{A.textContent=o}}async function Ye(A,e){if(!A)throw new Error("Element cannot be null or undefined");!function(A="soft"){switch(A){case"auto":return QA.session.styleMap=new Map,void(QA.session.nodeMap=new Map);case"soft":default:return QA.session.styleMap=new Map,QA.session.nodeMap=new Map,void(QA.session.styleCache=new WeakMap);case"full":return;case"disabled":QA.session.styleMap=new Map,QA.session.nodeMap=new Map,QA.session.styleCache=new WeakMap,QA.computedStyle=new WeakMap,QA.baseStyle=new Map,QA.defaultStyle=new Map,QA.image=new Map,QA.background=new Map,QA.resource=new Map,QA.font=new Set}}(e.cache);const t=e.fast,n=!!e.straighten,r=!!e.noShadows;let o,i,s,a,c,l="",u="",h=null;const g=Je(A);try{({clone:o,classCSS:i,styleCache:s}=await Pe(A,e)),n&&o&&(h=function(A,e){if(!A||!e||!e.style)return null;const t=getComputedStyle(A);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}const n=t.transform||"none";if("none"===n)try{const t=Ze(A);if(1===t.a&&0===t.b&&0===t.c&&1===t.d)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}const r=n.match(/^matrix\(\s*([^)]+)\)$/i);if(r){const A=r[1].split(",").map(A=>parseFloat(A.trim()));if(6===A.length&&A.every(Number.isFinite)){const[t,n,r,o]=A,i=Math.sqrt(t*t+n*n)||0;let s=0,a=0,c=0,l=0,u=0,h=0;i>0&&(s=t/i,a=n/i,c=s*r+a*o,l=r-s*c,u=o-a*c,h=Math.sqrt(l*l+u*u)||0,h>0?c/=h:c=0);const g=i,d=0,B=c*h,f=h;try{e.style.transform=`matrix(${g}, ${d}, ${B}, ${f}, 0, 0)`}catch{}return{a:g,b:d,c:B,d:f}}}try{const A=String(n).trim();return e.style.transform=A+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}(A,o)),r&&o&&function(A,e){if(!A||!e||!e.style)return;const t=getComputedStyle(A);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}const n=(t.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=n.length?n:"none"}catch{}}(A,o)}finally{g()}await new Promise(A=>{NA(async()=>{await async function(A,e={}){const t=Array.from(A.querySelectorAll("img")),n=async A=>{if(!A.getAttribute("src")){const e=A.currentSrc||A.src||"";e&&A.setAttribute("src",e)}A.removeAttribute("srcset"),A.removeAttribute("sizes");const t=A.src||"";if(!t)return;const n=await IA(t,{as:"dataURL",useProxy:e.useProxy});if(n.ok&&"string"==typeof n.data&&n.data.startsWith("data:"))return A.src=n.data,A.width||(A.width=A.naturalWidth||100),void(A.height||(A.height=A.naturalHeight||100));const{fallbackURL:r}=e||{};if(r)try{const n=parseInt(A.dataset?.snapdomWidth||"",10)||0,o=parseInt(A.dataset?.snapdomHeight||"",10)||0,i=parseInt(A.getAttribute("width")||"",10)||0,s=parseInt(A.getAttribute("height")||"",10)||0,a=parseFloat(A.style?.width||"")||0,c=parseFloat(A.style?.height||"")||0,l=n||a||i||A.width||void 0,u=o||c||s||A.height||void 0,h="function"==typeof r?await r({width:l,height:u,src:t,element:A}):r;if(h){const t=await IA(h,{as:"dataURL",useProxy:e.useProxy});return A.src=t.data,!A.width&&l&&(A.width=l),!A.height&&u&&(A.height=u),A.width||(A.width=A.naturalWidth||100),void(A.height||(A.height=A.naturalHeight||100))}}catch{}const o=A.width||A.naturalWidth||100,i=A.height||A.naturalHeight||100;if(!1!==e.placeholders){const e=document.createElement("div");e.style.cssText=[`width:${o}px`,`height:${i}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${i}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),e.textContent="img",A.replaceWith(e)}else{const e=document.createElement("div");e.style.cssText=`display:inline-block;width:${o}px;height:${i}px;visibility:hidden;`,A.replaceWith(e)}};for(let A=0;A<t.length;A+=4){const e=t.slice(A,A+4).map(n);await Promise.allSettled(e)}}(o,e),A()},{fast:t})}),await new Promise(n=>{NA(async()=>{await async function(A,e,t,n={}){const r=[[A,e]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],i=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],s=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){const[A,e]=r.shift(),a=t.get(A)||PA(A);t.has(A)||t.set(A,a);const c=(()=>{const A=a.getPropertyValue("border-image"),e=a.getPropertyValue("border-image-source");return A&&"none"!==A||e&&"none"!==e})();for(const A of o){const t=a.getPropertyValue(A);if(!t||"none"===t)continue;const r=VA(t),o=await Promise.all(r.map(A=>SA(A,n)));o.some(A=>A&&"none"!==A&&!/^url\(undefined/.test(A))&&e.style.setProperty(A,o.join(", "))}for(const A of i){const t=a.getPropertyValue(A);t&&"initial"!==t&&e.style.setProperty(A,t)}if(c)for(const A of s){const t=a.getPropertyValue(A);t&&"initial"!==t&&e.style.setProperty(A,t)}const l=Array.from(A.children),u=Array.from(e.children);for(let A=0;A<Math.min(l.length,u.length);A++)r.push([l[A],u[A]])}}(A,o,s,e),n()},{fast:t})}),e.embedFonts&&await new Promise(n=>{NA(async()=>{const t=Fe(A),r=function(A){const e=new Set,t=A=>{if(A)for(const t of A)e.add(t.codePointAt(0))},n=document.createTreeWalker(A,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;n.nextNode();){const A=n.currentNode;if(A.nodeType===Node.TEXT_NODE)t(A.nodeValue||"");else if(A.nodeType===Node.ELEMENT_NODE){const n=A;for(const A of["::before","::after"]){const r=getComputedStyle(n,A),o=r?.getPropertyValue("content");if(o&&"none"!==o)if(/^"/.test(o)||/^'/.test(o))t(o.slice(1,-1));else{const A=o.match(/\\[0-9A-Fa-f]{1,6}/g);if(A)for(const t of A)try{e.add(parseInt(t.slice(1),16))}catch{}}}}}return e}(A);if(GA()){const A=new Set(Array.from(t).map(A=>String(A).split("__")[0]).filter(Boolean));await async function(A,e=2){try{await document.fonts.ready}catch{}const t=Array.from(A||[]).filter(Boolean);if(0===t.length)return;const n=()=>{const A=document.createElement("div");A.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(const e of t){const t=document.createElement("span");t.textContent="AaBbGg1234ÁÉÍÓÚçñ—∞",t.style.fontFamily=`"${e}"`,t.style.fontWeight="700",t.style.fontStyle="italic",t.style.fontSize="32px",t.style.lineHeight="1",t.style.whiteSpace="nowrap",t.style.margin="0",t.style.padding="0",A.appendChild(t)}document.body.appendChild(A),A.offsetWidth,document.body.removeChild(A)};for(let A=0;A<Math.max(1,e);A++)n(),await new Promise(A=>requestAnimationFrame(()=>requestAnimationFrame(A)))}(A,1)}l=await Ue({required:t,usedCodepoints:r,exclude:e.excludeFonts,useProxy:e.useProxy}),n()},{fast:t})});const d=function(A){const e=new Set;return A.nodeType!==Node.ELEMENT_NODE&&A.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(A.tagName&&e.add(A.tagName.toLowerCase()),"function"==typeof A.querySelectorAll&&A.querySelectorAll("*").forEach(A=>e.add(A.tagName.toLowerCase())),Array.from(e))}(o).sort(),B=d.join(",");QA.baseStyle.has(B)?u=QA.baseStyle.get(B):await new Promise(A=>{NA(()=>{u=function(A){const e=new Map;for(let t of A){const A=QA.defaultStyle.get(t);if(!A)continue;const n=Object.entries(A).map(([A,e])=>`${A}:${e};`).sort().join("");n&&(e.has(n)||e.set(n,[]),e.get(n).push(t))}let t="";for(let[A,n]of e.entries())t+=`${n.join(",")} { ${A} }\n`;return t}(d),QA.baseStyle.set(B,u),A()},{fast:t})}),await new Promise(s=>{NA(()=>{const t=getComputedStyle(A);const g=A.getBoundingClientRect(),d=Math.max(1,Math.ceil(A.offsetWidth||parseFloat(t.width)||g.width||1)),B=Math.max(1,Math.ceil(A.offsetHeight||parseFloat(t.height)||g.height||1)),f=(A,e=NaN)=>{const t="string"==typeof A?parseFloat(A):A;return Number.isFinite(t)?t:e},w=f(e.width),p=f(e.height);let m=d,C=B;const Q=Number.isFinite(w),y=Number.isFinite(p),U=B>0?d/B:1;Q&&y?(m=Math.max(1,Math.ceil(w)),C=Math.max(1,Math.ceil(p))):Q?(m=Math.max(1,Math.ceil(w)),C=Math.max(1,Math.ceil(m/(U||1)))):y?(C=Math.max(1,Math.ceil(p)),m=Math.max(1,Math.ceil(C*(U||1)))):(m=d,C=B);let F=0,b=0,v=d,E=B;if(n&&h&&Number.isFinite(h.a)){const A=$e(d,B,{a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},0,0);F=A.minX,b=A.minY,v=A.maxX,E=A.maxY}else{if(!n&&function(A){const e=getComputedStyle(A),t=e.transform||"none";if("none"!==t&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(t))return!0;const n=e.rotate&&"none"!==e.rotate&&"0deg"!==e.rotate,r=e.scale&&"none"!==e.scale&&"1"!==e.scale,o=e.translate&&"none"!==e.translate&&"0px 0px"!==e.translate;return Boolean(n||r||o)}(A)){const e=t.transform&&"none"!==t.transform?t.transform:"",n=function(A){const e={rotate:"0deg",scale:null,translate:null},t="function"==typeof A.computedStyleMap?A.computedStyleMap():null;if(t){const n=A=>{try{return"function"!=typeof t.has||t.has(A)?"function"!=typeof t.get?null:t.get(A):null}catch{return null}},r=n("rotate");if(r)if(r.angle){const A=r.angle;e.rotate="rad"===A.unit?180*A.value/Math.PI+"deg":A.value+A.unit}else r.unit?e.rotate="rad"===r.unit?180*r.value/Math.PI+"deg":r.value+r.unit:e.rotate=String(r);else{const t=getComputedStyle(A);e.rotate=t.rotate&&"none"!==t.rotate?t.rotate:"0deg"}const o=n("scale");if(o){const A="x"in o&&null!=o.x?.value?o.x.value:Array.isArray(o)?o[0]?.value:Number(o)||1,t="y"in o&&null!=o.y?.value?o.y.value:Array.isArray(o)?o[1]?.value:A;e.scale=`${A} ${t}`}else{const t=getComputedStyle(A);e.scale=t.scale&&"none"!==t.scale?t.scale:null}const i=n("translate");if(i){const A="x"in i&&"value"in i.x?i.x.value:Array.isArray(i)?i[0]?.value:0,t="y"in i&&"value"in i.y?i.y.value:Array.isArray(i)?i[1]?.value:0,n="x"in i&&i.x?.unit?i.x.unit:"px",r="y"in i&&i.y?.unit?i.y.unit:"px";e.translate=`${A}${n} ${t}${r}`}else{const t=getComputedStyle(A);e.translate=t.translate&&"none"!==t.translate?t.translate:null}return e}const n=getComputedStyle(A);return e.rotate=n.rotate&&"none"!==n.rotate?n.rotate:"0deg",e.scale=n.scale&&"none"!==n.scale?n.scale:null,e.translate=n.translate&&"none"!==n.translate?n.translate:null,e}(A),r=function(A){const e=function(){if(ze)return ze;const A=document.createElement("div");return A.id="snapdom-measure-slot",A.setAttribute("aria-hidden","true"),Object.assign(A.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(A),ze=A,A}(),t=document.createElement("div");t.style.transformOrigin="0 0",A.baseTransform&&(t.style.transform=A.baseTransform);A.rotate&&(t.style.rotate=A.rotate);A.scale&&(t.style.scale=A.scale);A.translate&&(t.style.translate=A.translate);e.appendChild(t);const n=Ze(t);return e.removeChild(t),n}({baseTransform:e,rotate:n.rotate||"0deg",scale:n.scale,translate:n.translate}),{ox:o,oy:i}=function(A,e,t){const n=(A.transformOrigin||"0 0").trim().split(/\s+/),[r,o]=[n[0]||"0",n[1]||"0"],i=(A,e)=>{const t=A.toLowerCase();return"left"===t||"top"===t?0:"center"===t?e/2:"right"===t||"bottom"===t?e:t.endsWith("px")?parseFloat(t)||0:t.endsWith("%")?(parseFloat(t)||0)*e/100:/^-?\d+(\.\d+)?$/.test(t)&&parseFloat(t)||0};return{ox:i(r,e),oy:i(o,t)}}(t,d,B),s=$e(d,B,r.is2D?r:new DOMMatrix(r.toString()),o,i);F=s.minX,b=s.minY,v=s.maxX,E=s.maxY}}const H=function(A){const e=A.boxShadow||"";if(!e||"none"===e)return{top:0,right:0,bottom:0,left:0};const t=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(A=>A.trim());let n=0,r=0,o=0,i=0;for(const A of t){const e=A.match(/-?\d+(\.\d+)?px/g)?.map(A=>parseFloat(A))||[];if(e.length<2)continue;const[t,s,a=0,c=0]=e,l=Math.abs(t)+a+c,u=Math.abs(s)+a+c;r=Math.max(r,l+Math.max(t,0)),i=Math.max(i,l+Math.max(-t,0)),o=Math.max(o,u+Math.max(s,0)),n=Math.max(n,u+Math.max(-s,0))}return{top:Math.ceil(n),right:Math.ceil(r),bottom:Math.ceil(o),left:Math.ceil(i)}}(t),I=function(A){const e=(A.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),t=e?Math.ceil(parseFloat(e[1])||0):0;return{top:t,right:t,bottom:t,left:t}}(t),x=function(A){if("none"===(A.outlineStyle||"none"))return{top:0,right:0,bottom:0,left:0};const e=Math.ceil(parseFloat(A.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}(t),S=function(A){const e=`${A.filter||""} ${A.webkitFilter||""}`.trim();if(!e||"none"===e)return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};const t=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[];let n=0,r=0,o=0,i=0,s=!1;for(const A of t){s=!0;const e=A.match(/-?\d+(?:\.\d+)?px/gi)?.map(A=>parseFloat(A))||[],[t=0,a=0,c=0]=e,l=Math.abs(t)+c,u=Math.abs(a)+c;r=Math.max(r,l+Math.max(t,0)),i=Math.max(i,l+Math.max(-t,0)),o=Math.max(o,u+Math.max(a,0)),n=Math.max(n,u+Math.max(-a,0))}return{bleed:{top:Math.ceil(n),right:Math.ceil(r),bottom:Math.ceil(o),left:Math.ceil(i)},has:s}}(t),L=r?{top:0,right:0,bottom:0,left:0}:{top:H.top+I.top+x.top+S.bleed.top,right:H.right+I.right+x.right+S.bleed.right,bottom:H.bottom+I.bottom+x.bottom+S.bleed.bottom,left:H.left+I.left+x.left+S.bleed.left};F-=L.left,b-=L.top,v+=L.right,E+=L.bottom;const D=Math.max(1,Math.ceil(v-F)),M=Math.max(1,Math.ceil(E-b)),k=Math.max(1,Math.round(D*(Q||y?m/d:1))),K=Math.max(1,Math.round(M*(y||Q?C/B:1))),T="http://www.w3.org/2000/svg",R=(GA()?1:0)+(n?1:0),P=document.createElementNS(T,"foreignObject"),O=Math.floor(F),V=Math.floor(b);P.setAttribute("x",String(-(O-R))),P.setAttribute("y",String(-(V-R))),P.setAttribute("width",String(Math.ceil(d+2*R))),P.setAttribute("height",String(Math.ceil(B+2*R))),P.style.overflow="visible";const N=document.createElement("style");N.textContent=u+l+"svg{overflow:visible;} foreignObject{overflow:visible;}"+i,P.appendChild(N);const G=document.createElement("div");G.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),G.style.width=`${d}px`,G.style.height=`${B}px`,G.style.overflow="visible",o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),G.appendChild(o),P.appendChild(G);const W=(new XMLSerializer).serializeToString(P),_=D+2*R,X=M+2*R,J=Q||y;e.meta={w0:d,h0:B,vbW:_,vbH:X,targetW:m,targetH:C};const Y=GA()&&J?_:k+2*R,$=GA()&&J?X:K+2*R;c=`<svg xmlns="${T}" width="${Y}" height="${$}" viewBox="0 0 ${_} ${X}">`+W+"</svg>",a=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c)}`,s()},{fast:t})});const f=document.getElementById("snapdom-sandbox");return f&&"absolute"===f.style.position&&f.remove(),a}function $e(A,e,t,n,r){const o=t.a,i=t.b,s=t.c,a=t.d,c=t.e||0,l=t.f||0;function u(A,e){let t=A-n,u=e-r,h=o*t+s*u,g=i*t+a*u;return h+=n+c,g+=r+l,[h,g]}const h=[u(0,0),u(A,0),u(0,e),u(A,e)];let g=1/0,d=1/0,B=-1/0,f=-1/0;for(const[A,e]of h)A<g&&(g=A),e<d&&(d=e),A>B&&(B=A),e>f&&(f=e);return{minX:g,minY:d,maxX:B,maxY:f,width:B-g,height:f-d}}function Ze(A){const e=getComputedStyle(A).transform;if(!e||"none"===e)return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}var ze=null;function je(A){const e=function(A){let e=[],t="",n=0;for(let r=0;r<A.length;r++){const o=A[r];"("===o&&n++,")"===o&&(n=Math.max(0,n-1)),";"===o&&0===n?(e.push(t),t=""):t+=o}return t.trim()&&e.push(t),e.map(A=>A.trim()).filter(Boolean)}(A);let t=null,n=null,r=null;const o=[];for(const A of e){const e=A.indexOf(":");if(e<0)continue;const i=A.slice(0,e).trim().toLowerCase(),s=A.slice(e+1).trim();"box-shadow"===i?r=s:"filter"===i?t=s:"-webkit-filter"===i?n=s:o.push([i,s])}if(r){const A=function(A){const e=[];let t="",n=0;for(let r=0;r<A.length;r++){const o=A[r];"("===o&&n++,")"===o&&(n=Math.max(0,n-1)),","===o&&0===n?(e.push(t.trim()),t=""):t+=o}t.trim()&&e.push(t.trim());const r=[];for(const A of e){if(/\binset\b/i.test(A))continue;const e=A.match(/-?\d+(?:\.\d+)?px/gi)||[],[t="0px",n="0px",o="0px"]=e;let i=A.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/gi,"").trim().replace(/\s{2,}/g," ");const s=!!i&&","!==i;r.push(`drop-shadow(${t} ${n} ${o}${s?` ${i}`:""})`)}return r.join(" ")}(r);A&&(t=t?`${t} ${A}`:A,n=n?`${n} ${A}`:A)}const i=[...o];return t&&i.push(["filter",t]),n&&i.push(["-webkit-filter",n]),i.map(([A,e])=>`${A}:${e}`).join(";")}function qe(A){return A=(A=A.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(A,e)=>A.replace(e,function(A){return A.replace(/([^{}]+)\{([^}]*)\}/g,(A,e,t)=>`${e}{${je(t)}}`)}(e)))).replace(/style=(['"])([\s\S]*?)\1/gi,(A,e,t)=>`style=${e}${je(t)}${e}`)}function At(A){if(!GA()||("string"!=typeof(e=A)||!/^data:image\/svg\+xml/i.test(e)))return A;var e;try{const e=function(A){const e=A.indexOf(",");return e>=0?decodeURIComponent(A.slice(e+1)):""}(A),t=qe(e);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}catch{return A}}async function et(A,e){let{width:t,height:n,scale:r=1,dpr:o=1,meta:i={}}=e;A=At(A);const s=new Image;s.loading="eager",s.decoding="sync",s.crossOrigin="anonymous",s.src=A,await s.decode();const a=s.naturalWidth,c=s.naturalHeight,l=Number.isFinite(i.w0)?i.w0:a,u=Number.isFinite(i.h0)?i.h0:c;let h,g;const d=Number.isFinite(t),B=Number.isFinite(n);if(d&&B)h=Math.max(1,t),g=Math.max(1,n);else if(d){const A=t/Math.max(1,l);h=t,g=Math.round(u*A)}else if(B){const A=n/Math.max(1,u);g=n,h=Math.round(l*A)}else h=a,g=c;h=Math.round(h*r),g=Math.round(g*r);const f=document.createElement("canvas");f.width=Math.ceil(h*o),f.height=Math.ceil(g*o),f.style.width=`${h}px`,f.style.height=`${g}px`;const w=f.getContext("2d");return 1!==o&&w.scale(o,o),w.drawImage(s,0,0,h,g),f}async function tt(A,e){const t=await et(A,e),n=e.backgroundColor?xA(t,e.backgroundColor):t,r=new Image;return r.src=n.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=n.width/e.dpr+"px",r.style.height=n.height/e.dpr+"px",r}async function nt(A,e){const{scale:t=1,width:n,height:r,meta:o={}}=e,i=Number.isFinite(n),s=Number.isFinite(r),a=Number.isFinite(t)&&1!==t||i||s;if(GA()&&a){return await tt(A,{...e,format:"png",quality:1,meta:o})}const c=new Image;if(c.decoding="sync",c.loading="eager",c.src=A,await c.decode(),i&&s)c.style.width=`${n}px`,c.style.height=`${r}px`;else if(i){const A=Number.isFinite(o.w0)?o.w0:c.naturalWidth,e=Number.isFinite(o.h0)?o.h0:c.naturalHeight,t=n/Math.max(1,A);c.style.width=`${n}px`,c.style.height=`${Math.round(e*t)}px`}else if(s){const A=Number.isFinite(o.w0)?o.w0:c.naturalWidth,e=Number.isFinite(o.h0)?o.h0:c.naturalHeight,t=r/Math.max(1,e);c.style.height=`${r}px`,c.style.width=`${Math.round(A*t)}px`}else{const e=Math.round(c.naturalWidth*t),n=Math.round(c.naturalHeight*t);if(c.style.width=`${e}px`,c.style.height=`${n}px`,"string"==typeof A&&A.startsWith("data:image/svg+xml"))try{const t=decodeURIComponent(A.split(",")[1]).replace(/width="[^"]*"/,`width="${e}"`).replace(/height="[^"]*"/,`height="${n}"`);A=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,c.src=A}catch{}}return c}async function rt(A,e){const t=e.type;if("svg"===t){const e=decodeURIComponent(A.split(",")[1]);return new Blob([e],{type:"image/svg+xml"})}const n=await et(A,e),r=e.backgroundColor?xA(n,e.backgroundColor):n;return new Promise(A=>r.toBlob(e=>A(e),`image/${t}`,e.quality))}var ot=Symbol("snapdom.internal"),it=!1;async function st(A,e){if(!A)throw new Error("Element cannot be null or undefined");const t=function(A={}){const e=A.format??"png",t=function(A){if("string"==typeof A){const e=A.toLowerCase().trim();if("disabled"===e||"full"===e||"auto"===e||"soft"===e)return e}return"soft"}(A.cache);return{debug:A.debug??!1,fast:A.fast??!0,scale:A.scale??1,exclude:A.exclude??[],excludeMode:A.excludeMode??"hide",filter:A.filter??null,filterMode:A.filterMode??"hide",placeholders:!1!==A.placeholders,embedFonts:A.embedFonts??!1,iconFonts:Array.isArray(A.iconFonts)?A.iconFonts:A.iconFonts?[A.iconFonts]:[],localFonts:Array.isArray(A.localFonts)?A.localFonts:[],excludeFonts:A.excludeFonts??void 0,fallbackURL:A.fallbackURL??void 0,cache:t,useProxy:"string"==typeof A.useProxy?A.useProxy:"",width:A.width??null,height:A.height??null,format:e,type:A.type??"svg",quality:A.quality??.92,dpr:A.dpr??(window.devicePixelRatio||1),backgroundColor:A.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:A.filename??"snapDOM",straighten:A.straighten??!1,noShadows:A.noShadows??!1}}(e);if(GA()&&(!0===t.embedFonts||function(A){const e=document.createTreeWalker(A,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){const A=e.currentNode,t=getComputedStyle(A),n=t.backgroundImage&&"none"!==t.backgroundImage,r=t.maskImage&&"none"!==t.maskImage||t.webkitMaskImage&&"none"!==t.webkitMaskImage;if(n||r)return!0}return!1}(A)))for(let t=0;t<3;t++)try{await at(A,e),console.log("Iteración número:",t),it=!1}catch{}return t.iconFonts&&t.iconFonts.length>0&&function(A){const e=Array.isArray(A)?A:[A];for(const A of e)A instanceof RegExp?re.push(A):"string"==typeof A?re.push(new RegExp(A,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",A)}(t.iconFonts),t.snap||(t.snap={toPng:(A,e)=>st.toPng(A,e),toSvg:(A,e)=>st.toSvg(A,e)}),st.capture(A,t,ot)}async function at(A,e){if(it)return;const t={...e,fast:!0,embedFonts:!0,scale:.2};let n;try{n=await Ye(A,t)}catch{return}await new Promise(A=>{const e=new Image;e.decoding="sync",e.loading="eager",e.style.position="fixed",e.style.left=0,e.style.top=0,e.style.width="10px",e.style.height="10px",e.style.opacity="0.01",e.style.transform="translateZ(10px)",e.style.willChange="transform,opacity;",e.src=n;document.body.appendChild(e),(async()=>{await new Promise(A=>setTimeout(A,100)),e&&e.parentNode&&e.parentNode.removeChild(e),it=!0,A()})()})}st.capture=async(A,e,t)=>{if(t!==ot)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");const n=await Ye(A,e),r=A=>({...e,...A||{}}),o=A=>e=>{const t=r({...e||{},format:A}),o="jpeg"===A||"jpg"===A,i=null==t.backgroundColor||"transparent"===t.backgroundColor;return o&&i&&(t.backgroundColor="#ffffff"),tt(n,t)};return{url:n,toRaw:()=>n,toImg:A=>nt(n,r(A)),toSvg:A=>nt(n,r(A)),toCanvas:A=>et(n,r(A)),toBlob:A=>rt(n,r(A)),toPng:o("png"),toJpg:o("jpeg"),toWebp:o("webp"),download:A=>async function(A,e){if(e.dpr=1,"svg"===e.format){const t=await rt(A,{...e,type:"svg"}),n=URL.createObjectURL(t),r=document.createElement("a");return r.href=n,r.download=e.filename,r.click(),void URL.revokeObjectURL(n)}const t=await et(A,e),n=e.backgroundColor?xA(t,e.backgroundColor):t,r=document.createElement("a");r.href=n.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()}(n,r(A))}},st.toRaw=(A,e)=>st(A,e).then(A=>A.toRaw()),st.toImg=(A,e)=>st(A,e).then(A=>A.toImg()),st.toSvg=(A,e)=>st(A,e).then(A=>A.toSvg()),st.toCanvas=(A,e)=>st(A,e).then(A=>A.toCanvas()),st.toBlob=(A,e)=>st(A,e).then(A=>A.toBlob()),st.toPng=(A,e)=>st(A,{...e,format:"png"}).then(A=>A.toPng()),st.toJpg=(A,e)=>st(A,{...e,format:"jpeg"}).then(A=>A.toJpg()),st.toWebp=(A,e)=>st(A,{...e,format:"webp"}).then(A=>A.toWebp()),st.download=(A,e)=>st(A,e).then(A=>A.download());var ct="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function lt(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}function ut(A){if(A.__esModule)return A;var e=A.default;if("function"==typeof e){var t=function A(){return this instanceof A?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(A).forEach(function(e){var n=Object.getOwnPropertyDescriptor(A,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:function(){return A[e]}})}),t}var ht={exports:{}};
1
+ !function(A,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((A="undefined"!=typeof globalThis?globalThis:A||self).CustomerSDK={})}(this,function(A){"use strict";class e{constructor(A,e=!1,t,n){this.iconElement=null,this.badgeElement=null,this.onClickCallback=null,this.notificationCallback=null,this.iconPosition=null,this.debug=!1,this.isClickEnabled=!0,this.target=null,this.isDragging=!1,this.dragStarted=!1,this.dragIntent=!1,this.hasMoved=!1,this.dragOffset={x:0,y:0},this.lastTouchPosition={x:0,y:0},this.touchStartTime=0,this.clickThreshold=15,this.stoppedByIframe=!1,this.cachedContainer=null,this.cachedContainerRect=null,this.cachedIconSize={width:0,height:0},this.lastContainerUpdateTime=0,this.containerUpdateInterval=100,this.cachedIframes=[],this.lastIframeUpdateTime=0,this.iframeUpdateInterval=16,this.rafId=null,this.pendingPosition={x:0,y:0,needsUpdate:!1},this.activeDetectionRafId=null,this.activeDetectionTimeoutId=null,this.lastMousePosition={x:0,y:0,timestamp:0},this.mouseVelocity={vx:0,vy:0},this.onDragHandler=null,this.stopDragHandler=null,this.startDragHandler=null,this.mouseLeaveHandler=null,this.pointerLeaveHandler=null,this.blurHandler=null,this.dragTimeoutId=null,this.mouseLeaveTimeout=null,this.pointerLeaveTimeout=null,this.isStoppingDrag=!1,this.hasLoggedIframeWarning=!1,this.sideAttach=!0,this.sideHideRatio=.5,this.magnetic=!0,this.magneticDirection="x",this.margin=10,this.isAttachedToSide=!1,this.attachedSide="",this.autoAttachDelay=3e3,this.autoAttachTimer=null,this.iconPosition=A||null,this.debug=e,this.target=t||null,n&&(this.sideAttach=void 0===n.sideAttach||n.sideAttach,this.sideHideRatio=void 0!==n.sideHideRatio?n.sideHideRatio:.5,this.magnetic=void 0===n.magnetic||n.magnetic,this.magneticDirection=n.magneticDirection||"x",this.margin=void 0!==n.margin?n.margin:10,this.autoAttachDelay=void 0!==n.autoAttachDelay?n.autoAttachDelay:3e3)}async show(){if(this.iconElement)return;this.iconElement=document.createElement("div"),this.iconElement.className="customer-sdk-icon";const A={position:"absolute",width:"30px",height:"30px",backgroundColor:"transparent",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:"1000002",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",userSelect:"none",transition:"transform 0.2s ease",border:"none",outline:"none",overflow:"visible",pointerEvents:"none"};if(this.iconPosition)void 0!==this.iconPosition.x?(A.left="number"==typeof this.iconPosition.x?`${this.iconPosition.x}px`:this.iconPosition.x,A.right="auto"):A.right="20px",void 0!==this.iconPosition.y?(A.top="number"==typeof this.iconPosition.y?`${this.iconPosition.y}px`:this.iconPosition.y,A.bottom="auto"):A.bottom="80px";else if(this.sideAttach&&this.magnetic){const e=30*this.sideHideRatio;A.right=`-${e}px`,A.left="auto",A.bottom="80px",A.transform="translateX(0)",this.isAttachedToSide=!0,this.attachedSide="right"}else A.bottom="80px",A.right="20px";if(this.sideAttach&&this.isAttachedToSide&&this.attachedSide){const e=30*this.sideHideRatio;"left"===this.attachedSide?(A.left=`-${e}px`,A.right="auto",A.transform="translateX(0)"):"right"===this.attachedSide&&(A.right=`-${e}px`,A.left="auto",A.transform="translateX(0)")}Object.assign(this.iconElement.style,A);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.debug&&console.log("Icon image loaded successfully"),this.iconElement&&(e.style.opacity="1",e.style.visibility="visible")},e.onerror=A=>{console.error("Failed to load icon image",A)},e.style.opacity="1",e.style.visibility="visible";const t=document.createElement("div");Object.assign(t.style,{width:"100%",height:"100%",borderRadius:"50%",overflow:"hidden",position:"relative",pointerEvents:"auto"}),t.appendChild(e),this.iconElement.appendChild(t);const n=this.getTargetElement();if(this.debug&&console.log("[IconManager] Target element for icon:",{target:this.target,targetElement:n,targetElementId:n.id,targetElementClass:n.className,isBody:n===document.body}),this.sideAttach&&n!==document.body){const A=window.getComputedStyle(n),e=A.overflowX,t=A.overflowY;"hidden"!==e&&(n.dataset.originalOverflowX||(n.dataset.originalOverflowX=e||"visible",n.dataset.originalOverflowY=t||"visible"),n.style.overflowX="hidden","visible"===t&&(n.style.overflowY="auto"),this.debug&&console.log("[IconManager] Set overflow-x: hidden on target container",{target:this.target,originalOverflowX:e,originalOverflowY:t}))}n?(n.appendChild(this.iconElement),this.debug&&console.log("[IconManager] Icon added to target element:",{target:this.target,targetElement:n,targetElementId:n.id,targetElementClass:n.className})):(document.body.appendChild(this.iconElement),this.debug&&console.warn("[IconManager] Target element not found, icon added to document.body")),this.setupDragEvents(),this.magnetic&&!this.iconPosition&&setTimeout(()=>{if(this.iconElement){const A=this.getTargetElement();if(A){const e=A.getBoundingClientRect(),t=this.iconElement.offsetWidth||30,n=this.iconElement.offsetHeight||30,r=20,o=80,i=e.width-t-r,s=e.height-n-o;if(this.iconElement.style.left=`${i}px`,this.iconElement.style.top=`${s}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.sideAttach){this.isAttachedToSide=!0,this.attachedSide="right";const A=t*this.sideHideRatio;this.iconElement.style.right=`-${A}px`,this.iconElement.style.left="auto",this.iconElement.style.bottom=`${o}px`,this.iconElement.style.top="auto",this.iconElement.style.transform="translateX(0)",this.iconElement.style.transition="all 0.3s ease",this.debug&&console.log("[IconManager] Auto side attach on init",{isAttachedToSide:this.isAttachedToSide,attachedSide:this.attachedSide,hideDistance:A,right:`-${A}px`})}else this.magneticSnap(),this.debug&&console.log("[IconManager] Auto magnetic snap on init",{isAttachedToSide:this.isAttachedToSide,attachedSide:this.attachedSide})}}},200),this.sideAttach&&this.autoAttachDelay>0&&!this.isAttachedToSide&&setTimeout(()=>{this.startAutoAttachTimer()},300),this.debug&&console.log("CustomerSDK icon displayed")}forceCleanupDragEvents(){this.cleanupDragEvents()}hide(){if(this.cleanupDragEvents(),this.clearAutoAttachTimer(),this.iconElement){const A=window.getComputedStyle(this.iconElement),e=A.left,t=A.top;if("auto"!==e&&"auto"!==t&&""!==e&&""!==t){const A=parseFloat(e),n=parseFloat(t);isNaN(A)||isNaN(n)||(this.iconPosition={x:A,y:n},this.debug&&console.log("Icon position saved before hide:",this.iconPosition))}this.iconElement.remove(),this.iconElement=null,this.debug&&console.log("CustomerSDK icon hidden")}}setPosition(A){}setIconPosition(A){this.iconPosition=A,this.iconElement&&(void 0!==A.x&&(this.iconElement.style.left="number"==typeof A.x?`${A.x}px`:A.x,this.iconElement.style.right="auto"),void 0!==A.y&&(this.iconElement.style.top="number"==typeof A.y?`${A.y}px`:A.y,this.iconElement.style.bottom="auto"))}setStyle(A){}startAutoAttachTimer(){this.clearAutoAttachTimer(),this.isAttachedToSide||(this.autoAttachTimer=window.setTimeout(()=>{!this.iconElement||this.isDragging||this.dragStarted||this.autoAttachToSide(),this.autoAttachTimer=null},this.autoAttachDelay),this.debug&&console.log(`[IconManager] Auto attach timer started, will attach in ${this.autoAttachDelay}ms`))}clearAutoAttachTimer(){null!==this.autoAttachTimer&&(window.clearTimeout(this.autoAttachTimer),this.autoAttachTimer=null,this.debug&&console.log("[IconManager] Auto attach timer cleared"))}autoAttachToSide(){if(this.iconElement&&this.sideAttach)try{const A=this.getTargetElement();if(!A)return;const e=A.getBoundingClientRect(),t=this.iconElement.offsetWidth||30,n=window.getComputedStyle(this.iconElement),r=parseFloat(n.left)||0,o=n.right,i=e.width;let s=!0;if("auto"!==o&&""!==o){const A=parseFloat(o);if(!isNaN(A)){s=i-t-A>=i/2}}else s=r>=i/2;if(s){this.isAttachedToSide=!0,this.attachedSide="right";const A=t*this.sideHideRatio;this.iconElement.style.right=`-${A}px`,this.iconElement.style.left="auto"}else{this.isAttachedToSide=!0,this.attachedSide="left";const A=t*this.sideHideRatio;this.iconElement.style.left=`-${A}px`,this.iconElement.style.right="auto"}const a=window.getComputedStyle(this.iconElement);"auto"!==a.top&&""!==a.top?(this.iconElement.style.top=a.top,this.iconElement.style.bottom="auto"):"auto"!==a.bottom&&""!==a.bottom&&(this.iconElement.style.bottom=a.bottom,this.iconElement.style.top="auto"),this.iconElement.style.transform="translateX(0)",this.iconElement.style.transition="all 0.3s ease",this.debug&&console.log("[IconManager] Auto attached to side",{attachedSide:this.attachedSide,hideDistance:t*this.sideHideRatio})}catch(A){this.debug&&console.error("[IconManager] Error in autoAttachToSide:",A)}}onClick(A){this.onClickCallback=A}onNotification(A){this.notificationCallback=A}showNotification(A){if(!this.iconElement)return void(this.debug&&console.warn("Icon not displayed, cannot show notification"));const{showBadge:e=!0,badgeCount:t=0,badgeText:n="",pulse:r=!1}=A;(e||t>0)&&this.createBadge(t,n,r),this.notificationCallback&&this.notificationCallback({badgeCount:t,badgeText:n,pulse:r}),this.debug&&console.log("Notification shown:",{badgeCount:t,badgeText:n})}clearNotification(){this.badgeElement&&(this.badgeElement.remove(),this.badgeElement=null),this.debug&&console.log("Notification cleared")}setupDragEvents(){this.iconElement&&(this.startDragHandler=this.startDrag.bind(this),this.onDragHandler=this.onDrag.bind(this),this.stopDragHandler=this.stopDrag.bind(this),this.iconElement.addEventListener("mousedown",this.startDragHandler),this.iconElement.addEventListener("touchstart",this.startDragHandler,{passive:!1}))}isSDKIframeOpen(){if(!(window.innerWidth>768))return!1;const A=document.querySelector(".customer-sdk-container");if(!A)return this.debug&&console.log("[IconManager] [PC+iframe] SDK iframe container not found"),!1;const e=window.getComputedStyle(A),t=e.visibility,n=e.opacity,r=e.display,o="visible"===t&&parseFloat(n)>0&&"none"!==r;return this.debug&&console.log("[IconManager] [PC+iframe] Checking SDK iframe visibility:",{visibility:t,opacity:n,display:r,isVisible:o,parsedOpacity:parseFloat(n)}),o}startDrag(A){if(!this.iconElement||!this.isClickEnabled)return;const e="touches"in A?A.touches[0].clientX:A.clientX,t="touches"in A?A.touches[0].clientY:A.clientY;if(this.isSDKIframeOpen())return this.debug&&console.log("[IconManager] [PC+iframe] SDK iframe is open, icon dragging disabled, but click is allowed"),this.touchStartTime=Date.now(),this.lastTouchPosition.x=e,this.lastTouchPosition.y=t,this.hasMoved=!1,this.dragIntent=!1,this.dragStarted=!1,this.isDragging=!1,void(this.stopDragHandler&&(document.addEventListener("mouseup",this.stopDragHandler),document.addEventListener("touchend",this.stopDragHandler)));const n=window.innerWidth>768;if(n&&this.isMouseOverIframe(e,t))return this.debug&&console.log("[IconManager] [PC+iframe] Mouse is over iframe, icon dragging disabled, but click is allowed",{clientX:e,clientY:t,isPC:n}),this.touchStartTime=Date.now(),this.lastTouchPosition.x=e,this.lastTouchPosition.y=t,this.hasMoved=!1,this.dragIntent=!1,this.dragStarted=!1,this.isDragging=!1,void(this.stopDragHandler&&(document.addEventListener("mouseup",this.stopDragHandler),document.addEventListener("touchend",this.stopDragHandler)));if(this.clearAutoAttachTimer(),this.isStoppingDrag)return void(this.debug&&console.warn("[IconManager] startDrag called while stopping, ignoring"));if(this.isDragging||this.dragStarted)return void(this.debug&&console.warn("[IconManager] startDrag called but already dragging, ignoring",{isDragging:this.isDragging,dragStarted:this.dragStarted}));this.hasLoggedIframeWarning=!1,null===this.dragTimeoutId&&null===this.activeDetectionRafId&&null===this.rafId||(this.debug&&console.warn("[IconManager] startDrag found leftover resources, cleaning up",{hasTimeout:null!==this.dragTimeoutId,hasActiveDetection:null!==this.activeDetectionRafId,hasRaf:null!==this.rafId}),this.cleanupDragEvents());const r=A.target;if(!r||!("IFRAME"===r.tagName||r.closest("iframe")||r.closest(".customer-sdk-container")||r.closest(".customer-sdk-overlay"))){if(this.iconElement){const A=this.iconElement.getBoundingClientRect(),n=A.left+A.width/2,r=A.top+A.height/2,o=Math.min(A.width,A.height)/2,i=Math.sqrt(Math.pow(e-n,2)+Math.pow(t-r,2));if(i>o+10)return void(this.debug&&console.log("[IconManager] Touch point outside icon circle, allowing event to pass through",{distance:i,radius:o,touchPoint:{x:e,y:t},iconCenter:{x:n,y:r}}))}A.preventDefault(),A.stopPropagation(),this.iconElement&&(this.iconElement.style.pointerEvents="auto"),this.hasMoved=!1,this.dragStarted=!1,this.isDragging=!1,this.dragIntent=!0,this.touchStartTime=Date.now(),this.lastMousePosition={x:e,y:t,timestamp:Date.now()},this.lastTouchPosition.x=e,this.lastTouchPosition.y=t;try{const A=this.iconElement.getBoundingClientRect();if(!this.getTargetElement())return void(this.debug&&console.warn("Container not found"));this.dragOffset.x=e-A.left,this.dragOffset.y=t-A.top;const n=document.querySelectorAll("iframe");this.cachedIframes=Array.from(n).filter(A=>!A.closest(".customer-sdk-container")).map(A=>({element:A,rect:A.getBoundingClientRect()})),this.lastIframeUpdateTime=Date.now(),this.debug&&console.log(`[IconManager] Drag start - Found ${this.cachedIframes.length} iframe(s) (excluding SDK iframes)`,{iframes:this.cachedIframes.map(({rect:A})=>({left:A.left,top:A.top,right:A.right,bottom:A.bottom,width:A.width,height:A.height}))}),this.onDragHandler&&(document.addEventListener("mousemove",this.onDragHandler),document.addEventListener("touchmove",this.onDragHandler,{passive:!1})),this.stopDragHandler&&(document.addEventListener("mouseup",this.stopDragHandler),document.addEventListener("touchend",this.stopDragHandler)),this.mouseLeaveHandler=A=>{(A.clientY<-10||A.clientX<-10||A.clientX>window.innerWidth+10||A.clientY>window.innerHeight+10)&&!this.isMouseOverIframe(A.clientX,A.clientY)&&(this.mouseLeaveTimeout&&clearTimeout(this.mouseLeaveTimeout),this.mouseLeaveTimeout=window.setTimeout(()=>{!this.isDragging&&!this.dragStarted||this.isStoppingDrag||this.isMouseOverIframe(A.clientX,A.clientY)||(this.debug&&console.log("[IconManager] Mouse left window, stopping drag"),this.stopDrag()),this.mouseLeaveTimeout=null},100))},this.pointerLeaveHandler=A=>{(A.clientY<-10||A.clientX<-10||A.clientX>window.innerWidth+10||A.clientY>window.innerHeight+10)&&!this.isMouseOverIframe(A.clientX,A.clientY)&&(this.pointerLeaveTimeout&&clearTimeout(this.pointerLeaveTimeout),this.pointerLeaveTimeout=window.setTimeout(()=>{!this.isDragging&&!this.dragStarted||this.isStoppingDrag||this.isMouseOverIframe(A.clientX,A.clientY)||(this.debug&&console.log("[IconManager] Pointer left window, stopping drag"),this.stopDrag()),this.pointerLeaveTimeout=null},100))},document.addEventListener("mouseleave",this.mouseLeaveHandler),document.addEventListener("pointerleave",this.pointerLeaveHandler),this.blurHandler=()=>{this.isStoppingDrag||(this.isDragging||this.dragStarted)&&(this.debug&&console.log("[IconManager] Window lost focus, stopping drag"),this.stopDrag())},window.addEventListener("blur",this.blurHandler);const r=window.innerWidth>768,o=this.isMouseOverIframe(e,t);if(r)if(o){const A=()=>{const e=this.lastMousePosition;if(e&&this.isMouseOverIframe(e.x,e.y)&&(this.dragIntent||this.dragStarted||this.isDragging)){if(this.debug){const A=Date.now()-this.lastMousePosition.timestamp;console.log("[IconManager] [PC+iframe] Drag timeout but mouse is over iframe, keeping drag active (waiting for mouseup)",{timeSinceLastMove:A,lastMousePosition:this.lastMousePosition})}this.dragTimeoutId=window.setTimeout(A,5e3)}else(this.isDragging||this.dragStarted)&&this.dragStarted&&(this.debug&&console.warn("[IconManager] [PC+iframe] Drag timeout triggered, stopping drag"),this.stopDrag())};this.dragTimeoutId=window.setTimeout(A,5e3)}else this.dragTimeoutId=window.setTimeout(()=>{this.isDragging&&this.dragStarted&&(this.debug&&console.log("Drag timeout, stopping drag (likely mouse moved over iframe)"),this.stopDrag())},50);else if(o){const A=()=>{const e=this.lastMousePosition;if(e&&this.isMouseOverIframe(e.x,e.y)&&(this.dragIntent||this.dragStarted||this.isDragging)){if(this.debug){const A=Date.now()-this.lastMousePosition.timestamp;console.log("[IconManager] [Mobile+iframe] Drag timeout but mouse is over iframe, keeping drag active (waiting for mouseup)",{timeSinceLastMove:A,lastMousePosition:this.lastMousePosition})}this.dragTimeoutId=window.setTimeout(A,3e3)}else(this.isDragging||this.dragStarted)&&this.dragStarted&&(this.debug&&console.warn("[IconManager] [Mobile+iframe] Drag timeout triggered, stopping drag"),this.stopDrag())};this.dragTimeoutId=window.setTimeout(A,3e3)}else this.dragTimeoutId=window.setTimeout(()=>{this.isDragging&&this.dragStarted&&(this.debug&&console.log("Drag timeout, stopping drag (likely mouse moved over iframe)"),this.stopDrag())},50);this.startActiveDetection(),this.debug&&console.log("[IconManager] Drag start",{startPosition:{x:e,y:t},iconRect:{left:A.left,top:A.top,width:A.width,height:A.height},dragOffset:this.dragOffset})}catch(A){this.debug&&console.error("Error in startDrag:",A)}}}onDrag(A){if(!this.iconElement)return;const e="touches"in A?A.touches[0].clientX:A.clientX,t="touches"in A?A.touches[0].clientY:A.clientY,n=this.isSDKIframeOpen();if(this.debug&&console.log("[IconManager] [PC+iframe] Checking SDK iframe status:",{isSDKOpen:n,windowWidth:window.innerWidth,isPC:window.innerWidth>768}),n)return void(this.debug&&console.log("[IconManager] [PC+iframe] SDK iframe is open, blocking drag - returning immediately"));const r=window.innerWidth>768;if(r&&this.isMouseOverIframe(e,t))return void(this.debug&&console.log("[IconManager] [PC+iframe] Mouse is over iframe, blocking drag - returning immediately",{clientX:e,clientY:t,isPC:r}));if(A.preventDefault(),this.debug&&console.log("[IconManager] onDrag called",{clientPosition:{x:e,y:t},isDragging:this.isDragging,dragStarted:this.dragStarted}),this.isDragging||this.dragIntent||this.dragStarted){const A=Date.now();if(0===this.cachedIframes.length||A-this.lastIframeUpdateTime>this.iframeUpdateInterval){const e=document.querySelectorAll("iframe"),t=this.cachedIframes.length;this.cachedIframes=Array.from(e).filter(A=>!A.closest(".customer-sdk-container")).map(A=>({element:A,rect:A.getBoundingClientRect()})),this.lastIframeUpdateTime=A,this.debug&&this.cachedIframes.length!==t&&console.log(`[IconManager] Iframe cache updated - Found ${this.cachedIframes.length} iframe(s) (excluding SDK iframes)`,{iframes:this.cachedIframes.map(({rect:A})=>({left:A.left,top:A.top,right:A.right,bottom:A.bottom}))})}}const o=Date.now(),i=o-this.lastMousePosition.timestamp,s=this.lastMousePosition.x,a=this.lastMousePosition.y,c=this.lastMousePosition.timestamp;if(this.lastMousePosition={x:e,y:t,timestamp:o},c>0&&i>0&&i<100){const A=i/1e3;this.mouseVelocity.vx=(e-s)/A,this.mouseVelocity.vy=(t-a)/A,this.mouseVelocity.vx=Math.max(-2e3,Math.min(2e3,this.mouseVelocity.vx)),this.mouseVelocity.vy=Math.max(-2e3,Math.min(2e3,this.mouseVelocity.vy))}if(this.debug&&i>50&&this.lastMousePosition.timestamp>0&&console.warn(`[IconManager] Long gap between mousemove events: ${i}ms`,{lastPosition:{x:s,y:a},currentPosition:{x:e,y:t},velocity:{vx:this.mouseVelocity.vx,vy:this.mouseVelocity.vy}}),null!==this.dragTimeoutId){window.clearTimeout(this.dragTimeoutId);const A=window.innerWidth>768,n=this.isMouseOverIframe(e,t);if(A);else if(n){const A=()=>{const e=this.lastMousePosition;if(e&&this.isMouseOverIframe(e.x,e.y)&&(this.dragIntent||this.dragStarted||this.isDragging)){if(this.debug){const A=Date.now()-this.lastMousePosition.timestamp;console.log("[IconManager] [Mobile+iframe] Drag timeout but mouse is over iframe, keeping drag active (waiting for mouseup)",{timeSinceLastMove:A,lastMousePosition:this.lastMousePosition})}this.dragTimeoutId=window.setTimeout(A,3e3)}else(this.isDragging||this.dragStarted)&&(this.debug&&console.warn("[IconManager] [Mobile+iframe] Drag timeout triggered, stopping drag"),this.stopDrag())};this.dragTimeoutId=window.setTimeout(A,3e3)}else this.dragTimeoutId=window.setTimeout(()=>{if(this.isDragging){if(this.debug){const A=Date.now()-this.lastMousePosition.timestamp;console.warn("[IconManager] [Mobile] Drag timeout triggered, stopping drag",{timeSinceLastMove:A,lastMousePosition:this.lastMousePosition,iframeCount:this.cachedIframes.length})}this.stopDrag()}},200)}const l=Math.abs(e-this.lastTouchPosition.x),u=Math.abs(t-this.lastTouchPosition.y);if(Math.sqrt(l*l+u*u)>this.clickThreshold&&(this.hasMoved=!0,!this.dragStarted)){this.dragStarted=!0,this.isDragging=!0,this.isAttachedToSide&&(this.isAttachedToSide=!1,this.attachedSide="",this.iconElement&&(this.iconElement.style.transform=""));const A=window.getComputedStyle(this.iconElement);if("auto"!==A.right||"auto"!==A.bottom){const A=this.iconElement.getBoundingClientRect(),n=this.getTargetElement();if(n){const r=n.getBoundingClientRect(),o=A.left-r.left,i=A.top-r.top;this.iconElement.style.left=`${o}px`,this.iconElement.style.top=`${i}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.dragOffset.x=e-A.left,this.dragOffset.y=t-A.top}}this.iconElement.style.transition="none",this.iconElement.style.cursor="grabbing",this.debug&&console.log("Drag started (moved > threshold)")}if(this.isDragging||this.dragIntent||this.dragStarted)try{const A=Date.now(),n=this.getTargetElement();if(!n)return;(!this.cachedContainer||this.cachedContainer!==n||A-this.lastContainerUpdateTime>this.containerUpdateInterval)&&(this.cachedContainer=n,this.cachedContainerRect=n.getBoundingClientRect(),this.cachedIconSize={width:this.iconElement.offsetWidth,height:this.iconElement.offsetHeight},this.lastContainerUpdateTime=A);const r=this.cachedContainerRect,o=this.cachedIconSize.width,i=this.cachedIconSize.height,s=window.getComputedStyle(n).maxWidth,a=s&&"none"!==s?Math.min(r.width,parseFloat(s)||r.width):r.width,c=r.height;if(0===this.dragOffset.x&&0===this.dragOffset.y&&(this.dragIntent||this.dragStarted)&&this.iconElement&&!this.dragStarted){const A=this.iconElement.getBoundingClientRect();this.dragOffset.x=e-A.left,this.dragOffset.y=t-A.top,this.debug&&console.log("[IconManager] Calculated dragOffset in onDrag (fallback)",{dragOffset:this.dragOffset,clientPosition:{x:e,y:t},iconRect:A,dragStarted:this.dragStarted,dragIntent:this.dragIntent})}let l=e-this.dragOffset.x-r.left,u=t-this.dragOffset.y-r.top;const h=5-o,g=n===document.body?window.innerWidth-5:a+o-5,d=5-i,B=n===document.body?window.innerHeight-5:c+i-5;l=Math.max(h,Math.min(l,g)),u=Math.max(d,Math.min(u,B));const f=window.innerWidth>768,w=this.isMouseOverIframe(e,t);if(this.iconElement){if(this.dragIntent&&0===this.dragOffset.x&&0===this.dragOffset.y){const A=this.iconElement.getBoundingClientRect(),n={x:this.dragOffset.x,y:this.dragOffset.y};this.dragOffset.x=e-A.left,this.dragOffset.y=t-A.top,this.debug&&f&&console.log("[IconManager] [PC+iframe] Calculated dragOffset",{oldDragOffset:n,newDragOffset:{x:this.dragOffset.x,y:this.dragOffset.y},clientPosition:{x:e,y:t},iconRect:A,isOverIframe:w})}else this.debug&&f&&this.dragStarted&&0===this.dragOffset.x&&0===this.dragOffset.y&&console.warn("[IconManager] [PC] dragOffset is 0 but dragStarted is true! This should not happen.",{dragStarted:this.dragStarted,dragIntent:this.dragIntent,isDragging:this.isDragging,isOverIframe:w});if(w&&this.dragIntent&&!this.dragStarted&&(this.dragStarted=!0,this.isDragging=!0,this.hasMoved=!0),this.iconElement.style.left=`${l}px`,this.iconElement.style.top=`${u}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.debug&&f){const A=e-this.dragOffset.x-r.left,n=t-this.dragOffset.y-r.top;console.log("[IconManager] [PC+iframe] Icon position:",{x:l,y:u,isOverIframe:w,clientX:e,clientY:t,dragOffset:{x:this.dragOffset.x,y:this.dragOffset.y},containerLeft:r.left,containerTop:r.top,calculatedX:A,calculatedY:n,minX:h,maxX:g,actualWidth:a}),(Math.abs(A-l)>1||Math.abs(n-u)>1)&&console.warn("[IconManager] [PC+iframe] Position calculation mismatch!",{calculated:{x:A,y:n},actual:{x:l,y:u},dragOffset:{x:this.dragOffset.x,y:this.dragOffset.y},containerRect:{left:r.left,top:r.top},clientPosition:{x:e,y:t}})}}f?this.dragTimeoutId=w?window.setTimeout(()=>{this.isDragging&&this.dragStarted&&this.stopDrag()},5e3):window.setTimeout(()=>{this.isDragging&&this.dragStarted&&this.stopDrag()},50):w?this.iconElement&&(this.iconElement.style.left=`${l}px`,this.iconElement.style.top=`${u}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto"):(this.pendingPosition.x=l,this.pendingPosition.y=u,this.pendingPosition.needsUpdate=!0,null===this.rafId&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.pendingPosition.needsUpdate&&this.iconElement&&this.isDragging&&(this.iconElement.style.left=`${this.pendingPosition.x}px`,this.iconElement.style.top=`${this.pendingPosition.y}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.pendingPosition.needsUpdate=!1)}))),this.lastTouchPosition.x=e,this.lastTouchPosition.y=t,this.lastMousePosition.x=e,this.lastMousePosition.y=t,this.lastMousePosition.timestamp=Date.now()}catch(A){this.debug&&console.error("Error in onDrag:",A)}}updateIconPositionFromMouse(A,e){if(this.iconElement&&(this.isDragging||this.dragIntent||this.dragStarted)){if(0===this.dragOffset.x&&0===this.dragOffset.y){if(!this.dragStarted||!this.iconElement)return;{const t=this.iconElement.getBoundingClientRect();this.dragOffset.x=A-t.left,this.dragOffset.y=e-t.top}}try{const t=this.getTargetElement();if(!t)return;const n=t.getBoundingClientRect(),r=this.iconElement.offsetWidth,o=this.iconElement.offsetHeight,i=t===document.body?window.innerWidth:t.offsetWidth,s=t===document.body?window.innerHeight:t.offsetHeight;let a=A-this.dragOffset.x-n.left,c=e-this.dragOffset.y-n.top;const l=5-r,u=t===document.body?window.innerWidth-5:i+r-5,h=5-o,g=t===document.body?window.innerHeight-5:s+o-5;if(a=Math.max(l,Math.min(a,u)),c=Math.max(h,Math.min(c,g)),this.iconElement&&(this.iconElement.style.left=`${a}px`,this.iconElement.style.top=`${c}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto",this.debug)){const t=Date.now()-this.lastMousePosition.timestamp;console.log("[IconManager] [PC+iframe] Updated icon position in startActiveDetection",{mousePosition:{x:A,y:e},iconPosition:{x:a,y:c},timeSinceLastMove:t,lastMousePosition:this.lastMousePosition})}}catch(A){this.debug&&console.error("[IconManager] Error in updateIconPositionFromMouse:",A)}}}stopDrag(A){if(this.isStoppingDrag)return void(this.debug&&console.warn("[IconManager] stopDrag already in progress, ignoring duplicate call"));const e=this.touchStartTime>0&&!this.isDragging&&!this.dragStarted&&!this.hasMoved;if(!(this.isDragging||this.dragStarted||this.dragTimeoutId||this.activeDetectionRafId||e))return this.debug&&console.warn("[IconManager] stopDrag called but not dragging and not a click, ignoring"),void(this.stopDragHandler&&(document.removeEventListener("mouseup",this.stopDragHandler),document.removeEventListener("touchend",this.stopDragHandler)));if(this.isStoppingDrag=!0,A&&this.dragStarted&&this.iconElement){const e="clientX"in A?A.clientX:A.touches?.[0]?.clientX??A.changedTouches?.[0]?.clientX??0,t="clientY"in A?A.clientY:A.touches?.[0]?.clientY??A.changedTouches?.[0]?.clientY??0;if(e>0&&t>0){this.isMouseOverIframe(e,t)&&(this.lastMousePosition={x:e,y:t,timestamp:Date.now()},this.updateIconPositionFromMouse(e,t),this.debug&&console.log("[IconManager] [PC+iframe] Updated icon position from mouseup event",{mousePosition:{x:e,y:t},iconPosition:this.iconElement?{left:this.iconElement.style.left,top:this.iconElement.style.top}:null}))}}const t=this.isDragging?"drag_stopped":"not_dragging",n=this.iconElement?{left:this.iconElement.style.left,top:this.iconElement.style.top,computed:"auto"!==window.getComputedStyle(this.iconElement).left?{left:window.getComputedStyle(this.iconElement).left,top:window.getComputedStyle(this.iconElement).top}:null}:null;if(this.cleanupDragEvents(),!this.iconElement)return this.hasMoved=!1,this.isDragging=!1,this.dragStarted=!1,this.dragIntent=!1,void(this.isStoppingDrag=!1);this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer",this.iconElement.style.pointerEvents="none";const r=Date.now()-this.touchStartTime,o=!this.hasMoved&&r<1e3&&!this.dragStarted&&!this.isDragging&&(!this.dragIntent||r<200);this.debug&&console.log("[IconManager] Drag end",{stopReason:t,hasMoved:this.hasMoved,dragStarted:this.dragStarted,touchDuration:r,isValidClick:o,finalPosition:n,lastMousePosition:this.lastMousePosition});const i=o,s=this.stoppedByIframe;if(this.stoppedByIframe)this.debug&&console.log("[IconManager] Drag stopped by iframe, skipping magnetic snap and auto attach");else if(this.dragStarted&&this.magnetic&&this.iconElement&&this.magneticSnap(),this.dragStarted&&this.isDragging&&this.iconElement){const A=window.getComputedStyle(this.iconElement),e=A.left,t=A.top;if("auto"!==e&&"auto"!==t){const A=parseFloat(e),n=parseFloat(t);isNaN(A)||isNaN(n)||(this.iconPosition={x:A,y:n},this.debug&&console.log("Icon position saved:",this.iconPosition))}}this.hasMoved=!1,this.isDragging=!1,this.dragStarted=!1,this.dragIntent=!1,this.isStoppingDrag=!1,this.stoppedByIframe=!1,this.hasLoggedIframeWarning=!1,!s&&!this.isAttachedToSide&&this.sideAttach&&this.autoAttachDelay>0&&this.startAutoAttachTimer(),i&&setTimeout(()=>{!this.isClickEnabled||this.dragStarted||this.hasMoved||this.isDragging||this.handleClick()},100)}startActiveDetection(){if(null!==this.activeDetectionRafId)return void(this.debug&&console.log("[IconManager] Active detection already running"));this.debug&&console.log("[IconManager] Starting active detection mechanism");const A=()=>{if(this.isStoppingDrag||!this.isDragging&&!this.dragStarted&&!this.dragIntent)return this.debug&&console.log("[IconManager] Active detection stopped (drag ended or stopping)",{isDragging:this.isDragging,dragStarted:this.dragStarted,dragIntent:this.dragIntent,isStoppingDrag:this.isStoppingDrag}),this.activeDetectionRafId=null,void(null!==this.activeDetectionTimeoutId&&(window.clearTimeout(this.activeDetectionTimeoutId),this.activeDetectionTimeoutId=null));const e=Date.now(),t=e-this.lastMousePosition.timestamp;if(t>100){const A=this.lastMousePosition.x,n=this.lastMousePosition.y;if(0===this.cachedIframes.length||e-this.lastIframeUpdateTime>this.iframeUpdateInterval){const A=document.querySelectorAll("iframe");this.cachedIframes=Array.from(A).filter(A=>!A.closest(".customer-sdk-container")).map(A=>({element:A,rect:A.getBoundingClientRect()})),this.lastIframeUpdateTime=e}this.isMouseOverIframe(A,n)&&(!this.isDragging&&this.dragStarted&&(this.isDragging=!0,this.debug&&console.log("[IconManager] [PC+iframe] Active detection: Mouse over iframe, keeping drag state active (waiting for mouseup)")),this.debug&&t>500&&!this.hasLoggedIframeWarning&&(console.warn("[IconManager] [PC+iframe] Mouse entered iframe - mousemove events lost. Icon position frozen at last known position. Will update on mouseup.",{timeSinceLastMove:t,lastMousePosition:{x:this.lastMousePosition.x,y:this.lastMousePosition.y},note:"This is a browser security limitation. Icon will update to final position when mouse is released (mouseup event)."}),this.hasLoggedIframeWarning=!0))}const n=t>100&&this.isMouseOverIframe(this.lastMousePosition.x,this.lastMousePosition.y)?16:100;this.activeDetectionTimeoutId=window.setTimeout(()=>{this.activeDetectionTimeoutId=null,requestAnimationFrame(A)},n)};this.activeDetectionRafId=requestAnimationFrame(A)}stopActiveDetection(){null!==this.activeDetectionRafId&&(this.debug&&console.log("[IconManager] Stopping active detection mechanism"),cancelAnimationFrame(this.activeDetectionRafId),this.activeDetectionRafId=null)}isMouseOverIframe(A,e){const t=Date.now();if(0===this.cachedIframes.length||t-this.lastIframeUpdateTime>this.iframeUpdateInterval){const A=document.querySelectorAll("iframe");this.cachedIframes=Array.from(A).filter(A=>!A.closest(".customer-sdk-container")).map(A=>({element:A,rect:A.getBoundingClientRect()})),this.lastIframeUpdateTime=t}for(const{rect:t}of this.cachedIframes)if(A>=t.left&&A<=t.right&&e>=t.top&&e<=t.bottom)return!0;return!1}cleanupDragEvents(){this.onDragHandler&&(document.removeEventListener("mousemove",this.onDragHandler),document.removeEventListener("touchmove",this.onDragHandler)),this.stopDragHandler&&(document.removeEventListener("mouseup",this.stopDragHandler),document.removeEventListener("touchend",this.stopDragHandler)),this.mouseLeaveHandler&&(document.removeEventListener("mouseleave",this.mouseLeaveHandler),this.mouseLeaveHandler=null),this.pointerLeaveHandler&&(document.removeEventListener("pointerleave",this.pointerLeaveHandler),this.pointerLeaveHandler=null),this.blurHandler&&(window.removeEventListener("blur",this.blurHandler),this.blurHandler=null),null!==this.mouseLeaveTimeout&&(window.clearTimeout(this.mouseLeaveTimeout),this.mouseLeaveTimeout=null),null!==this.pointerLeaveTimeout&&(window.clearTimeout(this.pointerLeaveTimeout),this.pointerLeaveTimeout=null),null!==this.dragTimeoutId&&(window.clearTimeout(this.dragTimeoutId),this.dragTimeoutId=null),null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.stopActiveDetection(),null!==this.activeDetectionRafId&&(this.debug&&console.warn("[IconManager] Active detection RAF ID still exists, force cleaning"),cancelAnimationFrame(this.activeDetectionRafId),this.activeDetectionRafId=null),this.cachedContainer=null,this.cachedContainerRect=null,this.cachedIframes=[],this.pendingPosition.needsUpdate=!1,this.debug&&console.log("[IconManager] Cleanup completed",{isDragging:this.isDragging,dragStarted:this.dragStarted,isStoppingDrag:this.isStoppingDrag,hasTimeout:null!==this.dragTimeoutId,hasActiveDetection:null!==this.activeDetectionRafId,hasRaf:null!==this.rafId})}handleClick(){this.isClickEnabled&&(this.clearAutoAttachTimer(),this.clearNotification(),this.onClickCallback&&this.onClickCallback())}disableClick(){this.isClickEnabled=!1,this.iconElement&&this.startDragHandler&&(this.iconElement.removeEventListener("mousedown",this.startDragHandler),this.iconElement.removeEventListener("touchstart",this.startDragHandler)),this.iconElement&&(this.iconElement.style.pointerEvents="none",this.iconElement.style.cursor="default"),this.forceCleanupDragEvents()}enableClick(){this.isClickEnabled=!0,this.iconElement&&this.startDragHandler?(this.iconElement.addEventListener("mousedown",this.startDragHandler),this.iconElement.addEventListener("touchstart",this.startDragHandler,{passive:!1})):this.iconElement&&this.setupDragEvents(),this.iconElement&&(this.iconElement.style.pointerEvents="auto",this.iconElement.style.cursor="pointer")}magneticSnap(){if(this.iconElement)try{const A=this.getTargetElement();if(!A)return;const e=A.getBoundingClientRect(),t=this.iconElement.offsetWidth||30,n=this.iconElement.offsetHeight||30,r=window.getComputedStyle(A).maxWidth,o=r&&"none"!==r?Math.min(e.width,parseFloat(r)||e.width):e.width,i=window.getComputedStyle(this.iconElement),s=parseFloat(i.left)||0,a=parseFloat(i.top)||0;let c=s,l=a;if("x"===this.magneticDirection||"both"===this.magneticDirection){const A=o;if(s<A/2)if(c=this.margin,this.sideAttach&&s<t/2){this.isAttachedToSide=!0,this.attachedSide="left";c=-(t*this.sideHideRatio)}else this.isAttachedToSide=!1,this.attachedSide="";else if(c=A-t-this.margin,this.sideAttach){if(A-s-t<t/2||isNaN(s)||0===s||s>=A-t-this.margin-t/2){this.isAttachedToSide=!0,this.attachedSide="right";c=A-t*(1-this.sideHideRatio)}else this.isAttachedToSide=!1,this.attachedSide=""}else this.isAttachedToSide=!1,this.attachedSide=""}if("y"===this.magneticDirection||"both"===this.magneticDirection){const A=e.height;l=a<A/2?this.margin:A-n-this.margin}if(this.isAttachedToSide&&"right"===this.attachedSide){const A=t*this.sideHideRatio;this.iconElement.style.right=`-${A}px`,this.iconElement.style.left="auto"}else if(this.isAttachedToSide&&"left"===this.attachedSide){const A=t*this.sideHideRatio;this.iconElement.style.left=`-${A}px`,this.iconElement.style.right="auto"}else this.iconElement.style.left=`${c}px`,this.iconElement.style.right="auto";this.iconElement.style.top=`${l}px`,this.iconElement.style.bottom="auto",this.isAttachedToSide&&this.attachedSide?(this.iconElement.style.transform="translateX(0)",this.iconElement.style.transition="all 0.3s ease"):this.iconElement.style.transform="",this.isAttachedToSide&&"right"===this.attachedSide?this.iconPosition=null:this.iconPosition={x:c,y:l},this.debug&&console.log("[IconManager] Magnetic snap applied",{newPosition:{x:c,y:l},isAttachedToSide:this.isAttachedToSide,attachedSide:this.attachedSide})}catch(A){this.debug&&console.error("[IconManager] Error in magneticSnap:",A)}}getTargetElement(){if(!this.target)return document.body;if("string"==typeof this.target){const A=document.querySelector(this.target);return A||(this.debug&&console.warn(`Target element not found: ${this.target}, falling back to document.body`),document.body)}return this.target instanceof HTMLElement?document.body.contains(this.target)?this.target:(this.debug&&console.warn("Target element no longer in DOM, falling back to document.body"),document.body):document.body}createBadge(A,e="",t=!1){this.clearNotification(),this.badgeElement=document.createElement("div"),this.badgeElement.className="customer-sdk-icon-badge",this.badgeElement.textContent=A>0?A>99?"99+":A.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)",pointerEvents:"auto",...0===A&&""===e&&{width:"12px",height:"12px",minWidth:"12px",top:"-2px",left:"-2px"},...t&&{animation:"sdk-badge-pulse 1.5s infinite"}}),this.iconElement&&this.iconElement.appendChild(this.badgeElement)}}const t="p".charCodeAt(0),n="H".charCodeAt(0),r="Y".charCodeAt(0),o="s".charCodeAt(0);let i;function s(A){let e=-1;i||(i=function(){const A=new Int32Array(256);for(let e=0;e<256;e++){let t=e;for(let A=0;A<8;A++)t=1&t?3988292384^t>>>1:t>>>1;A[e]=t}return A}());for(let t=0;t<A.length;t++)e=i[255&(e^A[t])]^e>>>8;return-1^e}function a(A,e,i=!1){const a=new Uint8Array(13);e*=39.3701,a[0]=t,a[1]=n,a[2]=r,a[3]=o,a[4]=e>>>24,a[5]=e>>>16,a[6]=e>>>8,a[7]=255&e,a[8]=a[4],a[9]=a[5],a[10]=a[6],a[11]=a[7],a[12]=1;const c=s(a),l=new Uint8Array(4);if(l[0]=c>>>24,l[1]=c>>>16,l[2]=c>>>8,l[3]=255&c,i){const e=function(A){for(let e=A.length-1;e>=4;e--)if(9===A[e-4]&&A[e-3]===t&&A[e-2]===n&&A[e-1]===r&&A[e]===o)return e-3;return 0}(A);return A.set(a,e),A.set(l,e+13),A}{const e=new Uint8Array(4);e[0]=0,e[1]=0,e[2]=0,e[3]=9;const t=new Uint8Array(54);return t.set(A,0),t.set(e,33),t.set(a,37),t.set(l,50),t}}const c="[modern-screenshot]",l="undefined"!=typeof window,u=l&&"Worker"in window,h=l&&"atob"in window,g=l&&"btoa"in window,d=l?window.navigator?.userAgent:"",B=d.includes("Chrome"),f=d.includes("AppleWebKit")&&!B,w=d.includes("Firefox"),p=A=>1===A.nodeType,m=A=>"object"==typeof A.className,C=A=>"image"===A.tagName,Q=A=>p(A)&&void 0!==A.style&&!m(A),y=A=>8===A.nodeType,U=A=>"IMG"===A.tagName,F=A=>"VIDEO"===A.tagName,b=A=>"SLOT"===A.tagName;function v(A){const e=A?.createElement?.("canvas");return e&&(e.height=e.width=1),Boolean(e)&&"toDataURL"in e&&Boolean(e.toDataURL("image/webp").includes("image/webp"))}const E=A=>A.startsWith("data:");function H(A,e){if(A.match(/^[a-z]+:\/\//i))return A;if(l&&A.match(/^\/\//))return window.location.protocol+A;if(A.match(/^[a-z]+:/i))return A;if(!l)return A;const t=I().implementation.createHTMLDocument(),n=t.createElement("base"),r=t.createElement("a");return t.head.appendChild(n),t.body.appendChild(r),e&&(n.href=e),r.href=A,r.href}function I(A){return(A&&p(A)?A?.ownerDocument:A)??window.document}const x="http://www.w3.org/2000/svg";const S=A=>function(A,e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.onabort=()=>n(new Error(`Failed read blob to ${e}`)),r.readAsDataURL(A)})}(A,"dataUrl");function L(A,e){const t=I(e).createElement("img");return t.decoding="sync",t.loading="eager",t.src=A,t}function D(A,e){return new Promise(t=>{const{timeout:n,ownerDocument:r,onError:o,onWarn:i}=e??{},s="string"==typeof A?L(A,I(r)):A;let a=null,c=null;function l(){t(s),a&&clearTimeout(a),c?.()}if(n&&(a=setTimeout(l,n)),F(s)){const A=s.currentSrc||s.src;if(!A)return s.poster?D(s.poster,e).then(t):l();if(s.readyState>=2)return l();const n=l,r=e=>{i?.("Failed video load",A,e),o?.(e),l()};c=()=>{s.removeEventListener("loadeddata",n),s.removeEventListener("error",r)},s.addEventListener("loadeddata",n,{once:!0}),s.addEventListener("error",r,{once:!0})}else{const A=C(s)?s.href.baseVal:s.currentSrc||s.src;if(!A)return l();const e=async()=>{if(U(s)&&"decode"in s)try{await s.decode()}catch(e){i?.("Failed to decode image, trying to render anyway",s.dataset.originalSrc||A,e)}l()},t=e=>{i?.("Failed image load",s.dataset.originalSrc||A,e),l()};if(U(s)&&s.complete)return e();c=()=>{s.removeEventListener("load",e),s.removeEventListener("error",t)},s.addEventListener("load",e,{once:!0}),s.addEventListener("error",t,{once:!0})}})}const M=function(){let A=0;return()=>(A+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${A}`)}();function k(A){return A?.split(",").map(A=>A.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}let K=0;function T(A){const e=`${c}[#${K}]`;return K++,{time:t=>A&&console.time(`${e} ${t}`),timeEnd:t=>A&&console.timeEnd(`${e} ${t}`),warn:(...e)=>A&&((...A)=>console.warn(c,...A))(...e)}}async function R(A,e){return(t=A)&&"__CONTEXT__"in t?A:P(A,{...e,autoDestruct:!0});var t}async function P(A,e){const{scale:t=1,workerUrl:n,workerNumber:r=1}=e||{},o=Boolean(e?.debug),i=e?.features??!0,s=A.ownerDocument??(l?window.document:void 0),a=A.ownerDocument?.defaultView??(l?window:void 0),c=new Map,h={width:0,height:0,quality:1,type:"image/png",scale:t,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:o,fetch:{requestInit:(g=e?.fetch?.bypassingCache,{cache:g?"no-cache":"force-cache"}),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...e?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:r,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...e,__CONTEXT__:!0,log:T(o),node:A,ownerDocument:s,ownerWindow:a,dpi:1===t?null:96*t,svgStyleElement:O(s),svgDefsElement:s?.createElementNS(x,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:u&&n&&r?r:0})].map(()=>{try{const A=new Worker(n);return A.onmessage=async A=>{const{url:e,result:t}=A.data;t?c.get(e)?.resolve?.(t):c.get(e)?.reject?.(new Error(`Error receiving message from worker: ${e}`))},A.onmessageerror=A=>{const{url:e}=A.data;c.get(e)?.reject?.(new Error(`Error receiving message from worker: ${e}`))},A}catch(A){return h.log.warn("Failed to new Worker",A),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[v(s)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:c,drawImageCount:0,tasks:[],features:i,isEnable:A=>"restoreScrollPosition"===A?"boolean"!=typeof i&&(i[A]??!1):"boolean"==typeof i?i:i[A]??!0,shadowRoots:[]};var g;h.log.time("wait until load"),await async function(A,e){Q(A)&&(U(A)||F(A)?await D(A,e):await Promise.all(["img","video"].flatMap(t=>Array.from(A.querySelectorAll(t)).map(A=>D(A,e)))))}(A,{timeout:h.timeout,onWarn:h.log.warn}),h.log.timeEnd("wait until load");const{width:d,height:B}=function(A,e){let{width:t,height:n}=e;if(p(A)&&(!t||!n)){const e=A.getBoundingClientRect();t=t||e.width||Number(A.getAttribute("width"))||0,n=n||e.height||Number(A.getAttribute("height"))||0}return{width:t,height:n}}(A,h);return h.width=d,h.height=B,h}function O(A){if(!A)return;const e=A.createElement("style"),t=e.ownerDocument.createTextNode("\n.______background-clip--text {\n background-clip: text;\n -webkit-background-clip: text;\n}\n");return e.appendChild(t),e}async function V(A,e){const{log:t,timeout:n,drawImageCount:r,drawImageInterval:o}=e;t.time("image to canvas");const i=await D(A,{timeout:n,onWarn:e.log.warn}),{canvas:s,context2d:a}=function(A,e){const{width:t,height:n,scale:r,backgroundColor:o,maximumCanvasSize:i}=e,s=A.createElement("canvas");s.width=Math.floor(t*r),s.height=Math.floor(n*r),s.style.width=`${t}px`,s.style.height=`${n}px`,i&&(s.width>i||s.height>i)&&(s.width>i&&s.height>i?s.width>s.height?(s.height*=i/s.width,s.width=i):(s.width*=i/s.height,s.height=i):s.width>i?(s.height*=i/s.width,s.width=i):(s.width*=i/s.height,s.height=i));const a=s.getContext("2d");a&&o&&(a.fillStyle=o,a.fillRect(0,0,s.width,s.height));return{canvas:s,context2d:a}}(A.ownerDocument,e),c=()=>{try{a?.drawImage(i,0,0,s.width,s.height)}catch(A){e.log.warn("Failed to drawImage",A)}};if(c(),e.isEnable("fixSvgXmlDecode"))for(let A=0;A<r;A++)await new Promise(e=>{setTimeout(()=>{a?.clearRect(0,0,s.width,s.height),c(),e()},A+o)});return e.drawImageCount=0,t.timeEnd("image to canvas"),s}function N(A,e){if(A.ownerDocument)try{const e=A.toDataURL();if("data:,"!==e)return L(e,A.ownerDocument)}catch(A){e.log.warn("Failed to clone canvas",A)}const t=A.cloneNode(!1),n=A.getContext("2d"),r=t.getContext("2d");try{return n&&r&&r.putImageData(n.getImageData(0,0,A.width,A.height),0,0),t}catch(A){e.log.warn("Failed to clone canvas",A)}return t}function G(A,e){return(A=>"CANVAS"===A.tagName)(A)?N(A,e):(A=>"IFRAME"===A.tagName)(A)?function(A,e){try{if(A?.contentDocument?.body)return AA(A.contentDocument.body,e)}catch(A){e.log.warn("Failed to clone iframe",A)}return A.cloneNode(!1)}(A,e):U(A)?function(A){const e=A.cloneNode(!1);return A.currentSrc&&A.currentSrc!==A.src&&(e.src=A.currentSrc,e.srcset=""),"lazy"===e.loading&&(e.loading="eager"),e}(A):F(A)?async function(A,e){if(A.ownerDocument&&!A.currentSrc&&A.poster)return L(A.poster,A.ownerDocument);const t=A.cloneNode(!1);t.crossOrigin="anonymous",A.currentSrc&&A.currentSrc!==A.src&&(t.src=A.currentSrc);const n=t.ownerDocument;if(n){let r=!0;if(await D(t,{onError:()=>r=!1,onWarn:e.log.warn}),!r)return A.poster?L(A.poster,A.ownerDocument):t;t.currentTime=A.currentTime,await new Promise(A=>{t.addEventListener("seeked",A,{once:!0})});const o=n.createElement("canvas");o.width=A.offsetWidth,o.height=A.offsetHeight;try{const A=o.getContext("2d");A&&A.drawImage(t,0,0,o.width,o.height)}catch(n){return e.log.warn("Failed to clone video",n),A.poster?L(A.poster,A.ownerDocument):t}return N(o,e)}return t}(A,e):A.cloneNode(!1)}const W=["width","height","-webkit-text-fill-color"],_=["stroke","fill"];function X(A,e,t){const{defaultComputedStyles:n}=t,r=A.nodeName.toLowerCase(),o=m(A)&&"svg"!==r,i=o?_.map(e=>[e,A.getAttribute(e)]).filter(([,A])=>null!==A):[],s=[o&&"svg",r,i.map((A,e)=>`${A}=${e}`).join(","),e].filter(Boolean).join(":");if(n.has(s))return n.get(s);const a=function(A){let e=A.sandbox;if(!e){const{ownerDocument:t}=A;try{t&&(e=t.createElement("iframe"),e.id=`__SANDBOX__${M()}`,e.width="0",e.height="0",e.style.visibility="hidden",e.style.position="fixed",t.body.appendChild(e),e.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',A.sandbox=e)}catch(e){A.log.warn("Failed to getSandBox",e)}}return e}(t),c=a?.contentWindow;if(!c)return new Map;const l=c?.document;let u,h;o?(u=l.createElementNS(x,"svg"),h=u.ownerDocument.createElementNS(u.namespaceURI,r),i.forEach(([A,e])=>{h.setAttributeNS(null,A,e)}),u.appendChild(h)):u=h=l.createElement(r),h.textContent=" ",l.body.appendChild(u);const g=c.getComputedStyle(h,e),d=new Map;for(let A=g.length,e=0;e<A;e++){const A=g.item(e);W.includes(A)||d.set(A,g.getPropertyValue(A))}return l.body.removeChild(u),n.set(s,d),d}function J(A,e,t){const n=new Map,r=[],o=new Map;if(t)for(const A of t)i(A);else for(let e=A.length,t=0;t<e;t++){i(A.item(t))}for(let A=r.length,e=0;e<A;e++)o.get(r[e])?.forEach((A,e)=>n.set(e,A));function i(t){const i=A.getPropertyValue(t),s=A.getPropertyPriority(t),a=t.lastIndexOf("-"),c=a>-1?t.substring(0,a):void 0;if(c){let A=o.get(c);A||(A=new Map,o.set(c,A)),A.set(t,[i,s])}(e.get(t)!==i||s)&&(c?r.push(c):n.set(t,[i,s]))}return n}const Y=[":before",":after"],$=[":-webkit-scrollbar",":-webkit-scrollbar-button",":-webkit-scrollbar-thumb",":-webkit-scrollbar-track",":-webkit-scrollbar-track-piece",":-webkit-scrollbar-corner",":-webkit-resizer"];const Z=new Set(["symbol"]);async function z(A,e,t,n,r){if(p(t)&&((A=>"STYLE"===A.tagName)(t)||(A=>"SCRIPT"===A.tagName)(t)))return;if(n.filter&&!n.filter(t))return;Z.has(e.nodeName)||Z.has(t.nodeName)?n.currentParentNodeStyle=void 0:n.currentParentNodeStyle=n.currentNodeStyle;const o=await AA(t,n,!1,r);n.isEnable("restoreScrollPosition")&&function(A,e){if(!Q(A)||!Q(e))return;const{scrollTop:t,scrollLeft:n}=A;if(!t&&!n)return;const{transform:r}=e.style,o=new DOMMatrix(r),{a:i,b:s,c:a,d:c}=o;o.a=1,o.b=0,o.c=0,o.d=1,o.translateSelf(-n,-t),o.a=i,o.b=s,o.c=a,o.d=c,e.style.transform=o.toString()}(A,o),e.appendChild(o)}async function j(A,e,t,n){let r=A.firstChild;p(A)&&A.shadowRoot&&(r=A.shadowRoot?.firstChild,t.shadowRoots.push(A.shadowRoot));for(let o=r;o;o=o.nextSibling)if(!y(o))if(p(o)&&b(o)&&"function"==typeof o.assignedNodes){const r=o.assignedNodes();for(let o=0;o<r.length;o++)await z(A,e,r[o],t,n)}else await z(A,e,o,t,n)}const q=/^[\w-:]+$/;async function AA(A,e,t=!1,n){const{ownerDocument:r,ownerWindow:o,fontFamilies:i,onCloneEachNode:s}=e;if(r&&(A=>3===A.nodeType)(A))return n&&/\S/.test(A.data)&&n(A.data),r.createTextNode(A.data);if(r&&o&&p(A)&&(Q(A)||m(A))){const n=await G(A,e);if(e.isEnable("removeAbnormalAttributes")){const A=n.getAttributeNames();for(let e=A.length,t=0;t<e;t++){const e=A[t];q.test(e)||n.removeAttribute(e)}}const r=e.currentNodeStyle=function(A,e,t,n){const{ownerWindow:r,includeStyleProperties:o,currentParentNodeStyle:i}=n,s=e.style,a=r.getComputedStyle(A),c=X(A,null,n);i?.forEach((A,e)=>{c.delete(e)});const l=J(a,c,o);l.delete("transition-property"),l.delete("all"),l.delete("d"),l.delete("content"),t&&(l.delete("margin-top"),l.delete("margin-right"),l.delete("margin-bottom"),l.delete("margin-left"),l.delete("margin-block-start"),l.delete("margin-block-end"),l.delete("margin-inline-start"),l.delete("margin-inline-end"),l.set("box-sizing",["border-box",""])),"text"===l.get("background-clip")?.[0]&&e.classList.add("______background-clip--text"),B&&(l.has("font-kerning")||l.set("font-kerning",["normal",""]),"hidden"!==l.get("overflow-x")?.[0]&&"hidden"!==l.get("overflow-y")?.[0]||"ellipsis"!==l.get("text-overflow")?.[0]||A.scrollWidth!==A.clientWidth||l.set("text-overflow",["clip",""]));for(let A=s.length,e=0;e<A;e++)s.removeProperty(s.item(e));return l.forEach(([A,e],t)=>{s.setProperty(t,A,e)}),l}(A,n,t,e);t&&function(A,e){const{backgroundColor:t,width:n,height:r,style:o}=e,i=A.style;if(t&&i.setProperty("background-color",t,"important"),n&&i.setProperty("width",`${n}px`,"important"),r&&i.setProperty("height",`${r}px`,"important"),o)for(const A in o)i[A]=o[A]}(n,e);let o=!1;if(e.isEnable("copyScrollbar")){const e=[r.get("overflow-x")?.[0],r.get("overflow-y")?.[0]];o=e.includes("scroll")||(e.includes("auto")||e.includes("overlay"))&&(A.scrollHeight>A.clientHeight||A.scrollWidth>A.clientWidth)}const a=r.get("text-transform")?.[0],c=k(r.get("font-family")?.[0]),l=c?A=>{"uppercase"===a?A=A.toUpperCase():"lowercase"===a?A=A.toLowerCase():"capitalize"===a&&(A=A[0].toUpperCase()+A.substring(1)),c.forEach(e=>{let t=i.get(e);t||i.set(e,t=new Set),A.split("").forEach(A=>t.add(A))})}:void 0;return function(A,e,t,n,r){const{ownerWindow:o,svgStyleElement:i,svgStyles:s,currentNodeStyle:a}=n;function c(t){const i=o.getComputedStyle(A,t);let c=i.getPropertyValue("content");if(!c||"none"===c)return;r?.(c),c=c.replace(/(')|(")|(counter\(.+\))/g,"");const l=[M()],u=X(A,t,n);a?.forEach((A,e)=>{u.delete(e)});const h=J(i,u,n.includeStyleProperties);h.delete("content"),h.delete("-webkit-locale"),"text"===h.get("background-clip")?.[0]&&e.classList.add("______background-clip--text");const g=[`content: '${c}';`];if(h.forEach(([A,e],t)=>{g.push(`${t}: ${A}${e?" !important":""};`)}),1===g.length)return;try{e.className=[e.className,...l].join(" ")}catch(A){return void n.log.warn("Failed to copyPseudoClass",A)}const d=g.join("\n ");let B=s.get(d);B||(B=[],s.set(d,B)),B.push(`.${l[0]}:${t}`)}i&&o&&(Y.forEach(c),t&&$.forEach(c))}(A,n,o,e,l),function(A,e){((A=>"TEXTAREA"===A.tagName)(A)||(A=>"INPUT"===A.tagName)(A)||(A=>"SELECT"===A.tagName)(A))&&e.setAttribute("value",A.value)}(A,n),F(A)||await j(A,n,e,l),await(s?.(n)),n}const a=A.cloneNode(!1);return await j(A,a,e),await(s?.(a)),a}function eA(A){if(A.ownerDocument=void 0,A.ownerWindow=void 0,A.svgStyleElement=void 0,A.svgDefsElement=void 0,A.svgStyles.clear(),A.defaultComputedStyles.clear(),A.sandbox){try{A.sandbox.remove()}catch(e){A.log.warn("Failed to destroyContext",e)}A.sandbox=void 0}A.workers=[],A.fontFamilies.clear(),A.fontCssTexts.clear(),A.requests.clear(),A.tasks=[],A.shadowRoots=[]}function tA(A,e){const{url:t,requestType:n="text",responseType:r="text",imageDom:o}=e;let i=t;const{timeout:s,acceptOfImage:a,requests:c,fetchFn:l,fetch:{requestInit:u,bypassingCache:h,placeholderImage:g},font:d,workers:B,fontFamilies:p}=A;"image"===n&&(f||w)&&A.drawImageCount++;let m=c.get(t);if(!m){h&&h instanceof RegExp&&h.test(i)&&(i+=(/\?/.test(i)?"&":"?")+(new Date).getTime());const e=n.startsWith("font")&&d&&d.minify,w=new Set;if(e){n.split(";")[1].split(",").forEach(A=>{p.has(A)&&p.get(A).forEach(A=>w.add(A))})}const C=e&&w.size,Q={url:i,timeout:s,responseType:C?"arrayBuffer":r,headers:"image"===n?{accept:a}:void 0,...u};m={type:n,resolve:void 0,reject:void 0,response:null},m.response=(async()=>{if(l&&"image"===n){const A=await l(t);if(A)return A}return!f&&t.startsWith("http")&&B.length?new Promise((A,e)=>{B[c.size&B.length-1].postMessage({rawUrl:t,...Q}),m.resolve=A,m.reject=e}):function(A){const{url:e,timeout:t,responseType:n,...r}=A,o=new AbortController,i=t?setTimeout(()=>o.abort(),t):void 0;return fetch(e,{signal:o.signal,...r}).then(A=>{if(!A.ok)throw new Error("Failed fetch, not 2xx response",{cause:A});switch(n){case"arrayBuffer":return A.arrayBuffer();case"dataUrl":return A.blob().then(S);default:return A.text()}}).finally(()=>clearTimeout(i))}(Q)})().catch(e=>{if(c.delete(t),"image"===n&&g)return A.log.warn("Failed to fetch image base64, trying to use placeholder image",i),"string"==typeof g?g:g(o);throw e}),c.set(t,m)}return m.response}async function nA(A,e,t,n){if(!rA(A))return A;for(const[r,o]of function(A,e){const t=[];return A.replace(oA,(A,n,r)=>(t.push([r,H(r,e)]),A)),t.filter(([A])=>!E(A))}(A,e))try{const e=await tA(t,{url:o,requestType:n?"image":"text",responseType:"dataUrl"});A=A.replace(iA(r),`$1${e}$3`)}catch(A){t.log.warn("Failed to fetch css data url",r,A)}return A}function rA(A){return/url\((['"]?)([^'"]+?)\1\)/.test(A)}const oA=/url\((['"]?)([^'"]+?)\1\)/g;function iA(A){const e=A.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}const sA=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function aA(A,e){const{tasks:t}=e;p(A)&&((U(A)||C(A))&&t.push(...function(A,e){if(U(A)){const t=A.currentSrc||A.src;if(!E(t))return[tA(e,{url:t,imageDom:A,requestType:"image",responseType:"dataUrl"}).then(e=>{e&&(A.srcset="",A.dataset.originalSrc=t,A.src=e||"")})];(f||w)&&e.drawImageCount++}else if(m(A)&&!E(A.href.baseVal)){const t=A.href.baseVal;return[tA(e,{url:t,imageDom:A,requestType:"image",responseType:"dataUrl"}).then(e=>{e&&(A.dataset.originalSrc=t,A.href.baseVal=e||"")})]}return[]}(A,e)),"use"===A.tagName&&t.push(...function(A,e){const{ownerDocument:t,svgDefsElement:n}=e,r=A.getAttribute("href")??A.getAttribute("xlink:href");if(!r)return[];const[o,i]=r.split("#");if(i){const r=`#${i}`,s=e.shadowRoots.reduce((A,e)=>A??e.querySelector(`svg ${r}`),t?.querySelector(`svg ${r}`));if(o&&A.setAttribute("href",r),n?.querySelector(r))return[];if(s)return n?.appendChild(s.cloneNode(!0)),[];if(o)return[tA(e,{url:o,responseType:"text"}).then(A=>{n?.insertAdjacentHTML("beforeend",A)})]}return[]}(A,e))),Q(A)&&t.push(...function(A,e){return sA.map(t=>{const n=A.getPropertyValue(t);return n&&"none"!==n?((f||w)&&e.drawImageCount++,nA(n,null,e,!0).then(e=>{e&&n!==e&&A.setProperty(t,e,A.getPropertyPriority(t))})):null}).filter(Boolean)}(A.style,e)),A.childNodes.forEach(A=>{aA(A,e)})}async function cA(A,e){const{ownerDocument:t,svgStyleElement:n,fontFamilies:r,fontCssTexts:o,tasks:i,font:s}=e;if(t&&n&&r.size)if(s&&s.cssText){const A=dA(s.cssText,e);n.appendChild(t.createTextNode(`${A}\n`))}else{const A=Array.from(t.styleSheets).filter(A=>{try{return"cssRules"in A&&Boolean(A.cssRules.length)}catch(t){return e.log.warn(`Error while reading CSS rules from ${A.href}`,t),!1}});await Promise.all(A.flatMap(A=>Array.from(A.cssRules).map(async(t,n)=>{if("CSSImportRule"===t.constructor.name){let r=n+1;const o=t.href;let i="";try{i=await tA(e,{url:o,requestType:"text",responseType:"text"})}catch(A){e.log.warn(`Error fetch remote css import from ${o}`,A)}const s=i.replace(oA,(A,e,t)=>A.replace(t,H(t,o)));for(const t of function(A){if(null==A)return[];const e=[];let t=A.replace(lA,"");for(;;){const A=uA.exec(t);if(!A)break;e.push(A[0])}t=t.replace(uA,"");const n=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,r=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let A=n.exec(t);if(A)r.lastIndex=n.lastIndex;else{if(A=r.exec(t),!A)break;n.lastIndex=r.lastIndex}e.push(A[0])}return e}(s))try{A.insertRule(t,t.startsWith("@import")?r+=1:A.cssRules.length)}catch(A){e.log.warn("Error inserting rule from remote css import",{rule:t,error:A})}}})));A.flatMap(A=>Array.from(A.cssRules)).filter(A=>"CSSFontFaceRule"===A.constructor.name&&rA(A.style.getPropertyValue("src"))&&k(A.style.getPropertyValue("font-family"))?.some(A=>r.has(A))).forEach(A=>{const r=A,s=o.get(r.cssText);s?n.appendChild(t.createTextNode(`${s}\n`)):i.push(nA(r.cssText,r.parentStyleSheet?r.parentStyleSheet.href:null,e).then(A=>{A=dA(A,e),o.set(r.cssText,A),n.appendChild(t.createTextNode(`${A}\n`))}))})}}const lA=/(\/\*[\s\S]*?\*\/)/g,uA=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;const hA=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,gA=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function dA(A,e){const{font:t}=e,n=t?t?.preferredFormat:void 0;return n?A.replace(gA,A=>{for(;;){const[e,,t]=hA.exec(A)||[];if(!t)return"";if(t===n)return`src: ${e};`}}):A}async function BA(A,e){const t=await R(A,e);if(p(t.node)&&m(t.node))return t.node;const{ownerDocument:n,log:r,tasks:o,svgStyleElement:i,svgDefsElement:s,svgStyles:a,font:c,progress:l,autoDestruct:u,onCloneNode:h,onEmbedNode:g,onCreateForeignObjectSvg:d}=t;r.time("clone node");const B=await AA(t.node,t,!0);if(i&&n){let A="";a.forEach((e,t)=>{A+=`${e.join(",\n")} {\n ${t}\n}\n`}),i.appendChild(n.createTextNode(A))}r.timeEnd("clone node"),await(h?.(B)),!1!==c&&p(B)&&(r.time("embed web font"),await cA(0,t),r.timeEnd("embed web font")),r.time("embed node"),aA(B,t);const f=o.length;let w=0;l?.(w,f),await Promise.all([...Array.from({length:4})].map(async()=>{for(;;){const A=o.pop();if(!A)break;try{await A}catch(A){t.log.warn("Failed to run task",A)}l?.(++w,f)}})),r.timeEnd("embed node"),await(g?.(B));const C=function(A,e){const{width:t,height:n}=e,r=function(A,e,t){const n=I(t).createElementNS(x,"svg");return n.setAttributeNS(null,"width",A.toString()),n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"viewBox",`0 0 ${A} ${e}`),n}(t,n,A.ownerDocument),o=r.ownerDocument.createElementNS(r.namespaceURI,"foreignObject");return o.setAttributeNS(null,"x","0%"),o.setAttributeNS(null,"y","0%"),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.append(A),r.appendChild(o),r}(B,t);return s&&C.insertBefore(s,C.children[0]),i&&C.insertBefore(i,C.children[0]),u&&eA(t),await(d?.(C)),C}async function fA(A,e){const t=await R(A,e),n=await BA(t),r=function(A,e){let t=(new XMLSerializer).serializeToString(A);return e&&(t=t.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}(n,t.isEnable("removeControlCharacter"));t.autoDestruct||(t.svgStyleElement=O(t.ownerDocument),t.svgDefsElement=t.ownerDocument?.createElementNS(x,"defs"),t.svgStyles.clear());const o=L(r,n.ownerDocument);return await V(o,t)}async function wA(A,e){const t=await R(A,e),{log:n,quality:r,type:o,dpi:i}=t,s=await fA(t);n.time("canvas to data url");let c=s.toDataURL(o,r);if(["image/png","image/jpeg"].includes(o)&&i&&h&&g){const[A,e]=c.split(",");let t=0,n=!1;if("image/png"===o){const A=function(A){let e=A.indexOf("AAlwSFlz");return-1===e&&(e=A.indexOf("AAAJcEhZ")),-1===e&&(e=A.indexOf("AAAACXBI")),e}(e);A>=0?(t=4*Math.ceil((A+28)/3),n=!0):t=44}else"image/jpeg"===o&&(t=24);const r=e.substring(0,t),s=e.substring(t),l=window.atob(r),u=new Uint8Array(l.length);for(let A=0;A<u.length;A++)u[A]=l.charCodeAt(A);const h="image/png"===o?a(u,i,n):function(A,e){return A[13]=1,A[14]=e>>8,A[15]=255&e,A[16]=e>>8,A[17]=255&e,A}(u,i);c=[A,",",window.btoa(String.fromCharCode(...h)),s].join("")}return n.timeEnd("canvas to data url"),c}async function pA(A,e){return wA(await R(A,{...e,type:"image/jpeg"}))}async function mA(A,e){return wA(await R(A,{...e,type:"image/png"}))}async function CA(A,e){return wA(await R(A,{...e,type:"image/webp"}))}var QA={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function yA(A){const e=A.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;const t=e[2].trim();return t.startsWith("#")?null:t}function UA(A){if(/%[0-9A-Fa-f]{2}/.test(A))return A;try{return encodeURI(A)}catch{return A}}var FA=function(A="[snapDOM]",{ttlMs:e=3e5,maxEntries:t=12}={}){const n=new Map;let r=0;function o(o,i,s){if(r>=t)return;const a=Date.now();(n.get(i)||0)>a||(n.set(i,a+e),r++,"warn"===o&&console&&console.warn?console.warn(`${A} ${s}`):console&&console.error&&console.error(`${A} ${s}`))}return{warnOnce(A,e){o("warn",A,e)},errorOnce(A,e){o("error",A,e)},reset(){n.clear(),r=0}}}("[snapDOM]",{ttlMs:18e4,maxEntries:10}),bA=new Map,vA=new Map;function EA(A,e){if(!e)return!1;if(function(A){return/^data:|^blob:|^about:blank$/i.test(A)}(A))return!1;if(function(A,e){try{const t="undefined"!=typeof location&&location.href?location.href:"http://localhost/",n=e.includes("{url}")?e.split("{url}")[0]:e,r=new URL(n||".",t),o=new URL(A,t);if(o.origin===r.origin)return!0;const i=o.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}(A,e))return!1;try{const e="undefined"!=typeof location&&location.href?location.href:"http://localhost/",t=new URL(A,e);return"undefined"==typeof location||t.origin!==location.origin}catch{return!!e}}function HA(A){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>e(String(n.result||"")),n.onerror=()=>t(new Error("read_failed")),n.readAsDataURL(A)})}async function IA(A,e={}){const t=e.as??"blob",n=e.timeout??3e3,r=e.useProxy||"",o=e.errorTTL??8e3,i=e.headers||{},s=!!e.silent;if(/^data:/i.test(A))try{if("text"===t)return{ok:!0,data:String(A),status:200,url:A,fromCache:!1};if("dataURL"===t)return{ok:!0,data:String(A),status:200,url:A,fromCache:!1,mime:String(A).slice(5).split(";")[0]||""};const[,e="",n=""]=String(A).match(/^data:([^,]*),(.*)$/)||[],r=/;base64/i.test(e)?atob(n):decodeURIComponent(n),o=new Uint8Array([...r].map(A=>A.charCodeAt(0))),i=new Blob([o],{type:(e||"").split(";")[0]||""});return{ok:!0,data:i,status:200,url:A,fromCache:!1,mime:i.type||""}}catch{return{ok:!1,data:null,status:0,url:A,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(A))try{const e=await fetch(A);if(!e.ok)return{ok:!1,data:null,status:e.status,url:A,fromCache:!1,reason:"http_error"};const n=await e.blob(),r=n.type||e.headers.get("content-type")||"";if("dataURL"===t){return{ok:!0,data:await HA(n),status:e.status,url:A,fromCache:!1,mime:r}}if("text"===t){return{ok:!0,data:await n.text(),status:e.status,url:A,fromCache:!1,mime:r}}return{ok:!0,data:n,status:e.status,url:A,fromCache:!1,mime:r}}catch{return{ok:!1,data:null,status:0,url:A,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(A))return"dataURL"===t?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:A,fromCache:!1,mime:"image/png"}:{ok:!0,data:"text"===t?"":new Blob([]),status:200,url:A,fromCache:!1};const a=function(A,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,A].join("|")}(A,{as:t,timeout:n,useProxy:r,errorTTL:o}),c=vA.get(a);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&vA.delete(a);const l=bA.get(a);if(l)return l;const u=EA(A,r)?function(A,e){if(!e)return A;if(e.includes("{url}"))return e.replace("{urlRaw}",UA(A)).replace("{url}",encodeURIComponent(A));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(A)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(A)}`;if(e.endsWith("/"))return`${e}${UA(A)}`;const t=e.includes("?")?"&":"?";return`${e}${t}url=${encodeURIComponent(A)}`}(A,r):A;let h=e.credentials;if(!h)try{const e="undefined"!=typeof location&&location.href?location.href:"http://localhost/",t=new URL(A,e),n="undefined"!=typeof location&&t.origin===location.origin;h=n?"include":"omit"}catch{h="omit"}const g=new AbortController,d=setTimeout(()=>g.abort("timeout"),n),B=(async()=>{try{const n=await fetch(u,{signal:g.signal,credentials:h,headers:i});if(!n.ok){const r={ok:!1,data:null,status:n.status,url:u,fromCache:!1,reason:"http_error"};if(o>0&&vA.set(a,{until:Date.now()+o,result:r}),!s){const e=`${n.status} ${n.statusText||""}`.trim();FA.warnOnce(`http:${n.status}:${t}:${new URL(A,location?.href??"http://localhost/").origin}`,`HTTP error ${e} while fetching ${t} ${A}`)}return e.onError&&e.onError(r),r}if("text"===t){return{ok:!0,data:await n.text(),status:n.status,url:u,fromCache:!1}}const r=await n.blob(),c=r.type||n.headers.get("content-type")||"";if("dataURL"===t){return{ok:!0,data:await HA(r),status:n.status,url:u,fromCache:!1,mime:c}}return{ok:!0,data:r,status:n.status,url:u,fromCache:!1,mime:c}}catch(r){const i=r&&"object"==typeof r&&"name"in r&&"AbortError"===r.name?String(r.message||"").includes("timeout")?"timeout":"abort":"network",c={ok:!1,data:null,status:0,url:u,fromCache:!1,reason:i};if(!/^blob:/i.test(A)&&o>0&&vA.set(a,{until:Date.now()+o,result:c}),!s){const e=`${i}:${t}:${new URL(A,location?.href??"http://localhost/").origin}`,r="timeout"===i?`Timeout after ${n}ms. Consider increasing timeout or using a proxy for ${A}`:"abort"===i?`Request aborted while fetching ${t} ${A}`:`Network/CORS issue while fetching ${t} ${A}. A proxy may be required`;FA.errorOnce(e,r)}return e.onError&&e.onError(c),c}finally{clearTimeout(d),bA.delete(a)}})();return bA.set(a,B),B}function xA(A,e){if(!e||!A.width||!A.height)return A;const t=document.createElement("canvas");t.width=A.width,t.height=A.height;const n=t.getContext("2d");return n.fillStyle=e,n.fillRect(0,0,t.width,t.height),n.drawImage(A,0,0),t}async function SA(A,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(A)||"none"===A.trim())return A;const t=yA(A);if(!t)return A;const n=UA(t);if(QA.background.has(n)){const A=QA.background.get(n);return A?`url("${A}")`:"none"}try{const A=await IA(n,{as:"dataURL",useProxy:e.useProxy});return A.ok?(QA.background.set(n,A.data),`url("${A.data}")`):(QA.background.set(n,null),"none")}catch{return QA.background.set(n,null),"none"}}var LA=new Set(["meta","script","noscript","title","link","template"]),DA=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]);var MA=/(?:^|-)(animation|transition)(?:-|$)/i,kA=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,KA=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function TA(A){const e=String(A).toLowerCase();return!!KA.has(e)||(!!kA.test(e)||!!MA.test(e))}function RA(A,e){if(e=String(e||"").toLowerCase(),DA.has(e))return"";const t=[],n=function(A){if(A=String(A).toLowerCase(),DA.has(A)){const e={};return QA.defaultStyle.set(A,e),e}if(QA.defaultStyle.has(A))return QA.defaultStyle.get(A);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));const t=document.createElement(A);t.style.all="initial",e.appendChild(t);const n=getComputedStyle(t),r={};for(let A of n){if(TA(A))continue;const e=n.getPropertyValue(A);r[A]=e}return e.removeChild(t),QA.defaultStyle.set(A,r),r}(e);for(let[e,r]of Object.entries(A)){if(TA(e))continue;const A=n[e];r&&r!==A&&t.push(`${e}:${r}`)}return t.sort(),t.join(";")}function PA(A,e=null){if(!(A instanceof Element))return window.getComputedStyle(A,e);let t=QA.computedStyle.get(A);if(t||(t=new Map,QA.computedStyle.set(A,t)),!t.has(e)){const n=window.getComputedStyle(A,e);t.set(e,n)}return t.get(e)}function OA(A){const e={};for(let t of A)e[t]=A.getPropertyValue(t);return e}function VA(A){const e=[];let t=0,n=0;for(let r=0;r<A.length;r++){const o=A[r];"("===o&&t++,")"===o&&t--,","===o&&0===t&&(e.push(A.slice(n,r).trim()),n=r+1)}return e.push(A.slice(n).trim()),e}function NA(A,{fast:e=!1}={}){if(e)return A();"requestIdleCallback"in window?requestIdleCallback(A,{timeout:50}):setTimeout(A,1)}function GA(){const A="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(A),t=/AppleWebKit/i.test(A)&&/Mobile/i.test(A)&&!/Safari/i.test(A),n=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(A);return e||t||n}var WA=new WeakMap,_A=new Map,XA=0;function JA(){XA++}var YA=!1;var $A=new WeakMap;function ZA(A,e=null,t={}){const n=WA.get(A);if(n&&n.epoch===XA)return n.snapshot;const r=e||getComputedStyle(A),o=function(A,e={}){const t={},n=A.getPropertyValue("visibility");for(let e=0;e<A.length;e++){const n=A[e];let r=A.getPropertyValue(n);"background-image"!==n&&"content"!==n||!r.includes("url(")||r.includes("data:")||(r="none"),t[n]=r}if(e.embedFonts){const e=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(const n of e)if(!t[n])try{const e=A.getPropertyValue(n);e&&(t[n]=e)}catch{}}return"hidden"===n&&(t.opacity="0"),t}(r,t);return function(A,e,t){if(A instanceof HTMLElement&&A.style&&A.style.height)return;const n=e.display||"";if(n.includes("flex")||n.includes("grid"))return;if(function(A){return A instanceof HTMLImageElement||A instanceof HTMLCanvasElement||A instanceof HTMLVideoElement||A instanceof HTMLIFrameElement||A instanceof SVGElement||A instanceof HTMLObjectElement||A instanceof HTMLEmbedElement}(A))return;const r=e.position;if("absolute"===r||"fixed"===r||"sticky"===r)return;if("none"!==e.transform)return;if(function(A){if(A.backgroundImage&&"none"!==A.backgroundImage)return!0;if(A.backgroundColor&&"rgba(0, 0, 0, 0)"!==A.backgroundColor&&"transparent"!==A.backgroundColor)return!0;if((parseFloat(A.borderTopWidth)||0)>0)return!0;if((parseFloat(A.borderBottomWidth)||0)>0)return!0;if((parseFloat(A.paddingTop)||0)>0)return!0;if((parseFloat(A.paddingBottom)||0)>0)return!0;const e=A.overflowBlock||A.overflowY||"visible";return"visible"!==e}(e))return;if(function(A){const e=A.parentElement;if(!e)return!1;const t=getComputedStyle(e).display||"";return t.includes("flex")||t.includes("grid")}(A))return;if(!function(A,e){if(A.textContent&&/\S/.test(A.textContent))return!0;const t=A.firstElementChild,n=A.lastElementChild;if(t&&"BR"===t.tagName||n&&"BR"===n.tagName)return!0;const r=A.scrollHeight;if(0===r)return!1;const o=parseFloat(e.paddingTop)||0,i=parseFloat(e.paddingBottom)||0;return r>o+i}(A,e))return;delete t.height,delete t["block-size"]}(A,r,o),WA.set(A,{epoch:XA,snapshot:o}),o}async function zA(A,e,t,n){if("STYLE"===A.tagName)return;const r=function(A,e){return A&&A.session&&A.persist?A:A&&(A.styleMap||A.styleCache||A.nodeMap)?{session:A,persist:{snapshotKeyCache:_A,defaultStyle:QA.defaultStyle,baseStyle:QA.baseStyle,image:QA.image,resource:QA.resource,background:QA.background,font:QA.font},options:e||{}}:{session:QA.session,persist:{snapshotKeyCache:_A,defaultStyle:QA.defaultStyle,baseStyle:QA.baseStyle,image:QA.image,resource:QA.resource,background:QA.background,font:QA.font},options:A||e||{}}}(t,n),o=r.options&&r.options.cache||"auto";if("disabled"!==o&&function(A=document.documentElement){if(!YA){YA=!0;try{new MutationObserver(()=>JA()).observe(A,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>JA()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{const A=document.fonts;A&&(A.addEventListener?.("loadingdone",JA),A.ready?.then(()=>JA()).catch(()=>{}))}catch{}}}(document.documentElement),"disabled"!==o||r.session.__bumpedForDisabled||(JA(),_A.clear(),r.session.__bumpedForDisabled=!0),DA.has(A.tagName?.toLowerCase())){const t=A.getAttribute?.("style");t&&e.setAttribute("style",t)}const{session:i,persist:s}=r;i.styleCache.has(A)||i.styleCache.set(A,getComputedStyle(A));const a=ZA(A,i.styleCache.get(A),r.options),c=function(A){let e=$A.get(A);return e||(e=Object.entries(A).sort((A,e)=>A[0]<e[0]?-1:A[0]>e[0]?1:0).map(([A,e])=>`${A}:${e}`).join(";"),$A.set(A,e),e)}(a);let l=s.snapshotKeyCache.get(c);if(!l){l=RA(a,A.tagName?.toLowerCase()||"div"),s.snapshotKeyCache.set(c,l)}i.styleMap.set(e,l)}function jA(A,e,t){return Promise.all(A.map(A=>new Promise(n=>{!function r(){NA(t=>{!t||"function"!=typeof t.timeRemaining||t.timeRemaining()>0?e(A,n):r()},{fast:t})}()})))}function qA(A,e){return A?A=(A=(A=(A=(A=A.replace(/:host\(([^)]+)\)/g,(A,t)=>`:where(${e}:is(${t.trim()}))`)).replace(/:host\b/g,`:where(${e})`)).replace(/:host-context\(([^)]+)\)/g,(A,t)=>`:where(:where(${t.trim()}) ${e})`)).replace(/::slotted\(([^)]+)\)/g,(A,t)=>`:where(${e} ${t.trim()})`)).replace(/(^|})(\s*)([^@}{]+){/g,(A,t,n,r)=>{const o=function(A,e,t=!0){return A.split(",").map(A=>A.trim()).filter(Boolean).map(A=>{if(A.startsWith(":where("))return A;if(A.startsWith("@"))return A;const n=t?(r=(r=A).trim())?/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(r)?r:`${r}:not([data-sd-slotted])`:r:A;var r;return`:where(${e} ${n})`}).join(", ")}(r,e,!0);return`${t}${n}${o}{`}):""}function Ae(A,e){try{let t=getComputedStyle(A).getPropertyValue(e).trim();if(t)return t}catch{}try{let A=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(A)return A}catch{}return""}async function ee(A,e,t){const n=await async function(A,e=3){const t=()=>{try{return A.contentDocument||A.contentWindow?.document||null}catch{return null}};let n=t(),r=0;for(;r<e&&(!n||!n.body&&!n.documentElement);)await new Promise(A=>setTimeout(A,0)),n=t(),r++;return n&&(n.body||n.documentElement)?n:null}(A,3);if(!n)throw new Error("iframe document not accessible/ready");const{contentWidth:r,contentHeight:o,rect:i}=function(A){const e=A.getBoundingClientRect();let t=0,n=0,r=0,o=0;try{const e=getComputedStyle(A);t=parseFloat(e.borderLeftWidth)||0,n=parseFloat(e.borderRightWidth)||0,r=parseFloat(e.borderTopWidth)||0,o=parseFloat(e.borderBottomWidth)||0}catch{}return{contentWidth:Math.max(0,Math.round(e.width-(t+n))),contentHeight:Math.max(0,Math.round(e.height-(r+o))),rect:e}}(A),s=t?.snap;if(!s||"function"!=typeof s.toPng)throw new Error("snapdom.toPng not available in iframe or window");const a={...t,scale:1},c=function(A,e,t){const n=A.createElement("style");return n.setAttribute("data-sd-iframe-pin",""),n.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${t}px !important;min-width: ${e}px !important;min-height: ${t}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(A.head||A.documentElement).appendChild(n),()=>{try{n.remove()}catch{}}}(n,r,o);let l;try{l=await s.toPng(n.documentElement,a)}finally{c()}l.style.display="block",l.style.width=`${r}px`,l.style.height=`${o}px`;const u=document.createElement("div");return e.nodeMap.set(u,A),zA(A,u,e,t),u.style.overflow="hidden",u.style.display="block",u.style.width||(u.style.width=`${Math.round(i.width)}px`),u.style.height||(u.style.height=`${Math.round(i.height)}px`),u.appendChild(l),u}async function te(A,e,t){if(!A)throw new Error("Invalid node");const n=new Set;let r,o=null,i=null;if(A.nodeType===Node.ELEMENT_NODE){const e=(A.localName||A.tagName||"").toLowerCase();if("snapdom-sandbox"===A.id||A.hasAttribute("data-snapdom-sandbox"))return null;if(LA.has(e))return null}if(A.nodeType===Node.TEXT_NODE)return A.cloneNode(!0);if(A.nodeType!==Node.ELEMENT_NODE)return A.cloneNode(!0);if("exclude"===A.getAttribute("data-capture")){if("hide"===t.excludeMode){const e=document.createElement("div"),t=A.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${t.width}px;height:${t.height}px;visibility:hidden;`,e}if("remove"===t.excludeMode)return null}if(t.exclude&&Array.isArray(t.exclude))for(const e of t.exclude)try{if(A.matches?.(e)){if("hide"===t.excludeMode){const e=document.createElement("div"),t=A.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${t.width}px;height:${t.height}px;visibility:hidden;`,e}if("remove"===t.excludeMode)return null}}catch(A){console.warn(`Invalid selector in exclude option: ${e}`,A)}if("function"==typeof t.filter)try{if(!t.filter(A)){if("hide"===t.filterMode){const e=document.createElement("div"),t=A.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${t.width}px;height:${t.height}px;visibility:hidden;`,e}if("remove"===t.filterMode)return null}}catch(A){console.warn("Error in filter function:",A)}if("IFRAME"===A.tagName){let n=!1;try{n=!(!A.contentDocument&&!A.contentWindow?.document)}catch{n=!1}if(n)try{return await ee(A,e,t)}catch(A){console.warn("[SnapDOM] iframe rasterization failed, fallback:",A)}if(t.placeholders){const n=document.createElement("div");return n.style.cssText=`width:${A.offsetWidth}px;height:${A.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,zA(A,n,e,t),n}{const n=A.getBoundingClientRect(),r=document.createElement("div");return r.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,zA(A,r,e,t),r}}if("placeholder"===A.getAttribute("data-capture")){const n=A.cloneNode(!1);e.nodeMap.set(n,A),zA(A,n,e,t);const r=document.createElement("div");return r.textContent=A.getAttribute("data-placeholder-text")||"",r.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",n.appendChild(r),n}if("CANVAS"===A.tagName){const n=A.toDataURL(),r=document.createElement("img");return r.src=n,r.width=A.width,r.height=A.height,e.nodeMap.set(r,A),zA(A,r,e,t),r}try{if(r=A.cloneNode(!1),function(A,e){if(!(A instanceof Element&&e instanceof Element))return;const t=A.getAttribute?.("style");let n,r=!(!t||!t.includes("var("));if(!r&&A.attributes?.length){const e=A.attributes;for(let A=0;A<e.length;A++){const t=e[A];if(t&&"string"==typeof t.value&&t.value.includes("var(")){r=!0;break}}}if(!r)return;try{n=getComputedStyle(A)}catch{return}const o=A.style;if(o&&o.length)for(let A=0;A<o.length;A++){const t=o[A],r=o.getPropertyValue(t);if(!r||!r.includes("var("))continue;const i=n.getPropertyValue(t);if(i)try{e.style.setProperty(t,i.trim(),o.getPropertyPriority(t))}catch{}}if(A.attributes?.length){const t=A.attributes;for(let A=0;A<t.length;A++){const r=t[A];if(!r||"string"!=typeof r.value||!r.value.includes("var("))continue;const o=r.name;let i="";try{i=n.getPropertyValue(o)}catch{}if(i)try{e.style.setProperty(o,i.trim())}catch{}}}}(A,r),e.nodeMap.set(r,A),"IMG"===A.tagName){!function(A,e){try{const t=A.currentSrc||A.src||"";if(!t)return;e.setAttribute("src",t),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}(A,r);try{const e=A.getBoundingClientRect();let t=Math.round(e.width||0),n=Math.round(e.height||0);if(!t||!n){const e=window.getComputedStyle(A),r=parseFloat(e.width)||0,o=parseFloat(e.height)||0,i=parseInt(A.getAttribute("width")||"",10)||0,s=parseInt(A.getAttribute("height")||"",10)||0,a=A.width||A.naturalWidth||0,c=A.height||A.naturalHeight||0;t=Math.round(t||r||i||a||0),n=Math.round(n||o||s||c||0)}t&&(r.dataset.snapdomWidth=String(t)),n&&(r.dataset.snapdomHeight=String(n))}catch{}}}catch(e){throw console.error("[Snapdom] Failed to clone node:",A,e),e}if(A instanceof HTMLTextAreaElement){const e=A.getBoundingClientRect();r.style.width=`${e.width}px`,r.style.height=`${e.height}px`}if(A instanceof HTMLInputElement&&(r.value=A.value,r.setAttribute("value",A.value),void 0!==A.checked&&(r.checked=A.checked,A.checked&&r.setAttribute("checked",""),A.indeterminate&&(r.indeterminate=A.indeterminate))),A instanceof HTMLSelectElement&&(o=A.value),A instanceof HTMLTextAreaElement&&(i=A.value),zA(A,r,e,t),A.shadowRoot){let o=function(A,n){if(A.nodeType===Node.ELEMENT_NODE&&"STYLE"===A.tagName)return n(null);te(A,e,t).then(A=>{n(A||null)}).catch(()=>{n(null)})};try{const e=A.shadowRoot.querySelectorAll("slot");for(const A of e){let e=[];try{e=A.assignedNodes?.({flatten:!0})||A.assignedNodes?.()||[]}catch{e=A.assignedNodes?.()||[]}for(const A of e)n.add(A)}}catch{}const i=function(A){return A.shadowScopeSeq=(A.shadowScopeSeq||0)+1,`s${A.shadowScopeSeq}`}(e),s=`[data-sd="${i}"]`;try{r.setAttribute("data-sd",i)}catch{}const a=function(A){let e="";try{A.querySelectorAll("style").forEach(A=>{e+=(A.textContent||"")+"\n"});const t=A.adoptedStyleSheets||[];for(const A of t)try{if(A&&A.cssRules)for(const t of A.cssRules)e+=t.cssText+"\n"}catch{}}catch{}return e}(A.shadowRoot),c=qA(a,s),l=function(A,e,t){const n=[];for(const t of e){const e=Ae(A,t);e&&n.push(`${t}: ${e};`)}return n.length?`${t}{${n.join("")}}\n`:""}(A,function(A){const e=new Set;if(!A)return e;const t=/var\(\s*(--[A-Za-z0-9_-]+)\b/g;let n;for(;n=t.exec(A);)e.add(n[1]);return e}(a),s);!function(A,e,t){if(!e)return;const n=document.createElement("style");n.setAttribute("data-sd",t),n.textContent=e,A.insertBefore(n,A.firstChild||null)}(r,l+c,i);const u=document.createDocumentFragment(),h=await jA(Array.from(A.shadowRoot.childNodes),o,t.fast);u.append(...h.filter(A=>!!A)),r.appendChild(u)}if("SLOT"===A.tagName){let n=function(A,n){te(A,e,t).then(A=>{var e;A&&(e=A)&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(A=>A.setAttribute("data-sd-slotted",""))),n(A||null)}).catch(()=>{n(null)})};const r=A.assignedNodes?.({flatten:!0})||[],o=r.length>0?r:Array.from(A.childNodes),i=document.createDocumentFragment(),s=await jA(Array.from(o),n,t.fast);return i.append(...s.filter(A=>!!A)),i}const s=await jA(Array.from(A.childNodes),function(A,r){if(n.has(A))return r(null);te(A,e,t).then(A=>{r(A||null)}).catch(()=>{r(null)})},t.fast);if(r.append(...s.filter(A=>!!A)),null!==o&&r instanceof HTMLSelectElement){r.value=o;for(const A of r.options)A.value===o?A.setAttribute("selected",""):A.removeAttribute("selected")}return null!==i&&r instanceof HTMLTextAreaElement&&(r.textContent=i),r}var ne=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],re=[];function oe(A){const e="string"==typeof A?A:"",t=[...ne,...re];for(const A of t)if(A instanceof RegExp&&A.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function ie(A,e,t,n=32,r="#000"){e=e.replace(/^['"]+|['"]+$/g,"");const o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}const i=document.createElement("span");i.textContent=A,i.style.position="absolute",i.style.visibility="hidden",i.style.fontFamily=`"${e}"`,i.style.fontWeight=t||"normal",i.style.fontSize=`${n}px`,i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.padding="0",i.style.margin="0",document.body.appendChild(i);const s=i.getBoundingClientRect(),a=Math.ceil(s.width),c=Math.ceil(s.height);document.body.removeChild(i);const l=document.createElement("canvas");l.width=Math.max(1,a*o),l.height=Math.max(1,c*o);const u=l.getContext("2d");return u.scale(o,o),u.font=t?`${t} ${n}px "${e}"`:`${n}px "${e}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=r,u.fillText(A,0,0),{dataUrl:l.toDataURL(),width:a,height:c}}var se=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function ae(A){if(!A)return"";for(let e of A.split(",")){let A=e.trim().replace(/^['"]+|['"]+$/g,"");if(A&&!se.has(A.toLowerCase()))return A}return""}function ce(A){const e=String(A??"400").trim().toLowerCase();if("normal"===e)return 400;if("bold"===e)return 700;const t=parseInt(e,10);return Number.isFinite(t)?Math.min(900,Math.max(100,t)):400}function le(A){const e=String(A??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function ue(A,e){if(!A)return!1;try{const t=new URL(A,location.href);if(t.origin===location.origin)return!0;const n=t.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(A=>n.endsWith(A)))return!0;const r=(t.pathname+t.search).toLowerCase();if(/\bfont(s)?\b/.test(r)||/\.woff2?(\b|$)/.test(r))return!0;for(const A of e){const e=A.toLowerCase().replace(/\s+/g,"+"),t=A.toLowerCase().replace(/\s+/g,"-");if(r.includes(e)||r.includes(t))return!0}return!1}catch{return!1}}function he(A,e){return A?A.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(A,t,n)=>{const r=(n||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return A;let o=r;try{o=new URL(r,e||location.href).href}catch{}return`url("${o}")`}):A}var ge=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g;async function de(A,e,t){if(!A)return A;const n=new Set;function r(A,e){try{return new URL(A,e||location.href).href}catch{return A}}let o=he(A,e||location.href);return o=await async function A(e,o,i=0){if(i>4)return console.warn(`[snapDOM] @import depth exceeded (4) at ${o}`),e;let s,a="",c=0;for(;s=ge.exec(e);){a+=e.slice(c,s.index),c=ge.lastIndex;const l=r((s[2]||s[4]||"").trim(),o);if(n.has(l)){console.warn(`[snapDOM] Skipping circular @import: ${l}`);continue}n.add(l);let u="";try{const A=await IA(l,{as:"text",useProxy:t,silent:!0});A.ok&&"string"==typeof A.data&&(u=A.data)}catch{}u?(u=he(u,l),u=await A(u,l,i+1),a+=`\n/* inlined: ${l} */\n${u}\n`):a+=s[0]}return a+=e.slice(c),a}(o,e||location.href,0),o}var Be=/url\((["']?)([^"')]+)\1\)/g,fe=/@font-face[^{}]*\{[^}]*\}/g;function we(A){if(!A)return[];const e=[],t=A.split(",").map(A=>A.trim()).filter(Boolean);for(const A of t){const t=A.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!t)continue;const n=t[1],r=t[2],o=A=>{if(!A.includes("?"))return parseInt(A,16);return[parseInt(A.replace(/\?/g,"0"),16),parseInt(A.replace(/\?/g,"F"),16)]};if(r){const A=o(n),t=o(r),i=Array.isArray(A)?A[0]:A,s=Array.isArray(t)?t[1]:t;e.push([Math.min(i,s),Math.max(i,s)])}else{const A=o(n);Array.isArray(A)?e.push([A[0],A[1]]):e.push([A,A])}}return e}function pe(A,e){if(!e.length)return!0;if(!A||0===A.size)return!0;for(const t of A)for(const[A,n]of e)if(t>=A&&t<=n)return!0;return!1}function me(A,e){const t=[];if(!A)return t;for(const n of A.matchAll(Be)){let A=(n[2]||"").trim();if(A&&!A.startsWith("data:")){if(!/^https?:/i.test(A))try{A=new URL(A,e||location.href).href}catch{}t.push(A)}}return t}async function Ce(A,e,t=""){let n=A;for(const r of A.matchAll(Be)){const A=yA(r[0]);if(!A)continue;let o=A;if(!o.startsWith("http")&&!o.startsWith("data:"))try{o=new URL(o,e||location.href).href}catch{}if(!oe(o))if(QA.resource?.has(o))QA.font?.add(o),n=n.replace(r[0],`url(${QA.resource.get(o)})`);else if(!QA.font?.has(o))try{const A=await IA(o,{as:"dataURL",useProxy:t,silent:!0});if(A.ok&&"string"==typeof A.data){const e=A.data;QA.resource?.set(o,e),QA.font?.add(o),n=n.replace(r[0],`url(${e})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",o)}}return n}function Qe(A={}){const e=new Set((A.families||[]).map(A=>String(A).toLowerCase())),t=new Set((A.domains||[]).map(A=>String(A).toLowerCase())),n=new Set((A.subsets||[]).map(A=>String(A).toLowerCase()));return(A,r)=>{if(e.size&&e.has(A.family.toLowerCase()))return!0;if(t.size)for(const e of A.srcUrls)try{if(t.has(new URL(e).host.toLowerCase()))return!0}catch{}if(n.size){const A=function(A){if(!A.length)return null;const e=(e,t)=>A.some(([A,n])=>!(n<e||A>t)),t=e(0,255)||e(305,305),n=e(256,591)||e(7680,7935),r=e(880,1023),o=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":o?"cyrillic":r?"greek":n?"latin-ext":t?"latin":null}(r);if(A&&n.has(A))return!0}return!1}}async function ye(A,e,t,n){let r;try{r=A.cssRules||[]}catch{return}const o=(A,e)=>{try{return new URL(A,e||location.href).href}catch{return A}};for(const A of r){if(A.type===CSSRule.IMPORT_RULE&&A.styleSheet){const r=A.href?o(A.href,e):e;if(n.depth>=4){console.warn(`[snapDOM] CSSOM import depth exceeded (4) at ${r}`);continue}if(r&&n.visitedSheets.has(r)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${r}`);continue}r&&n.visitedSheets.add(r);const i={...n,depth:(n.depth||0)+1};await ye(A.styleSheet,r,t,i);continue}if(A.type===CSSRule.FONT_FACE_RULE){const r=ae((A.style.getPropertyValue("font-family")||"").trim());if(!r||oe(r))continue;const o=(A.style.getPropertyValue("font-weight")||"400").trim(),i=(A.style.getPropertyValue("font-style")||"normal").trim(),s=(A.style.getPropertyValue("font-stretch")||"100%").trim(),a=(A.style.getPropertyValue("src")||"").trim(),c=(A.style.getPropertyValue("unicode-range")||"").trim();if(!n.faceMatchesRequired(r,i,o,s))continue;const l=we(c);if(!pe(n.usedCodepoints,l))continue;const u={family:r,weightSpec:o,styleSpec:i,stretchSpec:s,unicodeRange:c,srcRaw:a,srcUrls:me(a,e||location.href),href:e||location.href};if(n.simpleExcluder&&n.simpleExcluder(u,l))continue;if(/url\(/i.test(a)){const A=await Ce(a,e||location.href,n.useProxy);await t(`@font-face{font-family:${r};src:${A};font-style:${i};font-weight:${o};font-stretch:${s};${c?`unicode-range:${c};`:""}}`)}else await t(`@font-face{font-family:${r};src:${a};font-style:${i};font-weight:${o};font-stretch:${s};${c?`unicode-range:${c};`:""}}`)}}}async function Ue({required:A,usedCodepoints:e,exclude:t,localFonts:n=[],useProxy:r=""}={}){A instanceof Set||(A=new Set),e instanceof Set||(e=new Set);const o=new Map;for(const e of A){const[A,t,n,r]=String(e).split("__");if(!A)continue;const i=o.get(A)||[];i.push({w:parseInt(t,10),s:n,st:parseInt(r,10)}),o.set(A,i)}function i(A,e,t,n){if(!o.has(A))return!1;const r=o.get(A),i=function(A){const e=String(A||"400").trim(),t=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(t){const A=ce(t[1]),e=ce(t[2]);return{min:Math.min(A,e),max:Math.max(A,e)}}const n=ce(e);return{min:n,max:n}}(t),s=function(A){const e=String(A||"normal").trim().toLowerCase();return"italic"===e?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}(e),a=function(A){const e=String(A||"100%").trim(),t=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(t){const A=parseFloat(t[1]),e=parseFloat(t[2]);return{min:Math.min(A,e),max:Math.max(A,e)}}const n=e.match(/(\d+(?:\.\d+)?)\s*%/),r=n?parseFloat(n[1]):100;return{min:r,max:r}}(n),c=i.min!==i.max,l=i.min,u=A=>"normal"===s.kind&&"normal"===A||"normal"!==s.kind&&("italic"===A||"oblique"===A);let h=!1;for(const A of r){const e=c?A.w>=i.min&&A.w<=i.max:A.w===l,t=u(le(A.s)),n=A.st>=a.min&&A.st<=a.max;if(e&&t&&n){h=!0;break}}if(h)return!0;if(!c)for(const A of r){const e=u(le(A.s)),t=A.st>=a.min&&A.st<=a.max;if(Math.abs(l-A.w)<=300&&e&&t)return!0}return!1}const s=Qe(t),a=function(A,e,t,n){return`fonts-embed-css::req=${Array.from(A||[]).sort().join("|")}::ex=${e?JSON.stringify({families:(e.families||[]).map(A=>String(A).toLowerCase()).sort(),domains:(e.domains||[]).map(A=>String(A).toLowerCase()).sort(),subsets:(e.subsets||[]).map(A=>String(A).toLowerCase()).sort()}):""}::lf=${(t||[]).map(A=>`${(A.family||"").toLowerCase()}::${A.weight||"normal"}::${A.style||"normal"}::${A.src||""}`).sort().join("|")}::px=${n||""}`}(A,t,n,r);if(QA.resource?.has(a))return QA.resource.get(a);const c=function(A){const e=new Set;for(const t of A||[]){const A=String(t).split("__")[0]?.trim();A&&e.add(A)}return e}(A),l=[],u=ge;for(const A of document.querySelectorAll("style")){const e=A.textContent||"";for(const A of e.matchAll(u)){const e=(A[2]||A[4]||"").trim();if(!e||oe(e))continue;!!document.querySelector(`link[rel="stylesheet"][href="${e}"]`)||l.push(e)}}l.length&&await Promise.all(l.map(A=>new Promise(e=>{if(document.querySelector(`link[rel="stylesheet"][href="${A}"]`))return e(null);const t=document.createElement("link");t.rel="stylesheet",t.href=A,t.setAttribute("data-snapdom","injected-import"),t.onload=()=>e(t),t.onerror=()=>e(null),document.head.appendChild(t)})));let h="";const g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(A=>!!A.href);for(const A of g)try{if(oe(A.href))continue;let n="",o=!1;try{o=new URL(A.href,location.href).origin===location.origin}catch{}if(!o&&!ue(A.href,c))continue;if(o){const e=Array.from(document.styleSheets).find(e=>e.href===A.href);if(e)try{const A=e.cssRules||[];n=Array.from(A).map(A=>A.cssText).join("")}catch{}}if(!n){if(n=(await IA(A.href,{as:"text",useProxy:r})).data,oe(A.href))continue}n=await de(n,A.href,r);let a="";for(const o of n.match(fe)||[]){const n=ae((o.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim());if(!n||oe(n))continue;const c=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),l=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),h=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),g=(o.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),d=me(g,A.href);if(!i(n,l,c,u))continue;const B=we(h);if(!pe(e,B))continue;const f={family:n,weightSpec:c,styleSpec:l,stretchSpec:u,unicodeRange:h,srcRaw:g,srcUrls:d,href:A.href};if(t&&s(f,B))continue;a+=/url\(/i.test(g)?await Ce(o,A.href,r):o}a.trim()&&(h+=a)}catch{console.warn("[snapDOM] Failed to process stylesheet:",A.href)}const d={requiredIndex:o,usedCodepoints:e,faceMatchesRequired:i,simpleExcluder:t?Qe(t):null,useProxy:r,visitedSheets:new Set,depth:0};for(const A of document.styleSheets)if(!A.href||!g.some(e=>e.href===A.href))try{const e=A.href||location.href;e&&d.visitedSheets.add(e),await ye(A,e,async A=>{h+=A},d)}catch{}try{for(const A of document.fonts||[]){if(!A||!A.family||"loaded"!==A.status||!A._snapdomSrc)continue;const e=String(A.family).replace(/^['"]+|['"]+$/g,"");if(oe(e))continue;if(!o.has(e))continue;if(t?.families&&t.families.some(A=>String(A).toLowerCase()===e.toLowerCase()))continue;let n=A._snapdomSrc;if(!String(n).startsWith("data:"))if(QA.resource?.has(A._snapdomSrc))n=QA.resource.get(A._snapdomSrc),QA.font?.add(A._snapdomSrc);else if(!QA.font?.has(A._snapdomSrc))try{const e=await IA(A._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(!e.ok||"string"!=typeof e.data)continue;n=e.data,QA.resource?.set(A._snapdomSrc,n),QA.font?.add(A._snapdomSrc)}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",A._snapdomSrc);continue}h+=`@font-face{font-family:'${e}';src:url(${n});font-style:${A.style||"normal"};font-weight:${A.weight||"normal"};}`}}catch{}for(const A of n){if(!A||"object"!=typeof A)continue;const e=String(A.family||"").replace(/^['"]+|['"]+$/g,"");if(!e||oe(e))continue;if(!o.has(e))continue;if(t?.families&&t.families.some(A=>String(A).toLowerCase()===e.toLowerCase()))continue;const n=null!=A.weight?String(A.weight):"normal",i=null!=A.style?String(A.style):"normal",s=null!=A.stretchPct?`${A.stretchPct}%`:"100%",a=String(A.src||"");let c=a;if(!c.startsWith("data:"))if(QA.resource?.has(a))c=QA.resource.get(a),QA.font?.add(a);else if(!QA.font?.has(a))try{const A=await IA(a,{as:"dataURL",useProxy:r,silent:!0});if(!A.ok||"string"!=typeof A.data)continue;c=A.data,QA.resource?.set(a,c),QA.font?.add(a)}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",a);continue}h+=`@font-face{font-family:'${e}';src:url(${c});font-style:${i};font-weight:${n};font-stretch:${s};}`}return h&&(h=function(A){if(!A)return A;const e=/@font-face[^{}]*\{[^}]*\}/gi,t=new Set,n=[];for(const r of A.match(e)||[]){const A=ae(r.match(/font-family:\s*([^;]+);/i)?.[1]||""),e=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),o=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),i=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),s=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),a=(r.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),c=me(a,location.href),l=c.length?c.map(A=>String(A).toLowerCase()).sort().join("|"):a.toLowerCase(),u=[String(A||"").toLowerCase(),e,o,i,s.toLowerCase(),l].join("|");t.has(u)||(t.add(u),n.push(r))}if(0===n.length)return A;let r=0;return A.replace(e,()=>n[r++]||"")}(h),QA.resource?.set(a,h)),h}function Fe(A){const e=new Set;if(!A)return e;const t=document.createTreeWalker(A,NodeFilter.SHOW_ELEMENT,null),n=A=>{const t=ae(A.fontFamily);if(!t)return;var n,r,o;e.add((n=A.fontWeight,r=A.fontStyle,o=A.fontStretch,`${t}__${ce(n)}__${le(r)}__${function(A){const e=String(A??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}(o)}`))};n(getComputedStyle(A));const r=getComputedStyle(A,"::before");r&&r.content&&"none"!==r.content&&n(r);const o=getComputedStyle(A,"::after");for(o&&o.content&&"none"!==o.content&&n(o);t.nextNode();){const A=t.currentNode;n(getComputedStyle(A));const e=getComputedStyle(A,"::before");e&&e.content&&"none"!==e.content&&n(e);const r=getComputedStyle(A,"::after");r&&r.content&&"none"!==r.content&&n(r)}return e}function be(A,e=!1){let t="",n=Math.max(1,A);for(;n>0;)n--,t=String.fromCharCode(97+n%26)+t,n=Math.floor(n/26);return e?t.toUpperCase():t}function ve(A,e=!0){const t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let n=Math.max(1,Math.min(3999,A)),r="";for(const[A,e]of t)for(;n>=A;)r+=e,n-=A;return e?r:r.toLowerCase()}function Ee(A,e){switch((e||"decimal").toLowerCase()){case"decimal":default:return String(Math.max(0,A));case"decimal-leading-zero":return(A<10?"0":"")+String(Math.max(0,A));case"lower-alpha":return be(A,!1);case"upper-alpha":return be(A,!0);case"lower-roman":return ve(A,!1);case"upper-roman":return ve(A,!0)}}function He(A){const e=new WeakMap,t=A instanceof Document?A.documentElement:A,n=A=>{let e=0,t=A?.parentElement;if(!t)return 0;for(const n of t.children){if(n===A)break;"LI"===n.tagName&&e++}return e},r=(A,e,t)=>{const r=(A=>{const e=new Map;for(const[t,n]of A)e.set(t,n.slice());return e})(A);let o,i;try{o=t.style?.counterReset||getComputedStyle(t).counterReset}catch{}if(o&&"none"!==o)for(const A of o.split(",")){const t=A.trim().split(/\s+/),n=t[0],o=Number.isFinite(Number(t[1]))?Number(t[1]):0;if(!n)continue;const i=e.get(n);if(i&&i.length){const A=i.slice();A.push(o),r.set(n,A)}else r.set(n,[o])}try{i=t.style?.counterIncrement||getComputedStyle(t).counterIncrement}catch{}if(i&&"none"!==i)for(const A of i.split(",")){const e=A.trim().split(/\s+/),t=e[0],n=Number.isFinite(Number(e[1]))?Number(e[1]):1;if(!t)continue;const o=r.get(t)||[];0===o.length&&o.push(0),o[o.length-1]+=n,r.set(t,o)}try{if("list-item"===getComputedStyle(t).display&&(A=>A&&"LI"===A.tagName)(t)){const A=t.parentElement;let e=1;if(A&&"OL"===A.tagName){const r=A.getAttribute("start"),o=Number.isFinite(Number(r))?Number(r):1,i=n(t),s=t.getAttribute("value");e=Number.isFinite(Number(s))?Number(s):o+i}else e=1+n(t);const o=r.get("list-item")||[];0===o.length&&o.push(0),o[o.length-1]=e,r.set("list-item",o)}}catch{}return r},o=(A,t,n)=>{const i=r(n,t,A);e.set(A,i);let s=i;for(const e of A.children){s=o(e,i,s)}return i},i=new Map;return o(t,i,i),{get(A,t){const n=e.get(A)?.get(t);return n&&n.length?n[n.length-1]:0},getStack(A,t){const n=e.get(A)?.get(t);return n?n.slice():[]}}}var Ie=null,xe=new WeakMap;function Se(A,e){const t=A.parentElement,n=t?xe.get(t):null;return n?{get(A,t){const r=e.get(A,t),o=n.get(t);return"number"==typeof o?Math.max(r,o):r},getStack(A,t){const r=e.getStack(A,t);if(!r.length)return r;const o=n.get(t);if("number"==typeof o){const A=r.slice();return A[A.length-1]=Math.max(A[A.length-1],o),A}return r}}:e}function Le(A,e,t){const n=new Map;function r(A){const e=[];if(!A||"none"===A)return e;for(const t of String(A).split(",")){const A=t.trim().split(/\s+/),n=A[0],r=Number.isFinite(Number(A[1]))?Number(A[1]):void 0;n&&e.push({name:n,num:r})}return e}const o=r(e?.counterReset),i=r(e?.counterIncrement);function s(e){if(n.has(e))return n.get(e).slice();let r=t.getStack(A,e);r=r.length?r.slice():[];const s=o.find(A=>A.name===e);if(s){const A=Number.isFinite(s.num)?s.num:0;r=r.length?[...r,A]:[A]}const a=i.find(A=>A.name===e);if(a){const A=Number.isFinite(a.num)?a.num:1;0===r.length&&(r=[0]),r[r.length-1]+=A}return n.set(e,r.slice()),r}return{get(A,e){const t=s(e);return t.length?t[t.length-1]:0},getStack:(A,e)=>s(e),__incs:i}}function De(A,e,t){let n;try{n=getComputedStyle(A,e)}catch{}const r=n?.content;if(!r||"none"===r||"normal"===r)return{text:"",incs:[]};const o=Le(A,n,Se(A,t));let i=/\bcounter\s*\(|\bcounters\s*\(/.test(r||"")?function(A,e,t){if(!A||"none"===A)return A;try{const n=/\b(counter|counters)\s*\(([^)]+)\)/g;return(A.replace(n,(A,n,r)=>{const o=String(r).split(",").map(A=>A.trim());if("counter"===n){const A=o[0]?.replace(/^["']|["']$/g,""),n=(o[1]||"decimal").toLowerCase();return Ee(t.get(e,A),n)}{const A=o[0]?.replace(/^["']|["']$/g,""),n=o[1]?.replace(/^["']|["']$/g,"")??"",r=(o[2]||"decimal").toLowerCase(),i=t.getStack(e,A);return i.length?i.map(A=>Ee(A,r)).join(n):""}})||"").replace(/"([^"]*)"/g,"$1")}catch{return"- "}}(r,A,o):r;const s=function(A){if(!A)return"";const e=[],t=/"([^"]*)"/g;let n;for(;n=t.exec(A);)e.push(n[1]);return e.length?e.join(""):(A||"").replace(/"([^"]*)"/g,"$1")}(i);return{text:s,incs:o.__incs||[]}}async function Me(A,e,t,n){if(!(A instanceof Element&&e instanceof Element))return;if(!Ie)try{Ie=He(A.ownerDocument||document)}catch{}for(const r of["::before","::after","::first-letter"])try{const o=PA(A,r);if(!o||"function"!=typeof o[Symbol.iterator])continue;if(!("none"!==o.content||"none"!==o.backgroundImage||"transparent"!==o.backgroundColor||"none"!==o.borderStyle&&0!==parseFloat(o.borderWidth)||o.transform&&"none"!==o.transform||"inline"!==o.display))continue;if("::first-letter"===r){const n=getComputedStyle(A);if(!(o.color!==n.color||o.fontSize!==n.fontSize||o.fontWeight!==n.fontWeight))continue;const r=Array.from(e.childNodes).find(A=>A.nodeType===Node.TEXT_NODE&&A.textContent?.trim().length>0);if(!r)continue;const i=r.textContent,s=i.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u),a=s?.[0],c=i.slice(a?.length||0);if(!a||/[\uD800-\uDFFF]/.test(a))continue;const l=document.createElement("span");l.textContent=a,l.dataset.snapdomPseudo="::first-letter";const u=RA(OA(o),"span");t.styleMap.set(l,u);const h=document.createTextNode(c);e.replaceChild(h,r),e.insertBefore(l,h);continue}const i=o.content,{text:s,incs:a}=De(A,r,Ie),c=o.backgroundImage,l=o.backgroundColor,u=o.fontFamily,h=parseInt(o.fontSize)||32,g=parseInt(o.fontWeight)||!1,d=o.color||"#000",B=o.borderStyle,f=parseFloat(o.borderWidth),w=o.transform,p=oe(u),m="none"!==i&&""!==s,C=c&&"none"!==c,Q=l&&"transparent"!==l&&"rgba(0, 0, 0, 0)"!==l,y=B&&"none"!==B&&f>0,U=w&&"none"!==w;if(!(m||C||Q||y||U)){if(a&&a.length&&A.parentElement){const e=xe.get(A.parentElement)||new Map;for(const{name:t}of a){if(!t)continue;const n=Se(A,Ie),o=Le(A,getComputedStyle(A,r),n).get(A,t);e.set(t,o)}xe.set(A.parentElement,e)}continue}const F=document.createElement("span");F.dataset.snapdomPseudo=r,F.style.verticalAlign="middle",F.style.pointerEvents="none";const b=RA(OA(o),"span");if(t.styleMap.set(F,b),p&&s&&1===s.length){const{dataUrl:A,width:t,height:n}=await ie(s,u,g,h,d),r=document.createElement("img");r.src=A,r.style=`height:${h}px;width:${t/n*h}px;object-fit:contain;`,F.appendChild(r),e.dataset.snapdomHasIcon="true"}else if(s&&s.startsWith("url(")){const e=yA(s);if(e?.trim())try{const A=document.createElement("img"),t=await IA(UA(e),{as:"dataURL",useProxy:n.useProxy});A.src=t.data,A.style=`width:${h}px;height:auto;object-fit:contain;`,F.appendChild(A)}catch(e){console.error(`[snapdom] Error in pseudo ${r} for`,A,e)}}else!p&&m&&(F.textContent=s);if(F.style.background="none","mask"in F.style&&(F.style.mask="none"),C)try{const A=VA(c),e=await Promise.all(A.map(SA));F.style.backgroundImage=e.join(", ")}catch(A){console.warn(`[snapdom] Failed to inline background-image for ${r}`,A)}Q&&(F.style.backgroundColor=l);const v=F.childNodes.length>0||""!==F.textContent?.trim()||C||Q||y||U;if(a&&a.length&&A.parentElement){const e=xe.get(A.parentElement)||new Map,t=Se(A,Ie),n=Le(A,getComputedStyle(A,r),t);for(const{name:t}of a){if(!t)continue;const r=n.get(A,t);e.set(t,r)}xe.set(A.parentElement,e)}if(!v)continue;"::before"===r?e.insertBefore(F,e.firstChild):e.appendChild(F)}catch(e){console.warn(`[snapdom] Failed to capture ${r} for`,A,e)}const r=Array.from(A.children),o=Array.from(e.children).filter(A=>!A.dataset.snapdomPseudo);for(let A=0;A<Math.min(r.length,o.length);A++)await Me(r[A],o[A],t,n)}function ke(A){if(!A||"auto"===A)return null;const e=Number.parseFloat(A);return Number.isFinite(e)?e:null}function Ke(A,e){const t=[];for(let n=A;n&&n!==e;){const A=n.parentElement;if(!A)break;t.push(Array.prototype.indexOf.call(A.children,n)),n=A}return t.reverse()}function Te(A,e,t){let n=A;for(let A=0;A<e.length;A++){if(n=Re(n,t)[e[A]],!n)return null}return n instanceof HTMLElement?n:null}function Re(A,e){const t=[],n=A.children;for(let A=0;A<n.length;A++){const r=n[A];r.hasAttribute(e)||t.push(r)}return t}async function Pe(A,e={}){const t={styleMap:QA.session.styleMap,styleCache:QA.session.styleCache,nodeMap:QA.session.nodeMap};let n,r="",o="";!function(A){const e=getComputedStyle(A),t=e.outlineStyle,n=e.outlineWidth,r=e.borderStyle,o=e.borderWidth,i="none"!==t&&parseFloat(n)>0,s="none"===r||0===parseFloat(o);i&&s&&(A.style.border=`${n} solid transparent`)}(A);try{!function(A){if(!A)return;const e=new Set;if(A.querySelectorAll("use").forEach(A=>{const t=A.getAttribute("xlink:href")||A.getAttribute("href");t&&t.startsWith("#")&&e.add(t.slice(1))}),!e.size)return;const t=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),n=t.filter(A=>"symbol"===A.tagName.toLowerCase()),r=t.filter(A=>"defs"===A.tagName.toLowerCase());let o=A.querySelector("svg.inline-defs-container");o||(o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("aria-hidden","true"),o.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),o.classList.add("inline-defs-container"),A.insertBefore(o,A.firstChild));const i=new Set;A.querySelectorAll("symbol[id], defs > *[id]").forEach(A=>{i.add(A.id)}),e.forEach(A=>{if(i.has(A))return;const e=n.find(e=>e.id===A);if(e)return o.appendChild(e.cloneNode(!0)),void i.add(A);for(const e of r){const t=e.querySelector(`#${CSS.escape(A)}`);if(t){let e=o.querySelector("defs");e||(e=document.createElementNS("http://www.w3.org/2000/svg","defs"),o.appendChild(e)),e.appendChild(t.cloneNode(!0)),i.add(A);break}}})}(A)}catch(A){console.warn("inlineExternal defs or symbol failed:",A)}try{n=await te(A,t,e)}catch(A){throw console.warn("deepClone failed:",A),A}try{await Me(A,n,t,e)}catch(A){console.warn("inlinePseudoElements failed:",A)}await async function(A){if(!A)return;const e=A.querySelectorAll?A.querySelectorAll("img"):[];for(const A of e)try{const e=A.getAttribute("src")||A.currentSrc||"";if(We(e)){const t=await Ve(e);A.setAttribute("src",t)}const t=A.getAttribute("srcset");if(t&&t.includes("blob:")){const e=_e(t);let n=!1;for(const A of e)if(We(A.url))try{A.url=await Ve(A.url),n=!0}catch{}n&&A.setAttribute("srcset",Xe(e))}}catch{}const t=A.querySelectorAll?A.querySelectorAll("image"):[];for(const A of t)try{const e="http://www.w3.org/1999/xlink",t=A.getAttribute("href")||A.getAttributeNS?.(e,"href");if(We(t)){const n=await Ve(t);A.setAttribute("href",n),A.removeAttributeNS?.(e,"href")}}catch{}const n=A.querySelectorAll?A.querySelectorAll("[style*='blob:']"):[];for(const A of n)try{const e=A.getAttribute("style");if(e&&e.includes("blob:")){const t=await Ge(e);A.setAttribute("style",t)}}catch{}const r=A.querySelectorAll?A.querySelectorAll("style"):[];for(const A of r)try{const e=A.textContent||"";e.includes("blob:")&&(A.textContent=await Ge(e))}catch{}const o=["poster"];for(const e of o){const t=A.querySelectorAll?A.querySelectorAll(`[${e}^='blob:']`):[];for(const A of t)try{const t=A.getAttribute(e);We(t)&&A.setAttribute(e,await Ve(t))}catch{}}}(n);try{const A=n.querySelectorAll("style[data-sd]");for(const e of A)o+=e.textContent||"",e.remove()}catch{}const i=function(A){const e=Array.from(new Set(A.values())).filter(Boolean).sort(),t=new Map;let n=1;for(const A of e)t.set(A,"c"+n++);return t}(t.styleMap);r=Array.from(i.entries()).map(([A,e])=>`.${e}{${A}}`).join(""),r=o+r;for(const[A,e]of t.styleMap.entries()){if("STYLE"===A.tagName)continue;if(A.getRootNode&&A.getRootNode()instanceof ShadowRoot){A.setAttribute("style",e.replace(/;/g,"; "));continue}const t=i.get(e);t&&A.classList.add(t);const n=A.style?.backgroundImage,r=A.dataset?.snapdomHasIcon;n&&"none"!==n&&(A.style.backgroundImage=n),r&&(A.style.verticalAlign="middle",A.style.display="inline")}for(const[A,e]of t.nodeMap.entries()){const t=e.scrollLeft,n=e.scrollTop;if((t||n)&&A instanceof HTMLElement){A.style.overflow="hidden",A.style.scrollbarWidth="none",A.style.msOverflowStyle="none";const e=document.createElement("div");for(e.style.transform=`translate(${-t}px, ${-n}px)`,e.style.willChange="transform",e.style.display="inline-block",e.style.width="100%";A.firstChild;)e.appendChild(A.firstChild);A.appendChild(e)}}if(function(A,e){if(!A||!e)return;const t=A.scrollTop||0;if(!t)return;"static"===getComputedStyle(e).position&&(e.style.position="relative");const n=A.getBoundingClientRect(),r=A.clientHeight,o="data-snap-ph",i=document.createTreeWalker(A,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){const s=i.currentNode,a=getComputedStyle(s),c=a.position;if("sticky"!==c&&"-webkit-sticky"!==c)continue;const l=ke(a.top),u=ke(a.bottom);if(null==l&&null==u)continue;const h=Te(e,Ke(s,A),o);if(!h)continue;const g=s.getBoundingClientRect(),d=g.width,B=g.height,f=g.left-n.left;if(!(d>0&&B>0))continue;if(!Number.isFinite(f))continue;const w=null!=l?l+t:t+(r-B-u);if(!Number.isFinite(w))continue;const p=Number.parseInt(a.zIndex,10),m=Number.isFinite(p),C=m?Math.max(p,1)+1:2,Q=m?p-1:0,y=h.cloneNode(!1);y.setAttribute(o,"1"),y.style.position="sticky",y.style.left=`${f}px`,y.style.top=`${w}px`,y.style.width=`${d}px`,y.style.height=`${B}px`,y.style.visibility="hidden",y.style.zIndex=String(Q),y.style.overflow="hidden",y.style.background="transparent",y.style.boxShadow="none",y.style.filter="none",h.parentElement?.insertBefore(y,h),h.style.position="absolute",h.style.left=`${f}px`,h.style.top=`${w}px`,h.style.bottom="auto",h.style.zIndex=String(C),h.style.pointerEvents="none"}}(A,n instanceof HTMLElement&&n.firstElementChild instanceof HTMLElement?n.firstElementChild:n),A===t.nodeMap.get(n)){const e=t.styleCache.get(A)||window.getComputedStyle(A);t.styleCache.set(A,e);const r=function(A){if(!A||"none"===A)return"";let e=A.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(A,e)=>{const t=e.split(",").map(A=>A.trim());return 6!==t.length?`matrix(${e})`:(t[4]="0",t[5]="0",`matrix(${t.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(A,e)=>{const t=e.split(",").map(A=>A.trim());return 16!==t.length?`matrix3d(${e})`:(t[12]="0",t[13]="0",`matrix3d(${t.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}(e.transform);n.style.margin="0",n.style.top="auto",n.style.left="auto",n.style.right="auto",n.style.bottom="auto",n.style.animation="none",n.style.transition="none",n.style.willChange="auto",n.style.float="none",n.style.clear="none",n.style.transform=r||""}for(const[A,e]of t.nodeMap.entries())"PRE"===e.tagName&&(A.style.marginTop="0",A.style.marginBlockStart="0");return{clone:n,classCSS:r,styleCache:t.styleCache}}var Oe=new Map;async function Ve(A){if(QA.resource?.has(A))return QA.resource.get(A);if(Oe.has(A))return Oe.get(A);const e=(async()=>{const e=await IA(A,{as:"dataURL",silent:!0});if(!e.ok||"string"!=typeof e.data)throw new Error(`[snapDOM] Failed to read blob URL: ${A}`);return QA.resource?.set(A,e.data),e.data})();Oe.set(A,e);try{const t=await e;return Oe.set(A,t),t}catch(e){throw Oe.delete(A),e}}var Ne=/\bblob:[^)"'\s]+/g;async function Ge(A){if(!A||-1===A.indexOf("blob:"))return A;const e=Array.from(new Set(A.match(Ne)||[]));if(0===e.length)return A;let t=A;for(const A of e)try{const e=await Ve(A);t=t.split(A).join(e)}catch{}return t}function We(A){return"string"==typeof A&&A.startsWith("blob:")}function _e(A){return(A||"").split(",").map(A=>A.trim()).filter(Boolean).map(A=>{const e=A.match(/^(\S+)(\s+.+)?$/);return e?{url:e[1],desc:e[2]||""}:null}).filter(Boolean)}function Xe(A){return A.map(A=>A.desc?`${A.url} ${A.desc.trim()}`:A.url).join(", ")}function Je(A){if(!A)return()=>{};const e=function(A){const e=getComputedStyle(A);let t=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");t=(t||"").trim();const n=parseInt(t,10);return Number.isFinite(n)&&n>0?n:0}(A);if(e<=0)return()=>{};if(!function(A){return!(A.childElementCount>0)&&Array.from(A.childNodes).some(A=>A.nodeType===Node.TEXT_NODE)}(A))return()=>{};const t=getComputedStyle(A),n=Math.round(function(A){const e=(A.lineHeight||"").trim(),t=parseFloat(A.fontSize)||16;return e&&"normal"!==e?e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*t):e.endsWith("%")?Math.round(parseFloat(e)/100*t):Math.round(1.2*t):Math.round(1.2*t)}(t)*e+function(A){return(parseFloat(A.paddingTop)||0)+(parseFloat(A.paddingBottom)||0)}(t)),r=A.textContent??"",o=r;if(A.scrollHeight<=n+.5)return()=>{};let i=0,s=r.length,a=-1;for(;i<=s;){const e=i+s>>1;A.textContent=r.slice(0,e)+"…",A.scrollHeight<=n+.5?(a=e,i=e+1):s=e-1}return A.textContent=(a>=0?r.slice(0,a):"")+"…",()=>{A.textContent=o}}async function Ye(A,e){if(!A)throw new Error("Element cannot be null or undefined");!function(A="soft"){switch(A){case"auto":return QA.session.styleMap=new Map,void(QA.session.nodeMap=new Map);case"soft":default:return QA.session.styleMap=new Map,QA.session.nodeMap=new Map,void(QA.session.styleCache=new WeakMap);case"full":return;case"disabled":QA.session.styleMap=new Map,QA.session.nodeMap=new Map,QA.session.styleCache=new WeakMap,QA.computedStyle=new WeakMap,QA.baseStyle=new Map,QA.defaultStyle=new Map,QA.image=new Map,QA.background=new Map,QA.resource=new Map,QA.font=new Set}}(e.cache);const t=e.fast,n=!!e.straighten,r=!!e.noShadows;let o,i,s,a,c,l="",u="",h=null;const g=Je(A);try{({clone:o,classCSS:i,styleCache:s}=await Pe(A,e)),n&&o&&(h=function(A,e){if(!A||!e||!e.style)return null;const t=getComputedStyle(A);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}const n=t.transform||"none";if("none"===n)try{const t=Ze(A);if(1===t.a&&0===t.b&&0===t.c&&1===t.d)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}const r=n.match(/^matrix\(\s*([^)]+)\)$/i);if(r){const A=r[1].split(",").map(A=>parseFloat(A.trim()));if(6===A.length&&A.every(Number.isFinite)){const[t,n,r,o]=A,i=Math.sqrt(t*t+n*n)||0;let s=0,a=0,c=0,l=0,u=0,h=0;i>0&&(s=t/i,a=n/i,c=s*r+a*o,l=r-s*c,u=o-a*c,h=Math.sqrt(l*l+u*u)||0,h>0?c/=h:c=0);const g=i,d=0,B=c*h,f=h;try{e.style.transform=`matrix(${g}, ${d}, ${B}, ${f}, 0, 0)`}catch{}return{a:g,b:d,c:B,d:f}}}try{const A=String(n).trim();return e.style.transform=A+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}(A,o)),r&&o&&function(A,e){if(!A||!e||!e.style)return;const t=getComputedStyle(A);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}const n=(t.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=n.length?n:"none"}catch{}}(A,o)}finally{g()}await new Promise(A=>{NA(async()=>{await async function(A,e={}){const t=Array.from(A.querySelectorAll("img")),n=async A=>{if(!A.getAttribute("src")){const e=A.currentSrc||A.src||"";e&&A.setAttribute("src",e)}A.removeAttribute("srcset"),A.removeAttribute("sizes");const t=A.src||"";if(!t)return;const n=await IA(t,{as:"dataURL",useProxy:e.useProxy});if(n.ok&&"string"==typeof n.data&&n.data.startsWith("data:"))return A.src=n.data,A.width||(A.width=A.naturalWidth||100),void(A.height||(A.height=A.naturalHeight||100));const{fallbackURL:r}=e||{};if(r)try{const n=parseInt(A.dataset?.snapdomWidth||"",10)||0,o=parseInt(A.dataset?.snapdomHeight||"",10)||0,i=parseInt(A.getAttribute("width")||"",10)||0,s=parseInt(A.getAttribute("height")||"",10)||0,a=parseFloat(A.style?.width||"")||0,c=parseFloat(A.style?.height||"")||0,l=n||a||i||A.width||void 0,u=o||c||s||A.height||void 0,h="function"==typeof r?await r({width:l,height:u,src:t,element:A}):r;if(h){const t=await IA(h,{as:"dataURL",useProxy:e.useProxy});return A.src=t.data,!A.width&&l&&(A.width=l),!A.height&&u&&(A.height=u),A.width||(A.width=A.naturalWidth||100),void(A.height||(A.height=A.naturalHeight||100))}}catch{}const o=A.width||A.naturalWidth||100,i=A.height||A.naturalHeight||100;if(!1!==e.placeholders){const e=document.createElement("div");e.style.cssText=[`width:${o}px`,`height:${i}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${i}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),e.textContent="img",A.replaceWith(e)}else{const e=document.createElement("div");e.style.cssText=`display:inline-block;width:${o}px;height:${i}px;visibility:hidden;`,A.replaceWith(e)}};for(let A=0;A<t.length;A+=4){const e=t.slice(A,A+4).map(n);await Promise.allSettled(e)}}(o,e),A()},{fast:t})}),await new Promise(n=>{NA(async()=>{await async function(A,e,t,n={}){const r=[[A,e]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],i=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],s=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){const[A,e]=r.shift(),a=t.get(A)||PA(A);t.has(A)||t.set(A,a);const c=(()=>{const A=a.getPropertyValue("border-image"),e=a.getPropertyValue("border-image-source");return A&&"none"!==A||e&&"none"!==e})();for(const A of o){const t=a.getPropertyValue(A);if(!t||"none"===t)continue;const r=VA(t),o=await Promise.all(r.map(A=>SA(A,n)));o.some(A=>A&&"none"!==A&&!/^url\(undefined/.test(A))&&e.style.setProperty(A,o.join(", "))}for(const A of i){const t=a.getPropertyValue(A);t&&"initial"!==t&&e.style.setProperty(A,t)}if(c)for(const A of s){const t=a.getPropertyValue(A);t&&"initial"!==t&&e.style.setProperty(A,t)}const l=Array.from(A.children),u=Array.from(e.children);for(let A=0;A<Math.min(l.length,u.length);A++)r.push([l[A],u[A]])}}(A,o,s,e),n()},{fast:t})}),e.embedFonts&&await new Promise(n=>{NA(async()=>{const t=Fe(A),r=function(A){const e=new Set,t=A=>{if(A)for(const t of A)e.add(t.codePointAt(0))},n=document.createTreeWalker(A,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;n.nextNode();){const A=n.currentNode;if(A.nodeType===Node.TEXT_NODE)t(A.nodeValue||"");else if(A.nodeType===Node.ELEMENT_NODE){const n=A;for(const A of["::before","::after"]){const r=getComputedStyle(n,A),o=r?.getPropertyValue("content");if(o&&"none"!==o)if(/^"/.test(o)||/^'/.test(o))t(o.slice(1,-1));else{const A=o.match(/\\[0-9A-Fa-f]{1,6}/g);if(A)for(const t of A)try{e.add(parseInt(t.slice(1),16))}catch{}}}}}return e}(A);if(GA()){const A=new Set(Array.from(t).map(A=>String(A).split("__")[0]).filter(Boolean));await async function(A,e=2){try{await document.fonts.ready}catch{}const t=Array.from(A||[]).filter(Boolean);if(0===t.length)return;const n=()=>{const A=document.createElement("div");A.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(const e of t){const t=document.createElement("span");t.textContent="AaBbGg1234ÁÉÍÓÚçñ—∞",t.style.fontFamily=`"${e}"`,t.style.fontWeight="700",t.style.fontStyle="italic",t.style.fontSize="32px",t.style.lineHeight="1",t.style.whiteSpace="nowrap",t.style.margin="0",t.style.padding="0",A.appendChild(t)}document.body.appendChild(A),A.offsetWidth,document.body.removeChild(A)};for(let A=0;A<Math.max(1,e);A++)n(),await new Promise(A=>requestAnimationFrame(()=>requestAnimationFrame(A)))}(A,1)}l=await Ue({required:t,usedCodepoints:r,exclude:e.excludeFonts,useProxy:e.useProxy}),n()},{fast:t})});const d=function(A){const e=new Set;return A.nodeType!==Node.ELEMENT_NODE&&A.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(A.tagName&&e.add(A.tagName.toLowerCase()),"function"==typeof A.querySelectorAll&&A.querySelectorAll("*").forEach(A=>e.add(A.tagName.toLowerCase())),Array.from(e))}(o).sort(),B=d.join(",");QA.baseStyle.has(B)?u=QA.baseStyle.get(B):await new Promise(A=>{NA(()=>{u=function(A){const e=new Map;for(let t of A){const A=QA.defaultStyle.get(t);if(!A)continue;const n=Object.entries(A).map(([A,e])=>`${A}:${e};`).sort().join("");n&&(e.has(n)||e.set(n,[]),e.get(n).push(t))}let t="";for(let[A,n]of e.entries())t+=`${n.join(",")} { ${A} }\n`;return t}(d),QA.baseStyle.set(B,u),A()},{fast:t})}),await new Promise(s=>{NA(()=>{const t=getComputedStyle(A);const g=A.getBoundingClientRect(),d=Math.max(1,Math.ceil(A.offsetWidth||parseFloat(t.width)||g.width||1)),B=Math.max(1,Math.ceil(A.offsetHeight||parseFloat(t.height)||g.height||1)),f=(A,e=NaN)=>{const t="string"==typeof A?parseFloat(A):A;return Number.isFinite(t)?t:e},w=f(e.width),p=f(e.height);let m=d,C=B;const Q=Number.isFinite(w),y=Number.isFinite(p),U=B>0?d/B:1;Q&&y?(m=Math.max(1,Math.ceil(w)),C=Math.max(1,Math.ceil(p))):Q?(m=Math.max(1,Math.ceil(w)),C=Math.max(1,Math.ceil(m/(U||1)))):y?(C=Math.max(1,Math.ceil(p)),m=Math.max(1,Math.ceil(C*(U||1)))):(m=d,C=B);let F=0,b=0,v=d,E=B;if(n&&h&&Number.isFinite(h.a)){const A=$e(d,B,{a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},0,0);F=A.minX,b=A.minY,v=A.maxX,E=A.maxY}else{if(!n&&function(A){const e=getComputedStyle(A),t=e.transform||"none";if("none"!==t&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(t))return!0;const n=e.rotate&&"none"!==e.rotate&&"0deg"!==e.rotate,r=e.scale&&"none"!==e.scale&&"1"!==e.scale,o=e.translate&&"none"!==e.translate&&"0px 0px"!==e.translate;return Boolean(n||r||o)}(A)){const e=t.transform&&"none"!==t.transform?t.transform:"",n=function(A){const e={rotate:"0deg",scale:null,translate:null},t="function"==typeof A.computedStyleMap?A.computedStyleMap():null;if(t){const n=A=>{try{return"function"!=typeof t.has||t.has(A)?"function"!=typeof t.get?null:t.get(A):null}catch{return null}},r=n("rotate");if(r)if(r.angle){const A=r.angle;e.rotate="rad"===A.unit?180*A.value/Math.PI+"deg":A.value+A.unit}else r.unit?e.rotate="rad"===r.unit?180*r.value/Math.PI+"deg":r.value+r.unit:e.rotate=String(r);else{const t=getComputedStyle(A);e.rotate=t.rotate&&"none"!==t.rotate?t.rotate:"0deg"}const o=n("scale");if(o){const A="x"in o&&null!=o.x?.value?o.x.value:Array.isArray(o)?o[0]?.value:Number(o)||1,t="y"in o&&null!=o.y?.value?o.y.value:Array.isArray(o)?o[1]?.value:A;e.scale=`${A} ${t}`}else{const t=getComputedStyle(A);e.scale=t.scale&&"none"!==t.scale?t.scale:null}const i=n("translate");if(i){const A="x"in i&&"value"in i.x?i.x.value:Array.isArray(i)?i[0]?.value:0,t="y"in i&&"value"in i.y?i.y.value:Array.isArray(i)?i[1]?.value:0,n="x"in i&&i.x?.unit?i.x.unit:"px",r="y"in i&&i.y?.unit?i.y.unit:"px";e.translate=`${A}${n} ${t}${r}`}else{const t=getComputedStyle(A);e.translate=t.translate&&"none"!==t.translate?t.translate:null}return e}const n=getComputedStyle(A);return e.rotate=n.rotate&&"none"!==n.rotate?n.rotate:"0deg",e.scale=n.scale&&"none"!==n.scale?n.scale:null,e.translate=n.translate&&"none"!==n.translate?n.translate:null,e}(A),r=function(A){const e=function(){if(ze)return ze;const A=document.createElement("div");return A.id="snapdom-measure-slot",A.setAttribute("aria-hidden","true"),Object.assign(A.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(A),ze=A,A}(),t=document.createElement("div");t.style.transformOrigin="0 0",A.baseTransform&&(t.style.transform=A.baseTransform);A.rotate&&(t.style.rotate=A.rotate);A.scale&&(t.style.scale=A.scale);A.translate&&(t.style.translate=A.translate);e.appendChild(t);const n=Ze(t);return e.removeChild(t),n}({baseTransform:e,rotate:n.rotate||"0deg",scale:n.scale,translate:n.translate}),{ox:o,oy:i}=function(A,e,t){const n=(A.transformOrigin||"0 0").trim().split(/\s+/),[r,o]=[n[0]||"0",n[1]||"0"],i=(A,e)=>{const t=A.toLowerCase();return"left"===t||"top"===t?0:"center"===t?e/2:"right"===t||"bottom"===t?e:t.endsWith("px")?parseFloat(t)||0:t.endsWith("%")?(parseFloat(t)||0)*e/100:/^-?\d+(\.\d+)?$/.test(t)&&parseFloat(t)||0};return{ox:i(r,e),oy:i(o,t)}}(t,d,B),s=$e(d,B,r.is2D?r:new DOMMatrix(r.toString()),o,i);F=s.minX,b=s.minY,v=s.maxX,E=s.maxY}}const H=function(A){const e=A.boxShadow||"";if(!e||"none"===e)return{top:0,right:0,bottom:0,left:0};const t=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(A=>A.trim());let n=0,r=0,o=0,i=0;for(const A of t){const e=A.match(/-?\d+(\.\d+)?px/g)?.map(A=>parseFloat(A))||[];if(e.length<2)continue;const[t,s,a=0,c=0]=e,l=Math.abs(t)+a+c,u=Math.abs(s)+a+c;r=Math.max(r,l+Math.max(t,0)),i=Math.max(i,l+Math.max(-t,0)),o=Math.max(o,u+Math.max(s,0)),n=Math.max(n,u+Math.max(-s,0))}return{top:Math.ceil(n),right:Math.ceil(r),bottom:Math.ceil(o),left:Math.ceil(i)}}(t),I=function(A){const e=(A.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),t=e?Math.ceil(parseFloat(e[1])||0):0;return{top:t,right:t,bottom:t,left:t}}(t),x=function(A){if("none"===(A.outlineStyle||"none"))return{top:0,right:0,bottom:0,left:0};const e=Math.ceil(parseFloat(A.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}(t),S=function(A){const e=`${A.filter||""} ${A.webkitFilter||""}`.trim();if(!e||"none"===e)return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};const t=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[];let n=0,r=0,o=0,i=0,s=!1;for(const A of t){s=!0;const e=A.match(/-?\d+(?:\.\d+)?px/gi)?.map(A=>parseFloat(A))||[],[t=0,a=0,c=0]=e,l=Math.abs(t)+c,u=Math.abs(a)+c;r=Math.max(r,l+Math.max(t,0)),i=Math.max(i,l+Math.max(-t,0)),o=Math.max(o,u+Math.max(a,0)),n=Math.max(n,u+Math.max(-a,0))}return{bleed:{top:Math.ceil(n),right:Math.ceil(r),bottom:Math.ceil(o),left:Math.ceil(i)},has:s}}(t),L=r?{top:0,right:0,bottom:0,left:0}:{top:H.top+I.top+x.top+S.bleed.top,right:H.right+I.right+x.right+S.bleed.right,bottom:H.bottom+I.bottom+x.bottom+S.bleed.bottom,left:H.left+I.left+x.left+S.bleed.left};F-=L.left,b-=L.top,v+=L.right,E+=L.bottom;const D=Math.max(1,Math.ceil(v-F)),M=Math.max(1,Math.ceil(E-b)),k=Math.max(1,Math.round(D*(Q||y?m/d:1))),K=Math.max(1,Math.round(M*(y||Q?C/B:1))),T="http://www.w3.org/2000/svg",R=(GA()?1:0)+(n?1:0),P=document.createElementNS(T,"foreignObject"),O=Math.floor(F),V=Math.floor(b);P.setAttribute("x",String(-(O-R))),P.setAttribute("y",String(-(V-R))),P.setAttribute("width",String(Math.ceil(d+2*R))),P.setAttribute("height",String(Math.ceil(B+2*R))),P.style.overflow="visible";const N=document.createElement("style");N.textContent=u+l+"svg{overflow:visible;} foreignObject{overflow:visible;}"+i,P.appendChild(N);const G=document.createElement("div");G.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),G.style.width=`${d}px`,G.style.height=`${B}px`,G.style.overflow="visible",o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),G.appendChild(o),P.appendChild(G);const W=(new XMLSerializer).serializeToString(P),_=D+2*R,X=M+2*R,J=Q||y;e.meta={w0:d,h0:B,vbW:_,vbH:X,targetW:m,targetH:C};const Y=GA()&&J?_:k+2*R,$=GA()&&J?X:K+2*R;c=`<svg xmlns="${T}" width="${Y}" height="${$}" viewBox="0 0 ${_} ${X}">`+W+"</svg>",a=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c)}`,s()},{fast:t})});const f=document.getElementById("snapdom-sandbox");return f&&"absolute"===f.style.position&&f.remove(),a}function $e(A,e,t,n,r){const o=t.a,i=t.b,s=t.c,a=t.d,c=t.e||0,l=t.f||0;function u(A,e){let t=A-n,u=e-r,h=o*t+s*u,g=i*t+a*u;return h+=n+c,g+=r+l,[h,g]}const h=[u(0,0),u(A,0),u(0,e),u(A,e)];let g=1/0,d=1/0,B=-1/0,f=-1/0;for(const[A,e]of h)A<g&&(g=A),e<d&&(d=e),A>B&&(B=A),e>f&&(f=e);return{minX:g,minY:d,maxX:B,maxY:f,width:B-g,height:f-d}}function Ze(A){const e=getComputedStyle(A).transform;if(!e||"none"===e)return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}var ze=null;function je(A){const e=function(A){let e=[],t="",n=0;for(let r=0;r<A.length;r++){const o=A[r];"("===o&&n++,")"===o&&(n=Math.max(0,n-1)),";"===o&&0===n?(e.push(t),t=""):t+=o}return t.trim()&&e.push(t),e.map(A=>A.trim()).filter(Boolean)}(A);let t=null,n=null,r=null;const o=[];for(const A of e){const e=A.indexOf(":");if(e<0)continue;const i=A.slice(0,e).trim().toLowerCase(),s=A.slice(e+1).trim();"box-shadow"===i?r=s:"filter"===i?t=s:"-webkit-filter"===i?n=s:o.push([i,s])}if(r){const A=function(A){const e=[];let t="",n=0;for(let r=0;r<A.length;r++){const o=A[r];"("===o&&n++,")"===o&&(n=Math.max(0,n-1)),","===o&&0===n?(e.push(t.trim()),t=""):t+=o}t.trim()&&e.push(t.trim());const r=[];for(const A of e){if(/\binset\b/i.test(A))continue;const e=A.match(/-?\d+(?:\.\d+)?px/gi)||[],[t="0px",n="0px",o="0px"]=e;let i=A.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/gi,"").trim().replace(/\s{2,}/g," ");const s=!!i&&","!==i;r.push(`drop-shadow(${t} ${n} ${o}${s?` ${i}`:""})`)}return r.join(" ")}(r);A&&(t=t?`${t} ${A}`:A,n=n?`${n} ${A}`:A)}const i=[...o];return t&&i.push(["filter",t]),n&&i.push(["-webkit-filter",n]),i.map(([A,e])=>`${A}:${e}`).join(";")}function qe(A){return A=(A=A.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(A,e)=>A.replace(e,function(A){return A.replace(/([^{}]+)\{([^}]*)\}/g,(A,e,t)=>`${e}{${je(t)}}`)}(e)))).replace(/style=(['"])([\s\S]*?)\1/gi,(A,e,t)=>`style=${e}${je(t)}${e}`)}function At(A){if(!GA()||("string"!=typeof(e=A)||!/^data:image\/svg\+xml/i.test(e)))return A;var e;try{const e=function(A){const e=A.indexOf(",");return e>=0?decodeURIComponent(A.slice(e+1)):""}(A),t=qe(e);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}catch{return A}}async function et(A,e){let{width:t,height:n,scale:r=1,dpr:o=1,meta:i={}}=e;A=At(A);const s=new Image;s.loading="eager",s.decoding="sync",s.crossOrigin="anonymous",s.src=A,await s.decode();const a=s.naturalWidth,c=s.naturalHeight,l=Number.isFinite(i.w0)?i.w0:a,u=Number.isFinite(i.h0)?i.h0:c;let h,g;const d=Number.isFinite(t),B=Number.isFinite(n);if(d&&B)h=Math.max(1,t),g=Math.max(1,n);else if(d){const A=t/Math.max(1,l);h=t,g=Math.round(u*A)}else if(B){const A=n/Math.max(1,u);g=n,h=Math.round(l*A)}else h=a,g=c;h=Math.round(h*r),g=Math.round(g*r);const f=document.createElement("canvas");f.width=Math.ceil(h*o),f.height=Math.ceil(g*o),f.style.width=`${h}px`,f.style.height=`${g}px`;const w=f.getContext("2d");return 1!==o&&w.scale(o,o),w.drawImage(s,0,0,h,g),f}async function tt(A,e){const t=await et(A,e),n=e.backgroundColor?xA(t,e.backgroundColor):t,r=new Image;return r.src=n.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=n.width/e.dpr+"px",r.style.height=n.height/e.dpr+"px",r}async function nt(A,e){const{scale:t=1,width:n,height:r,meta:o={}}=e,i=Number.isFinite(n),s=Number.isFinite(r),a=Number.isFinite(t)&&1!==t||i||s;if(GA()&&a){return await tt(A,{...e,format:"png",quality:1,meta:o})}const c=new Image;if(c.decoding="sync",c.loading="eager",c.src=A,await c.decode(),i&&s)c.style.width=`${n}px`,c.style.height=`${r}px`;else if(i){const A=Number.isFinite(o.w0)?o.w0:c.naturalWidth,e=Number.isFinite(o.h0)?o.h0:c.naturalHeight,t=n/Math.max(1,A);c.style.width=`${n}px`,c.style.height=`${Math.round(e*t)}px`}else if(s){const A=Number.isFinite(o.w0)?o.w0:c.naturalWidth,e=Number.isFinite(o.h0)?o.h0:c.naturalHeight,t=r/Math.max(1,e);c.style.height=`${r}px`,c.style.width=`${Math.round(A*t)}px`}else{const e=Math.round(c.naturalWidth*t),n=Math.round(c.naturalHeight*t);if(c.style.width=`${e}px`,c.style.height=`${n}px`,"string"==typeof A&&A.startsWith("data:image/svg+xml"))try{const t=decodeURIComponent(A.split(",")[1]).replace(/width="[^"]*"/,`width="${e}"`).replace(/height="[^"]*"/,`height="${n}"`);A=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,c.src=A}catch{}}return c}async function rt(A,e){const t=e.type;if("svg"===t){const e=decodeURIComponent(A.split(",")[1]);return new Blob([e],{type:"image/svg+xml"})}const n=await et(A,e),r=e.backgroundColor?xA(n,e.backgroundColor):n;return new Promise(A=>r.toBlob(e=>A(e),`image/${t}`,e.quality))}var ot=Symbol("snapdom.internal"),it=!1;async function st(A,e){if(!A)throw new Error("Element cannot be null or undefined");const t=function(A={}){const e=A.format??"png",t=function(A){if("string"==typeof A){const e=A.toLowerCase().trim();if("disabled"===e||"full"===e||"auto"===e||"soft"===e)return e}return"soft"}(A.cache);return{debug:A.debug??!1,fast:A.fast??!0,scale:A.scale??1,exclude:A.exclude??[],excludeMode:A.excludeMode??"hide",filter:A.filter??null,filterMode:A.filterMode??"hide",placeholders:!1!==A.placeholders,embedFonts:A.embedFonts??!1,iconFonts:Array.isArray(A.iconFonts)?A.iconFonts:A.iconFonts?[A.iconFonts]:[],localFonts:Array.isArray(A.localFonts)?A.localFonts:[],excludeFonts:A.excludeFonts??void 0,fallbackURL:A.fallbackURL??void 0,cache:t,useProxy:"string"==typeof A.useProxy?A.useProxy:"",width:A.width??null,height:A.height??null,format:e,type:A.type??"svg",quality:A.quality??.92,dpr:A.dpr??(window.devicePixelRatio||1),backgroundColor:A.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:A.filename??"snapDOM",straighten:A.straighten??!1,noShadows:A.noShadows??!1}}(e);if(GA()&&(!0===t.embedFonts||function(A){const e=document.createTreeWalker(A,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){const A=e.currentNode,t=getComputedStyle(A),n=t.backgroundImage&&"none"!==t.backgroundImage,r=t.maskImage&&"none"!==t.maskImage||t.webkitMaskImage&&"none"!==t.webkitMaskImage;if(n||r)return!0}return!1}(A)))for(let t=0;t<3;t++)try{await at(A,e),console.log("Iteración número:",t),it=!1}catch{}return t.iconFonts&&t.iconFonts.length>0&&function(A){const e=Array.isArray(A)?A:[A];for(const A of e)A instanceof RegExp?re.push(A):"string"==typeof A?re.push(new RegExp(A,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",A)}(t.iconFonts),t.snap||(t.snap={toPng:(A,e)=>st.toPng(A,e),toSvg:(A,e)=>st.toSvg(A,e)}),st.capture(A,t,ot)}async function at(A,e){if(it)return;const t={...e,fast:!0,embedFonts:!0,scale:.2};let n;try{n=await Ye(A,t)}catch{return}await new Promise(A=>{const e=new Image;e.decoding="sync",e.loading="eager",e.style.position="fixed",e.style.left=0,e.style.top=0,e.style.width="10px",e.style.height="10px",e.style.opacity="0.01",e.style.transform="translateZ(10px)",e.style.willChange="transform,opacity;",e.src=n;document.body.appendChild(e),(async()=>{await new Promise(A=>setTimeout(A,100)),e&&e.parentNode&&e.parentNode.removeChild(e),it=!0,A()})()})}st.capture=async(A,e,t)=>{if(t!==ot)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");const n=await Ye(A,e),r=A=>({...e,...A||{}}),o=A=>e=>{const t=r({...e||{},format:A}),o="jpeg"===A||"jpg"===A,i=null==t.backgroundColor||"transparent"===t.backgroundColor;return o&&i&&(t.backgroundColor="#ffffff"),tt(n,t)};return{url:n,toRaw:()=>n,toImg:A=>nt(n,r(A)),toSvg:A=>nt(n,r(A)),toCanvas:A=>et(n,r(A)),toBlob:A=>rt(n,r(A)),toPng:o("png"),toJpg:o("jpeg"),toWebp:o("webp"),download:A=>async function(A,e){if(e.dpr=1,"svg"===e.format){const t=await rt(A,{...e,type:"svg"}),n=URL.createObjectURL(t),r=document.createElement("a");return r.href=n,r.download=e.filename,r.click(),void URL.revokeObjectURL(n)}const t=await et(A,e),n=e.backgroundColor?xA(t,e.backgroundColor):t,r=document.createElement("a");r.href=n.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()}(n,r(A))}},st.toRaw=(A,e)=>st(A,e).then(A=>A.toRaw()),st.toImg=(A,e)=>st(A,e).then(A=>A.toImg()),st.toSvg=(A,e)=>st(A,e).then(A=>A.toSvg()),st.toCanvas=(A,e)=>st(A,e).then(A=>A.toCanvas()),st.toBlob=(A,e)=>st(A,e).then(A=>A.toBlob()),st.toPng=(A,e)=>st(A,{...e,format:"png"}).then(A=>A.toPng()),st.toJpg=(A,e)=>st(A,{...e,format:"jpeg"}).then(A=>A.toJpg()),st.toWebp=(A,e)=>st(A,{...e,format:"webp"}).then(A=>A.toWebp()),st.download=(A,e)=>st(A,e).then(A=>A.download());var ct="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function lt(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}function ut(A){if(A.__esModule)return A;var e=A.default;if("function"==typeof e){var t=function A(){return this instanceof A?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(A).forEach(function(e){var n=Object.getOwnPropertyDescriptor(A,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:function(){return A[e]}})}),t}var ht={exports:{}};
2
2
  /*!
3
3
  * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
4
4
  * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
@@ -35,4 +35,4 @@ e.mode.CTRGladman=function(){var A=e.lib.BlockCipherMode.extend();function t(A){
35
35
 
36
36
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
37
  */
38
- function(){var A=e,t=A.lib,n=t.WordArray,r=t.Hasher,o=A.algo,i=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),u=n.create([1352829926,1548603684,1836072691,2053994217,0]),h=o.RIPEMD160=r.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(A,e){for(var t=0;t<16;t++){var n=e+t,r=A[n];A[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var o,h,m,C,Q,y,U,F,b,v,E,H=this._hash.words,I=l.words,x=u.words,S=i.words,L=s.words,D=a.words,M=c.words;for(y=o=H[0],U=h=H[1],F=m=H[2],b=C=H[3],v=Q=H[4],t=0;t<80;t+=1)E=o+A[e+S[t]]|0,E+=t<16?g(h,m,C)+I[0]:t<32?d(h,m,C)+I[1]:t<48?B(h,m,C)+I[2]:t<64?f(h,m,C)+I[3]:w(h,m,C)+I[4],E=(E=p(E|=0,D[t]))+Q|0,o=Q,Q=C,C=p(m,10),m=h,h=E,E=y+A[e+L[t]]|0,E+=t<16?w(U,F,b)+x[0]:t<32?f(U,F,b)+x[1]:t<48?B(U,F,b)+x[2]:t<64?d(U,F,b)+x[3]:g(U,F,b)+x[4],E=(E=p(E|=0,M[t]))+v|0,y=v,v=b,b=p(F,10),F=U,U=E;E=H[1]+m+b|0,H[1]=H[2]+C+v|0,H[2]=H[3]+Q+y|0,H[3]=H[4]+o+U|0,H[4]=H[0]+h+F|0,H[0]=E},_doFinalize:function(){var A=this._data,e=A.words,t=8*this._nDataBytes,n=8*A.sigBytes;e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(t<<8|t>>>24)|4278255360&(t<<24|t>>>8),A.sigBytes=4*(e.length+1),this._process();for(var r=this._hash,o=r.words,i=0;i<5;i++){var s=o[i];o[i]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return r},clone:function(){var A=r.clone.call(this);return A._hash=this._hash.clone(),A}});function g(A,e,t){return A^e^t}function d(A,e,t){return A&e|~A&t}function B(A,e,t){return(A|~e)^t}function f(A,e,t){return A&t|e&~t}function w(A,e,t){return A^(e|~t)}function p(A,e){return A<<e|A>>>32-e}A.RIPEMD160=r._createHelper(h),A.HmacRIPEMD160=r._createHmacHelper(h)}(),e.RIPEMD160)}(xr)),Dr(),Mr||(Mr=1,function(A){var e,t,n,r,o,i,s,a,c;A.exports=(c=Yn(),pr(),Dr(),n=(t=(e=c).lib).Base,r=t.WordArray,i=(o=e.algo).SHA256,s=o.HMAC,a=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:25e4}),init:function(A){this.cfg=this.cfg.extend(A)},compute:function(A,e){for(var t=this.cfg,n=s.create(t.hasher,A),o=r.create(),i=r.create([1]),a=o.words,c=i.words,l=t.keySize,u=t.iterations;a.length<l;){var h=n.update(e).finalize(i);n.reset();for(var g=h.words,d=g.length,B=h,f=1;f<u;f++){B=n.finalize(B),n.reset();for(var w=B.words,p=0;p<d;p++)g[p]^=w[p]}o.concat(h),c[0]++}return o.sigBytes=4*l,o}}),e.PBKDF2=function(A,e,t){return a.create(t).compute(A,e)},c.PBKDF2)}(kr)),Rr(),Vr(),Wr(),Jr(),Zr(),qr(),Ao||(Ao=1,function(A){var e,t;A.exports=(t=Yn(),Vr(),t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(A,e){this._cipher.encryptBlock(A,e)}}),e.Decryptor=e.extend({processBlock:function(A,e){this._cipher.decryptBlock(A,e)}}),e),t.mode.ECB)}(eo)),to||(to=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.AnsiX923={pad:function(A,e){var t=A.sigBytes,n=4*e,r=n-t%n,o=t+r-1;A.clamp(),A.words[o>>>2]|=r<<24-o%4*8,A.sigBytes+=r},unpad:function(A){var e=255&A.words[A.sigBytes-1>>>2];A.sigBytes-=e}},e.pad.Ansix923)}(no)),ro||(ro=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.Iso10126={pad:function(A,t){var n=4*t,r=n-A.sigBytes%n;A.concat(e.lib.WordArray.random(r-1)).concat(e.lib.WordArray.create([r<<24],1))},unpad:function(A){var e=255&A.words[A.sigBytes-1>>>2];A.sigBytes-=e}},e.pad.Iso10126)}(oo)),io||(io=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.Iso97971={pad:function(A,t){A.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(A,t)},unpad:function(A){e.pad.ZeroPadding.unpad(A),A.sigBytes--}},e.pad.Iso97971)}(so)),ao||(ao=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.ZeroPadding={pad:function(A,e){var t=4*e;A.clamp(),A.sigBytes+=t-(A.sigBytes%t||t)},unpad:function(A){var e=A.words,t=A.sigBytes-1;for(t=A.sigBytes-1;t>=0;t--)if(e[t>>>2]>>>24-t%4*8&255){A.sigBytes=t+1;break}}},e.pad.ZeroPadding)}(co)),lo||(lo=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding)}(uo)),ho||(ho=1,function(A){var e,t,n,r;A.exports=(r=Yn(),Vr(),t=(e=r).lib.CipherParams,n=e.enc.Hex,e.format.Hex={stringify:function(A){return A.ciphertext.toString(n)},parse:function(A){var e=n.parse(A);return t.create({ciphertext:e})}},r.format.Hex)}(go)),Bo||(Bo=1,function(A){var e;A.exports=(e=Yn(),ir(),hr(),Rr(),Vr(),function(){var A=e,t=A.lib.BlockCipher,n=A.algo,r=[],o=[],i=[],s=[],a=[],c=[],l=[],u=[],h=[],g=[];!function(){for(var A=[],e=0;e<256;e++)A[e]=e<128?e<<1:e<<1^283;var t=0,n=0;for(e=0;e<256;e++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,r[t]=d,o[d]=t;var B=A[t],f=A[B],w=A[f],p=257*A[d]^16843008*d;i[t]=p<<24|p>>>8,s[t]=p<<16|p>>>16,a[t]=p<<8|p>>>24,c[t]=p,p=16843009*w^65537*f^257*B^16843008*t,l[d]=p<<24|p>>>8,u[d]=p<<16|p>>>16,h[d]=p<<8|p>>>24,g[d]=p,t?(t=B^A[A[A[w^B]]],n^=A[A[n]]):t=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],B=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var A=this._keyPriorReset=this._key,e=A.words,t=A.sigBytes/4,n=4*((this._nRounds=t+6)+1),o=this._keySchedule=[],i=0;i<n;i++)i<t?o[i]=e[i]:(c=o[i-1],i%t?t>6&&i%t==4&&(c=r[c>>>24]<<24|r[c>>>16&255]<<16|r[c>>>8&255]<<8|r[255&c]):(c=r[(c=c<<8|c>>>24)>>>24]<<24|r[c>>>16&255]<<16|r[c>>>8&255]<<8|r[255&c],c^=d[i/t|0]<<24),o[i]=o[i-t]^c);for(var s=this._invKeySchedule=[],a=0;a<n;a++){if(i=n-a,a%4)var c=o[i];else c=o[i-4];s[a]=a<4||i<=4?c:l[r[c>>>24]]^u[r[c>>>16&255]]^h[r[c>>>8&255]]^g[r[255&c]]}}},encryptBlock:function(A,e){this._doCryptBlock(A,e,this._keySchedule,i,s,a,c,r)},decryptBlock:function(A,e){var t=A[e+1];A[e+1]=A[e+3],A[e+3]=t,this._doCryptBlock(A,e,this._invKeySchedule,l,u,h,g,o),t=A[e+1],A[e+1]=A[e+3],A[e+3]=t},_doCryptBlock:function(A,e,t,n,r,o,i,s){for(var a=this._nRounds,c=A[e]^t[0],l=A[e+1]^t[1],u=A[e+2]^t[2],h=A[e+3]^t[3],g=4,d=1;d<a;d++){var B=n[c>>>24]^r[l>>>16&255]^o[u>>>8&255]^i[255&h]^t[g++],f=n[l>>>24]^r[u>>>16&255]^o[h>>>8&255]^i[255&c]^t[g++],w=n[u>>>24]^r[h>>>16&255]^o[c>>>8&255]^i[255&l]^t[g++],p=n[h>>>24]^r[c>>>16&255]^o[l>>>8&255]^i[255&u]^t[g++];c=B,l=f,u=w,h=p}B=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[255&h])^t[g++],f=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[h>>>8&255]<<8|s[255&c])^t[g++],w=(s[u>>>24]<<24|s[h>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^t[g++],p=(s[h>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&u])^t[g++],A[e]=B,A[e+1]=f,A[e+2]=w,A[e+3]=p},keySize:8});A.AES=t._createHelper(B)}(),e.AES)}(fo)),mo(),Co||(Co=1,function(A){var e;A.exports=(e=Yn(),ir(),hr(),Rr(),Vr(),function(){var A=e,t=A.lib.StreamCipher,n=A.algo,r=n.RC4=t.extend({_doReset:function(){for(var A=this._key,e=A.words,t=A.sigBytes,n=this._S=[],r=0;r<256;r++)n[r]=r;r=0;for(var o=0;r<256;r++){var i=r%t,s=e[i>>>2]>>>24-i%4*8&255;o=(o+n[r]+s)%256;var a=n[r];n[r]=n[o],n[o]=a}this._i=this._j=0},_doProcessBlock:function(A,e){A[e]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var A=this._S,e=this._i,t=this._j,n=0,r=0;r<4;r++){t=(t+A[e=(e+1)%256])%256;var o=A[e];A[e]=A[t],A[t]=o,n|=A[(A[e]+A[t])%256]<<24-8*r}return this._i=e,this._j=t,n}A.RC4=t._createHelper(r);var i=n.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var A=this.cfg.drop;A>0;A--)o.call(this)}});A.RC4Drop=t._createHelper(i)}(),e.RC4)}(Qo)),yo||(yo=1,function(A){var e;A.exports=(e=Yn(),ir(),hr(),Rr(),Vr(),function(){var A=e,t=A.lib.StreamCipher,n=A.algo,r=[],o=[],i=[],s=n.Rabbit=t.extend({_doReset:function(){for(var A=this._key.words,e=this.cfg.iv,t=0;t<4;t++)A[t]=16711935&(A[t]<<8|A[t]>>>24)|4278255360&(A[t]<<24|A[t]>>>8);var n=this._X=[A[0],A[3]<<16|A[2]>>>16,A[1],A[0]<<16|A[3]>>>16,A[2],A[1]<<16|A[0]>>>16,A[3],A[2]<<16|A[1]>>>16],r=this._C=[A[2]<<16|A[2]>>>16,4294901760&A[0]|65535&A[1],A[3]<<16|A[3]>>>16,4294901760&A[1]|65535&A[2],A[0]<<16|A[0]>>>16,4294901760&A[2]|65535&A[3],A[1]<<16|A[1]>>>16,4294901760&A[3]|65535&A[0]];for(this._b=0,t=0;t<4;t++)a.call(this);for(t=0;t<8;t++)r[t]^=n[t+4&7];if(e){var o=e.words,i=o[0],s=o[1],c=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=c>>>16|4294901760&l,h=l<<16|65535&c;for(r[0]^=c,r[1]^=u,r[2]^=l,r[3]^=h,r[4]^=c,r[5]^=u,r[6]^=l,r[7]^=h,t=0;t<4;t++)a.call(this)}},_doProcessBlock:function(A,e){var t=this._X;a.call(this),r[0]=t[0]^t[5]>>>16^t[3]<<16,r[1]=t[2]^t[7]>>>16^t[5]<<16,r[2]=t[4]^t[1]>>>16^t[7]<<16,r[3]=t[6]^t[3]>>>16^t[1]<<16;for(var n=0;n<4;n++)r[n]=16711935&(r[n]<<8|r[n]>>>24)|4278255360&(r[n]<<24|r[n]>>>8),A[e+n]^=r[n]},blockSize:4,ivSize:2});function a(){for(var A=this._X,e=this._C,t=0;t<8;t++)o[t]=e[t];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<o[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<o[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<o[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<o[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<o[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<o[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<o[6]>>>0?1:0)|0,this._b=e[7]>>>0<o[7]>>>0?1:0,t=0;t<8;t++){var n=A[t]+e[t],r=65535&n,s=n>>>16,a=((r*r>>>17)+r*s>>>15)+s*s,c=((4294901760&n)*n|0)+((65535&n)*n|0);i[t]=a^c}A[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,A[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,A[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,A[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,A[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,A[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,A[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,A[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}A.Rabbit=t._createHelper(s)}(),e.Rabbit)}(Uo)),Fo||(Fo=1,function(A){var e;A.exports=(e=Yn(),ir(),hr(),Rr(),Vr(),function(){var A=e,t=A.lib.StreamCipher,n=A.algo,r=[],o=[],i=[],s=n.RabbitLegacy=t.extend({_doReset:function(){var A=this._key.words,e=this.cfg.iv,t=this._X=[A[0],A[3]<<16|A[2]>>>16,A[1],A[0]<<16|A[3]>>>16,A[2],A[1]<<16|A[0]>>>16,A[3],A[2]<<16|A[1]>>>16],n=this._C=[A[2]<<16|A[2]>>>16,4294901760&A[0]|65535&A[1],A[3]<<16|A[3]>>>16,4294901760&A[1]|65535&A[2],A[0]<<16|A[0]>>>16,4294901760&A[2]|65535&A[3],A[1]<<16|A[1]>>>16,4294901760&A[3]|65535&A[0]];this._b=0;for(var r=0;r<4;r++)a.call(this);for(r=0;r<8;r++)n[r]^=t[r+4&7];if(e){var o=e.words,i=o[0],s=o[1],c=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=c>>>16|4294901760&l,h=l<<16|65535&c;for(n[0]^=c,n[1]^=u,n[2]^=l,n[3]^=h,n[4]^=c,n[5]^=u,n[6]^=l,n[7]^=h,r=0;r<4;r++)a.call(this)}},_doProcessBlock:function(A,e){var t=this._X;a.call(this),r[0]=t[0]^t[5]>>>16^t[3]<<16,r[1]=t[2]^t[7]>>>16^t[5]<<16,r[2]=t[4]^t[1]>>>16^t[7]<<16,r[3]=t[6]^t[3]>>>16^t[1]<<16;for(var n=0;n<4;n++)r[n]=16711935&(r[n]<<8|r[n]>>>24)|4278255360&(r[n]<<24|r[n]>>>8),A[e+n]^=r[n]},blockSize:4,ivSize:2});function a(){for(var A=this._X,e=this._C,t=0;t<8;t++)o[t]=e[t];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<o[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<o[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<o[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<o[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<o[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<o[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<o[6]>>>0?1:0)|0,this._b=e[7]>>>0<o[7]>>>0?1:0,t=0;t<8;t++){var n=A[t]+e[t],r=65535&n,s=n>>>16,a=((r*r>>>17)+r*s>>>15)+s*s,c=((4294901760&n)*n|0)+((65535&n)*n|0);i[t]=a^c}A[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,A[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,A[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,A[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,A[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,A[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,A[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,A[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}A.RabbitLegacy=t._createHelper(s)}(),e.RabbitLegacy)}(bo)),Ho(),e)}(Wn);var Io=Wn.exports;class xo{constructor(){this.iconManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1,this.isInitializing=!1,this.initResult=null,this.debug=!1,this.lastIconConfig=null}async init(A,t,n=!1){if(this.isInitializing)throw new Error("SDK is already initializing. Please wait for the current initialization to complete.");if(this.isInitialized&&!n){if(this.debug&&console.warn("CustomerSDK already initialized, returning cached result. Use forceReinit=true to reinitialize."),this.initResult)return this.initResult;throw new Error("SDK already initialized but cannot retrieve initialization info")}this.isInitializing=!0,this.isInitialized&&n&&(this.debug&&console.log("Force reinitializing SDK..."),this.screenshotManager?.destroy(),this.screenshotManager=null,this.isInitialized=!1),this.config=A,this.debug=A.debug??!1;try{const t=await this.getDeviceId();this.debug&&console.log("Raw Device ID:",t);const n=this.getReferrer(A),r=Io.MD5(t+n).toString();this.debug&&(console.log("Raw Device ID:",t),console.log("MD5 Device ID (for frontend):",r),console.log("Referrer used:",n));const o={deviceId:r,referrer:n,agent:A.agent,timestamp:Date.now()},i=A.iconPosition??this.lastIconConfig?.position,s=A.target??this.lastIconConfig?.target;if(this.isIconConfigChanged(i,s)?(this.iconManager&&(this.iconManager.hide(),this.iconManager=null,this.debug&&console.log("Icon config changed, recreating icon manager")),this.iconManager=new e(i,this.debug,s,{sideAttach:A.sideAttach??!0,sideHideRatio:A.sideHideRatio??.5,magnetic:A.magnetic??!0,magneticDirection:A.magneticDirection??"x",margin:A.margin??10,autoAttachDelay:A.autoAttachDelay??3e3}),await this.iconManager.show(),this.lastIconConfig={position:i,target:s}):(this.iconManager?(await this.iconManager.show(),this.debug&&console.log("Icon config unchanged, keeping existing icon manager")):(this.iconManager=new e(i,this.debug,s,{sideAttach:A.sideAttach??!0,sideHideRatio:A.sideHideRatio??.5,magnetic:A.magnetic??!0,magneticDirection:A.magneticDirection??"x",margin:A.margin??10,autoAttachDelay:A.autoAttachDelay??3e3}),await this.iconManager.show()),this.lastIconConfig={position:i,target:s}),this.iconManager.onClick(()=>{this.clearNotification()}),A.screenshot){const e=document.body,t={...A.screenshot,debug:this.debug};this.screenshotManager=new dt(e,t,void 0),this.screenshotManager.enable(!0),this.debug&&console.log("CustomerSDK screenshot manager initialized and enabled")}return this.isInitialized=!0,this.initResult=o,this.debug&&console.log("CustomerSDK initialized successfully (icon + screenshot only)"),o}catch(A){console.error("Failed to initialize CustomerSDK:",A);try{this.iconManager&&(this.iconManager.hide(),this.iconManager=null),this.screenshotManager&&(this.screenshotManager.destroy(),this.screenshotManager=null),this.isInitialized=!1,this.initResult=null}catch(A){console.error("Error during cleanup after initialization failure:",A)}throw A}finally{this.isInitializing=!1}}showIcon(){this.iconManager?.show()}hideIcon(){this.iconManager?.hide()}setIconPosition(A){this.iconManager?.setPosition(A)}setIconCoordinates(A){this.iconManager?.setIconPosition(A)}setIconStyle(A){this.iconManager?.setStyle(A)}onIconClick(A){this.iconManager?.onClick(A)}getConnectionStatus(){return this.isInitialized}showNotification(A=1,e={}){this.iconManager?(this.iconManager.showNotification({badgeCount:"string"==typeof A?0:A,badgeText:"string"==typeof A?A:"",pulse:e.pulse||!1}),e.autoHide&&e.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},e.autoHide)):this.debug&&console.warn("SDK not initialized")}clearNotification(){this.iconManager?.clearNotification()}setScreenshotTarget(A){this.screenshotManager?.setTargetElement(A)}async captureScreenshot(A=!1){return this.screenshotManager?await this.screenshotManager.captureOnce(A):(this.debug&&console.warn("截图功能未启用"),!1)}enableScreenshot(A){this.screenshotManager?(this.screenshotManager.enable(A),this.debug&&console.log("📸 截图功能已"+(A?"启用":"禁用"))):this.debug&&console.warn("截图管理器未初始化")}getScreenshotState(){return this.screenshotManager?.getState()||null}updateScreenshotOptions(A){this.screenshotManager?(this.screenshotManager.updateOptions(A),this.debug&&console.log("📸 截图配置已更新:",A)):this.debug&&console.warn("截图管理器未初始化,无法更新配置")}triggerScreenshotConfig(A){this.screenshotManager?(this.screenshotManager.handleScreenshotConfig(A),this.debug&&console.log("[CustomerServiceSDK] Screenshot config triggered:",A)):this.debug&&console.warn("[CustomerServiceSDK] ScreenshotManager not initialized")}destroy(){this.iconManager?.hide(),this.screenshotManager?.destroy(),this.iconManager=null,this.screenshotManager=null,this.config=null,this.initResult=null,this.lastIconConfig=null,this.isInitialized=!1,this.debug&&console.log("CustomerSDK destroyed")}getInitResult(){return this.initResult}async getDeviceId(){this.debug&&console.log("🔍 Starting to get device fingerprint...");try{this.debug&&console.log("📦 Loading FingerprintJS...");const A=await Gn.load();this.debug&&console.log("🎯 Getting device fingerprint...");const e=await A.get();return this.debug&&(console.log("✅ FingerprintJS result:",e),console.log("🆔 Device ID obtained:",e.visitorId)),e.visitorId}catch(A){this.debug&&console.warn("❌ Failed to get device fingerprint, using fallback:",A);const e="device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return this.debug&&console.log("🆔 Fallback Device ID:",e),e}}isIconConfigChanged(A,e){if(!this.lastIconConfig)return!0;const t=JSON.stringify(this.lastIconConfig.position)!==JSON.stringify(A),n=this.lastIconConfig.target;let r=!1;return n!==e&&(r="string"==typeof n&&"string"==typeof e?n!==e:(n instanceof HTMLElement&&HTMLElement,!0)),t||r}getReferrer(A){return A.referrer||document.referrer||document.location.href}}let So=null;const Lo=async(A,e,t=!1)=>(So||(So=new xo),await So.init(A,e,t)),Do=()=>{if(!So)throw new Error("SDK not initialized. Call init() first.");return So},Mo=()=>{Do().showIcon()},ko=()=>{Do().hideIcon()},Ko=A=>{Do().setIconPosition(A)},To=A=>{Do().setIconCoordinates(A)},Ro=A=>{Do().setIconStyle(A)},Po=A=>{Do().onIconClick(A)},Oo=()=>Do().getConnectionStatus(),Vo=()=>Do().getInitResult(),No=(A=1,e={})=>{Do().showNotification(A,e)},Go=()=>{Do().clearNotification()},Wo=()=>{Do().destroy(),So=null},_o=A=>{Do().setScreenshotTarget(A)},Xo=async(A=!1)=>{const e=Do();return await e.captureScreenshot(A)},Jo=A=>{Do().enableScreenshot(A)},Yo=()=>Do().getScreenshotState(),$o=A=>{Do().updateScreenshotOptions(A)},Zo=A=>{Do().triggerScreenshotConfig(A)};var zo={init:Lo,getInstance:Do,getInitResult:Vo,showIcon:Mo,hideIcon:ko,setIconPosition:Ko,setIconCoordinates:To,setIconStyle:Ro,onIconClick:Po,getConnectionStatus:Oo,showNotification:No,clearNotification:Go,setScreenshotTarget:_o,captureScreenshot:Xo,enableScreenshot:Jo,getScreenshotState:Yo,updateScreenshotOptions:$o,triggerScreenshotConfig:Zo,destroy:Wo};A.CustomerSDK=class{constructor(){this.iconManager=null,this.screenshotManager=null,this.debug=!1,this.deviceId=null,this.initResult=null,this.config=null,this.screenshotCallback=null,this.initCallback=null}async init(A,t,n){try{this.config=A,this.screenshotCallback=t||null,this.initCallback=n||null,this.debug=A.debug??!1;const r=await this.getRawDeviceId();this.debug&&console.log("Raw Device ID:",r);const o=A.referrer||document.referrer||document.location.href;this.deviceId=Io.MD5(r+o).toString(),this.debug&&(console.log("MD5 Device ID (for frontend):",this.deviceId),console.log("Referrer used:",o));const i={deviceId:this.deviceId,referrer:o,agent:A.agent,timestamp:Date.now()},s=A.target||void 0,a=A.iconPosition||void 0;if(this.iconManager=new e(a,this.debug,s,{sideAttach:A.sideAttach,sideHideRatio:A.sideHideRatio,magnetic:A.magnetic,magneticDirection:A.magneticDirection,margin:A.margin,autoAttachDelay:A.autoAttachDelay}),await this.iconManager.show(),n?.onIconClick&&this.iconManager.onClick(n.onIconClick),A.screenshot){const e="string"==typeof s?document.querySelector(s):s||document.body,n=t?.sendData||null;this.screenshotManager=new dt(e,A.screenshot,n||void 0),t?.onConfig&&this.setupScreenshotConfigListener(t.onConfig)}return this.initResult=i,this.debug&&console.log("CustomerSDK initialized successfully (icon + screenshot only)"),i}catch(A){throw console.error("Failed to initialize CustomerSDK:",A),A}}setupScreenshotConfigListener(A){const e=e=>{try{if(!e.data||"checkScreenshot"!==e.data.type)return;this.debug&&console.log("[CustomerSDK] Received screenshot config message:",e.data),e.data.data&&"string"==typeof e.data.data&&A(e.data.data)}catch(A){this.debug&&console.error("[CustomerSDK] Error handling screenshot config message:",A)}};window.addEventListener("message",e),this._screenshotConfigHandler=e}triggerScreenshotConfig(A){this.screenshotManager?this.screenshotManager.handleScreenshotConfig(A):this.debug&&console.warn("[CustomerSDK] ScreenshotManager not initialized")}hideIcon(){this.iconManager?.hide()}showIcon(){this.iconManager?.show()}onIconClick(A){this.iconManager?.onClick(A)}getScreenshotManager(){return this.screenshotManager}getIconManager(){return this.iconManager}getDeviceId(){return this.deviceId}getInitResult(){return this.initResult}async updateToken(A,e,t){if(!this.config)throw new Error("SDK not initialized. Call init() first.");this.debug&&console.log("Updating token:",A?"Token provided":"Token removed");const n={...this.config,token:A&&""!==A.trim()?A:void 0};return this.destroy(),await this.init(n,e||this.screenshotCallback||void 0,t||this.initCallback||void 0)}async getRawDeviceId(){this.debug&&console.log("🔍 Starting to get device fingerprint...");try{this.debug&&console.log("📦 Loading FingerprintJS...");const A=await Gn.load();this.debug&&console.log("🎯 Getting device fingerprint...");const e=await A.get();return this.debug&&(console.log("✅ FingerprintJS result:",e),console.log("🆔 Device ID obtained:",e.visitorId)),e.visitorId}catch(A){this.debug&&console.warn("❌ Failed to get device fingerprint, using fallback:",A);const e="device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return this.debug&&console.log("🆔 Fallback Device ID:",e),e}}showNotification(A=1,e={}){this.iconManager?(this.iconManager.showNotification({badgeCount:"string"==typeof A?0:A,badgeText:"string"==typeof A?A:"",pulse:e.pulse||!1}),e.autoHide&&e.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},e.autoHide)):this.debug&&console.warn("SDK not initialized")}clearNotification(){this.iconManager?.clearNotification()}destroy(){this.iconManager?.hide(),this.screenshotManager?.destroy(),this._screenshotConfigHandler&&(window.removeEventListener("message",this._screenshotConfigHandler),this._screenshotConfigHandler=null),this.iconManager=null,this.screenshotManager=null,this.initResult=null,this.deviceId=null,this.debug&&console.log("CustomerSDK destroyed")}},A.CustomerServiceSDK=xo,A.captureScreenshot=Xo,A.clearNotification=Go,A.default=zo,A.destroy=Wo,A.enableScreenshot=Jo,A.getConnectionStatus=Oo,A.getInitResult=Vo,A.getInstance=Do,A.getScreenshotState=Yo,A.hideIcon=ko,A.init=Lo,A.onIconClick=Po,A.setIconCoordinates=To,A.setIconPosition=Ko,A.setIconStyle=Ro,A.setScreenshotTarget=_o,A.showIcon=Mo,A.showNotification=No,A.triggerScreenshotConfig=Zo,A.updateScreenshotOptions=$o,Object.defineProperty(A,"__esModule",{value:!0})});
38
+ function(){var A=e,t=A.lib,n=t.WordArray,r=t.Hasher,o=A.algo,i=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),u=n.create([1352829926,1548603684,1836072691,2053994217,0]),h=o.RIPEMD160=r.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(A,e){for(var t=0;t<16;t++){var n=e+t,r=A[n];A[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var o,h,m,C,Q,y,U,F,b,v,E,H=this._hash.words,I=l.words,x=u.words,S=i.words,L=s.words,D=a.words,M=c.words;for(y=o=H[0],U=h=H[1],F=m=H[2],b=C=H[3],v=Q=H[4],t=0;t<80;t+=1)E=o+A[e+S[t]]|0,E+=t<16?g(h,m,C)+I[0]:t<32?d(h,m,C)+I[1]:t<48?B(h,m,C)+I[2]:t<64?f(h,m,C)+I[3]:w(h,m,C)+I[4],E=(E=p(E|=0,D[t]))+Q|0,o=Q,Q=C,C=p(m,10),m=h,h=E,E=y+A[e+L[t]]|0,E+=t<16?w(U,F,b)+x[0]:t<32?f(U,F,b)+x[1]:t<48?B(U,F,b)+x[2]:t<64?d(U,F,b)+x[3]:g(U,F,b)+x[4],E=(E=p(E|=0,M[t]))+v|0,y=v,v=b,b=p(F,10),F=U,U=E;E=H[1]+m+b|0,H[1]=H[2]+C+v|0,H[2]=H[3]+Q+y|0,H[3]=H[4]+o+U|0,H[4]=H[0]+h+F|0,H[0]=E},_doFinalize:function(){var A=this._data,e=A.words,t=8*this._nDataBytes,n=8*A.sigBytes;e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(t<<8|t>>>24)|4278255360&(t<<24|t>>>8),A.sigBytes=4*(e.length+1),this._process();for(var r=this._hash,o=r.words,i=0;i<5;i++){var s=o[i];o[i]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return r},clone:function(){var A=r.clone.call(this);return A._hash=this._hash.clone(),A}});function g(A,e,t){return A^e^t}function d(A,e,t){return A&e|~A&t}function B(A,e,t){return(A|~e)^t}function f(A,e,t){return A&t|e&~t}function w(A,e,t){return A^(e|~t)}function p(A,e){return A<<e|A>>>32-e}A.RIPEMD160=r._createHelper(h),A.HmacRIPEMD160=r._createHmacHelper(h)}(),e.RIPEMD160)}(xr)),Dr(),Mr||(Mr=1,function(A){var e,t,n,r,o,i,s,a,c;A.exports=(c=Yn(),pr(),Dr(),n=(t=(e=c).lib).Base,r=t.WordArray,i=(o=e.algo).SHA256,s=o.HMAC,a=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:25e4}),init:function(A){this.cfg=this.cfg.extend(A)},compute:function(A,e){for(var t=this.cfg,n=s.create(t.hasher,A),o=r.create(),i=r.create([1]),a=o.words,c=i.words,l=t.keySize,u=t.iterations;a.length<l;){var h=n.update(e).finalize(i);n.reset();for(var g=h.words,d=g.length,B=h,f=1;f<u;f++){B=n.finalize(B),n.reset();for(var w=B.words,p=0;p<d;p++)g[p]^=w[p]}o.concat(h),c[0]++}return o.sigBytes=4*l,o}}),e.PBKDF2=function(A,e,t){return a.create(t).compute(A,e)},c.PBKDF2)}(kr)),Rr(),Vr(),Wr(),Jr(),Zr(),qr(),Ao||(Ao=1,function(A){var e,t;A.exports=(t=Yn(),Vr(),t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(A,e){this._cipher.encryptBlock(A,e)}}),e.Decryptor=e.extend({processBlock:function(A,e){this._cipher.decryptBlock(A,e)}}),e),t.mode.ECB)}(eo)),to||(to=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.AnsiX923={pad:function(A,e){var t=A.sigBytes,n=4*e,r=n-t%n,o=t+r-1;A.clamp(),A.words[o>>>2]|=r<<24-o%4*8,A.sigBytes+=r},unpad:function(A){var e=255&A.words[A.sigBytes-1>>>2];A.sigBytes-=e}},e.pad.Ansix923)}(no)),ro||(ro=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.Iso10126={pad:function(A,t){var n=4*t,r=n-A.sigBytes%n;A.concat(e.lib.WordArray.random(r-1)).concat(e.lib.WordArray.create([r<<24],1))},unpad:function(A){var e=255&A.words[A.sigBytes-1>>>2];A.sigBytes-=e}},e.pad.Iso10126)}(oo)),io||(io=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.Iso97971={pad:function(A,t){A.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(A,t)},unpad:function(A){e.pad.ZeroPadding.unpad(A),A.sigBytes--}},e.pad.Iso97971)}(so)),ao||(ao=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.ZeroPadding={pad:function(A,e){var t=4*e;A.clamp(),A.sigBytes+=t-(A.sigBytes%t||t)},unpad:function(A){var e=A.words,t=A.sigBytes-1;for(t=A.sigBytes-1;t>=0;t--)if(e[t>>>2]>>>24-t%4*8&255){A.sigBytes=t+1;break}}},e.pad.ZeroPadding)}(co)),lo||(lo=1,function(A){var e;A.exports=(e=Yn(),Vr(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding)}(uo)),ho||(ho=1,function(A){var e,t,n,r;A.exports=(r=Yn(),Vr(),t=(e=r).lib.CipherParams,n=e.enc.Hex,e.format.Hex={stringify:function(A){return A.ciphertext.toString(n)},parse:function(A){var e=n.parse(A);return t.create({ciphertext:e})}},r.format.Hex)}(go)),Bo||(Bo=1,function(A){var e;A.exports=(e=Yn(),ir(),hr(),Rr(),Vr(),function(){var A=e,t=A.lib.BlockCipher,n=A.algo,r=[],o=[],i=[],s=[],a=[],c=[],l=[],u=[],h=[],g=[];!function(){for(var A=[],e=0;e<256;e++)A[e]=e<128?e<<1:e<<1^283;var t=0,n=0;for(e=0;e<256;e++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,r[t]=d,o[d]=t;var B=A[t],f=A[B],w=A[f],p=257*A[d]^16843008*d;i[t]=p<<24|p>>>8,s[t]=p<<16|p>>>16,a[t]=p<<8|p>>>24,c[t]=p,p=16843009*w^65537*f^257*B^16843008*t,l[d]=p<<24|p>>>8,u[d]=p<<16|p>>>16,h[d]=p<<8|p>>>24,g[d]=p,t?(t=B^A[A[A[w^B]]],n^=A[A[n]]):t=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],B=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var A=this._keyPriorReset=this._key,e=A.words,t=A.sigBytes/4,n=4*((this._nRounds=t+6)+1),o=this._keySchedule=[],i=0;i<n;i++)i<t?o[i]=e[i]:(c=o[i-1],i%t?t>6&&i%t==4&&(c=r[c>>>24]<<24|r[c>>>16&255]<<16|r[c>>>8&255]<<8|r[255&c]):(c=r[(c=c<<8|c>>>24)>>>24]<<24|r[c>>>16&255]<<16|r[c>>>8&255]<<8|r[255&c],c^=d[i/t|0]<<24),o[i]=o[i-t]^c);for(var s=this._invKeySchedule=[],a=0;a<n;a++){if(i=n-a,a%4)var c=o[i];else c=o[i-4];s[a]=a<4||i<=4?c:l[r[c>>>24]]^u[r[c>>>16&255]]^h[r[c>>>8&255]]^g[r[255&c]]}}},encryptBlock:function(A,e){this._doCryptBlock(A,e,this._keySchedule,i,s,a,c,r)},decryptBlock:function(A,e){var t=A[e+1];A[e+1]=A[e+3],A[e+3]=t,this._doCryptBlock(A,e,this._invKeySchedule,l,u,h,g,o),t=A[e+1],A[e+1]=A[e+3],A[e+3]=t},_doCryptBlock:function(A,e,t,n,r,o,i,s){for(var a=this._nRounds,c=A[e]^t[0],l=A[e+1]^t[1],u=A[e+2]^t[2],h=A[e+3]^t[3],g=4,d=1;d<a;d++){var B=n[c>>>24]^r[l>>>16&255]^o[u>>>8&255]^i[255&h]^t[g++],f=n[l>>>24]^r[u>>>16&255]^o[h>>>8&255]^i[255&c]^t[g++],w=n[u>>>24]^r[h>>>16&255]^o[c>>>8&255]^i[255&l]^t[g++],p=n[h>>>24]^r[c>>>16&255]^o[l>>>8&255]^i[255&u]^t[g++];c=B,l=f,u=w,h=p}B=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[255&h])^t[g++],f=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[h>>>8&255]<<8|s[255&c])^t[g++],w=(s[u>>>24]<<24|s[h>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^t[g++],p=(s[h>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&u])^t[g++],A[e]=B,A[e+1]=f,A[e+2]=w,A[e+3]=p},keySize:8});A.AES=t._createHelper(B)}(),e.AES)}(fo)),mo(),Co||(Co=1,function(A){var e;A.exports=(e=Yn(),ir(),hr(),Rr(),Vr(),function(){var A=e,t=A.lib.StreamCipher,n=A.algo,r=n.RC4=t.extend({_doReset:function(){for(var A=this._key,e=A.words,t=A.sigBytes,n=this._S=[],r=0;r<256;r++)n[r]=r;r=0;for(var o=0;r<256;r++){var i=r%t,s=e[i>>>2]>>>24-i%4*8&255;o=(o+n[r]+s)%256;var a=n[r];n[r]=n[o],n[o]=a}this._i=this._j=0},_doProcessBlock:function(A,e){A[e]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var A=this._S,e=this._i,t=this._j,n=0,r=0;r<4;r++){t=(t+A[e=(e+1)%256])%256;var o=A[e];A[e]=A[t],A[t]=o,n|=A[(A[e]+A[t])%256]<<24-8*r}return this._i=e,this._j=t,n}A.RC4=t._createHelper(r);var i=n.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var A=this.cfg.drop;A>0;A--)o.call(this)}});A.RC4Drop=t._createHelper(i)}(),e.RC4)}(Qo)),yo||(yo=1,function(A){var e;A.exports=(e=Yn(),ir(),hr(),Rr(),Vr(),function(){var A=e,t=A.lib.StreamCipher,n=A.algo,r=[],o=[],i=[],s=n.Rabbit=t.extend({_doReset:function(){for(var A=this._key.words,e=this.cfg.iv,t=0;t<4;t++)A[t]=16711935&(A[t]<<8|A[t]>>>24)|4278255360&(A[t]<<24|A[t]>>>8);var n=this._X=[A[0],A[3]<<16|A[2]>>>16,A[1],A[0]<<16|A[3]>>>16,A[2],A[1]<<16|A[0]>>>16,A[3],A[2]<<16|A[1]>>>16],r=this._C=[A[2]<<16|A[2]>>>16,4294901760&A[0]|65535&A[1],A[3]<<16|A[3]>>>16,4294901760&A[1]|65535&A[2],A[0]<<16|A[0]>>>16,4294901760&A[2]|65535&A[3],A[1]<<16|A[1]>>>16,4294901760&A[3]|65535&A[0]];for(this._b=0,t=0;t<4;t++)a.call(this);for(t=0;t<8;t++)r[t]^=n[t+4&7];if(e){var o=e.words,i=o[0],s=o[1],c=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=c>>>16|4294901760&l,h=l<<16|65535&c;for(r[0]^=c,r[1]^=u,r[2]^=l,r[3]^=h,r[4]^=c,r[5]^=u,r[6]^=l,r[7]^=h,t=0;t<4;t++)a.call(this)}},_doProcessBlock:function(A,e){var t=this._X;a.call(this),r[0]=t[0]^t[5]>>>16^t[3]<<16,r[1]=t[2]^t[7]>>>16^t[5]<<16,r[2]=t[4]^t[1]>>>16^t[7]<<16,r[3]=t[6]^t[3]>>>16^t[1]<<16;for(var n=0;n<4;n++)r[n]=16711935&(r[n]<<8|r[n]>>>24)|4278255360&(r[n]<<24|r[n]>>>8),A[e+n]^=r[n]},blockSize:4,ivSize:2});function a(){for(var A=this._X,e=this._C,t=0;t<8;t++)o[t]=e[t];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<o[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<o[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<o[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<o[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<o[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<o[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<o[6]>>>0?1:0)|0,this._b=e[7]>>>0<o[7]>>>0?1:0,t=0;t<8;t++){var n=A[t]+e[t],r=65535&n,s=n>>>16,a=((r*r>>>17)+r*s>>>15)+s*s,c=((4294901760&n)*n|0)+((65535&n)*n|0);i[t]=a^c}A[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,A[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,A[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,A[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,A[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,A[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,A[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,A[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}A.Rabbit=t._createHelper(s)}(),e.Rabbit)}(Uo)),Fo||(Fo=1,function(A){var e;A.exports=(e=Yn(),ir(),hr(),Rr(),Vr(),function(){var A=e,t=A.lib.StreamCipher,n=A.algo,r=[],o=[],i=[],s=n.RabbitLegacy=t.extend({_doReset:function(){var A=this._key.words,e=this.cfg.iv,t=this._X=[A[0],A[3]<<16|A[2]>>>16,A[1],A[0]<<16|A[3]>>>16,A[2],A[1]<<16|A[0]>>>16,A[3],A[2]<<16|A[1]>>>16],n=this._C=[A[2]<<16|A[2]>>>16,4294901760&A[0]|65535&A[1],A[3]<<16|A[3]>>>16,4294901760&A[1]|65535&A[2],A[0]<<16|A[0]>>>16,4294901760&A[2]|65535&A[3],A[1]<<16|A[1]>>>16,4294901760&A[3]|65535&A[0]];this._b=0;for(var r=0;r<4;r++)a.call(this);for(r=0;r<8;r++)n[r]^=t[r+4&7];if(e){var o=e.words,i=o[0],s=o[1],c=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=c>>>16|4294901760&l,h=l<<16|65535&c;for(n[0]^=c,n[1]^=u,n[2]^=l,n[3]^=h,n[4]^=c,n[5]^=u,n[6]^=l,n[7]^=h,r=0;r<4;r++)a.call(this)}},_doProcessBlock:function(A,e){var t=this._X;a.call(this),r[0]=t[0]^t[5]>>>16^t[3]<<16,r[1]=t[2]^t[7]>>>16^t[5]<<16,r[2]=t[4]^t[1]>>>16^t[7]<<16,r[3]=t[6]^t[3]>>>16^t[1]<<16;for(var n=0;n<4;n++)r[n]=16711935&(r[n]<<8|r[n]>>>24)|4278255360&(r[n]<<24|r[n]>>>8),A[e+n]^=r[n]},blockSize:4,ivSize:2});function a(){for(var A=this._X,e=this._C,t=0;t<8;t++)o[t]=e[t];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<o[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<o[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<o[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<o[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<o[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<o[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<o[6]>>>0?1:0)|0,this._b=e[7]>>>0<o[7]>>>0?1:0,t=0;t<8;t++){var n=A[t]+e[t],r=65535&n,s=n>>>16,a=((r*r>>>17)+r*s>>>15)+s*s,c=((4294901760&n)*n|0)+((65535&n)*n|0);i[t]=a^c}A[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,A[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,A[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,A[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,A[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,A[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,A[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,A[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}A.RabbitLegacy=t._createHelper(s)}(),e.RabbitLegacy)}(bo)),Ho(),e)}(Wn);var Io=Wn.exports;class xo{constructor(){this.iconManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1,this.isInitializing=!1,this.initResult=null,this.debug=!1,this.lastIconConfig=null}async init(A,t,n=!1){if(this.isInitializing)throw new Error("SDK is already initializing. Please wait for the current initialization to complete.");if(this.isInitialized&&!n){if(this.debug&&console.warn("CustomerSDK already initialized, returning cached result. Use forceReinit=true to reinitialize."),this.initResult)return this.initResult;throw new Error("SDK already initialized but cannot retrieve initialization info")}this.isInitializing=!0,this.isInitialized&&n&&(this.debug&&console.log("Force reinitializing SDK..."),this.screenshotManager?.destroy(),this.screenshotManager=null,this.isInitialized=!1),this.config=A,this.debug=A.debug??!1;try{const t=await this.getDeviceId();this.debug&&console.log("Raw Device ID:",t);const n=this.getReferrer(A),r=Io.MD5(t+n).toString();this.debug&&(console.log("Raw Device ID:",t),console.log("MD5 Device ID (for frontend):",r),console.log("Referrer used:",n));const o={deviceId:r,referrer:n,agent:A.agent,timestamp:Date.now()},i=A.iconPosition??this.lastIconConfig?.position,s=A.target??this.lastIconConfig?.target;if(this.isIconConfigChanged(i,s)?(this.iconManager&&(this.iconManager.hide(),this.iconManager=null,this.debug&&console.log("Icon config changed, recreating icon manager")),this.iconManager=new e(i,this.debug,s,{sideAttach:A.sideAttach??!0,sideHideRatio:A.sideHideRatio??.5,magnetic:A.magnetic??!0,magneticDirection:A.magneticDirection??"x",margin:A.margin??10,autoAttachDelay:A.autoAttachDelay??3e3}),await this.iconManager.show(),this.lastIconConfig={position:i,target:s}):(this.iconManager?(await this.iconManager.show(),this.debug&&console.log("Icon config unchanged, keeping existing icon manager")):(this.iconManager=new e(i,this.debug,s,{sideAttach:A.sideAttach??!0,sideHideRatio:A.sideHideRatio??.5,magnetic:A.magnetic??!0,magneticDirection:A.magneticDirection??"x",margin:A.margin??10,autoAttachDelay:A.autoAttachDelay??3e3}),await this.iconManager.show()),this.lastIconConfig={position:i,target:s}),this.iconManager.onClick(()=>{this.clearNotification()}),A.screenshot){const e=document.body,t={...A.screenshot,debug:this.debug};this.screenshotManager=new dt(e,t,void 0),this.screenshotManager.enable(!0),this.debug&&console.log("CustomerSDK screenshot manager initialized and enabled")}return this.isInitialized=!0,this.initResult=o,this.debug&&console.log("CustomerSDK initialized successfully (icon + screenshot only)"),o}catch(A){console.error("Failed to initialize CustomerSDK:",A);try{this.iconManager&&(this.iconManager.hide(),this.iconManager=null),this.screenshotManager&&(this.screenshotManager.destroy(),this.screenshotManager=null),this.isInitialized=!1,this.initResult=null}catch(A){console.error("Error during cleanup after initialization failure:",A)}throw A}finally{this.isInitializing=!1}}showIcon(){this.iconManager?.show()}hideIcon(){this.iconManager?.hide()}setIconPosition(A){this.iconManager?.setPosition(A)}setIconCoordinates(A){this.iconManager?.setIconPosition(A)}setIconStyle(A){this.iconManager?.setStyle(A)}onIconClick(A){this.iconManager?.onClick(A)}getConnectionStatus(){return this.isInitialized}showNotification(A=1,e={}){this.iconManager?(this.iconManager.showNotification({badgeCount:"string"==typeof A?0:A,badgeText:"string"==typeof A?A:"",pulse:e.pulse||!1}),e.autoHide&&e.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},e.autoHide)):this.debug&&console.warn("SDK not initialized")}clearNotification(){this.iconManager?.clearNotification()}setScreenshotTarget(A){this.screenshotManager?.setTargetElement(A)}async captureScreenshot(A=!1){return this.screenshotManager?await this.screenshotManager.captureOnce(A):(this.debug&&console.warn("截图功能未启用"),!1)}enableScreenshot(A){this.screenshotManager?(this.screenshotManager.enable(A),this.debug&&console.log("📸 截图功能已"+(A?"启用":"禁用"))):this.debug&&console.warn("截图管理器未初始化")}getScreenshotState(){return this.screenshotManager?.getState()||null}updateScreenshotOptions(A){this.screenshotManager?(this.screenshotManager.updateOptions(A),this.debug&&console.log("📸 截图配置已更新:",A)):this.debug&&console.warn("截图管理器未初始化,无法更新配置")}triggerScreenshotConfig(A){this.screenshotManager?(this.screenshotManager.handleScreenshotConfig(A),this.debug&&console.log("[CustomerServiceSDK] Screenshot config triggered:",A)):this.debug&&console.warn("[CustomerServiceSDK] ScreenshotManager not initialized")}destroy(){this.iconManager?.hide(),this.screenshotManager?.destroy(),this.iconManager=null,this.screenshotManager=null,this.config=null,this.initResult=null,this.lastIconConfig=null,this.isInitialized=!1,this.debug&&console.log("CustomerSDK destroyed")}getInitResult(){return this.initResult}async generateInitResult(A){const e=await this.getDeviceId(),t=this.config?.referrer||this.getReferrer(this.config||{}),n=Io.MD5(e+t).toString(),r=A||this.config?.agent;return this.debug&&console.log("Generated InitResult:",{deviceId:n,referrer:t,agent:r,timestamp:Date.now()}),{deviceId:n,referrer:t,agent:r,timestamp:Date.now()}}async getDeviceId(){this.debug&&console.log("🔍 Starting to get device fingerprint...");try{this.debug&&console.log("📦 Loading FingerprintJS...");const A=await Gn.load();this.debug&&console.log("🎯 Getting device fingerprint...");const e=await A.get();return this.debug&&(console.log("✅ FingerprintJS result:",e),console.log("🆔 Device ID obtained:",e.visitorId)),e.visitorId}catch(A){this.debug&&console.warn("❌ Failed to get device fingerprint, using fallback:",A);const e="device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return this.debug&&console.log("🆔 Fallback Device ID:",e),e}}isIconConfigChanged(A,e){if(!this.lastIconConfig)return!0;const t=JSON.stringify(this.lastIconConfig.position)!==JSON.stringify(A),n=this.lastIconConfig.target;let r=!1;return n!==e&&(r="string"==typeof n&&"string"==typeof e?n!==e:(n instanceof HTMLElement&&HTMLElement,!0)),t||r}getReferrer(A){return A.referrer||document.referrer||document.location.href}}let So=null;const Lo=async(A,e,t=!1)=>(So||(So=new xo),await So.init(A,e,t)),Do=()=>{if(!So)throw new Error("SDK not initialized. Call init() first.");return So},Mo=()=>{Do().showIcon()},ko=()=>{Do().hideIcon()},Ko=A=>{Do().setIconPosition(A)},To=A=>{Do().setIconCoordinates(A)},Ro=A=>{Do().setIconStyle(A)},Po=A=>{Do().onIconClick(A)},Oo=()=>Do().getConnectionStatus(),Vo=()=>Do().getInitResult(),No=async A=>{const e=Do();return await e.generateInitResult(A)},Go=(A=1,e={})=>{Do().showNotification(A,e)},Wo=()=>{Do().clearNotification()},_o=()=>{Do().destroy(),So=null},Xo=A=>{Do().setScreenshotTarget(A)},Jo=async(A=!1)=>{const e=Do();return await e.captureScreenshot(A)},Yo=A=>{Do().enableScreenshot(A)},$o=()=>Do().getScreenshotState(),Zo=A=>{Do().updateScreenshotOptions(A)},zo=A=>{Do().triggerScreenshotConfig(A)};var jo={init:Lo,getInstance:Do,getInitResult:Vo,generateInitResult:No,showIcon:Mo,hideIcon:ko,setIconPosition:Ko,setIconCoordinates:To,setIconStyle:Ro,onIconClick:Po,getConnectionStatus:Oo,showNotification:Go,clearNotification:Wo,setScreenshotTarget:Xo,captureScreenshot:Jo,enableScreenshot:Yo,getScreenshotState:$o,updateScreenshotOptions:Zo,triggerScreenshotConfig:zo,destroy:_o};A.CustomerSDK=class{constructor(){this.iconManager=null,this.screenshotManager=null,this.debug=!1,this.deviceId=null,this.initResult=null,this.config=null,this.screenshotCallback=null,this.initCallback=null}async init(A,t,n){try{this.config=A,this.screenshotCallback=t||null,this.initCallback=n||null,this.debug=A.debug??!1;const r=await this.getRawDeviceId();this.debug&&console.log("Raw Device ID:",r);const o=A.referrer||document.referrer||document.location.href;this.deviceId=Io.MD5(r+o).toString(),this.debug&&(console.log("MD5 Device ID (for frontend):",this.deviceId),console.log("Referrer used:",o));const i={deviceId:this.deviceId,referrer:o,agent:A.agent,timestamp:Date.now()},s=A.target||void 0,a=A.iconPosition||void 0;if(this.iconManager=new e(a,this.debug,s,{sideAttach:A.sideAttach,sideHideRatio:A.sideHideRatio,magnetic:A.magnetic,magneticDirection:A.magneticDirection,margin:A.margin,autoAttachDelay:A.autoAttachDelay}),await this.iconManager.show(),n?.onIconClick&&this.iconManager.onClick(n.onIconClick),A.screenshot){const e="string"==typeof s?document.querySelector(s):s||document.body,n=t?.sendData||null;this.screenshotManager=new dt(e,A.screenshot,n||void 0),t?.onConfig&&this.setupScreenshotConfigListener(t.onConfig)}return this.initResult=i,this.debug&&console.log("CustomerSDK initialized successfully (icon + screenshot only)"),i}catch(A){throw console.error("Failed to initialize CustomerSDK:",A),A}}setupScreenshotConfigListener(A){const e=e=>{try{if(!e.data||"checkScreenshot"!==e.data.type)return;this.debug&&console.log("[CustomerSDK] Received screenshot config message:",e.data),e.data.data&&"string"==typeof e.data.data&&A(e.data.data)}catch(A){this.debug&&console.error("[CustomerSDK] Error handling screenshot config message:",A)}};window.addEventListener("message",e),this._screenshotConfigHandler=e}triggerScreenshotConfig(A){this.screenshotManager?this.screenshotManager.handleScreenshotConfig(A):this.debug&&console.warn("[CustomerSDK] ScreenshotManager not initialized")}hideIcon(){this.iconManager?.hide()}showIcon(){this.iconManager?.show()}onIconClick(A){this.iconManager?.onClick(A)}getScreenshotManager(){return this.screenshotManager}getIconManager(){return this.iconManager}getDeviceId(){return this.deviceId}getInitResult(){return this.initResult}async updateToken(A,e,t){if(!this.config)throw new Error("SDK not initialized. Call init() first.");this.debug&&console.log("Updating token:",A?"Token provided":"Token removed");const n={...this.config,token:A&&""!==A.trim()?A:void 0};return this.destroy(),await this.init(n,e||this.screenshotCallback||void 0,t||this.initCallback||void 0)}async getRawDeviceId(){this.debug&&console.log("🔍 Starting to get device fingerprint...");try{this.debug&&console.log("📦 Loading FingerprintJS...");const A=await Gn.load();this.debug&&console.log("🎯 Getting device fingerprint...");const e=await A.get();return this.debug&&(console.log("✅ FingerprintJS result:",e),console.log("🆔 Device ID obtained:",e.visitorId)),e.visitorId}catch(A){this.debug&&console.warn("❌ Failed to get device fingerprint, using fallback:",A);const e="device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return this.debug&&console.log("🆔 Fallback Device ID:",e),e}}showNotification(A=1,e={}){this.iconManager?(this.iconManager.showNotification({badgeCount:"string"==typeof A?0:A,badgeText:"string"==typeof A?A:"",pulse:e.pulse||!1}),e.autoHide&&e.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},e.autoHide)):this.debug&&console.warn("SDK not initialized")}clearNotification(){this.iconManager?.clearNotification()}destroy(){this.iconManager?.hide(),this.screenshotManager?.destroy(),this._screenshotConfigHandler&&(window.removeEventListener("message",this._screenshotConfigHandler),this._screenshotConfigHandler=null),this.iconManager=null,this.screenshotManager=null,this.initResult=null,this.deviceId=null,this.debug&&console.log("CustomerSDK destroyed")}},A.CustomerServiceSDK=xo,A.captureScreenshot=Jo,A.clearNotification=Wo,A.default=jo,A.destroy=_o,A.enableScreenshot=Yo,A.generateInitResult=No,A.getConnectionStatus=Oo,A.getInitResult=Vo,A.getInstance=Do,A.getScreenshotState=$o,A.hideIcon=ko,A.init=Lo,A.onIconClick=Po,A.setIconCoordinates=To,A.setIconPosition=Ko,A.setIconStyle=Ro,A.setScreenshotTarget=Xo,A.showIcon=Mo,A.showNotification=Go,A.triggerScreenshotConfig=zo,A.updateScreenshotOptions=Zo,Object.defineProperty(A,"__esModule",{value:!0})});
package/dist/index.d.ts CHANGED
@@ -16,11 +16,11 @@ export declare class CustomerServiceSDK {
16
16
  /**
17
17
  * 初始化 SDK
18
18
  * @param config SDK配置
19
- * @param options UI选项(可选)
19
+ * @param options UI选项(可选,保留用于兼容性,当前未使用)
20
20
  * @param forceReinit 是否强制重新初始化(用于更新token等配置)
21
21
  * @returns 返回初始化信息(包含设备ID等)
22
22
  */
23
- init(config: SDKConfig, options?: ChatWindowOptions, forceReinit?: boolean): Promise<InitResult>;
23
+ init(config: SDKConfig, _options?: ChatWindowOptions, forceReinit?: boolean): Promise<InitResult>;
24
24
  /**
25
25
  * 显示/隐藏悬浮图标
26
26
  */
@@ -103,8 +103,16 @@ export declare class CustomerServiceSDK {
103
103
  destroy(): void;
104
104
  /**
105
105
  * 获取初始化信息(设备ID等)
106
+ * 如果已初始化,返回保存的结果;否则返回 null
106
107
  */
107
108
  getInitResult(): InitResult | null;
109
+ /**
110
+ * 生成初始化信息(设备ID等)
111
+ * 可以在任何时候调用,即使没有初始化也能获取 deviceId 等信息
112
+ * @param agent 代理商ID(可选,如果不传则从已保存的配置中获取)
113
+ * @returns 返回初始化信息(包含设备ID等)
114
+ */
115
+ generateInitResult(agent?: string): Promise<InitResult>;
108
116
  /**
109
117
  * 获取设备指纹ID
110
118
  */
@@ -155,6 +163,13 @@ export declare const getConnectionStatus: () => boolean;
155
163
  * 获取初始化信息(设备ID等)
156
164
  */
157
165
  export declare const getInitResult: () => InitResult | null;
166
+ /**
167
+ * 生成初始化信息(设备ID等)
168
+ * 可以在任何时候调用,即使没有初始化也能获取 deviceId 等信息
169
+ * @param agent 代理商ID(可选,如果不传则从已保存的配置中获取)
170
+ * @returns 返回初始化信息(包含设备ID等)
171
+ */
172
+ export declare const generateInitResult: (agent?: string) => Promise<InitResult>;
158
173
  /**
159
174
  * 消息通知API
160
175
  */
@@ -189,6 +204,7 @@ declare const _default: {
189
204
  init: (config: SDKConfig, options?: ChatWindowOptions, forceReinit?: boolean) => Promise<InitResult>;
190
205
  getInstance: () => CustomerServiceSDK;
191
206
  getInitResult: () => InitResult | null;
207
+ generateInitResult: (agent?: string) => Promise<InitResult>;
192
208
  showIcon: () => void;
193
209
  hideIcon: () => void;
194
210
  setIconPosition: (position: "top-left" | "top-right" | "bottom-left" | "bottom-right") => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customer-chat-sdk",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
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",