@inputbuffer/feedback 0.3.0 → 0.3.1

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/bar.css CHANGED
@@ -1 +1 @@
1
- .ib-bar-wrapper{--ib-primary: #6366f1;--ib-primary-hover: #4338ca;--ib-background: #f6f6f8;--ib-surface: #ffffff;--ib-text: #111827;--ib-muted: #8d99ae;--ib-border: var(--ib-primary);--ib-focus-color: var(--ib-primary);--ib-input-hover-border: var(--ib-border);--ib-selected: var(--ib-primary);--ib-selected-color: var(--ib-surface);--ib-radius: 2px;--ib-radius-input: 2px;position:relative;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.ib-bar-wrapper--fixed{position:fixed;bottom:32px;right:32px;z-index:9998}.ib-bar{display:inline-flex;align-items:stretch;height:40px;width:100%;overflow:hidden;background-color:var(--ib-background);border:1px solid var(--ib-border);border-radius:2px;box-shadow:0 1px 4px #00000014;box-sizing:border-box}.ib-bar-popover{display:none;position:fixed;width:320px;border:1px solid var(--ib-border);border-radius:var(--ib-radius);box-shadow:0 1px 3px #0000001f;box-sizing:border-box;z-index:9999;overflow:hidden}.ib-bar-popover--visible{display:block}.ib-bar-header{background:var(--ib-surface);padding:12px 16px;border-bottom:1px solid var(--ib-border)}.ib-bar-body{background:var(--ib-background);padding:16px}.ib-bar-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.1em;color:var(--ib-text);margin:0}.ib-bar-textarea{width:100%;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);padding:10px 12px;font-size:14px;font-family:inherit;color:var(--ib-text);resize:vertical;min-height:80px;box-sizing:border-box;outline:none;display:block}.ib-bar-textarea:hover{border-color:var(--ib-input-hover-border)}.ib-bar-textarea:focus{border-color:var(--ib-focus-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--ib-focus-color) 15%,transparent)}.ib-bar-wrapper .ib-bar-body .ib-bar-title-input{width:100%;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);padding:8px 12px;font-size:14px;font-family:inherit;color:var(--ib-text);box-sizing:border-box;outline:none;display:block}.ib-bar-title-input{margin-bottom:8px}.ib-bar-wrapper .ib-bar-body .ib-bar-title-input:hover{border-color:var(--ib-input-hover-border)}.ib-bar-wrapper .ib-bar-body .ib-bar-title-input:focus{border-color:var(--ib-focus-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--ib-focus-color) 15%,transparent)}.ib-bar-submit{background:var(--ib-primary);color:#fff;border:none;border-radius:var(--ib-radius-input);padding:8px 16px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;font-family:inherit;cursor:pointer;display:inline-block;transition:background .15s}.ib-bar-submit:hover{background:var(--ib-primary-hover)}.ib-bar-submit:disabled{opacity:.6;cursor:not-allowed}.ib-bar-footer{display:flex;align-items:center;justify-content:space-between;margin-top:10px}.ib-branding a{font-size:10px;color:var(--ib-muted);text-decoration:none;letter-spacing:.03em}.ib-branding a:hover{color:var(--ib-primary);text-decoration:underline}.ib-bar-error,.ib-bar-success{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;margin:8px 0 0}.ib-bar-error:empty,.ib-bar-success:empty{display:none}.ib-bar-error{color:#dc2626}.ib-bar-success{color:#16a34a}.ib-bar-label-area{flex:1;display:flex;align-items:center;padding:0 16px}.ib-bar-label{font-size:11px;font-weight:600;color:var(--ib-muted);text-transform:uppercase;letter-spacing:.1em;white-space:nowrap;user-select:none}.ib-bar-actions{display:flex;align-items:stretch;background:var(--ib-background);border-left:1px solid var(--ib-border)}.ib-bar-actions--no-label{border-left:none}.ib-bar-btn{width:40px;display:flex;align-items:center;justify-content:center;background:var(--ib-background);border:none;border-right:1px solid var(--ib-border);border-radius:0;color:var(--ib-primary);cursor:pointer;transition:background .15s,color .15s,transform .1s;padding:0;-webkit-appearance:none;appearance:none;box-sizing:border-box;margin:0}.ib-bar-btn--down{border-right:none}.ib-bar-btn:hover{background:var(--ib-primary);color:var(--ib-surface);transform:scale(1.15)}.ib-bar-btn:active{transform:scale(.95)}.ib-bar-btn:focus{outline:1px solid var(--ib-primary);outline-offset:-1px}.ib-bar-btn--active{background:var(--ib-selected);color:var(--ib-selected-color)}.ib-bar-btn--active:hover{background:var(--ib-primary-hover, var(--ib-primary));color:var(--ib-surface);transform:scale(1.1)}@media (prefers-color-scheme: dark){.ib-bar-wrapper:not(.ib-theme-light),.ib-bar-wrapper.ib-theme-dark{--ib-primary: #3A5244;--ib-primary-hover: #4E6857;--ib-background: #25272B;--ib-surface: #2C3630;--ib-text: #E5E7EB;--ib-muted: #9CA3AF;--ib-border: #363840;--ib-focus-color: #7B9B82;--ib-input-hover-border: rgba(255, 255, 255, .2);--ib-selected: #7B9B82;--ib-selected-color: #1a2420;--ib-radius: 8px;--ib-radius-input: 4px}}.ib-bar-wrapper.ib-theme-dark{--ib-primary: #3A5244;--ib-primary-hover: #4E6857;--ib-background: #25272B;--ib-surface: #2C3630;--ib-text: #E5E7EB;--ib-muted: #9CA3AF;--ib-border: #363840;--ib-focus-color: #7B9B82;--ib-input-hover-border: rgba(255, 255, 255, .2);--ib-selected: #7B9B82;--ib-selected-color: #1a2420;--ib-radius: 8px;--ib-radius-input: 4px}
1
+ .ib-bar-wrapper{--ib-primary: #6366f1;--ib-primary-hover: #4338ca;--ib-background: #f6f6f8;--ib-surface: #ffffff;--ib-text: #111827;--ib-muted: #8d99ae;--ib-border: var(--ib-primary);--ib-focus-color: var(--ib-primary);--ib-input-hover-border: var(--ib-border);--ib-selected: var(--ib-primary);--ib-selected-color: var(--ib-surface);--ib-radius: 2px;--ib-radius-input: 2px;position:relative;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.ib-bar-wrapper--fixed{position:fixed;bottom:32px;right:32px;z-index:9998}.ib-bar{display:inline-flex;align-items:stretch;height:40px;width:100%;overflow:hidden;background-color:var(--ib-background);border:1px solid var(--ib-border);border-radius:2px;box-shadow:0 1px 4px #00000014;box-sizing:border-box}.ib-bar-popover{display:none;position:fixed;width:320px;border:1px solid var(--ib-border);border-radius:var(--ib-radius);box-shadow:0 1px 3px #0000001f;box-sizing:border-box;z-index:9999;overflow:hidden}.ib-bar-popover--visible{display:block}.ib-bar-header{background:var(--ib-surface);padding:12px 16px;border-bottom:1px solid var(--ib-border)}.ib-bar-body{background:var(--ib-background);padding:16px}.ib-bar-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.1em;color:var(--ib-text);margin:0}.ib-bar-textarea{width:100%;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);padding:10px 12px;font-size:14px;font-family:inherit;color:var(--ib-text);resize:vertical;min-height:80px;box-sizing:border-box;outline:none;display:block}.ib-bar-textarea:hover{border-color:var(--ib-input-hover-border)}.ib-bar-textarea:focus{border-color:var(--ib-focus-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--ib-focus-color) 15%,transparent)}.ib-bar-wrapper .ib-bar-body .ib-bar-title-input{width:100%;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);padding:8px 12px;font-size:14px;font-family:inherit;color:var(--ib-text);box-sizing:border-box;outline:none;display:block}.ib-bar-title-input{margin-bottom:8px}.ib-bar-wrapper .ib-bar-body .ib-bar-title-input:hover{border-color:var(--ib-input-hover-border)}.ib-bar-wrapper .ib-bar-body .ib-bar-title-input:focus{border-color:var(--ib-focus-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--ib-focus-color) 15%,transparent)}.ib-bar-submit{background:var(--ib-primary);color:#fff;border:none;border-radius:var(--ib-radius-input);padding:8px 16px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;font-family:inherit;cursor:pointer;display:inline-block;transition:background .15s}.ib-bar-submit:hover{background:var(--ib-primary-hover)}.ib-bar-submit:disabled{opacity:.6;cursor:not-allowed}.ib-bar-footer{display:flex;align-items:center;justify-content:space-between;margin-top:10px}.ib-branding a{font-size:10px;color:var(--ib-muted);text-decoration:none;letter-spacing:.03em}.ib-branding a:hover{color:var(--ib-primary);text-decoration:underline}.ib-bar-error,.ib-bar-success{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;margin:8px 0 0}.ib-bar-error:empty,.ib-bar-success:empty{display:none}.ib-bar-error{color:#dc2626}.ib-bar-success{color:#16a34a}.ib-bar-label-area{flex:1;display:flex;align-items:center;padding:0 16px}.ib-bar-label{font-size:11px;font-weight:600;color:var(--ib-muted);text-transform:uppercase;letter-spacing:.1em;white-space:nowrap;user-select:none}.ib-bar-actions{display:flex;align-items:stretch;background:var(--ib-background);border-left:1px solid var(--ib-border)}.ib-bar-actions--no-label{border-left:none}.ib-bar-btn{width:40px;display:flex;align-items:center;justify-content:center;background:var(--ib-background);border:none;border-right:1px solid var(--ib-border);border-radius:0;color:var(--ib-primary);cursor:pointer;transition:background .15s,color .15s,transform .1s;padding:0;-webkit-appearance:none;appearance:none;box-sizing:border-box;margin:0}.ib-bar-btn--down{border-right:none}.ib-bar-btn:hover{background:var(--ib-primary);color:var(--ib-surface);transform:scale(1.15)}.ib-bar-btn:active{transform:scale(.95)}.ib-bar-btn:focus{outline:1px solid var(--ib-primary);outline-offset:-1px}.ib-bar-btn--active{background:var(--ib-selected);color:var(--ib-selected-color)}.ib-bar-btn--active:hover{background:var(--ib-primary-hover, var(--ib-primary));color:var(--ib-surface);transform:scale(1.1)}@media(prefers-color-scheme:dark){.ib-bar-wrapper:not(.ib-theme-light),.ib-bar-wrapper.ib-theme-dark{--ib-primary: #3A5244;--ib-primary-hover: #4E6857;--ib-background: #25272B;--ib-surface: #2C3630;--ib-text: #E5E7EB;--ib-muted: #9CA3AF;--ib-border: #363840;--ib-focus-color: #7B9B82;--ib-input-hover-border: rgba(255, 255, 255, .2);--ib-selected: #7B9B82;--ib-selected-color: #1a2420;--ib-radius: 8px;--ib-radius-input: 4px}}.ib-bar-wrapper.ib-theme-dark{--ib-primary: #3A5244;--ib-primary-hover: #4E6857;--ib-background: #25272B;--ib-surface: #2C3630;--ib-text: #E5E7EB;--ib-muted: #9CA3AF;--ib-border: #363840;--ib-focus-color: #7B9B82;--ib-input-hover-border: rgba(255, 255, 255, .2);--ib-selected: #7B9B82;--ib-selected-color: #1a2420;--ib-radius: 8px;--ib-radius-input: 4px}
package/dist/bar.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- var x=class extends Error{constructor(t){super(t.detail),this.name="ApiError",this.type=t.type,this.title=t.title,this.status=t.status,this.detail=t.detail,this.category=t.category,this.field=t.field}};var K="Something went wrong. Please try again.";function V(e){return e instanceof x?e.category==="user"?e.detail:(e.category==="integration"&&w(`${e.title}: ${e.detail}`,e.type),K):K}function w(e,t){typeof console!="undefined"&&console.warn(`[inputbuffer] ${e}`,t!=null?t:"")}var z="0.3.0",ae="https://inputbuffer.io",se="/api/v0/feedback",de="/api/v0/reactions",ce=1e4,le=5e3,be=500,pe=300;function q(e,t){return`${(e!=null?e:ae).replace(/\/+$/,"")}${t}`}async function G(e,t,i){var b,a,p,d;let n=new AbortController,l=setTimeout(()=>n.abort(),ce),s;try{s=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${z} (javascript)`},body:JSON.stringify(i),credentials:"omit",signal:n.signal})}finally{clearTimeout(l)}if(!s.ok){let u=await s.json().catch(()=>({}));throw new x({type:(b=u.type)!=null?b:"https://inputbuffer.io/docs/api/problems/internal-error",title:(a=u.title)!=null?a:"Error",detail:(p=u.detail)!=null?p:"Submission failed. Please try again.",status:(d=u.status)!=null?d:s.status,category:u.category,field:u.field})}return s}async function J(e,t,i,n,l){let s={description:t.slice(0,le)};if(i&&(s.title=i.slice(0,be)),n!=null&&n.submittedBy&&(s.submitted_by=n.submittedBy.slice(0,pe)),n!=null&&n.target){let p=n.target;s.targets=[{type:p.type,metadata:p.metadata}]}let b=await G(q(l,se),e,s),{data:a}=await b.json();return{id:a.id}}async function X(e,t,i,n,l){let s={reaction_value:t,target:{type:i.type,metadata:i.metadata}};n&&(s.user_id=n);let b;try{b=await G(q(l,de),e,s)}catch(p){throw p instanceof x&&p.status===422&&p.field==="user_id"&&w("Reaction rejected: no user_id and no client IP. Set the `userId` option (or the `user-id` attribute)."),p}let{data:a}=await b.json();return a}function Y(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 i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",e),t.appendChild(i),t}var ue="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",me="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",fe=24*60*60*1e3;function O(e){var $,W;let t;function i(){let r=e.target;return r?`ib:reaction:${e.apiKey}:${r.type}:${JSON.stringify(r.metadata)}`:`ib:reaction:${e.apiKey}:${window.location.pathname}`}function n(){try{let r=localStorage.getItem(i());if(!r)return null;let{sentiment:f,ts:m}=JSON.parse(r);return Date.now()-m>fe?(localStorage.removeItem(i()),null):f}catch{return null}}function l(r){try{localStorage.setItem(i(),JSON.stringify({sentiment:r,ts:Date.now()}))}catch{}}let s={vote:[],open:[],submit:[],close:[],error:[]};function b(r,f){var m;(m=s[r])==null||m.forEach(E=>E(f))}let a=document.createElement("div"),p=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";a.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+p;let{theme:d={}}=e;d.primary&&a.style.setProperty("--ib-primary",d.primary),d.background&&a.style.setProperty("--ib-background",d.background),d.surface&&a.style.setProperty("--ib-surface",d.surface),d.text&&a.style.setProperty("--ib-text",d.text),d.selected&&a.style.setProperty("--ib-selected",d.selected),d.selectedColor&&a.style.setProperty("--ib-selected-color",d.selectedColor);let u=document.createElement("div");u.className="ib-bar";let F=document.createElement("div");F.className="ib-bar-label-area";let L=document.createElement("span");L.className="ib-bar-label",L.textContent=($=e.label)!=null?$:"Was this helpful?",F.appendChild(L);let B=document.createElement("div");B.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let g=document.createElement("button");g.type="button",g.className="ib-bar-btn ib-bar-btn--up",g.setAttribute("aria-label","Yes"),g.appendChild(Y(ue));let h=document.createElement("button");h.type="button",h.className="ib-bar-btn ib-bar-btn--down",h.setAttribute("aria-label","No"),h.appendChild(Y(me)),B.appendChild(g),B.appendChild(h),e.showLabel!==!1&&u.appendChild(F),u.appendChild(B);let c=document.createElement("div");c.className="ib-bar-popover",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false");let P=document.createElement("div");if(P.className="ib-bar-header",e.modalTitle){c.setAttribute("aria-labelledby","ib-bar-title");let r=document.createElement("p");r.id="ib-bar-title",r.className="ib-bar-title",r.textContent=e.modalTitle,P.appendChild(r)}else c.setAttribute("aria-label","Feedback");let k=document.createElement("div");k.className="ib-bar-body";let y=document.createElement("textarea");y.className="ib-bar-textarea",y.placeholder=(W=e.modalPlaceholder)!=null?W:"What's on your mind?",y.maxLength=5e3,y.setAttribute("aria-label","Feedback");let C=document.createElement("p");C.className="ib-bar-error";let _=document.createElement("p");_.className="ib-bar-success";let v=document.createElement("button");if(v.type="button",v.className="ib-bar-submit",v.textContent="Send feedback",e.showTitleField===!0){let r=document.createElement("input");r.type="text",r.className="ib-bar-title-input",r.placeholder="Title (optional)",r.maxLength=500,r.setAttribute("aria-label","Feedback title"),k.appendChild(r)}k.appendChild(y),k.appendChild(C),k.appendChild(_);let A=document.createElement("div");A.className="ib-bar-footer",A.appendChild(v);let R=document.createElement("div");R.className="ib-branding";let T=document.createElement("a");T.href="https://inputbuffer.io",T.target="_blank",T.rel="noopener noreferrer",T.textContent="Powered by inputbuffer.io",R.appendChild(T),A.appendChild(R),k.appendChild(A),c.appendChild(P),c.appendChild(k),a.appendChild(c),a.appendChild(u);function S(){let r=u.getBoundingClientRect();c.style.top=`${r.top-c.offsetHeight-8}px`,c.style.left=`${r.right-320}px`}function ie(r){t=r,c.classList.add("ib-bar-popover--visible"),requestAnimationFrame(S),C.textContent="",_.textContent="",y.focus(),setTimeout(()=>document.addEventListener("click",M),0),document.addEventListener("keydown",D),window.addEventListener("scroll",S,{passive:!0}),window.addEventListener("resize",S,{passive:!0}),b("open",{sentiment:r})}function I(){c.classList.contains("ib-bar-popover--visible")&&(c.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",M),document.removeEventListener("keydown",D),window.removeEventListener("scroll",S),window.removeEventListener("resize",S),y.value="",b("close"))}function ne(){g.classList.remove("ib-bar-btn--active"),h.classList.remove("ib-bar-btn--active"),t=void 0}function M(r){a.contains(r.target)||I()}function D(r){r.key==="Escape"&&I()}async function oe(){let r=y.value.trim();if(r.length<10){C.textContent="Please enter at least 10 characters.";return}C.textContent="",v.disabled=!0,v.textContent="Sending\u2026";let f=c.querySelector(".ib-bar-title-input"),m=(f==null?void 0:f.value.trim())||null;try{let E=await J(e.apiKey,r,m,{sentiment:t,target:e.target,submittedBy:e.submittedBy},e.apiUrl);b("submit",E),_.textContent="Thanks for your feedback!",v.textContent="Send feedback",setTimeout(()=>{I(),ne()},2e3)}catch(E){b("error",E instanceof Error?E:new Error("Something went wrong.")),C.textContent=V(E),v.disabled=!1,v.textContent="Send feedback"}}function H(r){g.classList.remove("ib-bar-btn--active"),h.classList.remove("ib-bar-btn--active"),r.classList.add("ib-bar-btn--active")}let N=n();N&&(t=N,H(N==="positive"?g:h));function U(r,f){var m;l(r),H(f),ie(r),b("vote",{sentiment:r}),e.target&&X(e.apiKey,r==="positive"?1:-1,e.target,(m=e.userId)!=null?m:null,e.apiUrl).catch(()=>{})}return g.addEventListener("click",()=>U("positive",g)),h.addEventListener("click",()=>U("negative",h)),v.addEventListener("click",oe),{element:a,on(r,f){var m;(m=s[r])==null||m.push(f)},destroy(){I(),a.remove()}}}function o(e,t){var i;return(i=e.getAttribute(t))!=null?i:void 0}function Q(e,t){let i=e.getAttribute(t);return i===null?void 0:i==="true"}function ge(e){return{primary:o(e,"theme-primary"),background:o(e,"theme-background"),text:o(e,"theme-text"),selected:o(e,"theme-selected"),selectedColor:o(e,"theme-selected-color")}}function he(e){var i;let t=e.getAttribute("target-type");if(t)switch(t){case"documentation":{let n=(i=o(e,"target-page-url"))!=null?i:typeof window!="undefined"?window.location.href:void 0;if(!n){w('target-type="documentation" needs target-page-url. Ignoring the target.');return}return{type:"documentation",metadata:{page_url:n,section_heading:o(e,"target-section-heading"),doc_version:o(e,"target-doc-version")}}}case"rest_endpoint":{let n=o(e,"target-method"),l=o(e,"target-path");if(!n||!l){w('target-type="rest_endpoint" needs target-method and target-path. Ignoring the target.');return}return{type:"rest_endpoint",metadata:{method:n,path:l,host:o(e,"target-host"),api_version:o(e,"target-api-version")}}}case"cli_command":{let n=o(e,"target-command");if(!n){w('target-type="cli_command" needs target-command. Ignoring the target.');return}let l=o(e,"target-args");return{type:"cli_command",metadata:{command:n,subcommand:o(e,"target-subcommand"),cli_version:o(e,"target-cli-version"),args:l?l.split(",").map(s=>s.trim()).filter(Boolean):void 0}}}default:w(`Unknown target-type "${t}". Expected documentation, rest_endpoint, or cli_command.`);return}}function Z(e,t){return{apiKey:t,apiUrl:o(e,"api-url"),label:o(e,"label"),showLabel:Q(e,"show-label"),placement:e.getAttribute("placement")==="fixed"?"fixed":"inline",colorScheme:o(e,"color-scheme"),modalTitle:o(e,"modal-title"),modalPlaceholder:o(e,"modal-placeholder"),showTitleField:Q(e,"show-title-field"),submittedBy:o(e,"submitted-by"),userId:o(e,"user-id"),target:he(e),theme:ge(e)}}function ee(e){return e.getAttribute("inject-styles")!=="false"}var te=`/* InputBuffer Feedback Bar Styles
1
+ var x=class extends Error{constructor(t){super(t.detail),this.name="ApiError",this.type=t.type,this.title=t.title,this.status=t.status,this.detail=t.detail,this.category=t.category,this.field=t.field}};var K="Something went wrong. Please try again.";function V(e){return e instanceof x?e.category==="user"?e.detail:(e.category==="integration"&&w(`${e.title}: ${e.detail}`,e.type),K):K}function w(e,t){typeof console!="undefined"&&console.warn(`[inputbuffer] ${e}`,t!=null?t:"")}var z="0.3.1",ae="https://inputbuffer.io",se="/api/v0/feedback",de="/api/v0/reactions",ce=1e4,le=5e3,be=500,pe=300;function q(e,t){return`${(e!=null?e:ae).replace(/\/+$/,"")}${t}`}async function G(e,t,i){var b,a,p,d;let n=new AbortController,l=setTimeout(()=>n.abort(),ce),s;try{s=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${z} (javascript)`},body:JSON.stringify(i),credentials:"omit",signal:n.signal})}finally{clearTimeout(l)}if(!s.ok){let u=await s.json().catch(()=>({}));throw new x({type:(b=u.type)!=null?b:"https://inputbuffer.io/docs/api/problems/internal-error",title:(a=u.title)!=null?a:"Error",detail:(p=u.detail)!=null?p:"Submission failed. Please try again.",status:(d=u.status)!=null?d:s.status,category:u.category,field:u.field})}return s}async function J(e,t,i,n,l){let s={description:t.slice(0,le)};if(i&&(s.title=i.slice(0,be)),n!=null&&n.submittedBy&&(s.submitted_by=n.submittedBy.slice(0,pe)),n!=null&&n.target){let p=n.target;s.targets=[{type:p.type,metadata:p.metadata}]}let b=await G(q(l,se),e,s),{data:a}=await b.json();return{id:a.id}}async function X(e,t,i,n,l){let s={reaction_value:t,target:{type:i.type,metadata:i.metadata}};n&&(s.user_id=n);let b;try{b=await G(q(l,de),e,s)}catch(p){throw p instanceof x&&p.status===422&&p.field==="user_id"&&w("Reaction rejected: no user_id and no client IP. Set the `userId` option (or the `user-id` attribute)."),p}let{data:a}=await b.json();return a}function Y(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 i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",e),t.appendChild(i),t}var ue="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",me="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",fe=1440*60*1e3;function O(e){var $,W;let t;function i(){let r=e.target;return r?`ib:reaction:${e.apiKey}:${r.type}:${JSON.stringify(r.metadata)}`:`ib:reaction:${e.apiKey}:${window.location.pathname}`}function n(){try{let r=localStorage.getItem(i());if(!r)return null;let{sentiment:f,ts:m}=JSON.parse(r);return Date.now()-m>fe?(localStorage.removeItem(i()),null):f}catch{return null}}function l(r){try{localStorage.setItem(i(),JSON.stringify({sentiment:r,ts:Date.now()}))}catch{}}let s={vote:[],open:[],submit:[],close:[],error:[]};function b(r,f){var m;(m=s[r])==null||m.forEach(E=>E(f))}let a=document.createElement("div"),p=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";a.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+p;let{theme:d={}}=e;d.primary&&a.style.setProperty("--ib-primary",d.primary),d.background&&a.style.setProperty("--ib-background",d.background),d.surface&&a.style.setProperty("--ib-surface",d.surface),d.text&&a.style.setProperty("--ib-text",d.text),d.selected&&a.style.setProperty("--ib-selected",d.selected),d.selectedColor&&a.style.setProperty("--ib-selected-color",d.selectedColor);let u=document.createElement("div");u.className="ib-bar";let F=document.createElement("div");F.className="ib-bar-label-area";let L=document.createElement("span");L.className="ib-bar-label",L.textContent=($=e.label)!=null?$:"Was this helpful?",F.appendChild(L);let B=document.createElement("div");B.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let g=document.createElement("button");g.type="button",g.className="ib-bar-btn ib-bar-btn--up",g.setAttribute("aria-label","Yes"),g.appendChild(Y(ue));let h=document.createElement("button");h.type="button",h.className="ib-bar-btn ib-bar-btn--down",h.setAttribute("aria-label","No"),h.appendChild(Y(me)),B.appendChild(g),B.appendChild(h),e.showLabel!==!1&&u.appendChild(F),u.appendChild(B);let c=document.createElement("div");c.className="ib-bar-popover",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false");let P=document.createElement("div");if(P.className="ib-bar-header",e.modalTitle){c.setAttribute("aria-labelledby","ib-bar-title");let r=document.createElement("p");r.id="ib-bar-title",r.className="ib-bar-title",r.textContent=e.modalTitle,P.appendChild(r)}else c.setAttribute("aria-label","Feedback");let k=document.createElement("div");k.className="ib-bar-body";let y=document.createElement("textarea");y.className="ib-bar-textarea",y.placeholder=(W=e.modalPlaceholder)!=null?W:"What's on your mind?",y.maxLength=5e3,y.setAttribute("aria-label","Feedback");let C=document.createElement("p");C.className="ib-bar-error";let _=document.createElement("p");_.className="ib-bar-success";let v=document.createElement("button");if(v.type="button",v.className="ib-bar-submit",v.textContent="Send feedback",e.showTitleField===!0){let r=document.createElement("input");r.type="text",r.className="ib-bar-title-input",r.placeholder="Title (optional)",r.maxLength=500,r.setAttribute("aria-label","Feedback title"),k.appendChild(r)}k.appendChild(y),k.appendChild(C),k.appendChild(_);let A=document.createElement("div");A.className="ib-bar-footer",A.appendChild(v);let R=document.createElement("div");R.className="ib-branding";let T=document.createElement("a");T.href="https://inputbuffer.io",T.target="_blank",T.rel="noopener noreferrer",T.textContent="Powered by inputbuffer.io",R.appendChild(T),A.appendChild(R),k.appendChild(A),c.appendChild(P),c.appendChild(k),a.appendChild(c),a.appendChild(u);function S(){let r=u.getBoundingClientRect();c.style.top=`${r.top-c.offsetHeight-8}px`,c.style.left=`${r.right-320}px`}function ie(r){t=r,c.classList.add("ib-bar-popover--visible"),requestAnimationFrame(S),C.textContent="",_.textContent="",y.focus(),setTimeout(()=>document.addEventListener("click",M),0),document.addEventListener("keydown",D),window.addEventListener("scroll",S,{passive:!0}),window.addEventListener("resize",S,{passive:!0}),b("open",{sentiment:r})}function I(){c.classList.contains("ib-bar-popover--visible")&&(c.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",M),document.removeEventListener("keydown",D),window.removeEventListener("scroll",S),window.removeEventListener("resize",S),y.value="",b("close"))}function ne(){g.classList.remove("ib-bar-btn--active"),h.classList.remove("ib-bar-btn--active"),t=void 0}function M(r){a.contains(r.target)||I()}function D(r){r.key==="Escape"&&I()}async function oe(){let r=y.value.trim();if(r.length<10){C.textContent="Please enter at least 10 characters.";return}C.textContent="",v.disabled=!0,v.textContent="Sending\u2026";let f=c.querySelector(".ib-bar-title-input"),m=(f==null?void 0:f.value.trim())||null;try{let E=await J(e.apiKey,r,m,{sentiment:t,target:e.target,submittedBy:e.submittedBy},e.apiUrl);b("submit",E),_.textContent="Thanks for your feedback!",v.textContent="Send feedback",setTimeout(()=>{I(),ne()},2e3)}catch(E){b("error",E instanceof Error?E:new Error("Something went wrong.")),C.textContent=V(E),v.disabled=!1,v.textContent="Send feedback"}}function H(r){g.classList.remove("ib-bar-btn--active"),h.classList.remove("ib-bar-btn--active"),r.classList.add("ib-bar-btn--active")}let N=n();N&&(t=N,H(N==="positive"?g:h));function U(r,f){var m;l(r),H(f),ie(r),b("vote",{sentiment:r}),e.target&&X(e.apiKey,r==="positive"?1:-1,e.target,(m=e.userId)!=null?m:null,e.apiUrl).catch(()=>{})}return g.addEventListener("click",()=>U("positive",g)),h.addEventListener("click",()=>U("negative",h)),v.addEventListener("click",oe),{element:a,on(r,f){var m;(m=s[r])==null||m.push(f)},destroy(){I(),a.remove()}}}function o(e,t){var i;return(i=e.getAttribute(t))!=null?i:void 0}function Q(e,t){let i=e.getAttribute(t);return i===null?void 0:i==="true"}function ge(e){return{primary:o(e,"theme-primary"),background:o(e,"theme-background"),text:o(e,"theme-text"),selected:o(e,"theme-selected"),selectedColor:o(e,"theme-selected-color")}}function he(e){var i;let t=e.getAttribute("target-type");if(t)switch(t){case"documentation":{let n=(i=o(e,"target-page-url"))!=null?i:typeof window!="undefined"?window.location.href:void 0;if(!n){w('target-type="documentation" needs target-page-url. Ignoring the target.');return}return{type:"documentation",metadata:{page_url:n,section_heading:o(e,"target-section-heading"),doc_version:o(e,"target-doc-version")}}}case"rest_endpoint":{let n=o(e,"target-method"),l=o(e,"target-path");if(!n||!l){w('target-type="rest_endpoint" needs target-method and target-path. Ignoring the target.');return}return{type:"rest_endpoint",metadata:{method:n,path:l,host:o(e,"target-host"),api_version:o(e,"target-api-version")}}}case"cli_command":{let n=o(e,"target-command");if(!n){w('target-type="cli_command" needs target-command. Ignoring the target.');return}let l=o(e,"target-args");return{type:"cli_command",metadata:{command:n,subcommand:o(e,"target-subcommand"),cli_version:o(e,"target-cli-version"),args:l?l.split(",").map(s=>s.trim()).filter(Boolean):void 0}}}default:w(`Unknown target-type "${t}". Expected documentation, rest_endpoint, or cli_command.`);return}}function Z(e,t){return{apiKey:t,apiUrl:o(e,"api-url"),label:o(e,"label"),showLabel:Q(e,"show-label"),placement:e.getAttribute("placement")==="fixed"?"fixed":"inline",colorScheme:o(e,"color-scheme"),modalTitle:o(e,"modal-title"),modalPlaceholder:o(e,"modal-placeholder"),showTitleField:Q(e,"show-title-field"),submittedBy:o(e,"submitted-by"),userId:o(e,"user-id"),target:he(e),theme:ge(e)}}function ee(e){return e.getAttribute("inject-styles")!=="false"}var te=`/* InputBuffer Feedback Bar Styles
2
2
  * .ib-bar-* and .ib-bar-popover* classes are stable public API \u2014 do not rename them.
3
3
  * Developers may target these classes from their own stylesheets to customize the widget.
4
4
  */
package/dist/bar.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var x=class extends Error{constructor(t){super(t.detail),this.name="ApiError",this.type=t.type,this.title=t.title,this.status=t.status,this.detail=t.detail,this.category=t.category,this.field=t.field}};var K="Something went wrong. Please try again.";function V(e){return e instanceof x?e.category==="user"?e.detail:(e.category==="integration"&&w(`${e.title}: ${e.detail}`,e.type),K):K}function w(e,t){typeof console!="undefined"&&console.warn(`[inputbuffer] ${e}`,t!=null?t:"")}var z="0.3.0",ae="https://inputbuffer.io",se="/api/v0/feedback",de="/api/v0/reactions",ce=1e4,le=5e3,be=500,pe=300;function q(e,t){return`${(e!=null?e:ae).replace(/\/+$/,"")}${t}`}async function G(e,t,i){var b,a,p,d;let n=new AbortController,l=setTimeout(()=>n.abort(),ce),s;try{s=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${z} (javascript)`},body:JSON.stringify(i),credentials:"omit",signal:n.signal})}finally{clearTimeout(l)}if(!s.ok){let u=await s.json().catch(()=>({}));throw new x({type:(b=u.type)!=null?b:"https://inputbuffer.io/docs/api/problems/internal-error",title:(a=u.title)!=null?a:"Error",detail:(p=u.detail)!=null?p:"Submission failed. Please try again.",status:(d=u.status)!=null?d:s.status,category:u.category,field:u.field})}return s}async function J(e,t,i,n,l){let s={description:t.slice(0,le)};if(i&&(s.title=i.slice(0,be)),n!=null&&n.submittedBy&&(s.submitted_by=n.submittedBy.slice(0,pe)),n!=null&&n.target){let p=n.target;s.targets=[{type:p.type,metadata:p.metadata}]}let b=await G(q(l,se),e,s),{data:a}=await b.json();return{id:a.id}}async function X(e,t,i,n,l){let s={reaction_value:t,target:{type:i.type,metadata:i.metadata}};n&&(s.user_id=n);let b;try{b=await G(q(l,de),e,s)}catch(p){throw p instanceof x&&p.status===422&&p.field==="user_id"&&w("Reaction rejected: no user_id and no client IP. Set the `userId` option (or the `user-id` attribute)."),p}let{data:a}=await b.json();return a}function Y(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 i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",e),t.appendChild(i),t}var ue="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",me="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",fe=24*60*60*1e3;function O(e){var $,W;let t;function i(){let r=e.target;return r?`ib:reaction:${e.apiKey}:${r.type}:${JSON.stringify(r.metadata)}`:`ib:reaction:${e.apiKey}:${window.location.pathname}`}function n(){try{let r=localStorage.getItem(i());if(!r)return null;let{sentiment:f,ts:m}=JSON.parse(r);return Date.now()-m>fe?(localStorage.removeItem(i()),null):f}catch{return null}}function l(r){try{localStorage.setItem(i(),JSON.stringify({sentiment:r,ts:Date.now()}))}catch{}}let s={vote:[],open:[],submit:[],close:[],error:[]};function b(r,f){var m;(m=s[r])==null||m.forEach(E=>E(f))}let a=document.createElement("div"),p=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";a.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+p;let{theme:d={}}=e;d.primary&&a.style.setProperty("--ib-primary",d.primary),d.background&&a.style.setProperty("--ib-background",d.background),d.surface&&a.style.setProperty("--ib-surface",d.surface),d.text&&a.style.setProperty("--ib-text",d.text),d.selected&&a.style.setProperty("--ib-selected",d.selected),d.selectedColor&&a.style.setProperty("--ib-selected-color",d.selectedColor);let u=document.createElement("div");u.className="ib-bar";let F=document.createElement("div");F.className="ib-bar-label-area";let L=document.createElement("span");L.className="ib-bar-label",L.textContent=($=e.label)!=null?$:"Was this helpful?",F.appendChild(L);let B=document.createElement("div");B.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let g=document.createElement("button");g.type="button",g.className="ib-bar-btn ib-bar-btn--up",g.setAttribute("aria-label","Yes"),g.appendChild(Y(ue));let h=document.createElement("button");h.type="button",h.className="ib-bar-btn ib-bar-btn--down",h.setAttribute("aria-label","No"),h.appendChild(Y(me)),B.appendChild(g),B.appendChild(h),e.showLabel!==!1&&u.appendChild(F),u.appendChild(B);let c=document.createElement("div");c.className="ib-bar-popover",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false");let P=document.createElement("div");if(P.className="ib-bar-header",e.modalTitle){c.setAttribute("aria-labelledby","ib-bar-title");let r=document.createElement("p");r.id="ib-bar-title",r.className="ib-bar-title",r.textContent=e.modalTitle,P.appendChild(r)}else c.setAttribute("aria-label","Feedback");let k=document.createElement("div");k.className="ib-bar-body";let y=document.createElement("textarea");y.className="ib-bar-textarea",y.placeholder=(W=e.modalPlaceholder)!=null?W:"What's on your mind?",y.maxLength=5e3,y.setAttribute("aria-label","Feedback");let C=document.createElement("p");C.className="ib-bar-error";let _=document.createElement("p");_.className="ib-bar-success";let v=document.createElement("button");if(v.type="button",v.className="ib-bar-submit",v.textContent="Send feedback",e.showTitleField===!0){let r=document.createElement("input");r.type="text",r.className="ib-bar-title-input",r.placeholder="Title (optional)",r.maxLength=500,r.setAttribute("aria-label","Feedback title"),k.appendChild(r)}k.appendChild(y),k.appendChild(C),k.appendChild(_);let A=document.createElement("div");A.className="ib-bar-footer",A.appendChild(v);let R=document.createElement("div");R.className="ib-branding";let T=document.createElement("a");T.href="https://inputbuffer.io",T.target="_blank",T.rel="noopener noreferrer",T.textContent="Powered by inputbuffer.io",R.appendChild(T),A.appendChild(R),k.appendChild(A),c.appendChild(P),c.appendChild(k),a.appendChild(c),a.appendChild(u);function S(){let r=u.getBoundingClientRect();c.style.top=`${r.top-c.offsetHeight-8}px`,c.style.left=`${r.right-320}px`}function ie(r){t=r,c.classList.add("ib-bar-popover--visible"),requestAnimationFrame(S),C.textContent="",_.textContent="",y.focus(),setTimeout(()=>document.addEventListener("click",M),0),document.addEventListener("keydown",D),window.addEventListener("scroll",S,{passive:!0}),window.addEventListener("resize",S,{passive:!0}),b("open",{sentiment:r})}function I(){c.classList.contains("ib-bar-popover--visible")&&(c.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",M),document.removeEventListener("keydown",D),window.removeEventListener("scroll",S),window.removeEventListener("resize",S),y.value="",b("close"))}function ne(){g.classList.remove("ib-bar-btn--active"),h.classList.remove("ib-bar-btn--active"),t=void 0}function M(r){a.contains(r.target)||I()}function D(r){r.key==="Escape"&&I()}async function oe(){let r=y.value.trim();if(r.length<10){C.textContent="Please enter at least 10 characters.";return}C.textContent="",v.disabled=!0,v.textContent="Sending\u2026";let f=c.querySelector(".ib-bar-title-input"),m=(f==null?void 0:f.value.trim())||null;try{let E=await J(e.apiKey,r,m,{sentiment:t,target:e.target,submittedBy:e.submittedBy},e.apiUrl);b("submit",E),_.textContent="Thanks for your feedback!",v.textContent="Send feedback",setTimeout(()=>{I(),ne()},2e3)}catch(E){b("error",E instanceof Error?E:new Error("Something went wrong.")),C.textContent=V(E),v.disabled=!1,v.textContent="Send feedback"}}function H(r){g.classList.remove("ib-bar-btn--active"),h.classList.remove("ib-bar-btn--active"),r.classList.add("ib-bar-btn--active")}let N=n();N&&(t=N,H(N==="positive"?g:h));function U(r,f){var m;l(r),H(f),ie(r),b("vote",{sentiment:r}),e.target&&X(e.apiKey,r==="positive"?1:-1,e.target,(m=e.userId)!=null?m:null,e.apiUrl).catch(()=>{})}return g.addEventListener("click",()=>U("positive",g)),h.addEventListener("click",()=>U("negative",h)),v.addEventListener("click",oe),{element:a,on(r,f){var m;(m=s[r])==null||m.push(f)},destroy(){I(),a.remove()}}}function o(e,t){var i;return(i=e.getAttribute(t))!=null?i:void 0}function Q(e,t){let i=e.getAttribute(t);return i===null?void 0:i==="true"}function ge(e){return{primary:o(e,"theme-primary"),background:o(e,"theme-background"),text:o(e,"theme-text"),selected:o(e,"theme-selected"),selectedColor:o(e,"theme-selected-color")}}function he(e){var i;let t=e.getAttribute("target-type");if(t)switch(t){case"documentation":{let n=(i=o(e,"target-page-url"))!=null?i:typeof window!="undefined"?window.location.href:void 0;if(!n){w('target-type="documentation" needs target-page-url. Ignoring the target.');return}return{type:"documentation",metadata:{page_url:n,section_heading:o(e,"target-section-heading"),doc_version:o(e,"target-doc-version")}}}case"rest_endpoint":{let n=o(e,"target-method"),l=o(e,"target-path");if(!n||!l){w('target-type="rest_endpoint" needs target-method and target-path. Ignoring the target.');return}return{type:"rest_endpoint",metadata:{method:n,path:l,host:o(e,"target-host"),api_version:o(e,"target-api-version")}}}case"cli_command":{let n=o(e,"target-command");if(!n){w('target-type="cli_command" needs target-command. Ignoring the target.');return}let l=o(e,"target-args");return{type:"cli_command",metadata:{command:n,subcommand:o(e,"target-subcommand"),cli_version:o(e,"target-cli-version"),args:l?l.split(",").map(s=>s.trim()).filter(Boolean):void 0}}}default:w(`Unknown target-type "${t}". Expected documentation, rest_endpoint, or cli_command.`);return}}function Z(e,t){return{apiKey:t,apiUrl:o(e,"api-url"),label:o(e,"label"),showLabel:Q(e,"show-label"),placement:e.getAttribute("placement")==="fixed"?"fixed":"inline",colorScheme:o(e,"color-scheme"),modalTitle:o(e,"modal-title"),modalPlaceholder:o(e,"modal-placeholder"),showTitleField:Q(e,"show-title-field"),submittedBy:o(e,"submitted-by"),userId:o(e,"user-id"),target:he(e),theme:ge(e)}}function ee(e){return e.getAttribute("inject-styles")!=="false"}var te=`/* InputBuffer Feedback Bar Styles
1
+ "use strict";(()=>{var x=class extends Error{constructor(t){super(t.detail),this.name="ApiError",this.type=t.type,this.title=t.title,this.status=t.status,this.detail=t.detail,this.category=t.category,this.field=t.field}};var K="Something went wrong. Please try again.";function V(e){return e instanceof x?e.category==="user"?e.detail:(e.category==="integration"&&w(`${e.title}: ${e.detail}`,e.type),K):K}function w(e,t){typeof console!="undefined"&&console.warn(`[inputbuffer] ${e}`,t!=null?t:"")}var z="0.3.1",ae="https://inputbuffer.io",se="/api/v0/feedback",de="/api/v0/reactions",ce=1e4,le=5e3,be=500,pe=300;function q(e,t){return`${(e!=null?e:ae).replace(/\/+$/,"")}${t}`}async function G(e,t,i){var b,a,p,d;let n=new AbortController,l=setTimeout(()=>n.abort(),ce),s;try{s=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${z} (javascript)`},body:JSON.stringify(i),credentials:"omit",signal:n.signal})}finally{clearTimeout(l)}if(!s.ok){let u=await s.json().catch(()=>({}));throw new x({type:(b=u.type)!=null?b:"https://inputbuffer.io/docs/api/problems/internal-error",title:(a=u.title)!=null?a:"Error",detail:(p=u.detail)!=null?p:"Submission failed. Please try again.",status:(d=u.status)!=null?d:s.status,category:u.category,field:u.field})}return s}async function J(e,t,i,n,l){let s={description:t.slice(0,le)};if(i&&(s.title=i.slice(0,be)),n!=null&&n.submittedBy&&(s.submitted_by=n.submittedBy.slice(0,pe)),n!=null&&n.target){let p=n.target;s.targets=[{type:p.type,metadata:p.metadata}]}let b=await G(q(l,se),e,s),{data:a}=await b.json();return{id:a.id}}async function X(e,t,i,n,l){let s={reaction_value:t,target:{type:i.type,metadata:i.metadata}};n&&(s.user_id=n);let b;try{b=await G(q(l,de),e,s)}catch(p){throw p instanceof x&&p.status===422&&p.field==="user_id"&&w("Reaction rejected: no user_id and no client IP. Set the `userId` option (or the `user-id` attribute)."),p}let{data:a}=await b.json();return a}function Y(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 i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",e),t.appendChild(i),t}var ue="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",me="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",fe=1440*60*1e3;function O(e){var $,W;let t;function i(){let r=e.target;return r?`ib:reaction:${e.apiKey}:${r.type}:${JSON.stringify(r.metadata)}`:`ib:reaction:${e.apiKey}:${window.location.pathname}`}function n(){try{let r=localStorage.getItem(i());if(!r)return null;let{sentiment:f,ts:m}=JSON.parse(r);return Date.now()-m>fe?(localStorage.removeItem(i()),null):f}catch{return null}}function l(r){try{localStorage.setItem(i(),JSON.stringify({sentiment:r,ts:Date.now()}))}catch{}}let s={vote:[],open:[],submit:[],close:[],error:[]};function b(r,f){var m;(m=s[r])==null||m.forEach(E=>E(f))}let a=document.createElement("div"),p=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";a.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+p;let{theme:d={}}=e;d.primary&&a.style.setProperty("--ib-primary",d.primary),d.background&&a.style.setProperty("--ib-background",d.background),d.surface&&a.style.setProperty("--ib-surface",d.surface),d.text&&a.style.setProperty("--ib-text",d.text),d.selected&&a.style.setProperty("--ib-selected",d.selected),d.selectedColor&&a.style.setProperty("--ib-selected-color",d.selectedColor);let u=document.createElement("div");u.className="ib-bar";let F=document.createElement("div");F.className="ib-bar-label-area";let L=document.createElement("span");L.className="ib-bar-label",L.textContent=($=e.label)!=null?$:"Was this helpful?",F.appendChild(L);let B=document.createElement("div");B.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let g=document.createElement("button");g.type="button",g.className="ib-bar-btn ib-bar-btn--up",g.setAttribute("aria-label","Yes"),g.appendChild(Y(ue));let h=document.createElement("button");h.type="button",h.className="ib-bar-btn ib-bar-btn--down",h.setAttribute("aria-label","No"),h.appendChild(Y(me)),B.appendChild(g),B.appendChild(h),e.showLabel!==!1&&u.appendChild(F),u.appendChild(B);let c=document.createElement("div");c.className="ib-bar-popover",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false");let P=document.createElement("div");if(P.className="ib-bar-header",e.modalTitle){c.setAttribute("aria-labelledby","ib-bar-title");let r=document.createElement("p");r.id="ib-bar-title",r.className="ib-bar-title",r.textContent=e.modalTitle,P.appendChild(r)}else c.setAttribute("aria-label","Feedback");let k=document.createElement("div");k.className="ib-bar-body";let y=document.createElement("textarea");y.className="ib-bar-textarea",y.placeholder=(W=e.modalPlaceholder)!=null?W:"What's on your mind?",y.maxLength=5e3,y.setAttribute("aria-label","Feedback");let C=document.createElement("p");C.className="ib-bar-error";let _=document.createElement("p");_.className="ib-bar-success";let v=document.createElement("button");if(v.type="button",v.className="ib-bar-submit",v.textContent="Send feedback",e.showTitleField===!0){let r=document.createElement("input");r.type="text",r.className="ib-bar-title-input",r.placeholder="Title (optional)",r.maxLength=500,r.setAttribute("aria-label","Feedback title"),k.appendChild(r)}k.appendChild(y),k.appendChild(C),k.appendChild(_);let A=document.createElement("div");A.className="ib-bar-footer",A.appendChild(v);let R=document.createElement("div");R.className="ib-branding";let T=document.createElement("a");T.href="https://inputbuffer.io",T.target="_blank",T.rel="noopener noreferrer",T.textContent="Powered by inputbuffer.io",R.appendChild(T),A.appendChild(R),k.appendChild(A),c.appendChild(P),c.appendChild(k),a.appendChild(c),a.appendChild(u);function S(){let r=u.getBoundingClientRect();c.style.top=`${r.top-c.offsetHeight-8}px`,c.style.left=`${r.right-320}px`}function ie(r){t=r,c.classList.add("ib-bar-popover--visible"),requestAnimationFrame(S),C.textContent="",_.textContent="",y.focus(),setTimeout(()=>document.addEventListener("click",M),0),document.addEventListener("keydown",D),window.addEventListener("scroll",S,{passive:!0}),window.addEventListener("resize",S,{passive:!0}),b("open",{sentiment:r})}function I(){c.classList.contains("ib-bar-popover--visible")&&(c.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",M),document.removeEventListener("keydown",D),window.removeEventListener("scroll",S),window.removeEventListener("resize",S),y.value="",b("close"))}function ne(){g.classList.remove("ib-bar-btn--active"),h.classList.remove("ib-bar-btn--active"),t=void 0}function M(r){a.contains(r.target)||I()}function D(r){r.key==="Escape"&&I()}async function oe(){let r=y.value.trim();if(r.length<10){C.textContent="Please enter at least 10 characters.";return}C.textContent="",v.disabled=!0,v.textContent="Sending\u2026";let f=c.querySelector(".ib-bar-title-input"),m=(f==null?void 0:f.value.trim())||null;try{let E=await J(e.apiKey,r,m,{sentiment:t,target:e.target,submittedBy:e.submittedBy},e.apiUrl);b("submit",E),_.textContent="Thanks for your feedback!",v.textContent="Send feedback",setTimeout(()=>{I(),ne()},2e3)}catch(E){b("error",E instanceof Error?E:new Error("Something went wrong.")),C.textContent=V(E),v.disabled=!1,v.textContent="Send feedback"}}function H(r){g.classList.remove("ib-bar-btn--active"),h.classList.remove("ib-bar-btn--active"),r.classList.add("ib-bar-btn--active")}let N=n();N&&(t=N,H(N==="positive"?g:h));function U(r,f){var m;l(r),H(f),ie(r),b("vote",{sentiment:r}),e.target&&X(e.apiKey,r==="positive"?1:-1,e.target,(m=e.userId)!=null?m:null,e.apiUrl).catch(()=>{})}return g.addEventListener("click",()=>U("positive",g)),h.addEventListener("click",()=>U("negative",h)),v.addEventListener("click",oe),{element:a,on(r,f){var m;(m=s[r])==null||m.push(f)},destroy(){I(),a.remove()}}}function o(e,t){var i;return(i=e.getAttribute(t))!=null?i:void 0}function Q(e,t){let i=e.getAttribute(t);return i===null?void 0:i==="true"}function ge(e){return{primary:o(e,"theme-primary"),background:o(e,"theme-background"),text:o(e,"theme-text"),selected:o(e,"theme-selected"),selectedColor:o(e,"theme-selected-color")}}function he(e){var i;let t=e.getAttribute("target-type");if(t)switch(t){case"documentation":{let n=(i=o(e,"target-page-url"))!=null?i:typeof window!="undefined"?window.location.href:void 0;if(!n){w('target-type="documentation" needs target-page-url. Ignoring the target.');return}return{type:"documentation",metadata:{page_url:n,section_heading:o(e,"target-section-heading"),doc_version:o(e,"target-doc-version")}}}case"rest_endpoint":{let n=o(e,"target-method"),l=o(e,"target-path");if(!n||!l){w('target-type="rest_endpoint" needs target-method and target-path. Ignoring the target.');return}return{type:"rest_endpoint",metadata:{method:n,path:l,host:o(e,"target-host"),api_version:o(e,"target-api-version")}}}case"cli_command":{let n=o(e,"target-command");if(!n){w('target-type="cli_command" needs target-command. Ignoring the target.');return}let l=o(e,"target-args");return{type:"cli_command",metadata:{command:n,subcommand:o(e,"target-subcommand"),cli_version:o(e,"target-cli-version"),args:l?l.split(",").map(s=>s.trim()).filter(Boolean):void 0}}}default:w(`Unknown target-type "${t}". Expected documentation, rest_endpoint, or cli_command.`);return}}function Z(e,t){return{apiKey:t,apiUrl:o(e,"api-url"),label:o(e,"label"),showLabel:Q(e,"show-label"),placement:e.getAttribute("placement")==="fixed"?"fixed":"inline",colorScheme:o(e,"color-scheme"),modalTitle:o(e,"modal-title"),modalPlaceholder:o(e,"modal-placeholder"),showTitleField:Q(e,"show-title-field"),submittedBy:o(e,"submitted-by"),userId:o(e,"user-id"),target:he(e),theme:ge(e)}}function ee(e){return e.getAttribute("inject-styles")!=="false"}var te=`/* InputBuffer Feedback Bar Styles
2
2
  * .ib-bar-* and .ib-bar-popover* classes are stable public API \u2014 do not rename them.
3
3
  * Developers may target these classes from their own stylesheets to customize the widget.
4
4
  */
package/dist/modal.css CHANGED
@@ -1 +1 @@
1
- #ib-overlay{position:fixed;inset:0;background:#00000080;z-index:2147483647;display:flex;align-items:center;justify-content:center}#ib-modal{--ib-primary: #6366f1;--ib-primary-hover: #4338ca;--ib-background: #f6f6f8;--ib-surface: #ffffff;--ib-text: #111827;--ib-muted: #8d99ae;--ib-border: var(--ib-primary);--ib-focus-color: var(--ib-primary);--ib-input-hover-border: var(--ib-border);--ib-selected: var(--ib-primary);--ib-selected-color: var(--ib-surface);--ib-radius: 2px;--ib-radius-input: 2px;color:var(--ib-text);border:1px solid var(--ib-border);border-radius:var(--ib-radius);width:100%;max-width:480px;margin:16px;position:relative;box-shadow:0 4px 24px #0000001f;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;box-sizing:border-box;overflow:hidden}#ib-modal-header{background:var(--ib-surface);padding:12px 16px;border-bottom:1px solid var(--ib-border);display:flex;align-items:center;gap:8px}#ib-modal-body{background-color:var(--ib-background);padding:16px}#ib-title,.ib-modal-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.1em;margin:0;color:var(--ib-muted);flex:1}#ib-textarea,.ib-modal-textarea{width:100%;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);padding:10px 12px;font-size:14px;font-family:inherit;color:var(--ib-text);resize:vertical;min-height:100px;box-sizing:border-box;outline:none;display:block}#ib-textarea:hover,.ib-modal-textarea:hover{border-color:var(--ib-input-hover-border)}#ib-textarea:focus,.ib-modal-textarea:focus{border-color:var(--ib-focus-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--ib-focus-color) 15%,transparent)}#ib-modal-body #ib-title-input,#ib-modal-body .ib-modal-title-input{width:100%;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);padding:8px 12px;font-size:14px;font-family:inherit;color:var(--ib-text);box-sizing:border-box;outline:none;display:block}#ib-title-input,.ib-modal-title-input{margin-bottom:10px}#ib-modal-body #ib-title-input:hover,#ib-modal-body .ib-modal-title-input:hover{border-color:var(--ib-input-hover-border)}#ib-modal-body #ib-title-input:focus,#ib-modal-body .ib-modal-title-input:focus{border-color:var(--ib-focus-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--ib-focus-color) 15%,transparent)}#ib-submit,.ib-modal-submit{background:var(--ib-primary);color:#fff;border:none;border-radius:var(--ib-radius-input);padding:8px 16px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;font-family:inherit;cursor:pointer;display:inline-block;transition:background .15s}#ib-submit:hover,.ib-modal-submit:hover{background:var(--ib-primary-hover)}#ib-submit:disabled,.ib-modal-submit:disabled{opacity:.6;cursor:not-allowed}#ib-close,.ib-modal-close{background:none;border:none;font-size:18px;line-height:1;cursor:pointer;color:var(--ib-muted);padding:2px 6px;margin:0;border-radius:var(--ib-radius-input);flex-shrink:0}#ib-close:hover,.ib-modal-close:hover{color:var(--ib-primary)}#ib-success,.ib-modal-success{color:#16a34a;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;margin:8px 0 0;display:none}.ib-modal-footer{display:flex;align-items:center;justify-content:space-between;margin-top:12px}.ib-branding a{font-size:10px;color:var(--ib-muted);text-decoration:none;letter-spacing:.03em}.ib-branding a:hover{color:var(--ib-primary);text-decoration:underline}#ib-error,.ib-modal-error{color:#dc2626;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;margin:8px 0 0;display:none}.ib-modal-sentiment{display:flex;gap:4px}.ib-modal-thumb{width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);color:var(--ib-primary);cursor:pointer;transition:background .15s,color .15s;padding:0;margin:0;flex-shrink:0;-webkit-appearance:none;appearance:none;box-sizing:border-box}.ib-modal-thumb:hover{background:var(--ib-primary);color:var(--ib-surface)}.ib-modal-thumb:focus{outline:1px solid var(--ib-primary);outline-offset:-1px}.ib-modal-thumb--active{background:var(--ib-selected);color:var(--ib-selected-color)}.ib-modal-thumb--active:hover{background:var(--ib-primary-hover)}@media (prefers-color-scheme: dark){#ib-modal:not(.ib-theme-light),#ib-modal.ib-theme-dark{--ib-primary: #3A5244;--ib-primary-hover: #4E6857;--ib-background: #25272B;--ib-surface: #2C3630;--ib-text: #E5E7EB;--ib-muted: #9CA3AF;--ib-border: #363840;--ib-focus-color: #7B9B82;--ib-input-hover-border: rgba(255, 255, 255, .2);--ib-radius: 8px;--ib-radius-input: 4px}}#ib-modal.ib-theme-dark{--ib-primary: #3A5244;--ib-primary-hover: #4E6857;--ib-background: #25272B;--ib-surface: #2C3630;--ib-text: #E5E7EB;--ib-muted: #9CA3AF;--ib-border: #363840;--ib-focus-color: #7B9B82;--ib-input-hover-border: rgba(255, 255, 255, .2);--ib-radius: 8px;--ib-radius-input: 4px}
1
+ #ib-overlay{position:fixed;inset:0;background:#00000080;z-index:2147483647;display:flex;align-items:center;justify-content:center}#ib-modal{--ib-primary: #6366f1;--ib-primary-hover: #4338ca;--ib-background: #f6f6f8;--ib-surface: #ffffff;--ib-text: #111827;--ib-muted: #8d99ae;--ib-border: var(--ib-primary);--ib-focus-color: var(--ib-primary);--ib-input-hover-border: var(--ib-border);--ib-selected: var(--ib-primary);--ib-selected-color: var(--ib-surface);--ib-radius: 2px;--ib-radius-input: 2px;color:var(--ib-text);border:1px solid var(--ib-border);border-radius:var(--ib-radius);width:100%;max-width:480px;margin:16px;position:relative;box-shadow:0 4px 24px #0000001f;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;box-sizing:border-box;overflow:hidden}#ib-modal-header{background:var(--ib-surface);padding:12px 16px;border-bottom:1px solid var(--ib-border);display:flex;align-items:center;gap:8px}#ib-modal-body{background-color:var(--ib-background);padding:16px}#ib-title,.ib-modal-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.1em;margin:0;color:var(--ib-muted);flex:1}#ib-textarea,.ib-modal-textarea{width:100%;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);padding:10px 12px;font-size:14px;font-family:inherit;color:var(--ib-text);resize:vertical;min-height:100px;box-sizing:border-box;outline:none;display:block}#ib-textarea:hover,.ib-modal-textarea:hover{border-color:var(--ib-input-hover-border)}#ib-textarea:focus,.ib-modal-textarea:focus{border-color:var(--ib-focus-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--ib-focus-color) 15%,transparent)}#ib-modal-body #ib-title-input,#ib-modal-body .ib-modal-title-input{width:100%;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);padding:8px 12px;font-size:14px;font-family:inherit;color:var(--ib-text);box-sizing:border-box;outline:none;display:block}#ib-title-input,.ib-modal-title-input{margin-bottom:10px}#ib-modal-body #ib-title-input:hover,#ib-modal-body .ib-modal-title-input:hover{border-color:var(--ib-input-hover-border)}#ib-modal-body #ib-title-input:focus,#ib-modal-body .ib-modal-title-input:focus{border-color:var(--ib-focus-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--ib-focus-color) 15%,transparent)}#ib-submit,.ib-modal-submit{background:var(--ib-primary);color:#fff;border:none;border-radius:var(--ib-radius-input);padding:8px 16px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;font-family:inherit;cursor:pointer;display:inline-block;transition:background .15s}#ib-submit:hover,.ib-modal-submit:hover{background:var(--ib-primary-hover)}#ib-submit:disabled,.ib-modal-submit:disabled{opacity:.6;cursor:not-allowed}#ib-close,.ib-modal-close{background:none;border:none;font-size:18px;line-height:1;cursor:pointer;color:var(--ib-muted);padding:2px 6px;margin:0;border-radius:var(--ib-radius-input);flex-shrink:0}#ib-close:hover,.ib-modal-close:hover{color:var(--ib-primary)}#ib-success,.ib-modal-success{color:#16a34a;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;margin:8px 0 0;display:none}.ib-modal-footer{display:flex;align-items:center;justify-content:space-between;margin-top:12px}.ib-branding a{font-size:10px;color:var(--ib-muted);text-decoration:none;letter-spacing:.03em}.ib-branding a:hover{color:var(--ib-primary);text-decoration:underline}#ib-error,.ib-modal-error{color:#dc2626;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;margin:8px 0 0;display:none}.ib-modal-sentiment{display:flex;gap:4px}.ib-modal-thumb{width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:var(--ib-background);border:1px solid var(--ib-border);border-radius:var(--ib-radius-input);color:var(--ib-primary);cursor:pointer;transition:background .15s,color .15s;padding:0;margin:0;flex-shrink:0;-webkit-appearance:none;appearance:none;box-sizing:border-box}.ib-modal-thumb:hover{background:var(--ib-primary);color:var(--ib-surface)}.ib-modal-thumb:focus{outline:1px solid var(--ib-primary);outline-offset:-1px}.ib-modal-thumb--active{background:var(--ib-selected);color:var(--ib-selected-color)}.ib-modal-thumb--active:hover{background:var(--ib-primary-hover)}@media(prefers-color-scheme:dark){#ib-modal:not(.ib-theme-light),#ib-modal.ib-theme-dark{--ib-primary: #3A5244;--ib-primary-hover: #4E6857;--ib-background: #25272B;--ib-surface: #2C3630;--ib-text: #E5E7EB;--ib-muted: #9CA3AF;--ib-border: #363840;--ib-focus-color: #7B9B82;--ib-input-hover-border: rgba(255, 255, 255, .2);--ib-radius: 8px;--ib-radius-input: 4px}}#ib-modal.ib-theme-dark{--ib-primary: #3A5244;--ib-primary-hover: #4E6857;--ib-background: #25272B;--ib-surface: #2C3630;--ib-text: #E5E7EB;--ib-muted: #9CA3AF;--ib-border: #363840;--ib-focus-color: #7B9B82;--ib-input-hover-border: rgba(255, 255, 255, .2);--ib-radius: 8px;--ib-radius-input: 4px}
package/dist/modal.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- function H(i){let e=document.getElementById("ib-modal");if(!e)return;let{theme:t={}}=i;t.primary&&e.style.setProperty("--ib-primary",t.primary),t.background&&e.style.setProperty("--ib-background",t.background),t.surface&&e.style.setProperty("--ib-surface",t.surface),t.text&&e.style.setProperty("--ib-text",t.text),t.selected&&e.style.setProperty("--ib-selected",t.selected),t.selectedColor&&e.style.setProperty("--ib-selected-color",t.selectedColor)}var y=class extends Error{constructor(e){super(e.detail),this.name="ApiError",this.type=e.type,this.title=e.title,this.status=e.status,this.detail=e.detail,this.category=e.category,this.field=e.field}};var M="Something went wrong. Please try again.";function P(i){return i instanceof y?i.category==="user"?i.detail:(i.category==="integration"&&C(`${i.title}: ${i.detail}`,i.type),M):M}function C(i,e){typeof console!="undefined"&&console.warn(`[inputbuffer] ${i}`,e!=null?e:"")}var S="0.3.0",G="https://inputbuffer.io",V="/api/v0/feedback";var X=1e4,J=5e3,Y=500,Q=300;function Z(i,e){return`${(i!=null?i:G).replace(/\/+$/,"")}${e}`}async function ee(i,e,t){var c,u,d,p;let o=new AbortController,b=setTimeout(()=>o.abort(),X),n;try{n=await fetch(i,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${S} (javascript)`},body:JSON.stringify(t),credentials:"omit",signal:o.signal})}finally{clearTimeout(b)}if(!n.ok){let s=await n.json().catch(()=>({}));throw new y({type:(c=s.type)!=null?c:"https://inputbuffer.io/docs/api/problems/internal-error",title:(u=s.title)!=null?u:"Error",detail:(d=s.detail)!=null?d:"Submission failed. Please try again.",status:(p=s.status)!=null?p:n.status,category:s.category,field:s.field})}return n}async function R(i,e,t,o,b){let n={description:e.slice(0,J)};if(t&&(n.title=t.slice(0,Y)),o!=null&&o.submittedBy&&(n.submitted_by=o.submittedBy.slice(0,Q)),o!=null&&o.target){let d=o.target;n.targets=[{type:d.type,metadata:d.metadata}]}let c=await ee(Z(b,V),i,n),{data:u}=await c.json();return{id:u.id}}function F(i){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("fill","currentColor"),e.setAttribute("aria-hidden","true"),e.style.display="block";let t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",i),e.appendChild(t),e}var te="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",ie="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 O(i){let e=null,t,o,b=null,n=null,c=null,u=null,d=null,p=null,s=null,T=null,A=[],B=[],L=[];function I(r){if(r.key==="Escape"){v();return}if(r.key==="Tab"&&e){let a=Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(a.length===0)return;let l=a[0],m=a[a.length-1];r.shiftKey?document.activeElement===l&&(r.preventDefault(),m.focus()):document.activeElement===m&&(r.preventDefault(),l.focus())}}async function W(){var a;if(!n||!u)return;let r=n.value.trim();if(r.length<10){d&&(d.textContent="Please enter at least 10 characters.",d.style.display="block");return}d&&(d.style.display="none"),u.disabled=!0,u.textContent="Sending\u2026";try{let l=(c==null?void 0:c.value.trim())||null,m=o!=null?o:t==null?void 0:t.sentiment,f=await R(i.apiKey,r,l,{...t,sentiment:m,submittedBy:(a=t==null?void 0:t.submittedBy)!=null?a:i.submittedBy},i.apiUrl);p&&(p.textContent="Thanks for your feedback!",p.style.display="block"),A.forEach(x=>x(f)),b=setTimeout(()=>v(),2e3)}catch(l){let m=l instanceof Error?l:new Error("Unknown error");d&&(d.textContent=P(l),d.style.display="block"),L.forEach(f=>f(m)),u.disabled=!1,u.textContent="Send feedback"}}function U(){let r=document.createElement("div");r.id="ib-overlay";let a=document.createElement("div");a.id="ib-modal",i.colorScheme==="dark"?a.classList.add("ib-theme-dark"):i.colorScheme==="light"&&a.classList.add("ib-theme-light"),a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true");let l=document.createElement("div");if(l.id="ib-modal-header",T=l,i.title?(a.setAttribute("aria-labelledby","ib-title"),s=document.createElement("h2"),s.id="ib-title",s.className="ib-modal-title",s.textContent=i.title,l.appendChild(s)):a.setAttribute("aria-label","Feedback"),i.showSentiment){let g,h,k=document.createElement("div");k.className="ib-modal-sentiment",g=document.createElement("button"),g.type="button",g.className="ib-modal-thumb ib-modal-thumb--up",g.setAttribute("aria-label","Helpful"),g.appendChild(F(te)),h=document.createElement("button"),h.type="button",h.className="ib-modal-thumb ib-modal-thumb--down",h.setAttribute("aria-label","Not helpful"),h.appendChild(F(ie)),g.addEventListener("click",()=>{g.classList.add("ib-modal-thumb--active"),h.classList.remove("ib-modal-thumb--active"),o="positive"}),h.addEventListener("click",()=>{h.classList.add("ib-modal-thumb--active"),g.classList.remove("ib-modal-thumb--active"),o="negative"}),k.appendChild(g),k.appendChild(h),l.appendChild(k)}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",v),l.appendChild(m);let f=document.createElement("div");f.id="ib-modal-body",n=document.createElement("textarea"),n.id="ib-textarea",n.className="ib-modal-textarea",n.placeholder=i.placeholder||"What's on your mind?",n.maxLength=5e3,n.setAttribute("aria-label","Feedback"),u=document.createElement("button"),u.id="ib-submit",u.className="ib-modal-submit",u.textContent="Send feedback",u.addEventListener("click",W),p=document.createElement("p"),p.id="ib-success",p.className="ib-modal-success",d=document.createElement("p"),d.id="ib-error",d.className="ib-modal-error",i.showTitleField===!0&&(c=document.createElement("input"),c.id="ib-title-input",c.className="ib-modal-title-input",c.type="text",c.placeholder="Title (optional)",c.maxLength=500,c.setAttribute("aria-label","Feedback title"),f.appendChild(c)),f.appendChild(n),f.appendChild(d),f.appendChild(p);let x=document.createElement("div");x.className="ib-modal-footer",x.appendChild(u);let w=document.createElement("div");w.className="ib-branding";let E=document.createElement("a");return E.href="https://inputbuffer.io",E.target="_blank",E.rel="noopener noreferrer",E.textContent="Powered by inputbuffer.io",w.appendChild(E),x.appendChild(w),f.appendChild(x),a.appendChild(l),a.appendChild(f),r.appendChild(a),r.addEventListener("click",g=>{g.target===r&&v()}),document.addEventListener("keydown",I),r}function q(r){var a;if(!e){if(t=r,e=U(),document.body.appendChild(e),H(i),r!=null&&r.title){if(s)s.textContent=r.title;else if(T){let l=e.querySelector("#ib-modal");l.removeAttribute("aria-label"),l.setAttribute("aria-labelledby","ib-title"),s=document.createElement("h2"),s.id="ib-title",s.className="ib-modal-title",s.textContent=r.title,T.prepend(s)}}if(r!=null&&r.sentiment){o=r.sentiment;let l=e.querySelector(".ib-modal-thumb--up"),m=e.querySelector(".ib-modal-thumb--down");r.sentiment==="positive"?l==null||l.classList.add("ib-modal-thumb--active"):r.sentiment==="negative"&&(m==null||m.classList.add("ib-modal-thumb--active"))}n&&((a=r==null?void 0:r.prefill)!=null&&a.description)&&(n.value=r.prefill.description),n==null||n.focus()}}function v(){e&&(b!==null&&(clearTimeout(b),b=null),document.removeEventListener("keydown",I),e.remove(),e=null,n=null,c=null,u=null,d=null,p=null,s=null,T=null,t=void 0,o=void 0,B.forEach(r=>r()))}function K(r,a){r==="submit"?A.push(a):r==="close"?B.push(a):r==="error"&&L.push(a)}function $(){v()}return{open:q,close:v,on:K,destroy:$}}function N(i,e){let t=i.dataset;return{apiKey:e,apiUrl:t.apiUrl,attachTo:t.attachTo,injectStyles:t.injectStyles===void 0?!0:t.injectStyles!=="false",colorScheme:t.colorScheme,title:t.title,placeholder:t.placeholder,showTitleField:t.showTitleField===void 0?void 0:t.showTitleField==="true",showSentiment:t.showSentiment===void 0?void 0:t.showSentiment==="true",submittedBy:t.submittedBy,theme:{primary:t.themePrimary,background:t.themeBackground,text:t.themeText,selected:t.themeSelected,selectedColor:t.themeSelectedColor}}}var j=`/* InputBuffer Modal Styles
1
+ function H(i){let e=document.getElementById("ib-modal");if(!e)return;let{theme:t={}}=i;t.primary&&e.style.setProperty("--ib-primary",t.primary),t.background&&e.style.setProperty("--ib-background",t.background),t.surface&&e.style.setProperty("--ib-surface",t.surface),t.text&&e.style.setProperty("--ib-text",t.text),t.selected&&e.style.setProperty("--ib-selected",t.selected),t.selectedColor&&e.style.setProperty("--ib-selected-color",t.selectedColor)}var y=class extends Error{constructor(e){super(e.detail),this.name="ApiError",this.type=e.type,this.title=e.title,this.status=e.status,this.detail=e.detail,this.category=e.category,this.field=e.field}};var M="Something went wrong. Please try again.";function P(i){return i instanceof y?i.category==="user"?i.detail:(i.category==="integration"&&C(`${i.title}: ${i.detail}`,i.type),M):M}function C(i,e){typeof console!="undefined"&&console.warn(`[inputbuffer] ${i}`,e!=null?e:"")}var S="0.3.1",G="https://inputbuffer.io",V="/api/v0/feedback";var X=1e4,J=5e3,Y=500,Q=300;function Z(i,e){return`${(i!=null?i:G).replace(/\/+$/,"")}${e}`}async function ee(i,e,t){var c,u,d,p;let o=new AbortController,b=setTimeout(()=>o.abort(),X),n;try{n=await fetch(i,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${S} (javascript)`},body:JSON.stringify(t),credentials:"omit",signal:o.signal})}finally{clearTimeout(b)}if(!n.ok){let s=await n.json().catch(()=>({}));throw new y({type:(c=s.type)!=null?c:"https://inputbuffer.io/docs/api/problems/internal-error",title:(u=s.title)!=null?u:"Error",detail:(d=s.detail)!=null?d:"Submission failed. Please try again.",status:(p=s.status)!=null?p:n.status,category:s.category,field:s.field})}return n}async function R(i,e,t,o,b){let n={description:e.slice(0,J)};if(t&&(n.title=t.slice(0,Y)),o!=null&&o.submittedBy&&(n.submitted_by=o.submittedBy.slice(0,Q)),o!=null&&o.target){let d=o.target;n.targets=[{type:d.type,metadata:d.metadata}]}let c=await ee(Z(b,V),i,n),{data:u}=await c.json();return{id:u.id}}function F(i){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("fill","currentColor"),e.setAttribute("aria-hidden","true"),e.style.display="block";let t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",i),e.appendChild(t),e}var te="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",ie="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 O(i){let e=null,t,o,b=null,n=null,c=null,u=null,d=null,p=null,s=null,T=null,A=[],B=[],L=[];function I(r){if(r.key==="Escape"){v();return}if(r.key==="Tab"&&e){let a=Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(a.length===0)return;let l=a[0],m=a[a.length-1];r.shiftKey?document.activeElement===l&&(r.preventDefault(),m.focus()):document.activeElement===m&&(r.preventDefault(),l.focus())}}async function W(){var a;if(!n||!u)return;let r=n.value.trim();if(r.length<10){d&&(d.textContent="Please enter at least 10 characters.",d.style.display="block");return}d&&(d.style.display="none"),u.disabled=!0,u.textContent="Sending\u2026";try{let l=(c==null?void 0:c.value.trim())||null,m=o!=null?o:t==null?void 0:t.sentiment,f=await R(i.apiKey,r,l,{...t,sentiment:m,submittedBy:(a=t==null?void 0:t.submittedBy)!=null?a:i.submittedBy},i.apiUrl);p&&(p.textContent="Thanks for your feedback!",p.style.display="block"),A.forEach(x=>x(f)),b=setTimeout(()=>v(),2e3)}catch(l){let m=l instanceof Error?l:new Error("Unknown error");d&&(d.textContent=P(l),d.style.display="block"),L.forEach(f=>f(m)),u.disabled=!1,u.textContent="Send feedback"}}function U(){let r=document.createElement("div");r.id="ib-overlay";let a=document.createElement("div");a.id="ib-modal",i.colorScheme==="dark"?a.classList.add("ib-theme-dark"):i.colorScheme==="light"&&a.classList.add("ib-theme-light"),a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true");let l=document.createElement("div");if(l.id="ib-modal-header",T=l,i.title?(a.setAttribute("aria-labelledby","ib-title"),s=document.createElement("h2"),s.id="ib-title",s.className="ib-modal-title",s.textContent=i.title,l.appendChild(s)):a.setAttribute("aria-label","Feedback"),i.showSentiment){let g,h,k=document.createElement("div");k.className="ib-modal-sentiment",g=document.createElement("button"),g.type="button",g.className="ib-modal-thumb ib-modal-thumb--up",g.setAttribute("aria-label","Helpful"),g.appendChild(F(te)),h=document.createElement("button"),h.type="button",h.className="ib-modal-thumb ib-modal-thumb--down",h.setAttribute("aria-label","Not helpful"),h.appendChild(F(ie)),g.addEventListener("click",()=>{g.classList.add("ib-modal-thumb--active"),h.classList.remove("ib-modal-thumb--active"),o="positive"}),h.addEventListener("click",()=>{h.classList.add("ib-modal-thumb--active"),g.classList.remove("ib-modal-thumb--active"),o="negative"}),k.appendChild(g),k.appendChild(h),l.appendChild(k)}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",v),l.appendChild(m);let f=document.createElement("div");f.id="ib-modal-body",n=document.createElement("textarea"),n.id="ib-textarea",n.className="ib-modal-textarea",n.placeholder=i.placeholder||"What's on your mind?",n.maxLength=5e3,n.setAttribute("aria-label","Feedback"),u=document.createElement("button"),u.id="ib-submit",u.className="ib-modal-submit",u.textContent="Send feedback",u.addEventListener("click",W),p=document.createElement("p"),p.id="ib-success",p.className="ib-modal-success",d=document.createElement("p"),d.id="ib-error",d.className="ib-modal-error",i.showTitleField===!0&&(c=document.createElement("input"),c.id="ib-title-input",c.className="ib-modal-title-input",c.type="text",c.placeholder="Title (optional)",c.maxLength=500,c.setAttribute("aria-label","Feedback title"),f.appendChild(c)),f.appendChild(n),f.appendChild(d),f.appendChild(p);let x=document.createElement("div");x.className="ib-modal-footer",x.appendChild(u);let w=document.createElement("div");w.className="ib-branding";let E=document.createElement("a");return E.href="https://inputbuffer.io",E.target="_blank",E.rel="noopener noreferrer",E.textContent="Powered by inputbuffer.io",w.appendChild(E),x.appendChild(w),f.appendChild(x),a.appendChild(l),a.appendChild(f),r.appendChild(a),r.addEventListener("click",g=>{g.target===r&&v()}),document.addEventListener("keydown",I),r}function q(r){var a;if(!e){if(t=r,e=U(),document.body.appendChild(e),H(i),r!=null&&r.title){if(s)s.textContent=r.title;else if(T){let l=e.querySelector("#ib-modal");l.removeAttribute("aria-label"),l.setAttribute("aria-labelledby","ib-title"),s=document.createElement("h2"),s.id="ib-title",s.className="ib-modal-title",s.textContent=r.title,T.prepend(s)}}if(r!=null&&r.sentiment){o=r.sentiment;let l=e.querySelector(".ib-modal-thumb--up"),m=e.querySelector(".ib-modal-thumb--down");r.sentiment==="positive"?l==null||l.classList.add("ib-modal-thumb--active"):r.sentiment==="negative"&&(m==null||m.classList.add("ib-modal-thumb--active"))}n&&((a=r==null?void 0:r.prefill)!=null&&a.description)&&(n.value=r.prefill.description),n==null||n.focus()}}function v(){e&&(b!==null&&(clearTimeout(b),b=null),document.removeEventListener("keydown",I),e.remove(),e=null,n=null,c=null,u=null,d=null,p=null,s=null,T=null,t=void 0,o=void 0,B.forEach(r=>r()))}function K(r,a){r==="submit"?A.push(a):r==="close"?B.push(a):r==="error"&&L.push(a)}function $(){v()}return{open:q,close:v,on:K,destroy:$}}function N(i,e){let t=i.dataset;return{apiKey:e,apiUrl:t.apiUrl,attachTo:t.attachTo,injectStyles:t.injectStyles===void 0?!0:t.injectStyles!=="false",colorScheme:t.colorScheme,title:t.title,placeholder:t.placeholder,showTitleField:t.showTitleField===void 0?void 0:t.showTitleField==="true",showSentiment:t.showSentiment===void 0?void 0:t.showSentiment==="true",submittedBy:t.submittedBy,theme:{primary:t.themePrimary,background:t.themeBackground,text:t.themeText,selected:t.themeSelected,selectedColor:t.themeSelectedColor}}}var j=`/* InputBuffer Modal Styles
2
2
  * All #ib-* IDs are stable public API \u2014 do not rename them.
3
3
  * Developers may target these IDs from their own stylesheets to customize the widget.
4
4
  */
package/dist/modal.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{function H(i){let e=document.getElementById("ib-modal");if(!e)return;let{theme:t={}}=i;t.primary&&e.style.setProperty("--ib-primary",t.primary),t.background&&e.style.setProperty("--ib-background",t.background),t.surface&&e.style.setProperty("--ib-surface",t.surface),t.text&&e.style.setProperty("--ib-text",t.text),t.selected&&e.style.setProperty("--ib-selected",t.selected),t.selectedColor&&e.style.setProperty("--ib-selected-color",t.selectedColor)}var y=class extends Error{constructor(e){super(e.detail),this.name="ApiError",this.type=e.type,this.title=e.title,this.status=e.status,this.detail=e.detail,this.category=e.category,this.field=e.field}};var M="Something went wrong. Please try again.";function P(i){return i instanceof y?i.category==="user"?i.detail:(i.category==="integration"&&C(`${i.title}: ${i.detail}`,i.type),M):M}function C(i,e){typeof console!="undefined"&&console.warn(`[inputbuffer] ${i}`,e!=null?e:"")}var S="0.3.0",G="https://inputbuffer.io",V="/api/v0/feedback";var X=1e4,J=5e3,Y=500,Q=300;function Z(i,e){return`${(i!=null?i:G).replace(/\/+$/,"")}${e}`}async function ee(i,e,t){var c,u,d,p;let o=new AbortController,b=setTimeout(()=>o.abort(),X),n;try{n=await fetch(i,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${S} (javascript)`},body:JSON.stringify(t),credentials:"omit",signal:o.signal})}finally{clearTimeout(b)}if(!n.ok){let s=await n.json().catch(()=>({}));throw new y({type:(c=s.type)!=null?c:"https://inputbuffer.io/docs/api/problems/internal-error",title:(u=s.title)!=null?u:"Error",detail:(d=s.detail)!=null?d:"Submission failed. Please try again.",status:(p=s.status)!=null?p:n.status,category:s.category,field:s.field})}return n}async function R(i,e,t,o,b){let n={description:e.slice(0,J)};if(t&&(n.title=t.slice(0,Y)),o!=null&&o.submittedBy&&(n.submitted_by=o.submittedBy.slice(0,Q)),o!=null&&o.target){let d=o.target;n.targets=[{type:d.type,metadata:d.metadata}]}let c=await ee(Z(b,V),i,n),{data:u}=await c.json();return{id:u.id}}function F(i){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("fill","currentColor"),e.setAttribute("aria-hidden","true"),e.style.display="block";let t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",i),e.appendChild(t),e}var te="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",ie="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 O(i){let e=null,t,o,b=null,n=null,c=null,u=null,d=null,p=null,s=null,T=null,A=[],B=[],L=[];function I(r){if(r.key==="Escape"){v();return}if(r.key==="Tab"&&e){let a=Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(a.length===0)return;let l=a[0],m=a[a.length-1];r.shiftKey?document.activeElement===l&&(r.preventDefault(),m.focus()):document.activeElement===m&&(r.preventDefault(),l.focus())}}async function W(){var a;if(!n||!u)return;let r=n.value.trim();if(r.length<10){d&&(d.textContent="Please enter at least 10 characters.",d.style.display="block");return}d&&(d.style.display="none"),u.disabled=!0,u.textContent="Sending\u2026";try{let l=(c==null?void 0:c.value.trim())||null,m=o!=null?o:t==null?void 0:t.sentiment,f=await R(i.apiKey,r,l,{...t,sentiment:m,submittedBy:(a=t==null?void 0:t.submittedBy)!=null?a:i.submittedBy},i.apiUrl);p&&(p.textContent="Thanks for your feedback!",p.style.display="block"),A.forEach(x=>x(f)),b=setTimeout(()=>v(),2e3)}catch(l){let m=l instanceof Error?l:new Error("Unknown error");d&&(d.textContent=P(l),d.style.display="block"),L.forEach(f=>f(m)),u.disabled=!1,u.textContent="Send feedback"}}function U(){let r=document.createElement("div");r.id="ib-overlay";let a=document.createElement("div");a.id="ib-modal",i.colorScheme==="dark"?a.classList.add("ib-theme-dark"):i.colorScheme==="light"&&a.classList.add("ib-theme-light"),a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true");let l=document.createElement("div");if(l.id="ib-modal-header",T=l,i.title?(a.setAttribute("aria-labelledby","ib-title"),s=document.createElement("h2"),s.id="ib-title",s.className="ib-modal-title",s.textContent=i.title,l.appendChild(s)):a.setAttribute("aria-label","Feedback"),i.showSentiment){let g,h,k=document.createElement("div");k.className="ib-modal-sentiment",g=document.createElement("button"),g.type="button",g.className="ib-modal-thumb ib-modal-thumb--up",g.setAttribute("aria-label","Helpful"),g.appendChild(F(te)),h=document.createElement("button"),h.type="button",h.className="ib-modal-thumb ib-modal-thumb--down",h.setAttribute("aria-label","Not helpful"),h.appendChild(F(ie)),g.addEventListener("click",()=>{g.classList.add("ib-modal-thumb--active"),h.classList.remove("ib-modal-thumb--active"),o="positive"}),h.addEventListener("click",()=>{h.classList.add("ib-modal-thumb--active"),g.classList.remove("ib-modal-thumb--active"),o="negative"}),k.appendChild(g),k.appendChild(h),l.appendChild(k)}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",v),l.appendChild(m);let f=document.createElement("div");f.id="ib-modal-body",n=document.createElement("textarea"),n.id="ib-textarea",n.className="ib-modal-textarea",n.placeholder=i.placeholder||"What's on your mind?",n.maxLength=5e3,n.setAttribute("aria-label","Feedback"),u=document.createElement("button"),u.id="ib-submit",u.className="ib-modal-submit",u.textContent="Send feedback",u.addEventListener("click",W),p=document.createElement("p"),p.id="ib-success",p.className="ib-modal-success",d=document.createElement("p"),d.id="ib-error",d.className="ib-modal-error",i.showTitleField===!0&&(c=document.createElement("input"),c.id="ib-title-input",c.className="ib-modal-title-input",c.type="text",c.placeholder="Title (optional)",c.maxLength=500,c.setAttribute("aria-label","Feedback title"),f.appendChild(c)),f.appendChild(n),f.appendChild(d),f.appendChild(p);let x=document.createElement("div");x.className="ib-modal-footer",x.appendChild(u);let w=document.createElement("div");w.className="ib-branding";let E=document.createElement("a");return E.href="https://inputbuffer.io",E.target="_blank",E.rel="noopener noreferrer",E.textContent="Powered by inputbuffer.io",w.appendChild(E),x.appendChild(w),f.appendChild(x),a.appendChild(l),a.appendChild(f),r.appendChild(a),r.addEventListener("click",g=>{g.target===r&&v()}),document.addEventListener("keydown",I),r}function q(r){var a;if(!e){if(t=r,e=U(),document.body.appendChild(e),H(i),r!=null&&r.title){if(s)s.textContent=r.title;else if(T){let l=e.querySelector("#ib-modal");l.removeAttribute("aria-label"),l.setAttribute("aria-labelledby","ib-title"),s=document.createElement("h2"),s.id="ib-title",s.className="ib-modal-title",s.textContent=r.title,T.prepend(s)}}if(r!=null&&r.sentiment){o=r.sentiment;let l=e.querySelector(".ib-modal-thumb--up"),m=e.querySelector(".ib-modal-thumb--down");r.sentiment==="positive"?l==null||l.classList.add("ib-modal-thumb--active"):r.sentiment==="negative"&&(m==null||m.classList.add("ib-modal-thumb--active"))}n&&((a=r==null?void 0:r.prefill)!=null&&a.description)&&(n.value=r.prefill.description),n==null||n.focus()}}function v(){e&&(b!==null&&(clearTimeout(b),b=null),document.removeEventListener("keydown",I),e.remove(),e=null,n=null,c=null,u=null,d=null,p=null,s=null,T=null,t=void 0,o=void 0,B.forEach(r=>r()))}function K(r,a){r==="submit"?A.push(a):r==="close"?B.push(a):r==="error"&&L.push(a)}function $(){v()}return{open:q,close:v,on:K,destroy:$}}function N(i,e){let t=i.dataset;return{apiKey:e,apiUrl:t.apiUrl,attachTo:t.attachTo,injectStyles:t.injectStyles===void 0?!0:t.injectStyles!=="false",colorScheme:t.colorScheme,title:t.title,placeholder:t.placeholder,showTitleField:t.showTitleField===void 0?void 0:t.showTitleField==="true",showSentiment:t.showSentiment===void 0?void 0:t.showSentiment==="true",submittedBy:t.submittedBy,theme:{primary:t.themePrimary,background:t.themeBackground,text:t.themeText,selected:t.themeSelected,selectedColor:t.themeSelectedColor}}}var j=`/* InputBuffer Modal Styles
1
+ "use strict";(()=>{function H(i){let e=document.getElementById("ib-modal");if(!e)return;let{theme:t={}}=i;t.primary&&e.style.setProperty("--ib-primary",t.primary),t.background&&e.style.setProperty("--ib-background",t.background),t.surface&&e.style.setProperty("--ib-surface",t.surface),t.text&&e.style.setProperty("--ib-text",t.text),t.selected&&e.style.setProperty("--ib-selected",t.selected),t.selectedColor&&e.style.setProperty("--ib-selected-color",t.selectedColor)}var y=class extends Error{constructor(e){super(e.detail),this.name="ApiError",this.type=e.type,this.title=e.title,this.status=e.status,this.detail=e.detail,this.category=e.category,this.field=e.field}};var M="Something went wrong. Please try again.";function P(i){return i instanceof y?i.category==="user"?i.detail:(i.category==="integration"&&C(`${i.title}: ${i.detail}`,i.type),M):M}function C(i,e){typeof console!="undefined"&&console.warn(`[inputbuffer] ${i}`,e!=null?e:"")}var S="0.3.1",G="https://inputbuffer.io",V="/api/v0/feedback";var X=1e4,J=5e3,Y=500,Q=300;function Z(i,e){return`${(i!=null?i:G).replace(/\/+$/,"")}${e}`}async function ee(i,e,t){var c,u,d,p;let o=new AbortController,b=setTimeout(()=>o.abort(),X),n;try{n=await fetch(i,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${S} (javascript)`},body:JSON.stringify(t),credentials:"omit",signal:o.signal})}finally{clearTimeout(b)}if(!n.ok){let s=await n.json().catch(()=>({}));throw new y({type:(c=s.type)!=null?c:"https://inputbuffer.io/docs/api/problems/internal-error",title:(u=s.title)!=null?u:"Error",detail:(d=s.detail)!=null?d:"Submission failed. Please try again.",status:(p=s.status)!=null?p:n.status,category:s.category,field:s.field})}return n}async function R(i,e,t,o,b){let n={description:e.slice(0,J)};if(t&&(n.title=t.slice(0,Y)),o!=null&&o.submittedBy&&(n.submitted_by=o.submittedBy.slice(0,Q)),o!=null&&o.target){let d=o.target;n.targets=[{type:d.type,metadata:d.metadata}]}let c=await ee(Z(b,V),i,n),{data:u}=await c.json();return{id:u.id}}function F(i){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("fill","currentColor"),e.setAttribute("aria-hidden","true"),e.style.display="block";let t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",i),e.appendChild(t),e}var te="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",ie="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 O(i){let e=null,t,o,b=null,n=null,c=null,u=null,d=null,p=null,s=null,T=null,A=[],B=[],L=[];function I(r){if(r.key==="Escape"){v();return}if(r.key==="Tab"&&e){let a=Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(a.length===0)return;let l=a[0],m=a[a.length-1];r.shiftKey?document.activeElement===l&&(r.preventDefault(),m.focus()):document.activeElement===m&&(r.preventDefault(),l.focus())}}async function W(){var a;if(!n||!u)return;let r=n.value.trim();if(r.length<10){d&&(d.textContent="Please enter at least 10 characters.",d.style.display="block");return}d&&(d.style.display="none"),u.disabled=!0,u.textContent="Sending\u2026";try{let l=(c==null?void 0:c.value.trim())||null,m=o!=null?o:t==null?void 0:t.sentiment,f=await R(i.apiKey,r,l,{...t,sentiment:m,submittedBy:(a=t==null?void 0:t.submittedBy)!=null?a:i.submittedBy},i.apiUrl);p&&(p.textContent="Thanks for your feedback!",p.style.display="block"),A.forEach(x=>x(f)),b=setTimeout(()=>v(),2e3)}catch(l){let m=l instanceof Error?l:new Error("Unknown error");d&&(d.textContent=P(l),d.style.display="block"),L.forEach(f=>f(m)),u.disabled=!1,u.textContent="Send feedback"}}function U(){let r=document.createElement("div");r.id="ib-overlay";let a=document.createElement("div");a.id="ib-modal",i.colorScheme==="dark"?a.classList.add("ib-theme-dark"):i.colorScheme==="light"&&a.classList.add("ib-theme-light"),a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true");let l=document.createElement("div");if(l.id="ib-modal-header",T=l,i.title?(a.setAttribute("aria-labelledby","ib-title"),s=document.createElement("h2"),s.id="ib-title",s.className="ib-modal-title",s.textContent=i.title,l.appendChild(s)):a.setAttribute("aria-label","Feedback"),i.showSentiment){let g,h,k=document.createElement("div");k.className="ib-modal-sentiment",g=document.createElement("button"),g.type="button",g.className="ib-modal-thumb ib-modal-thumb--up",g.setAttribute("aria-label","Helpful"),g.appendChild(F(te)),h=document.createElement("button"),h.type="button",h.className="ib-modal-thumb ib-modal-thumb--down",h.setAttribute("aria-label","Not helpful"),h.appendChild(F(ie)),g.addEventListener("click",()=>{g.classList.add("ib-modal-thumb--active"),h.classList.remove("ib-modal-thumb--active"),o="positive"}),h.addEventListener("click",()=>{h.classList.add("ib-modal-thumb--active"),g.classList.remove("ib-modal-thumb--active"),o="negative"}),k.appendChild(g),k.appendChild(h),l.appendChild(k)}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",v),l.appendChild(m);let f=document.createElement("div");f.id="ib-modal-body",n=document.createElement("textarea"),n.id="ib-textarea",n.className="ib-modal-textarea",n.placeholder=i.placeholder||"What's on your mind?",n.maxLength=5e3,n.setAttribute("aria-label","Feedback"),u=document.createElement("button"),u.id="ib-submit",u.className="ib-modal-submit",u.textContent="Send feedback",u.addEventListener("click",W),p=document.createElement("p"),p.id="ib-success",p.className="ib-modal-success",d=document.createElement("p"),d.id="ib-error",d.className="ib-modal-error",i.showTitleField===!0&&(c=document.createElement("input"),c.id="ib-title-input",c.className="ib-modal-title-input",c.type="text",c.placeholder="Title (optional)",c.maxLength=500,c.setAttribute("aria-label","Feedback title"),f.appendChild(c)),f.appendChild(n),f.appendChild(d),f.appendChild(p);let x=document.createElement("div");x.className="ib-modal-footer",x.appendChild(u);let w=document.createElement("div");w.className="ib-branding";let E=document.createElement("a");return E.href="https://inputbuffer.io",E.target="_blank",E.rel="noopener noreferrer",E.textContent="Powered by inputbuffer.io",w.appendChild(E),x.appendChild(w),f.appendChild(x),a.appendChild(l),a.appendChild(f),r.appendChild(a),r.addEventListener("click",g=>{g.target===r&&v()}),document.addEventListener("keydown",I),r}function q(r){var a;if(!e){if(t=r,e=U(),document.body.appendChild(e),H(i),r!=null&&r.title){if(s)s.textContent=r.title;else if(T){let l=e.querySelector("#ib-modal");l.removeAttribute("aria-label"),l.setAttribute("aria-labelledby","ib-title"),s=document.createElement("h2"),s.id="ib-title",s.className="ib-modal-title",s.textContent=r.title,T.prepend(s)}}if(r!=null&&r.sentiment){o=r.sentiment;let l=e.querySelector(".ib-modal-thumb--up"),m=e.querySelector(".ib-modal-thumb--down");r.sentiment==="positive"?l==null||l.classList.add("ib-modal-thumb--active"):r.sentiment==="negative"&&(m==null||m.classList.add("ib-modal-thumb--active"))}n&&((a=r==null?void 0:r.prefill)!=null&&a.description)&&(n.value=r.prefill.description),n==null||n.focus()}}function v(){e&&(b!==null&&(clearTimeout(b),b=null),document.removeEventListener("keydown",I),e.remove(),e=null,n=null,c=null,u=null,d=null,p=null,s=null,T=null,t=void 0,o=void 0,B.forEach(r=>r()))}function K(r,a){r==="submit"?A.push(a):r==="close"?B.push(a):r==="error"&&L.push(a)}function $(){v()}return{open:q,close:v,on:K,destroy:$}}function N(i,e){let t=i.dataset;return{apiKey:e,apiUrl:t.apiUrl,attachTo:t.attachTo,injectStyles:t.injectStyles===void 0?!0:t.injectStyles!=="false",colorScheme:t.colorScheme,title:t.title,placeholder:t.placeholder,showTitleField:t.showTitleField===void 0?void 0:t.showTitleField==="true",showSentiment:t.showSentiment===void 0?void 0:t.showSentiment==="true",submittedBy:t.submittedBy,theme:{primary:t.themePrimary,background:t.themeBackground,text:t.themeText,selected:t.themeSelected,selectedColor:t.themeSelectedColor}}}var j=`/* InputBuffer Modal Styles
2
2
  * All #ib-* IDs are stable public API \u2014 do not rename them.
3
3
  * Developers may target these IDs from their own stylesheets to customize the widget.
4
4
  */
@@ -1,4 +1,4 @@
1
- function X(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 _=class extends Error{constructor(t){super(t.detail),this.name="ApiError",this.type=t.type,this.title=t.title,this.status=t.status,this.detail=t.detail,this.category=t.category,this.field=t.field}};var Y="Something went wrong. Please try again.";function j(e){return e instanceof _?e.category==="user"?e.detail:(e.category==="integration"&&M(`${e.title}: ${e.detail}`,e.type),Y):Y}function M(e,t){typeof console!="undefined"&&console.warn(`[inputbuffer] ${e}`,t!=null?t:"")}var U="0.3.0",pe="https://inputbuffer.io",me="/api/v0/feedback",fe="/api/v0/reactions",ge=1e4,he=5e3,ve=500,ye=300;function Q(e,t){return`${(e!=null?e:pe).replace(/\/+$/,"")}${t}`}async function Z(e,t,r){var d,s,c,p;let n=new AbortController,g=setTimeout(()=>n.abort(),ge),a;try{a=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${U} (javascript)`},body:JSON.stringify(r),credentials:"omit",signal:n.signal})}finally{clearTimeout(g)}if(!a.ok){let b=await a.json().catch(()=>({}));throw new _({type:(d=b.type)!=null?d:"https://inputbuffer.io/docs/api/problems/internal-error",title:(s=b.title)!=null?s:"Error",detail:(c=b.detail)!=null?c:"Submission failed. Please try again.",status:(p=b.status)!=null?p:a.status,category:b.category,field:b.field})}return a}async function D(e,t,r,n,g){let a={description:t.slice(0,he)};if(r&&(a.title=r.slice(0,ve)),n!=null&&n.submittedBy&&(a.submitted_by=n.submittedBy.slice(0,ye)),n!=null&&n.target){let c=n.target;a.targets=[{type:c.type,metadata:c.metadata}]}let d=await Z(Q(g,me),e,a),{data:s}=await d.json();return{id:s.id}}async function ee(e,t,r,n,g){let a={reaction_value:t,target:{type:r.type,metadata:r.metadata}};n&&(a.user_id=n);let d;try{d=await Z(Q(g,fe),e,a)}catch(c){throw c instanceof _&&c.status===422&&c.field==="user_id"&&M("Reaction rejected: no user_id and no client IP. Set the `userId` option (or the `user-id` attribute)."),c}let{data:s}=await d.json();return s}function te(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 xe="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",Ee="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 re(e){let t=null,r,n,g=null,a=null,d=null,s=null,c=null,p=null,b=null,B=null,z=[],H=[],E=[];function k(i){if(i.key==="Escape"){y();return}if(i.key==="Tab"&&t){let l=Array.from(t.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(l.length===0)return;let u=l[0],m=l[l.length-1];i.shiftKey?document.activeElement===u&&(i.preventDefault(),m.focus()):document.activeElement===m&&(i.preventDefault(),u.focus())}}async function h(){var l;if(!a||!s)return;let i=a.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"),s.disabled=!0,s.textContent="Sending\u2026";try{let u=(d==null?void 0:d.value.trim())||null,m=n!=null?n:r==null?void 0:r.sentiment,v=await D(e.apiKey,i,u,{...r,sentiment:m,submittedBy:(l=r==null?void 0:r.submittedBy)!=null?l:e.submittedBy},e.apiUrl);p&&(p.textContent="Thanks for your feedback!",p.style.display="block"),z.forEach(A=>A(v)),g=setTimeout(()=>y(),2e3)}catch(u){let m=u instanceof Error?u:new Error("Unknown error");c&&(c.textContent=j(u),c.style.display="block"),E.forEach(v=>v(m)),s.disabled=!1,s.textContent="Send feedback"}}function O(){let i=document.createElement("div");i.id="ib-overlay";let l=document.createElement("div");l.id="ib-modal",e.colorScheme==="dark"?l.classList.add("ib-theme-dark"):e.colorScheme==="light"&&l.classList.add("ib-theme-light"),l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true");let u=document.createElement("div");if(u.id="ib-modal-header",B=u,e.title?(l.setAttribute("aria-labelledby","ib-title"),b=document.createElement("h2"),b.id="ib-title",b.className="ib-modal-title",b.textContent=e.title,u.appendChild(b)):l.setAttribute("aria-label","Feedback"),e.showSentiment){let x,w,R=document.createElement("div");R.className="ib-modal-sentiment",x=document.createElement("button"),x.type="button",x.className="ib-modal-thumb ib-modal-thumb--up",x.setAttribute("aria-label","Helpful"),x.appendChild(te(xe)),w=document.createElement("button"),w.type="button",w.className="ib-modal-thumb ib-modal-thumb--down",w.setAttribute("aria-label","Not helpful"),w.appendChild(te(Ee)),x.addEventListener("click",()=>{x.classList.add("ib-modal-thumb--active"),w.classList.remove("ib-modal-thumb--active"),n="positive"}),w.addEventListener("click",()=>{w.classList.add("ib-modal-thumb--active"),x.classList.remove("ib-modal-thumb--active"),n="negative"}),R.appendChild(x),R.appendChild(w),u.appendChild(R)}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",y),u.appendChild(m);let v=document.createElement("div");v.id="ib-modal-body",a=document.createElement("textarea"),a.id="ib-textarea",a.className="ib-modal-textarea",a.placeholder=e.placeholder||"What's on your mind?",a.maxLength=5e3,a.setAttribute("aria-label","Feedback"),s=document.createElement("button"),s.id="ib-submit",s.className="ib-modal-submit",s.textContent="Send feedback",s.addEventListener("click",h),p=document.createElement("p"),p.id="ib-success",p.className="ib-modal-success",c=document.createElement("p"),c.id="ib-error",c.className="ib-modal-error",e.showTitleField===!0&&(d=document.createElement("input"),d.id="ib-title-input",d.className="ib-modal-title-input",d.type="text",d.placeholder="Title (optional)",d.maxLength=500,d.setAttribute("aria-label","Feedback title"),v.appendChild(d)),v.appendChild(a),v.appendChild(c),v.appendChild(p);let A=document.createElement("div");A.className="ib-modal-footer",A.appendChild(s);let I=document.createElement("div");I.className="ib-branding";let F=document.createElement("a");return F.href="https://inputbuffer.io",F.target="_blank",F.rel="noopener noreferrer",F.textContent="Powered by inputbuffer.io",I.appendChild(F),A.appendChild(I),v.appendChild(A),l.appendChild(u),l.appendChild(v),i.appendChild(l),i.addEventListener("click",x=>{x.target===i&&y()}),document.addEventListener("keydown",k),i}function S(i){var l;if(!t){if(r=i,t=O(),document.body.appendChild(t),X(e),i!=null&&i.title){if(b)b.textContent=i.title;else if(B){let u=t.querySelector("#ib-modal");u.removeAttribute("aria-label"),u.setAttribute("aria-labelledby","ib-title"),b=document.createElement("h2"),b.id="ib-title",b.className="ib-modal-title",b.textContent=i.title,B.prepend(b)}}if(i!=null&&i.sentiment){n=i.sentiment;let u=t.querySelector(".ib-modal-thumb--up"),m=t.querySelector(".ib-modal-thumb--down");i.sentiment==="positive"?u==null||u.classList.add("ib-modal-thumb--active"):i.sentiment==="negative"&&(m==null||m.classList.add("ib-modal-thumb--active"))}a&&((l=i==null?void 0:i.prefill)!=null&&l.description)&&(a.value=i.prefill.description),a==null||a.focus()}}function y(){t&&(g!==null&&(clearTimeout(g),g=null),document.removeEventListener("keydown",k),t.remove(),t=null,a=null,d=null,s=null,c=null,p=null,b=null,B=null,r=void 0,n=void 0,H.forEach(i=>i()))}function L(i,l){i==="submit"?z.push(l):i==="close"?H.push(l):i==="error"&&E.push(l)}function P(){y()}return{open:S,close:y,on:L,destroy:P}}function ie(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 ke="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",we="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",Ce=24*60*60*1e3;function K(e){var G,J;let t;function r(){let o=e.target;return o?`ib:reaction:${e.apiKey}:${o.type}:${JSON.stringify(o.metadata)}`:`ib:reaction:${e.apiKey}:${window.location.pathname}`}function n(){try{let o=localStorage.getItem(r());if(!o)return null;let{sentiment:T,ts:C}=JSON.parse(o);return Date.now()-C>Ce?(localStorage.removeItem(r()),null):T}catch{return null}}function g(o){try{localStorage.setItem(r(),JSON.stringify({sentiment:o,ts:Date.now()}))}catch{}}let a={vote:[],open:[],submit:[],close:[],error:[]};function d(o,T){var C;(C=a[o])==null||C.forEach(N=>N(T))}let s=document.createElement("div"),c=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";s.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+c;let{theme:p={}}=e;p.primary&&s.style.setProperty("--ib-primary",p.primary),p.background&&s.style.setProperty("--ib-background",p.background),p.surface&&s.style.setProperty("--ib-surface",p.surface),p.text&&s.style.setProperty("--ib-text",p.text),p.selected&&s.style.setProperty("--ib-selected",p.selected),p.selectedColor&&s.style.setProperty("--ib-selected-color",p.selectedColor);let b=document.createElement("div");b.className="ib-bar";let B=document.createElement("div");B.className="ib-bar-label-area";let z=document.createElement("span");z.className="ib-bar-label",z.textContent=(G=e.label)!=null?G:"Was this helpful?",B.appendChild(z);let H=document.createElement("div");H.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let E=document.createElement("button");E.type="button",E.className="ib-bar-btn ib-bar-btn--up",E.setAttribute("aria-label","Yes"),E.appendChild(ie(ke));let k=document.createElement("button");k.type="button",k.className="ib-bar-btn ib-bar-btn--down",k.setAttribute("aria-label","No"),k.appendChild(ie(we)),H.appendChild(E),H.appendChild(k),e.showLabel!==!1&&b.appendChild(B),b.appendChild(H);let h=document.createElement("div");h.className="ib-bar-popover",h.setAttribute("role","dialog"),h.setAttribute("aria-modal","false");let O=document.createElement("div");if(O.className="ib-bar-header",e.modalTitle){h.setAttribute("aria-labelledby","ib-bar-title");let o=document.createElement("p");o.id="ib-bar-title",o.className="ib-bar-title",o.textContent=e.modalTitle,O.appendChild(o)}else h.setAttribute("aria-label","Feedback");let S=document.createElement("div");S.className="ib-bar-body";let y=document.createElement("textarea");y.className="ib-bar-textarea",y.placeholder=(J=e.modalPlaceholder)!=null?J:"What's on your mind?",y.maxLength=5e3,y.setAttribute("aria-label","Feedback");let L=document.createElement("p");L.className="ib-bar-error";let P=document.createElement("p");P.className="ib-bar-success";let i=document.createElement("button");if(i.type="button",i.className="ib-bar-submit",i.textContent="Send feedback",e.showTitleField===!0){let o=document.createElement("input");o.type="text",o.className="ib-bar-title-input",o.placeholder="Title (optional)",o.maxLength=500,o.setAttribute("aria-label","Feedback title"),S.appendChild(o)}S.appendChild(y),S.appendChild(L),S.appendChild(P);let l=document.createElement("div");l.className="ib-bar-footer",l.appendChild(i);let u=document.createElement("div");u.className="ib-branding";let m=document.createElement("a");m.href="https://inputbuffer.io",m.target="_blank",m.rel="noopener noreferrer",m.textContent="Powered by inputbuffer.io",u.appendChild(m),l.appendChild(u),S.appendChild(l),h.appendChild(O),h.appendChild(S),s.appendChild(h),s.appendChild(b);function v(){let o=b.getBoundingClientRect();h.style.top=`${o.top-h.offsetHeight-8}px`,h.style.left=`${o.right-320}px`}function A(o){t=o,h.classList.add("ib-bar-popover--visible"),requestAnimationFrame(v),L.textContent="",P.textContent="",y.focus(),setTimeout(()=>document.addEventListener("click",x),0),document.addEventListener("keydown",w),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("resize",v,{passive:!0}),d("open",{sentiment:o})}function I(){h.classList.contains("ib-bar-popover--visible")&&(h.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",x),document.removeEventListener("keydown",w),window.removeEventListener("scroll",v),window.removeEventListener("resize",v),y.value="",d("close"))}function F(){E.classList.remove("ib-bar-btn--active"),k.classList.remove("ib-bar-btn--active"),t=void 0}function x(o){s.contains(o.target)||I()}function w(o){o.key==="Escape"&&I()}async function R(){let o=y.value.trim();if(o.length<10){L.textContent="Please enter at least 10 characters.";return}L.textContent="",i.disabled=!0,i.textContent="Sending\u2026";let T=h.querySelector(".ib-bar-title-input"),C=(T==null?void 0:T.value.trim())||null;try{let N=await D(e.apiKey,o,C,{sentiment:t,target:e.target,submittedBy:e.submittedBy},e.apiUrl);d("submit",N),P.textContent="Thanks for your feedback!",i.textContent="Send feedback",setTimeout(()=>{I(),F()},2e3)}catch(N){d("error",N instanceof Error?N:new Error("Something went wrong.")),L.textContent=j(N),i.disabled=!1,i.textContent="Send feedback"}}function q(o){E.classList.remove("ib-bar-btn--active"),k.classList.remove("ib-bar-btn--active"),o.classList.add("ib-bar-btn--active")}let W=n();W&&(t=W,q(W==="positive"?E:k));function V(o,T){var C;g(o),q(T),A(o),d("vote",{sentiment:o}),e.target&&ee(e.apiKey,o==="positive"?1:-1,e.target,(C=e.userId)!=null?C:null,e.apiUrl).catch(()=>{})}return E.addEventListener("click",()=>V("positive",E)),k.addEventListener("click",()=>V("negative",k)),i.addEventListener("click",R),{element:s,on(o,T){var C;(C=a[o])==null||C.push(T)},destroy(){I(),s.remove()}}}function f(e,t){var r;return(r=e.getAttribute(t))!=null?r:void 0}function ne(e,t){let r=e.getAttribute(t);return r===null?void 0:r==="true"}function Te(e){return{primary:f(e,"theme-primary"),background:f(e,"theme-background"),text:f(e,"theme-text"),selected:f(e,"theme-selected"),selectedColor:f(e,"theme-selected-color")}}function Se(e){var r;let t=e.getAttribute("target-type");if(t)switch(t){case"documentation":{let n=(r=f(e,"target-page-url"))!=null?r:typeof window!="undefined"?window.location.href:void 0;if(!n){M('target-type="documentation" needs target-page-url. Ignoring the target.');return}return{type:"documentation",metadata:{page_url:n,section_heading:f(e,"target-section-heading"),doc_version:f(e,"target-doc-version")}}}case"rest_endpoint":{let n=f(e,"target-method"),g=f(e,"target-path");if(!n||!g){M('target-type="rest_endpoint" needs target-method and target-path. Ignoring the target.');return}return{type:"rest_endpoint",metadata:{method:n,path:g,host:f(e,"target-host"),api_version:f(e,"target-api-version")}}}case"cli_command":{let n=f(e,"target-command");if(!n){M('target-type="cli_command" needs target-command. Ignoring the target.');return}let g=f(e,"target-args");return{type:"cli_command",metadata:{command:n,subcommand:f(e,"target-subcommand"),cli_version:f(e,"target-cli-version"),args:g?g.split(",").map(a=>a.trim()).filter(Boolean):void 0}}}default:M(`Unknown target-type "${t}". Expected documentation, rest_endpoint, or cli_command.`);return}}function oe(e,t){return{apiKey:t,apiUrl:f(e,"api-url"),label:f(e,"label"),showLabel:ne(e,"show-label"),placement:e.getAttribute("placement")==="fixed"?"fixed":"inline",colorScheme:f(e,"color-scheme"),modalTitle:f(e,"modal-title"),modalPlaceholder:f(e,"modal-placeholder"),showTitleField:ne(e,"show-title-field"),submittedBy:f(e,"submitted-by"),userId:f(e,"user-id"),target:Se(e),theme:Te(e)}}function ae(e){return e.getAttribute("inject-styles")!=="false"}function se(e,t){let r=e.dataset;return{apiKey:t,apiUrl:r.apiUrl,attachTo:r.attachTo,injectStyles:r.injectStyles===void 0?!0:r.injectStyles!=="false",colorScheme:r.colorScheme,title:r.title,placeholder:r.placeholder,showTitleField:r.showTitleField===void 0?void 0:r.showTitleField==="true",showSentiment:r.showSentiment===void 0?void 0:r.showSentiment==="true",submittedBy:r.submittedBy,theme:{primary:r.themePrimary,background:r.themeBackground,text:r.themeText,selected:r.themeSelected,selectedColor:r.themeSelectedColor}}}var le=`/* InputBuffer Modal Styles
1
+ function X(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 _=class extends Error{constructor(t){super(t.detail),this.name="ApiError",this.type=t.type,this.title=t.title,this.status=t.status,this.detail=t.detail,this.category=t.category,this.field=t.field}};var Y="Something went wrong. Please try again.";function j(e){return e instanceof _?e.category==="user"?e.detail:(e.category==="integration"&&M(`${e.title}: ${e.detail}`,e.type),Y):Y}function M(e,t){typeof console!="undefined"&&console.warn(`[inputbuffer] ${e}`,t!=null?t:"")}var U="0.3.1",pe="https://inputbuffer.io",me="/api/v0/feedback",fe="/api/v0/reactions",ge=1e4,he=5e3,ve=500,ye=300;function Q(e,t){return`${(e!=null?e:pe).replace(/\/+$/,"")}${t}`}async function Z(e,t,r){var d,s,c,p;let n=new AbortController,g=setTimeout(()=>n.abort(),ge),a;try{a=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${U} (javascript)`},body:JSON.stringify(r),credentials:"omit",signal:n.signal})}finally{clearTimeout(g)}if(!a.ok){let b=await a.json().catch(()=>({}));throw new _({type:(d=b.type)!=null?d:"https://inputbuffer.io/docs/api/problems/internal-error",title:(s=b.title)!=null?s:"Error",detail:(c=b.detail)!=null?c:"Submission failed. Please try again.",status:(p=b.status)!=null?p:a.status,category:b.category,field:b.field})}return a}async function D(e,t,r,n,g){let a={description:t.slice(0,he)};if(r&&(a.title=r.slice(0,ve)),n!=null&&n.submittedBy&&(a.submitted_by=n.submittedBy.slice(0,ye)),n!=null&&n.target){let c=n.target;a.targets=[{type:c.type,metadata:c.metadata}]}let d=await Z(Q(g,me),e,a),{data:s}=await d.json();return{id:s.id}}async function ee(e,t,r,n,g){let a={reaction_value:t,target:{type:r.type,metadata:r.metadata}};n&&(a.user_id=n);let d;try{d=await Z(Q(g,fe),e,a)}catch(c){throw c instanceof _&&c.status===422&&c.field==="user_id"&&M("Reaction rejected: no user_id and no client IP. Set the `userId` option (or the `user-id` attribute)."),c}let{data:s}=await d.json();return s}function te(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 xe="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",Ee="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 re(e){let t=null,r,n,g=null,a=null,d=null,s=null,c=null,p=null,b=null,B=null,z=[],H=[],E=[];function k(i){if(i.key==="Escape"){y();return}if(i.key==="Tab"&&t){let l=Array.from(t.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(l.length===0)return;let u=l[0],m=l[l.length-1];i.shiftKey?document.activeElement===u&&(i.preventDefault(),m.focus()):document.activeElement===m&&(i.preventDefault(),u.focus())}}async function h(){var l;if(!a||!s)return;let i=a.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"),s.disabled=!0,s.textContent="Sending\u2026";try{let u=(d==null?void 0:d.value.trim())||null,m=n!=null?n:r==null?void 0:r.sentiment,v=await D(e.apiKey,i,u,{...r,sentiment:m,submittedBy:(l=r==null?void 0:r.submittedBy)!=null?l:e.submittedBy},e.apiUrl);p&&(p.textContent="Thanks for your feedback!",p.style.display="block"),z.forEach(A=>A(v)),g=setTimeout(()=>y(),2e3)}catch(u){let m=u instanceof Error?u:new Error("Unknown error");c&&(c.textContent=j(u),c.style.display="block"),E.forEach(v=>v(m)),s.disabled=!1,s.textContent="Send feedback"}}function O(){let i=document.createElement("div");i.id="ib-overlay";let l=document.createElement("div");l.id="ib-modal",e.colorScheme==="dark"?l.classList.add("ib-theme-dark"):e.colorScheme==="light"&&l.classList.add("ib-theme-light"),l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true");let u=document.createElement("div");if(u.id="ib-modal-header",B=u,e.title?(l.setAttribute("aria-labelledby","ib-title"),b=document.createElement("h2"),b.id="ib-title",b.className="ib-modal-title",b.textContent=e.title,u.appendChild(b)):l.setAttribute("aria-label","Feedback"),e.showSentiment){let x,w,R=document.createElement("div");R.className="ib-modal-sentiment",x=document.createElement("button"),x.type="button",x.className="ib-modal-thumb ib-modal-thumb--up",x.setAttribute("aria-label","Helpful"),x.appendChild(te(xe)),w=document.createElement("button"),w.type="button",w.className="ib-modal-thumb ib-modal-thumb--down",w.setAttribute("aria-label","Not helpful"),w.appendChild(te(Ee)),x.addEventListener("click",()=>{x.classList.add("ib-modal-thumb--active"),w.classList.remove("ib-modal-thumb--active"),n="positive"}),w.addEventListener("click",()=>{w.classList.add("ib-modal-thumb--active"),x.classList.remove("ib-modal-thumb--active"),n="negative"}),R.appendChild(x),R.appendChild(w),u.appendChild(R)}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",y),u.appendChild(m);let v=document.createElement("div");v.id="ib-modal-body",a=document.createElement("textarea"),a.id="ib-textarea",a.className="ib-modal-textarea",a.placeholder=e.placeholder||"What's on your mind?",a.maxLength=5e3,a.setAttribute("aria-label","Feedback"),s=document.createElement("button"),s.id="ib-submit",s.className="ib-modal-submit",s.textContent="Send feedback",s.addEventListener("click",h),p=document.createElement("p"),p.id="ib-success",p.className="ib-modal-success",c=document.createElement("p"),c.id="ib-error",c.className="ib-modal-error",e.showTitleField===!0&&(d=document.createElement("input"),d.id="ib-title-input",d.className="ib-modal-title-input",d.type="text",d.placeholder="Title (optional)",d.maxLength=500,d.setAttribute("aria-label","Feedback title"),v.appendChild(d)),v.appendChild(a),v.appendChild(c),v.appendChild(p);let A=document.createElement("div");A.className="ib-modal-footer",A.appendChild(s);let I=document.createElement("div");I.className="ib-branding";let F=document.createElement("a");return F.href="https://inputbuffer.io",F.target="_blank",F.rel="noopener noreferrer",F.textContent="Powered by inputbuffer.io",I.appendChild(F),A.appendChild(I),v.appendChild(A),l.appendChild(u),l.appendChild(v),i.appendChild(l),i.addEventListener("click",x=>{x.target===i&&y()}),document.addEventListener("keydown",k),i}function S(i){var l;if(!t){if(r=i,t=O(),document.body.appendChild(t),X(e),i!=null&&i.title){if(b)b.textContent=i.title;else if(B){let u=t.querySelector("#ib-modal");u.removeAttribute("aria-label"),u.setAttribute("aria-labelledby","ib-title"),b=document.createElement("h2"),b.id="ib-title",b.className="ib-modal-title",b.textContent=i.title,B.prepend(b)}}if(i!=null&&i.sentiment){n=i.sentiment;let u=t.querySelector(".ib-modal-thumb--up"),m=t.querySelector(".ib-modal-thumb--down");i.sentiment==="positive"?u==null||u.classList.add("ib-modal-thumb--active"):i.sentiment==="negative"&&(m==null||m.classList.add("ib-modal-thumb--active"))}a&&((l=i==null?void 0:i.prefill)!=null&&l.description)&&(a.value=i.prefill.description),a==null||a.focus()}}function y(){t&&(g!==null&&(clearTimeout(g),g=null),document.removeEventListener("keydown",k),t.remove(),t=null,a=null,d=null,s=null,c=null,p=null,b=null,B=null,r=void 0,n=void 0,H.forEach(i=>i()))}function L(i,l){i==="submit"?z.push(l):i==="close"?H.push(l):i==="error"&&E.push(l)}function P(){y()}return{open:S,close:y,on:L,destroy:P}}function ie(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 ke="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",we="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",Ce=1440*60*1e3;function K(e){var G,J;let t;function r(){let o=e.target;return o?`ib:reaction:${e.apiKey}:${o.type}:${JSON.stringify(o.metadata)}`:`ib:reaction:${e.apiKey}:${window.location.pathname}`}function n(){try{let o=localStorage.getItem(r());if(!o)return null;let{sentiment:T,ts:C}=JSON.parse(o);return Date.now()-C>Ce?(localStorage.removeItem(r()),null):T}catch{return null}}function g(o){try{localStorage.setItem(r(),JSON.stringify({sentiment:o,ts:Date.now()}))}catch{}}let a={vote:[],open:[],submit:[],close:[],error:[]};function d(o,T){var C;(C=a[o])==null||C.forEach(N=>N(T))}let s=document.createElement("div"),c=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";s.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+c;let{theme:p={}}=e;p.primary&&s.style.setProperty("--ib-primary",p.primary),p.background&&s.style.setProperty("--ib-background",p.background),p.surface&&s.style.setProperty("--ib-surface",p.surface),p.text&&s.style.setProperty("--ib-text",p.text),p.selected&&s.style.setProperty("--ib-selected",p.selected),p.selectedColor&&s.style.setProperty("--ib-selected-color",p.selectedColor);let b=document.createElement("div");b.className="ib-bar";let B=document.createElement("div");B.className="ib-bar-label-area";let z=document.createElement("span");z.className="ib-bar-label",z.textContent=(G=e.label)!=null?G:"Was this helpful?",B.appendChild(z);let H=document.createElement("div");H.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let E=document.createElement("button");E.type="button",E.className="ib-bar-btn ib-bar-btn--up",E.setAttribute("aria-label","Yes"),E.appendChild(ie(ke));let k=document.createElement("button");k.type="button",k.className="ib-bar-btn ib-bar-btn--down",k.setAttribute("aria-label","No"),k.appendChild(ie(we)),H.appendChild(E),H.appendChild(k),e.showLabel!==!1&&b.appendChild(B),b.appendChild(H);let h=document.createElement("div");h.className="ib-bar-popover",h.setAttribute("role","dialog"),h.setAttribute("aria-modal","false");let O=document.createElement("div");if(O.className="ib-bar-header",e.modalTitle){h.setAttribute("aria-labelledby","ib-bar-title");let o=document.createElement("p");o.id="ib-bar-title",o.className="ib-bar-title",o.textContent=e.modalTitle,O.appendChild(o)}else h.setAttribute("aria-label","Feedback");let S=document.createElement("div");S.className="ib-bar-body";let y=document.createElement("textarea");y.className="ib-bar-textarea",y.placeholder=(J=e.modalPlaceholder)!=null?J:"What's on your mind?",y.maxLength=5e3,y.setAttribute("aria-label","Feedback");let L=document.createElement("p");L.className="ib-bar-error";let P=document.createElement("p");P.className="ib-bar-success";let i=document.createElement("button");if(i.type="button",i.className="ib-bar-submit",i.textContent="Send feedback",e.showTitleField===!0){let o=document.createElement("input");o.type="text",o.className="ib-bar-title-input",o.placeholder="Title (optional)",o.maxLength=500,o.setAttribute("aria-label","Feedback title"),S.appendChild(o)}S.appendChild(y),S.appendChild(L),S.appendChild(P);let l=document.createElement("div");l.className="ib-bar-footer",l.appendChild(i);let u=document.createElement("div");u.className="ib-branding";let m=document.createElement("a");m.href="https://inputbuffer.io",m.target="_blank",m.rel="noopener noreferrer",m.textContent="Powered by inputbuffer.io",u.appendChild(m),l.appendChild(u),S.appendChild(l),h.appendChild(O),h.appendChild(S),s.appendChild(h),s.appendChild(b);function v(){let o=b.getBoundingClientRect();h.style.top=`${o.top-h.offsetHeight-8}px`,h.style.left=`${o.right-320}px`}function A(o){t=o,h.classList.add("ib-bar-popover--visible"),requestAnimationFrame(v),L.textContent="",P.textContent="",y.focus(),setTimeout(()=>document.addEventListener("click",x),0),document.addEventListener("keydown",w),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("resize",v,{passive:!0}),d("open",{sentiment:o})}function I(){h.classList.contains("ib-bar-popover--visible")&&(h.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",x),document.removeEventListener("keydown",w),window.removeEventListener("scroll",v),window.removeEventListener("resize",v),y.value="",d("close"))}function F(){E.classList.remove("ib-bar-btn--active"),k.classList.remove("ib-bar-btn--active"),t=void 0}function x(o){s.contains(o.target)||I()}function w(o){o.key==="Escape"&&I()}async function R(){let o=y.value.trim();if(o.length<10){L.textContent="Please enter at least 10 characters.";return}L.textContent="",i.disabled=!0,i.textContent="Sending\u2026";let T=h.querySelector(".ib-bar-title-input"),C=(T==null?void 0:T.value.trim())||null;try{let N=await D(e.apiKey,o,C,{sentiment:t,target:e.target,submittedBy:e.submittedBy},e.apiUrl);d("submit",N),P.textContent="Thanks for your feedback!",i.textContent="Send feedback",setTimeout(()=>{I(),F()},2e3)}catch(N){d("error",N instanceof Error?N:new Error("Something went wrong.")),L.textContent=j(N),i.disabled=!1,i.textContent="Send feedback"}}function q(o){E.classList.remove("ib-bar-btn--active"),k.classList.remove("ib-bar-btn--active"),o.classList.add("ib-bar-btn--active")}let W=n();W&&(t=W,q(W==="positive"?E:k));function V(o,T){var C;g(o),q(T),A(o),d("vote",{sentiment:o}),e.target&&ee(e.apiKey,o==="positive"?1:-1,e.target,(C=e.userId)!=null?C:null,e.apiUrl).catch(()=>{})}return E.addEventListener("click",()=>V("positive",E)),k.addEventListener("click",()=>V("negative",k)),i.addEventListener("click",R),{element:s,on(o,T){var C;(C=a[o])==null||C.push(T)},destroy(){I(),s.remove()}}}function f(e,t){var r;return(r=e.getAttribute(t))!=null?r:void 0}function ne(e,t){let r=e.getAttribute(t);return r===null?void 0:r==="true"}function Te(e){return{primary:f(e,"theme-primary"),background:f(e,"theme-background"),text:f(e,"theme-text"),selected:f(e,"theme-selected"),selectedColor:f(e,"theme-selected-color")}}function Se(e){var r;let t=e.getAttribute("target-type");if(t)switch(t){case"documentation":{let n=(r=f(e,"target-page-url"))!=null?r:typeof window!="undefined"?window.location.href:void 0;if(!n){M('target-type="documentation" needs target-page-url. Ignoring the target.');return}return{type:"documentation",metadata:{page_url:n,section_heading:f(e,"target-section-heading"),doc_version:f(e,"target-doc-version")}}}case"rest_endpoint":{let n=f(e,"target-method"),g=f(e,"target-path");if(!n||!g){M('target-type="rest_endpoint" needs target-method and target-path. Ignoring the target.');return}return{type:"rest_endpoint",metadata:{method:n,path:g,host:f(e,"target-host"),api_version:f(e,"target-api-version")}}}case"cli_command":{let n=f(e,"target-command");if(!n){M('target-type="cli_command" needs target-command. Ignoring the target.');return}let g=f(e,"target-args");return{type:"cli_command",metadata:{command:n,subcommand:f(e,"target-subcommand"),cli_version:f(e,"target-cli-version"),args:g?g.split(",").map(a=>a.trim()).filter(Boolean):void 0}}}default:M(`Unknown target-type "${t}". Expected documentation, rest_endpoint, or cli_command.`);return}}function oe(e,t){return{apiKey:t,apiUrl:f(e,"api-url"),label:f(e,"label"),showLabel:ne(e,"show-label"),placement:e.getAttribute("placement")==="fixed"?"fixed":"inline",colorScheme:f(e,"color-scheme"),modalTitle:f(e,"modal-title"),modalPlaceholder:f(e,"modal-placeholder"),showTitleField:ne(e,"show-title-field"),submittedBy:f(e,"submitted-by"),userId:f(e,"user-id"),target:Se(e),theme:Te(e)}}function ae(e){return e.getAttribute("inject-styles")!=="false"}function se(e,t){let r=e.dataset;return{apiKey:t,apiUrl:r.apiUrl,attachTo:r.attachTo,injectStyles:r.injectStyles===void 0?!0:r.injectStyles!=="false",colorScheme:r.colorScheme,title:r.title,placeholder:r.placeholder,showTitleField:r.showTitleField===void 0?void 0:r.showTitleField==="true",showSentiment:r.showSentiment===void 0?void 0:r.showSentiment==="true",submittedBy:r.submittedBy,theme:{primary:r.themePrimary,background:r.themeBackground,text:r.themeText,selected:r.themeSelected,selectedColor:r.themeSelectedColor}}}var le=`/* InputBuffer Modal Styles
2
2
  * All #ib-* IDs are stable public API \u2014 do not rename them.
3
3
  * Developers may target these IDs from their own stylesheets to customize the widget.
4
4
  */
package/dist/widget.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{function X(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 _=class extends Error{constructor(t){super(t.detail),this.name="ApiError",this.type=t.type,this.title=t.title,this.status=t.status,this.detail=t.detail,this.category=t.category,this.field=t.field}};var Y="Something went wrong. Please try again.";function j(e){return e instanceof _?e.category==="user"?e.detail:(e.category==="integration"&&M(`${e.title}: ${e.detail}`,e.type),Y):Y}function M(e,t){typeof console!="undefined"&&console.warn(`[inputbuffer] ${e}`,t!=null?t:"")}var U="0.3.0",pe="https://inputbuffer.io",me="/api/v0/feedback",fe="/api/v0/reactions",ge=1e4,he=5e3,ve=500,ye=300;function Q(e,t){return`${(e!=null?e:pe).replace(/\/+$/,"")}${t}`}async function Z(e,t,r){var d,s,c,p;let n=new AbortController,g=setTimeout(()=>n.abort(),ge),a;try{a=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${U} (javascript)`},body:JSON.stringify(r),credentials:"omit",signal:n.signal})}finally{clearTimeout(g)}if(!a.ok){let b=await a.json().catch(()=>({}));throw new _({type:(d=b.type)!=null?d:"https://inputbuffer.io/docs/api/problems/internal-error",title:(s=b.title)!=null?s:"Error",detail:(c=b.detail)!=null?c:"Submission failed. Please try again.",status:(p=b.status)!=null?p:a.status,category:b.category,field:b.field})}return a}async function D(e,t,r,n,g){let a={description:t.slice(0,he)};if(r&&(a.title=r.slice(0,ve)),n!=null&&n.submittedBy&&(a.submitted_by=n.submittedBy.slice(0,ye)),n!=null&&n.target){let c=n.target;a.targets=[{type:c.type,metadata:c.metadata}]}let d=await Z(Q(g,me),e,a),{data:s}=await d.json();return{id:s.id}}async function ee(e,t,r,n,g){let a={reaction_value:t,target:{type:r.type,metadata:r.metadata}};n&&(a.user_id=n);let d;try{d=await Z(Q(g,fe),e,a)}catch(c){throw c instanceof _&&c.status===422&&c.field==="user_id"&&M("Reaction rejected: no user_id and no client IP. Set the `userId` option (or the `user-id` attribute)."),c}let{data:s}=await d.json();return s}function te(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 xe="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",Ee="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 re(e){let t=null,r,n,g=null,a=null,d=null,s=null,c=null,p=null,b=null,B=null,z=[],H=[],E=[];function k(i){if(i.key==="Escape"){y();return}if(i.key==="Tab"&&t){let l=Array.from(t.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(l.length===0)return;let u=l[0],m=l[l.length-1];i.shiftKey?document.activeElement===u&&(i.preventDefault(),m.focus()):document.activeElement===m&&(i.preventDefault(),u.focus())}}async function h(){var l;if(!a||!s)return;let i=a.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"),s.disabled=!0,s.textContent="Sending\u2026";try{let u=(d==null?void 0:d.value.trim())||null,m=n!=null?n:r==null?void 0:r.sentiment,v=await D(e.apiKey,i,u,{...r,sentiment:m,submittedBy:(l=r==null?void 0:r.submittedBy)!=null?l:e.submittedBy},e.apiUrl);p&&(p.textContent="Thanks for your feedback!",p.style.display="block"),z.forEach(A=>A(v)),g=setTimeout(()=>y(),2e3)}catch(u){let m=u instanceof Error?u:new Error("Unknown error");c&&(c.textContent=j(u),c.style.display="block"),E.forEach(v=>v(m)),s.disabled=!1,s.textContent="Send feedback"}}function O(){let i=document.createElement("div");i.id="ib-overlay";let l=document.createElement("div");l.id="ib-modal",e.colorScheme==="dark"?l.classList.add("ib-theme-dark"):e.colorScheme==="light"&&l.classList.add("ib-theme-light"),l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true");let u=document.createElement("div");if(u.id="ib-modal-header",B=u,e.title?(l.setAttribute("aria-labelledby","ib-title"),b=document.createElement("h2"),b.id="ib-title",b.className="ib-modal-title",b.textContent=e.title,u.appendChild(b)):l.setAttribute("aria-label","Feedback"),e.showSentiment){let x,w,R=document.createElement("div");R.className="ib-modal-sentiment",x=document.createElement("button"),x.type="button",x.className="ib-modal-thumb ib-modal-thumb--up",x.setAttribute("aria-label","Helpful"),x.appendChild(te(xe)),w=document.createElement("button"),w.type="button",w.className="ib-modal-thumb ib-modal-thumb--down",w.setAttribute("aria-label","Not helpful"),w.appendChild(te(Ee)),x.addEventListener("click",()=>{x.classList.add("ib-modal-thumb--active"),w.classList.remove("ib-modal-thumb--active"),n="positive"}),w.addEventListener("click",()=>{w.classList.add("ib-modal-thumb--active"),x.classList.remove("ib-modal-thumb--active"),n="negative"}),R.appendChild(x),R.appendChild(w),u.appendChild(R)}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",y),u.appendChild(m);let v=document.createElement("div");v.id="ib-modal-body",a=document.createElement("textarea"),a.id="ib-textarea",a.className="ib-modal-textarea",a.placeholder=e.placeholder||"What's on your mind?",a.maxLength=5e3,a.setAttribute("aria-label","Feedback"),s=document.createElement("button"),s.id="ib-submit",s.className="ib-modal-submit",s.textContent="Send feedback",s.addEventListener("click",h),p=document.createElement("p"),p.id="ib-success",p.className="ib-modal-success",c=document.createElement("p"),c.id="ib-error",c.className="ib-modal-error",e.showTitleField===!0&&(d=document.createElement("input"),d.id="ib-title-input",d.className="ib-modal-title-input",d.type="text",d.placeholder="Title (optional)",d.maxLength=500,d.setAttribute("aria-label","Feedback title"),v.appendChild(d)),v.appendChild(a),v.appendChild(c),v.appendChild(p);let A=document.createElement("div");A.className="ib-modal-footer",A.appendChild(s);let I=document.createElement("div");I.className="ib-branding";let F=document.createElement("a");return F.href="https://inputbuffer.io",F.target="_blank",F.rel="noopener noreferrer",F.textContent="Powered by inputbuffer.io",I.appendChild(F),A.appendChild(I),v.appendChild(A),l.appendChild(u),l.appendChild(v),i.appendChild(l),i.addEventListener("click",x=>{x.target===i&&y()}),document.addEventListener("keydown",k),i}function S(i){var l;if(!t){if(r=i,t=O(),document.body.appendChild(t),X(e),i!=null&&i.title){if(b)b.textContent=i.title;else if(B){let u=t.querySelector("#ib-modal");u.removeAttribute("aria-label"),u.setAttribute("aria-labelledby","ib-title"),b=document.createElement("h2"),b.id="ib-title",b.className="ib-modal-title",b.textContent=i.title,B.prepend(b)}}if(i!=null&&i.sentiment){n=i.sentiment;let u=t.querySelector(".ib-modal-thumb--up"),m=t.querySelector(".ib-modal-thumb--down");i.sentiment==="positive"?u==null||u.classList.add("ib-modal-thumb--active"):i.sentiment==="negative"&&(m==null||m.classList.add("ib-modal-thumb--active"))}a&&((l=i==null?void 0:i.prefill)!=null&&l.description)&&(a.value=i.prefill.description),a==null||a.focus()}}function y(){t&&(g!==null&&(clearTimeout(g),g=null),document.removeEventListener("keydown",k),t.remove(),t=null,a=null,d=null,s=null,c=null,p=null,b=null,B=null,r=void 0,n=void 0,H.forEach(i=>i()))}function L(i,l){i==="submit"?z.push(l):i==="close"?H.push(l):i==="error"&&E.push(l)}function P(){y()}return{open:S,close:y,on:L,destroy:P}}function ie(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 ke="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",we="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",Ce=24*60*60*1e3;function K(e){var G,J;let t;function r(){let o=e.target;return o?`ib:reaction:${e.apiKey}:${o.type}:${JSON.stringify(o.metadata)}`:`ib:reaction:${e.apiKey}:${window.location.pathname}`}function n(){try{let o=localStorage.getItem(r());if(!o)return null;let{sentiment:T,ts:C}=JSON.parse(o);return Date.now()-C>Ce?(localStorage.removeItem(r()),null):T}catch{return null}}function g(o){try{localStorage.setItem(r(),JSON.stringify({sentiment:o,ts:Date.now()}))}catch{}}let a={vote:[],open:[],submit:[],close:[],error:[]};function d(o,T){var C;(C=a[o])==null||C.forEach(N=>N(T))}let s=document.createElement("div"),c=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";s.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+c;let{theme:p={}}=e;p.primary&&s.style.setProperty("--ib-primary",p.primary),p.background&&s.style.setProperty("--ib-background",p.background),p.surface&&s.style.setProperty("--ib-surface",p.surface),p.text&&s.style.setProperty("--ib-text",p.text),p.selected&&s.style.setProperty("--ib-selected",p.selected),p.selectedColor&&s.style.setProperty("--ib-selected-color",p.selectedColor);let b=document.createElement("div");b.className="ib-bar";let B=document.createElement("div");B.className="ib-bar-label-area";let z=document.createElement("span");z.className="ib-bar-label",z.textContent=(G=e.label)!=null?G:"Was this helpful?",B.appendChild(z);let H=document.createElement("div");H.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let E=document.createElement("button");E.type="button",E.className="ib-bar-btn ib-bar-btn--up",E.setAttribute("aria-label","Yes"),E.appendChild(ie(ke));let k=document.createElement("button");k.type="button",k.className="ib-bar-btn ib-bar-btn--down",k.setAttribute("aria-label","No"),k.appendChild(ie(we)),H.appendChild(E),H.appendChild(k),e.showLabel!==!1&&b.appendChild(B),b.appendChild(H);let h=document.createElement("div");h.className="ib-bar-popover",h.setAttribute("role","dialog"),h.setAttribute("aria-modal","false");let O=document.createElement("div");if(O.className="ib-bar-header",e.modalTitle){h.setAttribute("aria-labelledby","ib-bar-title");let o=document.createElement("p");o.id="ib-bar-title",o.className="ib-bar-title",o.textContent=e.modalTitle,O.appendChild(o)}else h.setAttribute("aria-label","Feedback");let S=document.createElement("div");S.className="ib-bar-body";let y=document.createElement("textarea");y.className="ib-bar-textarea",y.placeholder=(J=e.modalPlaceholder)!=null?J:"What's on your mind?",y.maxLength=5e3,y.setAttribute("aria-label","Feedback");let L=document.createElement("p");L.className="ib-bar-error";let P=document.createElement("p");P.className="ib-bar-success";let i=document.createElement("button");if(i.type="button",i.className="ib-bar-submit",i.textContent="Send feedback",e.showTitleField===!0){let o=document.createElement("input");o.type="text",o.className="ib-bar-title-input",o.placeholder="Title (optional)",o.maxLength=500,o.setAttribute("aria-label","Feedback title"),S.appendChild(o)}S.appendChild(y),S.appendChild(L),S.appendChild(P);let l=document.createElement("div");l.className="ib-bar-footer",l.appendChild(i);let u=document.createElement("div");u.className="ib-branding";let m=document.createElement("a");m.href="https://inputbuffer.io",m.target="_blank",m.rel="noopener noreferrer",m.textContent="Powered by inputbuffer.io",u.appendChild(m),l.appendChild(u),S.appendChild(l),h.appendChild(O),h.appendChild(S),s.appendChild(h),s.appendChild(b);function v(){let o=b.getBoundingClientRect();h.style.top=`${o.top-h.offsetHeight-8}px`,h.style.left=`${o.right-320}px`}function A(o){t=o,h.classList.add("ib-bar-popover--visible"),requestAnimationFrame(v),L.textContent="",P.textContent="",y.focus(),setTimeout(()=>document.addEventListener("click",x),0),document.addEventListener("keydown",w),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("resize",v,{passive:!0}),d("open",{sentiment:o})}function I(){h.classList.contains("ib-bar-popover--visible")&&(h.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",x),document.removeEventListener("keydown",w),window.removeEventListener("scroll",v),window.removeEventListener("resize",v),y.value="",d("close"))}function F(){E.classList.remove("ib-bar-btn--active"),k.classList.remove("ib-bar-btn--active"),t=void 0}function x(o){s.contains(o.target)||I()}function w(o){o.key==="Escape"&&I()}async function R(){let o=y.value.trim();if(o.length<10){L.textContent="Please enter at least 10 characters.";return}L.textContent="",i.disabled=!0,i.textContent="Sending\u2026";let T=h.querySelector(".ib-bar-title-input"),C=(T==null?void 0:T.value.trim())||null;try{let N=await D(e.apiKey,o,C,{sentiment:t,target:e.target,submittedBy:e.submittedBy},e.apiUrl);d("submit",N),P.textContent="Thanks for your feedback!",i.textContent="Send feedback",setTimeout(()=>{I(),F()},2e3)}catch(N){d("error",N instanceof Error?N:new Error("Something went wrong.")),L.textContent=j(N),i.disabled=!1,i.textContent="Send feedback"}}function q(o){E.classList.remove("ib-bar-btn--active"),k.classList.remove("ib-bar-btn--active"),o.classList.add("ib-bar-btn--active")}let W=n();W&&(t=W,q(W==="positive"?E:k));function V(o,T){var C;g(o),q(T),A(o),d("vote",{sentiment:o}),e.target&&ee(e.apiKey,o==="positive"?1:-1,e.target,(C=e.userId)!=null?C:null,e.apiUrl).catch(()=>{})}return E.addEventListener("click",()=>V("positive",E)),k.addEventListener("click",()=>V("negative",k)),i.addEventListener("click",R),{element:s,on(o,T){var C;(C=a[o])==null||C.push(T)},destroy(){I(),s.remove()}}}function f(e,t){var r;return(r=e.getAttribute(t))!=null?r:void 0}function ne(e,t){let r=e.getAttribute(t);return r===null?void 0:r==="true"}function Te(e){return{primary:f(e,"theme-primary"),background:f(e,"theme-background"),text:f(e,"theme-text"),selected:f(e,"theme-selected"),selectedColor:f(e,"theme-selected-color")}}function Se(e){var r;let t=e.getAttribute("target-type");if(t)switch(t){case"documentation":{let n=(r=f(e,"target-page-url"))!=null?r:typeof window!="undefined"?window.location.href:void 0;if(!n){M('target-type="documentation" needs target-page-url. Ignoring the target.');return}return{type:"documentation",metadata:{page_url:n,section_heading:f(e,"target-section-heading"),doc_version:f(e,"target-doc-version")}}}case"rest_endpoint":{let n=f(e,"target-method"),g=f(e,"target-path");if(!n||!g){M('target-type="rest_endpoint" needs target-method and target-path. Ignoring the target.');return}return{type:"rest_endpoint",metadata:{method:n,path:g,host:f(e,"target-host"),api_version:f(e,"target-api-version")}}}case"cli_command":{let n=f(e,"target-command");if(!n){M('target-type="cli_command" needs target-command. Ignoring the target.');return}let g=f(e,"target-args");return{type:"cli_command",metadata:{command:n,subcommand:f(e,"target-subcommand"),cli_version:f(e,"target-cli-version"),args:g?g.split(",").map(a=>a.trim()).filter(Boolean):void 0}}}default:M(`Unknown target-type "${t}". Expected documentation, rest_endpoint, or cli_command.`);return}}function oe(e,t){return{apiKey:t,apiUrl:f(e,"api-url"),label:f(e,"label"),showLabel:ne(e,"show-label"),placement:e.getAttribute("placement")==="fixed"?"fixed":"inline",colorScheme:f(e,"color-scheme"),modalTitle:f(e,"modal-title"),modalPlaceholder:f(e,"modal-placeholder"),showTitleField:ne(e,"show-title-field"),submittedBy:f(e,"submitted-by"),userId:f(e,"user-id"),target:Se(e),theme:Te(e)}}function ae(e){return e.getAttribute("inject-styles")!=="false"}function se(e,t){let r=e.dataset;return{apiKey:t,apiUrl:r.apiUrl,attachTo:r.attachTo,injectStyles:r.injectStyles===void 0?!0:r.injectStyles!=="false",colorScheme:r.colorScheme,title:r.title,placeholder:r.placeholder,showTitleField:r.showTitleField===void 0?void 0:r.showTitleField==="true",showSentiment:r.showSentiment===void 0?void 0:r.showSentiment==="true",submittedBy:r.submittedBy,theme:{primary:r.themePrimary,background:r.themeBackground,text:r.themeText,selected:r.themeSelected,selectedColor:r.themeSelectedColor}}}var le=`/* InputBuffer Modal Styles
1
+ "use strict";(()=>{function X(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 _=class extends Error{constructor(t){super(t.detail),this.name="ApiError",this.type=t.type,this.title=t.title,this.status=t.status,this.detail=t.detail,this.category=t.category,this.field=t.field}};var Y="Something went wrong. Please try again.";function j(e){return e instanceof _?e.category==="user"?e.detail:(e.category==="integration"&&M(`${e.title}: ${e.detail}`,e.type),Y):Y}function M(e,t){typeof console!="undefined"&&console.warn(`[inputbuffer] ${e}`,t!=null?t:"")}var U="0.3.1",pe="https://inputbuffer.io",me="/api/v0/feedback",fe="/api/v0/reactions",ge=1e4,he=5e3,ve=500,ye=300;function Q(e,t){return`${(e!=null?e:pe).replace(/\/+$/,"")}${t}`}async function Z(e,t,r){var d,s,c,p;let n=new AbortController,g=setTimeout(()=>n.abort(),ge),a;try{a=await fetch(e,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-IB-Client":`inputbuffer-widget/${U} (javascript)`},body:JSON.stringify(r),credentials:"omit",signal:n.signal})}finally{clearTimeout(g)}if(!a.ok){let b=await a.json().catch(()=>({}));throw new _({type:(d=b.type)!=null?d:"https://inputbuffer.io/docs/api/problems/internal-error",title:(s=b.title)!=null?s:"Error",detail:(c=b.detail)!=null?c:"Submission failed. Please try again.",status:(p=b.status)!=null?p:a.status,category:b.category,field:b.field})}return a}async function D(e,t,r,n,g){let a={description:t.slice(0,he)};if(r&&(a.title=r.slice(0,ve)),n!=null&&n.submittedBy&&(a.submitted_by=n.submittedBy.slice(0,ye)),n!=null&&n.target){let c=n.target;a.targets=[{type:c.type,metadata:c.metadata}]}let d=await Z(Q(g,me),e,a),{data:s}=await d.json();return{id:s.id}}async function ee(e,t,r,n,g){let a={reaction_value:t,target:{type:r.type,metadata:r.metadata}};n&&(a.user_id=n);let d;try{d=await Z(Q(g,fe),e,a)}catch(c){throw c instanceof _&&c.status===422&&c.field==="user_id"&&M("Reaction rejected: no user_id and no client IP. Set the `userId` option (or the `user-id` attribute)."),c}let{data:s}=await d.json();return s}function te(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 xe="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",Ee="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 re(e){let t=null,r,n,g=null,a=null,d=null,s=null,c=null,p=null,b=null,B=null,z=[],H=[],E=[];function k(i){if(i.key==="Escape"){y();return}if(i.key==="Tab"&&t){let l=Array.from(t.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(l.length===0)return;let u=l[0],m=l[l.length-1];i.shiftKey?document.activeElement===u&&(i.preventDefault(),m.focus()):document.activeElement===m&&(i.preventDefault(),u.focus())}}async function h(){var l;if(!a||!s)return;let i=a.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"),s.disabled=!0,s.textContent="Sending\u2026";try{let u=(d==null?void 0:d.value.trim())||null,m=n!=null?n:r==null?void 0:r.sentiment,v=await D(e.apiKey,i,u,{...r,sentiment:m,submittedBy:(l=r==null?void 0:r.submittedBy)!=null?l:e.submittedBy},e.apiUrl);p&&(p.textContent="Thanks for your feedback!",p.style.display="block"),z.forEach(A=>A(v)),g=setTimeout(()=>y(),2e3)}catch(u){let m=u instanceof Error?u:new Error("Unknown error");c&&(c.textContent=j(u),c.style.display="block"),E.forEach(v=>v(m)),s.disabled=!1,s.textContent="Send feedback"}}function O(){let i=document.createElement("div");i.id="ib-overlay";let l=document.createElement("div");l.id="ib-modal",e.colorScheme==="dark"?l.classList.add("ib-theme-dark"):e.colorScheme==="light"&&l.classList.add("ib-theme-light"),l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true");let u=document.createElement("div");if(u.id="ib-modal-header",B=u,e.title?(l.setAttribute("aria-labelledby","ib-title"),b=document.createElement("h2"),b.id="ib-title",b.className="ib-modal-title",b.textContent=e.title,u.appendChild(b)):l.setAttribute("aria-label","Feedback"),e.showSentiment){let x,w,R=document.createElement("div");R.className="ib-modal-sentiment",x=document.createElement("button"),x.type="button",x.className="ib-modal-thumb ib-modal-thumb--up",x.setAttribute("aria-label","Helpful"),x.appendChild(te(xe)),w=document.createElement("button"),w.type="button",w.className="ib-modal-thumb ib-modal-thumb--down",w.setAttribute("aria-label","Not helpful"),w.appendChild(te(Ee)),x.addEventListener("click",()=>{x.classList.add("ib-modal-thumb--active"),w.classList.remove("ib-modal-thumb--active"),n="positive"}),w.addEventListener("click",()=>{w.classList.add("ib-modal-thumb--active"),x.classList.remove("ib-modal-thumb--active"),n="negative"}),R.appendChild(x),R.appendChild(w),u.appendChild(R)}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",y),u.appendChild(m);let v=document.createElement("div");v.id="ib-modal-body",a=document.createElement("textarea"),a.id="ib-textarea",a.className="ib-modal-textarea",a.placeholder=e.placeholder||"What's on your mind?",a.maxLength=5e3,a.setAttribute("aria-label","Feedback"),s=document.createElement("button"),s.id="ib-submit",s.className="ib-modal-submit",s.textContent="Send feedback",s.addEventListener("click",h),p=document.createElement("p"),p.id="ib-success",p.className="ib-modal-success",c=document.createElement("p"),c.id="ib-error",c.className="ib-modal-error",e.showTitleField===!0&&(d=document.createElement("input"),d.id="ib-title-input",d.className="ib-modal-title-input",d.type="text",d.placeholder="Title (optional)",d.maxLength=500,d.setAttribute("aria-label","Feedback title"),v.appendChild(d)),v.appendChild(a),v.appendChild(c),v.appendChild(p);let A=document.createElement("div");A.className="ib-modal-footer",A.appendChild(s);let I=document.createElement("div");I.className="ib-branding";let F=document.createElement("a");return F.href="https://inputbuffer.io",F.target="_blank",F.rel="noopener noreferrer",F.textContent="Powered by inputbuffer.io",I.appendChild(F),A.appendChild(I),v.appendChild(A),l.appendChild(u),l.appendChild(v),i.appendChild(l),i.addEventListener("click",x=>{x.target===i&&y()}),document.addEventListener("keydown",k),i}function S(i){var l;if(!t){if(r=i,t=O(),document.body.appendChild(t),X(e),i!=null&&i.title){if(b)b.textContent=i.title;else if(B){let u=t.querySelector("#ib-modal");u.removeAttribute("aria-label"),u.setAttribute("aria-labelledby","ib-title"),b=document.createElement("h2"),b.id="ib-title",b.className="ib-modal-title",b.textContent=i.title,B.prepend(b)}}if(i!=null&&i.sentiment){n=i.sentiment;let u=t.querySelector(".ib-modal-thumb--up"),m=t.querySelector(".ib-modal-thumb--down");i.sentiment==="positive"?u==null||u.classList.add("ib-modal-thumb--active"):i.sentiment==="negative"&&(m==null||m.classList.add("ib-modal-thumb--active"))}a&&((l=i==null?void 0:i.prefill)!=null&&l.description)&&(a.value=i.prefill.description),a==null||a.focus()}}function y(){t&&(g!==null&&(clearTimeout(g),g=null),document.removeEventListener("keydown",k),t.remove(),t=null,a=null,d=null,s=null,c=null,p=null,b=null,B=null,r=void 0,n=void 0,H.forEach(i=>i()))}function L(i,l){i==="submit"?z.push(l):i==="close"?H.push(l):i==="error"&&E.push(l)}function P(){y()}return{open:S,close:y,on:L,destroy:P}}function ie(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 ke="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",we="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",Ce=1440*60*1e3;function K(e){var G,J;let t;function r(){let o=e.target;return o?`ib:reaction:${e.apiKey}:${o.type}:${JSON.stringify(o.metadata)}`:`ib:reaction:${e.apiKey}:${window.location.pathname}`}function n(){try{let o=localStorage.getItem(r());if(!o)return null;let{sentiment:T,ts:C}=JSON.parse(o);return Date.now()-C>Ce?(localStorage.removeItem(r()),null):T}catch{return null}}function g(o){try{localStorage.setItem(r(),JSON.stringify({sentiment:o,ts:Date.now()}))}catch{}}let a={vote:[],open:[],submit:[],close:[],error:[]};function d(o,T){var C;(C=a[o])==null||C.forEach(N=>N(T))}let s=document.createElement("div"),c=e.colorScheme==="dark"?" ib-theme-dark":e.colorScheme==="light"?" ib-theme-light":"";s.className="ib-bar-wrapper"+(e.placement==="fixed"?" ib-bar-wrapper--fixed":"")+c;let{theme:p={}}=e;p.primary&&s.style.setProperty("--ib-primary",p.primary),p.background&&s.style.setProperty("--ib-background",p.background),p.surface&&s.style.setProperty("--ib-surface",p.surface),p.text&&s.style.setProperty("--ib-text",p.text),p.selected&&s.style.setProperty("--ib-selected",p.selected),p.selectedColor&&s.style.setProperty("--ib-selected-color",p.selectedColor);let b=document.createElement("div");b.className="ib-bar";let B=document.createElement("div");B.className="ib-bar-label-area";let z=document.createElement("span");z.className="ib-bar-label",z.textContent=(G=e.label)!=null?G:"Was this helpful?",B.appendChild(z);let H=document.createElement("div");H.className="ib-bar-actions"+(e.showLabel===!1?" ib-bar-actions--no-label":"");let E=document.createElement("button");E.type="button",E.className="ib-bar-btn ib-bar-btn--up",E.setAttribute("aria-label","Yes"),E.appendChild(ie(ke));let k=document.createElement("button");k.type="button",k.className="ib-bar-btn ib-bar-btn--down",k.setAttribute("aria-label","No"),k.appendChild(ie(we)),H.appendChild(E),H.appendChild(k),e.showLabel!==!1&&b.appendChild(B),b.appendChild(H);let h=document.createElement("div");h.className="ib-bar-popover",h.setAttribute("role","dialog"),h.setAttribute("aria-modal","false");let O=document.createElement("div");if(O.className="ib-bar-header",e.modalTitle){h.setAttribute("aria-labelledby","ib-bar-title");let o=document.createElement("p");o.id="ib-bar-title",o.className="ib-bar-title",o.textContent=e.modalTitle,O.appendChild(o)}else h.setAttribute("aria-label","Feedback");let S=document.createElement("div");S.className="ib-bar-body";let y=document.createElement("textarea");y.className="ib-bar-textarea",y.placeholder=(J=e.modalPlaceholder)!=null?J:"What's on your mind?",y.maxLength=5e3,y.setAttribute("aria-label","Feedback");let L=document.createElement("p");L.className="ib-bar-error";let P=document.createElement("p");P.className="ib-bar-success";let i=document.createElement("button");if(i.type="button",i.className="ib-bar-submit",i.textContent="Send feedback",e.showTitleField===!0){let o=document.createElement("input");o.type="text",o.className="ib-bar-title-input",o.placeholder="Title (optional)",o.maxLength=500,o.setAttribute("aria-label","Feedback title"),S.appendChild(o)}S.appendChild(y),S.appendChild(L),S.appendChild(P);let l=document.createElement("div");l.className="ib-bar-footer",l.appendChild(i);let u=document.createElement("div");u.className="ib-branding";let m=document.createElement("a");m.href="https://inputbuffer.io",m.target="_blank",m.rel="noopener noreferrer",m.textContent="Powered by inputbuffer.io",u.appendChild(m),l.appendChild(u),S.appendChild(l),h.appendChild(O),h.appendChild(S),s.appendChild(h),s.appendChild(b);function v(){let o=b.getBoundingClientRect();h.style.top=`${o.top-h.offsetHeight-8}px`,h.style.left=`${o.right-320}px`}function A(o){t=o,h.classList.add("ib-bar-popover--visible"),requestAnimationFrame(v),L.textContent="",P.textContent="",y.focus(),setTimeout(()=>document.addEventListener("click",x),0),document.addEventListener("keydown",w),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("resize",v,{passive:!0}),d("open",{sentiment:o})}function I(){h.classList.contains("ib-bar-popover--visible")&&(h.classList.remove("ib-bar-popover--visible"),document.removeEventListener("click",x),document.removeEventListener("keydown",w),window.removeEventListener("scroll",v),window.removeEventListener("resize",v),y.value="",d("close"))}function F(){E.classList.remove("ib-bar-btn--active"),k.classList.remove("ib-bar-btn--active"),t=void 0}function x(o){s.contains(o.target)||I()}function w(o){o.key==="Escape"&&I()}async function R(){let o=y.value.trim();if(o.length<10){L.textContent="Please enter at least 10 characters.";return}L.textContent="",i.disabled=!0,i.textContent="Sending\u2026";let T=h.querySelector(".ib-bar-title-input"),C=(T==null?void 0:T.value.trim())||null;try{let N=await D(e.apiKey,o,C,{sentiment:t,target:e.target,submittedBy:e.submittedBy},e.apiUrl);d("submit",N),P.textContent="Thanks for your feedback!",i.textContent="Send feedback",setTimeout(()=>{I(),F()},2e3)}catch(N){d("error",N instanceof Error?N:new Error("Something went wrong.")),L.textContent=j(N),i.disabled=!1,i.textContent="Send feedback"}}function q(o){E.classList.remove("ib-bar-btn--active"),k.classList.remove("ib-bar-btn--active"),o.classList.add("ib-bar-btn--active")}let W=n();W&&(t=W,q(W==="positive"?E:k));function V(o,T){var C;g(o),q(T),A(o),d("vote",{sentiment:o}),e.target&&ee(e.apiKey,o==="positive"?1:-1,e.target,(C=e.userId)!=null?C:null,e.apiUrl).catch(()=>{})}return E.addEventListener("click",()=>V("positive",E)),k.addEventListener("click",()=>V("negative",k)),i.addEventListener("click",R),{element:s,on(o,T){var C;(C=a[o])==null||C.push(T)},destroy(){I(),s.remove()}}}function f(e,t){var r;return(r=e.getAttribute(t))!=null?r:void 0}function ne(e,t){let r=e.getAttribute(t);return r===null?void 0:r==="true"}function Te(e){return{primary:f(e,"theme-primary"),background:f(e,"theme-background"),text:f(e,"theme-text"),selected:f(e,"theme-selected"),selectedColor:f(e,"theme-selected-color")}}function Se(e){var r;let t=e.getAttribute("target-type");if(t)switch(t){case"documentation":{let n=(r=f(e,"target-page-url"))!=null?r:typeof window!="undefined"?window.location.href:void 0;if(!n){M('target-type="documentation" needs target-page-url. Ignoring the target.');return}return{type:"documentation",metadata:{page_url:n,section_heading:f(e,"target-section-heading"),doc_version:f(e,"target-doc-version")}}}case"rest_endpoint":{let n=f(e,"target-method"),g=f(e,"target-path");if(!n||!g){M('target-type="rest_endpoint" needs target-method and target-path. Ignoring the target.');return}return{type:"rest_endpoint",metadata:{method:n,path:g,host:f(e,"target-host"),api_version:f(e,"target-api-version")}}}case"cli_command":{let n=f(e,"target-command");if(!n){M('target-type="cli_command" needs target-command. Ignoring the target.');return}let g=f(e,"target-args");return{type:"cli_command",metadata:{command:n,subcommand:f(e,"target-subcommand"),cli_version:f(e,"target-cli-version"),args:g?g.split(",").map(a=>a.trim()).filter(Boolean):void 0}}}default:M(`Unknown target-type "${t}". Expected documentation, rest_endpoint, or cli_command.`);return}}function oe(e,t){return{apiKey:t,apiUrl:f(e,"api-url"),label:f(e,"label"),showLabel:ne(e,"show-label"),placement:e.getAttribute("placement")==="fixed"?"fixed":"inline",colorScheme:f(e,"color-scheme"),modalTitle:f(e,"modal-title"),modalPlaceholder:f(e,"modal-placeholder"),showTitleField:ne(e,"show-title-field"),submittedBy:f(e,"submitted-by"),userId:f(e,"user-id"),target:Se(e),theme:Te(e)}}function ae(e){return e.getAttribute("inject-styles")!=="false"}function se(e,t){let r=e.dataset;return{apiKey:t,apiUrl:r.apiUrl,attachTo:r.attachTo,injectStyles:r.injectStyles===void 0?!0:r.injectStyles!=="false",colorScheme:r.colorScheme,title:r.title,placeholder:r.placeholder,showTitleField:r.showTitleField===void 0?void 0:r.showTitleField==="true",showSentiment:r.showSentiment===void 0?void 0:r.showSentiment==="true",submittedBy:r.submittedBy,theme:{primary:r.themePrimary,background:r.themeBackground,text:r.themeText,selected:r.themeSelected,selectedColor:r.themeSelectedColor}}}var le=`/* InputBuffer Modal Styles
2
2
  * All #ib-* IDs are stable public API \u2014 do not rename them.
3
3
  * Developers may target these IDs from their own stylesheets to customize the widget.
4
4
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inputbuffer/feedback",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Collect feedback from any website with a single script tag.",
5
5
  "type": "module",
6
6
  "main": "dist/widget.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@vitest/coverage-v8": "^4.1.4",
39
- "esbuild": "0.25.0",
39
+ "esbuild": "0.28.2",
40
40
  "jsdom": "^29.0.2",
41
41
  "typescript": "^5.8.2",
42
42
  "vitest": "^4.1.4"