helldots 0.3.0 → 0.4.0

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,4 +1,25 @@
1
- import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{customElements.get(A)||customElements.define(A,class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}})};function re(){Pe();let r=document.querySelector(A);return r||(r=document.createElement(A),document.body.appendChild(r)),r.shadowRoot}var D=.5,He=.7,se=r=>!r||r==="transparent"||r==="rgba(0, 0, 0, 0)",ke=()=>{let r=getComputedStyle(document.documentElement).backgroundColor;if(!se(r))return r;let e=getComputedStyle(document.body).backgroundColor;return se(e)?"#ffffff":e};async function q({scale:r=1}={}){return $e(document.body,{scale:r,backgroundColor:ke()})}async function K(r){let e=document.querySelector(A),t=e?.style.display;e&&(e.style.display="none");try{return await r()}finally{e&&(e.style.display=t||"")}}function ae(r,{left:e,top:t,width:o,height:i}){let s=document.createElement("canvas");s.width=o,s.height=i;let a=s.getContext("2d");return a?(a.drawImage(r,e+window.scrollX,t+window.scrollY,o,i,0,0,o,i),s.toDataURL("image/png")):null}function Z(r,{sourceScale:e=1,outputScale:t=D,quality:o=He}={}){let i=document.createElement("canvas");i.width=Math.round(window.innerWidth*t),i.height=Math.round(window.innerHeight*t);let s=i.getContext("2d");return s?(s.drawImage(r,window.scrollX*e,window.scrollY*e,window.innerWidth*e,window.innerHeight*e,0,0,i.width,i.height),i.toDataURL("image/jpeg",o)):null}var De=[{name:"Edge",re:/Edg\/([\d.]+)/},{name:"Chrome",re:/Chrome\/([\d.]+)/},{name:"Firefox",re:/Firefox\/([\d.]+)/},{name:"Safari",re:/Version\/([\d.]+).*Safari/}],Xe=[{name:"iOS",re:/(?:iPhone|iPad).*OS ([\d_]+) like Mac OS X/},{name:"Android",re:/Android ([\d.]+)/},{name:"Windows",re:/Windows NT ([\d.]+)/},{name:"macOS",re:/Mac OS X ([\d_.]+)/},{name:"Linux",re:/Linux/}],Ue={name:"unknown",version:""},Fe=r=>/not[\W_]*a[\W_]*brand/i.test(r),le=(r,e)=>{for(let{name:t,re:o}of r){let i=e.match(o);if(i)return{name:t,version:(i[1]||"").replace(/_/g,".")}}return{...Ue}};function ce(r=window){let e=r.navigator||{},t=e.userAgent||"",o=e.userAgentData,i=le(De,t),s=o?.brands?.find(l=>!Fe(l.brand));s&&(i={name:s.brand,version:s.version||""});let a=le(Xe,t);return o?.platform&&(a.name=o.platform),{version:1,url:r.location?.href||"",viewport:{width:r.innerWidth,height:r.innerHeight},screen:{width:r.screen?.width??0,height:r.screen?.height??0},devicePixelRatio:r.devicePixelRatio??1,userAgent:t,browser:i,os:a,language:e.language||""}}var n={CIRCLE:"comment-circle",CIRCLE_WRAPPER:"comment-circle-wrapper",TOOLTIP:"comment-tooltip",TOOLBAR_TEXT:"toolbar-text",SHORTCUT_HINT:"shortcut-hint",COMMENT_INPUT_AREA:"comment-input-area",CLOSE_TOOLTIP:"close-tooltip",ACTIVE:"active",COMMENT_CURSOR:"comment-cursor",COMMENT_OVERLAY:"comment-overlay",THREAD_POPOVER:"comment-thread-popover",THREAD_HEADER:"thread-header",THREAD_BODY:"thread-body",THREAD_REPLIES:"thread-replies",THREAD_REPLY:"thread-reply",THREAD_INPUT_AREA:"thread-input-area",THREAD_INPUT:"thread-input",THREAD_SUBMIT:"thread-submit",THREAD_META:"thread-meta",THREAD_AUTHOR:"thread-author",THREAD_TIME:"thread-time",PREVIEW_CIRCLE:"preview-circle",SELECTION_RECT:"selection-rect",SCREENSHOT_IMG:"screenshot-img",SCREENSHOT_REMOVE:"screenshot-remove",SCREENSHOTS_CONTAINER:"screenshots-container",SCREENSHOT_ITEM:"screenshot-item",LIGHTBOX:"helldots-lightbox",LIGHTBOX_IMG:"helldots-lightbox-img",LIGHTBOX_CLOSE:"helldots-lightbox-close",COMMENT_ACTIONS_BAR:"comment-actions-bar",ATTACH_IMAGE_BTN:"attach-image-btn",TOOLBAR_ACTIONS:"toolbar-actions",TOOLBAR_ACTION_BTN:"toolbar-action-btn",TOOLBAR_ACTION_WRAPPER:"toolbar-action-wrapper",TOOLBAR_ACTION_TOOLTIP:"toolbar-action-tooltip",TOOLBAR_COMMENT_BTN:"toolbar-comment-btn",TOOLBAR_MENU_BTN:"toolbar-menu-btn",INBOX_PANEL:"inbox-panel",INBOX_HEADER:"inbox-header",INBOX_FILTER:"inbox-filter",INBOX_FILTER_MENU:"inbox-filter-menu",INBOX_FILTER_OPTION:"inbox-filter-option",INBOX_FILTER_SECTION:"inbox-filter-section",INBOX_CLOSE:"inbox-close",INBOX_LIST:"inbox-list",INBOX_CARD:"inbox-card",INBOX_CARD_HEADER:"inbox-card-header",INBOX_CARD_ACTIONS:"inbox-card-actions",INBOX_CARD_TEXT:"inbox-card-text",INBOX_CARD_TAG:"inbox-card-tag",INBOX_CARD_REPLY_LINK:"inbox-card-reply-link",INBOX_ACTION_BTN:"inbox-action-btn",INBOX_ACTION_BTN_LABELED:"inbox-action-btn--labeled",INBOX_ACTION_LABEL:"inbox-action-label",INBOX_STATUS_DOT:"inbox-status-dot",INBOX_MENU:"inbox-menu",INBOX_MENU_ITEM:"inbox-menu-item",INBOX_DETAIL:"inbox-detail",INBOX_DETAIL_HEADER:"inbox-detail-header",INBOX_BACK:"inbox-back",INBOX_NAV_BTN:"inbox-nav-btn",INBOX_REPLIES:"inbox-replies",INBOX_EMPTY:"inbox-empty",CLASSIFY_ROW:"classify-row",TAGS_INPUT:"tags-input",TAG_CHIP:"tag-chip",TAG_CHIP_REMOVE:"tag-chip-remove",INBOX_BADGES:"inbox-badges",BADGE:"helldots-badge",BADGE_TYPE:"helldots-badge--type",BADGE_PRIORITY:"helldots-badge--priority",BADGE_TAG:"helldots-badge--tag",BADGE_DURATION:"helldots-badge--duration",CONTEXT_BLOCK:"inbox-context",CONTEXT_ROW:"inbox-context-row",CONTEXT_SCREENSHOT_CAPTION:"inbox-context-screenshot-caption",HIGHLIGHT:"helldots-highlight"},T={TOOLBAR:"comment-toolbar",COMMENT_BOX:"comment-box",COMMENT_INPUT:"comment-input",SUBMIT_COMMENT:"submit-comment",STYLES:"comment-overlay-styles",GLOBAL_STYLES:"comment-overlay-global-styles",ATTACH_IMAGE_INPUT:"attach-image-input"},M=["open","in_progress","resolved"],de={open:"#2E90FA",in_progress:"#FF9F0A",resolved:"#30D158"},y=["bug","suggestion","question","improvement"],w={bug:"#FF453A",suggestion:"#BF5AF2",question:"#64D2FF",improvement:"#5E5CE6"},S=["high","medium","low"],L={high:"#FF453A",medium:"#FF9F0A",low:"#8E8E93"},he={CONTAINER:'section, div[class*="container"], div[class*="content"]'},x={CIRCLE:9997,TOOLTIP:1e4,TOOLBAR:9998,COMMENT_BOX:9999,LIGHTBOX:10001},pe='data:image/svg+xml;utf8,<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><g filter="url(%23filter0_d_4_97)"><path d="M6 8C6 6.89543 6.89543 6 8 6H20C27.732 6 34 12.268 34 20V20C34 27.732 27.732 34 20 34V34C12.268 34 6 27.732 6 20V8Z" fill="%232E90FA"/><path d="M8 7H20C27.1797 7 33 12.8203 33 20C33 27.1797 27.1797 33 20 33C12.8203 33 7 27.1797 7 20V8C7 7.44772 7.44772 7 8 7Z" stroke="white" stroke-width="2"/></g><filter id="filter0_d_4_97" x="0" y="0" width="48" height="48" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dx="4" dy="4"/><feGaussianBlur stdDeviation="5"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0.180392 0 0 0 0 0.564706 0 0 0 0 0.980392 0 0 0 0.16 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_4_97"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_4_97" result="shape"/></filter></svg>';var ue=()=>`
1
+ /*! HellDots MIT. Bundles nanoid (MIT) © 2017 Andrey Sitnik <andrey@sitnik.es> https://github.com/ai/nanoid */
2
+ import{domToCanvas as ut}from"modern-screenshot";var w="helldots-root",ht=()=>{customElements.get(w)||customElements.define(w,class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}})};function Re(){ht();let n=document.querySelector(w);return n||(n=document.createElement(w),document.body.appendChild(n)),n.shadowRoot}var K=.5,mt=.7,Ie=n=>!n||n==="transparent"||n==="rgba(0, 0, 0, 0)",gt=()=>{let n=getComputedStyle(document.documentElement).backgroundColor;if(!Ie(n))return n;let e=getComputedStyle(document.body).backgroundColor;return Ie(e)?"#ffffff":e};async function pe({scale:n=1}={}){return ut(document.body,{scale:n,backgroundColor:gt()})}async function he(n){let e=document.querySelector(w),t=e?.style.display;e&&(e.style.display="none");try{return await n()}finally{e&&(e.style.display=t||"")}}function Ne(n,{left:e,top:t,width:i,height:s}){let r=document.createElement("canvas");r.width=i,r.height=s;let a=r.getContext("2d");return a?(a.drawImage(n,e+window.scrollX,t+window.scrollY,i,s,0,0,i,s),r.toDataURL("image/png")):null}function ue(n,{sourceScale:e=1,outputScale:t=K,quality:i=mt}={}){let s=document.createElement("canvas");s.width=Math.round(window.innerWidth*t),s.height=Math.round(window.innerHeight*t);let r=s.getContext("2d");return r?(r.drawImage(n,window.scrollX*e,window.scrollY*e,window.innerWidth*e,window.innerHeight*e,0,0,s.width,s.height),s.toDataURL("image/jpeg",i)):null}var Et=[{name:"Edge",re:/Edg\/([\d.]+)/},{name:"Chrome",re:/Chrome\/([\d.]+)/},{name:"Firefox",re:/Firefox\/([\d.]+)/},{name:"Safari",re:/Version\/([\d.]+).*Safari/}],ft=[{name:"iOS",re:/(?:iPhone|iPad).*OS ([\d_]+) like Mac OS X/},{name:"Android",re:/Android ([\d.]+)/},{name:"Windows",re:/Windows NT ([\d.]+)/},{name:"macOS",re:/Mac OS X ([\d_.]+)/},{name:"Linux",re:/Linux/}],bt={name:"unknown",version:""},Ct=n=>/not[\W_]*a[\W_]*brand/i.test(n),we=(n,e)=>{for(let{name:t,re:i}of n){let s=e.match(i);if(s)return{name:t,version:(s[1]||"").replace(/_/g,".")}}return{...bt}};function Le(n=window){let e=n.navigator||{},t=e.userAgent||"",i=e.userAgentData,s=we(Et,t),r=i?.brands?.find(l=>!Ct(l.brand));r&&(s={name:r.brand,version:r.version||""});let a=we(ft,t);return i?.platform&&(a.name=i.platform),{version:1,url:n.location?.href||"",viewport:{width:n.innerWidth,height:n.innerHeight},screen:{width:n.screen?.width??0,height:n.screen?.height??0},devicePixelRatio:n.devicePixelRatio??1,userAgent:t,browser:s,os:a,language:e.language||""}}var o={CIRCLE:"comment-circle",CIRCLE_ACTIVE:"comment-circle--active",CIRCLE_WRAPPER:"comment-circle-wrapper",TOOLTIP:"comment-tooltip",TOOLBAR_TEXT:"toolbar-text",SHORTCUT_HINT:"shortcut-hint",COMMENT_INPUT_AREA:"comment-input-area",CLOSE_TOOLTIP:"close-tooltip",ACTIVE:"active",COMMENT_CURSOR:"comment-cursor",COMMENT_OVERLAY:"comment-overlay",THREAD_POPOVER:"comment-thread-popover",THREAD_HEADER:"thread-header",THREAD_BODY:"thread-body",THREAD_REPLIES:"thread-replies",THREAD_REPLY:"thread-reply",THREAD_REPLY_ACTIONS:"thread-reply-actions",THREAD_INPUT_AREA:"thread-input-area",THREAD_INPUT:"thread-input",THREAD_SUBMIT:"thread-submit",THREAD_ACTIONS_ROW:"thread-actions-row",THREAD_SCROLL:"thread-scroll",THREAD_META:"thread-meta",THREAD_AUTHOR:"thread-author",THREAD_TIME:"thread-time",THREAD_EDITED:"thread-edited",EDITOR:"helldots-editor",EDITOR_INPUT:"helldots-editor-input",EDITOR_ACTIONS:"helldots-editor-actions",EDITOR_SAVE:"helldots-editor-save",EDITOR_CANCEL:"helldots-editor-cancel",INBOX_NOTICE:"inbox-notice",PREVIEW_CIRCLE:"preview-circle",SELECTION_RECT:"selection-rect",SCREENSHOT_IMG:"screenshot-img",SCREENSHOT_REMOVE:"screenshot-remove",SCREENSHOTS_CONTAINER:"screenshots-container",SCREENSHOT_ITEM:"screenshot-item",CONFIRM:"helldots-confirm",CONFIRM_PANEL:"helldots-confirm-panel",CONFIRM_TITLE:"helldots-confirm-title",CONFIRM_MESSAGE:"helldots-confirm-message",CONFIRM_ACTIONS:"helldots-confirm-actions",CONFIRM_CANCEL:"helldots-confirm-cancel",CONFIRM_ACCEPT:"helldots-confirm-accept",LIGHTBOX:"helldots-lightbox",LIGHTBOX_IMG:"helldots-lightbox-img",LIGHTBOX_CLOSE:"helldots-lightbox-close",COMMENT_ACTIONS_BAR:"comment-actions-bar",ATTACH_IMAGE_BTN:"attach-image-btn",TOOLBAR_ACTIONS:"toolbar-actions",TOOLBAR_ACTION_BTN:"toolbar-action-btn",TOOLBAR_ACTION_WRAPPER:"toolbar-action-wrapper",TOOLBAR_ACTION_TOOLTIP:"toolbar-action-tooltip",TOOLBAR_COMMENT_BTN:"toolbar-comment-btn",TOOLBAR_MENU_BTN:"toolbar-menu-btn",INBOX_PANEL:"inbox-panel",INBOX_HEADER:"inbox-header",INBOX_FILTER:"inbox-filter",INBOX_FILTER_MENU:"inbox-filter-menu",INBOX_FILTER_MENU_HEADER:"inbox-filter-menu-header",INBOX_FILTER_CLEAR:"inbox-filter-clear",INBOX_FILTER_GROUP:"inbox-filter-group",INBOX_FILTER_CHIPS:"inbox-filter-chips",INBOX_FILTER_CHIP:"inbox-filter-chip",INBOX_FILTER_SECTION:"inbox-filter-section",INBOX_CLOSE:"inbox-close",INBOX_LIST:"inbox-list",INBOX_CARD:"inbox-card",INBOX_CARD_HEADER:"inbox-card-header",INBOX_CARD_ACTIONS:"inbox-card-actions",INBOX_CARD_TEXT:"inbox-card-text",INBOX_CARD_TAG:"inbox-card-tag",INBOX_CARD_REPLY_LINK:"inbox-card-reply-link",INBOX_ACTION_BTN:"inbox-action-btn",INBOX_ACTION_BTN_LABELED:"inbox-action-btn--labeled",INBOX_ACTION_LABEL:"inbox-action-label",INBOX_STATUS_DOT:"inbox-status-dot",INBOX_MENU:"inbox-menu",INBOX_MENU_ITEM:"inbox-menu-item",INBOX_DETAIL:"inbox-detail",INBOX_DETAIL_HEADER:"inbox-detail-header",INBOX_BACK:"inbox-back",INBOX_NAV_BTN:"inbox-nav-btn",INBOX_REPLIES:"inbox-replies",TOOLTIP_REPLY_COUNT:"comment-tooltip-reply-count",INBOX_EMPTY:"inbox-empty",INBOX_EMPTY_ICON:"inbox-empty-icon",INBOX_EMPTY_TITLE:"inbox-empty-title",INBOX_EMPTY_TEXT:"inbox-empty-text",INBOX_EMPTY_KBD:"inbox-empty-kbd",INBOX_EMPTY_ACTION:"inbox-empty-action",CLASSIFY_ROW:"classify-row",INBOX_BADGES:"inbox-badges",BADGE:"helldots-badge",BADGE_STATUS:"helldots-badge--status",BADGE_TYPE:"helldots-badge--type",BADGE_PRIORITY:"helldots-badge--priority",BADGE_TAG:"helldots-badge--tag",BADGE_DURATION:"helldots-badge--duration",CONTEXT_BLOCK:"inbox-context",CONTEXT_TITLE:"inbox-context-title",CONTEXT_BODY:"inbox-context-body",CONTEXT_ROW:"inbox-context-row",CONTEXT_SCREENSHOT_CAPTION:"inbox-context-screenshot-caption",CONTEXT_TOGGLE:"inbox-context-toggle",HIGHLIGHT:"helldots-highlight"},Be=[o.COMMENT_CURSOR],T={TOOLBAR:"comment-toolbar",COMMENT_BOX:"comment-box",COMMENT_INPUT:"comment-input",SUBMIT_COMMENT:"submit-comment",STYLES:"comment-overlay-styles",GLOBAL_STYLES:"comment-overlay-global-styles",ATTACH_IMAGE_INPUT:"attach-image-input"},L=["open","in_progress","resolved"],Z={open:"#2E90FA",in_progress:"#FF9F0A",resolved:"#30D158"},R=["bug","suggestion","question","improvement"],X={bug:"#FF453A",suggestion:"#BF5AF2",question:"#64D2FF",improvement:"#5E5CE6"},I=["high","medium","low"],F={high:"#FF453A",medium:"#FF9F0A",low:"#8E8E93"},Me={CONTAINER:'section, div[class*="container"], div[class*="content"]'},O={CIRCLE:9997,TOOLTIP:1e4,TOOLBAR:9998,COMMENT_BOX:9999,LIGHTBOX:10001,CONFIRM:10002},Pe='data:image/svg+xml;utf8,<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-4,-4)"><path d="M6 8C6 6.89543 6.89543 6 8 6H20C27.732 6 34 12.268 34 20V20C34 27.732 27.732 34 20 34V34C12.268 34 6 27.732 6 20V8Z" fill="%232E90FA"/><path d="M8 7H20C27.1797 7 33 12.8203 33 20C33 27.1797 27.1797 33 20 33C12.8203 33 7 27.1797 7 20V8C7 7.44772 7.44772 7 8 7Z" stroke="white" stroke-width="2"/></g></svg>',De="2 2";var Q=`
3
+ scrollbar-width: thin;
4
+ scrollbar-color: rgba(255,255,255,0.22) transparent;`,Tt=(...n)=>n.map(e=>`
5
+ ${e}::-webkit-scrollbar {
6
+ width: 8px;
7
+ height: 8px;
8
+ }
9
+
10
+ ${e}::-webkit-scrollbar-track {
11
+ background: transparent;
12
+ }
13
+
14
+ ${e}::-webkit-scrollbar-thumb {
15
+ background: rgba(255,255,255,0.22);
16
+ border-radius: 4px;
17
+ }
18
+
19
+ ${e}::-webkit-scrollbar-thumb:hover {
20
+ background: rgba(255,255,255,0.35);
21
+ }
22
+ `).join(""),$e=()=>`
2
23
 
3
24
  :host {
4
25
  all: initial;
@@ -26,14 +47,14 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
26
47
  bottom: 20px;
27
48
  left: 50%;
28
49
  transform: translateX(-50%);
29
- z-index: ${x.TOOLBAR};
50
+ z-index: ${O.TOOLBAR};
30
51
  }
31
52
 
32
- .${n.TOOLBAR_ACTION_WRAPPER} {
53
+ .${o.TOOLBAR_ACTION_WRAPPER} {
33
54
  position: relative;
34
55
  }
35
56
 
36
- .${n.TOOLBAR_ACTION_TOOLTIP} {
57
+ .${o.TOOLBAR_ACTION_TOOLTIP} {
37
58
  position: absolute;
38
59
  bottom: calc(100% + 10px);
39
60
  left: 50%;
@@ -55,19 +76,19 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
55
76
  transition: opacity 0.15s ease, transform 0.15s ease;
56
77
  }
57
78
 
58
- .${n.TOOLBAR_ACTION_WRAPPER}:hover .${n.TOOLBAR_ACTION_TOOLTIP} {
79
+ .${o.TOOLBAR_ACTION_WRAPPER}:hover .${o.TOOLBAR_ACTION_TOOLTIP} {
59
80
  opacity: 1;
60
81
  pointer-events: auto;
61
82
  transform: translateX(-50%) translateY(0);
62
83
  }
63
84
 
64
- .${n.TOOLBAR_TEXT} {
85
+ .${o.TOOLBAR_TEXT} {
65
86
  font-size: 13px;
66
87
  font-weight: 500;
67
88
  letter-spacing: -0.01em;
68
89
  }
69
90
 
70
- .${n.SHORTCUT_HINT} {
91
+ .${o.SHORTCUT_HINT} {
71
92
  font-size: 11px;
72
93
  font-weight: 500;
73
94
  color: rgba(255, 255, 255, 0.5);
@@ -79,7 +100,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
79
100
  white-space: nowrap;
80
101
  }
81
102
 
82
- .${n.TOOLBAR_ACTIONS} {
103
+ .${o.TOOLBAR_ACTIONS} {
83
104
  display: flex;
84
105
  flex-direction: row;
85
106
  background: rgba(20, 20, 23, 0.95);
@@ -89,7 +110,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
89
110
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
90
111
  }
91
112
 
92
- .${n.TOOLBAR_ACTION_BTN} {
113
+ .${o.TOOLBAR_ACTION_BTN} {
93
114
  width: 42px;
94
115
  height: 42px;
95
116
  display: flex;
@@ -104,20 +125,20 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
104
125
  padding: 0;
105
126
  }
106
127
 
107
- .${n.TOOLBAR_ACTION_WRAPPER}:first-child .${n.TOOLBAR_ACTION_BTN} {
128
+ .${o.TOOLBAR_ACTION_WRAPPER}:first-child .${o.TOOLBAR_ACTION_BTN} {
108
129
  border-radius: 12px 0 0 12px;
109
130
  }
110
131
 
111
- .${n.TOOLBAR_ACTION_WRAPPER}:last-child .${n.TOOLBAR_ACTION_BTN} {
132
+ .${o.TOOLBAR_ACTION_WRAPPER}:last-child .${o.TOOLBAR_ACTION_BTN} {
112
133
  border-radius: 0 12px 12px 0;
113
134
  }
114
135
 
115
- .${n.TOOLBAR_ACTION_BTN}:hover {
136
+ .${o.TOOLBAR_ACTION_BTN}:hover {
116
137
  background: rgba(255, 255, 255, 0.08);
117
138
  color: white;
118
139
  }
119
140
 
120
- .${n.TOOLBAR_COMMENT_BTN}.${n.ACTIVE} {
141
+ .${o.TOOLBAR_COMMENT_BTN}.${o.ACTIVE} {
121
142
  color: #2E90FA;
122
143
  background: rgba(46, 144, 250, 0.1);
123
144
  }
@@ -129,57 +150,41 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
129
150
  border-radius: 12px;
130
151
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
131
152
  padding: 16px;
132
- z-index: ${x.COMMENT_BOX};
133
- width: 400px;
153
+ z-index: ${O.COMMENT_BOX};
154
+ width: min(400px, calc(100vw - 24px));
134
155
  display: none;
135
156
  box-sizing: border-box;
136
157
  }
137
-
138
- #${T.COMMENT_BOX} .${n.COMMENT_INPUT_AREA} {
158
+
159
+ #${T.COMMENT_BOX} .${o.COMMENT_INPUT_AREA} {
139
160
  display: flex;
140
161
  flex-direction: column;
141
162
  gap: 0;
142
163
  }
143
164
 
144
- .${n.CLASSIFY_ROW} {
165
+ /* Shares the comment box's own 16px inset instead of adding its own, so
166
+ the pickers line up with the textarea below them. The hairline is the
167
+ mirror of the one .thread-input-area carries on top. */
168
+ .${o.CLASSIFY_ROW} {
145
169
  display: flex;
146
170
  align-items: center;
147
171
  flex-wrap: wrap;
148
- gap: 6px;
149
- padding: 8px 10px 0;
150
- }
151
- .${n.TAGS_INPUT} {
152
- flex: 1 1 90px;
153
- min-width: 90px;
154
- background: transparent;
155
- border: none;
156
- outline: none;
157
- color: inherit;
158
- font-size: 12px;
159
- padding: 2px 0;
160
- }
161
- .${n.TAG_CHIP} {
162
- display: inline-flex;
163
- align-items: center;
164
- gap: 4px;
165
- padding: 2px 6px;
166
- border-radius: 10px;
167
- background: rgba(255, 255, 255, 0.1);
168
- font-size: 11px;
169
- line-height: 1.4;
172
+ gap: 8px;
173
+ padding: 0 0 10px;
174
+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);
170
175
  }
171
- .${n.TAG_CHIP_REMOVE} {
172
- background: none;
173
- border: none;
174
- color: inherit;
175
- cursor: pointer;
176
- padding: 0;
177
- font-size: 13px;
178
- line-height: 1;
179
- opacity: 0.6;
176
+
177
+ /* In the inbox the pickers sit in a strip of other icon buttons and read
178
+ as controls on their own. Alone at the top of an empty comment box
179
+ they need an outline to do the same. */
180
+ .${o.CLASSIFY_ROW} .${o.INBOX_ACTION_BTN} {
181
+ height: 26px;
182
+ border: 1px solid rgba(255, 255, 255, 0.12);
183
+ border-radius: 8px;
180
184
  }
181
- .${n.TAG_CHIP_REMOVE}:hover {
182
- opacity: 1;
185
+
186
+ .${o.CLASSIFY_ROW} .${o.INBOX_ACTION_BTN}:hover {
187
+ border-color: rgba(255, 255, 255, 0.28);
183
188
  }
184
189
 
185
190
  #${T.COMMENT_INPUT} {
@@ -194,8 +199,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
194
199
  line-height: 1.4;
195
200
  box-sizing: border-box;
196
201
  field-sizing: content;
197
- padding-top: 4px;
198
- padding-bottom: 8px;
202
+ padding: 8px 0;
199
203
  }
200
204
 
201
205
  #${T.COMMENT_INPUT}::placeholder {
@@ -207,14 +211,14 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
207
211
  box-shadow: none;
208
212
  }
209
213
 
210
- .${n.COMMENT_ACTIONS_BAR} {
214
+ .${o.COMMENT_ACTIONS_BAR} {
211
215
  display: flex;
212
216
  align-items: center;
213
217
  justify-content: space-between;
214
218
  padding-top: 12px;
215
219
  }
216
220
 
217
- .${n.ATTACH_IMAGE_BTN} {
221
+ .${o.ATTACH_IMAGE_BTN} {
218
222
  background: none;
219
223
  border: none;
220
224
  color: rgba(255, 255, 255, 0.5);
@@ -226,12 +230,12 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
226
230
  transition: background 0.2s, color 0.2s;
227
231
  }
228
232
 
229
- .${n.ATTACH_IMAGE_BTN}:hover {
233
+ .${o.ATTACH_IMAGE_BTN}:hover {
230
234
  background: rgba(255, 255, 255, 0.1);
231
235
  color: rgba(255, 255, 255, 0.8);
232
236
  }
233
237
 
234
- .${n.CIRCLE} {
238
+ .${o.CIRCLE} {
235
239
  position: absolute;
236
240
  width: 28px;
237
241
  height: 28px;
@@ -241,68 +245,101 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
241
245
  cursor: pointer;
242
246
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
243
247
  transition: transform 0.2s, background 0.2s;
244
- z-index: ${x.CIRCLE};
248
+ z-index: ${O.CIRCLE};
245
249
  transform: translate(-50%, -50%);
246
250
  }
247
251
 
248
- .${n.CIRCLE}:hover {
252
+ .${o.CIRCLE}:hover {
249
253
  transform: translate(-50%, -50%) scale(1.2) !important;
250
254
  background: rgb(0, 123, 255);
251
255
  }
252
256
 
253
- .${n.CIRCLE}.${n.HIGHLIGHT} {
257
+ .${o.CIRCLE}.${o.HIGHLIGHT} {
254
258
  transform: translate(-50%, -50%) scale(1.2) !important;
255
259
  background: rgb(0, 123, 255);
256
260
  box-shadow: 0 0 0 4px rgba(46, 144, 250, 0.35), 0 1px 5px rgba(0,0,0,0.2);
257
261
  }
258
262
 
259
- .${n.CIRCLE_WRAPPER} {
263
+ /* The marker whose thread is open. Grows like hover does \u2014 the pointer
264
+ has to leave the circle to reach the popover, so hover alone can't
265
+ carry the selected state \u2014 and adds a heavier ring. Size and ring,
266
+ not colour alone (WCAG 1.4.1). */
267
+ .${o.CIRCLE}.${o.CIRCLE_ACTIVE} {
268
+ transform: translate(-50%, -50%) scale(1.2) !important;
269
+ background: rgb(0, 123, 255);
270
+ box-shadow: 0 0 0 5px rgba(46, 144, 250, 0.5), 0 1px 5px rgba(0,0,0,0.2);
271
+ }
272
+
273
+ .${o.CIRCLE_WRAPPER} {
260
274
  position: absolute;
261
275
  left: 0;
262
276
  top: 0;
263
277
  width: 100%;
264
278
  height: 100%;
265
279
  pointer-events: none;
266
- z-index: ${x.CIRCLE};
280
+ z-index: ${O.CIRCLE};
267
281
  }
268
282
 
269
- .${n.TOOLTIP} {
283
+ .${o.TOOLTIP} {
270
284
  position: fixed;
271
285
  background: #1C1C1E;
272
286
  border-radius: 12px;
273
287
  padding: 16px;
274
288
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
275
- width: 400px;
276
- z-index: ${x.TOOLTIP};
289
+ width: min(400px, calc(100vw - 24px));
290
+ max-height: calc(100vh - 20px);
291
+ overflow-y: auto;
292
+ overscroll-behavior: contain;${Q}
293
+ z-index: ${O.TOOLTIP};
277
294
  color: white;
278
295
  font-size: 14px;
279
296
  line-height: 1.5;
280
297
  box-sizing: border-box;
281
298
  }
282
299
 
283
- .${n.TOOLTIP} .${n.THREAD_HEADER} {
300
+ .${o.TOOLTIP} .${o.THREAD_HEADER} {
284
301
  padding: 0 0 0;
285
302
  }
286
303
 
287
- .${n.TOOLTIP} .${n.THREAD_BODY} {
304
+ .${o.TOOLTIP} .${o.THREAD_BODY} {
288
305
  padding: 8px 0;
289
306
  }
290
307
 
291
- .${n.THREAD_POPOVER} {
308
+ .${o.THREAD_POPOVER} {
292
309
  position: fixed;
293
310
  background: #1C1C1E;
294
311
  border-radius: 12px;
295
312
  padding: 16px;
296
313
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
297
- width: 400px;
298
- z-index: ${x.TOOLTIP};
314
+ width: min(400px, calc(100vw - 24px));
315
+ max-height: calc(100vh - 20px);
316
+ display: flex;
317
+ flex-direction: column;
318
+ z-index: ${O.TOOLTIP};
299
319
  color: white;
300
320
  font-size: 14px;
301
321
  line-height: 1.5;
302
322
  box-sizing: border-box;
303
323
  }
304
324
 
305
- .${n.INBOX_PANEL} {
325
+ /* The header, its action row and the reply box are pinned; the comment
326
+ body, context block and replies scroll between them. The min-height: 0
327
+ is required \u2014 a flex item's default minimum is its content height, so
328
+ without it the popover grows past max-height instead of scrolling. */
329
+ .${o.THREAD_POPOVER} > .${o.THREAD_HEADER},
330
+ .${o.THREAD_POPOVER} > .${o.THREAD_ACTIONS_ROW},
331
+ .${o.THREAD_POPOVER} > .${o.THREAD_INPUT_AREA} {
332
+ flex: none;
333
+ }
334
+
335
+ .${o.THREAD_SCROLL} {
336
+ flex: 1 1 auto;
337
+ min-height: 0;
338
+ overflow-y: auto;
339
+ overscroll-behavior: contain;${Q}
340
+ }
341
+ ${Tt(`.${o.THREAD_SCROLL}`,`.${o.TOOLTIP}`,`.${o.INBOX_LIST}`,`.${o.INBOX_DETAIL}`,`.${o.EDITOR_INPUT}`)}
342
+ .${o.INBOX_PANEL} {
306
343
  position: fixed;
307
344
  top: 16px;
308
345
  right: 16px;
@@ -314,7 +351,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
314
351
  border: 1px solid rgba(255,255,255,0.08);
315
352
  border-radius: 14px;
316
353
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
317
- z-index: ${x.COMMENT_BOX};
354
+ z-index: ${O.COMMENT_BOX};
318
355
  color: white;
319
356
  font-size: 14px;
320
357
  line-height: 1.5;
@@ -322,15 +359,17 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
322
359
  overflow: hidden;
323
360
  }
324
361
 
325
- @media (max-width: 420px) {
326
- .${n.INBOX_PANEL} {
362
+ /* 380px panel + 16px of gutter each side needs 412px to sit flush on
363
+ the right; below that it spans the viewport instead. */
364
+ @media (max-width: 480px) {
365
+ .${o.INBOX_PANEL} {
327
366
  left: 16px;
328
367
  width: auto;
329
368
  }
330
369
  }
331
370
 
332
- .${n.INBOX_HEADER},
333
- .${n.INBOX_DETAIL_HEADER} {
371
+ .${o.INBOX_HEADER},
372
+ .${o.INBOX_DETAIL_HEADER} {
334
373
  display: flex;
335
374
  align-items: center;
336
375
  justify-content: space-between;
@@ -340,11 +379,11 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
340
379
  flex: none;
341
380
  }
342
381
 
343
- .${n.INBOX_FILTER}-wrapper {
382
+ .${o.INBOX_FILTER}-wrapper {
344
383
  position: relative;
345
384
  }
346
385
 
347
- .${n.INBOX_FILTER} {
386
+ .${o.INBOX_FILTER} {
348
387
  display: flex;
349
388
  align-items: center;
350
389
  gap: 6px;
@@ -358,46 +397,97 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
358
397
  border-radius: 6px;
359
398
  }
360
399
 
361
- .${n.INBOX_FILTER}:hover {
400
+ .${o.INBOX_FILTER}:hover {
362
401
  background: rgba(255,255,255,0.08);
363
402
  }
364
403
 
365
- .${n.INBOX_FILTER_MENU} {
404
+ .${o.INBOX_FILTER_MENU} {
366
405
  position: absolute;
367
- top: calc(100% + 4px);
406
+ top: calc(100% + 6px);
368
407
  left: 0;
369
408
  background: #2C2C2E;
370
409
  border: 1px solid rgba(255,255,255,0.1);
371
- border-radius: 8px;
372
- padding: 4px;
373
- min-width: 190px;
410
+ border-radius: 12px;
411
+ padding: 14px;
412
+ width: 300px;
413
+ max-width: calc(100vw - 40px);
374
414
  z-index: 1;
375
- box-shadow: 0 4px 16px rgba(0,0,0,0.4);
415
+ box-shadow: 0 8px 28px rgba(0,0,0,0.5);
416
+ }
417
+
418
+ .${o.INBOX_FILTER_MENU_HEADER} {
419
+ display: flex;
420
+ align-items: baseline;
421
+ justify-content: space-between;
422
+ gap: 12px;
423
+ font-size: 13px;
424
+ font-weight: 600;
425
+ margin-bottom: 12px;
426
+ }
427
+
428
+ .${o.INBOX_FILTER_CLEAR} {
429
+ background: transparent;
430
+ border: none;
431
+ color: rgba(255,255,255,0.55);
432
+ font-size: 12px;
433
+ font-weight: 500;
434
+ cursor: pointer;
435
+ padding: 0;
436
+ }
437
+
438
+ .${o.INBOX_FILTER_CLEAR}:hover:not(:disabled) {
439
+ color: white;
440
+ }
441
+
442
+ .${o.INBOX_FILTER_CLEAR}:disabled {
443
+ opacity: 0.35;
444
+ cursor: default;
445
+ }
446
+
447
+ .${o.INBOX_FILTER_GROUP} + .${o.INBOX_FILTER_GROUP} {
448
+ margin-top: 14px;
376
449
  }
377
450
 
378
- .${n.INBOX_FILTER_SECTION} {
379
- padding: 8px 10px 4px;
451
+ .${o.INBOX_FILTER_SECTION} {
380
452
  font-size: 11px;
381
453
  font-weight: 600;
382
454
  color: rgba(255,255,255,0.45);
383
- text-transform: none;
455
+ margin-bottom: 8px;
384
456
  }
385
457
 
386
- .${n.INBOX_FILTER_SECTION}:not(:first-child) {
387
- margin-top: 4px;
388
- border-top: 1px solid rgba(255,255,255,0.1);
389
- padding-top: 10px;
458
+ .${o.INBOX_FILTER_CHIPS} {
459
+ display: flex;
460
+ flex-wrap: wrap;
461
+ gap: 6px;
390
462
  }
391
463
 
392
- .${n.INBOX_FILTER_OPTION} {
393
- display: flex;
394
- justify-content: space-between;
395
- align-items: center;
396
- gap: 12px;
464
+ .${o.INBOX_FILTER_CHIP} {
465
+ background: transparent;
466
+ border: 1px solid rgba(255,255,255,0.18);
467
+ border-radius: 999px;
468
+ color: rgba(255,255,255,0.75);
469
+ font-size: 12px;
470
+ line-height: 1;
471
+ padding: 7px 12px;
472
+ cursor: pointer;
473
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
474
+ }
475
+
476
+ .${o.INBOX_FILTER_CHIP}:hover {
477
+ border-color: rgba(255,255,255,0.4);
478
+ color: white;
397
479
  }
398
480
 
399
- .${n.INBOX_FILTER_OPTION},
400
- .${n.INBOX_MENU_ITEM} {
481
+ /* Selected chips are filled *and* carry aria-checked \u2014 the fill is a
482
+ convenience, never the only way to tell them apart. */
483
+ .${o.INBOX_FILTER_CHIP}[aria-checked="true"] {
484
+ background: rgba(255,255,255,0.92);
485
+ border-color: rgba(255,255,255,0.92);
486
+ color: #1C1C1E;
487
+ font-weight: 600;
488
+ }
489
+
490
+ .${o.INBOX_MENU_ITEM} {
401
491
  display: block;
402
492
  width: 100%;
403
493
  text-align: left;
@@ -410,14 +500,13 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
410
500
  cursor: pointer;
411
501
  }
412
502
 
413
- .${n.INBOX_FILTER_OPTION}:hover,
414
- .${n.INBOX_MENU_ITEM}:hover {
503
+ .${o.INBOX_MENU_ITEM}:hover {
415
504
  background: rgba(255,255,255,0.08);
416
505
  }
417
506
 
418
- .${n.INBOX_CLOSE},
419
- .${n.INBOX_NAV_BTN},
420
- .${n.INBOX_BACK} {
507
+ .${o.INBOX_CLOSE},
508
+ .${o.INBOX_NAV_BTN},
509
+ .${o.INBOX_BACK} {
421
510
  display: flex;
422
511
  align-items: center;
423
512
  gap: 4px;
@@ -430,34 +519,34 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
430
519
  font-size: 14px;
431
520
  }
432
521
 
433
- .${n.INBOX_CLOSE} {
522
+ .${o.INBOX_CLOSE} {
434
523
  font-size: 20px;
435
524
  line-height: 1;
436
525
  }
437
526
 
438
- .${n.INBOX_CLOSE}:hover,
439
- .${n.INBOX_NAV_BTN}:not(:disabled):hover,
440
- .${n.INBOX_BACK}:hover {
527
+ .${o.INBOX_CLOSE}:hover,
528
+ .${o.INBOX_NAV_BTN}:not(:disabled):hover,
529
+ .${o.INBOX_BACK}:hover {
441
530
  background: rgba(255,255,255,0.08);
442
531
  color: white;
443
532
  }
444
533
 
445
- .${n.INBOX_NAV_BTN}:disabled {
534
+ .${o.INBOX_NAV_BTN}:disabled {
446
535
  opacity: 0.35;
447
536
  cursor: default;
448
537
  }
449
538
 
450
- .${n.INBOX_LIST},
451
- .${n.INBOX_DETAIL} {
539
+ .${o.INBOX_LIST},
540
+ .${o.INBOX_DETAIL} {
452
541
  flex: 1;
453
- overflow-y: auto;
542
+ overflow-y: auto;${Q}
454
543
  padding: 12px;
455
544
  display: flex;
456
545
  flex-direction: column;
457
546
  gap: 12px;
458
547
  }
459
548
 
460
- .${n.INBOX_CARD} {
549
+ .${o.INBOX_CARD} {
461
550
  border: 1px solid rgba(255,255,255,0.1);
462
551
  border-radius: 10px;
463
552
  padding: 12px;
@@ -466,38 +555,43 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
466
555
  gap: 8px;
467
556
  }
468
557
 
469
- .${n.INBOX_LIST} .${n.INBOX_CARD} {
558
+ .${o.INBOX_LIST} .${o.INBOX_CARD} {
470
559
  cursor: pointer;
471
560
  }
472
561
 
473
- .${n.INBOX_LIST} .${n.INBOX_CARD}:hover {
562
+ .${o.INBOX_LIST} .${o.INBOX_CARD}:hover {
474
563
  border-color: rgba(255,255,255,0.22);
475
564
  }
476
565
 
477
- .${n.INBOX_CARD}--resolved {
566
+ .${o.INBOX_CARD}--resolved {
478
567
  border-color: rgba(48, 209, 88, 0.4);
479
568
  opacity: 0.75;
480
569
  }
481
570
 
482
- .${n.INBOX_LIST} .${n.INBOX_CARD}--resolved:hover {
571
+ .${o.INBOX_LIST} .${o.INBOX_CARD}--resolved:hover {
483
572
  border-color: rgba(48, 209, 88, 0.7);
484
573
  opacity: 1;
485
574
  }
486
575
 
487
- .${n.INBOX_CARD_HEADER} {
576
+ .${o.INBOX_CARD_HEADER} {
488
577
  display: flex;
489
578
  align-items: center;
490
579
  justify-content: space-between;
491
580
  gap: 8px;
492
581
  }
493
582
 
494
- .${n.INBOX_CARD_ACTIONS} {
583
+ /* Labels made the strip wide enough to overflow a narrow card in the
584
+ worst case ("In progress" + "Improvement" + "Medium"), so it wraps to
585
+ a second line rather than pushing the card sideways. */
586
+ .${o.INBOX_CARD_ACTIONS} {
495
587
  display: flex;
496
588
  align-items: center;
589
+ flex-wrap: wrap;
590
+ justify-content: flex-end;
497
591
  gap: 6px;
498
592
  }
499
593
 
500
- .${n.INBOX_ACTION_BTN} {
594
+ .${o.INBOX_ACTION_BTN} {
501
595
  display: flex;
502
596
  align-items: center;
503
597
  justify-content: center;
@@ -510,32 +604,30 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
510
604
  cursor: pointer;
511
605
  }
512
606
 
513
- .${n.INBOX_ACTION_BTN}:hover {
607
+ .${o.INBOX_ACTION_BTN}:hover {
514
608
  background: rgba(255,255,255,0.08);
515
609
  color: white;
516
610
  }
517
611
 
518
- /* Type/priority pickers show their current value as text next to the
519
- dot (colour alone can't tell bug/high apart \u2014 same hex, and there's
520
- no hover on touch). Grow from the square icon-button width but stay
521
- bounded so the strip doesn't crowd out copy/status/\u22EF next to it. */
522
- .${n.INBOX_ACTION_BTN_LABELED} {
612
+ /* Status/type/priority pickers show their current value as text next to
613
+ the dot (colour alone can't tell bug/high apart \u2014 same hex, and
614
+ there's no hover on touch). The 72px cap they used to carry is gone:
615
+ the strip has its own row now, so labels show in full. */
616
+ .${o.INBOX_ACTION_BTN_LABELED} {
523
617
  width: auto;
524
- max-width: 72px;
525
618
  padding: 0 8px 0 6px;
526
619
  gap: 5px;
527
620
  justify-content: flex-start;
621
+ flex: none;
528
622
  }
529
623
 
530
- .${n.INBOX_ACTION_LABEL} {
624
+ .${o.INBOX_ACTION_LABEL} {
531
625
  font-size: 11px;
532
626
  line-height: 1;
533
627
  white-space: nowrap;
534
- overflow: hidden;
535
- text-overflow: ellipsis;
536
628
  }
537
629
 
538
- .${n.INBOX_STATUS_DOT} {
630
+ .${o.INBOX_STATUS_DOT} {
539
631
  width: 12px;
540
632
  height: 12px;
541
633
  border-radius: 50%;
@@ -544,7 +636,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
544
636
  flex: none;
545
637
  }
546
638
 
547
- .${n.INBOX_MENU_ITEM} .${n.INBOX_STATUS_DOT} {
639
+ .${o.INBOX_MENU_ITEM} .${o.INBOX_STATUS_DOT} {
548
640
  width: 9px;
549
641
  height: 9px;
550
642
  border: none;
@@ -552,13 +644,21 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
552
644
  vertical-align: baseline;
553
645
  }
554
646
 
555
- .${n.INBOX_MENU_ITEM}[aria-checked="true"] {
647
+ .${o.INBOX_MENU_ITEM}[aria-checked="true"] {
556
648
  background: rgba(255,255,255,0.08);
557
649
  }
558
650
 
559
- .${n.THREAD_HEADER} .${n.INBOX_CARD_ACTIONS} {
560
- margin-left: auto;
561
- margin-right: 8px;
651
+ /* The action strip on its own row under the author. Shared by the inbox
652
+ card and the thread popover so the two read the same; only the
653
+ popover needs the extra top padding, since the card's column gap
654
+ already spaces it. */
655
+ .${o.THREAD_ACTIONS_ROW} {
656
+ display: flex;
657
+ justify-content: flex-end;
658
+ }
659
+
660
+ .${o.THREAD_POPOVER} > .${o.THREAD_ACTIONS_ROW} {
661
+ padding-top: 8px;
562
662
  }
563
663
 
564
664
  /* Generic hover tooltip, same look as .thread-time[data-full-date] */
@@ -588,7 +688,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
588
688
  opacity: 1;
589
689
  }
590
690
 
591
- .${n.INBOX_MENU} {
691
+ .${o.INBOX_MENU} {
592
692
  position: absolute;
593
693
  top: calc(100% + 4px);
594
694
  right: 0;
@@ -601,12 +701,12 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
601
701
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
602
702
  }
603
703
 
604
- .${n.INBOX_CARD_TEXT} {
704
+ .${o.INBOX_CARD_TEXT} {
605
705
  white-space: pre-wrap;
606
706
  word-break: break-word;
607
707
  }
608
708
 
609
- .${n.INBOX_CARD_TAG} {
709
+ .${o.INBOX_CARD_TAG} {
610
710
  align-self: flex-start;
611
711
  padding: 1px 8px;
612
712
  border-radius: 999px;
@@ -616,7 +716,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
616
716
  font-weight: 600;
617
717
  }
618
718
 
619
- .${n.INBOX_BADGES} {
719
+ .${o.INBOX_BADGES} {
620
720
  display: flex;
621
721
  flex-wrap: wrap;
622
722
  gap: 4px;
@@ -627,10 +727,13 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
627
727
  the tags input, and the classify row's own gap already spaces it
628
728
  from its siblings, so an extra margin here would nudge it out of
629
729
  alignment with them. */
630
- .${n.INBOX_CARD} .${n.INBOX_BADGES} {
730
+ .${o.INBOX_CARD} .${o.INBOX_BADGES} {
631
731
  margin-top: 6px;
632
732
  }
633
- .${n.BADGE} {
733
+ .${o.TOOLTIP} .${o.INBOX_BADGES} {
734
+ margin-bottom: 4px;
735
+ }
736
+ .${o.BADGE} {
634
737
  display: inline-flex;
635
738
  align-items: center;
636
739
  padding: 1px 6px;
@@ -641,36 +744,75 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
641
744
  letter-spacing: 0.01em;
642
745
  white-space: nowrap;
643
746
  }
644
- .${n.BADGE_TYPE},
645
- .${n.BADGE_PRIORITY} {
747
+ .${o.BADGE_STATUS},
748
+ .${o.BADGE_TYPE},
749
+ .${o.BADGE_PRIORITY} {
646
750
  font-weight: 600;
647
751
  }
648
- .${n.BADGE_TAG} {
752
+ .${o.BADGE_TAG} {
649
753
  opacity: 0.75;
650
754
  }
651
- .${n.BADGE_DURATION} {
755
+ .${o.BADGE_DURATION} {
652
756
  opacity: 0.75;
653
757
  border-style: dashed;
654
758
  }
655
759
 
656
- .${n.CONTEXT_BLOCK} {
760
+ .${o.CONTEXT_BLOCK} {
657
761
  display: flex;
658
762
  flex-direction: column;
659
- gap: 4px;
660
763
  padding: 10px 12px;
661
764
  border-top: 1px solid rgba(255, 255, 255, 0.08);
662
765
  font-size: 11px;
663
766
  }
664
- .${n.CONTEXT_BLOCK} img {
767
+ .${o.CONTEXT_BODY} {
768
+ display: flex;
769
+ flex-direction: column;
770
+ gap: 4px;
771
+ }
772
+ .${o.CONTEXT_TITLE} {
773
+ font-size: 11px;
774
+ font-weight: 600;
775
+ color: rgba(255,255,255,0.45);
776
+ padding-bottom: 4px;
777
+ }
778
+ /* The popover's collapsed variant. Same weight and colour as the inbox
779
+ title so the two surfaces read as the same block. */
780
+ .${o.CONTEXT_TOGGLE} {
781
+ display: flex;
782
+ align-items: center;
783
+ justify-content: space-between;
784
+ width: 100%;
785
+ background: transparent;
786
+ border: none;
787
+ color: rgba(255,255,255,0.45);
788
+ font-size: 11px;
789
+ font-weight: 600;
790
+ cursor: pointer;
791
+ padding: 2px 0;
792
+ }
793
+ .${o.CONTEXT_TOGGLE}:hover {
794
+ color: rgba(255,255,255,0.75);
795
+ }
796
+ .${o.CONTEXT_TOGGLE} svg {
797
+ flex: none;
798
+ transition: transform 0.15s ease;
799
+ }
800
+ .${o.CONTEXT_TOGGLE}[aria-expanded="true"] svg {
801
+ transform: rotate(180deg);
802
+ }
803
+ .${o.CONTEXT_TOGGLE}[aria-expanded="true"] + .${o.CONTEXT_BODY} {
804
+ padding-top: 8px;
805
+ }
806
+ .${o.CONTEXT_BLOCK} img {
665
807
  width: 100%;
666
808
  border-radius: 6px;
667
809
  margin-bottom: 6px;
668
810
  cursor: zoom-in;
669
811
  }
670
- .${n.CONTEXT_SCREENSHOT_CAPTION} {
812
+ .${o.CONTEXT_SCREENSHOT_CAPTION} {
671
813
  opacity: 0.75;
672
814
  }
673
- .${n.CONTEXT_ROW} {
815
+ .${o.CONTEXT_ROW} {
674
816
  display: flex;
675
817
  justify-content: space-between;
676
818
  gap: 12px;
@@ -678,12 +820,12 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
678
820
  }
679
821
  /* URLs and user agents have no spaces to break on, so the value column
680
822
  would otherwise push the row wider than the panel. */
681
- .${n.CONTEXT_ROW} span:last-child {
823
+ .${o.CONTEXT_ROW} span:last-child {
682
824
  text-align: right;
683
825
  word-break: break-all;
684
826
  }
685
827
 
686
- .${n.INBOX_CARD_REPLY_LINK} {
828
+ .${o.INBOX_CARD_REPLY_LINK} {
687
829
  align-self: flex-start;
688
830
  background: transparent;
689
831
  border: none;
@@ -693,49 +835,128 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
693
835
  padding: 0;
694
836
  }
695
837
 
696
- .${n.INBOX_CARD_REPLY_LINK}:hover {
838
+ .${o.INBOX_CARD_REPLY_LINK}:hover {
697
839
  color: white;
698
840
  }
699
841
 
700
- .${n.INBOX_REPLIES} {
842
+ .${o.INBOX_REPLIES} {
701
843
  display: flex;
702
844
  flex-direction: column;
703
845
  gap: 10px;
704
846
  padding: 0 4px;
705
847
  }
706
848
 
707
- .${n.INBOX_EMPTY} {
708
- padding: 24px 12px;
849
+ /* Centred in whatever height the list has, so the state sits in the
850
+ middle of the panel rather than clinging to the top. */
851
+ /* Sits under the body as a quiet aside: the preview shows the root
852
+ comment only, so this says "there is more" without competing with it. */
853
+ .${o.TOOLTIP_REPLY_COUNT} {
854
+ font-size: 12px;
855
+ color: rgba(255,255,255,0.45);
856
+ padding-top: 4px;
857
+ }
858
+
859
+ .${o.INBOX_EMPTY} {
860
+ flex: 1;
861
+ display: flex;
862
+ flex-direction: column;
863
+ align-items: center;
864
+ justify-content: center;
865
+ gap: 10px;
866
+ padding: 32px 24px;
709
867
  color: rgba(255,255,255,0.55);
710
868
  text-align: center;
711
869
  }
712
870
 
713
- .${n.THREAD_HEADER} {
871
+ /* The marker's own silhouette, drawn as an outline: what the user is
872
+ about to place, not a generic placeholder. Same border-radius as
873
+ .comment-circle. */
874
+ .${o.INBOX_EMPTY_ICON} {
875
+ width: 44px;
876
+ height: 44px;
877
+ margin-bottom: 6px;
878
+ border: 2px dashed rgba(255,255,255,0.25);
879
+ border-radius: 0% 100% 100% 100%;
880
+ flex: none;
881
+ }
882
+
883
+ .${o.INBOX_EMPTY_TITLE} {
884
+ color: white;
885
+ font-size: 14px;
886
+ font-weight: 600;
887
+ }
888
+
889
+ .${o.INBOX_EMPTY_TEXT} {
890
+ font-size: 13px;
891
+ line-height: 1.5;
892
+ max-width: 30ch;
893
+ }
894
+
895
+ .${o.INBOX_EMPTY_KBD} {
896
+ font-family: inherit;
897
+ font-size: 12px;
898
+ font-weight: 500;
899
+ color: rgba(255,255,255,0.8);
900
+ background: rgba(255,255,255,0.08);
901
+ border: 1px solid rgba(255,255,255,0.14);
902
+ border-radius: 5px;
903
+ padding: 1px 5px;
904
+ white-space: nowrap;
905
+ }
906
+
907
+ .${o.INBOX_EMPTY_ACTION} {
908
+ margin-top: 6px;
909
+ background: transparent;
910
+ border: 1px solid rgba(255,255,255,0.2);
911
+ border-radius: 8px;
912
+ color: white;
913
+ font-size: 13px;
914
+ font-weight: 500;
915
+ padding: 8px 16px;
916
+ cursor: pointer;
917
+ transition: background 0.15s, border-color 0.15s;
918
+ }
919
+
920
+ .${o.INBOX_EMPTY_ACTION}:hover {
921
+ background: rgba(255,255,255,0.08);
922
+ border-color: rgba(255,255,255,0.35);
923
+ }
924
+
925
+ .${o.THREAD_HEADER} {
714
926
  display: flex;
715
927
  justify-content: space-between;
716
928
  align-items: center;
717
929
  padding: 0 0 0;
718
930
  }
719
931
 
720
- .${n.THREAD_META} {
932
+ /* min-width:0 is what lets the author actually shrink: a flex item
933
+ defaults to min-content, so without it the name pushes the row wider
934
+ instead of truncating. */
935
+ .${o.THREAD_META} {
721
936
  display: flex;
722
937
  align-items: center;
723
938
  gap: 6px;
939
+ flex: 1;
940
+ min-width: 0;
724
941
  }
725
942
 
726
- .${n.THREAD_AUTHOR} {
943
+ .${o.THREAD_AUTHOR} {
727
944
  font-weight: 600;
728
945
  font-size: 13px;
946
+ overflow: hidden;
947
+ text-overflow: ellipsis;
948
+ white-space: nowrap;
729
949
  }
730
950
 
731
- .${n.THREAD_TIME} {
951
+ .${o.THREAD_TIME} {
732
952
  font-size: 12px;
733
953
  color: rgba(255,255,255,0.5);
734
954
  cursor: default;
735
955
  position: relative;
956
+ flex: none;
736
957
  }
737
958
 
738
- .${n.THREAD_TIME}::after {
959
+ .${o.THREAD_TIME}::after {
739
960
  content: attr(data-full-date);
740
961
  position: absolute;
741
962
  bottom: calc(100% + 6px);
@@ -753,25 +974,25 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
753
974
  z-index: 1;
754
975
  }
755
976
 
756
- .${n.THREAD_TIME}:hover::after {
977
+ .${o.THREAD_TIME}:hover::after {
757
978
  opacity: 1;
758
979
  }
759
980
 
760
- .${n.THREAD_BODY} {
981
+ .${o.THREAD_BODY} {
761
982
  padding: 8px 0;
762
983
  white-space: pre-wrap;
763
984
  word-break: break-word;
764
985
  }
765
986
 
766
- .${n.THREAD_REPLIES} {
987
+ .${o.THREAD_REPLIES} {
767
988
  padding: 0;
768
989
  }
769
990
 
770
- .${n.THREAD_REPLIES}:empty {
991
+ .${o.THREAD_REPLIES}:empty {
771
992
  display: none;
772
993
  }
773
994
 
774
- .${n.THREAD_REPLY} {
995
+ .${o.THREAD_REPLY} {
775
996
  padding: 16px 0 0 0;
776
997
  border-top: 1px solid rgba(255,255,255,0.1);
777
998
  white-space: pre-wrap;
@@ -780,11 +1001,19 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
780
1001
  color: rgba(255,255,255,0.85);
781
1002
  }
782
1003
 
783
- .${n.THREAD_REPLY} .${n.THREAD_META} {
1004
+ .${o.THREAD_REPLY} .${o.THREAD_META} {
784
1005
  margin-bottom: 2px;
785
1006
  }
786
1007
 
787
- .${n.THREAD_REPLY} .${n.SCREENSHOT_IMG} {
1008
+ /* Pushed to the far edge of the reply's meta row, where the same \u22EF sits
1009
+ on the comment above it. flex: none keeps it off the author's
1010
+ truncation budget. */
1011
+ .${o.THREAD_REPLY_ACTIONS} {
1012
+ margin-left: auto;
1013
+ flex: none;
1014
+ }
1015
+
1016
+ .${o.THREAD_REPLY} .${o.SCREENSHOT_IMG} {
788
1017
  width: 144px;
789
1018
  height: 100px;
790
1019
  object-fit: cover;
@@ -794,7 +1023,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
794
1023
  display: block;
795
1024
  }
796
1025
 
797
- .${n.THREAD_INPUT_AREA} {
1026
+ .${o.THREAD_INPUT_AREA} {
798
1027
  display: flex;
799
1028
  flex-direction: column;
800
1029
  gap: 0;
@@ -802,7 +1031,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
802
1031
  border-top: 1px solid rgba(255,255,255,0.1);
803
1032
  }
804
1033
 
805
- .${n.THREAD_INPUT} {
1034
+ .${o.THREAD_INPUT} {
806
1035
  width: 100%;
807
1036
  background: transparent;
808
1037
  border: none;
@@ -814,16 +1043,16 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
814
1043
  box-sizing: border-box;
815
1044
  }
816
1045
 
817
- .${n.THREAD_INPUT}::placeholder {
1046
+ .${o.THREAD_INPUT}::placeholder {
818
1047
  color: rgba(255,255,255,0.5);
819
1048
  }
820
1049
 
821
- .${n.THREAD_INPUT}:focus {
1050
+ .${o.THREAD_INPUT}:focus {
822
1051
  outline: none;
823
1052
  box-shadow: none;
824
1053
  }
825
1054
 
826
- .${n.THREAD_SUBMIT} {
1055
+ .${o.THREAD_SUBMIT} {
827
1056
  background: none;
828
1057
  border: none;
829
1058
  color: #2E90FA;
@@ -835,12 +1064,12 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
835
1064
  transition: background 0.2s;
836
1065
  }
837
1066
 
838
- .${n.THREAD_SUBMIT}:hover {
1067
+ .${o.THREAD_SUBMIT}:hover {
839
1068
  background: rgba(46, 144, 250, 0.15);
840
1069
  color: #1570D6;
841
1070
  }
842
1071
 
843
- .${n.CLOSE_TOOLTIP} {
1072
+ .${o.CLOSE_TOOLTIP} {
844
1073
  background: none;
845
1074
  border: none;
846
1075
  font-size: 18px;
@@ -849,11 +1078,11 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
849
1078
  line-height: 1;
850
1079
  }
851
1080
 
852
- .${n.CLOSE_TOOLTIP}:hover {
1081
+ .${o.CLOSE_TOOLTIP}:hover {
853
1082
  color: white;
854
1083
  }
855
1084
 
856
- .${n.PREVIEW_CIRCLE} {
1085
+ .${o.PREVIEW_CIRCLE} {
857
1086
  animation: helldots-pulse 1.5s ease-in-out infinite;
858
1087
  }
859
1088
 
@@ -862,7 +1091,7 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
862
1091
  50% { box-shadow: 0 0 0 8px rgba(46, 144, 250, 0), 0 1px 5px rgba(0,0,0,0.2); }
863
1092
  }
864
1093
 
865
- .${n.COMMENT_OVERLAY} {
1094
+ .${o.COMMENT_OVERLAY} {
866
1095
  position: fixed;
867
1096
  top: 0;
868
1097
  left: 0;
@@ -870,24 +1099,24 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
870
1099
  bottom: 0;
871
1100
  background: transparent;
872
1101
  pointer-events: none;
873
- z-index: ${x.TOOLBAR-1};
1102
+ z-index: ${O.TOOLBAR-1};
874
1103
  }
875
1104
 
876
- .${n.COMMENT_OVERLAY}.${n.ACTIVE} {
1105
+ .${o.COMMENT_OVERLAY}.${o.ACTIVE} {
877
1106
  pointer-events: auto;
878
1107
  background: rgba(0, 0, 0, 0.1);
879
1108
  }
880
1109
 
881
- .${n.SELECTION_RECT} {
1110
+ .${o.SELECTION_RECT} {
882
1111
  position: fixed;
883
1112
  border: 2px solid #2E90FA;
884
1113
  background: rgba(46, 144, 250, 0.1);
885
1114
  pointer-events: none;
886
- z-index: ${x.TOOLTIP};
1115
+ z-index: ${O.TOOLTIP};
887
1116
  box-sizing: border-box;
888
1117
  }
889
1118
 
890
- .${n.SCREENSHOTS_CONTAINER} {
1119
+ .${o.SCREENSHOTS_CONTAINER} {
891
1120
  display: none;
892
1121
  overflow-x: auto;
893
1122
  gap: 8px;
@@ -895,23 +1124,23 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
895
1124
  padding: 4px 0;
896
1125
  scrollbar-width: none;
897
1126
  -ms-overflow-style: none;
898
- margin-bottom: 16px;
1127
+ margin-bottom: 8px;
899
1128
  }
900
1129
 
901
- .${n.SCREENSHOTS_CONTAINER}::-webkit-scrollbar {
1130
+ .${o.SCREENSHOTS_CONTAINER}::-webkit-scrollbar {
902
1131
  display: none;
903
1132
  }
904
1133
 
905
- .${n.SCREENSHOTS_CONTAINER}.${n.ACTIVE} {
1134
+ .${o.SCREENSHOTS_CONTAINER}.${o.ACTIVE} {
906
1135
  display: flex;
907
1136
  }
908
1137
 
909
- .${n.SCREENSHOT_ITEM} {
1138
+ .${o.SCREENSHOT_ITEM} {
910
1139
  position: relative;
911
1140
  flex-shrink: 0;
912
1141
  }
913
1142
 
914
- .${n.SCREENSHOT_ITEM} .${n.SCREENSHOT_IMG} {
1143
+ .${o.SCREENSHOT_ITEM} .${o.SCREENSHOT_IMG} {
915
1144
  width: 50px;
916
1145
  height: 50px;
917
1146
  object-fit: cover;
@@ -921,11 +1150,11 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
921
1150
  margin: 0;
922
1151
  }
923
1152
 
924
- .${n.SCREENSHOT_ITEM} .${n.SCREENSHOT_IMG}:hover {
1153
+ .${o.SCREENSHOT_ITEM} .${o.SCREENSHOT_IMG}:hover {
925
1154
  opacity: 0.85;
926
1155
  }
927
1156
 
928
- .${n.SCREENSHOT_ITEM} .${n.SCREENSHOT_REMOVE} {
1157
+ .${o.SCREENSHOT_ITEM} .${o.SCREENSHOT_REMOVE} {
929
1158
  position: absolute;
930
1159
  top: -5px;
931
1160
  right: -5px;
@@ -944,29 +1173,116 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
944
1173
  z-index: 1;
945
1174
  }
946
1175
 
947
- .${n.SCREENSHOT_ITEM}:hover .${n.SCREENSHOT_REMOVE} {
1176
+ .${o.SCREENSHOT_ITEM}:hover .${o.SCREENSHOT_REMOVE} {
948
1177
  display: flex;
949
1178
  }
950
1179
 
951
- .${n.SCREENSHOT_ITEM} .${n.SCREENSHOT_REMOVE}:hover {
1180
+ .${o.SCREENSHOT_ITEM} .${o.SCREENSHOT_REMOVE}:hover {
952
1181
  background: rgba(0,0,0,0.9);
953
1182
  }
954
1183
 
955
- .${n.TOOLTIP} > .${n.SCREENSHOTS_CONTAINER} .${n.SCREENSHOT_ITEM} .${n.SCREENSHOT_IMG},
956
- .${n.THREAD_POPOVER} > .${n.SCREENSHOTS_CONTAINER} .${n.SCREENSHOT_ITEM} .${n.SCREENSHOT_IMG},
957
- .${n.THREAD_REPLY} .${n.SCREENSHOT_ITEM} .${n.SCREENSHOT_IMG} {
1184
+ .${o.TOOLTIP} > .${o.SCREENSHOTS_CONTAINER} .${o.SCREENSHOT_ITEM} .${o.SCREENSHOT_IMG},
1185
+ .${o.THREAD_SCROLL} > .${o.SCREENSHOTS_CONTAINER} .${o.SCREENSHOT_ITEM} .${o.SCREENSHOT_IMG},
1186
+ .${o.THREAD_REPLY} .${o.SCREENSHOT_ITEM} .${o.SCREENSHOT_IMG} {
958
1187
  width: 144px;
959
1188
  height: 100px;
960
1189
  }
961
1190
 
962
- .${n.LIGHTBOX} {
1191
+ .${o.CONFIRM} {
1192
+ position: fixed;
1193
+ top: 0;
1194
+ left: 0;
1195
+ right: 0;
1196
+ bottom: 0;
1197
+ background: rgba(0,0,0,0.6);
1198
+ display: flex;
1199
+ align-items: center;
1200
+ justify-content: center;
1201
+ padding: 16px;
1202
+ animation: helldots-fade-in 0.15s ease;
1203
+ }
1204
+
1205
+ .${o.CONFIRM_PANEL} {
1206
+ width: min(360px, 100%);
1207
+ background: #1C1C1E;
1208
+ border: 1px solid rgba(255,255,255,0.1);
1209
+ border-radius: 14px;
1210
+ box-shadow: 0 8px 32px rgba(0,0,0,0.5);
1211
+ padding: 20px;
1212
+ color: white;
1213
+ font-size: 14px;
1214
+ line-height: 1.5;
1215
+ box-sizing: border-box;
1216
+ }
1217
+
1218
+ /* :host { all: initial } does not reach descendants, so the heading and
1219
+ paragraph still arrive with UA margins. */
1220
+ .${o.CONFIRM_TITLE} {
1221
+ margin: 0 0 8px;
1222
+ font-size: 15px;
1223
+ font-weight: 600;
1224
+ }
1225
+
1226
+ .${o.CONFIRM_MESSAGE} {
1227
+ margin: 0 0 20px;
1228
+ font-size: 13px;
1229
+ color: rgba(255,255,255,0.65);
1230
+ }
1231
+
1232
+ .${o.CONFIRM_ACTIONS} {
1233
+ display: flex;
1234
+ justify-content: flex-end;
1235
+ gap: 8px;
1236
+ }
1237
+
1238
+ .${o.CONFIRM_CANCEL},
1239
+ .${o.CONFIRM_ACCEPT} {
1240
+ padding: 7px 14px;
1241
+ border: 1px solid transparent;
1242
+ border-radius: 8px;
1243
+ font-size: 13px;
1244
+ font-weight: 600;
1245
+ cursor: pointer;
1246
+ }
1247
+
1248
+ /* The one place in the widget with visible focus rings. The dialog traps
1249
+ Tab between exactly two buttons, one of them destructive, so a
1250
+ keyboard user who cannot see which one is focused is being asked to
1251
+ guess. Scoped here on purpose \u2014 see DECISIONS.md; it does not reopen
1252
+ the rings that were reverted elsewhere for visual parity. */
1253
+ .${o.CONFIRM_CANCEL}:focus-visible,
1254
+ .${o.CONFIRM_ACCEPT}:focus-visible {
1255
+ outline: 2px solid #2E90FA;
1256
+ outline-offset: 2px;
1257
+ }
1258
+
1259
+ .${o.CONFIRM_CANCEL} {
1260
+ background: rgba(255,255,255,0.08);
1261
+ border-color: rgba(255,255,255,0.12);
1262
+ color: white;
1263
+ }
1264
+
1265
+ .${o.CONFIRM_CANCEL}:hover {
1266
+ background: rgba(255,255,255,0.14);
1267
+ }
1268
+
1269
+ .${o.CONFIRM_ACCEPT} {
1270
+ background: #FF453A;
1271
+ color: white;
1272
+ }
1273
+
1274
+ .${o.CONFIRM_ACCEPT}:hover {
1275
+ background: #FF6961;
1276
+ }
1277
+
1278
+ .${o.LIGHTBOX} {
963
1279
  position: fixed;
964
1280
  top: 0;
965
1281
  left: 0;
966
1282
  right: 0;
967
1283
  bottom: 0;
968
1284
  background: rgba(0,0,0,0.92);
969
- z-index: ${x.LIGHTBOX};
1285
+ z-index: ${O.LIGHTBOX};
970
1286
  display: flex;
971
1287
  align-items: center;
972
1288
  justify-content: center;
@@ -978,14 +1294,14 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
978
1294
  to { opacity: 1; }
979
1295
  }
980
1296
 
981
- .${n.LIGHTBOX_IMG} {
1297
+ .${o.LIGHTBOX_IMG} {
982
1298
  max-width: 90vw;
983
1299
  max-height: 90vh;
984
1300
  object-fit: contain;
985
1301
  border-radius: 8px;
986
1302
  }
987
1303
 
988
- .${n.LIGHTBOX_CLOSE} {
1304
+ .${o.LIGHTBOX_CLOSE} {
989
1305
  position: absolute;
990
1306
  top: 16px;
991
1307
  right: 16px;
@@ -1003,17 +1319,137 @@ import{domToCanvas as $e}from"modern-screenshot";var A="helldots-root",Pe=()=>{c
1003
1319
  transition: background 0.2s;
1004
1320
  }
1005
1321
 
1006
- .${n.LIGHTBOX_CLOSE}:hover {
1322
+ .${o.LIGHTBOX_CLOSE}:hover {
1007
1323
  background: rgba(255,255,255,0.3);
1008
1324
  }
1009
- `,me=()=>`
1010
- .${n.COMMENT_CURSOR},
1011
- .${n.COMMENT_CURSOR} * {
1012
- cursor: url('${pe}') 6 6, auto !important;
1325
+ /* --- inline editor --- */
1326
+
1327
+ .${o.EDITOR} {
1328
+ display: flex;
1329
+ flex-direction: column;
1330
+ gap: 8px;
1331
+ margin: 4px 0 2px;
1332
+ }
1333
+
1334
+ .${o.EDITOR_INPUT} {
1335
+ width: 100%;
1336
+ box-sizing: border-box;
1337
+ resize: vertical;
1338
+ min-height: 60px;
1339
+ background: rgba(255,255,255,0.06);
1340
+ border: 1px solid rgba(255,255,255,0.14);
1341
+ border-radius: 8px;
1342
+ padding: 8px 10px;
1343
+ color: white;
1344
+ font-size: 14px;
1345
+ font-family: inherit;
1346
+ line-height: 1.45;
1347
+ outline: none;${Q}
1348
+ }
1349
+
1350
+ .${o.EDITOR_INPUT}:focus {
1351
+ border-color: rgba(46,144,250,0.7);
1352
+ }
1353
+
1354
+ .${o.EDITOR_ACTIONS} {
1355
+ display: flex;
1356
+ justify-content: flex-end;
1357
+ gap: 8px;
1358
+ }
1359
+
1360
+ .${o.EDITOR_CANCEL},
1361
+ .${o.EDITOR_SAVE} {
1362
+ padding: 5px 12px;
1363
+ border: 1px solid transparent;
1364
+ border-radius: 7px;
1365
+ font-size: 13px;
1366
+ font-weight: 600;
1367
+ font-family: inherit;
1368
+ cursor: pointer;
1369
+ }
1370
+
1371
+ .${o.EDITOR_CANCEL} {
1372
+ background: rgba(255,255,255,0.08);
1373
+ border-color: rgba(255,255,255,0.12);
1374
+ color: white;
1375
+ }
1376
+
1377
+ .${o.EDITOR_CANCEL}:hover {
1378
+ background: rgba(255,255,255,0.14);
1379
+ }
1380
+
1381
+ .${o.EDITOR_SAVE} {
1382
+ background: #2E90FA;
1383
+ color: white;
1384
+ }
1385
+
1386
+ .${o.EDITOR_SAVE}:hover:not(:disabled) {
1387
+ background: #57A6FB;
1388
+ }
1389
+
1390
+ /* Blanking a body is not a way to delete \u2014 the comment would keep its
1391
+ marker, its replies and its inbox row while saying nothing. The
1392
+ disabled state is carried by more than colour: the cursor changes and
1393
+ the control stops responding (WCAG 1.4.1). */
1394
+ .${o.EDITOR_SAVE}:disabled {
1395
+ background: rgba(255,255,255,0.10);
1396
+ color: rgba(255,255,255,0.4);
1397
+ cursor: not-allowed;
1398
+ }
1399
+
1400
+ .${o.THREAD_EDITED} {
1401
+ font-size: 12px;
1402
+ color: rgba(255,255,255,0.4);
1403
+ cursor: default;
1404
+ position: relative;
1405
+ flex: none;
1406
+ }
1407
+
1408
+ .${o.THREAD_EDITED}::before {
1409
+ content: "\xB7";
1410
+ margin-right: 4px;
1411
+ }
1412
+
1413
+ .${o.THREAD_EDITED}::after {
1414
+ content: attr(data-full-date);
1415
+ position: absolute;
1416
+ bottom: calc(100% + 6px);
1417
+ left: 50%;
1418
+ transform: translateX(-50%);
1419
+ background: #000;
1420
+ color: white;
1421
+ padding: 4px 8px;
1422
+ border-radius: 6px;
1423
+ font-size: 11px;
1424
+ white-space: nowrap;
1425
+ opacity: 0;
1426
+ pointer-events: none;
1427
+ transition: opacity 0.15s ease;
1428
+ }
1429
+
1430
+ .${o.THREAD_EDITED}:hover::after {
1431
+ opacity: 1;
1432
+ }
1433
+
1434
+ .${o.INBOX_NOTICE} {
1435
+ margin: 0 0 10px;
1436
+ padding: 9px 11px;
1437
+ border-radius: 8px;
1438
+ background: rgba(255,255,255,0.06);
1439
+ border: 1px solid rgba(255,255,255,0.12);
1440
+ color: rgba(255,255,255,0.75);
1441
+ font-size: 13px;
1442
+ line-height: 1.4;
1013
1443
  }
1014
- `;var v={commentAriaLabelPrefix:"Comment: ",anonymous:"Anonymous",justNow:"Just now",minutesAgoTemplate:"{n}m",hoursAgoTemplate:"{n}h",daysAgoTemplate:"{n}d",toolbarComment:"Comment",toolbarInbox:"Inbox",modifierAlt:"Alt",modifierCtrl:"Ctrl",commentBoxAriaLabel:"New comment",commentPlaceholder:"Type your comment...",attachImage:"Attach image",send:"Send",tooltipAriaLabel:"Comment preview",close:"Close",popoverAriaLabel:"Comment thread",replyPlaceholder:"Reply...",attachedScreenshot:"Attached screenshot",screenshotPreview:"Screenshot preview",removeScreenshot:"Remove screenshot",inboxAriaLabel:"Comments inbox",inboxEmpty:"No comments yet",orphanedBadge:"Unanchored",hiddenBadge:"Hidden",filterAll:"All comments",filterCurrentPage:"Current page",filterByPage:"Filter by Page",filterByStatus:"Filter by Status",filterStatusAll:"All",filterUnresolved:"Unresolved",filterResolved:"Resolved",back:"Back",deleteComment:"Delete",copyAgentContext:"Copy agent context",copied:"Copied",statusLabel:"Status",prevComment:"Previous comment",nextComment:"Next comment",replyLink:"Reply",commentOptions:"Comment options",moreOptions:"More",statusOpen:"Open",statusInProgress:"In progress",statusResolved:"Resolved",durationLessThanMinute:"<1m",resolvedInTemplate:"Resolved in {n}",typeLabel:"Type",priorityLabel:"Priority",unset:"Unset",typeBug:"Bug",typeSuggestion:"Suggestion",typeQuestion:"Question",typeImprovement:"Improvement",priorityHigh:"High",priorityMedium:"Medium",priorityLow:"Low",tagsPlaceholder:"Add tags...",removeTag:"Remove tag",filterByType:"Filter by Type",filterByPriority:"Filter by Priority",contextSection:"Context",autoScreenshotLabel:"Automatic context",contextUrl:"URL",contextViewport:"Viewport",contextScreen:"Screen",contextBrowser:"Browser",contextOs:"OS"};var ge={commentAriaLabelPrefix:"Comentario: ",anonymous:"An\xF3nimo",justNow:"Justo ahora",minutesAgoTemplate:"{n}m",hoursAgoTemplate:"{n}h",daysAgoTemplate:"{n}d",toolbarComment:"Comentar",toolbarInbox:"Bandeja",modifierAlt:"Alt",modifierCtrl:"Ctrl",commentBoxAriaLabel:"Nuevo comentario",commentPlaceholder:"Escribe tu comentario...",attachImage:"Adjuntar imagen",send:"Enviar",tooltipAriaLabel:"Vista previa del comentario",close:"Cerrar",popoverAriaLabel:"Hilo de comentarios",replyPlaceholder:"Responder...",attachedScreenshot:"Captura de pantalla adjunta",screenshotPreview:"Vista previa de la captura",removeScreenshot:"Quitar captura de pantalla",inboxAriaLabel:"Bandeja de comentarios",inboxEmpty:"A\xFAn no hay comentarios",orphanedBadge:"Desanclado",hiddenBadge:"Oculto",filterAll:"Todos los comentarios",filterCurrentPage:"P\xE1gina actual",filterByPage:"Filtrar por p\xE1gina",filterByStatus:"Filtrar por estado",filterStatusAll:"Todos",filterUnresolved:"Sin resolver",filterResolved:"Resueltos",back:"Volver",deleteComment:"Eliminar",copyAgentContext:"Copiar contexto de agente",copied:"Copiado",statusLabel:"Estado",prevComment:"Comentario anterior",nextComment:"Comentario siguiente",replyLink:"Responder",commentOptions:"Opciones del comentario",moreOptions:"M\xE1s",statusOpen:"Abierto",statusInProgress:"En progreso",statusResolved:"Resuelto",durationLessThanMinute:"<1m",resolvedInTemplate:"Resuelto en {n}",typeLabel:"Tipo",priorityLabel:"Prioridad",unset:"Sin definir",typeBug:"Bug",typeSuggestion:"Sugerencia",typeQuestion:"Pregunta",typeImprovement:"Mejora",priorityHigh:"Alta",priorityMedium:"Media",priorityLow:"Baja",tagsPlaceholder:"A\xF1adir etiquetas...",removeTag:"Quitar etiqueta",filterByType:"Filtrar por tipo",filterByPriority:"Filtrar por prioridad",contextSection:"Contexto",autoScreenshotLabel:"Contexto autom\xE1tico",contextUrl:"URL",contextViewport:"Viewport",contextScreen:"Pantalla",contextBrowser:"Navegador",contextOs:"SO"};var Q={en:v,es:ge},J="en";function Ee(){let r=(navigator.language||J).slice(0,2).toLowerCase();return r in Q?r:J}function fe(r){return Q[r]||Q[J]}function _(r,e){return r.replace("{n}",String(e))}var Ge=6e4;function X(r,e){if(!Number.isFinite(r)||r<0)return"";let t=Math.floor(r/Ge);if(t<1)return e.durationLessThanMinute;if(t<60)return _(e.minutesAgoTemplate,t);let o=Math.floor(t/60);if(o<24){let l=t%60,c=_(e.hoursAgoTemplate,o);return l?`${c} ${_(e.minutesAgoTemplate,l)}`:c}let i=Math.floor(o/24),s=o%24,a=_(e.daysAgoTemplate,i);return s?`${a} ${_(e.hoursAgoTemplate,s)}`:a}var Ve=/^(css|sc|jsx|emotion)-/i,ze=/^data-(reactid|react-|v-|svelte-)/,Ye=["id","name","role","aria-label"],je=["data-testid","name","aria-label"],ee=r=>typeof CSS<"u"&&CSS.escape?CSS.escape(r):String(r).replace(/[^a-zA-Z0-9_-]/g,"\\$&"),We=r=>String(r).replace(/["\\]/g,"\\$&"),P=(r,e)=>{try{return e.querySelectorAll(r).length===1}catch{return!1}},Ce=r=>(r||"").replace(/\s+/g," ").trim().slice(0,64),qe=r=>Ve.test(r)?!1:!r.split(/[-_]/).some(e=>e.length>=5&&/\d/.test(e)),Ke=r=>[...r.classList].filter(qe),Ze=r=>{let e={};for(let{name:t,value:o}of r.attributes)(Ye.includes(t)||t.startsWith("data-")&&!ze.test(t))&&o&&(e[t]=o.slice(0,64));return e},te=r=>{let e=r.parentElement;if(!e)return{index:0,count:1};let t=[...e.children].filter(o=>o.tagName===r.tagName);return{index:t.indexOf(r),count:t.length}},Qe=(r,e)=>{if(!r.id)return null;let t=`#${ee(r.id)}`;return P(t,e)?t:null},Je=(r,e)=>{let t=r.tagName.toLowerCase();for(let o of je){let i=r.getAttribute(o);if(!i)continue;let s=`${t}[${o}="${We(i)}"]`;if(P(s,e))return s}return null},et=(r,e)=>{let t=[],o=r;for(let i=0;i<3&&o;i++){let s=Ke(o),a=o.tagName.toLowerCase();if(t.unshift(s.length?`${a}.${s.map(ee).join(".")}`:a),i===0&&!s.length)return null;let l=t.join(" > ");if(P(l,e))return l;o=o.parentElement}return null},tt=(r,e)=>{if(r===e.body)return"body";let t=[],o=r;for(let s=0;s<5&&o;s++){if(o===e.body){t.unshift("body");break}if(o.id){let l=[`#${ee(o.id)}`,...t].join(" > ");if(P(l,e))return l}let{index:a}=te(o);t.unshift(`${o.tagName.toLowerCase()}:nth-of-type(${a+1})`),o=o.parentElement}let i=t.join(" > ");return P(i,e)?i:null},xe=(r,e)=>Qe(r,e)||Je(r,e)||et(r,e)||tt(r,e);function _e(r){return xe(r,r.ownerDocument)}function Oe(r,e,t){let o=r.ownerDocument,{index:i,count:s}=te(r);return{version:1,selector:xe(r,o),fingerprint:{tagName:r.tagName,textSnippet:Ce(r.textContent),attributes:Ze(r),siblingIndex:i,siblingCount:s},relativeX:e,relativeY:t}}var ot=(r,e)=>{if(!r&&!e)return 1;if(!r||!e)return 0;if(r===e)return 1;if(r.startsWith(e)||e.startsWith(r))return .8;let t=new Set(r.split(" ")),o=new Set(e.split(" ")),i=0;for(let s of t)o.has(s)&&i++;return 2*i/(t.size+o.size)},nt=(r,e)=>{let t=Object.keys(e);if(!t.length)return 1;let o=0;for(let i of t)(r.getAttribute(i)||"").slice(0,64)===e[i]&&o++;return o/t.length},be=(r,e)=>{let{index:t,count:o}=te(r),i=Math.abs(t-e.siblingIndex),s=Math.max(e.siblingCount,o,1);return Math.max(0,1-i/s)},it=(r,e)=>{if(r.tagName!==e.tagName)return 0;let t=!!e.textSnippet,o=Object.keys(e.attributes||{}).length>0,i=.5,s=.3,a=.2;return o?t||(s+=i,i=0):(i+=s,s=0),!t&&!o?be(r,e):i*ot(Ce(r.textContent),e.textSnippet)+s*nt(r,e.attributes||{})+a*be(r,e)},Te=(r,e)=>{let t=null;for(let o of r){let i=it(o,e);(!t||i>t.confidence)&&(t={element:o,confidence:i})}return t};function ye(r,e=document){let t=r?.fingerprint;if(!t||!t.tagName)return null;if(r.selector){let a=[];try{a=[...e.querySelectorAll(r.selector)]}catch{}let l=Te(a,t);if(l&&l.confidence>=.6)return l}if(!(!!t.textSnippet||Object.keys(t.attributes||{}).length>0))return null;let i;try{i=[...e.querySelectorAll(t.tagName)]}catch{return null}let s=Te(i,t);return s&&s.confidence>=.7?s:null}var ve="helldots-comments",U="helldots-pending-detail";function F(){try{let r=localStorage.getItem(ve);if(!r)return[];let e=JSON.parse(r);return Array.isArray(e)?e:[]}catch(r){return console.warn("HellDots: could not read stored comments",r),[]}}function Se(r){try{return localStorage.setItem(ve,JSON.stringify(r)),!0}catch{return!1}}function oe(r){if(Se(r))return!0;let e=r.map((i,s)=>({comment:i,index:s})).filter(({comment:i})=>i?.contextScreenshot).sort((i,s)=>{let a=Date.parse(i.comment.createdAt),l=Date.parse(s.comment.createdAt);return Number.isFinite(a)&&Number.isFinite(l)&&a!==l?a-l:i.index-s.index});if(e.length===0)return console.warn("HellDots: could not persist comments (storage quota exceeded, nothing left to shed)"),!1;let t=[...r],o=0;for(let{index:i}of e)if(t[i]={...t[i],contextScreenshot:null},o++,Se(t))return console.warn(`HellDots: localStorage quota exceeded \u2014 dropped the automatic context screenshot from the ${o} oldest comment(s) to keep all comments persisted. Comment text, replies and user-attached screenshots were not touched.`),!0;return console.warn(`HellDots: could not persist comments even after dropping all ${o} automatic context screenshot(s); storage quota exceeded`),!1}function ne(r,e,t){let o=new Set(e.map(s=>s.id));return[...r.filter(s=>!o.has(s.id)&&s.page!==t),...e]}var Ae='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',rt='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',st='<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="12" r="1.6"/><circle cx="12" cy="12" r="1.6"/><circle cx="19" cy="12" r="1.6"/></svg>',G=r=>{if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(r).catch(()=>{});let e=document.createElement("textarea");e.value=r,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch{}return e.remove(),Promise.resolve()},at=(r,e)=>({open:e.statusOpen,in_progress:e.statusInProgress,resolved:e.statusResolved})[r]||e.statusOpen,I=(r,e)=>({bug:e.typeBug,suggestion:e.typeSuggestion,question:e.typeQuestion,improvement:e.typeImprovement})[r]||e.unset,R=(r,e)=>({high:e.priorityHigh,medium:e.priorityMedium,low:e.priorityLow})[r]||e.unset,B=({action:r,options:e,value:t,colorOf:o,labelOf:i,tooltipLabel:s,onSelect:a,showLabel:l=!1})=>{let c=document.createElement("div");c.style.position="relative";let p=document.createElement("button");p.type="button",p.className=n.INBOX_ACTION_BTN,l&&p.classList.add(n.INBOX_ACTION_BTN_LABELED),p.dataset.action=r,p.setAttribute("aria-haspopup","true");let h=document.createElement("span");h.className=n.INBOX_STATUS_DOT,p.appendChild(h);let m=null;l&&(m=document.createElement("span"),m.className=n.INBOX_ACTION_LABEL,p.appendChild(m));let u=document.createElement("div");u.className=n.INBOX_MENU,u.style.display="none",u.setAttribute("role","menu");let d=t,E=()=>{let f=`${s}: ${i(d)}`;h.style.backgroundColor=o(d),p.dataset.hdTooltip=f,p.setAttribute("aria-label",f),m&&(m.textContent=i(d)),u.querySelectorAll("[data-picker-option]").forEach(g=>{let b=g.dataset.pickerOption,C=b===""?null:b;g.setAttribute("aria-checked",String(C===d))})};for(let f of e){let g=document.createElement("button");g.type="button",g.className=n.INBOX_MENU_ITEM,g.dataset.pickerOption=f===null?"":f,g.setAttribute("role","menuitemradio");let b=document.createElement("span");b.className=n.INBOX_STATUS_DOT,b.style.backgroundColor=o(f),g.appendChild(b),g.appendChild(document.createTextNode(i(f))),g.addEventListener("click",C=>{C.stopPropagation(),u.style.display="none",f!==d&&(d=f,a(f),E())}),u.appendChild(g)}return p.addEventListener("click",f=>{f.stopPropagation(),u.style.display=u.style.display==="none"?"block":"none"}),c.appendChild(p),c.appendChild(u),E(),c},V=(r,{strings:e,onCopy:t,onSetStatus:o,onSetType:i,onSetPriority:s,onDelete:a})=>{let l=document.createElement("div");l.className=n.INBOX_CARD_ACTIONS;let c=document.createElement("button");c.type="button",c.className=n.INBOX_ACTION_BTN,c.dataset.action="copy",c.dataset.hdTooltip=e.copyAgentContext,c.setAttribute("aria-label",e.copyAgentContext),c.innerHTML=Ae,c.addEventListener("click",d=>{d.stopPropagation(),t(r),c.innerHTML=rt,c.dataset.hdTooltip=e.copied,setTimeout(()=>{c.innerHTML=Ae,c.dataset.hdTooltip=e.copyAgentContext},1500)}),l.appendChild(c),l.appendChild(B({action:"status",options:M,value:r.status||"open",colorOf:d=>de[d]||"",labelOf:d=>at(d,e),tooltipLabel:e.statusLabel,onSelect:d=>o(r,d)})),l.appendChild(B({action:"type",options:[null,...y],value:r.type||null,colorOf:d=>w[d]||"transparent",labelOf:d=>I(d,e),tooltipLabel:e.typeLabel,onSelect:d=>i?.(r,d),showLabel:!0})),l.appendChild(B({action:"priority",options:[null,...S],value:r.priority||null,colorOf:d=>L[d]||"transparent",labelOf:d=>R(d,e),tooltipLabel:e.priorityLabel,onSelect:d=>s?.(r,d),showLabel:!0}));let p=document.createElement("div");p.style.position="relative";let h=document.createElement("button");h.type="button",h.className=n.INBOX_ACTION_BTN,h.dataset.action="menu",h.dataset.hdTooltip=e.moreOptions,h.setAttribute("aria-label",e.commentOptions),h.innerHTML=st;let m=document.createElement("div");m.className=n.INBOX_MENU,m.style.display="none";let u=document.createElement("button");return u.type="button",u.className=n.INBOX_MENU_ITEM,u.textContent=e.deleteComment,u.addEventListener("click",d=>{d.stopPropagation(),m.style.display="none",a(r)}),m.appendChild(u),h.addEventListener("click",d=>{d.stopPropagation(),m.style.display=m.style.display==="none"?"block":"none"}),p.appendChild(h),p.appendChild(m),l.appendChild(p),l};var lt=(r,e)=>{let t=Date.now()-new Date(r).getTime(),o=Math.floor(t/6e4),i=Math.floor(t/36e5),s=Math.floor(t/864e5);return o<1?e.justNow:o<60?_(e.minutesAgoTemplate,o):i<24?_(e.hoursAgoTemplate,i):_(e.daysAgoTemplate,s)},ct=(r,e)=>new Intl.DateTimeFormat(e,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(r)),$=(r,e,t,o)=>{let i=document.createElement("div");i.className=n.THREAD_META;let s=document.createElement("span");s.className=n.THREAD_AUTHOR,s.textContent=r||t.anonymous;let a=document.createElement("span");return a.className=n.THREAD_TIME,a.textContent=lt(e,t),a.dataset.fullDate=ct(e,o),i.appendChild(s),i.appendChild(a),i},dt=(r,e)=>{let t=/Mac|iPod|iPhone|iPad/.test(navigator.userAgent),o={alt:t?"\u2325":e.modifierAlt,ctrl:t?"\u2318":e.modifierCtrl,shift:"\u21E7"},i=o[r.shortcutModifier]||o.alt,s=r.shortcutKey?.toUpperCase()||"C";return`${i} + ${s}`},ht='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>',pt='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 2L11 13M22 2L15 22L11 13M11 13L2 9L22 2"/></svg>',ut='<svg width="16" height="16" viewBox="0 0 16 16" stroke-linejoin="round" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.8914 10.4028L2.98327 10.6318C3.22909 11.2445 3.5 12.1045 3.5 13C3.5 13.3588 3.4564 13.7131 3.38773 14.0495C3.69637 13.9446 4.01409 13.8159 4.32918 13.6584C4.87888 13.3835 5.33961 13.0611 5.70994 12.7521L6.22471 12.3226L6.88809 12.4196C7.24851 12.4724 7.61994 12.5 8 12.5C11.7843 12.5 14.5 9.85569 14.5 7C14.5 4.14431 11.7843 1.5 8 1.5C4.21574 1.5 1.5 4.14431 1.5 7C1.5 8.18175 1.94229 9.29322 2.73103 10.2153L2.8914 10.4028ZM2.8135 15.7653C1.76096 16 1 16 1 16C1 16 1.43322 15.3097 1.72937 14.4367C1.88317 13.9834 2 13.4808 2 13C2 12.3826 1.80733 11.7292 1.59114 11.1903C0.591845 10.0221 0 8.57152 0 7C0 3.13401 3.58172 0 8 0C12.4183 0 16 3.13401 16 7C16 10.866 12.4183 14 8 14C7.54721 14 7.10321 13.9671 6.67094 13.9038C6.22579 14.2753 5.66881 14.6656 5 15C4.23366 15.3832 3.46733 15.6195 2.8135 15.7653Z"/></svg>',mt='<svg width="16" height="16" viewBox="0 0 16 16" stroke-linejoin="round" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.67705 7.5L3.92705 3H12.0729L14.3229 7.5H10H9.25V8.25C9.25 8.94036 8.69036 9.5 8 9.5C7.30964 9.5 6.75 8.94036 6.75 8.25V7.5H6H1.67705ZM1.5 9V12C1.5 12.5523 1.94772 13 2.5 13H13.5C14.0523 13 14.5 12.5523 14.5 12V9H10.6465C10.32 10.1543 9.25878 11 8 11C6.74122 11 5.67998 10.1543 5.35352 9H1.5ZM3 1.5H13L15.8944 7.28885C15.9639 7.42771 16 7.58082 16 7.73607V12C16 13.3807 14.8807 14.5 13.5 14.5H2.5C1.11929 14.5 0 13.3807 0 12V7.73607C0 7.58082 0.0361451 7.42771 0.105573 7.28885L3 1.5Z"/></svg>',z=({areaClassName:r,inputTag:e="textarea",inputClassName:t,inputId:o,inputPlaceholder:i,submitBtnId:s,fileInputId:a},l)=>{let c=document.createElement("div");c.className=r;let p=document.createElement(e);o&&(p.id=o),t&&(p.className=t),p.placeholder=i,p.setAttribute("aria-label",i),e==="input"&&(p.type="text");let h=document.createElement("div");h.className=n.SCREENSHOTS_CONTAINER;let m=document.createElement("div");m.className=n.COMMENT_ACTIONS_BAR;let u=document.createElement("button");u.className=n.ATTACH_IMAGE_BTN,u.type="button",u.setAttribute("aria-label",l.attachImage),u.innerHTML=ht;let d=document.createElement("input");d.type="file",a&&(d.id=a),d.accept="image/*",d.style.display="none";let E=document.createElement("button");return s&&(E.id=s),E.className=n.THREAD_SUBMIT,E.type="button",E.setAttribute("aria-label",l.send),E.innerHTML=pt,m.appendChild(u),m.appendChild(d),m.appendChild(E),c.appendChild(p),c.appendChild(h),c.appendChild(m),{container:c,inputEl:p,screenshotsContainer:h,attachBtn:u,fileInput:d,submitBtn:E}},Ne=(r,e,t,o)=>{let i=document.createElement("div");i.className=n.TOOLBAR_ACTION_WRAPPER;let s=document.createElement("div");s.className=n.TOOLBAR_ACTION_TOOLTIP,t.forEach(l=>s.appendChild(l));let a=document.createElement("button");return a.type="button",a.className=`${n.TOOLBAR_ACTION_BTN} ${r}`,a.setAttribute("aria-label",o),a.innerHTML=e,i.appendChild(s),i.appendChild(a),i},Ie=(r={},e=v)=>{let t=document.createElement("div");t.id=T.TOOLBAR;let o=document.createElement("div");o.className=n.TOOLBAR_ACTIONS;let i=document.createElement("span");i.className=n.TOOLBAR_TEXT,i.textContent=e.toolbarComment;let s=document.createElement("span");s.className=n.SHORTCUT_HINT,s.textContent=dt(r,e);let a=Ne(n.TOOLBAR_COMMENT_BTN,ut,[i,s],e.toolbarComment);a.querySelector(`.${n.TOOLBAR_COMMENT_BTN}`)?.setAttribute("aria-pressed","false");let l=document.createElement("span");l.className=n.TOOLBAR_TEXT,l.textContent=e.toolbarInbox;let c=Ne(n.TOOLBAR_MENU_BTN,mt,[l],e.toolbarInbox);return o.appendChild(a),o.appendChild(c),t.appendChild(o),t},gt=r=>{let e=document.createElement("div");e.className=n.CLASSIFY_ROW;let t=null,o=null,i=[],s=document.createElement("div");s.className=n.INBOX_BADGES;let a=document.createElement("input");a.type="text",a.className=n.TAGS_INPUT,a.placeholder=r.tagsPlaceholder,a.setAttribute("aria-label",r.tagsPlaceholder);let l=()=>{s.innerHTML="",i.forEach((h,m)=>{let u=document.createElement("span");u.className=n.TAG_CHIP,u.appendChild(document.createTextNode(h));let d=document.createElement("button");d.type="button",d.className=n.TAG_CHIP_REMOVE,d.setAttribute("aria-label",`${r.removeTag}: ${h}`),d.innerHTML="&times;",d.addEventListener("click",E=>{E.stopPropagation(),i.splice(m,1),l()}),u.appendChild(d),s.appendChild(u)})},c=()=>{let h=a.value.trim().toLowerCase();h&&!i.includes(h)&&(i.push(h),l()),a.value=""};a.addEventListener("keydown",h=>{h.key!=="Enter"&&h.key!==","||(h.preventDefault(),c())});let p=()=>{e.replaceChildren(),e.appendChild(B({action:"type",options:[null,...y],value:null,colorOf:h=>w[h]||"transparent",labelOf:h=>I(h,r),tooltipLabel:r.typeLabel,onSelect:h=>t=h,showLabel:!0})),e.appendChild(B({action:"priority",options:[null,...S],value:null,colorOf:h=>L[h]||"transparent",labelOf:h=>R(h,r),tooltipLabel:r.priorityLabel,onSelect:h=>o=h,showLabel:!0})),e.appendChild(a),e.appendChild(s)};return p(),{container:e,getType:()=>t,getPriority:()=>o,getTags:()=>(c(),[...i]),reset:()=>{t=null,o=null,i.length=0,a.value="",l(),p()}}},Re=(r=v)=>{let e=document.createElement("div");e.id=T.COMMENT_BOX,e.setAttribute("role","dialog"),e.setAttribute("aria-label",r.commentBoxAriaLabel);let{container:t}=z({areaClassName:n.COMMENT_INPUT_AREA,inputTag:"textarea",inputId:T.COMMENT_INPUT,inputPlaceholder:r.commentPlaceholder,submitBtnId:T.SUBMIT_COMMENT,fileInputId:T.ATTACH_IMAGE_INPUT},r),o=gt(r);return e.appendChild(o.container),e.appendChild(t),e.style.display="none",e.classify=o,e},we=(r,e=v)=>{let t=document.createElement("div");return t.className=n.CIRCLE,t.dataset.commentId=r.id,t.dataset.commentText=r.text,t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label",`${e.commentAriaLabelPrefix}${r.text}`),t.style.cssText=`
1444
+ `,ke=()=>`
1445
+ .${o.COMMENT_CURSOR},
1446
+ .${o.COMMENT_CURSOR} * {
1447
+ cursor: url('${Pe}') ${De}, auto !important;
1448
+ }
1449
+
1450
+ `;var N={commentAriaLabelPrefix:"Comment: ",anonymous:"Anonymous",justNow:"Just now",minutesAgoTemplate:"{n}m",hoursAgoTemplate:"{n}h",daysAgoTemplate:"{n}d",toolbarComment:"Comment",toolbarInbox:"Inbox",modifierAlt:"Alt",modifierCtrl:"Ctrl",commentBoxAriaLabel:"New comment",commentPlaceholder:"Type your comment...",attachImage:"Attach image",send:"Send",tooltipAriaLabel:"Comment preview",close:"Close",popoverAriaLabel:"Comment thread",replyPlaceholder:"Reply...",attachedScreenshot:"Attached screenshot",screenshotPreview:"Screenshot preview",removeScreenshot:"Remove screenshot",inboxAriaLabel:"Comments inbox",inboxEmptyTitle:"No comments yet",inboxEmptyHintTemplate:"Press {n} and click anywhere on the page to start.",inboxEmptyAction:"Turn on comment mode",inboxNoMatches:"No comments match these filters",orphanedBadge:"Unanchored",hiddenBadge:"Hidden",filterAll:"All pages",filterCurrentPage:"Current page",filterTitle:"Filter",filterClear:"Clear",filterByPage:"Page",filterByStatus:"Status",back:"Back",deleteComment:"Delete",deleteReply:"Delete reply",replyOptions:"Reply options",editComment:"Edit",editReply:"Edit reply",copyLink:"Copy link",linkCopied:"Link copied",editorAriaLabel:"Edit text",editSave:"Save",editCancel:"Cancel",editedMark:"edited",editedAtPrefix:"Edited ",confirmDiscardTitle:"Discard changes?",confirmDiscardMessage:"The changes you made to this text have not been saved and will be lost.",confirmDiscard:"Discard",confirmKeepEditing:"Keep editing",commentNotFound:"That comment is not on this page.",confirmDelete:"Delete",confirmCancel:"Cancel",confirmDeleteCommentTitle:"Delete this comment?",confirmDeleteCommentMessage:"This comment will be permanently deleted. This action cannot be undone.",confirmDeleteThreadMessage:"This comment and all of its replies will be permanently deleted. This action cannot be undone.",confirmDeleteReplyTitle:"Delete this reply?",confirmDeleteReplyMessage:"This reply will be permanently deleted. This action cannot be undone.",copyAgentContext:"Copy agent context",copied:"Copied",statusLabel:"Status",prevComment:"Previous comment",nextComment:"Next comment",replyLink:"Reply",replyCountOne:"1 reply",replyCountTemplate:"{n} replies",commentOptions:"Comment options",moreOptions:"More",statusOpen:"Open",statusInProgress:"In progress",statusResolved:"Resolved",durationLessThanMinute:"<1m",resolvedInTemplate:"Resolved in {n}",typeLabel:"Type",priorityLabel:"Priority",unset:"Unset",typeBug:"Bug",typeSuggestion:"Suggestion",typeQuestion:"Question",typeImprovement:"Improvement",priorityHigh:"High",priorityMedium:"Medium",priorityLow:"Low",filterByType:"Type",filterByPriority:"Priority",contextSection:"Context",autoScreenshotLabel:"Automatic context",contextUrl:"URL",contextViewport:"Viewport",contextScreen:"Screen",contextBrowser:"Browser",contextOs:"OS"};var He={commentAriaLabelPrefix:"Comentario: ",anonymous:"An\xF3nimo",justNow:"Justo ahora",minutesAgoTemplate:"{n}m",hoursAgoTemplate:"{n}h",daysAgoTemplate:"{n}d",toolbarComment:"Comentar",toolbarInbox:"Bandeja",modifierAlt:"Alt",modifierCtrl:"Ctrl",commentBoxAriaLabel:"Nuevo comentario",commentPlaceholder:"Escribe tu comentario...",attachImage:"Adjuntar imagen",send:"Enviar",tooltipAriaLabel:"Vista previa del comentario",close:"Cerrar",popoverAriaLabel:"Hilo de comentarios",replyPlaceholder:"Responder...",attachedScreenshot:"Captura de pantalla adjunta",screenshotPreview:"Vista previa de la captura",removeScreenshot:"Quitar captura de pantalla",inboxAriaLabel:"Bandeja de comentarios",inboxEmptyTitle:"Todav\xEDa no hay comentarios",inboxEmptyHintTemplate:"Pulsa {n} y haz clic en cualquier parte de la p\xE1gina para empezar.",inboxEmptyAction:"Activar modo",inboxNoMatches:"Ning\xFAn comentario coincide con estos filtros",orphanedBadge:"Desanclado",hiddenBadge:"Oculto",filterAll:"Todas las p\xE1ginas",filterCurrentPage:"P\xE1gina actual",filterTitle:"Filtrar",filterClear:"Limpiar",filterByPage:"P\xE1gina",filterByStatus:"Estado",back:"Volver",deleteComment:"Eliminar",deleteReply:"Eliminar respuesta",replyOptions:"Opciones de la respuesta",editComment:"Editar",editReply:"Editar respuesta",copyLink:"Copiar enlace",linkCopied:"Enlace copiado",editorAriaLabel:"Editar texto",editSave:"Guardar",editCancel:"Cancelar",editedMark:"editado",editedAtPrefix:"Editado el ",confirmDiscardTitle:"\xBFDescartar los cambios?",confirmDiscardMessage:"Los cambios que hiciste en este texto no se han guardado y se perder\xE1n.",confirmDiscard:"Descartar",confirmKeepEditing:"Seguir editando",commentNotFound:"Ese comentario no est\xE1 en esta p\xE1gina.",confirmDelete:"Eliminar",confirmCancel:"Cancelar",confirmDeleteCommentTitle:"\xBFEliminar comentario?",confirmDeleteCommentMessage:"Este comentario se eliminar\xE1 de forma permanente. Esta acci\xF3n no se puede deshacer.",confirmDeleteThreadMessage:"Este comentario y todas sus respuestas se eliminar\xE1n de forma permanente. Esta acci\xF3n no se puede deshacer.",confirmDeleteReplyTitle:"\xBFEliminar respuesta?",confirmDeleteReplyMessage:"Esta respuesta se eliminar\xE1 de forma permanente. Esta acci\xF3n no se puede deshacer.",copyAgentContext:"Copiar contexto de agente",copied:"Copiado",statusLabel:"Estado",prevComment:"Comentario anterior",nextComment:"Comentario siguiente",replyLink:"Responder",replyCountOne:"1 respuesta",replyCountTemplate:"{n} respuestas",commentOptions:"Opciones del comentario",moreOptions:"M\xE1s",statusOpen:"Abierto",statusInProgress:"En progreso",statusResolved:"Resuelto",durationLessThanMinute:"<1m",resolvedInTemplate:"Resuelto en {n}",typeLabel:"Tipo",priorityLabel:"Prioridad",unset:"Sin definir",typeBug:"Bug",typeSuggestion:"Sugerencia",typeQuestion:"Pregunta",typeImprovement:"Mejora",priorityHigh:"Alta",priorityMedium:"Media",priorityLow:"Baja",filterByType:"Tipo",filterByPriority:"Prioridad",contextSection:"Contexto",autoScreenshotLabel:"Contexto autom\xE1tico",contextUrl:"URL",contextViewport:"Viewport",contextScreen:"Pantalla",contextBrowser:"Navegador",contextOs:"SO"};var me={en:N,es:He},ge="en";function Xe(){let n=(navigator.language||ge).slice(0,2).toLowerCase();return n in me?n:ge}function Fe(n){return me[n]||me[ge]}function v(n,e){return n.replace("{n}",String(e))}var xt=6e4;function J(n,e){if(!Number.isFinite(n)||n<0)return"";let t=Math.floor(n/xt);if(t<1)return e.durationLessThanMinute;if(t<60)return v(e.minutesAgoTemplate,t);let i=Math.floor(t/60);if(i<24){let l=t%60,c=v(e.hoursAgoTemplate,i);return l?`${c} ${v(e.minutesAgoTemplate,l)}`:c}let s=Math.floor(i/24),r=i%24,a=v(e.daysAgoTemplate,s);return r?`${a} ${v(e.hoursAgoTemplate,r)}`:a}var Ee=64,_t=3,Ot=5,yt=.6,vt=.7,St=/^(css|sc|jsx|emotion)-/i,At=/^data-(reactid|react-|v-|svelte-)/,Rt=["id","name","role","aria-label"],It=["data-testid","name","aria-label"],fe=n=>typeof CSS<"u"&&CSS.escape?CSS.escape(n):String(n).replace(/[^a-zA-Z0-9_-]/g,"\\$&"),Nt=n=>String(n).replace(/["\\]/g,"\\$&"),U=(n,e)=>{try{return e.querySelectorAll(n).length===1}catch{return!1}},Ve=n=>(n||"").replace(/\s+/g," ").trim().slice(0,Ee),wt=n=>Be.includes(n)||St.test(n)?!1:!n.split(/[-_]/).some(e=>e.length>=5&&/\d/.test(e)),Lt=n=>[...n.classList].filter(wt),Bt=n=>{let e={};for(let{name:t,value:i}of n.attributes)(Rt.includes(t)||t.startsWith("data-")&&!At.test(t))&&i&&(e[t]=i.slice(0,Ee));return e},be=n=>{let e=n.parentElement;if(!e)return{index:0,count:1};let t=[...e.children].filter(i=>i.tagName===n.tagName);return{index:t.indexOf(n),count:t.length}},Mt=(n,e)=>{if(!n.id)return null;let t=`#${fe(n.id)}`;return U(t,e)?t:null},Pt=(n,e)=>{let t=n.tagName.toLowerCase();for(let i of It){let s=n.getAttribute(i);if(!s)continue;let r=`${t}[${i}="${Nt(s)}"]`;if(U(r,e))return r}return null},Dt=(n,e)=>{let t=[],i=n;for(let s=0;s<_t&&i;s++){let r=Lt(i),a=i.tagName.toLowerCase();if(t.unshift(r.length?`${a}.${r.map(fe).join(".")}`:a),s===0&&!r.length)return null;let l=t.join(" > ");if(U(l,e))return l;i=i.parentElement}return null},$t=(n,e)=>{if(n===e.body)return"body";let t=[],i=n;for(let r=0;r<Ot&&i;r++){if(i===e.body){t.unshift("body");break}if(i.id){let l=[`#${fe(i.id)}`,...t].join(" > ");if(U(l,e))return l}let{index:a}=be(i);t.unshift(`${i.tagName.toLowerCase()}:nth-of-type(${a+1})`),i=i.parentElement}let s=t.join(" > ");return U(s,e)?s:null},ze=(n,e)=>Mt(n,e)||Pt(n,e)||Dt(n,e)||$t(n,e);function Ye(n){return ze(n,n.ownerDocument)}function We(n,e,t){let i=n.ownerDocument,{index:s,count:r}=be(n);return{version:1,selector:ze(n,i),fingerprint:{tagName:n.tagName,textSnippet:Ve(n.textContent),attributes:Bt(n),siblingIndex:s,siblingCount:r},relativeX:e,relativeY:t}}var kt=(n,e)=>{if(!n&&!e)return 1;if(!n||!e)return 0;if(n===e)return 1;if(n.startsWith(e)||e.startsWith(n))return .8;let t=new Set(n.split(" ")),i=new Set(e.split(" ")),s=0;for(let r of t)i.has(r)&&s++;return 2*s/(t.size+i.size)},Ht=(n,e)=>{let t=Object.keys(e);if(!t.length)return 1;let i=0;for(let s of t)(n.getAttribute(s)||"").slice(0,Ee)===e[s]&&i++;return i/t.length},Ue=(n,e)=>{let{index:t,count:i}=be(n),s=Math.abs(t-e.siblingIndex),r=Math.max(e.siblingCount,i,1);return Math.max(0,1-s/r)},Xt=(n,e)=>{if(n.tagName!==e.tagName)return 0;let t=!!e.textSnippet,i=Object.keys(e.attributes||{}).length>0,s=.5,r=.3,a=.2;return i?t||(r+=s,s=0):(s+=r,r=0),!t&&!i?Ue(n,e):s*kt(Ve(n.textContent),e.textSnippet)+r*Ht(n,e.attributes||{})+a*Ue(n,e)},Ge=(n,e)=>{let t=null;for(let i of n){let s=Xt(i,e);(!t||s>t.confidence)&&(t={element:i,confidence:s})}return t};function je(n,e=document){let t=n?.fingerprint;if(!t||!t.tagName)return null;if(n.selector){let a=[];try{a=[...e.querySelectorAll(n.selector)]}catch{}let l=Ge(a,t);if(l&&l.confidence>=yt)return l}if(!(!!t.textSnippet||Object.keys(t.attributes||{}).length>0))return null;let s;try{s=[...e.querySelectorAll(t.tagName)]}catch{return null}let r=Ge(s,t);return r&&r.confidence>=vt?r:null}var Ke="helldots-comments",ee="helldots-pending-detail";function te(){try{let n=localStorage.getItem(Ke);if(!n)return[];let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch(n){return console.warn("HellDots: could not read stored comments",n),[]}}function qe(n){try{return localStorage.setItem(Ke,JSON.stringify(n)),!0}catch{return!1}}function Ce(n){if(qe(n))return!0;let e=n.map((s,r)=>({comment:s,index:r})).filter(({comment:s})=>s?.contextScreenshot).sort((s,r)=>{let a=Date.parse(s.comment.createdAt),l=Date.parse(r.comment.createdAt);return Number.isFinite(a)&&Number.isFinite(l)&&a!==l?a-l:s.index-r.index});if(e.length===0)return console.warn("HellDots: could not persist comments (storage quota exceeded, nothing left to shed)"),!1;let t=[...n],i=0;for(let{index:s}of e)if(t[s]={...t[s],contextScreenshot:null},i++,qe(t))return console.warn(`HellDots: localStorage quota exceeded \u2014 dropped the automatic context screenshot from the ${i} oldest comment(s) to keep all comments persisted. Comment text, replies and user-attached screenshots were not touched.`),!0;return console.warn(`HellDots: could not persist comments even after dropping all ${i} automatic context screenshot(s); storage quota exceeded`),!1}function Te(n,e,t){let i=new Set(e.map(r=>r.id));return[...n.filter(r=>!i.has(r.id)&&r.page!==t),...e]}var Ze="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Qe=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n|=0));for(;n--;)e+=Ze[t[n]&63];return e};var xe=()=>Qe();var oe="helldotsComment",G=(n,e=oe,t=location.href)=>{let i=new URL(t),s=n.page||i.pathname,r=s===i.pathname?i:new URL(s,i);return r.searchParams.set(e,String(n.id)),r.href},Je=(n=oe,e=location.href)=>{try{return new URL(e).searchParams.get(n)}catch{return null}};var V=new Set,P=null,et=(n,e)=>(typeof e.composedPath=="function"?e.composedPath():[]).includes(n)||n.contains(e.target),Ft=()=>{P||(P=n=>{for(let e of[...V])et(e.menu,n)||et(e.button,n)||e.close()},document.addEventListener("mousedown",P,!0))},Ut=()=>{P&&(document.removeEventListener("mousedown",P,!0),P=null)},ie=()=>{for(let n of[...V])n.close()},z=(n,e)=>{let t={button:n,menu:e,close:()=>{e.style.display="none",n.setAttribute("aria-expanded","false"),V.delete(t),V.size===0&&Ut()}},i=()=>{ie(),e.style.display="block",n.setAttribute("aria-expanded","true"),V.add(t),Ft()},s=()=>e.style.display!=="none";return e.style.display="none",n.setAttribute("aria-expanded","false"),n.addEventListener("click",r=>{r.stopPropagation();let a=s();ie(),a||i()}),{open:i,close:t.close,isOpen:s}};var _e=new Set,tt=()=>{for(let n of[..._e])n(!1)},ne=(n,{title:e,message:t,confirmLabel:i,cancelLabel:s})=>new Promise(r=>{let a=document.createElement("div");a.className=o.CONFIRM,a.style.zIndex=String(O.CONFIRM);let l=document.createElement("div");l.className=o.CONFIRM_PANEL,l.setAttribute("role","alertdialog"),l.setAttribute("aria-modal","true");let c=document.createElement("h2");c.className=o.CONFIRM_TITLE,c.textContent=e,c.id=`hd-confirm-title-${Math.random().toString(36).slice(2,9)}`,l.setAttribute("aria-labelledby",c.id);let p=document.createElement("p");p.className=o.CONFIRM_MESSAGE,p.textContent=t;let h=document.createElement("div");h.className=o.CONFIRM_ACTIONS;let d=document.createElement("button");d.type="button",d.className=o.CONFIRM_CANCEL,d.textContent=s;let g=document.createElement("button");g.type="button",g.className=o.CONFIRM_ACCEPT,g.textContent=i,h.appendChild(d),h.appendChild(g),l.appendChild(c),l.appendChild(p),l.appendChild(h),a.appendChild(l);let m=n.activeElement||document.activeElement,u=!1,f=E=>{u||(u=!0,_e.delete(f),document.removeEventListener("keydown",b,!0),a.remove(),m?.focus?.(),r(E))},b=E=>{if(E.key==="Escape"){E.stopPropagation(),E.preventDefault(),f(!1);return}if(E.key!=="Tab")return;let C=[d,g],y=n.activeElement||document.activeElement,_=C.indexOf(y);E.preventDefault(),(E.shiftKey?C[(_<=0?C.length:_)-1]:C[(_+1)%C.length]).focus()};d.addEventListener("click",()=>f(!1)),g.addEventListener("click",()=>f(!0));let x=!1;a.addEventListener("mousedown",E=>{x=E.target===a,E.stopPropagation()}),a.addEventListener("click",E=>{E.target===a&&x&&f(!1),x=!1}),_e.add(f),document.addEventListener("keydown",b,!0),(n.body||n).appendChild(a),d.focus()});var ot='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',Gt='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',Vt='<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="12" r="1.6"/><circle cx="12" cy="12" r="1.6"/><circle cx="19" cy="12" r="1.6"/></svg>',$=n=>{if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(n).catch(()=>{});let e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch{}return e.remove(),Promise.resolve()},k=(n,e)=>({open:e.statusOpen,in_progress:e.statusInProgress,resolved:e.statusResolved})[n]||e.statusOpen,B=(n,e)=>({bug:e.typeBug,suggestion:e.typeSuggestion,question:e.typeQuestion,improvement:e.typeImprovement})[n]||e.unset,M=(n,e)=>({high:e.priorityHigh,medium:e.priorityMedium,low:e.priorityLow})[n]||e.unset,D=({action:n,options:e,value:t,colorOf:i,labelOf:s,tooltipLabel:r,onSelect:a,showLabel:l=!1})=>{let c=document.createElement("div");c.style.position="relative";let p=document.createElement("button");p.type="button",p.className=o.INBOX_ACTION_BTN,l&&p.classList.add(o.INBOX_ACTION_BTN_LABELED),p.dataset.action=n,p.setAttribute("aria-haspopup","true");let h=document.createElement("span");h.className=o.INBOX_STATUS_DOT,p.appendChild(h);let d=null;l&&(d=document.createElement("span"),d.className=o.INBOX_ACTION_LABEL,p.appendChild(d));let g=document.createElement("div");g.className=o.INBOX_MENU,g.setAttribute("role","menu");let m=z(p,g),u=t,f=()=>{let b=`${r}: ${s(u)}`;h.style.backgroundColor=i(u),p.dataset.hdTooltip=b,p.setAttribute("aria-label",b),d&&(d.textContent=s(u)),g.querySelectorAll("[data-picker-option]").forEach(x=>{let S=x.dataset.pickerOption,E=S===""?null:S;x.setAttribute("aria-checked",String(E===u))})};for(let b of e){let x=document.createElement("button");x.type="button",x.className=o.INBOX_MENU_ITEM,x.dataset.pickerOption=b===null?"":b,x.setAttribute("role","menuitemradio");let S=document.createElement("span");S.className=o.INBOX_STATUS_DOT,S.style.backgroundColor=i(b),x.appendChild(S),x.appendChild(document.createTextNode(s(b))),x.addEventListener("click",E=>{E.stopPropagation(),m.close(),b!==u&&(u=b,a(b),f())}),g.appendChild(x)}return c.appendChild(p),c.appendChild(g),f(),c},Oe=({label:n,tooltip:e,items:t})=>{let i=document.createElement("div");i.style.position="relative";let s=document.createElement("button");s.type="button",s.className=o.INBOX_ACTION_BTN,s.dataset.action="menu",e&&(s.dataset.hdTooltip=e),s.setAttribute("aria-label",n),s.innerHTML=Vt;let r=document.createElement("div");r.className=o.INBOX_MENU,r.setAttribute("role","menu");let a=z(s,r);for(let l of t){let c=document.createElement("button");c.type="button",c.className=o.INBOX_MENU_ITEM,c.setAttribute("role","menuitem"),c.textContent=l.label,c.addEventListener("click",async p=>{if(p.stopPropagation(),l.feedbackLabel){l.onSelect(),c.textContent=l.feedbackLabel,setTimeout(()=>{c.textContent=l.label,a.close()},1200);return}if(a.close(),l.confirm){let h=c.getRootNode();if(!await ne(h,l.confirm()))return}l.onSelect()}),r.appendChild(c)}return i.appendChild(s),i.appendChild(r),i},re=(n,{strings:e,onCopy:t,onCopyLink:i,onEdit:s,onSetStatus:r,onSetType:a,onSetPriority:l,onDelete:c})=>{let p=document.createElement("div");p.className=o.INBOX_CARD_ACTIONS;let h=document.createElement("button");return h.type="button",h.className=o.INBOX_ACTION_BTN,h.dataset.action="copy",h.dataset.hdTooltip=e.copyAgentContext,h.setAttribute("aria-label",e.copyAgentContext),h.innerHTML=ot,h.addEventListener("click",d=>{d.stopPropagation(),t(n),h.innerHTML=Gt,h.dataset.hdTooltip=e.copied,setTimeout(()=>{h.innerHTML=ot,h.dataset.hdTooltip=e.copyAgentContext},1500)}),p.appendChild(h),p.appendChild(D({action:"status",options:L,value:n.status||"open",colorOf:d=>Z[d]||"",labelOf:d=>k(d,e),tooltipLabel:e.statusLabel,onSelect:d=>r(n,d),showLabel:!0})),p.appendChild(D({action:"type",options:[null,...R],value:n.type||null,colorOf:d=>X[d]||"transparent",labelOf:d=>B(d,e),tooltipLabel:e.typeLabel,onSelect:d=>a?.(n,d),showLabel:!0})),p.appendChild(D({action:"priority",options:[null,...I],value:n.priority||null,colorOf:d=>F[d]||"transparent",labelOf:d=>M(d,e),tooltipLabel:e.priorityLabel,onSelect:d=>l?.(n,d),showLabel:!0})),p.appendChild(Oe({label:e.commentOptions,tooltip:e.moreOptions,items:[{label:e.copyLink,feedbackLabel:e.linkCopied,onSelect:()=>i?.(n)},{label:e.editComment,onSelect:()=>s?.(n)},{label:e.deleteComment,onSelect:()=>c(n),confirm:()=>({title:e.confirmDeleteCommentTitle,message:n.replies?.length?e.confirmDeleteThreadMessage:e.confirmDeleteCommentMessage,confirmLabel:e.confirmDelete,cancelLabel:e.confirmCancel})}]})),p};var H=({value:n,strings:e,onInput:t,onSave:i,onCancel:s})=>{let r=document.createElement("div");r.className=o.EDITOR;let a=document.createElement("textarea");a.className=o.EDITOR_INPUT,a.value=n,a.rows=3,a.setAttribute("aria-label",e.editorAriaLabel);let l=document.createElement("div");l.className=o.EDITOR_ACTIONS;let c=document.createElement("button");c.type="button",c.className=o.EDITOR_CANCEL,c.textContent=e.editCancel;let p=document.createElement("button");p.type="button",p.className=o.EDITOR_SAVE,p.textContent=e.editSave;let h=()=>{p.disabled=a.value.trim().length===0};return h(),a.addEventListener("input",()=>{h(),t(a.value)}),a.addEventListener("keydown",d=>{if(d.key==="Escape"){d.stopPropagation(),d.preventDefault(),s();return}d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&!p.disabled&&(d.preventDefault(),i(a.value))}),c.addEventListener("click",d=>{d.stopPropagation(),s()}),p.addEventListener("click",d=>{d.stopPropagation(),p.disabled||i(a.value)}),l.appendChild(c),l.appendChild(p),r.appendChild(a),r.appendChild(l),queueMicrotask(()=>{a.focus(),a.setSelectionRange(a.value.length,a.value.length)}),r},se=(n,e)=>ne(n,{title:e.confirmDiscardTitle,message:e.confirmDiscardMessage,confirmLabel:e.confirmDiscard,cancelLabel:e.confirmKeepEditing});var zt=(n,e)=>{let t=Date.now()-new Date(n).getTime(),i=Math.floor(t/6e4),s=Math.floor(t/36e5),r=Math.floor(t/864e5);return i<1?e.justNow:i<60?v(e.minutesAgoTemplate,i):s<24?v(e.hoursAgoTemplate,s):v(e.daysAgoTemplate,r)},nt=(n,e)=>new Intl.DateTimeFormat(e,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(n)),Y=(n,e,t,i,s=null)=>{let r=document.createElement("div");r.className=o.THREAD_META;let a=document.createElement("span");a.className=o.THREAD_AUTHOR,a.textContent=n||t.anonymous;let l=document.createElement("span");return l.className=o.THREAD_TIME,l.textContent=zt(e,t),l.dataset.fullDate=nt(e,i),r.appendChild(a),r.appendChild(l),s&&r.appendChild(ye(s,t,i)),r},ye=(n,e,t)=>{let i=document.createElement("span");return i.className=o.THREAD_EDITED,i.textContent=e.editedMark,i.dataset.fullDate=e.editedAtPrefix+nt(n,t),i},ve=(n,e)=>{let t=/Mac|iPod|iPhone|iPad/.test(navigator.userAgent),i={alt:t?"\u2325":e.modifierAlt,ctrl:t?"\u2318":e.modifierCtrl,shift:"\u21E7"},s=i[n.shortcutModifier]||i.alt,r=n.shortcutKey?.toUpperCase()||"C";return`${s} + ${r}`},Yt='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>',Wt='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 2L11 13M22 2L15 22L11 13M11 13L2 9L22 2"/></svg>',jt='<svg width="16" height="16" viewBox="0 0 16 16" stroke-linejoin="round" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.8914 10.4028L2.98327 10.6318C3.22909 11.2445 3.5 12.1045 3.5 13C3.5 13.3588 3.4564 13.7131 3.38773 14.0495C3.69637 13.9446 4.01409 13.8159 4.32918 13.6584C4.87888 13.3835 5.33961 13.0611 5.70994 12.7521L6.22471 12.3226L6.88809 12.4196C7.24851 12.4724 7.61994 12.5 8 12.5C11.7843 12.5 14.5 9.85569 14.5 7C14.5 4.14431 11.7843 1.5 8 1.5C4.21574 1.5 1.5 4.14431 1.5 7C1.5 8.18175 1.94229 9.29322 2.73103 10.2153L2.8914 10.4028ZM2.8135 15.7653C1.76096 16 1 16 1 16C1 16 1.43322 15.3097 1.72937 14.4367C1.88317 13.9834 2 13.4808 2 13C2 12.3826 1.80733 11.7292 1.59114 11.1903C0.591845 10.0221 0 8.57152 0 7C0 3.13401 3.58172 0 8 0C12.4183 0 16 3.13401 16 7C16 10.866 12.4183 14 8 14C7.54721 14 7.10321 13.9671 6.67094 13.9038C6.22579 14.2753 5.66881 14.6656 5 15C4.23366 15.3832 3.46733 15.6195 2.8135 15.7653Z"/></svg>',qt='<svg width="16" height="16" viewBox="0 0 16 16" stroke-linejoin="round" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.67705 7.5L3.92705 3H12.0729L14.3229 7.5H10H9.25V8.25C9.25 8.94036 8.69036 9.5 8 9.5C7.30964 9.5 6.75 8.94036 6.75 8.25V7.5H6H1.67705ZM1.5 9V12C1.5 12.5523 1.94772 13 2.5 13H13.5C14.0523 13 14.5 12.5523 14.5 12V9H10.6465C10.32 10.1543 9.25878 11 8 11C6.74122 11 5.67998 10.1543 5.35352 9H1.5ZM3 1.5H13L15.8944 7.28885C15.9639 7.42771 16 7.58082 16 7.73607V12C16 13.3807 14.8807 14.5 13.5 14.5H2.5C1.11929 14.5 0 13.3807 0 12V7.73607C0 7.58082 0.0361451 7.42771 0.105573 7.28885L3 1.5Z"/></svg>',ae=({areaClassName:n,inputTag:e="textarea",inputClassName:t,inputId:i,inputPlaceholder:s,submitBtnId:r,fileInputId:a},l)=>{let c=document.createElement("div");c.className=n;let p=document.createElement(e);i&&(p.id=i),t&&(p.className=t),p.placeholder=s,p.setAttribute("aria-label",s),e==="input"&&(p.type="text");let h=document.createElement("div");h.className=o.SCREENSHOTS_CONTAINER;let d=document.createElement("div");d.className=o.COMMENT_ACTIONS_BAR;let g=document.createElement("button");g.className=o.ATTACH_IMAGE_BTN,g.type="button",g.setAttribute("aria-label",l.attachImage),g.innerHTML=Yt;let m=document.createElement("input");m.type="file",a&&(m.id=a),m.accept="image/*",m.style.display="none";let u=document.createElement("button");return r&&(u.id=r),u.className=o.THREAD_SUBMIT,u.type="button",u.setAttribute("aria-label",l.send),u.innerHTML=Wt,d.appendChild(g),d.appendChild(m),d.appendChild(u),c.appendChild(p),c.appendChild(h),c.appendChild(d),{container:c,inputEl:p,screenshotsContainer:h,attachBtn:g,fileInput:m,submitBtn:u}},it=(n,e,t,i)=>{let s=document.createElement("div");s.className=o.TOOLBAR_ACTION_WRAPPER;let r=document.createElement("div");r.className=o.TOOLBAR_ACTION_TOOLTIP,t.forEach(l=>r.appendChild(l));let a=document.createElement("button");return a.type="button",a.className=`${o.TOOLBAR_ACTION_BTN} ${n}`,a.setAttribute("aria-label",i),a.innerHTML=e,s.appendChild(r),s.appendChild(a),s},rt=(n={},e=N)=>{let t=document.createElement("div");t.id=T.TOOLBAR;let i=document.createElement("div");i.className=o.TOOLBAR_ACTIONS;let s=document.createElement("span");s.className=o.TOOLBAR_TEXT,s.textContent=e.toolbarComment;let r=document.createElement("span");r.className=o.SHORTCUT_HINT,r.textContent=ve(n,e);let a=it(o.TOOLBAR_COMMENT_BTN,jt,[s,r],e.toolbarComment);a.querySelector(`.${o.TOOLBAR_COMMENT_BTN}`)?.setAttribute("aria-pressed","false");let l=document.createElement("span");l.className=o.TOOLBAR_TEXT,l.textContent=e.toolbarInbox;let c=it(o.TOOLBAR_MENU_BTN,qt,[l],e.toolbarInbox);return i.appendChild(a),i.appendChild(c),t.appendChild(i),t},Se=(n,e,{includeStatus:t=!1,includeClassification:i=!0}={})=>{let s=document.createElement("div");s.className=o.INBOX_BADGES;let r=(a,l,c)=>{let p=document.createElement("span");p.className=`${o.BADGE} ${l}`,p.textContent=a,c&&(p.style.borderColor=c),s.appendChild(p)};if(t){let a=n.status||"open";r(k(a,e),o.BADGE_STATUS,Z[a])}i&&n.type&&r(B(n.type,e),o.BADGE_TYPE,X[n.type]),i&&n.priority&&r(M(n.priority,e),o.BADGE_PRIORITY,F[n.priority]);for(let a of n.tags||[])r(a,o.BADGE_TAG,null);if(n.status==="resolved"){let a=n.resolvedAt?J(new Date(n.resolvedAt).getTime()-new Date(n.createdAt).getTime(),e):"";r(v(e.resolvedInTemplate,a||"\u2014"),o.BADGE_DURATION,null)}return s.children.length?s:null},Kt=n=>{let e=document.createElement("div");e.className=o.CLASSIFY_ROW;let t=null,i=null,s=()=>{e.replaceChildren(),e.appendChild(D({action:"type",options:[null,...R],value:null,colorOf:r=>X[r]||"transparent",labelOf:r=>B(r,n),tooltipLabel:n.typeLabel,onSelect:r=>t=r,showLabel:!0})),e.appendChild(D({action:"priority",options:[null,...I],value:null,colorOf:r=>F[r]||"transparent",labelOf:r=>M(r,n),tooltipLabel:n.priorityLabel,onSelect:r=>i=r,showLabel:!0}))};return s(),{container:e,getType:()=>t,getPriority:()=>i,reset:()=>{t=null,i=null,s()}}},st=(n=N)=>{let e=document.createElement("div");e.id=T.COMMENT_BOX,e.setAttribute("role","dialog"),e.setAttribute("aria-label",n.commentBoxAriaLabel);let{container:t}=ae({areaClassName:o.COMMENT_INPUT_AREA,inputTag:"textarea",inputId:T.COMMENT_INPUT,inputPlaceholder:n.commentPlaceholder,submitBtnId:T.SUBMIT_COMMENT,fileInputId:T.ATTACH_IMAGE_INPUT},n),i=Kt(n);return e.appendChild(i.container),e.appendChild(t),e.style.display="none",e.classify=i,e},at=(n,e=N)=>{let t=document.createElement("div");return t.className=o.CIRCLE,t.dataset.commentId=n.id,t.dataset.commentText=n.text,t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label",`${e.commentAriaLabelPrefix}${n.text}`),t.style.cssText=`
1015
1451
  position: absolute;
1016
1452
  pointer-events: auto;
1017
- `,t},H=(r,e)=>{let t=document.createElement("div");return t.className=n.SCREENSHOTS_CONTAINER,t.classList.add(n.ACTIVE),r.forEach(o=>{let i=document.createElement("div");i.className=n.SCREENSHOT_ITEM;let s=document.createElement("img");s.className=n.SCREENSHOT_IMG,s.src=o,s.alt=e.attachedScreenshot,i.appendChild(s),t.appendChild(i)}),t},Le=(r,e=v,t)=>{let o=document.createElement("div");o.className=n.TOOLTIP,o.dataset.for=r.id,o.setAttribute("role","dialog"),o.setAttribute("aria-label",e.tooltipAriaLabel);let i=document.createElement("div");i.className=n.THREAD_HEADER;let s=$(r.author,r.createdAt,e,t),a=document.createElement("button");a.type="button",a.className=n.CLOSE_TOOLTIP,a.setAttribute("aria-label",e.close),a.innerHTML="&times;",i.appendChild(s),i.appendChild(a);let l=document.createElement("div");l.className=n.THREAD_BODY,l.textContent=r.text,o.appendChild(i),o.appendChild(l);let c=r.screenshots||(r.screenshot?[r.screenshot]:[]);return c.length>0&&o.appendChild(H(c,e)),o},k=(r,e=v,t)=>{let o=document.createElement("div");o.className=n.THREAD_REPLY;let i=$(r.author,r.timestamp,e,t),s=document.createElement("div");s.className=n.THREAD_BODY,s.textContent=r.text,o.appendChild(i),o.appendChild(s);let a=r.screenshots||(r.screenshot?[r.screenshot]:[]);return a.length>0&&o.appendChild(H(a,e)),o},Be=(r,e=v,t)=>{let o=document.createElement("div");o.className=n.THREAD_POPOVER,o.dataset.for=r.id,o.setAttribute("role","dialog"),o.setAttribute("aria-label",e.popoverAriaLabel);let i=document.createElement("div");i.className=n.THREAD_HEADER;let s=$(r.author,r.createdAt,e,t),a=document.createElement("button");a.type="button",a.className=n.CLOSE_TOOLTIP,a.setAttribute("aria-label",e.close),a.innerHTML="&times;",i.appendChild(s),i.appendChild(a);let l=document.createElement("div");l.className=n.THREAD_BODY,l.textContent=r.text;let c=document.createElement("div");c.className=n.THREAD_REPLIES,r.replies&&r.replies.forEach(m=>{c.appendChild(k(m,e,t))});let{container:p}=z({areaClassName:n.THREAD_INPUT_AREA,inputTag:"input",inputClassName:n.THREAD_INPUT,inputPlaceholder:e.replyPlaceholder},e);o.appendChild(i),o.appendChild(l);let h=r.screenshots||(r.screenshot?[r.screenshot]:[]);return h.length>0&&o.appendChild(H(h,e)),o.appendChild(c),o.appendChild(p),o};var Et=r=>{let e=[...r.attributes].map(({name:t,value:o})=>`${t}="${o}"`).join(" ");return`<${r.tagName.toLowerCase()}${e?` ${e}`:""}>`},ft=r=>{if(!r?.tagName)return"(unknown)";let e=Object.entries(r.attributes||{}).map(([t,o])=>`${t}="${o}"`).join(" ");return`<${r.tagName.toLowerCase()}${e?` ${e}`:""}>`},bt=r=>{let e=[],t=r;for(;t&&t!==document.documentElement;){let o=t.tagName.toLowerCase(),i=t.id?`#${t.id}`:"",s=[...t.classList].slice(0,2).map(a=>`.${a}`).join("");if(e.unshift(`${o}${i}${s}`),t===document.body)break;t=t.parentElement}return e.join(" > ")};function Y(r,{viewportWidth:e,viewportHeight:t,strings:o}){let i=r.anchor,s=i?.fingerprint,a=r.container?.isConnected?r.container:null,l=r.hidden?"hidden":r.anchorState,c=a?Et(a):ft(s),p=a?bt(a):"(unavailable)",h=r.context?.viewport,m=h?.width??e,u=h?.height??t,d=[`Page: ${r.page}`,`Viewport: ${m}x${u}`,`Anchor state: ${l}`,`Status: ${r.status||"open"}`,`Selector: ${i?.selector||"(none)"}`,`Element: ${c}`,`DOM path: ${p}`,`Nearby text: "${s?.textSnippet??""}"`,`Comment by ${r.author} (${r.createdAt}):`,`"${r.text}"`];r.type&&d.push(`Type: ${r.type}`),r.priority&&d.push(`Priority: ${r.priority}`),r.tags?.length&&d.push(`Tags: ${r.tags.join(", ")}`);let E=r.context;if(E&&(E.url&&d.push(`URL: ${E.url}`),E.screen&&d.push(`Screen: ${E.screen.width}x${E.screen.height}`),E.browser?.name&&d.push(`Browser: ${`${E.browser.name} ${E.browser.version||""}`.trim()}`),E.os?.name&&d.push(`OS: ${`${E.os.name} ${E.os.version||""}`.trim()}`)),o&&r.status==="resolved"&&r.resolvedAt){let g=X(new Date(r.resolvedAt).getTime()-new Date(r.createdAt).getTime(),o);g&&d.push(`Resolution time: ${g}`)}let f=r.replies||[];if(f.length>0){d.push(`Replies (${f.length}):`);for(let g of f)d.push(`- ${g.author}: "${g.text}"`)}return d.join(`
1018
- `)}var Tt='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>',Ct='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"/></svg>',xt='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"/></svg>',_t='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>',j=class{constructor({shadowRoot:e,strings:t,locale:o,currentPage:i,getComments:s,callbacks:a}){this.shadowRoot=e,this.strings=t,this.locale=o,this.currentPage=i,this.getComments=s,this.callbacks=a,this.pageFilter="page",this.statusFilter="all",this.typeFilter="all",this.priorityFilter="all",this.detailId=null,this.el=null}isOpen(){return!!this.el}open(){this.el||(this.el=document.createElement("div"),this.el.className=n.INBOX_PANEL,this.el.setAttribute("role","dialog"),this.el.setAttribute("aria-label",this.strings.inboxAriaLabel),this.shadowRoot.appendChild(this.el),this.render())}close(){this._clearHighlight(),this.el?.remove(),this.el=null,this.detailId=null}refresh(){this.el&&this.render()}_highlight(e){if(this._clearHighlight(),e.anchorState!=="anchored"||e.hidden||e.status==="resolved")return;let t=this.shadowRoot.querySelector(`[data-comment-id="${e.id}"]`);t&&(t.classList.add(n.HIGHLIGHT),this._highlightedEl=t)}_clearHighlight(){this._highlightedEl?.classList.remove(n.HIGHLIGHT),this._highlightedEl=null}filteredComments(){let e=this.getComments();return this.pageFilter==="page"&&(e=e.filter(t=>t.page===this.currentPage)),this.statusFilter==="resolved"?e=e.filter(t=>t.status==="resolved"):this.statusFilter==="unresolved"&&(e=e.filter(t=>t.status!=="resolved")),this.typeFilter!=="all"&&(e=e.filter(t=>t.type===this.typeFilter)),this.priorityFilter!=="all"&&(e=e.filter(t=>t.priority===this.priorityFilter)),[...e.filter(t=>t.status!=="resolved"),...e.filter(t=>t.status==="resolved")]}render(){if(!this.el)return;this._clearHighlight(),this.el.innerHTML="";let e=this.filteredComments(),t=this.detailId!=null?e.find(o=>o.id===this.detailId):null;t?this._renderDetail(t,e):(this.detailId=null,this._renderList(e))}openDetail(e){this.el||this.open();let t=this.getComments().find(o=>o.id===e);t&&this._openDetail(t)}_openDetail(e){this.detailId=e.id,e.anchorState==="anchored"&&!e.hidden&&this.callbacks.onOpenDetailScroll(e),this.render()}_closeButton(){let e=document.createElement("button");return e.type="button",e.className=n.INBOX_CLOSE,e.setAttribute("aria-label",this.strings.close),e.innerHTML="&times;",e.addEventListener("click",()=>this.callbacks.onClose()),e}_renderList(e){let t=document.createElement("div");t.className=n.INBOX_HEADER,t.appendChild(this._buildFilter()),t.appendChild(this._closeButton()),this.el.appendChild(t);let o=document.createElement("div");if(o.className=n.INBOX_LIST,this.el.appendChild(o),e.length===0){let i=document.createElement("div");i.className=n.INBOX_EMPTY,i.textContent=this.strings.inboxEmpty,o.appendChild(i);return}for(let i of e)o.appendChild(this._buildCard(i,{interactive:!0}))}_pageFilterLabel(e){return e==="all"?this.strings.filterAll:this.strings.filterCurrentPage}_statusFilterLabel(e){return e==="unresolved"?this.strings.filterUnresolved:e==="resolved"?this.strings.filterResolved:this.strings.filterStatusAll}_filterSummaryLabel(){let e=[this._pageFilterLabel(this.pageFilter)];return this.statusFilter!=="all"&&e.push(this._statusFilterLabel(this.statusFilter)),this.typeFilter!=="all"&&e.push(I(this.typeFilter,this.strings)),this.priorityFilter!=="all"&&e.push(R(this.priorityFilter,this.strings)),e.join(" \xB7 ")}_buildFilter(){let e=document.createElement("div");e.className=n.INBOX_FILTER+"-wrapper";let t=this._filterSummaryLabel(),o=document.createElement("button");o.type="button",o.className=n.INBOX_FILTER,o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),o.innerHTML=`<span>${t}</span>${Tt}`;let i=document.createElement("div");i.className=n.INBOX_FILTER_MENU,i.style.display="none";let s=l=>{let c=document.createElement("div");c.className=n.INBOX_FILTER_SECTION,c.textContent=l,i.appendChild(c)},a=(l,c,p,h,m)=>{let u=document.createElement("button");u.type="button",u.className=n.INBOX_FILTER_OPTION,u.dataset[p]=h,u.setAttribute("role","menuitemradio"),u.setAttribute("aria-checked",String(c)),u.innerHTML=`<span>${l}</span>${c?"\u2713":""}`,u.addEventListener("click",d=>{d.stopPropagation(),m(),this.render()}),i.appendChild(u)};s(this.strings.filterByPage);for(let l of["all","page"])a(this._pageFilterLabel(l),this.pageFilter===l,"filterPage",l,()=>this.pageFilter=l);s(this.strings.filterByStatus);for(let l of["all","unresolved","resolved"])a(this._statusFilterLabel(l),this.statusFilter===l,"filterStatus",l,()=>this.statusFilter=l);s(this.strings.filterByType);for(let l of["all",...y])a(l==="all"?this.strings.filterStatusAll:I(l,this.strings),this.typeFilter===l,"filterType",l,()=>this.typeFilter=l);s(this.strings.filterByPriority);for(let l of["all",...S])a(l==="all"?this.strings.filterStatusAll:R(l,this.strings),this.priorityFilter===l,"filterPriority",l,()=>this.priorityFilter=l);return o.addEventListener("click",l=>{l.stopPropagation();let c=i.style.display!=="none";i.style.display=c?"none":"block",o.setAttribute("aria-expanded",String(!c))}),e.appendChild(o),e.appendChild(i),e}_buildCard(e,{interactive:t}){let o=document.createElement("div");o.className=n.INBOX_CARD,e.status==="resolved"&&o.classList.add(`${n.INBOX_CARD}--resolved`),o.dataset.commentId=e.id;let i=document.createElement("div");i.className=n.INBOX_CARD_HEADER,i.appendChild($(e.author,e.createdAt,this.strings,this.locale)),i.appendChild(this._buildCardActions(e)),o.appendChild(i);let s=document.createElement("div");if(s.className=n.INBOX_CARD_TEXT,s.textContent=e.text,o.appendChild(s),e.screenshots?.length){let c=H(e.screenshots,this.strings);c.querySelectorAll(`.${n.SCREENSHOT_IMG}`).forEach(p=>{p.addEventListener("click",h=>{h.stopPropagation(),this.callbacks.onShowLightbox(p.src)})}),o.appendChild(c)}let a=this._buildBadges(e);a&&o.appendChild(a);let l=this._buildTag(e);if(l&&o.appendChild(l),t){o.setAttribute("role","button"),o.setAttribute("tabindex","0");let c=()=>e.anchorState==="inactive"?this.callbacks.onNavigateToPage(e):this._openDetail(e),p=document.createElement("button");p.type="button",p.className=n.INBOX_CARD_REPLY_LINK,p.textContent=this.strings.replyLink,p.addEventListener("click",h=>{h.stopPropagation(),c()}),o.appendChild(p),o.addEventListener("click",c),o.addEventListener("keydown",h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),c())}),o.addEventListener("mouseenter",()=>this._highlight(e)),o.addEventListener("mouseleave",()=>this._clearHighlight())}return o}_buildTag(e){let t=null;if(e.anchorState==="orphaned"?t=this.strings.orphanedBadge:e.hidden?t=this.strings.hiddenBadge:e.anchorState==="inactive"&&(t=e.page),!t)return null;let o=document.createElement("span");return o.className=n.INBOX_CARD_TAG,o.textContent=t,o}_buildBadges(e){let t=document.createElement("div");t.className=n.INBOX_BADGES;let o=(i,s,a)=>{let l=document.createElement("span");l.className=`${n.BADGE} ${s}`,l.textContent=i,a&&(l.style.borderColor=a),t.appendChild(l)};e.type&&o(I(e.type,this.strings),n.BADGE_TYPE,w[e.type]),e.priority&&o(R(e.priority,this.strings),n.BADGE_PRIORITY,L[e.priority]);for(let i of e.tags||[])o(i,n.BADGE_TAG,null);if(e.status==="resolved"){let i=e.resolvedAt?X(new Date(e.resolvedAt).getTime()-new Date(e.createdAt).getTime(),this.strings):"";o(_(this.strings.resolvedInTemplate,i||"\u2014"),n.BADGE_DURATION,null)}return t.children.length?t:null}_buildContextBlock(e){let{context:t,contextScreenshot:o}=e;if(!t&&!o)return null;let i=document.createElement("div");i.className=n.CONTEXT_BLOCK;let s=document.createElement("div");if(s.className=n.INBOX_FILTER_SECTION,s.textContent=this.strings.contextSection,i.appendChild(s),o){let a=document.createElement("div");a.className=n.CONTEXT_SCREENSHOT_CAPTION,a.textContent=this.strings.autoScreenshotLabel,i.appendChild(a);let l=document.createElement("img");l.className=n.SCREENSHOT_IMG,l.src=o,l.alt=this.strings.autoScreenshotLabel,l.addEventListener("click",c=>{c.stopPropagation(),this.callbacks.onShowLightbox(o)}),i.appendChild(l)}if(t){let a=(p,h)=>{if(!h)return;let m=document.createElement("div");m.className=n.CONTEXT_ROW;let u=document.createElement("span");u.textContent=p;let d=document.createElement("span");d.textContent=h,m.appendChild(u),m.appendChild(d),i.appendChild(m)},l=p=>p?`${p.width}\xD7${p.height}`:"",c=p=>p?.name?`${p.name} ${p.version||""}`.trim():"";a(this.strings.contextUrl,t.url),a(this.strings.contextViewport,l(t.viewport)),a(this.strings.contextScreen,l(t.screen)),a(this.strings.contextBrowser,c(t.browser)),a(this.strings.contextOs,c(t.os))}return i}_buildCardActions(e){return V(e,{strings:this.strings,onCopy:t=>G(Y(t,{viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,strings:this.strings})),onSetStatus:(t,o)=>this.callbacks.onSetStatus(t.id,o),onSetType:(t,o)=>this.callbacks.onSetType(t.id,o),onSetPriority:(t,o)=>this.callbacks.onSetPriority(t.id,o),onDelete:t=>{this.detailId===t.id&&(this.detailId=null),this.callbacks.onDelete(t.id),this.render()}})}_renderDetail(e,t){let o=t.indexOf(e),i=document.createElement("div");i.className=n.INBOX_DETAIL_HEADER;let s=document.createElement("button");s.type="button",s.className=n.INBOX_BACK,s.innerHTML=`${Ct}<span>${this.strings.back}</span>`,s.addEventListener("click",()=>{this.detailId=null,this.render()}),i.appendChild(s);let a=document.createElement("div");a.className=n.INBOX_CARD_ACTIONS;let l=(m,u,d)=>{let E=document.createElement("button");E.type="button",E.className=n.INBOX_NAV_BTN,E.setAttribute("aria-label",u),E.title=u,E.innerHTML=m;let f=t[d];return E.disabled=!f,f&&E.addEventListener("click",()=>this._openDetail(f)),E};a.appendChild(l(xt,this.strings.prevComment,o-1)),a.appendChild(l(_t,this.strings.nextComment,o+1)),a.appendChild(this._closeButton()),i.appendChild(a),this.el.appendChild(i);let c=document.createElement("div");c.className=n.INBOX_DETAIL,c.appendChild(this._buildCard(e,{interactive:!1}));let p=this._buildContextBlock(e);p&&c.appendChild(p);let h=document.createElement("div");h.className=n.INBOX_REPLIES;for(let m of e.replies||[]){let u=k(m,this.strings,this.locale);u.querySelectorAll(`.${n.SCREENSHOT_IMG}`).forEach(d=>{d.addEventListener("click",E=>{E.stopPropagation(),this.callbacks.onShowLightbox(d.src)})}),h.appendChild(u)}c.appendChild(h),c.appendChild(this._buildReplyInput(e)),this.el.appendChild(c)}_buildReplyInput(e){let{container:t,inputEl:o,screenshotsContainer:i,attachBtn:s,fileInput:a,submitBtn:l}=z({areaClassName:n.THREAD_INPUT_AREA,inputTag:"input",inputClassName:n.THREAD_INPUT,inputPlaceholder:this.strings.replyPlaceholder},this.strings),c=[],p=()=>{i.innerHTML="",i.classList.toggle(n.ACTIVE,c.length>0),c.forEach((m,u)=>{let d=document.createElement("div");d.className=n.SCREENSHOT_ITEM;let E=document.createElement("img");E.className=n.SCREENSHOT_IMG,E.src=m,E.alt=this.strings.attachedScreenshot,E.onclick=()=>this.callbacks.onShowLightbox(m);let f=document.createElement("button");f.type="button",f.className=n.SCREENSHOT_REMOVE,f.setAttribute("aria-label",this.strings.removeScreenshot),f.innerHTML="&times;",f.onclick=g=>{g.stopPropagation(),c.splice(u,1),p()},d.appendChild(E),d.appendChild(f),i.appendChild(d)})};s.addEventListener("click",()=>a.click()),a.addEventListener("change",m=>{let u=m.target.files[0];if(!u||c.length>=5)return;let d=new FileReader;d.onload=E=>{c.push(E.target.result),p()},d.readAsDataURL(u),a.value=""});let h=()=>{let m=o.value.trim();!m&&c.length===0||(this.callbacks.onReply(e,m,[...c]),c=[],this.render())};return l.addEventListener("click",h),o.addEventListener("keydown",m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),h())}),t}};var Ot=r=>{let e=new Set;for(let t of r){let o=String(t).trim().toLowerCase();o&&e.add(o)}return[...e]},ie=class{constructor(e={}){this.comments=[],this.commentMode=!1,this.isMac=/Mac|iPod|iPhone|iPad/.test(navigator.userAgent),this.options={shortcutKey:e.shortcutKey||(this.isMac?"c":"C"),shortcutModifier:e.shortcutModifier||"alt",autoScreenshot:e.autoScreenshot!==!1,...e},this.locale=this.options.locale||Ee(),this.strings=fe(this.locale),this.resizeObservers=new Map,this.mutationObservers=new Map,this.positionValidationEnabled=!0,this._pendingRaf=null,this._pendingContextScreenshot=null,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.initOverlay()):this.initOverlay()}initOverlay(){this.shadowRoot=re(),this.toolbar=Ie(this.options,this.strings),this.commentBox=Re(this.strings),this.overlay=document.createElement("div"),this.overlay.className=n.COMMENT_OVERLAY,this.shadowRoot.appendChild(this.overlay),this.shadowRoot.appendChild(this.toolbar),this.shadowRoot.appendChild(this.commentBox),this.commentBtn=this.toolbar.querySelector(`.${n.TOOLBAR_COMMENT_BTN}`),this.inboxBtn=this.toolbar.querySelector(`.${n.TOOLBAR_MENU_BTN}`),this.submitButton=this.shadowRoot.getElementById(T.SUBMIT_COMMENT),this.commentInput=this.shadowRoot.getElementById(T.COMMENT_INPUT),this.attachImageBtn=this.commentBox.querySelector(`.${n.ATTACH_IMAGE_BTN}`),this.attachImageInput=this.shadowRoot.getElementById(T.ATTACH_IMAGE_INPUT),this.bindEventListeners(),this.setupKeyboardShortcut(),this.setupResizeHandlers(),this.injectStyles(),this.options.persistence==="localStorage"&&(this.loadComments(F()),this._openPendingDetail())}_navigateTo(e){location.assign(e)}_openPendingDetail(){let e=null;try{e=sessionStorage.getItem(U),e!=null&&sessionStorage.removeItem(U)}catch{return}if(!e)return;let t=this.comments.find(o=>String(o.id)===e);t&&(this.showInbox(),this.inboxView.openDetail(t.id))}_syncStorage(){this.options.persistence==="localStorage"&&oe(ne(F(),this.serializeComments(),location.pathname))}bindEventListeners(){this.commentBtn.addEventListener("click",()=>this.toggleCommentMode()),this.inboxBtn.addEventListener("click",()=>this.toggleInbox()),this.submitButton.addEventListener("click",()=>this.saveComment()),this.commentInput.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),this.saveComment())}),this.attachImageBtn.addEventListener("click",()=>{this.attachImageInput.click()}),this.attachImageInput.addEventListener("change",e=>{let t=e.target.files[0];if(!t||(this._pendingScreenshots||(this._pendingScreenshots=[]),this._pendingScreenshots.length>=5))return;let o=new FileReader;o.onload=i=>{this._pendingScreenshots.push(i.target.result),this._updateScreenshotsPreview()},o.readAsDataURL(t),this.attachImageInput.value=""}),this._handleDocumentClickBound=e=>this.handleDocumentClick(e),document.addEventListener("mousedown",this._handleDocumentClickBound)}setupKeyboardShortcut(){this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=e=>{if(e.key==="Escape"){this._activeLightbox?this.closeLightbox():this.activeThreadPopover?this.closeThreadPopover():this.inboxView?.isOpen()?this.closeInbox():this.commentBox.style.display!=="none"?(this.hideCommentBox(),this.toggleCommentMode()):this.commentMode&&this.toggleCommentMode();return}let t=this.isMac&&e.altKey&&(e.key==="\xE7"||e.key==="\xC7"),o=!this.isMac&&e.altKey&&e.key.toLowerCase()==="c",i=e.key.toLowerCase()===this.options.shortcutKey.toLowerCase()&&(this.options.shortcutModifier==="alt"&&e.altKey||this.options.shortcutModifier==="ctrl"&&(e.ctrlKey||e.metaKey)||this.options.shortcutModifier==="shift"&&e.shiftKey);if(t||o||i)return e.preventDefault(),e.stopPropagation(),this.toggleCommentMode(),!1},document.addEventListener("keydown",this.keydownHandler)}handleDocumentClick(e){if(!this.commentMode)return;let t=e.composedPath()[0]||e.target;if(!(this.toolbar.contains(t)||t?.closest?.(`.${n.CIRCLE}`)||t?.closest?.(`.${n.TOOLTIP}`)||t?.closest?.(`.${n.THREAD_POPOVER}`)||t?.closest?.(`.${n.INBOX_PANEL}`)||t?.closest?.(`.${n.LIGHTBOX}`))&&!this.commentBox.contains(t)){if(this.commentBox.style.display!=="none"){this.hideCommentBox(),this.toggleCommentMode();return}e.button===0&&(e.preventDefault(),this._dragStart={x:e.clientX,y:e.clientY},this._isDragging=!1,this._boundDragMove=o=>this._onDragMove(o),this._boundDragEnd=o=>this._onDragEnd(o),document.addEventListener("mousemove",this._boundDragMove),document.addEventListener("mouseup",this._boundDragEnd))}}_onDragMove(e){let t=e.clientX-this._dragStart.x,o=e.clientY-this._dragStart.y;if(!this._isDragging&&Math.hypot(t,o)<5)return;this._isDragging=!0;let i=Math.min(this._dragStart.x,e.clientX),s=Math.min(this._dragStart.y,e.clientY),a=Math.abs(t),l=Math.abs(o);this._selectionRect||(this._selectionRect=document.createElement("div"),this._selectionRect.className=n.SELECTION_RECT,this.shadowRoot.appendChild(this._selectionRect)),this._selectionRect.style.left=`${i}px`,this._selectionRect.style.top=`${s}px`,this._selectionRect.style.width=`${a}px`,this._selectionRect.style.height=`${l}px`}async _onDragEnd(e){if(document.removeEventListener("mousemove",this._boundDragMove),document.removeEventListener("mouseup",this._boundDragEnd),this._isDragging){let t=Math.min(this._dragStart.x,e.clientX),o=Math.min(this._dragStart.y,e.clientY),i=Math.abs(e.clientX-this._dragStart.x),s=Math.abs(e.clientY-this._dragStart.y);if(this._selectionRect?.remove(),this._selectionRect=null,i>10&&s>10)try{this._pendingScreenshots||(this._pendingScreenshots=[]);let a=await K(()=>q({scale:1})),l=ae(a,{left:t,top:o,width:i,height:s});l&&this._pendingScreenshots.length<5&&this._pendingScreenshots.push(l),this.options.autoScreenshot&&(this._pendingContextScreenshot=Z(a,{sourceScale:1}))}catch(a){console.warn("Screenshot capture failed:",a)}await this._placeCommentAtPoint(e.clientX,e.clientY)}else await this._placeCommentAtPoint(this._dragStart.x,this._dragStart.y);this._isDragging=!1,this._dragStart=null}async _placeCommentAtPoint(e,t){if(this.options.autoScreenshot&&!this._pendingContextScreenshot)try{let h=await K(()=>q({scale:D}));this._pendingContextScreenshot=Z(h,{sourceScale:D})}catch(h){console.warn("HellDots: automatic screenshot failed",h),this._pendingContextScreenshot=null}let o=this.overlay.style.pointerEvents;this.overlay.style.pointerEvents="none";let i=document.elementFromPoint(e,t);this.overlay.style.pointerEvents=o||"";let s=i?.closest?.(he.CONTAINER)||document.body,a=s.getBoundingClientRect(),l=a.width>0?(e-a.left)/a.width:0,c=a.height>0?(t-a.top)/a.height:0,p=Oe(s,l,c);p.targetSelector=i&&i!==s?_e(i):null,this.currentPosition={container:s,relativeX:l,relativeY:c,anchor:p,target:i||s},this.createPreviewCircle(e,t),document.body.classList.remove(n.COMMENT_CURSOR),this._pendingScreenshots&&this._pendingScreenshots.length>0&&this._updateScreenshotsPreview(),this.showCommentBox(e,t)}_updateScreenshotsPreview(){let e=this.commentBox.querySelector(`.${n.SCREENSHOTS_CONTAINER}`);if(e){if(e.innerHTML="",!this._pendingScreenshots||this._pendingScreenshots.length===0){e.classList.remove(n.ACTIVE);return}e.classList.add(n.ACTIVE),this._pendingScreenshots.forEach((t,o)=>{let i=document.createElement("div");i.className=n.SCREENSHOT_ITEM;let s=document.createElement("img");s.className=n.SCREENSHOT_IMG,s.src=t,s.alt=this.strings.attachedScreenshot,s.onclick=()=>this.showLightbox(t);let a=document.createElement("button");a.type="button",a.className=n.SCREENSHOT_REMOVE,a.setAttribute("aria-label",this.strings.removeScreenshot),a.innerHTML="&times;",a.onclick=l=>{l.stopPropagation(),this._pendingScreenshots.splice(o,1),this._updateScreenshotsPreview()},i.appendChild(s),i.appendChild(a),e.appendChild(i)})}}_clearScreenshotPreview(){this._pendingScreenshots=[];let e=this.commentBox.querySelector(`.${n.SCREENSHOTS_CONTAINER}`);e&&(e.innerHTML="",e.classList.remove(n.ACTIVE))}showCommentBox(e,t){this.commentBox.style.display="block";let o=300,s=28/2,a=s+10,l=window.innerWidth,c=window.innerHeight,p=e+s,h=t+s,m=p+a,u=h-s;m+o>l&&(m=p-a-o),m=Math.max(10,m);let d=this.commentBox.getBoundingClientRect();u+d.height>c&&(u=c-d.height-10),u=Math.max(10,u),this.commentBox.style.left=`${m}px`,this.commentBox.style.top=`${u}px`,this.commentInput.value="",setTimeout(()=>this.commentInput.focus(),50)}hideCommentBox(){this.commentBox.style.display="none",this.commentInput.style.height="auto",this.currentPosition=null,this.removePreviewCircle(),this._clearScreenshotPreview(),this._pendingContextScreenshot=null,this.commentBox.classify?.reset(),this.commentMode&&document.body.classList.add(n.COMMENT_CURSOR)}toggleCommentMode(){this.commentMode=!this.commentMode,this.commentBtn?.classList.toggle(n.ACTIVE,this.commentMode),this.commentBtn?.setAttribute("aria-pressed",String(this.commentMode)),this.overlay.classList.toggle(n.ACTIVE,this.commentMode),document.body.classList.toggle(n.COMMENT_CURSOR,this.commentMode),this.commentMode||this.hideCommentBox()}saveComment(){if(!this.commentInput.value.trim()||!this.currentPosition)return;let e={text:this.commentInput.value,container:this.currentPosition.container,relativeX:this.currentPosition.relativeX,relativeY:this.currentPosition.relativeY,anchor:this.currentPosition.anchor,anchorState:"anchored",target:this.currentPosition.target,hidden:!1,status:"open",page:location.pathname,id:Date.now(),replies:[],author:this.options.user?.name||this.strings.anonymous,createdAt:new Date().toISOString(),screenshots:this._pendingScreenshots?[...this._pendingScreenshots]:[],type:this.commentBox.classify?.getType()??null,priority:this.commentBox.classify?.getPriority()??null,tags:this.commentBox.classify?.getTags()??[],resolvedAt:null,context:ce(),contextScreenshot:this._pendingContextScreenshot};this.comments.push(e),this._syncStorage(),this.options.onCommentCreated?.(this._serializeComment(e)),this.renderCommentCircle(e),this.hideCommentBox(),this.toggleCommentMode();let t=this.shadowRoot.querySelector(`[data-comment-id="${e.id}"]`);t&&this.showThreadPopover(t,e)}renderCommentCircle(e){let t=we(e,this.strings);t.addEventListener("mouseenter",()=>this.showCommentTooltip(t,e)),t.addEventListener("mouseleave",()=>{setTimeout(()=>{let o=this.shadowRoot.querySelector(`.${n.TOOLTIP}[data-for="${e.id}"]`);o&&!o.matches(":hover")&&o.remove()},250)}),t.addEventListener("click",o=>{o.stopPropagation();let i=this.shadowRoot.querySelector(`.${n.TOOLTIP}[data-for="${e.id}"]`);i&&i.remove(),this.showThreadPopover(t,e)}),t.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t.click())}),this.overlay.appendChild(t),this.updateCommentPosition(e,t),this.createResizeObserver(e,t),this.createMutationObserver(e)}showCommentTooltip(e,t){if(this.shadowRoot.querySelector(`.${n.THREAD_POPOVER}[data-for="${t.id}"]`)||this.shadowRoot.querySelector(`.${n.TOOLTIP}[data-for="${t.id}"]`))return;let s=Le(t,this.strings,this.locale);this.shadowRoot.appendChild(s),s.querySelectorAll(`.${n.SCREENSHOT_IMG}`).forEach(a=>{a.addEventListener("click",l=>{l.stopPropagation(),this.showLightbox(a.src)})}),setTimeout(()=>{this.positionPopoverAtCircle(s,e)},10),s.querySelector(`.${n.CLOSE_TOOLTIP}`).addEventListener("click",a=>{a.stopPropagation(),s.remove()}),s.addEventListener("mouseleave",()=>s.remove())}toggleInbox(){this.inboxView?.isOpen()?this.closeInbox():this.showInbox()}showInbox(){this.closeThreadPopover(),this.inboxView||(this.inboxView=new j({shadowRoot:this.shadowRoot,strings:this.strings,locale:this.locale,currentPage:location.pathname,getComments:()=>this.comments,callbacks:{onOpenDetailScroll:e=>e.container?.scrollIntoView?.({block:"center"}),onReply:(e,t,o)=>this.addReply(e,t,o),onDelete:e=>this.deleteComment(e),onSetStatus:(e,t)=>this.setCommentStatus(e,t),onSetType:(e,t)=>this.setCommentType(e,t),onSetPriority:(e,t)=>this.setCommentPriority(e,t),onNavigateToPage:e=>{try{sessionStorage.setItem(U,String(e.id))}catch{}this._navigateTo(e.page)},onShowLightbox:e=>this.showLightbox(e),onClose:()=>this.closeInbox()}})),this.inboxView.open(),setTimeout(()=>{this._inboxClickHandler=e=>{let t=e.composedPath()[0]||e.target;!this.inboxView.el?.contains(t)&&!this.inboxBtn.contains(t)&&this.closeInbox()},document.addEventListener("mousedown",this._inboxClickHandler)},0)}closeInbox(){this.inboxView?.close(),this._inboxClickHandler&&(document.removeEventListener("mousedown",this._inboxClickHandler),this._inboxClickHandler=null)}showThreadPopover(e,t){this.closeThreadPopover();let o=this.shadowRoot.querySelector(`.${n.TOOLTIP}[data-for="${t.id}"]`);o&&o.remove();let i=Be(t,this.strings,this.locale);this.shadowRoot.appendChild(i);let s=i.querySelector(`.${n.THREAD_HEADER}`),a=V(t,{strings:this.strings,onCopy:g=>G(Y(g,{viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,strings:this.strings})),onSetStatus:(g,b)=>this.setCommentStatus(g.id,b),onSetType:(g,b)=>this.setCommentType(g.id,b),onSetPriority:(g,b)=>this.setCommentPriority(g.id,b),onDelete:g=>{this.closeThreadPopover(),this.deleteComment(g.id),this.inboxView?.isOpen()&&this.inboxView.refresh()}});s.insertBefore(a,s.querySelector(`.${n.CLOSE_TOOLTIP}`));let l=Array.from(i.children).find(g=>g.classList.contains(n.SCREENSHOTS_CONTAINER));l&&l.querySelectorAll(`.${n.SCREENSHOT_IMG}`).forEach(g=>{g.addEventListener("click",b=>{b.stopPropagation(),this.showLightbox(g.src)})}),setTimeout(()=>{e?this.positionPopoverAtCircle(i,e):this.centerPopover(i)},10),i.querySelector(`.${n.CLOSE_TOOLTIP}`).addEventListener("click",g=>{g.stopPropagation(),this.closeThreadPopover()});let c=i.querySelector(`.${n.THREAD_INPUT}`),p=i.querySelector(`.${n.THREAD_SUBMIT}`),h=i.querySelector(`.${n.THREAD_INPUT_AREA} .${n.ATTACH_IMAGE_BTN}`),m=i.querySelector(`.${n.THREAD_INPUT_AREA} input[type="file"]`),u=i.querySelector(`.${n.THREAD_INPUT_AREA} .${n.SCREENSHOTS_CONTAINER}`),d=[],E=()=>{if(u.innerHTML="",d.length===0){u.classList.remove(n.ACTIVE);return}u.classList.add(n.ACTIVE),d.forEach((g,b)=>{let C=document.createElement("div");C.className=n.SCREENSHOT_ITEM;let O=document.createElement("img");O.className=n.SCREENSHOT_IMG,O.src=g,O.alt=this.strings.attachedScreenshot,O.onclick=()=>this.showLightbox(g);let N=document.createElement("button");N.className=n.SCREENSHOT_REMOVE,N.innerHTML="&times;",N.onclick=W=>{W.stopPropagation(),d.splice(b,1),E()},C.appendChild(O),C.appendChild(N),u.appendChild(C)})};h.addEventListener("click",()=>{m.click()}),m.addEventListener("change",g=>{let b=g.target.files[0];if(!b||d.length>=5)return;let C=new FileReader;C.onload=O=>{d.push(O.target.result),E()},C.readAsDataURL(b),m.value=""});let f=()=>{let g=c.value.trim();if(!g&&d.length===0)return;let b=this.addReply(t,g,d.length>0?[...d]:[]),C=i.querySelector(`.${n.THREAD_REPLIES}`),O=k(b,this.strings,this.locale);C.appendChild(O),O.querySelectorAll(`.${n.SCREENSHOT_IMG}`).forEach(N=>{N.addEventListener("click",W=>{W.stopPropagation(),this.showLightbox(N.src)})}),c.value="",d=[],E(),c.focus()};p.addEventListener("click",f),c.addEventListener("keydown",g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),f())}),this.activeThreadPopover=i,setTimeout(()=>c.focus(),50),setTimeout(()=>{this._threadClickHandler=g=>{let b=g.composedPath()[0]||g.target;!i.contains(b)&&!e?.contains(b)&&this.closeThreadPopover()},document.addEventListener("mousedown",this._threadClickHandler)},0)}closeThreadPopover(){this.activeThreadPopover&&(this.activeThreadPopover.remove(),this.activeThreadPopover=null),this._threadClickHandler&&(document.removeEventListener("mousedown",this._threadClickHandler),this._threadClickHandler=null)}showLightbox(e){this.closeLightbox();let t=document.createElement("div");t.className=n.LIGHTBOX;let o=document.createElement("img");o.className=n.LIGHTBOX_IMG,o.src=e,o.alt=this.strings.screenshotPreview;let i=document.createElement("button");i.type="button",i.className=n.LIGHTBOX_CLOSE,i.setAttribute("aria-label",this.strings.close),i.innerHTML="&times;",i.addEventListener("click",()=>this.closeLightbox()),t.appendChild(o),t.appendChild(i),t.addEventListener("click",s=>{s.target===t&&this.closeLightbox()}),this.shadowRoot.appendChild(t),this._activeLightbox=t}closeLightbox(){this._activeLightbox?.remove(),this._activeLightbox=null}addReply(e,t,o=[]){e.replies||(e.replies=[]);let i={id:Date.now(),text:t,author:this.options.user?.name||this.strings.anonymous,timestamp:new Date().toISOString(),screenshots:o};return e.replies.push(i),this._syncStorage(),this.options.onReplyAdded?.(this._serializeComment(e),this._serializeReply(i)),i}_serializeReply({id:e,text:t,author:o,timestamp:i,screenshots:s}){return{id:e,text:t,author:o,timestamp:i,screenshots:s||[]}}_serializeComment(e){return{id:e.id,text:e.text,anchor:e.anchor||null,page:e.page||location.pathname,replies:(e.replies||[]).map(t=>this._serializeReply(t)),author:e.author,createdAt:e.createdAt,screenshots:e.screenshots||[],status:e.status||"open",type:e.type||null,priority:e.priority||null,tags:e.tags?[...e.tags]:[],resolvedAt:e.resolvedAt||null,context:e.context?{...e.context}:null,contextScreenshot:e.contextScreenshot||null}}setCommentStatus(e,t){if(!M.includes(t))return!1;let o=this.comments.find(s=>s.id===e);if(!o)return!1;if(o.status===t)return!0;o.status=t,o.resolvedAt=t==="resolved"?new Date().toISOString():null;let i=this.shadowRoot?.querySelector(`[data-comment-id="${e}"]`);return i&&this.updateCommentPosition(o,i),this._syncStorage(),this.inboxView?.isOpen()&&this.inboxView.refresh(),this.options.onCommentStatusChanged?.(this._serializeComment(o)),!0}_commitUpdate(e){return this._syncStorage(),this.inboxView?.isOpen()&&this.inboxView.refresh(),this.options.onCommentUpdated?.(this._serializeComment(e)),!0}setCommentType(e,t){if(t!==null&&!y.includes(t))return!1;let o=this.comments.find(i=>i.id===e);return o?(o.type=t,this._commitUpdate(o)):!1}setCommentPriority(e,t){if(t!==null&&!S.includes(t))return!1;let o=this.comments.find(i=>i.id===e);return o?(o.priority=t,this._commitUpdate(o)):!1}setCommentTags(e,t){if(!Array.isArray(t))return!1;let o=this.comments.find(i=>i.id===e);return o?(o.tags=Ot(t),this._commitUpdate(o)):!1}serializeComments(){return this.comments.map(e=>this._serializeComment(e))}deleteComment(e){return this.comments.some(t=>t.id===e)?(this._removeComment(e),this.options.persistence==="localStorage"&&oe(ne(F().filter(t=>t.id!==e),this.serializeComments(),location.pathname)),this.options.onCommentDeleted?.(e),!0):!1}_removeComment(e){if(this.cleanupResizeObserver(e),this.mutationObservers.has(e)){try{this.mutationObservers.get(e).disconnect()}catch{}this.mutationObservers.delete(e)}this.shadowRoot.querySelector(`[data-comment-id="${e}"]`)?.remove(),this.comments=this.comments.filter(t=>t.id!==e)}loadComments(e){let t=0,o=0,i=0;if(!Array.isArray(e))return{anchored:t,orphaned:o,inactive:i};for(let s of e){if(!s||s.id==null||typeof s.text!="string"){console.warn("HellDots: skipping malformed serialized comment",s);continue}this._removeComment(s.id);let a={id:s.id,text:s.text,anchor:s.anchor||null,anchorState:"orphaned",target:null,hidden:!1,page:s.page||location.pathname,container:null,relativeX:0,relativeY:0,replies:Array.isArray(s.replies)?[...s.replies]:[],author:s.author||this.strings.anonymous,createdAt:s.createdAt||new Date().toISOString(),screenshots:Array.isArray(s.screenshots)?[...s.screenshots]:[],status:s.status==="closed"?"resolved":M.includes(s.status)?s.status:"open",type:y.includes(s.type)?s.type:null,priority:S.includes(s.priority)?s.priority:null,tags:Array.isArray(s.tags)?[...s.tags]:[],resolvedAt:s.resolvedAt||null,context:s.context||null,contextScreenshot:s.contextScreenshot||null};if(s.page&&s.page!==location.pathname){a.anchorState="inactive",this.comments.push(a),i++;continue}let l=s.anchor?ye(s.anchor):null;l?(a.container=l.element,a.relativeX=s.anchor.relativeX,a.relativeY=s.anchor.relativeY,a.anchorState="anchored",this.comments.push(a),this.renderCommentCircle(a),t++):(this.comments.push(a),o++,this.options.onAnchorLost?.(this._serializeComment(a)))}return{anchored:t,orphaned:o,inactive:i}}centerPopover(e){let t=e.getBoundingClientRect(),o=Math.max(10,(window.innerWidth-(t.width||400))/2),i=Math.max(10,(window.innerHeight-t.height)/2);e.style.left=`${o}px`,e.style.top=`${i}px`}positionPopoverAtCircle(e,t){let o=t.getBoundingClientRect(),i=o.left+o.width/2,s=o.top+o.height/2,a=28,l=a/2+10,c=i+l,p=s-a/2;c+400>window.innerWidth&&(c=i-l-400),c=Math.max(10,c);let h=e.getBoundingClientRect();p+h.height>window.innerHeight&&(p=window.innerHeight-h.height-10),p=Math.max(10,p),e.style.left=`${c}px`,e.style.top=`${p}px`}createPreviewCircle(e,t){this.removePreviewCircle();let o=document.createElement("div");o.className=`${n.CIRCLE} ${n.PREVIEW_CIRCLE}`,o.style.position="absolute";let i=14;o.style.left=`${e+i}px`,o.style.top=`${t+i}px`,o.style.transform="translate(-50%, -50%)",o.style.pointerEvents="none",this.overlay.appendChild(o),this.previewCircle=o}removePreviewCircle(){this.previewCircle?.remove(),this.previewCircle=null}cleanupResizeObserver(e){if(this.resizeObservers&&this.resizeObservers.has(e)){let{circle:t,observer:o}=this.resizeObservers.get(e);o&&o.disconnect(),t&&t.parentNode&&t.parentNode.removeChild(t),this.resizeObservers.delete(e)}}validateAndCalculatePosition(e,t){if(!e.container||!t)return null;let o=e.container.getBoundingClientRect(),i=o.width,s=o.height;if(i<=0||s<=0)return null;let a=e.relativeX*i,l=e.relativeY*s,c=28,p=Math.max(0,Math.min(a,i-c)),h=Math.max(0,Math.min(l,s-c)),m=p/i,u=h/s;return{absoluteX:p,absoluteY:h,relativeX:m,relativeY:u,containerWidth:i,containerHeight:s,containerLeft:o.left,containerTop:o.top}}_isAnchorTargetVisible(e){let t=e.target;if((!t||!t.isConnected)&&e.anchor?.targetSelector){try{t=document.querySelector(e.anchor.targetSelector)}catch{t=null}e.target=t||null}if(!t||!t.isConnected)return!0;let o=t.getBoundingClientRect();return o.width>0&&o.height>0}_isMarkerOccluded(e,t,o){if(typeof document.elementsFromPoint!="function"||t<0||o<0||t>=window.innerWidth||o>=window.innerHeight)return!1;let s=document.elementsFromPoint(t,o).find(c=>c.tagName.toLowerCase()!==A.toLowerCase());if(!s)return!1;let a=e.target?.isConnected?e.target:null;if(a&&(a.contains(s)||s.contains(a)))return!1;let l=e.container;if(!l?.isConnected)return!1;if(!l.contains(s)&&!s.contains(l))return!0;if(l.contains(s)&&s!==l){for(let c=s;c&&c!==l;c=c.parentElement)if(this._looksLikeModalLayer(c,a))return!0}return!1}_looksLikeModalLayer(e,t){if(t&&e.contains(t))return!1;if(e.matches?.('dialog, [aria-modal="true"], [role="dialog"]'))return!0;if(getComputedStyle(e).position!=="fixed")return!1;let o=e.getBoundingClientRect();return o.width>=window.innerWidth*.5&&o.height>=window.innerHeight*.5}_dismissMarkerUi(e){this.shadowRoot.querySelector(`.${n.TOOLTIP}[data-for="${e.id}"]`)?.remove(),this.activeThreadPopover?.dataset.for===String(e.id)&&this.closeThreadPopover()}updateCommentPosition(e,t){if(e.status==="resolved"){t&&(t.style.display="none");return}let o=this.validateAndCalculatePosition(e,t);o&&!this._isAnchorTargetVisible(e)&&(o=null);let i=e.hidden===!0;if(!o){t&&e.container&&(e.hidden=!0,t.style.display="none",this._dismissMarkerUi(e),!i&&this.inboxView?.isOpen()&&this.inboxView.refresh());return}let s=14,a=o.containerLeft+o.absoluteX+s,l=o.containerTop+o.absoluteY+s;if(this._isMarkerOccluded(e,a,l)){e.hidden=!0,t.style.display="none",this._dismissMarkerUi(e),!i&&this.inboxView?.isOpen()&&this.inboxView.refresh();return}e.hidden=!1,t.style.display="",i&&this.inboxView?.isOpen()&&this.inboxView.refresh(),t.style.left=`${a}px`,t.style.top=`${l}px`,t.style.transform="translate(-50%, -50%)",t.style.position="absolute",e.relativeX=o.relativeX,e.relativeY=o.relativeY}setupResizeHandlers(){this.scheduleUpdatePositions=()=>{this._pendingRaf||(this._pendingRaf=requestAnimationFrame(()=>{this._pendingRaf=null,this.positionValidationEnabled&&this.comments.forEach(e=>{let t=this.shadowRoot.querySelector(`[data-comment-id="${e.id}"]`);t&&this.updateCommentPosition(e,t)})}))},this.windowResizeHandler=()=>{this.scheduleUpdatePositions()},window.addEventListener("resize",this.windowResizeHandler,{passive:!0}),this.scrollHandler=()=>{this.scheduleUpdatePositions()},window.addEventListener("scroll",this.scrollHandler,{capture:!0,passive:!0}),this.loadHandler=()=>{this.scheduleUpdatePositions()},window.addEventListener("load",this.loadHandler),window.MutationObserver&&(this._globalMutationObserver=new MutationObserver(()=>{this.scheduleUpdatePositions()}),this._globalMutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden","open"]}))}debugPosition(e,t){if(!e||!t)return;let o=e.container.getBoundingClientRect(),i=t.getBoundingClientRect(),s=e.relativeX*o.width,a=e.relativeY*o.height;console.log("Position Debug:",{commentId:e.id,relativePosition:{x:e.relativeX,y:e.relativeY},containerRect:{left:o.left,top:o.top,width:o.width,height:o.height},circlePosition:{left:i.left,top:i.top,centerX:i.left+i.width/2,centerY:i.top+i.height/2},expectedPosition:{x:s,y:a},offset:{x:i.left+i.width/2-(o.left+s),y:i.top+i.height/2-(o.top+a)}})}createResizeObserver(e,t){if(!window.ResizeObserver){console.warn("ResizeObserver not supported, position validation will be limited");return}let o=new ResizeObserver(i=>{if(this.positionValidationEnabled)for(let s of i)s.target===e.container&&this.updateCommentPosition(e,t)});o.observe(e.container),this.resizeObservers.set(e.id,{circle:t,observer:o,container:e.container})}createMutationObserver(e){if(!window.MutationObserver)return;if(this.mutationObservers.has(e.id)){try{this.mutationObservers.get(e.id).disconnect()}catch{}this.mutationObservers.delete(e.id)}let t=new MutationObserver(()=>{this.scheduleUpdatePositions()});t.observe(e.container,{attributes:!0,attributeFilter:void 0,childList:!0,subtree:!0}),this.mutationObservers.set(e.id,t)}cleanup(){this.closeThreadPopover(),this.closeInbox(),this.closeLightbox(),this.removePreviewCircle(),this._selectionRect?.remove(),this._pendingScreenshots=[],this._handleDocumentClickBound&&document.removeEventListener("mousedown",this._handleDocumentClickBound),this.windowResizeHandler&&window.removeEventListener("resize",this.windowResizeHandler),this.scrollHandler&&window.removeEventListener("scroll",this.scrollHandler,{capture:!0}),this.loadHandler&&window.removeEventListener("load",this.loadHandler),this._globalMutationObserver&&(this._globalMutationObserver.disconnect(),this._globalMutationObserver=null),this.resizeObservers&&(this.resizeObservers.forEach(({observer:e})=>{e&&e.disconnect()}),this.resizeObservers.clear()),this.mutationObservers&&(this.mutationObservers.forEach(e=>{try{e.disconnect()}catch{}}),this.mutationObservers.clear()),this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.toolbar&&this.toolbar.parentNode&&this.toolbar.parentNode.removeChild(this.toolbar),this.commentBox&&this.commentBox.parentNode&&this.commentBox.parentNode.removeChild(this.commentBox),this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),document.body.classList.remove(n.COMMENT_CURSOR),document.getElementById(T.GLOBAL_STYLES)?.remove(),this.comments.forEach(e=>{let t=this.shadowRoot.querySelector(`[data-comment-id="${e.id}"]`);t&&t.parentNode&&t.parentNode.removeChild(t)})}injectStyles(){let e=this.shadowRoot.getElementById(T.STYLES);e&&e.remove();let t=document.createElement("style");t.id=T.STYLES,t.textContent=ue(),this.shadowRoot.appendChild(t);let o=document.getElementById(T.GLOBAL_STYLES);o&&o.remove();let i=document.createElement("style");i.id=T.GLOBAL_STYLES,i.textContent=me(),document.head.appendChild(i)}},Me=ie;function yt(r={}){let{autoInit:e=!0,...t}=r,o=()=>new Me(t);return e?o():o}var fo=yt;export{Me as CommentOverlay,yt as createCommentOverlay,fo as default};
1453
+ `,t},W=(n,e)=>{let t=document.createElement("div");return t.className=o.SCREENSHOTS_CONTAINER,t.classList.add(o.ACTIVE),n.forEach(i=>{let s=document.createElement("div");s.className=o.SCREENSHOT_ITEM;let r=document.createElement("img");r.className=o.SCREENSHOT_IMG,r.src=i,r.alt=e.attachedScreenshot,s.appendChild(r),t.appendChild(s)}),t},lt=(n,e=N,t)=>{let i=document.createElement("div");i.className=o.TOOLTIP,i.dataset.for=n.id,i.setAttribute("role","dialog"),i.setAttribute("aria-label",e.tooltipAriaLabel);let s=document.createElement("div");s.className=o.THREAD_HEADER;let r=Y(n.author,n.createdAt,e,t,n.editedAt),a=document.createElement("button");a.type="button",a.className=o.CLOSE_TOOLTIP,a.setAttribute("aria-label",e.close),a.innerHTML="&times;",s.appendChild(r),s.appendChild(a);let l=document.createElement("div");l.className=o.THREAD_BODY,l.textContent=n.text,i.appendChild(s),i.appendChild(l);let c=Se(n,e,{includeStatus:!0});c&&i.appendChild(c);let p=n.screenshots||(n.screenshot?[n.screenshot]:[]);p.length>0&&i.appendChild(W(p,e));let h=n.replies?.length||0;if(h>0){let d=document.createElement("div");d.className=o.TOOLTIP_REPLY_COUNT,d.textContent=h===1?e.replyCountOne:v(e.replyCountTemplate,h),i.appendChild(d)}return i},j=(n,e=N,t,{onDelete:i,onEdit:s,editing:r=null}={})=>{let a=document.createElement("div");a.className=o.THREAD_REPLY,a.dataset.replyId=String(n.id);let l=Y(n.author,n.timestamp,e,t,n.editedAt),c=[];if(s&&c.push({label:e.editReply,onSelect:()=>s(n)}),i&&c.push({label:e.deleteReply,onSelect:()=>i(n,a),confirm:()=>({title:e.confirmDeleteReplyTitle,message:e.confirmDeleteReplyMessage,confirmLabel:e.confirmDelete,cancelLabel:e.confirmCancel})}),c.length>0){let d=Oe({label:e.replyOptions,items:c});d.classList.add(o.THREAD_REPLY_ACTIONS),l.appendChild(d)}let p;r?p=H({value:r.draft,strings:e,onInput:r.onInput,onSave:r.onSave,onCancel:r.onCancel}):(p=document.createElement("div"),p.className=o.THREAD_BODY,p.textContent=n.text),a.appendChild(l),a.appendChild(p);let h=n.screenshots||(n.screenshot?[n.screenshot]:[]);return h.length>0&&a.appendChild(W(h,e)),a},ct=(n,e=N,t,{onDeleteReply:i,onEditReply:s}={})=>{let r=document.createElement("div");r.className=o.THREAD_POPOVER,r.dataset.for=n.id,r.setAttribute("role","dialog"),r.setAttribute("aria-label",e.popoverAriaLabel);let a=document.createElement("div");a.className=o.THREAD_HEADER;let l=Y(n.author,n.createdAt,e,t,n.editedAt),c=document.createElement("button");c.type="button",c.className=o.CLOSE_TOOLTIP,c.setAttribute("aria-label",e.close),c.innerHTML="&times;",a.appendChild(l),a.appendChild(c);let p=document.createElement("div");p.className=o.THREAD_BODY,p.textContent=n.text;let h=document.createElement("div");h.className=o.THREAD_REPLIES,n.replies&&n.replies.forEach(u=>{h.appendChild(j(u,e,t,{onDelete:i,onEdit:s}))});let{container:d}=ae({areaClassName:o.THREAD_INPUT_AREA,inputTag:"input",inputClassName:o.THREAD_INPUT,inputPlaceholder:e.replyPlaceholder},e),g=document.createElement("div");g.className=o.THREAD_SCROLL,r.appendChild(a),g.appendChild(p);let m=n.screenshots||(n.screenshot?[n.screenshot]:[]);return m.length>0&&g.appendChild(W(m,e)),g.appendChild(h),r.appendChild(g),r.appendChild(d),r};var Zt=n=>{let e=[...n.attributes].map(({name:t,value:i})=>`${t}="${i}"`).join(" ");return`<${n.tagName.toLowerCase()}${e?` ${e}`:""}>`},Qt=n=>{if(!n?.tagName)return"(unknown)";let e=Object.entries(n.attributes||{}).map(([t,i])=>`${t}="${i}"`).join(" ");return`<${n.tagName.toLowerCase()}${e?` ${e}`:""}>`},Jt=n=>{let e=[],t=n;for(;t&&t!==document.documentElement;){let i=t.tagName.toLowerCase(),s=t.id?`#${t.id}`:"",r=[...t.classList].slice(0,2).map(a=>`.${a}`).join("");if(e.unshift(`${i}${s}${r}`),t===document.body)break;t=t.parentElement}return e.join(" > ")};function le(n,{viewportWidth:e,viewportHeight:t,strings:i}){let s=n.anchor,r=s?.fingerprint,a=n.container?.isConnected?n.container:null,l=n.hidden?"hidden":n.anchorState,c=a?Zt(a):Qt(r),p=a?Jt(a):"(unavailable)",h=n.context?.viewport,d=h?.width??e,g=h?.height??t,m=[`Page: ${n.page}`,`Viewport: ${d}x${g}`,`Anchor state: ${l}`,`Status: ${n.status||"open"}`,`Selector: ${s?.selector||"(none)"}`,`Element: ${c}`,`DOM path: ${p}`,`Nearby text: "${r?.textSnippet??""}"`,`Comment by ${n.author} (${n.createdAt}):`,`"${n.text}"`];n.type&&m.push(`Type: ${n.type}`),n.priority&&m.push(`Priority: ${n.priority}`),n.tags?.length&&m.push(`Tags: ${n.tags.join(", ")}`);let u=n.context;if(u&&(u.url&&m.push(`URL: ${u.url}`),u.screen&&m.push(`Screen: ${u.screen.width}x${u.screen.height}`),u.browser?.name&&m.push(`Browser: ${`${u.browser.name} ${u.browser.version||""}`.trim()}`),u.os?.name&&m.push(`OS: ${`${u.os.name} ${u.os.version||""}`.trim()}`)),i&&n.status==="resolved"&&n.resolvedAt){let b=J(new Date(n.resolvedAt).getTime()-new Date(n.createdAt).getTime(),i);b&&m.push(`Resolution time: ${b}`)}let f=n.replies||[];if(f.length>0){m.push(`Replies (${f.length}):`);for(let b of f)m.push(`- ${b.author}: "${b.text}"`)}return m.join(`
1454
+ `)}var eo='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>',ce=(n,{strings:e,onShowLightbox:t,collapsible:i=!1})=>{let{context:s,contextScreenshot:r}=n;if(!s&&!r)return null;let a=document.createElement("div");a.className=o.CONTEXT_BLOCK;let l=document.createElement("div");if(l.className=o.CONTEXT_BODY,i){let c=document.createElement("button");c.type="button",c.className=o.CONTEXT_TOGGLE,c.setAttribute("aria-expanded","false"),c.innerHTML=`<span>${e.contextSection}</span>${eo}`,l.style.display="none",c.addEventListener("click",p=>{p.stopPropagation();let h=c.getAttribute("aria-expanded")==="true";c.setAttribute("aria-expanded",String(!h)),l.style.display=h?"none":""}),a.appendChild(c)}else{let c=document.createElement("div");c.className=o.CONTEXT_TITLE,c.textContent=e.contextSection,a.appendChild(c)}if(r){let c=document.createElement("div");c.className=o.CONTEXT_SCREENSHOT_CAPTION,c.textContent=e.autoScreenshotLabel,l.appendChild(c);let p=document.createElement("img");p.className=o.SCREENSHOT_IMG,p.src=r,p.alt=e.autoScreenshotLabel,p.addEventListener("click",h=>{h.stopPropagation(),t(r)}),l.appendChild(p)}if(s){let c=(d,g)=>{if(!g)return;let m=document.createElement("div");m.className=o.CONTEXT_ROW;let u=document.createElement("span");u.textContent=d;let f=document.createElement("span");f.textContent=g,m.appendChild(u),m.appendChild(f),l.appendChild(m)},p=d=>d?`${d.width}\xD7${d.height}`:"",h=d=>d?.name?`${d.name} ${d.version||""}`.trim():"";c(e.contextUrl,s.url),c(e.contextViewport,p(s.viewport)),c(e.contextScreen,p(s.screen)),c(e.contextBrowser,h(s.browser)),c(e.contextOs,h(s.os))}return a.appendChild(l),a};var to='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>',oo='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"/></svg>',io='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"/></svg>',no='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>',de=class{constructor({shadowRoot:e,strings:t,locale:i,currentPage:s,getComments:r,callbacks:a,options:l={}}){this.shadowRoot=e,this.strings=t,this.locale=i,this.currentPage=s,this.getComments=r,this.callbacks=a,this.options=l,this.pageFilter="page",this.statusFilter="all",this.typeFilter="all",this.priorityFilter="all",this.detailId=null,this.editing=null,this.notice=null,this.el=null,this._highlightedEl=null,this._activeMarkerEl=null}isOpen(){return!!this.el}open(){this.el||(this.el=document.createElement("div"),this.el.className=o.INBOX_PANEL,this.el.setAttribute("role","dialog"),this.el.setAttribute("aria-label",this.strings.inboxAriaLabel),this.shadowRoot.appendChild(this.el),this.render())}close(){this._clearHighlight(),this._setActiveMarker(null),this.el?.remove(),this.el=null,this.detailId=null,this.editing=null,this.notice=null}refresh(){this.el&&this.render()}showNotice(e){this.notice=e,this.refresh()}clearNotice(){this.notice&&(this.notice=null,this.refresh())}isDirty(){return this.editing?this.editing.draft.trim()!==this._editingOriginalText().trim():!1}_editingOriginalText(){if(!this.editing)return"";let e=this.getComments().find(i=>String(i.id)===String(this.editing.commentId));return e?this.editing.replyId==null?e.text||"":(e.replies||[]).find(i=>String(i.id)===String(this.editing.replyId))?.text||"":""}async releaseEditor(){if(!this.editing)return!0;if(this.isDirty()){let e=this.el||this.shadowRoot;if(!await se(e,this.strings))return!1}return this.editing=null,!0}_editorHandlers(){return{draft:this.editing.draft,onInput:e=>{this.editing.draft=e},onSave:e=>{let{commentId:t,replyId:i}=this.editing;i==null?this.callbacks.onEditComment(t,e):this.callbacks.onEditReply(t,i,e),this.editing=null,this.render()},onCancel:async()=>{await this.releaseEditor()&&this.render()}}}_buildEditor(){let e=this._editorHandlers();return H({value:e.draft,strings:this.strings,onInput:e.onInput,onSave:e.onSave,onCancel:e.onCancel})}async startEditing(e,t=null){await this.releaseEditor()&&(this.detailId=e,this.editing={commentId:e,replyId:t,draft:""},this.editing.draft=this._editingOriginalText(),this.render())}_markerFor(e){return e.anchorState!=="anchored"||e.hidden||e.status==="resolved"?null:this.shadowRoot.querySelector(`[data-comment-id="${e.id}"]`)}_highlight(e){this._clearHighlight();let t=this._markerFor(e);t&&(t.classList.add(o.HIGHLIGHT),this._highlightedEl=t)}_clearHighlight(){this._highlightedEl?.classList.remove(o.HIGHLIGHT),this._highlightedEl=null}_setActiveMarker(e){if(this._activeMarkerEl?.classList.remove(o.CIRCLE_ACTIVE),this._activeMarkerEl=null,!e)return;let t=this._markerFor(e);t&&(t.classList.add(o.CIRCLE_ACTIVE),this._activeMarkerEl=t)}filteredComments(){let e=this.getComments();return this.pageFilter==="page"&&(e=e.filter(t=>t.page===this.currentPage)),this.statusFilter!=="all"&&(e=e.filter(t=>(t.status||"open")===this.statusFilter)),this.typeFilter!=="all"&&(e=e.filter(t=>t.type===this.typeFilter)),this.priorityFilter!=="all"&&(e=e.filter(t=>t.priority===this.priorityFilter)),[...e.filter(t=>t.status!=="resolved"),...e.filter(t=>t.status==="resolved")]}render(){if(!this.el)return;this._clearHighlight(),this.el.innerHTML="";let e=this.filteredComments(),t=this.detailId!=null?e.find(i=>i.id===this.detailId):null;this._setActiveMarker(t),t?this._renderDetail(t,e):(this.detailId=null,this._renderList(e))}openDetail(e){this.el||this.open();let t=this.getComments().find(i=>i.id===e);t&&this._openDetail(t)}_openDetail(e){this.detailId=e.id,e.anchorState==="anchored"&&!e.hidden&&this.callbacks.onOpenDetailScroll(e),this.render()}_closeButton(){let e=document.createElement("button");return e.type="button",e.className=o.INBOX_CLOSE,e.setAttribute("aria-label",this.strings.close),e.innerHTML="&times;",e.addEventListener("click",async()=>{this.editing&&!await this.releaseEditor()||this.callbacks.onClose()}),e}_renderList(e){let t=document.createElement("div");t.className=o.INBOX_HEADER,t.appendChild(this._buildFilter()),t.appendChild(this._closeButton()),this.el.appendChild(t);let i=document.createElement("div");if(i.className=o.INBOX_LIST,this.el.appendChild(i),this.notice){let s=document.createElement("div");s.className=o.INBOX_NOTICE,s.setAttribute("role","status"),s.textContent=this.notice,i.appendChild(s)}if(e.length===0){i.appendChild(this._buildEmptyState());return}for(let s of e)i.appendChild(this._buildCard(s,{interactive:!0}))}_buildEmptyState(){let e=document.createElement("div");e.className=o.INBOX_EMPTY;let t=document.createElement("div");t.className=o.INBOX_EMPTY_ICON,t.setAttribute("aria-hidden","true"),e.appendChild(t);let i=this.getComments().length>0,s=document.createElement("div");if(s.className=o.INBOX_EMPTY_TITLE,s.textContent=i?this.strings.inboxNoMatches:this.strings.inboxEmptyTitle,e.appendChild(s),i){let h=document.createElement("button");return h.type="button",h.className=o.INBOX_EMPTY_ACTION,h.textContent=this.strings.filterClear,h.addEventListener("click",()=>{this.pageFilter="page",this.statusFilter="all",this.typeFilter="all",this.priorityFilter="all",this.render()}),e.appendChild(h),e}let r=document.createElement("div");r.className=o.INBOX_EMPTY_TEXT;let[a,l]=String(this.strings.inboxEmptyHintTemplate).split("{n}"),c=document.createElement("kbd");c.className=o.INBOX_EMPTY_KBD,c.textContent=ve(this.options,this.strings),r.appendChild(document.createTextNode(a??"")),r.appendChild(c),r.appendChild(document.createTextNode(l??"")),e.appendChild(r);let p=document.createElement("button");return p.type="button",p.className=o.INBOX_EMPTY_ACTION,p.textContent=this.strings.inboxEmptyAction,p.addEventListener("click",()=>this.callbacks.onActivateCommentMode()),e.appendChild(p),e}_pageFilterLabel(e){return e==="all"?this.strings.filterAll:this.strings.filterCurrentPage}_filterSummaryLabel(){let e=[this._pageFilterLabel(this.pageFilter)];return this.statusFilter!=="all"&&e.push(k(this.statusFilter,this.strings)),this.typeFilter!=="all"&&e.push(B(this.typeFilter,this.strings)),this.priorityFilter!=="all"&&e.push(M(this.priorityFilter,this.strings)),e.join(" \xB7 ")}_isFilterActive(){return this.pageFilter!=="page"||this.statusFilter!=="all"||this.typeFilter!=="all"||this.priorityFilter!=="all"}_buildFilterGroup({title:e,dataAttr:t,values:i,labelOf:s,selected:r,toggles:a=!0,onSelect:l}){let c=document.createElement("div");c.className=o.INBOX_FILTER_GROUP;let p=document.createElement("div");p.className=o.INBOX_FILTER_SECTION,p.textContent=e,c.appendChild(p);let h=document.createElement("div");h.className=o.INBOX_FILTER_CHIPS;for(let d of i){let g=r===d,m=document.createElement("button");m.type="button",m.className=o.INBOX_FILTER_CHIP,m.dataset[t]=d,m.setAttribute("role",a?"switch":"radio"),m.setAttribute("aria-checked",String(g)),m.textContent=s(d),m.addEventListener("click",u=>{u.stopPropagation(),l(a&&g?"all":d),this.render()}),h.appendChild(m)}return c.appendChild(h),c}_buildFilter(){let e=document.createElement("div");e.className=o.INBOX_FILTER+"-wrapper";let t=document.createElement("button");t.type="button",t.className=o.INBOX_FILTER,t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded","false"),t.innerHTML=`<span>${this._filterSummaryLabel()}</span>${to}`;let i=document.createElement("div");i.className=o.INBOX_FILTER_MENU,i.setAttribute("role","group"),i.setAttribute("aria-label",this.strings.filterTitle),z(t,i);let s=document.createElement("div");s.className=o.INBOX_FILTER_MENU_HEADER;let r=document.createElement("span");r.textContent=this.strings.filterTitle,s.appendChild(r);let a=document.createElement("button");return a.type="button",a.className=o.INBOX_FILTER_CLEAR,a.textContent=this.strings.filterClear,a.disabled=!this._isFilterActive(),a.addEventListener("click",l=>{l.stopPropagation(),this.pageFilter="page",this.statusFilter="all",this.typeFilter="all",this.priorityFilter="all",this.render()}),s.appendChild(a),i.appendChild(s),i.appendChild(this._buildFilterGroup({title:this.strings.filterByPage,dataAttr:"filterPage",values:["page","all"],labelOf:l=>this._pageFilterLabel(l),selected:this.pageFilter,toggles:!1,onSelect:l=>this.pageFilter=l})),i.appendChild(this._buildFilterGroup({title:this.strings.filterByStatus,dataAttr:"filterStatus",values:[...L],labelOf:l=>k(l,this.strings),selected:this.statusFilter,onSelect:l=>this.statusFilter=l})),i.appendChild(this._buildFilterGroup({title:this.strings.filterByType,dataAttr:"filterType",values:[...R],labelOf:l=>B(l,this.strings),selected:this.typeFilter,onSelect:l=>this.typeFilter=l})),i.appendChild(this._buildFilterGroup({title:this.strings.filterByPriority,dataAttr:"filterPriority",values:[...I],labelOf:l=>M(l,this.strings),selected:this.priorityFilter,onSelect:l=>this.priorityFilter=l})),e.appendChild(t),e.appendChild(i),e}_buildCard(e,{interactive:t}){let i=document.createElement("div");i.className=o.INBOX_CARD,e.status==="resolved"&&i.classList.add(`${o.INBOX_CARD}--resolved`),i.dataset.commentId=e.id;let s=document.createElement("div");s.className=o.INBOX_CARD_HEADER,s.appendChild(Y(e.author,e.createdAt,this.strings,this.locale,e.editedAt)),i.appendChild(s);let r=document.createElement("div");if(r.className=o.THREAD_ACTIONS_ROW,r.appendChild(this._buildCardActions(e)),i.appendChild(r),!t&&this.editing&&this.editing.replyId==null&&String(this.editing.commentId)===String(e.id))i.appendChild(this._buildEditor());else{let p=document.createElement("div");p.className=o.INBOX_CARD_TEXT,p.textContent=e.text,i.appendChild(p)}if(e.screenshots?.length){let p=W(e.screenshots,this.strings);p.querySelectorAll(`.${o.SCREENSHOT_IMG}`).forEach(h=>{h.addEventListener("click",d=>{d.stopPropagation(),this.callbacks.onShowLightbox(h.src)})}),i.appendChild(p)}let l=Se(e,this.strings,{includeClassification:!1});l&&i.appendChild(l);let c=this._buildTag(e);if(c&&i.appendChild(c),t){i.setAttribute("role","button"),i.setAttribute("tabindex","0");let p=()=>e.anchorState==="inactive"?this.callbacks.onNavigateToPage(e):this._openDetail(e),h=document.createElement("button");h.type="button",h.className=o.INBOX_CARD_REPLY_LINK,h.textContent=this.strings.replyLink,h.addEventListener("click",d=>{d.stopPropagation(),p()}),i.appendChild(h),i.addEventListener("click",p),i.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),p())}),i.addEventListener("mouseenter",()=>this._highlight(e)),i.addEventListener("mouseleave",()=>this._clearHighlight())}return i}_buildTag(e){let t=null;if(e.anchorState==="orphaned"?t=this.strings.orphanedBadge:e.hidden?t=this.strings.hiddenBadge:e.anchorState==="inactive"&&(t=e.page),!t)return null;let i=document.createElement("span");return i.className=o.INBOX_CARD_TAG,i.textContent=t,i}_buildCardActions(e){return re(e,{strings:this.strings,onCopy:t=>$(le(t,{viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,strings:this.strings})),onCopyLink:t=>$(G(t,this.options.linkParam)),onEdit:t=>this.startEditing(t.id),onSetStatus:(t,i)=>this.callbacks.onSetStatus(t.id,i),onSetType:(t,i)=>this.callbacks.onSetType(t.id,i),onSetPriority:(t,i)=>this.callbacks.onSetPriority(t.id,i),onDelete:t=>{this.detailId===t.id&&(this.detailId=null),this.callbacks.onDelete(t.id),this.render()}})}_renderDetail(e,t){let i=t.indexOf(e),s=document.createElement("div");s.className=o.INBOX_DETAIL_HEADER;let r=document.createElement("button");r.type="button",r.className=o.INBOX_BACK,r.innerHTML=`${oo}<span>${this.strings.back}</span>`,r.addEventListener("click",async()=>{this.editing&&!await this.releaseEditor()||(this.detailId=null,this.render())}),s.appendChild(r);let a=document.createElement("div");a.className=o.INBOX_CARD_ACTIONS;let l=(d,g,m)=>{let u=document.createElement("button");u.type="button",u.className=o.INBOX_NAV_BTN,u.setAttribute("aria-label",g),u.title=g,u.innerHTML=d;let f=t[m];return u.disabled=!f,f&&u.addEventListener("click",async()=>{this.editing&&!await this.releaseEditor()||this._openDetail(f)}),u};a.appendChild(l(io,this.strings.prevComment,i-1)),a.appendChild(l(no,this.strings.nextComment,i+1)),a.appendChild(this._closeButton()),s.appendChild(a),this.el.appendChild(s);let c=document.createElement("div");c.className=o.INBOX_DETAIL,c.appendChild(this._buildCard(e,{interactive:!1}));let p=ce(e,{strings:this.strings,onShowLightbox:d=>this.callbacks.onShowLightbox(d)});p&&c.appendChild(p);let h=document.createElement("div");h.className=o.INBOX_REPLIES;for(let d of e.replies||[]){let g=this.editing&&String(this.editing.commentId)===String(e.id)&&String(this.editing.replyId)===String(d.id),m=j(d,this.strings,this.locale,{onDelete:(u,f)=>{this.callbacks.onDeleteReply(e.id,u.id)&&f.remove()},onEdit:u=>this.startEditing(e.id,u.id),editing:g?this._editorHandlers():null});m.querySelectorAll(`.${o.SCREENSHOT_IMG}`).forEach(u=>{u.addEventListener("click",f=>{f.stopPropagation(),this.callbacks.onShowLightbox(u.src)})}),h.appendChild(m)}c.appendChild(h),c.appendChild(this._buildReplyInput(e)),this.el.appendChild(c)}_buildReplyInput(e){let{container:t,inputEl:i,screenshotsContainer:s,attachBtn:r,fileInput:a,submitBtn:l}=ae({areaClassName:o.THREAD_INPUT_AREA,inputTag:"input",inputClassName:o.THREAD_INPUT,inputPlaceholder:this.strings.replyPlaceholder},this.strings),c=[],p=()=>{s.innerHTML="",s.classList.toggle(o.ACTIVE,c.length>0),c.forEach((d,g)=>{let m=document.createElement("div");m.className=o.SCREENSHOT_ITEM;let u=document.createElement("img");u.className=o.SCREENSHOT_IMG,u.src=d,u.alt=this.strings.attachedScreenshot,u.onclick=()=>this.callbacks.onShowLightbox(d);let f=document.createElement("button");f.type="button",f.className=o.SCREENSHOT_REMOVE,f.setAttribute("aria-label",this.strings.removeScreenshot),f.innerHTML="&times;",f.onclick=b=>{b.stopPropagation(),c.splice(g,1),p()},m.appendChild(u),m.appendChild(f),s.appendChild(m)})};r.addEventListener("click",()=>a.click()),a.addEventListener("change",d=>{let g=d.target.files[0];if(!g||c.length>=5)return;let m=new FileReader;m.onload=u=>{c.push(u.target.result),p()},m.readAsDataURL(g),a.value=""});let h=()=>{let d=i.value.trim();!d&&c.length===0||(this.callbacks.onReply(e,d,[...c]),c=[],this.render())};return l.addEventListener("click",h),i.addEventListener("keydown",d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),h())}),t}};var ro=n=>{let e=new Set;for(let t of n){let i=String(t).trim().toLowerCase();i&&e.add(i)}return[...e]},Ae=class{constructor(e={}){this.comments=[],this.commentMode=!1,this.isMac=/Mac|iPod|iPhone|iPad/.test(navigator.userAgent),this.options={shortcutKey:e.shortcutKey||(this.isMac?"c":"C"),shortcutModifier:e.shortcutModifier||"alt",autoScreenshot:e.autoScreenshot!==!1,...e},this.locale=this.options.locale||Xe(),this.strings=Fe(this.locale),this.resizeObservers=new Map,this.mutationObservers=new Map,this.positionValidationEnabled=!0,this._pendingRaf=null,this._pendingContextScreenshot=null,this._popoverEditing=null,this._pendingDetailId=null,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.initOverlay()):this.initOverlay()}initOverlay(){this.shadowRoot=Re(),this.toolbar=rt(this.options,this.strings),this.commentBox=st(this.strings),this.overlay=document.createElement("div"),this.overlay.className=o.COMMENT_OVERLAY,this.shadowRoot.appendChild(this.overlay),this.shadowRoot.appendChild(this.toolbar),this.shadowRoot.appendChild(this.commentBox),this.commentBtn=this.toolbar.querySelector(`.${o.TOOLBAR_COMMENT_BTN}`),this.inboxBtn=this.toolbar.querySelector(`.${o.TOOLBAR_MENU_BTN}`),this.submitButton=this.shadowRoot.getElementById(T.SUBMIT_COMMENT),this.commentInput=this.shadowRoot.getElementById(T.COMMENT_INPUT),this.attachImageBtn=this.commentBox.querySelector(`.${o.ATTACH_IMAGE_BTN}`),this.attachImageInput=this.shadowRoot.getElementById(T.ATTACH_IMAGE_INPUT),this.bindEventListeners(),this.setupKeyboardShortcut(),this.setupResizeHandlers(),this.injectStyles(),this._pendingDetailId=this._readPendingDetailId(),this.options.persistence==="localStorage"&&this.loadComments(te()),this._openPendingDetail()}_navigateTo(e){location.assign(e)}_readPendingDetailId(){let e=Je(this._linkParam()),t=null;try{t=sessionStorage.getItem(ee),t!=null&&sessionStorage.removeItem(ee)}catch{}return e??t}_linkParam(){return this.options.linkParam||oe}_openPendingDetail(){let e=this._pendingDetailId;if(!e)return;let t=this.comments.find(i=>String(i.id)===String(e));if(!t){this.showInbox(),this.inboxView?.showNotice(this.strings.commentNotFound);return}this._pendingDetailId=null,this.showInbox(),this.inboxView.clearNotice(),this.inboxView.openDetail(t.id)}_popoverBodyEl(e=null){let t=this.activeThreadPopover;return t?e==null?t.querySelector(`.${o.THREAD_SCROLL} > .${o.THREAD_BODY}, .${o.THREAD_SCROLL} > .${o.EDITOR}`):t.querySelector(`.${o.THREAD_REPLY}[data-reply-id="${e}"]`)?.querySelector(`.${o.THREAD_BODY}, .${o.EDITOR}`)||null:null}_refreshCommentViews(e,t=null){if(this.activeThreadPopover?.dataset.for!==String(e))return;let i=this.comments.find(l=>String(l.id)===String(e));if(!i)return;let s=t==null?i:(i.replies||[]).find(l=>String(l.id)===String(t));if(!s)return;let r=document.createElement("div");r.className=o.THREAD_BODY,r.textContent=s.text,this._popoverBodyEl(t)?.replaceWith(r);let a=t==null?this.activeThreadPopover.querySelector(`.${o.THREAD_META}`):this.activeThreadPopover.querySelector(`.${o.THREAD_REPLY}[data-reply-id="${t}"]`)?.querySelector(`.${o.THREAD_META}`);if(a&&s.editedAt&&!a.querySelector(`.${o.THREAD_EDITED}`)){let l=ye(s.editedAt,this.strings,this.locale),c=a.querySelector(`.${o.THREAD_REPLY_ACTIONS}`);c?a.insertBefore(l,c):a.appendChild(l)}}_popoverEditorDirty(){if(!this._popoverEditing)return!1;let{commentId:e,replyId:t,draft:i}=this._popoverEditing,s=this.comments.find(a=>String(a.id)===String(e)),r=t==null?s:(s?.replies||[]).find(a=>String(a.id)===String(t));return i.trim()!==String(r?.text||"").trim()}async _releasePopoverEditor(){if(!this._popoverEditing)return!0;if(this._popoverEditorDirty()){let t=this.shadowRoot;if(!await se(t,this.strings))return!1}let{replyId:e}=this._popoverEditing;return this._popoverEditing=null,this._restorePopoverBody(e),!0}_restorePopoverBody(e){let t=this.comments.find(r=>String(r.id)===String(this.activeThreadPopover?.dataset.for));if(!t)return;let i=e==null?t:(t.replies||[]).find(r=>String(r.id)===String(e));if(!i)return;let s=document.createElement("div");s.className=o.THREAD_BODY,s.textContent=i.text,this._popoverBodyEl(e)?.replaceWith(s)}async _startPopoverEditing(e,t=null){if(!await this._releasePopoverEditor())return;let i=this.comments.find(a=>String(a.id)===String(e)),s=t==null?i:(i?.replies||[]).find(a=>String(a.id)===String(t));if(!s)return;this._popoverEditing={commentId:e,replyId:t,draft:s.text};let r=H({value:s.text,strings:this.strings,onInput:a=>{this._popoverEditing.draft=a},onSave:a=>{let l=t==null?this.editComment(e,a):this.editReply(e,t,a);this._popoverEditing=null,l?(this._refreshCommentViews(e,t),this.inboxView?.isOpen()&&this.inboxView.refresh()):this._restorePopoverBody(t)},onCancel:()=>{this._releasePopoverEditor()}});this._popoverBodyEl(t)?.replaceWith(r)}commentLink(e){let t=this.comments.find(i=>String(i.id)===String(e));return t?G(t,this._linkParam()):null}_syncStorage(){this.options.persistence==="localStorage"&&Ce(Te(te(),this.serializeComments(),location.pathname))}bindEventListeners(){this.commentBtn.addEventListener("click",()=>this.toggleCommentMode()),this.inboxBtn.addEventListener("click",()=>this.toggleInbox()),this.submitButton.addEventListener("click",()=>this.saveComment()),this.commentInput.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),this.saveComment())}),this.attachImageBtn.addEventListener("click",()=>{this.attachImageInput.click()}),this.attachImageInput.addEventListener("change",e=>{let t=e.target.files[0];if(!t||(this._pendingScreenshots||(this._pendingScreenshots=[]),this._pendingScreenshots.length>=5))return;let i=new FileReader;i.onload=s=>{this._pendingScreenshots.push(s.target.result),this._updateScreenshotsPreview()},i.readAsDataURL(t),this.attachImageInput.value=""}),this._handleDocumentClickBound=e=>this.handleDocumentClick(e),document.addEventListener("mousedown",this._handleDocumentClickBound)}setupKeyboardShortcut(){this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=e=>{if(e.key==="Escape"){this._activeLightbox?this.closeLightbox():this.activeThreadPopover?this._popoverEditing?this._releasePopoverEditor():this.closeThreadPopover():this.inboxView?.isOpen()?this.inboxView.editing?this.inboxView.releaseEditor().then(r=>r&&this.inboxView?.refresh()):this.closeInbox():this.commentBox.style.display!=="none"?(this.hideCommentBox(),this.toggleCommentMode()):this.commentMode&&this.toggleCommentMode();return}let t=this.isMac&&e.altKey&&(e.key==="\xE7"||e.key==="\xC7"),i=!this.isMac&&e.altKey&&e.key.toLowerCase()==="c",s=e.key.toLowerCase()===this.options.shortcutKey.toLowerCase()&&(this.options.shortcutModifier==="alt"&&e.altKey||this.options.shortcutModifier==="ctrl"&&(e.ctrlKey||e.metaKey)||this.options.shortcutModifier==="shift"&&e.shiftKey);if(t||i||s)return e.preventDefault(),e.stopPropagation(),this.toggleCommentMode(),!1},document.addEventListener("keydown",this.keydownHandler)}handleDocumentClick(e){if(!this.commentMode)return;let t=e.composedPath()[0]||e.target;if(!(this.toolbar.contains(t)||t?.closest?.(`.${o.CIRCLE}`)||t?.closest?.(`.${o.TOOLTIP}`)||t?.closest?.(`.${o.THREAD_POPOVER}`)||t?.closest?.(`.${o.INBOX_PANEL}`)||t?.closest?.(`.${o.LIGHTBOX}`))&&!this.commentBox.contains(t)){if(this.commentBox.style.display!=="none"){this.hideCommentBox(),this.toggleCommentMode();return}e.button===0&&(e.preventDefault(),this._dragStart={x:e.clientX,y:e.clientY},this._isDragging=!1,this._boundDragMove=i=>this._onDragMove(i),this._boundDragEnd=i=>this._onDragEnd(i),document.addEventListener("mousemove",this._boundDragMove),document.addEventListener("mouseup",this._boundDragEnd))}}_onDragMove(e){let t=e.clientX-this._dragStart.x,i=e.clientY-this._dragStart.y;if(!this._isDragging&&Math.hypot(t,i)<5)return;this._isDragging=!0;let s=Math.min(this._dragStart.x,e.clientX),r=Math.min(this._dragStart.y,e.clientY),a=Math.abs(t),l=Math.abs(i);this._selectionRect||(this._selectionRect=document.createElement("div"),this._selectionRect.className=o.SELECTION_RECT,this.shadowRoot.appendChild(this._selectionRect)),this._selectionRect.style.left=`${s}px`,this._selectionRect.style.top=`${r}px`,this._selectionRect.style.width=`${a}px`,this._selectionRect.style.height=`${l}px`}async _onDragEnd(e){if(document.removeEventListener("mousemove",this._boundDragMove),document.removeEventListener("mouseup",this._boundDragEnd),this._isDragging){let t=Math.min(this._dragStart.x,e.clientX),i=Math.min(this._dragStart.y,e.clientY),s=Math.abs(e.clientX-this._dragStart.x),r=Math.abs(e.clientY-this._dragStart.y);if(this._selectionRect?.remove(),this._selectionRect=null,s>10&&r>10)try{this._pendingScreenshots||(this._pendingScreenshots=[]);let a=await he(()=>pe({scale:1})),l=Ne(a,{left:t,top:i,width:s,height:r});l&&this._pendingScreenshots.length<5&&this._pendingScreenshots.push(l),this.options.autoScreenshot&&(this._pendingContextScreenshot=ue(a,{sourceScale:1}))}catch(a){console.warn("Screenshot capture failed:",a)}await this._placeCommentAtPoint(e.clientX,e.clientY)}else await this._placeCommentAtPoint(this._dragStart.x,this._dragStart.y);this._isDragging=!1,this._dragStart=null}async _placeCommentAtPoint(e,t){if(this.options.autoScreenshot&&!this._pendingContextScreenshot)try{let h=await he(()=>pe({scale:K}));this._pendingContextScreenshot=ue(h,{sourceScale:K})}catch(h){console.warn("HellDots: automatic screenshot failed",h),this._pendingContextScreenshot=null}let i=this.overlay.style.pointerEvents;this.overlay.style.pointerEvents="none";let s=document.elementFromPoint(e,t);this.overlay.style.pointerEvents=i||"";let r=s?.closest?.(Me.CONTAINER)||document.body,a=r.getBoundingClientRect(),l=a.width>0?(e-a.left)/a.width:0,c=a.height>0?(t-a.top)/a.height:0,p=We(r,l,c);p.targetSelector=s&&s!==r?Ye(s):null,this.currentPosition={container:r,relativeX:l,relativeY:c,anchor:p,target:s||r},this.createPreviewCircle(e,t),document.body.classList.remove(o.COMMENT_CURSOR),this._pendingScreenshots&&this._pendingScreenshots.length>0&&this._updateScreenshotsPreview(),this.showCommentBox(e,t)}_updateScreenshotsPreview(){let e=this.commentBox.querySelector(`.${o.SCREENSHOTS_CONTAINER}`);if(e){if(e.innerHTML="",!this._pendingScreenshots||this._pendingScreenshots.length===0){e.classList.remove(o.ACTIVE);return}e.classList.add(o.ACTIVE),this._pendingScreenshots.forEach((t,i)=>{let s=document.createElement("div");s.className=o.SCREENSHOT_ITEM;let r=document.createElement("img");r.className=o.SCREENSHOT_IMG,r.src=t,r.alt=this.strings.attachedScreenshot,r.onclick=()=>this.showLightbox(t);let a=document.createElement("button");a.type="button",a.className=o.SCREENSHOT_REMOVE,a.setAttribute("aria-label",this.strings.removeScreenshot),a.innerHTML="&times;",a.onclick=l=>{l.stopPropagation(),this._pendingScreenshots.splice(i,1),this._updateScreenshotsPreview()},s.appendChild(r),s.appendChild(a),e.appendChild(s)})}}_clearScreenshotPreview(){this._pendingScreenshots=[];let e=this.commentBox.querySelector(`.${o.SCREENSHOTS_CONTAINER}`);e&&(e.innerHTML="",e.classList.remove(o.ACTIVE))}showCommentBox(e,t){this.commentBox.style.display="block";let s=28/2,r=s+10,a=window.innerWidth,l=window.innerHeight,c=this.commentBox.getBoundingClientRect(),p=c.width||400,h=e+s,d=t+s,g=h+r,m=d-s;g+p>a&&(g=h-r-p),g=Math.min(g,a-p-10),g=Math.max(10,g),m+c.height>l&&(m=l-c.height-10),m=Math.max(10,m),this.commentBox.style.left=`${g}px`,this.commentBox.style.top=`${m}px`,this.commentInput.value="",setTimeout(()=>this.commentInput.focus(),50)}hideCommentBox(){this.commentBox.style.display="none",this.commentInput.style.height="auto",this.currentPosition=null,this.removePreviewCircle(),this._clearScreenshotPreview(),this._pendingContextScreenshot=null,this.commentBox.classify?.reset(),this.commentMode&&document.body.classList.add(o.COMMENT_CURSOR)}toggleCommentMode(){this.commentMode=!this.commentMode,this.commentMode&&this.closeInbox(),this.commentBtn?.classList.toggle(o.ACTIVE,this.commentMode),this.commentBtn?.setAttribute("aria-pressed",String(this.commentMode)),this.overlay.classList.toggle(o.ACTIVE,this.commentMode),document.body.classList.toggle(o.COMMENT_CURSOR,this.commentMode),this.commentMode||this.hideCommentBox()}saveComment(){if(!this.commentInput.value.trim()||!this.currentPosition)return;let e={text:this.commentInput.value,container:this.currentPosition.container,relativeX:this.currentPosition.relativeX,relativeY:this.currentPosition.relativeY,anchor:this.currentPosition.anchor,anchorState:"anchored",target:this.currentPosition.target,hidden:!1,status:"open",page:location.pathname,id:xe(),replies:[],author:this.options.user?.name||this.strings.anonymous,createdAt:new Date().toISOString(),screenshots:this._pendingScreenshots?[...this._pendingScreenshots]:[],type:this.commentBox.classify?.getType()??null,priority:this.commentBox.classify?.getPriority()??null,tags:[],resolvedAt:null,context:Le(),contextScreenshot:this._pendingContextScreenshot};this.comments.push(e),this._syncStorage(),this.options.onCommentCreated?.(this._serializeComment(e)),this.renderCommentCircle(e),this.hideCommentBox(),this.toggleCommentMode();let t=this.shadowRoot.querySelector(`[data-comment-id="${e.id}"]`);t&&this.showThreadPopover(t,e)}renderCommentCircle(e){let t=at(e,this.strings);t.addEventListener("mouseenter",()=>this.showCommentTooltip(t,e)),t.addEventListener("mouseleave",()=>{setTimeout(()=>{let i=this.shadowRoot.querySelector(`.${o.TOOLTIP}[data-for="${e.id}"]`);i&&!i.matches(":hover")&&i.remove()},250)}),t.addEventListener("click",i=>{i.stopPropagation();let s=this.shadowRoot.querySelector(`.${o.TOOLTIP}[data-for="${e.id}"]`);if(s&&s.remove(),this.activeThreadPopover?.dataset.for===String(e.id)){this.closeThreadPopover();return}this.showThreadPopover(t,e)}),t.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t.click())}),this.overlay.appendChild(t),this.updateCommentPosition(e,t),this.createResizeObserver(e,t),this.createMutationObserver(e)}showCommentTooltip(e,t){if(this.shadowRoot.querySelector(`.${o.THREAD_POPOVER}[data-for="${t.id}"]`)||this.shadowRoot.querySelector(`.${o.TOOLTIP}[data-for="${t.id}"]`))return;let r=lt(t,this.strings,this.locale);this.shadowRoot.appendChild(r),r.querySelectorAll(`.${o.SCREENSHOT_IMG}`).forEach(a=>{a.addEventListener("click",l=>{l.stopPropagation(),this.showLightbox(a.src)})}),setTimeout(()=>{this.positionPopoverAtCircle(r,e)},10),r.querySelector(`.${o.CLOSE_TOOLTIP}`).addEventListener("click",a=>{a.stopPropagation(),r.remove()}),r.addEventListener("mouseleave",()=>r.remove())}toggleInbox(){this.inboxView?.isOpen()?this.closeInbox():this.showInbox()}showInbox(){this.closeThreadPopover(),this.inboxView||(this.inboxView=new de({shadowRoot:this.shadowRoot,strings:this.strings,locale:this.locale,currentPage:location.pathname,getComments:()=>this.comments,options:this.options,callbacks:{onActivateCommentMode:()=>{this.closeInbox(),this.commentMode||this.toggleCommentMode()},onOpenDetailScroll:e=>this.scrollMarkerIntoView(e),onReply:(e,t,i)=>this.addReply(e,t,i),onDelete:e=>this.deleteComment(e),onDeleteReply:(e,t)=>this.deleteReply(e,t),onEditComment:(e,t)=>{this.editComment(e,t)&&this._refreshCommentViews(e)},onEditReply:(e,t,i)=>{this.editReply(e,t,i)&&this._refreshCommentViews(e)},onSetStatus:(e,t)=>this.setCommentStatus(e,t),onSetType:(e,t)=>this.setCommentType(e,t),onSetPriority:(e,t)=>this.setCommentPriority(e,t),onNavigateToPage:e=>{try{sessionStorage.setItem(ee,String(e.id))}catch{}this._navigateTo(e.page)},onShowLightbox:e=>this.showLightbox(e),onClose:()=>this.closeInbox()}})),this.inboxView.open(),setTimeout(()=>{this._inboxClickHandler=e=>{let t=e.composedPath()[0]||e.target;if(!this.inboxView.el?.contains(t)&&!this.inboxBtn.contains(t)&&!this._isInsideLightbox(t)){if(this.inboxView.isDirty())return;this.closeInbox()}},document.addEventListener("mousedown",this._inboxClickHandler)},0)}closeInbox(){this.inboxView?.close(),this._inboxClickHandler&&(document.removeEventListener("mousedown",this._inboxClickHandler),this._inboxClickHandler=null)}showThreadPopover(e,t){this.closeThreadPopover();let i=this.shadowRoot.querySelector(`.${o.TOOLTIP}[data-for="${t.id}"]`);i&&i.remove(),e?.classList.add(o.CIRCLE_ACTIVE),this._activePopoverCircle=e||null;let s=(E,C)=>{this.deleteReply(t.id,E.id)&&(C.remove(),this.inboxView?.isOpen()&&this.inboxView.refresh())},r=ct(t,this.strings,this.locale,{onDeleteReply:s,onEditReply:E=>this._startPopoverEditing(t.id,E.id)});this.shadowRoot.appendChild(r);let a=r.querySelector(`.${o.THREAD_HEADER}`),l=re(t,{strings:this.strings,onCopy:E=>$(le(E,{viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,strings:this.strings})),onCopyLink:E=>$(G(E,this._linkParam())),onEdit:E=>this._startPopoverEditing(E.id),onSetStatus:(E,C)=>this.setCommentStatus(E.id,C),onSetType:(E,C)=>this.setCommentType(E.id,C),onSetPriority:(E,C)=>this.setCommentPriority(E.id,C),onDelete:E=>{this.closeThreadPopover(),this.deleteComment(E.id),this.inboxView?.isOpen()&&this.inboxView.refresh()}}),c=document.createElement("div");c.className=o.THREAD_ACTIONS_ROW,c.appendChild(l),a.insertAdjacentElement("afterend",c);let p=r.querySelector(`.${o.THREAD_SCROLL} > .${o.SCREENSHOTS_CONTAINER}`);p&&p.querySelectorAll(`.${o.SCREENSHOT_IMG}`).forEach(E=>{E.addEventListener("click",C=>{C.stopPropagation(),this.showLightbox(E.src)})});let h=ce(t,{strings:this.strings,onShowLightbox:E=>this.showLightbox(E),collapsible:!0});h&&r.querySelector(`.${o.THREAD_REPLIES}`).before(h),setTimeout(()=>{e?this.positionPopoverAtCircle(r,e):this.centerPopover(r)},10),r.querySelector(`.${o.CLOSE_TOOLTIP}`).addEventListener("click",async E=>{E.stopPropagation(),!(this._popoverEditing&&!await this._releasePopoverEditor())&&this.closeThreadPopover()});let d=r.querySelector(`.${o.THREAD_INPUT}`),g=r.querySelector(`.${o.THREAD_SUBMIT}`),m=r.querySelector(`.${o.THREAD_INPUT_AREA} .${o.ATTACH_IMAGE_BTN}`),u=r.querySelector(`.${o.THREAD_INPUT_AREA} input[type="file"]`),f=r.querySelector(`.${o.THREAD_INPUT_AREA} .${o.SCREENSHOTS_CONTAINER}`),b=[],x=()=>{if(f.innerHTML="",b.length===0){f.classList.remove(o.ACTIVE);return}f.classList.add(o.ACTIVE),b.forEach((E,C)=>{let y=document.createElement("div");y.className=o.SCREENSHOT_ITEM;let _=document.createElement("img");_.className=o.SCREENSHOT_IMG,_.src=E,_.alt=this.strings.attachedScreenshot,_.onclick=()=>this.showLightbox(E);let A=document.createElement("button");A.className=o.SCREENSHOT_REMOVE,A.innerHTML="&times;",A.onclick=q=>{q.stopPropagation(),b.splice(C,1),x()},y.appendChild(_),y.appendChild(A),f.appendChild(y)})};m.addEventListener("click",()=>{u.click()}),u.addEventListener("change",E=>{let C=E.target.files[0];if(!C||b.length>=5)return;let y=new FileReader;y.onload=_=>{b.push(_.target.result),x()},y.readAsDataURL(C),u.value=""});let S=()=>{let E=d.value.trim();if(!E&&b.length===0)return;let C=this.addReply(t,E,b.length>0?[...b]:[]),y=r.querySelector(`.${o.THREAD_REPLIES}`),_=j(C,this.strings,this.locale,{onDelete:s});y.appendChild(_),_.querySelectorAll(`.${o.SCREENSHOT_IMG}`).forEach(q=>{q.addEventListener("click",pt=>{pt.stopPropagation(),this.showLightbox(q.src)})});let A=r.querySelector(`.${o.THREAD_SCROLL}`);A&&(A.scrollTop=A.scrollHeight),d.value="",b=[],x(),d.focus()};g.addEventListener("click",S),d.addEventListener("keydown",E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),S())}),this.activeThreadPopover=r,typeof ResizeObserver<"u"&&(this._popoverResizeObserver=new ResizeObserver(()=>this._repositionThreadPopover()),this._popoverResizeObserver.observe(r)),setTimeout(()=>d.focus(),50),setTimeout(()=>{this._threadClickHandler=E=>{let C=E.composedPath()[0]||E.target;if(!r.contains(C)&&!e?.contains(C)&&!this._isInsideLightbox(C)){if(this._popoverEditorDirty())return;this.closeThreadPopover()}},document.addEventListener("mousedown",this._threadClickHandler)},0)}closeThreadPopover(){this.shadowRoot?.querySelectorAll(`.${o.CIRCLE_ACTIVE}`).forEach(e=>e.classList.remove(o.CIRCLE_ACTIVE)),this._popoverResizeObserver?.disconnect(),this._popoverResizeObserver=null,this._popoverEditing=null,this.activeThreadPopover&&(this.activeThreadPopover.remove(),this.activeThreadPopover=null),this._activePopoverCircle=null,this._threadClickHandler&&(document.removeEventListener("mousedown",this._threadClickHandler),this._threadClickHandler=null)}showLightbox(e){this.closeLightbox();let t=document.createElement("div");t.className=o.LIGHTBOX;let i=document.createElement("img");i.className=o.LIGHTBOX_IMG,i.src=e,i.alt=this.strings.screenshotPreview;let s=document.createElement("button");s.type="button",s.className=o.LIGHTBOX_CLOSE,s.setAttribute("aria-label",this.strings.close),s.innerHTML="&times;",s.addEventListener("click",()=>this.closeLightbox()),t.appendChild(i),t.appendChild(s),t.addEventListener("click",r=>{r.target===t&&this.closeLightbox()}),this.shadowRoot.appendChild(t),this._activeLightbox=t}closeLightbox(){this._activeLightbox?.remove(),this._activeLightbox=null}_isInsideLightbox(e){return!!e?.closest?.(`.${o.LIGHTBOX}`)}addReply(e,t,i=[]){e.replies||(e.replies=[]);let s={id:xe(),editedAt:null,text:t,author:this.options.user?.name||this.strings.anonymous,timestamp:new Date().toISOString(),screenshots:i};return e.replies.push(s),this._syncStorage(),this.options.onReplyAdded?.(this._serializeComment(e),this._serializeReply(s)),s}deleteReply(e,t){let i=this.comments.find(a=>a.id===e),s=i?.replies?.findIndex(a=>a.id===t)??-1;if(s<0)return!1;let[r]=i.replies.splice(s,1);return this._syncStorage(),this.options.onReplyDeleted?.(this._serializeComment(i),this._serializeReply(r)),!0}editComment(e,t){let i=this.comments.find(r=>String(r.id)===String(e)),s=String(t??"").trim();return!i||!s||s===i.text?!1:(i.text=s,i.editedAt=new Date().toISOString(),this._syncStorage(),this.options.onCommentEdited?.(this._serializeComment(i)),!0)}editReply(e,t,i){let s=this.comments.find(l=>String(l.id)===String(e)),r=s?.replies?.find(l=>String(l.id)===String(t)),a=String(i??"").trim();return!r||!a||a===r.text?!1:(r.text=a,r.editedAt=new Date().toISOString(),this._syncStorage(),this.options.onReplyEdited?.(this._serializeComment(s),this._serializeReply(r)),!0)}_serializeReply({id:e,text:t,author:i,timestamp:s,screenshots:r,editedAt:a}){return{id:e,text:t,author:i,timestamp:s,screenshots:r||[],editedAt:a||null}}_serializeComment(e){return{id:e.id,text:e.text,editedAt:e.editedAt||null,anchor:e.anchor||null,page:e.page||location.pathname,replies:(e.replies||[]).map(t=>this._serializeReply(t)),author:e.author,createdAt:e.createdAt,screenshots:e.screenshots||[],status:e.status||"open",type:e.type||null,priority:e.priority||null,tags:e.tags?[...e.tags]:[],resolvedAt:e.resolvedAt||null,context:e.context?{...e.context}:null,contextScreenshot:e.contextScreenshot||null}}setCommentStatus(e,t){if(!L.includes(t))return!1;let i=this.comments.find(r=>r.id===e);if(!i)return!1;if(i.status===t)return!0;i.status=t,i.resolvedAt=t==="resolved"?new Date().toISOString():null;let s=this.shadowRoot?.querySelector(`[data-comment-id="${e}"]`);return s&&this.updateCommentPosition(i,s),this._syncStorage(),this.inboxView?.isOpen()&&this.inboxView.refresh(),this.options.onCommentStatusChanged?.(this._serializeComment(i)),!0}_commitUpdate(e){return this._syncStorage(),this.inboxView?.isOpen()&&this.inboxView.refresh(),this.options.onCommentUpdated?.(this._serializeComment(e)),!0}setCommentType(e,t){if(t!==null&&!R.includes(t))return!1;let i=this.comments.find(s=>s.id===e);return i?(i.type=t,this._commitUpdate(i)):!1}setCommentPriority(e,t){if(t!==null&&!I.includes(t))return!1;let i=this.comments.find(s=>s.id===e);return i?(i.priority=t,this._commitUpdate(i)):!1}setCommentTags(e,t){if(!Array.isArray(t))return!1;let i=this.comments.find(s=>s.id===e);return i?(i.tags=ro(t),this._commitUpdate(i)):!1}serializeComments(){return this.comments.map(e=>this._serializeComment(e))}deleteComment(e){return this.comments.some(t=>t.id===e)?(this._removeComment(e),this.options.persistence==="localStorage"&&Ce(Te(te().filter(t=>t.id!==e),this.serializeComments(),location.pathname)),this.options.onCommentDeleted?.(e),!0):!1}_removeComment(e){if(this.cleanupResizeObserver(e),this.mutationObservers.has(e)){try{this.mutationObservers.get(e).disconnect()}catch{}this.mutationObservers.delete(e)}this.shadowRoot.querySelector(`[data-comment-id="${e}"]`)?.remove(),this.comments=this.comments.filter(t=>t.id!==e)}loadComments(e){let t=0,i=0,s=0;if(!Array.isArray(e))return{anchored:t,orphaned:i,inactive:s};for(let r of e){if(!r||r.id==null||typeof r.text!="string"){console.warn("HellDots: skipping malformed serialized comment",r);continue}this._removeComment(r.id);let a={id:r.id,text:r.text,editedAt:r.editedAt||null,anchor:r.anchor||null,anchorState:"orphaned",target:null,hidden:!1,page:r.page||location.pathname,container:null,relativeX:0,relativeY:0,replies:Array.isArray(r.replies)?[...r.replies]:[],author:r.author||this.strings.anonymous,createdAt:r.createdAt||new Date().toISOString(),screenshots:Array.isArray(r.screenshots)?[...r.screenshots]:[],status:r.status==="closed"?"resolved":L.includes(r.status)?r.status:"open",type:R.includes(r.type)?r.type:null,priority:I.includes(r.priority)?r.priority:null,tags:Array.isArray(r.tags)?[...r.tags]:[],resolvedAt:r.resolvedAt||null,context:r.context||null,contextScreenshot:r.contextScreenshot||null};if(r.page&&r.page!==location.pathname){a.anchorState="inactive",this.comments.push(a),s++;continue}let l=r.anchor?je(r.anchor):null;l?(a.container=l.element,a.relativeX=r.anchor.relativeX,a.relativeY=r.anchor.relativeY,a.anchorState="anchored",this.comments.push(a),this.renderCommentCircle(a),t++):(this.comments.push(a),i++,this.options.onAnchorLost?.(this._serializeComment(a)))}return this._openPendingDetail(),{anchored:t,orphaned:i,inactive:s}}centerPopover(e){let t=e.getBoundingClientRect(),i=Math.max(10,(window.innerWidth-(t.width||400))/2),s=Math.max(10,(window.innerHeight-t.height)/2);e.style.left=`${i}px`,e.style.bottom="auto",e.style.top=`${s}px`}scrollMarkerIntoView(e){let t=this._markerViewportY(e);t!=null&&window.scrollTo({top:Math.max(0,window.scrollY+t-window.innerHeight/2)})}_markerViewportY(e){let t=e.container;if(!t?.isConnected)return null;let i=t.getBoundingClientRect();if(i.height<=0)return null;let s=28,r=Math.max(0,Math.min(e.relativeY*i.height,i.height-s));return i.top+r+s/2}_repositionThreadPopover(){let e=this.activeThreadPopover;!e||e.style.display==="none"||(this._activePopoverCircle?this.positionPopoverAtCircle(e,this._activePopoverCircle):this.centerPopover(e))}syncThreadPopoverToMarker(){let e=this.activeThreadPopover,t=this._activePopoverCircle;if(!e||!t)return;let i=t.getBoundingClientRect();if(!(t.isConnected&&t.style.display!=="none"&&i.bottom>0&&i.right>0&&i.top<window.innerHeight&&i.left<window.innerWidth)){e.style.display="none";return}e.style.display="",this.positionPopoverAtCircle(e,t)}positionPopoverAtCircle(e,t){let i=t.getBoundingClientRect(),s=i.left+i.width/2,r=i.top+i.height/2,a=28,l=a/2+10,c=e.getBoundingClientRect(),p=c.width||400,h=s+l;h+p>window.innerWidth&&(h=s-l-p),h=Math.min(h,window.innerWidth-p-10),h=Math.max(10,h),e.style.left=`${h}px`;let d=10,g=r-a/2,m=window.innerHeight-d-g;c.height>m?(e.style.top="auto",e.style.bottom=`${d}px`):(e.style.bottom="auto",e.style.top=`${Math.max(d,g)}px`)}createPreviewCircle(e,t){this.removePreviewCircle();let i=document.createElement("div");i.className=`${o.CIRCLE} ${o.PREVIEW_CIRCLE}`,i.style.position="absolute";let s=14;i.style.left=`${e+s}px`,i.style.top=`${t+s}px`,i.style.transform="translate(-50%, -50%)",i.style.pointerEvents="none",this.overlay.appendChild(i),this.previewCircle=i}removePreviewCircle(){this.previewCircle?.remove(),this.previewCircle=null}cleanupResizeObserver(e){if(this.resizeObservers&&this.resizeObservers.has(e)){let{circle:t,observer:i}=this.resizeObservers.get(e);i&&i.disconnect(),t&&t.parentNode&&t.parentNode.removeChild(t),this.resizeObservers.delete(e)}}validateAndCalculatePosition(e,t){if(!e.container||!t)return null;let i=e.container.getBoundingClientRect(),s=i.width,r=i.height;if(s<=0||r<=0)return null;let a=e.relativeX*s,l=e.relativeY*r,c=28,p=Math.max(0,Math.min(a,s-c)),h=Math.max(0,Math.min(l,r-c)),d=p/s,g=h/r;return{absoluteX:p,absoluteY:h,relativeX:d,relativeY:g,containerWidth:s,containerHeight:r,containerLeft:i.left,containerTop:i.top}}_isAnchorTargetVisible(e){let t=e.target;if((!t||!t.isConnected)&&e.anchor?.targetSelector){try{t=document.querySelector(e.anchor.targetSelector)}catch{t=null}e.target=t||null}if(!t||!t.isConnected)return!0;let i=t.getBoundingClientRect();return i.width>0&&i.height>0}_isMarkerOccluded(e,t,i){if(typeof document.elementsFromPoint!="function"||t<0||i<0||t>=window.innerWidth||i>=window.innerHeight)return!1;let r=document.elementsFromPoint(t,i).find(c=>c.tagName.toLowerCase()!==w.toLowerCase());if(!r)return!1;let a=e.target?.isConnected?e.target:null;if(a&&(a.contains(r)||r.contains(a)))return!1;let l=e.container;if(!l?.isConnected)return!1;if(!l.contains(r)&&!r.contains(l))return!0;if(l.contains(r)&&r!==l){for(let c=r;c&&c!==l;c=c.parentElement)if(this._looksLikeModalLayer(c,a))return!0}return!1}_looksLikeModalLayer(e,t){if(t&&e.contains(t))return!1;if(e.matches?.('dialog, [aria-modal="true"], [role="dialog"]'))return!0;if(getComputedStyle(e).position!=="fixed")return!1;let i=e.getBoundingClientRect();return i.width>=window.innerWidth*.5&&i.height>=window.innerHeight*.5}_dismissMarkerUi(e){this.shadowRoot.querySelector(`.${o.TOOLTIP}[data-for="${e.id}"]`)?.remove(),this.activeThreadPopover?.dataset.for===String(e.id)&&this.closeThreadPopover()}updateCommentPosition(e,t){if(e.status==="resolved"){t&&(t.style.display="none");return}let i=this.validateAndCalculatePosition(e,t);i&&!this._isAnchorTargetVisible(e)&&(i=null);let s=e.hidden===!0;if(!i){t&&e.container&&(e.hidden=!0,t.style.display="none",this._dismissMarkerUi(e),!s&&this.inboxView?.isOpen()&&this.inboxView.refresh());return}let r=14,a=i.containerLeft+i.absoluteX+r,l=i.containerTop+i.absoluteY+r;if(this._isMarkerOccluded(e,a,l)){e.hidden=!0,t.style.display="none",this._dismissMarkerUi(e),!s&&this.inboxView?.isOpen()&&this.inboxView.refresh();return}e.hidden=!1,t.style.display="",s&&this.inboxView?.isOpen()&&this.inboxView.refresh(),t.style.left=`${a}px`,t.style.top=`${l}px`,t.style.transform="translate(-50%, -50%)",t.style.position="absolute",e.relativeX=i.relativeX,e.relativeY=i.relativeY}setupResizeHandlers(){this.scheduleUpdatePositions=()=>{this._pendingRaf||(this._pendingRaf=requestAnimationFrame(()=>{this._pendingRaf=null,this.positionValidationEnabled&&this.comments.forEach(e=>{let t=this.shadowRoot.querySelector(`[data-comment-id="${e.id}"]`);t&&this.updateCommentPosition(e,t)}),this.syncThreadPopoverToMarker()}))},this.windowResizeHandler=()=>{this.scheduleUpdatePositions()},window.addEventListener("resize",this.windowResizeHandler,{passive:!0}),this.scrollHandler=()=>{this.scheduleUpdatePositions()},window.addEventListener("scroll",this.scrollHandler,{capture:!0,passive:!0}),this.loadHandler=()=>{this.scheduleUpdatePositions()},window.addEventListener("load",this.loadHandler),window.MutationObserver&&(this._globalMutationObserver=new MutationObserver(()=>{this.scheduleUpdatePositions()}),this._globalMutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden","open"]}))}debugPosition(e,t){if(!e||!t)return;let i=e.container.getBoundingClientRect(),s=t.getBoundingClientRect(),r=e.relativeX*i.width,a=e.relativeY*i.height;console.log("Position Debug:",{commentId:e.id,relativePosition:{x:e.relativeX,y:e.relativeY},containerRect:{left:i.left,top:i.top,width:i.width,height:i.height},circlePosition:{left:s.left,top:s.top,centerX:s.left+s.width/2,centerY:s.top+s.height/2},expectedPosition:{x:r,y:a},offset:{x:s.left+s.width/2-(i.left+r),y:s.top+s.height/2-(i.top+a)}})}createResizeObserver(e,t){if(!window.ResizeObserver){console.warn("ResizeObserver not supported, position validation will be limited");return}let i=new ResizeObserver(s=>{if(this.positionValidationEnabled)for(let r of s)r.target===e.container&&this.updateCommentPosition(e,t)});i.observe(e.container),this.resizeObservers.set(e.id,{circle:t,observer:i,container:e.container})}createMutationObserver(e){if(!window.MutationObserver)return;if(this.mutationObservers.has(e.id)){try{this.mutationObservers.get(e.id).disconnect()}catch{}this.mutationObservers.delete(e.id)}let t=new MutationObserver(()=>{this.scheduleUpdatePositions()});t.observe(e.container,{attributes:!0,attributeFilter:void 0,childList:!0,subtree:!0}),this.mutationObservers.set(e.id,t)}cleanup(){ie(),tt(),this.closeThreadPopover(),this.closeInbox(),this.closeLightbox(),this.removePreviewCircle(),this._selectionRect?.remove(),this._pendingScreenshots=[],this._handleDocumentClickBound&&document.removeEventListener("mousedown",this._handleDocumentClickBound),this.windowResizeHandler&&window.removeEventListener("resize",this.windowResizeHandler),this.scrollHandler&&window.removeEventListener("scroll",this.scrollHandler,{capture:!0}),this.loadHandler&&window.removeEventListener("load",this.loadHandler),this._globalMutationObserver&&(this._globalMutationObserver.disconnect(),this._globalMutationObserver=null),this.resizeObservers&&(this.resizeObservers.forEach(({observer:e})=>{e&&e.disconnect()}),this.resizeObservers.clear()),this.mutationObservers&&(this.mutationObservers.forEach(e=>{try{e.disconnect()}catch{}}),this.mutationObservers.clear()),this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.toolbar&&this.toolbar.parentNode&&this.toolbar.parentNode.removeChild(this.toolbar),this.commentBox&&this.commentBox.parentNode&&this.commentBox.parentNode.removeChild(this.commentBox),this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),document.body.classList.remove(o.COMMENT_CURSOR),document.getElementById(T.GLOBAL_STYLES)?.remove(),this.comments.forEach(e=>{let t=this.shadowRoot.querySelector(`[data-comment-id="${e.id}"]`);t&&t.parentNode&&t.parentNode.removeChild(t)})}injectStyles(){let e=this.shadowRoot.getElementById(T.STYLES);e&&e.remove();let t=document.createElement("style");t.id=T.STYLES,t.textContent=$e(),this.shadowRoot.appendChild(t);let i=document.getElementById(T.GLOBAL_STYLES);i&&i.remove();let s=document.createElement("style");s.id=T.GLOBAL_STYLES,s.textContent=ke(),document.head.appendChild(s)}},dt=Ae;function so(n={}){let{autoInit:e=!0,...t}=n,i=()=>new dt(t);return e?i():i}var Si=so;export{dt as CommentOverlay,so as createCommentOverlay,Si as default};
1019
1455
  //# sourceMappingURL=helldots.esm.js.map