@inputbuffer/feedback 0.1.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.
package/dist/widget.js ADDED
@@ -0,0 +1,632 @@
1
+ "use strict";(()=>{function R(e){let t=document.getElementById("ib-modal");if(!t)return;let{theme:r={}}=e;r.primary&&t.style.setProperty("--ib-primary",r.primary),r.background&&t.style.setProperty("--ib-background",r.background),r.surface&&t.style.setProperty("--ib-surface",r.surface),r.text&&t.style.setProperty("--ib-text",r.text),r.selected&&t.style.setProperty("--ib-selected",r.selected),r.selectedColor&&t.style.setProperty("--ib-selected-color",r.selectedColor)}var W="0.1.0",X="https://inputbuffer.io/api/v0/inputs";async function j(e,t,r,d,o,p){var h;let l={description:t};if(d&&(l.title=d),r&&(l.contactEmail=r),o!=null&&o.sentiment&&(l.sentiment=o.sentiment),o!=null&&o.source&&(l.source=o.source),o!=null&&o.target){let n=o.target;l.targets=[{target_type:n.type,...n.targetId&&{target_id:n.targetId},...n.displayName&&{display_name:n.displayName},...n.dedupKey&&{dedup_key:n.dedupKey},metadata:n.metadata}]}let u=new AbortController,f=setTimeout(()=>u.abort(),1e4),c;try{c=await fetch(p!=null?p:X,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${W} (javascript)`},body:JSON.stringify(l),credentials:"omit",signal:u.signal})}finally{clearTimeout(f)}if(!c.ok){let n=await c.json().catch(()=>({}));throw new Error(((h=n==null?void 0:n.error)==null?void 0:h.message)||"Submission failed. Please try again.")}return c.json()}function K(e){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("fill","currentColor"),t.setAttribute("aria-hidden","true"),t.style.display="block";let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",e),t.appendChild(r),t}var Q="M9 21h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2zM9 9l4.34-4.34L12 10h9v2l-3 7H9V9zM1 9h2v12H1z",Z="M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L10.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm0 12l-4.34 4.34L12 14H3v-2l3-7h9v10zm4-12h2v12h-2z";function U(e){let t=null,r,d,o=null,p=null,l=null,u=null,f=null,c=null,h=null,n=null,g=null,v=[],z=[],C=[];function B(i){if(i.key==="Escape"){L();return}if(i.key==="Tab"&&t){let b=Array.from(t.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(b.length===0)return;let x=b[0],m=b[b.length-1];i.shiftKey?document.activeElement===x&&(i.preventDefault(),m.focus()):document.activeElement===m&&(i.preventDefault(),x.focus())}}async function H(){var b,x;if(!p||!f)return;let i=p.value.trim();if(i.length<10){c&&(c.textContent="Please enter at least 10 characters.",c.style.display="block");return}c&&(c.style.display="none"),f.disabled=!0,f.textContent="Sending\u2026";try{let m=(u==null?void 0:u.value.trim())||((b=r==null?void 0:r.prefill)==null?void 0:b.email)||null,y=(l==null?void 0:l.value.trim())||null,A=d!=null?d:r==null?void 0:r.sentiment,I=await j(e.apiKey,i,m||null,y,{...r,sentiment:A,source:(x=r==null?void 0:r.source)!=null?x:e.source},e.apiUrl);h&&(h.textContent="Thanks for your feedback!",h.style.display="block"),v.forEach(T=>T(I)),o=setTimeout(()=>L(),2e3)}catch(m){let y=m instanceof Error?m:new Error("Unknown error");c&&(c.textContent="Something went wrong. Please try again.",c.style.display="block"),C.forEach(A=>A(y)),f.disabled=!1,f.textContent="Send feedback"}}function S(){let i=document.createElement("div");i.id="ib-overlay";let b=document.createElement("div");b.id="ib-modal",e.colorScheme==="dark"?b.classList.add("ib-theme-dark"):e.colorScheme==="light"&&b.classList.add("ib-theme-light"),b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true");let x=document.createElement("div");if(x.id="ib-modal-header",g=x,e.title?(b.setAttribute("aria-labelledby","ib-title"),n=document.createElement("h2"),n.id="ib-title",n.className="ib-modal-title",n.textContent=e.title,x.appendChild(n)):b.setAttribute("aria-label","Feedback"),e.showSentiment){let k,a,w=document.createElement("div");w.className="ib-modal-sentiment",k=document.createElement("button"),k.type="button",k.className="ib-modal-thumb ib-modal-thumb--up",k.setAttribute("aria-label","Helpful"),k.appendChild(K(Q)),a=document.createElement("button"),a.type="button",a.className="ib-modal-thumb ib-modal-thumb--down",a.setAttribute("aria-label","Not helpful"),a.appendChild(K(Z)),k.addEventListener("click",()=>{k.classList.add("ib-modal-thumb--active"),a.classList.remove("ib-modal-thumb--active"),d="positive"}),a.addEventListener("click",()=>{a.classList.add("ib-modal-thumb--active"),k.classList.remove("ib-modal-thumb--active"),d="negative"}),w.appendChild(k),w.appendChild(a),x.appendChild(w)}let m=document.createElement("button");m.id="ib-close",m.className="ib-modal-close",m.textContent="\xD7",m.setAttribute("aria-label","Close feedback form"),m.addEventListener("click",L),x.appendChild(m);let y=document.createElement("div");y.id="ib-modal-body",p=document.createElement("textarea"),p.id="ib-textarea",p.className="ib-modal-textarea",p.placeholder=e.placeholder||"What's on your mind?",p.setAttribute("aria-label","Feedback"),f=document.createElement("button"),f.id="ib-submit",f.className="ib-modal-submit",f.textContent="Send feedback",f.addEventListener("click",H),h=document.createElement("p"),h.id="ib-success",h.className="ib-modal-success",c=document.createElement("p"),c.id="ib-error",c.className="ib-modal-error",e.showTitleField===!0&&(l=document.createElement("input"),l.id="ib-title-input",l.className="ib-modal-title-input",l.type="text",l.placeholder="Title (optional)",l.setAttribute("aria-label","Feedback title"),y.appendChild(l)),y.appendChild(p),e.showEmailField===!0&&(u=document.createElement("input"),u.id="ib-email",u.className="ib-modal-email",u.type="email",u.placeholder="Your email (optional)",u.setAttribute("aria-label","Email address"),y.appendChild(u)),y.appendChild(c),y.appendChild(h);let A=document.createElement("div");A.className="ib-modal-footer",A.appendChild(f);let I=document.createElement("div");I.className="ib-branding";let T=document.createElement("a");return T.href="https://inputbuffer.io",T.target="_blank",T.rel="noopener noreferrer",T.textContent="Powered by inputbuffer.io",I.appendChild(T),A.appendChild(I),y.appendChild(A),b.appendChild(x),b.appendChild(y),i.appendChild(b),i.addEventListener("click",k=>{k.target===i&&L()}),document.addEventListener("keydown",B),i}function E(i){var b,x;if(!t){if(r=i,t=S(),document.body.appendChild(t),R(e),i!=null&&i.title){if(n)n.textContent=i.title;else if(g){let m=t.querySelector("#ib-modal");m.removeAttribute("aria-label"),m.setAttribute("aria-labelledby","ib-title"),n=document.createElement("h2"),n.id="ib-title",n.className="ib-modal-title",n.textContent=i.title,g.prepend(n)}}if(i!=null&&i.sentiment){d=i.sentiment;let m=t.querySelector(".ib-modal-thumb--up"),y=t.querySelector(".ib-modal-thumb--down");i.sentiment==="positive"?m==null||m.classList.add("ib-modal-thumb--active"):i.sentiment==="negative"&&(y==null||y.classList.add("ib-modal-thumb--active"))}p&&((b=i==null?void 0:i.prefill)!=null&&b.description)&&(p.value=i.prefill.description),u&&((x=i==null?void 0:i.prefill)!=null&&x.email)&&(u.value=i.prefill.email),p==null||p.focus()}}function L(){t&&(o!==null&&(clearTimeout(o),o=null),document.removeEventListener("keydown",B),t.remove(),t=null,p=null,l=null,u=null,f=null,c=null,h=null,n=null,g=null,r=void 0,d=void 0,z.forEach(i=>i()))}function P(i,b){i==="submit"?v.push(b):i==="close"?z.push(b):i==="error"&&C.push(b)}function N(){L()}return{open:E,close:L,on:P,destroy:N}}function _(e){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("fill","currentColor"),t.setAttribute("aria-hidden","true"),t.style.display="block";let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",e),t.appendChild(r),t}var ee="M9 21h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2zM9 9l4.34-4.34L12 10h9v2l-3 7H9V9zM1 9h2v12H1z",te="M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L10.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm0 12l-4.34 4.34L12 14H3v-2l3-7h9v10zm4-12h2v12h-2z";function D(e){var T,k;let t,r={vote:[],open:[],submit:[],close:[],error:[]};function d(a,w){var M;(M=r[a])==null||M.forEach(O=>O(w))}let o=document.createElement("div"),p=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";o.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+p;let{theme:l={}}=e;l.primary&&o.style.setProperty("--ib-primary",l.primary),l.background&&o.style.setProperty("--ib-background",l.background),l.surface&&o.style.setProperty("--ib-surface",l.surface),l.text&&o.style.setProperty("--ib-text",l.text),l.selected&&o.style.setProperty("--ib-selected",l.selected),l.selectedColor&&o.style.setProperty("--ib-selected-color",l.selectedColor);let u=document.createElement("div");u.className="ib-bar";let f=document.createElement("div");f.className="ib-bar-label-area";let c=document.createElement("span");c.className="ib-bar-label",c.textContent=(T=e.label)!=null?T:"Was this helpful?",f.appendChild(c);let h=document.createElement("div");h.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let n=document.createElement("button");n.type="button",n.className="ib-bar-btn ib-bar-btn--up",n.setAttribute("aria-label","Yes"),n.appendChild(_(ee));let g=document.createElement("button");g.type="button",g.className="ib-bar-btn ib-bar-btn--down",g.setAttribute("aria-label","No"),g.appendChild(_(te)),h.appendChild(n),h.appendChild(g),e.showLabel!==!1&&u.appendChild(f),u.appendChild(h);let v=document.createElement("div");v.className="ib-bar-popover",v.setAttribute("role","dialog"),v.setAttribute("aria-modal","false");let z=document.createElement("div");if(z.className="ib-bar-header",e.modalTitle){v.setAttribute("aria-labelledby","ib-bar-title");let a=document.createElement("p");a.id="ib-bar-title",a.className="ib-bar-title",a.textContent=e.modalTitle,z.appendChild(a)}else v.setAttribute("aria-label","Feedback");let C=document.createElement("div");C.className="ib-bar-body";let B=document.createElement("textarea");B.className="ib-bar-textarea",B.placeholder=(k=e.modalPlaceholder)!=null?k:"What's on your mind?",B.setAttribute("aria-label","Feedback");let H=document.createElement("p");H.className="ib-bar-error";let S=document.createElement("p");S.className="ib-bar-success";let E=document.createElement("button");if(E.type="button",E.className="ib-bar-submit",E.textContent="Send feedback",e.showTitleField===!0){let a=document.createElement("input");a.type="text",a.className="ib-bar-title-input",a.placeholder="Title (optional)",a.setAttribute("aria-label","Feedback title"),C.appendChild(a)}if(C.appendChild(B),e.showEmailField===!0){let a=document.createElement("input");a.type="email",a.className="ib-bar-email",a.placeholder="Your email (optional)",a.setAttribute("aria-label","Email address"),C.appendChild(a)}C.appendChild(H),C.appendChild(S);let L=document.createElement("div");L.className="ib-bar-footer",L.appendChild(E);let P=document.createElement("div");P.className="ib-branding";let N=document.createElement("a");N.href="https://inputbuffer.io",N.target="_blank",N.rel="noopener noreferrer",N.textContent="Powered by inputbuffer.io",P.appendChild(N),L.appendChild(P),C.appendChild(L),v.appendChild(z),v.appendChild(C),o.appendChild(v),o.appendChild(u);function i(a){t=a,v.classList.add("ib-bar-popover--visible"),H.textContent="",S.textContent="",B.focus(),setTimeout(()=>document.addEventListener("click",m),0),document.addEventListener("keydown",y),d("open",{sentiment:a})}function b(){v.classList.contains("ib-bar-popover--visible")&&(v.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",m),document.removeEventListener("keydown",y),B.value="",d("close"))}function x(){n.classList.remove("ib-bar-btn--active"),g.classList.remove("ib-bar-btn--active"),t=void 0}function m(a){o.contains(a.target)||b()}function y(a){a.key==="Escape"&&b()}async function A(){let a=B.value.trim();if(a.length<10){H.textContent="Please enter at least 10 characters.";return}H.textContent="",E.disabled=!0,E.textContent="Sending\u2026";let w=v.querySelector(".ib-bar-title-input"),M=(w==null?void 0:w.value.trim())||null,O=v.querySelector(".ib-bar-email"),J=(O==null?void 0:O.value.trim())||null;try{let F=await j(e.apiKey,a,J,M,{sentiment:t,target:e.target,source:e.source},e.apiUrl);d("submit",F),S.textContent="Thanks for your feedback!",E.textContent="Send feedback",setTimeout(()=>{b(),x()},2e3)}catch(F){d("error",F instanceof Error?F:new Error("Something went wrong.")),H.textContent=F instanceof Error?F.message:"Something went wrong.",E.disabled=!1,E.textContent="Send feedback"}}function I(a){n.classList.remove("ib-bar-btn--active"),g.classList.remove("ib-bar-btn--active"),a.classList.add("ib-bar-btn--active")}return n.addEventListener("click",()=>{d("vote",{sentiment:"positive"}),I(n),i("positive")}),g.addEventListener("click",()=>{d("vote",{sentiment:"negative"}),I(g),i("negative")}),E.addEventListener("click",A),{element:o,on(a,w){var M;(M=r[a])==null||M.push(w)},destroy(){b(),o.remove()}}}var V=`/* InputBuffer Modal Styles
2
+ * All #ib-* IDs are stable public API \u2014 do not rename them.
3
+ * Developers may target these IDs from their own stylesheets to customize the widget.
4
+ */
5
+
6
+ #ib-overlay {
7
+ position: fixed;
8
+ top: 0;
9
+ right: 0;
10
+ bottom: 0;
11
+ left: 0;
12
+ background: rgba(0, 0, 0, 0.5);
13
+ z-index: 2147483647;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ }
18
+
19
+ #ib-modal {
20
+ --ib-primary: #6366f1;
21
+ --ib-primary-hover: #4338ca;
22
+ --ib-background: #f6f6f8;
23
+ --ib-surface: #ffffff;
24
+ --ib-text: #111827;
25
+ --ib-muted: #8d99ae;
26
+ --ib-border: var(--ib-primary);
27
+ --ib-focus-color: var(--ib-primary);
28
+ --ib-input-hover-border: var(--ib-border);
29
+ --ib-selected: var(--ib-primary);
30
+ --ib-selected-color: var(--ib-surface);
31
+ --ib-radius: 2px;
32
+ --ib-radius-input: 2px;
33
+
34
+ color: var(--ib-text);
35
+ border: 1px solid var(--ib-border);
36
+ border-radius: var(--ib-radius);
37
+ width: 100%;
38
+ max-width: 480px;
39
+ margin: 16px;
40
+ position: relative;
41
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
42
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
43
+ font-size: 14px;
44
+ box-sizing: border-box;
45
+ overflow: hidden;
46
+ }
47
+
48
+ #ib-modal-header {
49
+ background: var(--ib-surface);
50
+ padding: 12px 16px;
51
+ border-bottom: 1px solid var(--ib-border);
52
+ display: flex;
53
+ align-items: center;
54
+ gap: 8px;
55
+ }
56
+
57
+ #ib-modal-body {
58
+ background-color: var(--ib-background);
59
+ padding: 16px;
60
+ }
61
+
62
+ #ib-title,
63
+ .ib-modal-title {
64
+ font-size: 11px;
65
+ font-weight: 600;
66
+ text-transform: uppercase;
67
+ letter-spacing: 0.1em;
68
+ margin: 0;
69
+ color: var(--ib-muted);
70
+ flex: 1;
71
+ }
72
+
73
+ #ib-textarea,
74
+ .ib-modal-textarea {
75
+ width: 100%;
76
+ background: var(--ib-background);
77
+ border: 1px solid var(--ib-border);
78
+ border-radius: var(--ib-radius-input);
79
+ padding: 10px 12px;
80
+ font-size: 14px;
81
+ font-family: inherit;
82
+ color: var(--ib-text);
83
+ resize: vertical;
84
+ min-height: 100px;
85
+ box-sizing: border-box;
86
+ outline: none;
87
+ display: block;
88
+ }
89
+
90
+ #ib-textarea:hover,
91
+ .ib-modal-textarea:hover {
92
+ border-color: var(--ib-input-hover-border);
93
+ }
94
+
95
+ #ib-textarea:focus,
96
+ .ib-modal-textarea:focus {
97
+ border-color: var(--ib-focus-color);
98
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--ib-focus-color) 15%, transparent);
99
+ }
100
+
101
+ #ib-modal-body #ib-title-input,
102
+ #ib-modal-body .ib-modal-title-input,
103
+ #ib-modal-body #ib-email,
104
+ #ib-modal-body .ib-modal-email {
105
+ width: 100%;
106
+ background: var(--ib-background);
107
+ border: 1px solid var(--ib-border);
108
+ border-radius: var(--ib-radius-input);
109
+ padding: 8px 12px;
110
+ font-size: 14px;
111
+ font-family: inherit;
112
+ color: var(--ib-text);
113
+ box-sizing: border-box;
114
+ outline: none;
115
+ display: block;
116
+ }
117
+
118
+ #ib-title-input,
119
+ .ib-modal-title-input {
120
+ margin-bottom: 10px;
121
+ }
122
+
123
+ #ib-email,
124
+ .ib-modal-email {
125
+ margin-top: 10px;
126
+ }
127
+
128
+ #ib-modal-body #ib-title-input:hover,
129
+ #ib-modal-body .ib-modal-title-input:hover,
130
+ #ib-modal-body #ib-email:hover,
131
+ #ib-modal-body .ib-modal-email:hover {
132
+ border-color: var(--ib-input-hover-border);
133
+ }
134
+
135
+ #ib-modal-body #ib-title-input:focus,
136
+ #ib-modal-body .ib-modal-title-input:focus,
137
+ #ib-modal-body #ib-email:focus,
138
+ #ib-modal-body .ib-modal-email:focus {
139
+ border-color: var(--ib-focus-color);
140
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--ib-focus-color) 15%, transparent);
141
+ }
142
+
143
+ #ib-submit,
144
+ .ib-modal-submit {
145
+ background: var(--ib-primary);
146
+ color: #ffffff;
147
+ border: none;
148
+ border-radius: var(--ib-radius-input);
149
+ padding: 8px 16px;
150
+ font-size: 11px;
151
+ font-weight: 600;
152
+ text-transform: uppercase;
153
+ letter-spacing: 0.08em;
154
+ font-family: inherit;
155
+ cursor: pointer;
156
+ display: inline-block;
157
+ transition: background 0.15s;
158
+ }
159
+
160
+ #ib-submit:hover,
161
+ .ib-modal-submit:hover {
162
+ background: var(--ib-primary-hover);
163
+ }
164
+
165
+ #ib-submit:disabled,
166
+ .ib-modal-submit:disabled {
167
+ opacity: 0.6;
168
+ cursor: not-allowed;
169
+ }
170
+
171
+ #ib-close,
172
+ .ib-modal-close {
173
+ background: none;
174
+ border: none;
175
+ font-size: 18px;
176
+ line-height: 1;
177
+ cursor: pointer;
178
+ color: var(--ib-muted);
179
+ padding: 2px 6px;
180
+ margin: 0;
181
+ border-radius: var(--ib-radius-input);
182
+ flex-shrink: 0;
183
+ }
184
+
185
+ #ib-close:hover,
186
+ .ib-modal-close:hover {
187
+ color: var(--ib-primary);
188
+ }
189
+
190
+ #ib-success,
191
+ .ib-modal-success {
192
+ color: #16a34a;
193
+ font-size: 11px;
194
+ font-weight: 600;
195
+ text-transform: uppercase;
196
+ letter-spacing: 0.08em;
197
+ margin: 8px 0 0;
198
+ display: none;
199
+ }
200
+
201
+ .ib-modal-footer {
202
+ display: flex;
203
+ align-items: center;
204
+ justify-content: space-between;
205
+ margin-top: 12px;
206
+ }
207
+
208
+ .ib-branding a {
209
+ font-size: 10px;
210
+ color: var(--ib-muted);
211
+ text-decoration: none;
212
+ letter-spacing: 0.03em;
213
+ }
214
+
215
+ .ib-branding a:hover {
216
+ color: var(--ib-primary);
217
+ text-decoration: underline;
218
+ }
219
+
220
+ #ib-error,
221
+ .ib-modal-error {
222
+ color: #dc2626;
223
+ font-size: 11px;
224
+ font-weight: 600;
225
+ text-transform: uppercase;
226
+ letter-spacing: 0.08em;
227
+ margin: 8px 0 0;
228
+ display: none;
229
+ }
230
+
231
+ /* Modal sentiment thumbs */
232
+
233
+ .ib-modal-sentiment {
234
+ display: flex;
235
+ gap: 4px;
236
+ }
237
+
238
+ .ib-modal-thumb {
239
+ width: 30px;
240
+ height: 30px;
241
+ display: flex;
242
+ align-items: center;
243
+ justify-content: center;
244
+ background: var(--ib-background);
245
+ border: 1px solid var(--ib-border);
246
+ border-radius: var(--ib-radius-input);
247
+ color: var(--ib-primary);
248
+ cursor: pointer;
249
+ transition: background 0.15s, color 0.15s;
250
+ padding: 0;
251
+ margin: 0;
252
+ flex-shrink: 0;
253
+ -webkit-appearance: none;
254
+ appearance: none;
255
+ box-sizing: border-box;
256
+ }
257
+
258
+ .ib-modal-thumb:hover {
259
+ background: var(--ib-primary);
260
+ color: var(--ib-surface);
261
+ }
262
+
263
+ .ib-modal-thumb:focus {
264
+ outline: 1px solid var(--ib-primary);
265
+ outline-offset: -1px;
266
+ }
267
+
268
+ .ib-modal-thumb--active {
269
+ background: var(--ib-selected);
270
+ color: var(--ib-selected-color);
271
+ }
272
+
273
+ .ib-modal-thumb--active:hover {
274
+ background: var(--ib-primary-hover);
275
+ }
276
+
277
+ /* \u2500\u2500 Dark theme \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
278
+
279
+ @media (prefers-color-scheme: dark) {
280
+ #ib-modal:not(.ib-theme-light),
281
+ #ib-modal.ib-theme-dark {
282
+ --ib-primary: #3A5244;
283
+ --ib-primary-hover: #4E6857;
284
+ --ib-background: #25272B;
285
+ --ib-surface: #2C3630;
286
+ --ib-text: #E5E7EB;
287
+ --ib-muted: #9CA3AF;
288
+ --ib-border: #363840;
289
+ --ib-focus-color: #7B9B82;
290
+ --ib-input-hover-border: rgba(255, 255, 255, 0.2);
291
+ --ib-radius: 8px;
292
+ --ib-radius-input: 4px;
293
+ }
294
+ }
295
+
296
+ #ib-modal.ib-theme-dark {
297
+ --ib-primary: #3A5244;
298
+ --ib-primary-hover: #4E6857;
299
+ --ib-background: #25272B;
300
+ --ib-surface: #2C3630;
301
+ --ib-text: #E5E7EB;
302
+ --ib-muted: #9CA3AF;
303
+ --ib-border: #363840;
304
+ --ib-focus-color: #7B9B82;
305
+ --ib-input-hover-border: rgba(255, 255, 255, 0.2);
306
+ --ib-radius: 8px;
307
+ --ib-radius-input: 4px;
308
+ }
309
+ `;var q=`/* InputBuffer Feedback Bar Styles
310
+ * .ib-bar-* and .ib-bar-popover* classes are stable public API \u2014 do not rename them.
311
+ * Developers may target these classes from their own stylesheets to customize the widget.
312
+ */
313
+
314
+ .ib-bar-wrapper {
315
+ --ib-primary: #6366f1;
316
+ --ib-primary-hover: #4338ca;
317
+ --ib-background: #f6f6f8;
318
+ --ib-surface: #ffffff;
319
+ --ib-text: #111827;
320
+ --ib-muted: #8d99ae;
321
+ --ib-border: var(--ib-primary);
322
+ --ib-focus-color: var(--ib-primary);
323
+ --ib-input-hover-border: var(--ib-border);
324
+ --ib-selected: var(--ib-primary);
325
+ --ib-selected-color: var(--ib-surface);
326
+ --ib-radius: 2px;
327
+ --ib-radius-input: 2px;
328
+
329
+ position: relative;
330
+ display: inline-block;
331
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
332
+ }
333
+
334
+ .ib-bar-wrapper--fixed {
335
+ position: fixed;
336
+ bottom: 32px;
337
+ right: 32px;
338
+ z-index: 9998;
339
+ }
340
+
341
+ .ib-bar {
342
+ display: inline-flex;
343
+ align-items: stretch;
344
+ height: 40px;
345
+ width: 100%;
346
+ overflow: hidden;
347
+
348
+ background-color: var(--ib-background);
349
+ border: 1px solid var(--ib-border);
350
+ border-radius: 2px;
351
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
352
+ box-sizing: border-box;
353
+ }
354
+
355
+ .ib-bar-popover {
356
+ display: none;
357
+ position: absolute;
358
+ bottom: calc(100% + 8px);
359
+ right: 0;
360
+ width: 320px;
361
+
362
+ border: 1px solid var(--ib-border);
363
+ border-radius: var(--ib-radius);
364
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
365
+ box-sizing: border-box;
366
+ z-index: 9999;
367
+ overflow: hidden;
368
+ }
369
+
370
+ .ib-bar-popover--visible {
371
+ display: block;
372
+ }
373
+
374
+ .ib-bar-header {
375
+ background: var(--ib-surface);
376
+ padding: 12px 16px;
377
+ border-bottom: 1px solid var(--ib-border);
378
+ }
379
+
380
+ .ib-bar-body {
381
+ background: var(--ib-background);
382
+ padding: 16px;
383
+ }
384
+
385
+ .ib-bar-title {
386
+ font-size: 11px;
387
+ font-weight: 600;
388
+ text-transform: uppercase;
389
+ letter-spacing: 0.1em;
390
+ color: var(--ib-text);
391
+ margin: 0;
392
+ }
393
+
394
+ .ib-bar-textarea {
395
+ width: 100%;
396
+ background: var(--ib-background);
397
+ border: 1px solid var(--ib-border);
398
+ border-radius: var(--ib-radius-input);
399
+ padding: 10px 12px;
400
+ font-size: 14px;
401
+ font-family: inherit;
402
+ color: var(--ib-text);
403
+ resize: vertical;
404
+ min-height: 80px;
405
+ box-sizing: border-box;
406
+ outline: none;
407
+ display: block;
408
+ }
409
+
410
+ .ib-bar-textarea:hover {
411
+ border-color: var(--ib-input-hover-border);
412
+ }
413
+
414
+ .ib-bar-textarea:focus {
415
+ border-color: var(--ib-focus-color);
416
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--ib-focus-color) 15%, transparent);
417
+ }
418
+
419
+ .ib-bar-wrapper .ib-bar-body .ib-bar-title-input,
420
+ .ib-bar-wrapper .ib-bar-body .ib-bar-email {
421
+ width: 100%;
422
+ background: var(--ib-background);
423
+ border: 1px solid var(--ib-border);
424
+ border-radius: var(--ib-radius-input);
425
+ padding: 8px 12px;
426
+ font-size: 14px;
427
+ font-family: inherit;
428
+ color: var(--ib-text);
429
+ box-sizing: border-box;
430
+ outline: none;
431
+ display: block;
432
+ }
433
+
434
+ .ib-bar-title-input {
435
+ margin-bottom: 8px;
436
+ }
437
+
438
+ .ib-bar-email {
439
+ margin-top: 8px;
440
+ }
441
+
442
+ .ib-bar-wrapper .ib-bar-body .ib-bar-title-input:hover,
443
+ .ib-bar-wrapper .ib-bar-body .ib-bar-email:hover {
444
+ border-color: var(--ib-input-hover-border);
445
+ }
446
+
447
+ .ib-bar-wrapper .ib-bar-body .ib-bar-title-input:focus,
448
+ .ib-bar-wrapper .ib-bar-body .ib-bar-email:focus {
449
+ border-color: var(--ib-focus-color);
450
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--ib-focus-color) 15%, transparent);
451
+ }
452
+
453
+ .ib-bar-submit {
454
+ background: var(--ib-primary);
455
+ color: #ffffff;
456
+ border: none;
457
+ border-radius: var(--ib-radius-input);
458
+ padding: 8px 16px;
459
+ font-size: 11px;
460
+ font-weight: 600;
461
+ text-transform: uppercase;
462
+ letter-spacing: 0.08em;
463
+ font-family: inherit;
464
+ cursor: pointer;
465
+ display: inline-block;
466
+ transition: background 0.15s;
467
+ }
468
+
469
+ .ib-bar-submit:hover {
470
+ background: var(--ib-primary-hover);
471
+ }
472
+
473
+ .ib-bar-submit:disabled {
474
+ opacity: 0.6;
475
+ cursor: not-allowed;
476
+ }
477
+
478
+ .ib-bar-footer {
479
+ display: flex;
480
+ align-items: center;
481
+ justify-content: space-between;
482
+ margin-top: 10px;
483
+ }
484
+
485
+ .ib-branding a {
486
+ font-size: 10px;
487
+ color: var(--ib-muted);
488
+ text-decoration: none;
489
+ letter-spacing: 0.03em;
490
+ }
491
+
492
+ .ib-branding a:hover {
493
+ color: var(--ib-primary);
494
+ text-decoration: underline;
495
+ }
496
+
497
+ .ib-bar-error,
498
+ .ib-bar-success {
499
+ font-size: 11px;
500
+ font-weight: 600;
501
+ text-transform: uppercase;
502
+ letter-spacing: 0.08em;
503
+ margin: 8px 0 0;
504
+ }
505
+
506
+ .ib-bar-error:empty,
507
+ .ib-bar-success:empty {
508
+ display: none;
509
+ }
510
+
511
+ .ib-bar-error {
512
+ color: #dc2626;
513
+ }
514
+
515
+ .ib-bar-success {
516
+ color: #16a34a;
517
+ }
518
+
519
+ .ib-bar-label-area {
520
+ flex: 1;
521
+ display: flex;
522
+ align-items: center;
523
+ padding: 0 16px;
524
+ }
525
+
526
+ .ib-bar-label {
527
+ font-size: 11px;
528
+ font-weight: 600;
529
+ color: var(--ib-muted);
530
+ text-transform: uppercase;
531
+ letter-spacing: 0.1em;
532
+ white-space: nowrap;
533
+ user-select: none;
534
+ }
535
+
536
+ .ib-bar-actions {
537
+ display: flex;
538
+ align-items: stretch;
539
+ background: var(--ib-background);
540
+ border-left: 1px solid var(--ib-border);
541
+ }
542
+
543
+ .ib-bar-actions--no-label {
544
+ border-left: none;
545
+ }
546
+
547
+ .ib-bar-btn {
548
+ width: 40px;
549
+ display: flex;
550
+ align-items: center;
551
+ justify-content: center;
552
+ background: var(--ib-background);
553
+ border: none;
554
+ border-right: 1px solid var(--ib-border);
555
+ border-radius: 0;
556
+ color: var(--ib-primary);
557
+ cursor: pointer;
558
+ transition: background 0.15s, color 0.15s, transform 0.1s;
559
+ padding: 0;
560
+ -webkit-appearance: none;
561
+ appearance: none;
562
+ box-sizing: border-box;
563
+ margin: 0;
564
+ }
565
+
566
+ .ib-bar-btn--down {
567
+ border-right: none;
568
+ }
569
+
570
+ .ib-bar-btn:hover {
571
+ background: var(--ib-primary);
572
+ color: var(--ib-surface);
573
+ transform: scale(1.15);
574
+ }
575
+
576
+ .ib-bar-btn:active {
577
+ transform: scale(0.95);
578
+ }
579
+
580
+ .ib-bar-btn:focus {
581
+ outline: 1px solid var(--ib-primary);
582
+ outline-offset: -1px;
583
+ }
584
+
585
+ .ib-bar-btn--active {
586
+ background: var(--ib-selected);
587
+ color: var(--ib-selected-color);
588
+ }
589
+
590
+ .ib-bar-btn--active:hover {
591
+ background: var(--ib-primary-hover, var(--ib-primary));
592
+ color: var(--ib-surface);
593
+ transform: scale(1.1);
594
+ }
595
+
596
+ /* \u2500\u2500 Dark theme \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
597
+
598
+ @media (prefers-color-scheme: dark) {
599
+ .ib-bar-wrapper:not(.ib-theme-light),
600
+ .ib-bar-wrapper.ib-theme-dark {
601
+ --ib-primary: #3A5244;
602
+ --ib-primary-hover: #4E6857;
603
+ --ib-background: #25272B;
604
+ --ib-surface: #2C3630;
605
+ --ib-text: #E5E7EB;
606
+ --ib-muted: #9CA3AF;
607
+ --ib-border: #363840;
608
+ --ib-focus-color: #7B9B82;
609
+ --ib-input-hover-border: rgba(255, 255, 255, 0.2);
610
+ --ib-selected: #7B9B82;
611
+ --ib-selected-color: #1a2420;
612
+ --ib-radius: 8px;
613
+ --ib-radius-input: 4px;
614
+ }
615
+ }
616
+
617
+ .ib-bar-wrapper.ib-theme-dark {
618
+ --ib-primary: #3A5244;
619
+ --ib-primary-hover: #4E6857;
620
+ --ib-background: #25272B;
621
+ --ib-surface: #2C3630;
622
+ --ib-text: #E5E7EB;
623
+ --ib-muted: #9CA3AF;
624
+ --ib-border: #363840;
625
+ --ib-focus-color: #7B9B82;
626
+ --ib-input-hover-border: rgba(255, 255, 255, 0.2);
627
+ --ib-selected: #7B9B82;
628
+ --ib-selected-color: #1a2420;
629
+ --ib-radius: 8px;
630
+ --ib-radius-input: 4px;
631
+ }
632
+ `;var s=typeof document!="undefined"?document.currentScript:null;function ae(){if(typeof document=="undefined"||document.getElementById("ib-modal-styles"))return;let e=document.createElement("style");e.id="ib-modal-styles",e.textContent=V,document.head.appendChild(e)}function G(){if(typeof document=="undefined"||document.getElementById("ib-bar-styles"))return;let e=document.createElement("style");e.id="ib-bar-styles",e.textContent=q,document.head.appendChild(e)}function Y(e){e.injectStyles!==!1&&ae();let t=U(e),r=null,d=null;return e.attachTo&&(r=document.querySelector(e.attachTo),r&&(d=()=>t.open(),r.addEventListener("click",d))),{open:o=>t.open(o),close:()=>t.close(),on:(o,p)=>t.on(o,p),destroy:()=>{r&&d&&(r.removeEventListener("click",d),r=null,d=null),t.destroy()}}}function oe(e){return e.injectStyles!==!1&&G(),D(e)}if(typeof HTMLElement!="undefined"){class e extends HTMLElement{constructor(){super(...arguments);this._bar=null}connectedCallback(){var u,f,c,h,n,g,v;let d=this.getAttribute("api-key");if(!d)return;let o=this.getAttribute("inject-styles");(o===null?!0:o!=="false")&&G();let l=this.getAttribute("placement");this._bar=D({apiKey:d,apiUrl:(u=this.getAttribute("api-url"))!=null?u:void 0,label:(f=this.getAttribute("label"))!=null?f:void 0,placement:l==="fixed"?"fixed":"inline",theme:{primary:(c=this.getAttribute("theme-primary"))!=null?c:void 0,background:(h=this.getAttribute("theme-background"))!=null?h:void 0,text:(n=this.getAttribute("theme-text"))!=null?n:void 0,selected:(g=this.getAttribute("theme-selected"))!=null?g:void 0,selectedColor:(v=this.getAttribute("theme-selected-color"))!=null?v:void 0}}),this.appendChild(this._bar.element)}disconnectedCallback(){var d;(d=this._bar)==null||d.destroy(),this._bar=null}}typeof customElements!="undefined"&&!customElements.get("inputbuffer-feedback")&&customElements.define("inputbuffer-feedback",e)}var $={createModal:Y,createBar:oe,version:W};typeof window!="undefined"&&(window.InputBufferIO=$);(function(){if(typeof window=="undefined")return;let t=s==null?void 0:s.dataset.apiKey;if(!t)return;let r=s==null?void 0:s.dataset.injectStyles,d=s==null?void 0:s.dataset.colorScheme,o=Y({apiKey:t,apiUrl:s==null?void 0:s.dataset.apiUrl,attachTo:s==null?void 0:s.dataset.attachTo,injectStyles:r===void 0?!0:r!=="false",colorScheme:d,theme:{primary:s==null?void 0:s.dataset.themePrimary,background:s==null?void 0:s.dataset.themeBackground,text:s==null?void 0:s.dataset.themeText,selected:s==null?void 0:s.dataset.themeSelected,selectedColor:s==null?void 0:s.dataset.themeSelectedColor}});$._defaultInstance=o})();})();