beeport 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BeePort={})}(this,function(e){"use strict";function t(e,t){if(e.setAttribute("data-theme",t),"auto"!==t)return()=>{};if("undefined"==typeof window||!window.matchMedia)return()=>{};const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{};n.addEventListener("change",r);let o=!1;return()=>{o||(n.removeEventListener("change",r),o=!0)}}function n(e,t){const n=document.createElement("div");n.className="beeport-form-panel",n.style.display="none",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true");const o=document.createElement("div");o.className="beeport-form-header";const i=document.createElement("h3");i.className="beeport-form-title",i.id="beeport-form-title",i.textContent="Report to BeePort";const a=document.createElement("p");a.className="beeport-form-subtitle",a.textContent="Help us fix bugs and shape features in under a minute.",n.setAttribute("aria-labelledby","beeport-form-title");const s=document.createElement("button");s.className="beeport-form-close",s.textContent="×",s.setAttribute("aria-label","Close");const p=document.createElement("div");p.className="beeport-form-heading",p.appendChild(i),p.appendChild(a),o.appendChild(p),o.appendChild(s);const c=document.createElement("p");c.className="beeport-type-legend",c.textContent="What are you sharing?";const l=document.createElement("div");l.className="beeport-type-selector",l.setAttribute("role","tablist"),l.setAttribute("aria-label","Select feedback type");const d=r("bug","Bug report",!0),u=r("feature","Feature idea",!1);l.appendChild(d),l.appendChild(u);const b=document.createElement("div");b.className="beeport-input-wrapper";const h=document.createElement("label");h.textContent="Title",h.htmlFor="beeport-title-input",h.className="beeport-input-label";const m=document.createElement("input");m.type="text",m.id="beeport-title-input",m.className="beeport-input-title",m.placeholder="Example: Save button does nothing on Safari";const f=document.createElement("div");f.className="beeport-input-hint beeport-input-hint-title",f.textContent="Use a short summary (3+ characters).";const g=document.createElement("div");g.id="beeport-title-error",g.className="beeport-error-message",g.setAttribute("role","alert"),b.appendChild(h),b.appendChild(m),b.appendChild(f),b.appendChild(g);const x=document.createElement("div");x.className="beeport-input-wrapper";const y=document.createElement("label");y.textContent="Description",y.htmlFor="beeport-description-input",y.className="beeport-input-label";const v=document.createElement("textarea");v.id="beeport-description-input",v.className="beeport-input-description",v.placeholder="What happened? What did you expect instead? Include steps to reproduce.",v.maxLength=1e3,v.rows=5;const w=document.createElement("div");w.className="beeport-input-hint beeport-input-hint-description",w.textContent="Include context, expected result, and actual result (10+ characters).";const k=document.createElement("div");k.className="beeport-char-counter",k.textContent="0/1000 characters";const C=document.createElement("div");C.className="beeport-description-meta",C.appendChild(w),C.appendChild(k);const E=document.createElement("div");E.id="beeport-description-error",E.className="beeport-error-message",E.setAttribute("role","alert"),x.appendChild(y),x.appendChild(v),x.appendChild(C),x.appendChild(E);const S=document.createElement("div");S.className="beeport-status-message",S.setAttribute("aria-live","polite"),S.setAttribute("aria-atomic","true"),S.textContent="";const A=document.createElement("div");A.className="beeport-form-buttons";const N=document.createElement("button");N.className="beeport-cancel-button",N.textContent="Not now";const L=document.createElement("button");L.className="beeport-submit-button",L.textContent="Create Issue",A.appendChild(N),A.appendChild(L);const B=document.createElement("div");B.className="beeport-form-footer";const $=document.createElement("a");$.href="https://beeport.ai",$.target="_blank",$.rel="noopener noreferrer",$.className="beeport-footer-link";const P=document.createElement("span");P.className="beeport-footer-bee",P.textContent="🐝";const O=document.createElement("span");O.className="beeport-footer-text",O.textContent="Powered by ";const F=document.createElement("span");F.className="beeport-footer-brand",F.textContent="BeePort",$.appendChild(P),$.appendChild(O),$.appendChild(F),B.appendChild($),n.appendChild(o),n.appendChild(c),n.appendChild(l),n.appendChild(b),n.appendChild(x),n.appendChild(S),n.appendChild(A),n.appendChild(B);const T=document.createElement("style");T.textContent='\n /* Form Panel */\n .beeport-form-panel {\n position: absolute;\n bottom: 72px;\n right: 0;\n width: min(420px, calc(100vw - 24px));\n max-height: min(80vh, 680px);\n background:\n radial-gradient(circle at top left, rgba(250, 204, 21, 0.18), transparent 55%),\n var(--beeport-bg-primary);\n border: 1px solid rgba(245, 158, 11, 0.32);\n border-radius: 18px;\n box-shadow: 0 20px 44px rgba(17, 24, 39, 0.28), 0 6px 18px rgba(17, 24, 39, 0.16);\n padding: 0;\n color: var(--beeport-text-primary);\n font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;\n overflow: hidden;\n animation: beeport-form-enter 160ms cubic-bezier(0.22, 1, 0.36, 1);\n }\n\n /* Mobile responsive */\n @media (max-width: 500px) {\n .beeport-form-panel {\n right: 8px;\n bottom: 72px;\n width: calc(100vw - 16px);\n max-height: calc(100vh - 96px);\n border-radius: 14px;\n }\n }\n\n /* Header */\n .beeport-form-header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n padding: 18px 18px 14px;\n border-bottom: 1px solid rgba(245, 158, 11, 0.2);\n background: linear-gradient(180deg, rgba(250, 204, 21, 0.15) 0%, transparent 100%);\n }\n\n .beeport-form-heading {\n min-width: 0;\n flex: 1;\n }\n\n .beeport-form-title {\n margin: 0;\n font-size: 20px;\n font-weight: 700;\n color: var(--beeport-text-primary);\n line-height: 1.2;\n }\n\n .beeport-form-subtitle {\n margin: 6px 0 0;\n font-size: 12px;\n line-height: 1.4;\n color: var(--beeport-text-secondary);\n max-width: 32ch;\n }\n\n .beeport-form-close {\n background: var(--beeport-bg-secondary);\n border: 1px solid rgba(245, 158, 11, 0.3);\n font-size: 17px;\n line-height: 1;\n color: var(--beeport-text-primary);\n cursor: pointer;\n padding: 2px;\n width: 30px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n font-family: inherit;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-form-close:hover {\n border-color: #f59e0b;\n background: rgba(245, 158, 11, 0.18);\n transform: rotate(90deg);\n }\n\n .beeport-form-close:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-form-close:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-form-close:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-type-legend {\n margin: 12px 18px 8px;\n color: var(--beeport-text-secondary);\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.01em;\n }\n\n /* Type Selector */\n .beeport-type-selector {\n display: flex;\n gap: 8px;\n margin: 0 18px 14px;\n padding: 5px;\n min-height: 62px;\n border: 1px solid rgba(245, 158, 11, 0.28);\n border-radius: 12px;\n background: var(--beeport-bg-secondary);\n }\n\n .beeport-type-button {\n flex: 1;\n padding: 9px 10px;\n min-height: 52px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n border-radius: 9px;\n color: var(--beeport-text-secondary);\n font-size: 12px;\n font-weight: 700;\n font-family: inherit;\n letter-spacing: 0.01em;\n text-transform: none;\n cursor: pointer;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-type-button:last-child {\n border-right: 0;\n }\n\n .beeport-type-button:hover {\n background: rgba(245, 158, 11, 0.1);\n color: var(--beeport-text-primary);\n }\n\n .beeport-type-button.active {\n background: linear-gradient(135deg, #f59e0b, #facc15);\n color: #111827;\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);\n }\n\n .beeport-type-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: -2px;\n }\n\n .beeport-type-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-type-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: -2px;\n }\n\n /* Input Wrapper */\n .beeport-input-wrapper {\n position: relative;\n padding: 0 18px 14px;\n border-bottom: none;\n }\n\n /* Input Label */\n .beeport-input-label {\n display: block;\n margin-bottom: 6px;\n color: var(--beeport-text-secondary);\n font-size: 11px;\n font-weight: 600;\n font-family: inherit;\n letter-spacing: 0.01em;\n }\n\n /* Input and Textarea */\n .beeport-input-title,\n .beeport-input-description {\n width: 100%;\n padding: 10px 12px;\n background: var(--beeport-input-bg);\n border: 1px solid rgba(107, 114, 128, 0.45);\n border-radius: 11px;\n color: var(--beeport-text-primary);\n font-size: 14px;\n font-family: inherit;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n box-sizing: border-box;\n }\n\n .beeport-input-title::placeholder,\n .beeport-input-description::placeholder {\n color: var(--beeport-text-secondary);\n opacity: 0.8;\n }\n\n .beeport-input-title:focus,\n .beeport-input-description:focus {\n outline: none;\n border-color: #f59e0b;\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);\n }\n\n .beeport-input-title:focus:not(:focus-visible),\n .beeport-input-description:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-input-title:focus-visible,\n .beeport-input-description:focus-visible {\n outline: none;\n border-color: #f59e0b;\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);\n }\n\n .beeport-input-description {\n resize: vertical;\n min-height: 108px;\n max-height: 240px;\n }\n\n /* Error state */\n .beeport-input-title.error,\n .beeport-input-description.error {\n border-color: #dc2626;\n box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.16);\n }\n\n .beeport-input-hint {\n margin-top: 7px;\n font-size: 11px;\n color: var(--beeport-text-secondary);\n line-height: 1.3;\n }\n\n .beeport-error-message {\n color: #dc2626;\n font-size: 12px;\n margin-top: 6px;\n min-height: 16px;\n }\n\n /* Status Message (Live Region) */\n .beeport-status-message {\n margin: 0 18px 14px;\n padding: 8px 10px;\n border-radius: 10px;\n font-size: var(--beeport-font-size-sm);\n min-height: 0;\n }\n\n .beeport-status-message:empty {\n display: none;\n }\n\n .beeport-status-message.success {\n background-color: #d1fae5;\n color: #065f46;\n border: 1px solid #10b981;\n }\n\n .beeport-status-message.error {\n background-color: #fee2e2;\n color: #991b1b;\n border: 1px solid #dc2626;\n }\n\n .beeport-description-meta {\n margin-top: 7px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n }\n\n /* Character Counter */\n .beeport-char-counter {\n font-size: 11px;\n font-family: inherit;\n color: var(--beeport-text-secondary);\n opacity: 0.8;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transition: color var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-char-counter.warning {\n color: #b45309;\n }\n\n .beeport-char-counter.limit {\n color: #dc2626;\n font-weight: 700;\n }\n\n /* Form Buttons */\n .beeport-form-buttons {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n padding: 0 18px 16px;\n }\n\n .beeport-cancel-button,\n .beeport-submit-button {\n padding: 10px 16px;\n border-radius: 10px;\n font-size: 12px;\n font-weight: 700;\n font-family: inherit;\n letter-spacing: 0.02em;\n text-transform: none;\n cursor: pointer;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-cancel-button {\n background: transparent;\n border: 1px solid rgba(107, 114, 128, 0.45);\n color: var(--beeport-text-primary);\n }\n\n .beeport-cancel-button:hover {\n background: rgba(107, 114, 128, 0.1);\n color: var(--beeport-text-primary);\n border-color: rgba(107, 114, 128, 0.8);\n }\n\n .beeport-cancel-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-cancel-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-cancel-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-submit-button {\n background: linear-gradient(135deg, #f59e0b, #facc15);\n border: 1px solid #d97706;\n color: #ffffff;\n text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);\n }\n\n .beeport-submit-button:hover {\n transform: translateY(-1px);\n box-shadow: 0 8px 16px rgba(245, 158, 11, 0.34);\n }\n\n .beeport-submit-button:active {\n background: #f59e0b;\n border-color: #B45309;\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.28);\n transform: translateY(0);\n }\n\n .beeport-submit-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-submit-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-submit-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n /* Footer Branding */\n .beeport-form-footer {\n padding: 10px 16px 14px;\n text-align: center;\n background: linear-gradient(180deg, transparent 0%, rgba(245, 158, 11, 0.08) 100%);\n }\n\n .beeport-footer-link {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n text-decoration: none;\n color: var(--beeport-text-secondary);\n font-size: 11px;\n font-family: inherit;\n letter-spacing: 0.02em;\n transition: color var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-footer-link:hover {\n color: var(--beeport-text-primary);\n }\n\n .beeport-footer-link:hover .beeport-footer-brand {\n text-decoration: underline;\n }\n\n .beeport-footer-bee {\n font-size: 11px;\n line-height: 1;\n }\n\n .beeport-footer-text {\n opacity: 0.5;\n }\n\n .beeport-footer-brand {\n font-weight: 700;\n color: #F59E0B;\n letter-spacing: 0.02em;\n }\n\n @keyframes beeport-form-enter {\n from {\n opacity: 0;\n transform: translateY(8px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n }\n ',e.appendChild(T),e.appendChild(n);let R="bug",z=null;const G=e=>{R=e,[d,u].forEach(t=>{t.dataset.type===e?(t.classList.add("active"),t.setAttribute("aria-selected","true")):(t.classList.remove("active"),t.setAttribute("aria-selected","false"))})},j=()=>{t?.onCancel&&t.onCancel()},I=e=>{const t=e.target;"block"!==n.style.display||n.contains(t)||(n.style.display="none",V())},V=()=>{z&&(z.focus(),z=null)};return d.addEventListener("click",()=>G("bug")),u.addEventListener("click",()=>G("feature")),v.addEventListener("input",()=>{const e=v.value.length;k.textContent=`${e}/1000 characters`,k.classList.toggle("warning",e>=900&&e<1e3),k.classList.toggle("limit",e>=1e3)}),L.addEventListener("click",()=>{t?.onSubmit&&t.onSubmit()}),N.addEventListener("click",j),s.addEventListener("click",j),n.addEventListener("keydown",e=>{if("Escape"===e.key)return n.style.display="none",void V();if("Tab"===e.key){const t=(()=>{const e=n.querySelectorAll(["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(","));return Array.from(e)})();if(0===t.length)return;const r=t[0],o=t[t.length-1];e.shiftKey?document.activeElement===r&&o&&(e.preventDefault(),o.focus()):document.activeElement===o&&r&&(e.preventDefault(),r.focus())}}),e.addEventListener("click",I),{show(){z=document.activeElement,n.style.display="block",m.focus()},hide(){n.style.display="none",V()},reset(){m.value="",v.value="",R="bug",G("bug"),k.textContent="0/1000 characters",k.classList.remove("warning","limit"),m.classList.remove("error"),v.classList.remove("error"),m.removeAttribute("aria-invalid"),v.removeAttribute("aria-invalid"),m.removeAttribute("aria-describedby"),v.removeAttribute("aria-describedby"),g.textContent="",E.textContent=""},destroy(){e.removeEventListener("click",I),n.remove(),T.remove()},getValues:()=>({type:R,title:m.value,description:v.value}),validate:()=>(()=>{const e={},t=m.value.trim(),n=v.value.trim();return m.classList.remove("error"),v.classList.remove("error"),m.removeAttribute("aria-invalid"),v.removeAttribute("aria-invalid"),m.removeAttribute("aria-describedby"),v.removeAttribute("aria-describedby"),g.textContent="",E.textContent="",0===t.length?e.title="Title is required":t.length<3&&(e.title="Title must be at least 3 characters"),0===n.length?e.description="Description is required":n.length<10&&(e.description="Description must be at least 10 characters"),e.title&&(m.classList.add("error"),m.setAttribute("aria-invalid","true"),m.setAttribute("aria-describedby","beeport-title-error"),g.textContent=e.title),e.description&&(v.classList.add("error"),v.setAttribute("aria-invalid","true"),v.setAttribute("aria-describedby","beeport-description-error"),E.textContent=e.description),{valid:0===Object.keys(e).length,errors:e}})()}}function r(e,t,n){const r=document.createElement("button");return r.className="beeport-type-button",r.dataset.type=e,r.textContent=t,r.setAttribute("role","tab"),r.setAttribute("aria-selected",String(n)),r.setAttribute("aria-label",{bug:"Report a bug",feature:"Request a feature",question:"Ask a question"}[e]),n&&r.classList.add("active"),r}function o(e,t){try{return e()}catch{return t}}const i=["token","key","secret","password","auth","session","api_key","access_token"];function a(e){const t=function(e){try{const t=new URL(e),n=t.searchParams;return n.forEach((e,t)=>{const r=t.toLowerCase();i.some(e=>r.includes(e))&&n.set(t,"[REDACTED]")}),decodeURIComponent(t.toString())}catch{return e}}(e.url),n=e.cookiesEnabled?"Enabled":"Disabled";return`## Environment\n- **URL**: ${t}\n- **Browser**: ${e.browser.name} ${e.browser.version}\n- **OS**: ${e.os.name} ${e.os.version}\n- **Viewport**: ${e.viewport.width}x${e.viewport.height}\n- **Screen**: ${e.screen.width}x${e.screen.height} @${e.screen.pixelRatio}x\n- **Language**: ${e.language}\n- **Cookies**: ${n}\n- **Timestamp**: ${e.timestamp}`}function s(e){if(!e||0===e.length)return"No errors captured";const t=function(e){const t=new Map;for(const n of e){const e=t.get(n.message);e?(e.count++,e.errors.push(n)):t.set(n.message,{errors:[n],count:1})}return t}(e),n=[];let r=1;return t.forEach(e=>{const t=e.errors[0];if(!t)return;const o=function(e){const t=["TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError"];for(const n of t)if(e.startsWith(n))return n;return"Error"}(t.message),i=[`### Error ${r}`,`**Type**: ${o}`,`**Message**: ${t.message}`];if(e.count>1&&i.push(`**Occurrences**: (occurred ${e.count} times)`),t.stack){const e=function(e,t=20){const n=e.split("\n");if(n.length<=t)return e;const r=n.slice(0,t),o=n.length-t;return r.push(`... (${o} more lines)`),r.join("\n")}(t.stack);i.push(`**Stack trace**:\n\`\`\`\n${e}\n\`\`\``)}i.push(`**Timestamp**: ${t.timestamp}`),n.push(i.join("\n")),r++}),n.join("\n\n")}class p extends Error{constructor(e,t,n){super(e),this.status=t,this.response=n,this.name="GitHubError"}}class c extends p{constructor(e,t,n){super(e,t,n),this.name="GitHubAuthError"}}class l extends p{constructor(e,t,n){super(e,t,n),this.name="GitHubNotFoundError"}}class d extends p{constructor(e,t,n){super(e,t,n),this.name="GitHubValidationError"}}class u extends p{constructor(e,t,n,r){super(e,t,n),this.rateLimit=r,this.name="GitHubRateLimitError"}}class b extends p{constructor(e,t){super(e),this.cause=t,this.name="GitHubNetworkError"}}async function h(e){const{token:t,owner:n,repo:r,title:o,body:i,labels:a}=e,s=`https://api.github.com/repos/${n}/${r}/issues`,h={title:o,body:i};let m;a&&a.length>0&&(h.labels=a);try{m=await fetch(s,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","Content-Type":"application/json"},body:JSON.stringify(h)})}catch(g){throw new b("Network request failed",g instanceof Error?g:void 0)}if(!m.ok){let e;try{e=await m.json()}catch{e={}}const t=e.message||`HTTP ${m.status}`;switch(m.status){case 401:case 403:throw new c(t,m.status,e);case 404:throw new l(t,m.status,e);case 422:throw new d(t,m.status,e);case 429:{const n={limit:parseInt(m.headers.get("X-RateLimit-Limit")||"0",10),remaining:parseInt(m.headers.get("X-RateLimit-Remaining")||"0",10),reset:parseInt(m.headers.get("X-RateLimit-Reset")||"0",10)};throw new u(t,m.status,e,n)}default:throw new p(t,m.status,e)}}const f=await m.json();return{url:f.html_url,number:f.number,id:f.id}}function m(e,t){const n=e.toLowerCase().trim(),r=t.toLowerCase().trim();if(0===n.length&&0===r.length)return 1;if(0===n.length||0===r.length)return 0;const o=function(e,t){if(0===e.length)return t.length;if(0===t.length)return e.length;const n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++)t.charAt(r-1)===e.charAt(o-1)?n[r][o]=n[r-1][o-1]:n[r][o]=Math.min(n[r-1][o-1]+1,n[r][o-1]+1,n[r-1][o]+1);return n[t.length][e.length]}(n,r);return 1-o/Math.max(n.length,r.length)}function f(e){return e instanceof c?"Authentication failed. Check your GitHub token.":e instanceof l?"Repository not found. Check the repo setting.":e instanceof u?"Rate limit exceeded. Please try again later.":e instanceof d?"Invalid issue data. Please check your input.":e instanceof b?"Network error. Check your connection.":e instanceof Error?e.message:"An unknown error occurred."}async function g(e){const{config:t,formValues:n,errors:r}=e;try{const e={url:o(()=>window.location.href,"unknown"),viewport:o(()=>({width:window.innerWidth,height:window.innerHeight}),{width:0,height:0}),screen:o(()=>({width:window.screen.width,height:window.screen.height,pixelRatio:window.devicePixelRatio}),{width:0,height:0,pixelRatio:1}),browser:o(()=>{const e=navigator.userAgentData;if(e?.brands){const t=e.brands;for(const e of t){const t=e.brand.toLowerCase();if(t.includes("chrome")&&!t.includes("chromium"))return{name:"Chrome",version:e.version};if(t.includes("edge"))return{name:"Edge",version:e.version};if(t.includes("opera"))return{name:"Opera",version:e.version}}}return function(e){if(/Edg\//.test(e)){const t=e.match(/Edg\/([\d.]+)/);return{name:"Edge",version:t?.[1]||"unknown"}}if(/OPR\//.test(e)){const t=e.match(/OPR\/([\d.]+)/);return{name:"Opera",version:t?.[1]||"unknown"}}if(/Chrome\//.test(e)&&!/Edg\//.test(e)){const t=e.match(/Chrome\/([\d.]+)/);return{name:"Chrome",version:t?.[1]||"unknown"}}if(/Firefox\//.test(e)){const t=e.match(/Firefox\/([\d.]+)/);return{name:"Firefox",version:t?.[1]||"unknown"}}if(/Safari\//.test(e)&&!/Chrome\//.test(e)){const t=e.match(/Version\/([\d.]+)/);return{name:"Safari",version:t?.[1]||"unknown"}}return{name:"Unknown",version:"unknown"}}(navigator.userAgent)},{name:"Unknown",version:"unknown"}),os:o(()=>function(e){if(/iPhone|iPad|iPod/.test(e)){const t=e.match(/OS ([\d_]+)/);return{name:"iOS",version:t?.[1]?.replace(/_/g,".")||"unknown"}}if(/Windows NT/.test(e)){const t=e.match(/Windows NT ([\d.]+)/),n=t?.[1]||"unknown";return{name:"Windows",version:{"10.0":"10",6.3:"8.1",6.2:"8",6.1:"7"}[n]||n}}if(/Mac OS X/.test(e)){const t=e.match(/Mac OS X ([\d_]+)/);return{name:"macOS",version:t?.[1]?.replace(/_/g,".")||"unknown"}}if(/Android/.test(e)){const t=e.match(/Android ([\d.]+)/);return{name:"Android",version:t?.[1]||"unknown"}}return/Linux/.test(e)?{name:"Linux",version:"unknown"}:{name:"Unknown",version:"unknown"}}(navigator.userAgent),{name:"Unknown",version:"unknown"}),timestamp:(new Date).toISOString(),language:o(()=>navigator.language,"unknown"),cookiesEnabled:o(()=>navigator.cookieEnabled,!1),doNotTrack:o(()=>navigator.doNotTrack,null)},c=function(e,t){return`${{bug:"[Bug]",feature:"[Feature]",question:"[Question]"}[e]} ${t}`}(n.type,n.title),l=function(e){switch(e.type){case"bug":return function(e){return[`## Summary\n${e.description}`,"## Steps to Reproduce\nNot provided","## Expected Behavior\nNot provided","## Actual Behavior\nNot provided",a(e.context),`## Console Errors\n${s(e.errors)}`].join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);case"feature":return function(e){return[`## Summary\n${e.description}`,"## Use Case\nNot provided","## Proposed Solution\nNot provided",a(e.context)].join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);case"question":return function(e){return[`## Question\n${e.description}`,"## Context\nNot provided",a(e.context)].join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);default:throw new Error(`Unknown feedback type: ${e.type}`)}}({type:n.type,title:n.title,description:n.description,context:e,errors:r}),d=["bug"===(i=n.type)?"bug":"feature"===i?"enhancement":"question","beeport","agent-ready"];if(t.endpoint)return async function(e,t){let n;try{n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{return{status:"error",error:"Network error. Check your connection."}}if(!n.ok){const e=await n.json().catch(()=>({}));return{status:"error",error:"string"==typeof e.error?e.error:400===(r=n.status)?"Invalid issue data. Please check your input.":429===r?"Rate limit exceeded. Please try again later.":502===r||503===r?"Service temporarily unavailable. Please try again.":"An unexpected error occurred."}}var r;const o=await n.json();return{status:"success",issueUrl:o.issueUrl,issueNumber:o.issueNumber}}(t.endpoint,{title:c,body:l,labels:d});const{owner:u,repo:b}=function(e){const t=e.split("/");return{owner:t[0]||"",repo:t.slice(1).join("/")}}(t.repo);let f=[];try{f=await async function(e){const{token:t,owner:n,repo:r,title:o}=e;try{const e=`https://api.github.com/repos/${n}/${r}/issues?labels=beeport&state=open`,i=await fetch(e,{method:"GET",headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).map(e=>({number:e.number,title:e.title,url:e.html_url,similarity:m(o,e.title),state:e.state})).filter(e=>e.similarity>.7).sort((e,t)=>t.similarity-e.similarity).slice(0,5):(console.warn(`GitHub API error: ${i.status} ${i.statusText}`),[])}catch(i){return console.warn("Failed to search for duplicate issues:",i),[]}}({token:t.token,owner:u,repo:b,title:c})}catch(p){console.warn("Duplicate search failed, proceeding with submission:",p)}if(f.length>0)return{status:"duplicates_found",candidates:f,pendingSubmission:{title:c,body:l,labels:d,owner:u,repo:b,token:t.token}};const g=await h({token:t.token,owner:u,repo:b,title:c,body:l,labels:d});return{status:"success",issueUrl:g.url,issueNumber:g.number}}catch(p){return{status:"error",error:f(p)}}var i}const x=Object.freeze(Object.defineProperty({__proto__:null,confirmSubmit:async function(e){try{const t=await h({token:e.token,owner:e.owner,repo:e.repo,title:e.title,body:e.body,labels:e.labels});return{status:"success",issueUrl:t.url,issueNumber:t.number}}catch(t){return{status:"error",error:f(t)}}},submitFeedback:g},Symbol.toStringTag,{value:"Module"}));class y{constructor(e){this.isOpen=!1,this.themeCleanup=null,this.config=e,this.hostElement=document.createElement("div"),this.hostElement.setAttribute("data-beeport-container",""),this.shadowRoot=this.hostElement.attachShadow({mode:"open"}),this.container=document.createElement("div"),this.container.className="beeport-container",this.container.setAttribute("data-open","false"),this.applyPosition(e.position??"bottom-right");const r=document.createElement("style");r.textContent='\n /* CSS Custom Properties (theme variables) */\n :host {\n --beeport-z-index: 999999;\n --beeport-spacing-sm: 8px;\n --beeport-spacing-md: 16px;\n --beeport-spacing-lg: 24px;\n --beeport-border-radius: 8px;\n --beeport-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n\n /* Typography */\n --beeport-font-size-sm: 12px;\n --beeport-font-size-md: 14px;\n --beeport-font-size-lg: 16px;\n --beeport-font-weight-normal: 400;\n --beeport-font-weight-medium: 500;\n --beeport-font-weight-bold: 600;\n\n /* Transitions */\n --beeport-transition-speed: 200ms;\n --beeport-transition-easing: ease-in-out;\n }\n\n /* Light theme colors */\n .beeport-container[data-theme="light"] {\n /* Base colors */\n --beeport-bg-primary: #ffffff;\n --beeport-bg-secondary: #f5f5f5;\n --beeport-text-primary: #1f2937;\n --beeport-text-secondary: #6b7280;\n --beeport-border-color: #d1d5db;\n --beeport-accent: #2563eb;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #1d4ed8;\n --beeport-button-primary-active: #1e40af;\n --beeport-button-disabled-bg: #e5e7eb;\n --beeport-button-disabled-text: #4b5563;\n\n /* Input states */\n --beeport-input-bg: #ffffff;\n --beeport-input-border: #9ca3af;\n --beeport-input-focus-border: #2563eb;\n\n /* Status colors */\n --beeport-success: #047857;\n --beeport-error: #dc2626;\n --beeport-warning: #b45309;\n }\n\n /* Dark theme colors */\n .beeport-container[data-theme="dark"] {\n /* Base colors */\n --beeport-bg-primary: #1f2937;\n --beeport-bg-secondary: #111827;\n --beeport-text-primary: #f9fafb;\n --beeport-text-secondary: #9ca3af;\n --beeport-border-color: #6b7280;\n --beeport-accent: #60a5fa;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #2563eb;\n --beeport-button-primary-active: #1d4ed8;\n --beeport-button-disabled-bg: #374151;\n --beeport-button-disabled-text: #d1d5db;\n\n /* Input states */\n --beeport-input-bg: #111827;\n --beeport-input-border: #6b7280;\n --beeport-input-focus-border: #60a5fa;\n\n /* Status colors */\n --beeport-success: #34d399;\n --beeport-error: #f87171;\n --beeport-warning: #fbbf24;\n }\n\n /* Auto theme - respect system preference */\n .beeport-container[data-theme="auto"] {\n /* Base colors */\n --beeport-bg-primary: #ffffff;\n --beeport-bg-secondary: #f5f5f5;\n --beeport-text-primary: #1f2937;\n --beeport-text-secondary: #6b7280;\n --beeport-border-color: #d1d5db;\n --beeport-accent: #2563eb;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #1d4ed8;\n --beeport-button-primary-active: #1e40af;\n --beeport-button-disabled-bg: #e5e7eb;\n --beeport-button-disabled-text: #4b5563;\n\n /* Input states */\n --beeport-input-bg: #ffffff;\n --beeport-input-border: #9ca3af;\n --beeport-input-focus-border: #2563eb;\n\n /* Status colors */\n --beeport-success: #047857;\n --beeport-error: #dc2626;\n --beeport-warning: #b45309;\n }\n\n @media (prefers-color-scheme: dark) {\n .beeport-container[data-theme="auto"] {\n /* Base colors */\n --beeport-bg-primary: #1f2937;\n --beeport-bg-secondary: #111827;\n --beeport-text-primary: #f9fafb;\n --beeport-text-secondary: #9ca3af;\n --beeport-border-color: #6b7280;\n --beeport-accent: #60a5fa;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #2563eb;\n --beeport-button-primary-active: #1d4ed8;\n --beeport-button-disabled-bg: #374151;\n --beeport-button-disabled-text: #d1d5db;\n\n /* Input states */\n --beeport-input-bg: #111827;\n --beeport-input-border: #6b7280;\n --beeport-input-focus-border: #60a5fa;\n\n /* Status colors */\n --beeport-success: #34d399;\n --beeport-error: #f87171;\n --beeport-warning: #fbbf24;\n }\n }\n\n /* Container base styles */\n .beeport-container {\n position: fixed;\n z-index: var(--beeport-z-index);\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n font-size: 14px;\n line-height: 1.5;\n box-sizing: border-box;\n }\n\n .beeport-container *,\n .beeport-container *::before,\n .beeport-container *::after {\n box-sizing: border-box;\n }\n\n /* Reset button styles for future components */\n .beeport-container button {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n cursor: pointer;\n }\n\n /* Feedback button - floating action button */\n .beeport-feedback-button {\n position: relative;\n width: 56px;\n height: 56px;\n border-radius: 50%;\n background: linear-gradient(135deg, #FFC107 0%, #F59E0B 50%, #D97706 100%);\n color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n border: none;\n cursor: pointer;\n outline: none;\n }\n\n .beeport-feedback-button:hover {\n background: linear-gradient(135deg, #FFD54F 0%, #FFC107 50%, #F59E0B 100%);\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);\n }\n\n .beeport-feedback-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-feedback-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-feedback-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-feedback-button:active {\n background: linear-gradient(135deg, #F59E0B 0%, #D97706 50%, #B45309 100%);\n transform: translateY(0);\n }\n\n .beeport-feedback-button svg {\n width: 28px;\n height: 28px;\n pointer-events: none;\n filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));\n }\n ',this.shadowRoot.appendChild(r),this.shadowRoot.appendChild(this.container),this.feedbackButton=this.createFeedbackButton(),this.container.appendChild(this.feedbackButton),this.form=n(this.container,{onSubmit:()=>{this.handleSubmit()},onCancel:()=>{this.isOpen&&this.toggleOpen()}}),document.body.appendChild(this.hostElement),this.themeCleanup=t(this.container,e.theme??"auto")}applyPosition(e){this.container.style.position="fixed",this.container.style.bottom="20px","bottom-right"===e?this.container.style.right="20px":this.container.style.left="20px"}createFeedbackButton(){const e=document.createElement("button");return e.className="beeport-feedback-button",e.setAttribute("aria-label","Send feedback"),e.setAttribute("aria-expanded","false"),e.setAttribute("tabindex","0"),this.updateButtonIcon(e,!1),e.addEventListener("click",e=>{e.stopPropagation(),this.toggleOpen()}),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggleOpen())}),e}async handleSubmit(){if(!this.form.validate().valid)return;const e=this.form.getValues(),t=await g({config:this.config,formValues:e});if("success"===t.status)this.form.reset(),this.toggleOpen(),console.log(`[BeePort] Issue created: ${t.issueUrl}`);else if("duplicates_found"===t.status){console.log("[BeePort] Potential duplicates found, submitting anyway");const{confirmSubmit:e}=await Promise.resolve().then(()=>x),n=await e(t.pendingSubmission);"success"===n.status?(this.form.reset(),this.toggleOpen(),console.log(`[BeePort] Issue created: ${n.issueUrl}`)):"error"===n.status&&console.error(`[BeePort] Submit failed: ${n.error}`)}else"error"===t.status&&console.error(`[BeePort] Submit failed: ${t.error}`)}toggleOpen(){this.isOpen=!this.isOpen,this.container.setAttribute("data-open",String(this.isOpen)),this.feedbackButton.setAttribute("aria-expanded",String(this.isOpen)),this.updateButtonIcon(this.feedbackButton,this.isOpen),this.isOpen?this.form.show():this.form.hide();const e=new CustomEvent("beeport:toggle",{detail:{open:this.isOpen},bubbles:!0,composed:!0});this.hostElement.dispatchEvent(e)}updateButtonIcon(e,t){if(e.textContent="",t){const t=this.createSVGElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"}),n=this.createSVGElement("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"});t.appendChild(n),e.appendChild(t)}else{const t=this.createSVGElement("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none"}),n=this.createSVGElement("ellipse",{cx:"14",cy:"15",rx:"6",ry:"7.5",fill:"#FFC107",stroke:"currentColor","stroke-width":"1.5"}),r=this.createSVGElement("path",{d:"M8.5 13.5 Q14 12 19.5 13.5",stroke:"#1a1a1a","stroke-width":"1.8","stroke-linecap":"round",fill:"none"}),o=this.createSVGElement("path",{d:"M8.2 16.5 Q14 15 19.8 16.5",stroke:"#1a1a1a","stroke-width":"1.8","stroke-linecap":"round",fill:"none"}),i=this.createSVGElement("ellipse",{cx:"9.5",cy:"9",rx:"3.5",ry:"4",fill:"rgba(255,255,255,0.7)",stroke:"currentColor","stroke-width":"1",transform:"rotate(-15 9.5 9)"}),a=this.createSVGElement("ellipse",{cx:"18.5",cy:"9",rx:"3.5",ry:"4",fill:"rgba(255,255,255,0.7)",stroke:"currentColor","stroke-width":"1",transform:"rotate(15 18.5 9)"}),s=this.createSVGElement("circle",{cx:"14",cy:"7.5",r:"3",fill:"#1a1a1a"}),p=this.createSVGElement("circle",{cx:"12.8",cy:"7",r:"0.8",fill:"white"}),c=this.createSVGElement("circle",{cx:"15.2",cy:"7",r:"0.8",fill:"white"}),l=this.createSVGElement("path",{d:"M12.5 5 Q11 2.5 9.5 2",stroke:"#1a1a1a","stroke-width":"1.2","stroke-linecap":"round",fill:"none"}),d=this.createSVGElement("path",{d:"M15.5 5 Q17 2.5 18.5 2",stroke:"#1a1a1a","stroke-width":"1.2","stroke-linecap":"round",fill:"none"}),u=this.createSVGElement("circle",{cx:"9.3",cy:"1.8",r:"1",fill:"#FFC107"}),b=this.createSVGElement("circle",{cx:"18.7",cy:"1.8",r:"1",fill:"#FFC107"}),h=this.createSVGElement("path",{d:"M14 22.5 L14 24.5",stroke:"#1a1a1a","stroke-width":"1.5","stroke-linecap":"round"});t.appendChild(i),t.appendChild(a),t.appendChild(n),t.appendChild(r),t.appendChild(o),t.appendChild(s),t.appendChild(p),t.appendChild(c),t.appendChild(l),t.appendChild(d),t.appendChild(u),t.appendChild(b),t.appendChild(h),e.appendChild(t)}}createSVGElement(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg",e);for(const[r,o]of Object.entries(t))n.setAttribute(r,o);return n}show(){this.hostElement.style.display=""}hide(){this.hostElement.style.display="none"}destroy(){this.form.destroy(),this.themeCleanup&&(this.themeCleanup(),this.themeCleanup=null),this.hostElement.parentNode&&this.hostElement.parentNode.removeChild(this.hostElement)}setTheme(e){this.themeCleanup&&this.themeCleanup(),this.themeCleanup=t(this.container,e)}getContainer(){return this.container}}let v=null,w=null;e.destroy=function(){v&&(v.destroy(),v=null,w=null)},e.init=function(e){if(function(e){const t=e.endpoint&&""!==e.endpoint.trim(),n=e.token&&""!==e.token.trim();if(t&&n)throw new Error("Cannot use both endpoint and token. Choose one mode.");if(!t){if(!e.repo)throw new Error("repo is required (or use endpoint for proxy mode)");if(!e.repo.includes("/")||2!==e.repo.split("/").length)throw new Error('repo must be in format "owner/repo"');if(!n)throw new Error("token is required (or use endpoint for proxy mode)")}}(e),v&&w)return w;const t={...e,position:e.position??"bottom-right",theme:e.theme??"auto"};var n;return v=new y(t),n=v,w={show:()=>n.show(),hide:()=>n.hide(),destroy:()=>{n.destroy(),v=null,w=null},setTheme:e=>n.setTheme(e)},w},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BeePort={})}(this,function(e){"use strict";function t(e,t){if(e.setAttribute("data-theme",t),"auto"!==t)return()=>{};if("undefined"==typeof window||!window.matchMedia)return()=>{};const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{};n.addEventListener("change",r);let o=!1;return()=>{o||(n.removeEventListener("change",r),o=!0)}}const n=["image/png","image/jpeg","image/webp"],r=1920;function o(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function i(e){return new Promise(t=>{const n=new Image;n.onload=()=>{if(n.width<=r&&n.height<=r)return void t(e);const o=r/Math.max(n.width,n.height),i=document.createElement("canvas");i.width=Math.round(n.width*o),i.height=Math.round(n.height*o),i.getContext("2d").drawImage(n,0,0,i.width,i.height),t(i.toDataURL("image/jpeg",.85))},n.onerror=()=>t(e),n.src=e})}function a(e,t,r){const a=document.createElement("div");a.className="beeport-form-panel",a.style.display="none",a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true");const p=document.createElement("div");p.className="beeport-form-header";const c=document.createElement("h3");c.className="beeport-form-title",c.id="beeport-form-title",c.textContent="Report to BeePort";const l=document.createElement("p");l.className="beeport-form-subtitle",l.textContent="Help us fix bugs and shape features in under a minute.",a.setAttribute("aria-labelledby","beeport-form-title");const d=document.createElement("button");d.className="beeport-form-close",d.textContent="×",d.setAttribute("aria-label","Close");const u=document.createElement("div");u.className="beeport-form-heading",u.appendChild(c),u.appendChild(l),p.appendChild(u),p.appendChild(d);const b=document.createElement("p");b.className="beeport-type-legend",b.textContent="What are you sharing?";const h=document.createElement("div");h.className="beeport-type-selector",h.setAttribute("role","tablist"),h.setAttribute("aria-label","Select feedback type");const m=s("bug","Bug report",!0),f=s("feature","Feature idea",!1);h.appendChild(m),h.appendChild(f);const g=document.createElement("div");g.className="beeport-input-wrapper";const x=document.createElement("label");x.textContent="Title",x.htmlFor="beeport-title-input",x.className="beeport-input-label";const v=document.createElement("input");v.type="text",v.id="beeport-title-input",v.className="beeport-input-title",v.placeholder="Example: Save button does nothing on Safari";const y=document.createElement("div");y.className="beeport-input-hint beeport-input-hint-title",y.textContent="Use a short summary (3+ characters).";const w=document.createElement("div");w.id="beeport-title-error",w.className="beeport-error-message",w.setAttribute("role","alert"),g.appendChild(x),g.appendChild(v),g.appendChild(y),g.appendChild(w);const k=document.createElement("div");k.className="beeport-input-wrapper";const E=document.createElement("label");E.textContent="Description",E.htmlFor="beeport-description-input",E.className="beeport-input-label";const C=document.createElement("textarea");C.id="beeport-description-input",C.className="beeport-input-description",C.placeholder="What happened? What did you expect instead? Include steps to reproduce.",C.maxLength=1e3,C.rows=5;const S=document.createElement("div");S.className="beeport-input-hint beeport-input-hint-description",S.textContent="Include context, expected result, and actual result (10+ characters).";const A=document.createElement("div");A.className="beeport-char-counter",A.textContent="0/1000 characters";const N=document.createElement("div");N.className="beeport-description-meta",N.appendChild(S),N.appendChild(A);const L=document.createElement("div");L.id="beeport-description-error",L.className="beeport-error-message",L.setAttribute("role","alert"),k.appendChild(E),k.appendChild(C),k.appendChild(N),k.appendChild(L);const $=document.createElement("div");$.className="beeport-status-message",$.setAttribute("aria-live","polite"),$.setAttribute("aria-atomic","true"),$.textContent="";const z=document.createElement("div");z.className="beeport-form-buttons";const B=document.createElement("button");B.className="beeport-cancel-button",B.textContent="Not now";const P=document.createElement("button");P.className="beeport-submit-button",P.textContent="Create Issue",z.appendChild(B),z.appendChild(P);const F=document.createElement("div");F.className="beeport-form-footer";const O=document.createElement("a");O.href="https://beeport.ai",O.target="_blank",O.rel="noopener noreferrer",O.className="beeport-footer-link";const T=document.createElement("span");T.className="beeport-footer-bee",T.textContent="🐝";const j=document.createElement("span");j.className="beeport-footer-text",j.textContent="Powered by ";const R=document.createElement("span");R.className="beeport-footer-brand",R.textContent="BeePort",O.appendChild(T),O.appendChild(j),O.appendChild(R),F.appendChild(O),a.appendChild(p),a.appendChild(b),a.appendChild(h),a.appendChild(g),a.appendChild(k),a.appendChild($),a.appendChild(z),a.appendChild(F);const G=document.createElement("style");G.textContent='\n /* Form Panel */\n .beeport-form-panel {\n position: absolute;\n bottom: 72px;\n right: 0;\n width: min(420px, calc(100vw - 24px));\n max-height: min(80vh, 680px);\n background:\n radial-gradient(circle at top left, rgba(250, 204, 21, 0.18), transparent 55%),\n var(--beeport-bg-primary);\n border: 1px solid rgba(245, 158, 11, 0.32);\n border-radius: 18px;\n box-shadow: 0 20px 44px rgba(17, 24, 39, 0.28), 0 6px 18px rgba(17, 24, 39, 0.16);\n padding: 0;\n color: var(--beeport-text-primary);\n font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;\n overflow-y: auto;\n overflow-x: hidden;\n animation: beeport-form-enter 160ms cubic-bezier(0.22, 1, 0.36, 1);\n }\n\n /* Scrollbar styling */\n .beeport-form-panel::-webkit-scrollbar {\n width: 6px;\n }\n .beeport-form-panel::-webkit-scrollbar-track {\n background: transparent;\n }\n .beeport-form-panel::-webkit-scrollbar-thumb {\n background: rgba(107, 114, 128, 0.3);\n border-radius: 3px;\n }\n .beeport-form-panel::-webkit-scrollbar-thumb:hover {\n background: rgba(107, 114, 128, 0.5);\n }\n\n /* Mobile responsive */\n @media (max-width: 500px) {\n .beeport-form-panel {\n right: 8px;\n bottom: 72px;\n width: calc(100vw - 16px);\n max-height: calc(100vh - 96px);\n border-radius: 14px;\n }\n }\n\n /* Header */\n .beeport-form-header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n padding: 18px 18px 14px;\n border-bottom: 1px solid rgba(245, 158, 11, 0.2);\n background: linear-gradient(180deg, rgba(250, 204, 21, 0.15) 0%, transparent 100%);\n }\n\n .beeport-form-heading {\n min-width: 0;\n flex: 1;\n }\n\n .beeport-form-title {\n margin: 0;\n font-size: 20px;\n font-weight: 700;\n color: var(--beeport-text-primary);\n line-height: 1.2;\n }\n\n .beeport-form-subtitle {\n margin: 6px 0 0;\n font-size: 12px;\n line-height: 1.4;\n color: var(--beeport-text-secondary);\n max-width: 32ch;\n }\n\n .beeport-form-close {\n background: var(--beeport-bg-secondary);\n border: 1px solid rgba(245, 158, 11, 0.3);\n font-size: 17px;\n line-height: 1;\n color: var(--beeport-text-primary);\n cursor: pointer;\n padding: 2px;\n width: 30px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n font-family: inherit;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-form-close:hover {\n border-color: #f59e0b;\n background: rgba(245, 158, 11, 0.18);\n transform: rotate(90deg);\n }\n\n .beeport-form-close:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-form-close:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-form-close:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-type-legend {\n margin: 12px 18px 8px;\n color: var(--beeport-text-secondary);\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.01em;\n }\n\n /* Type Selector */\n .beeport-type-selector {\n display: flex;\n gap: 8px;\n margin: 0 18px 14px;\n padding: 5px;\n min-height: 62px;\n border: 1px solid rgba(245, 158, 11, 0.28);\n border-radius: 12px;\n background: var(--beeport-bg-secondary);\n }\n\n .beeport-type-button {\n flex: 1;\n padding: 9px 10px;\n min-height: 52px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n border-radius: 9px;\n color: var(--beeport-text-secondary);\n font-size: 12px;\n font-weight: 700;\n font-family: inherit;\n letter-spacing: 0.01em;\n text-transform: none;\n cursor: pointer;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-type-button:last-child {\n border-right: 0;\n }\n\n .beeport-type-button:hover {\n background: rgba(245, 158, 11, 0.1);\n color: var(--beeport-text-primary);\n }\n\n .beeport-type-button.active {\n background: linear-gradient(135deg, #f59e0b, #facc15);\n color: #111827;\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);\n }\n\n .beeport-type-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: -2px;\n }\n\n .beeport-type-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-type-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: -2px;\n }\n\n /* Input Wrapper */\n .beeport-input-wrapper {\n position: relative;\n padding: 0 18px 14px;\n border-bottom: none;\n }\n\n /* Input Label */\n .beeport-input-label {\n display: block;\n margin-bottom: 6px;\n color: var(--beeport-text-secondary);\n font-size: 11px;\n font-weight: 600;\n font-family: inherit;\n letter-spacing: 0.01em;\n }\n\n /* Input and Textarea */\n .beeport-input-title,\n .beeport-input-description {\n width: 100%;\n padding: 10px 12px;\n background: var(--beeport-input-bg);\n border: 1px solid rgba(107, 114, 128, 0.45);\n border-radius: 11px;\n color: var(--beeport-text-primary);\n font-size: 14px;\n font-family: inherit;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n box-sizing: border-box;\n }\n\n .beeport-input-title::placeholder,\n .beeport-input-description::placeholder {\n color: var(--beeport-text-secondary);\n opacity: 0.8;\n }\n\n .beeport-input-title:focus,\n .beeport-input-description:focus {\n outline: none;\n border-color: #f59e0b;\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);\n }\n\n .beeport-input-title:focus:not(:focus-visible),\n .beeport-input-description:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-input-title:focus-visible,\n .beeport-input-description:focus-visible {\n outline: none;\n border-color: #f59e0b;\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);\n }\n\n .beeport-input-description {\n resize: vertical;\n min-height: 108px;\n max-height: 240px;\n }\n\n /* Error state */\n .beeport-input-title.error,\n .beeport-input-description.error {\n border-color: #dc2626;\n box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.16);\n }\n\n .beeport-input-hint {\n margin-top: 7px;\n font-size: 11px;\n color: var(--beeport-text-secondary);\n line-height: 1.3;\n }\n\n .beeport-error-message {\n color: #dc2626;\n font-size: 12px;\n margin-top: 6px;\n min-height: 16px;\n }\n\n /* Status Message (Live Region) */\n .beeport-status-message {\n margin: 0 18px 14px;\n padding: 8px 10px;\n border-radius: 10px;\n font-size: var(--beeport-font-size-sm);\n min-height: 0;\n }\n\n .beeport-status-message:empty {\n display: none;\n }\n\n .beeport-status-message.success {\n background-color: #d1fae5;\n color: #065f46;\n border: 1px solid #10b981;\n }\n\n .beeport-status-message.error {\n background-color: #fee2e2;\n color: #991b1b;\n border: 1px solid #dc2626;\n }\n\n .beeport-description-meta {\n margin-top: 7px;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 8px;\n }\n\n .beeport-description-meta .beeport-input-hint {\n flex: 1;\n min-width: 0;\n }\n\n /* Character Counter */\n .beeport-char-counter {\n font-size: 11px;\n font-family: inherit;\n color: var(--beeport-text-secondary);\n opacity: 0.8;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transition: color var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-char-counter.warning {\n color: #b45309;\n }\n\n .beeport-char-counter.limit {\n color: #dc2626;\n font-weight: 700;\n }\n\n /* Form Buttons */\n .beeport-form-buttons {\n display: flex;\n gap: 10px;\n padding: 4px 18px 18px;\n }\n\n .beeport-form-buttons .beeport-cancel-button,\n .beeport-form-buttons .beeport-submit-button {\n flex: 1;\n }\n\n .beeport-cancel-button,\n .beeport-submit-button {\n padding: 12px 32px;\n min-height: 48px;\n border-radius: 12px;\n font-size: 14px;\n font-weight: 700;\n font-family: inherit;\n letter-spacing: 0.02em;\n text-transform: none;\n cursor: pointer;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-cancel-button {\n background: transparent;\n border: 1px solid rgba(107, 114, 128, 0.45);\n color: var(--beeport-text-primary);\n }\n\n .beeport-cancel-button:hover {\n background: rgba(107, 114, 128, 0.1);\n color: var(--beeport-text-primary);\n border-color: rgba(107, 114, 128, 0.8);\n }\n\n .beeport-cancel-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-cancel-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-cancel-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-submit-button {\n background: #ffffff;\n border: 1px solid #d97706;\n color: #b45309;\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.18);\n }\n\n .beeport-submit-button:hover {\n background: linear-gradient(135deg, #f59e0b, #facc15);\n color: #ffffff;\n text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);\n box-shadow: 0 8px 16px rgba(245, 158, 11, 0.34);\n transform: translateY(-1px);\n }\n\n .beeport-submit-button:active {\n background: #f59e0b;\n color: #ffffff;\n text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);\n border-color: #B45309;\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.28);\n transform: translateY(0);\n }\n\n .beeport-submit-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-submit-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-submit-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n /* Footer Branding */\n .beeport-form-footer {\n padding: 10px 16px 14px;\n text-align: center;\n background: linear-gradient(180deg, transparent 0%, rgba(245, 158, 11, 0.08) 100%);\n }\n\n .beeport-footer-link {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n text-decoration: none;\n color: var(--beeport-text-secondary);\n font-size: 11px;\n font-family: inherit;\n letter-spacing: 0.02em;\n transition: color var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-footer-link:hover {\n color: var(--beeport-text-primary);\n }\n\n .beeport-footer-link:hover .beeport-footer-brand {\n text-decoration: underline;\n }\n\n .beeport-footer-bee {\n font-size: 11px;\n line-height: 1;\n }\n\n .beeport-footer-text {\n opacity: 0.5;\n }\n\n .beeport-footer-brand {\n font-weight: 700;\n color: #F59E0B;\n letter-spacing: 0.02em;\n }\n\n @keyframes beeport-form-enter {\n from {\n opacity: 0;\n transform: translateY(8px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n }\n ',e.appendChild(G),e.appendChild(a);const I=function(e,t){const r=[],a=document.createElement("div");a.className="beeport-screenshot-area";const s=document.createElement("div");s.className="beeport-drop-zone",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Upload screenshots");const p=document.createElement("input");p.type="file",p.accept=n.join(","),p.multiple=!0,p.className="beeport-screenshot-input",p.setAttribute("aria-hidden","true"),p.tabIndex=-1;const c=document.createElement("span");c.className="beeport-drop-zone-text",c.textContent="Drop images or click to upload";const l=document.createElement("span");l.className="beeport-drop-zone-hint",l.textContent=`PNG, JPEG, WebP. Max ${o(t.maxFileSize)} each.`,s.appendChild(p),s.appendChild(c),s.appendChild(l);const d=document.createElement("div");d.className="beeport-screenshot-previews";const u=document.createElement("div");u.className="beeport-screenshot-error",u.setAttribute("role","alert"),a.appendChild(s),a.appendChild(d),a.appendChild(u);const b=document.createElement("style");b.textContent="\n .beeport-screenshot-area {\n padding: 4px 18px 14px;\n }\n .beeport-drop-zone {\n border: 2px dashed rgba(107, 114, 128, 0.4);\n border-radius: 11px;\n padding: 14px;\n text-align: center;\n cursor: pointer;\n transition: all var(--beeport-transition-speed, 150ms) var(--beeport-transition-easing, ease);\n background: var(--beeport-input-bg, transparent);\n }\n .beeport-drop-zone:hover,\n .beeport-drop-zone.dragover {\n border-color: #f59e0b;\n background: rgba(245, 158, 11, 0.08);\n }\n .beeport-drop-zone:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border, #f59e0b);\n outline-offset: 2px;\n }\n .beeport-drop-zone-text {\n display: block;\n font-size: 12px;\n font-weight: 600;\n color: var(--beeport-text-secondary, #6b7280);\n margin-bottom: 3px;\n }\n .beeport-drop-zone-hint {\n display: block;\n font-size: 11px;\n color: var(--beeport-text-secondary, #6b7280);\n opacity: 0.7;\n }\n .beeport-screenshot-input { display: none; }\n .beeport-screenshot-previews {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-top: 10px;\n }\n .beeport-screenshot-previews:empty { margin-top: 0; }\n .beeport-preview-item {\n position: relative;\n width: 72px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid rgba(107, 114, 128, 0.3);\n }\n .beeport-preview-thumb {\n width: 72px;\n height: 72px;\n object-fit: cover;\n display: block;\n }\n .beeport-preview-remove {\n position: absolute;\n top: 2px;\n right: 2px;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.6);\n color: white;\n font-size: 13px;\n line-height: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n cursor: pointer;\n padding: 0;\n }\n .beeport-preview-remove:hover { background: rgba(220, 38, 38, 0.9); }\n .beeport-preview-remove:focus-visible {\n outline: 2px solid white;\n outline-offset: 1px;\n }\n .beeport-screenshot-error {\n color: #dc2626;\n font-size: 12px;\n margin-top: 6px;\n min-height: 0;\n }\n .beeport-screenshot-error:empty { display: none; }\n ",e.appendChild(b);const h=e.querySelector(".beeport-status-message");function m(e){u.textContent=e,setTimeout(()=>{u.textContent=""},4e3)}function f(e){const t=document.createElement("div");t.className="beeport-preview-item";const n=document.createElement("img");n.className="beeport-preview-thumb",n.src=e.dataUrl,n.alt=e.name;const o=document.createElement("button");o.className="beeport-preview-remove",o.textContent="×",o.setAttribute("aria-label",`Remove screenshot: ${e.name}`),o.addEventListener("click",()=>{const n=r.indexOf(e);-1!==n&&r.splice(n,1),t.remove(),g()}),t.appendChild(n),t.appendChild(o),d.appendChild(t)}function g(){s.style.display=r.length>=t.maxFiles?"none":""}async function x(e){for(const a of Array.from(e)){if(r.length>=t.maxFiles){m(`Maximum ${t.maxFiles} screenshots allowed.`);break}if(!n.includes(a.type)){m(`${a.name}: unsupported format. Use PNG, JPEG, or WebP.`);continue}if(a.size>t.maxFileSize){m(`${a.name}: exceeds ${o(t.maxFileSize)} limit.`);continue}const e=await v(a),s=await i(e),p={name:a.name,type:a.type,size:a.size,dataUrl:s};r.push(p),f(p),g()}}function v(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(e)})}h?e.insertBefore(a,h):e.appendChild(a),s.addEventListener("click",e=>{e.target!==p&&p.click()}),s.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p.click())}),p.addEventListener("change",()=>{p.files&&(x(p.files),p.value="")}),s.addEventListener("dragover",e=>{e.preventDefault(),s.classList.add("dragover")}),s.addEventListener("dragleave",()=>{s.classList.remove("dragover")}),s.addEventListener("drop",e=>{e.preventDefault(),s.classList.remove("dragover"),e.dataTransfer?.files&&x(e.dataTransfer.files)});const y=e=>{const t=e.clipboardData?.items;if(!t)return;const r=[];for(const o of Array.from(t))if("file"===o.kind&&n.includes(o.type)){const e=o.getAsFile();e&&r.push(e)}r.length>0&&(e.preventDefault(),x(r))};return e.addEventListener("paste",y),{getScreenshots:()=>[...r],reset(){for(r.length=0;d.firstChild;)d.removeChild(d.firstChild);u.textContent="",g()},destroy(){e.removeEventListener("paste",y),a.remove(),b.remove()}}}(a,{maxFiles:r?.maxScreenshots??3,maxFileSize:r?.maxFileSize??5242880});let U="bug",M=null;const V=e=>{U=e,[m,f].forEach(t=>{t.dataset.type===e?(t.classList.add("active"),t.setAttribute("aria-selected","true")):(t.classList.remove("active"),t.setAttribute("aria-selected","false"))})},D=()=>{t?.onCancel&&t.onCancel()},H=e=>{const t=e.target;"block"!==a.style.display||a.contains(t)||(a.style.display="none",_())},_=()=>{M&&(M.focus(),M=null)};return m.addEventListener("click",()=>V("bug")),f.addEventListener("click",()=>V("feature")),C.addEventListener("input",()=>{const e=C.value.length;A.textContent=`${e}/1000 characters`,A.classList.toggle("warning",e>=900&&e<1e3),A.classList.toggle("limit",e>=1e3)}),P.addEventListener("click",()=>{t?.onSubmit&&t.onSubmit()}),B.addEventListener("click",D),d.addEventListener("click",D),a.addEventListener("keydown",e=>{if("Escape"===e.key)return a.style.display="none",void _();if("Tab"===e.key){const t=(()=>{const e=a.querySelectorAll(["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(","));return Array.from(e)})();if(0===t.length)return;const n=t[0],r=t[t.length-1];e.shiftKey?document.activeElement===n&&r&&(e.preventDefault(),r.focus()):document.activeElement===r&&n&&(e.preventDefault(),n.focus())}}),e.addEventListener("click",H),{show(){M=document.activeElement,a.style.display="block",v.focus()},hide(){a.style.display="none",_()},reset(){v.value="",C.value="",U="bug",V("bug"),A.textContent="0/1000 characters",A.classList.remove("warning","limit"),I.reset(),v.classList.remove("error"),C.classList.remove("error"),v.removeAttribute("aria-invalid"),C.removeAttribute("aria-invalid"),v.removeAttribute("aria-describedby"),C.removeAttribute("aria-describedby"),w.textContent="",L.textContent=""},destroy(){I.destroy(),e.removeEventListener("click",H),a.remove(),G.remove()},getValues:()=>({type:U,title:v.value,description:C.value,screenshots:I.getScreenshots()}),validate:()=>(()=>{const e={},t=v.value.trim(),n=C.value.trim();return v.classList.remove("error"),C.classList.remove("error"),v.removeAttribute("aria-invalid"),C.removeAttribute("aria-invalid"),v.removeAttribute("aria-describedby"),C.removeAttribute("aria-describedby"),w.textContent="",L.textContent="",0===t.length?e.title="Title is required":t.length<3&&(e.title="Title must be at least 3 characters"),0===n.length?e.description="Description is required":n.length<10&&(e.description="Description must be at least 10 characters"),e.title&&(v.classList.add("error"),v.setAttribute("aria-invalid","true"),v.setAttribute("aria-describedby","beeport-title-error"),w.textContent=e.title),e.description&&(C.classList.add("error"),C.setAttribute("aria-invalid","true"),C.setAttribute("aria-describedby","beeport-description-error"),L.textContent=e.description),{valid:0===Object.keys(e).length,errors:e}})()}}function s(e,t,n){const r=document.createElement("button");return r.className="beeport-type-button",r.dataset.type=e,r.textContent=t,r.setAttribute("role","tab"),r.setAttribute("aria-selected",String(n)),r.setAttribute("aria-label",{bug:"Report a bug",feature:"Request a feature",question:"Ask a question"}[e]),n&&r.classList.add("active"),r}function p(e,t){try{return e()}catch{return t}}const c=["token","key","secret","password","auth","session","api_key","access_token"];function l(e){const t=function(e){try{const t=new URL(e),n=t.searchParams;return n.forEach((e,t)=>{const r=t.toLowerCase();c.some(e=>r.includes(e))&&n.set(t,"[REDACTED]")}),decodeURIComponent(t.toString())}catch{return e}}(e.url),n=e.cookiesEnabled?"Enabled":"Disabled";return`## Environment\n- **URL**: ${t}\n- **Browser**: ${e.browser.name} ${e.browser.version}\n- **OS**: ${e.os.name} ${e.os.version}\n- **Viewport**: ${e.viewport.width}x${e.viewport.height}\n- **Screen**: ${e.screen.width}x${e.screen.height} @${e.screen.pixelRatio}x\n- **Language**: ${e.language}\n- **Cookies**: ${n}\n- **Timestamp**: ${e.timestamp}`}function d(e){if(!e||0===e.length)return"No errors captured";const t=function(e){const t=new Map;for(const n of e){const e=t.get(n.message);e?(e.count++,e.errors.push(n)):t.set(n.message,{errors:[n],count:1})}return t}(e),n=[];let r=1;return t.forEach(e=>{const t=e.errors[0];if(!t)return;const o=function(e){const t=["TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError"];for(const n of t)if(e.startsWith(n))return n;return"Error"}(t.message),i=[`### Error ${r}`,`**Type**: ${o}`,`**Message**: ${t.message}`];if(e.count>1&&i.push(`**Occurrences**: (occurred ${e.count} times)`),t.stack){const e=function(e,t=20){const n=e.split("\n");if(n.length<=t)return e;const r=n.slice(0,t),o=n.length-t;return r.push(`... (${o} more lines)`),r.join("\n")}(t.stack);i.push(`**Stack trace**:\n\`\`\`\n${e}\n\`\`\``)}i.push(`**Timestamp**: ${t.timestamp}`),n.push(i.join("\n")),r++}),n.join("\n\n")}function u(e){return e&&0!==e.length?`## Screenshots\n${e.map((e,t)=>`![Screenshot ${t+1}: ${e.name}](${e.url})`).join("\n\n")}`:""}class b extends Error{constructor(e,t,n){super(e),this.status=t,this.response=n,this.name="GitHubError"}}class h extends b{constructor(e,t,n){super(e,t,n),this.name="GitHubAuthError"}}class m extends b{constructor(e,t,n){super(e,t,n),this.name="GitHubNotFoundError"}}class f extends b{constructor(e,t,n){super(e,t,n),this.name="GitHubValidationError"}}class g extends b{constructor(e,t,n,r){super(e,t,n),this.rateLimit=r,this.name="GitHubRateLimitError"}}class x extends b{constructor(e,t){super(e),this.cause=t,this.name="GitHubNetworkError"}}async function v(e){const{token:t,owner:n,repo:r,title:o,body:i,labels:a}=e,s=`https://api.github.com/repos/${n}/${r}/issues`,p={title:o,body:i};let c;a&&a.length>0&&(p.labels=a);try{c=await fetch(s,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","Content-Type":"application/json"},body:JSON.stringify(p)})}catch(d){throw new x("Network request failed",d instanceof Error?d:void 0)}if(!c.ok){let e;try{e=await c.json()}catch{e={}}const t=e.message||`HTTP ${c.status}`;switch(c.status){case 401:case 403:throw new h(t,c.status,e);case 404:throw new m(t,c.status,e);case 422:throw new f(t,c.status,e);case 429:{const n={limit:parseInt(c.headers.get("X-RateLimit-Limit")||"0",10),remaining:parseInt(c.headers.get("X-RateLimit-Remaining")||"0",10),reset:parseInt(c.headers.get("X-RateLimit-Reset")||"0",10)};throw new g(t,c.status,e,n)}default:throw new b(t,c.status,e)}}const l=await c.json();return{url:l.html_url,number:l.number,id:l.id}}function y(e,t){const n=e.toLowerCase().trim(),r=t.toLowerCase().trim();if(0===n.length&&0===r.length)return 1;if(0===n.length||0===r.length)return 0;const o=function(e,t){if(0===e.length)return t.length;if(0===t.length)return e.length;const n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++)t.charAt(r-1)===e.charAt(o-1)?n[r][o]=n[r-1][o-1]:n[r][o]=Math.min(n[r-1][o-1]+1,n[r][o-1]+1,n[r-1][o]+1);return n[t.length][e.length]}(n,r);return 1-o/Math.max(n.length,r.length)}async function w(e,t){return 0===t.length?[]:e?(await Promise.all(t.map(async t=>{try{const n=await async function(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,type:t.type,data:t.dataUrl})});if(!n.ok)throw new Error(`Screenshot upload failed: ${n.status}`);return(await n.json()).url}(e,t);return{name:t.name,url:n}}catch(n){return console.warn(`[BeePort] Failed to upload ${t.name}:`,n),null}}))).filter(e=>null!==e):(console.warn("[BeePort] Screenshots require uploadEndpoint. Screenshots will be omitted."),[])}function k(e){return e instanceof h?"Authentication failed. Check your GitHub token.":e instanceof m?"Repository not found. Check the repo setting.":e instanceof g?"Rate limit exceeded. Please try again later.":e instanceof f?"Invalid issue data. Please check your input.":e instanceof x?"Network error. Check your connection.":e instanceof Error?e.message:"An unknown error occurred."}async function E(e){const{config:t,formValues:n,errors:r}=e;try{const e={url:p(()=>window.location.href,"unknown"),viewport:p(()=>({width:window.innerWidth,height:window.innerHeight}),{width:0,height:0}),screen:p(()=>({width:window.screen.width,height:window.screen.height,pixelRatio:window.devicePixelRatio}),{width:0,height:0,pixelRatio:1}),browser:p(()=>{const e=navigator.userAgentData;if(e?.brands){const t=e.brands;for(const e of t){const t=e.brand.toLowerCase();if(t.includes("chrome")&&!t.includes("chromium"))return{name:"Chrome",version:e.version};if(t.includes("edge"))return{name:"Edge",version:e.version};if(t.includes("opera"))return{name:"Opera",version:e.version}}}return function(e){if(/Edg\//.test(e)){const t=e.match(/Edg\/([\d.]+)/);return{name:"Edge",version:t?.[1]||"unknown"}}if(/OPR\//.test(e)){const t=e.match(/OPR\/([\d.]+)/);return{name:"Opera",version:t?.[1]||"unknown"}}if(/Chrome\//.test(e)&&!/Edg\//.test(e)){const t=e.match(/Chrome\/([\d.]+)/);return{name:"Chrome",version:t?.[1]||"unknown"}}if(/Firefox\//.test(e)){const t=e.match(/Firefox\/([\d.]+)/);return{name:"Firefox",version:t?.[1]||"unknown"}}if(/Safari\//.test(e)&&!/Chrome\//.test(e)){const t=e.match(/Version\/([\d.]+)/);return{name:"Safari",version:t?.[1]||"unknown"}}return{name:"Unknown",version:"unknown"}}(navigator.userAgent)},{name:"Unknown",version:"unknown"}),os:p(()=>function(e){if(/iPhone|iPad|iPod/.test(e)){const t=e.match(/OS ([\d_]+)/);return{name:"iOS",version:t?.[1]?.replace(/_/g,".")||"unknown"}}if(/Windows NT/.test(e)){const t=e.match(/Windows NT ([\d.]+)/),n=t?.[1]||"unknown";return{name:"Windows",version:{"10.0":"10",6.3:"8.1",6.2:"8",6.1:"7"}[n]||n}}if(/Mac OS X/.test(e)){const t=e.match(/Mac OS X ([\d_]+)/);return{name:"macOS",version:t?.[1]?.replace(/_/g,".")||"unknown"}}if(/Android/.test(e)){const t=e.match(/Android ([\d.]+)/);return{name:"Android",version:t?.[1]||"unknown"}}return/Linux/.test(e)?{name:"Linux",version:"unknown"}:{name:"Unknown",version:"unknown"}}(navigator.userAgent),{name:"Unknown",version:"unknown"}),timestamp:(new Date).toISOString(),language:p(()=>navigator.language,"unknown"),cookiesEnabled:p(()=>navigator.cookieEnabled,!1),doNotTrack:p(()=>navigator.doNotTrack,null)},a=function(e,t){return`${{bug:"[Bug]",feature:"[Feature]",question:"[Question]"}[e]} ${t}`}(n.type,n.title),s=n.screenshots??[];let c=[];t.endpoint?t.uploadEndpoint&&s.length>0&&(c=await w(t.uploadEndpoint,s)):s.length>0&&(c=await w(t.uploadEndpoint,s));const b=function(e){switch(e.type){case"bug":return function(e){return[`## Summary\n${e.description}`,u(e.screenshots),"## Steps to Reproduce\nNot provided","## Expected Behavior\nNot provided","## Actual Behavior\nNot provided",l(e.context),`## Console Errors\n${d(e.errors)}`].filter(Boolean).join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);case"feature":return function(e){return[`## Summary\n${e.description}`,u(e.screenshots),"## Use Case\nNot provided","## Proposed Solution\nNot provided",l(e.context)].filter(Boolean).join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);case"question":return function(e){return[`## Question\n${e.description}`,u(e.screenshots),"## Context\nNot provided",l(e.context)].filter(Boolean).join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);default:throw new Error(`Unknown feedback type: ${e.type}`)}}({type:n.type,title:n.title,description:n.description,context:e,errors:r,screenshots:c.length>0?c:void 0}),h=["bug"===(o=n.type)?"bug":"feature"===o?"enhancement":"question","beeport","agent-ready"];if(t.endpoint){const e=s.length>0?s.map(e=>({name:e.name,type:e.type,dataUrl:e.dataUrl})):void 0;return async function(e,t){let n;try{n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{return{status:"error",error:"Network error. Check your connection."}}if(!n.ok){const e=await n.json().catch(()=>({}));return{status:"error",error:"string"==typeof e.error?e.error:400===(r=n.status)?"Invalid issue data. Please check your input.":429===r?"Rate limit exceeded. Please try again later.":502===r||503===r?"Service temporarily unavailable. Please try again.":"An unexpected error occurred."}}var r;const o=await n.json();return{status:"success",issueUrl:o.issueUrl,issueNumber:o.issueNumber}}(t.endpoint,{title:a,body:b,labels:h,screenshots:e})}const{owner:m,repo:f}=function(e){const t=e.split("/");return{owner:t[0]||"",repo:t.slice(1).join("/")}}(t.repo);let g=[];try{g=await async function(e){const{token:t,owner:n,repo:r,title:o}=e;try{const e=`https://api.github.com/repos/${n}/${r}/issues?labels=beeport&state=open`,i=await fetch(e,{method:"GET",headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).map(e=>({number:e.number,title:e.title,url:e.html_url,similarity:y(o,e.title),state:e.state})).filter(e=>e.similarity>.7).sort((e,t)=>t.similarity-e.similarity).slice(0,5):(console.warn(`GitHub API error: ${i.status} ${i.statusText}`),[])}catch(i){return console.warn("Failed to search for duplicate issues:",i),[]}}({token:t.token,owner:m,repo:f,title:a})}catch(i){console.warn("Duplicate search failed, proceeding with submission:",i)}if(g.length>0)return{status:"duplicates_found",candidates:g,pendingSubmission:{title:a,body:b,labels:h,owner:m,repo:f,token:t.token}};const x=await v({token:t.token,owner:m,repo:f,title:a,body:b,labels:h});return{status:"success",issueUrl:x.url,issueNumber:x.number}}catch(i){return{status:"error",error:k(i)}}var o}const C=Object.freeze(Object.defineProperty({__proto__:null,confirmSubmit:async function(e){try{const t=await v({token:e.token,owner:e.owner,repo:e.repo,title:e.title,body:e.body,labels:e.labels});return{status:"success",issueUrl:t.url,issueNumber:t.number}}catch(t){return{status:"error",error:k(t)}}},submitFeedback:E},Symbol.toStringTag,{value:"Module"}));class S{constructor(e){this.isOpen=!1,this.themeCleanup=null,this.config=e,this.hostElement=document.createElement("div"),this.hostElement.setAttribute("data-beeport-container",""),this.shadowRoot=this.hostElement.attachShadow({mode:"open"}),this.container=document.createElement("div"),this.container.className="beeport-container",this.container.setAttribute("data-open","false"),this.applyPosition(e.position??"bottom-right");const n=document.createElement("style");n.textContent='\n /* CSS Custom Properties (theme variables) */\n :host {\n --beeport-z-index: 999999;\n --beeport-spacing-sm: 8px;\n --beeport-spacing-md: 16px;\n --beeport-spacing-lg: 24px;\n --beeport-border-radius: 8px;\n --beeport-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n\n /* Typography */\n --beeport-font-size-sm: 12px;\n --beeport-font-size-md: 14px;\n --beeport-font-size-lg: 16px;\n --beeport-font-weight-normal: 400;\n --beeport-font-weight-medium: 500;\n --beeport-font-weight-bold: 600;\n\n /* Transitions */\n --beeport-transition-speed: 200ms;\n --beeport-transition-easing: ease-in-out;\n }\n\n /* Light theme colors */\n .beeport-container[data-theme="light"] {\n /* Base colors */\n --beeport-bg-primary: #ffffff;\n --beeport-bg-secondary: #f5f5f5;\n --beeport-text-primary: #1f2937;\n --beeport-text-secondary: #6b7280;\n --beeport-border-color: #d1d5db;\n --beeport-accent: #2563eb;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #1d4ed8;\n --beeport-button-primary-active: #1e40af;\n --beeport-button-disabled-bg: #e5e7eb;\n --beeport-button-disabled-text: #4b5563;\n\n /* Input states */\n --beeport-input-bg: #ffffff;\n --beeport-input-border: #9ca3af;\n --beeport-input-focus-border: #2563eb;\n\n /* Status colors */\n --beeport-success: #047857;\n --beeport-error: #dc2626;\n --beeport-warning: #b45309;\n }\n\n /* Dark theme colors */\n .beeport-container[data-theme="dark"] {\n /* Base colors */\n --beeport-bg-primary: #1f2937;\n --beeport-bg-secondary: #111827;\n --beeport-text-primary: #f9fafb;\n --beeport-text-secondary: #9ca3af;\n --beeport-border-color: #6b7280;\n --beeport-accent: #60a5fa;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #2563eb;\n --beeport-button-primary-active: #1d4ed8;\n --beeport-button-disabled-bg: #374151;\n --beeport-button-disabled-text: #d1d5db;\n\n /* Input states */\n --beeport-input-bg: #111827;\n --beeport-input-border: #6b7280;\n --beeport-input-focus-border: #60a5fa;\n\n /* Status colors */\n --beeport-success: #34d399;\n --beeport-error: #f87171;\n --beeport-warning: #fbbf24;\n }\n\n /* Auto theme - respect system preference */\n .beeport-container[data-theme="auto"] {\n /* Base colors */\n --beeport-bg-primary: #ffffff;\n --beeport-bg-secondary: #f5f5f5;\n --beeport-text-primary: #1f2937;\n --beeport-text-secondary: #6b7280;\n --beeport-border-color: #d1d5db;\n --beeport-accent: #2563eb;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #1d4ed8;\n --beeport-button-primary-active: #1e40af;\n --beeport-button-disabled-bg: #e5e7eb;\n --beeport-button-disabled-text: #4b5563;\n\n /* Input states */\n --beeport-input-bg: #ffffff;\n --beeport-input-border: #9ca3af;\n --beeport-input-focus-border: #2563eb;\n\n /* Status colors */\n --beeport-success: #047857;\n --beeport-error: #dc2626;\n --beeport-warning: #b45309;\n }\n\n @media (prefers-color-scheme: dark) {\n .beeport-container[data-theme="auto"] {\n /* Base colors */\n --beeport-bg-primary: #1f2937;\n --beeport-bg-secondary: #111827;\n --beeport-text-primary: #f9fafb;\n --beeport-text-secondary: #9ca3af;\n --beeport-border-color: #6b7280;\n --beeport-accent: #60a5fa;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #2563eb;\n --beeport-button-primary-active: #1d4ed8;\n --beeport-button-disabled-bg: #374151;\n --beeport-button-disabled-text: #d1d5db;\n\n /* Input states */\n --beeport-input-bg: #111827;\n --beeport-input-border: #6b7280;\n --beeport-input-focus-border: #60a5fa;\n\n /* Status colors */\n --beeport-success: #34d399;\n --beeport-error: #f87171;\n --beeport-warning: #fbbf24;\n }\n }\n\n /* Container base styles */\n .beeport-container {\n position: fixed;\n z-index: var(--beeport-z-index);\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n font-size: 14px;\n line-height: 1.5;\n box-sizing: border-box;\n }\n\n .beeport-container *,\n .beeport-container *::before,\n .beeport-container *::after {\n box-sizing: border-box;\n }\n\n /* Reset button styles for future components */\n .beeport-container button {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n cursor: pointer;\n }\n\n /* Feedback button - floating action button */\n .beeport-feedback-button {\n position: relative;\n width: 56px;\n height: 56px;\n border-radius: 50%;\n background: linear-gradient(135deg, #FFC107 0%, #F59E0B 50%, #D97706 100%);\n color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n border: none;\n cursor: pointer;\n outline: none;\n }\n\n .beeport-feedback-button:hover {\n background: #ffffff;\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(245, 158, 11, 0.15);\n }\n\n .beeport-feedback-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-feedback-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-feedback-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-feedback-button:active {\n background: linear-gradient(135deg, #F59E0B 0%, #D97706 50%, #B45309 100%);\n transform: translateY(0);\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);\n }\n\n .beeport-feedback-button svg {\n width: 28px;\n height: 28px;\n pointer-events: none;\n filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));\n }\n ',this.shadowRoot.appendChild(n),this.shadowRoot.appendChild(this.container),this.feedbackButton=this.createFeedbackButton(),this.container.appendChild(this.feedbackButton),this.form=a(this.container,{onSubmit:()=>{this.handleSubmit()},onCancel:()=>{this.isOpen&&this.toggleOpen()}},{maxScreenshots:e.maxScreenshots,maxFileSize:e.maxFileSize}),document.body.appendChild(this.hostElement),this.themeCleanup=t(this.container,e.theme??"auto")}applyPosition(e){this.container.style.position="fixed",this.container.style.bottom="20px","bottom-right"===e?this.container.style.right="20px":this.container.style.left="20px"}createFeedbackButton(){const e=document.createElement("button");return e.className="beeport-feedback-button",e.setAttribute("aria-label","Send feedback"),e.setAttribute("aria-expanded","false"),e.setAttribute("tabindex","0"),this.updateButtonIcon(e,!1),e.addEventListener("click",e=>{e.stopPropagation(),this.toggleOpen()}),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggleOpen())}),e}async handleSubmit(){if(!this.form.validate().valid)return;const e=this.form.getValues(),t=await E({config:this.config,formValues:e});if("success"===t.status)this.form.reset(),this.toggleOpen(),console.log(`[BeePort] Issue created: ${t.issueUrl}`);else if("duplicates_found"===t.status){console.log("[BeePort] Potential duplicates found, submitting anyway");const{confirmSubmit:e}=await Promise.resolve().then(()=>C),n=await e(t.pendingSubmission);"success"===n.status?(this.form.reset(),this.toggleOpen(),console.log(`[BeePort] Issue created: ${n.issueUrl}`)):"error"===n.status&&console.error(`[BeePort] Submit failed: ${n.error}`)}else"error"===t.status&&console.error(`[BeePort] Submit failed: ${t.error}`)}toggleOpen(){this.isOpen=!this.isOpen,this.container.setAttribute("data-open",String(this.isOpen)),this.feedbackButton.setAttribute("aria-expanded",String(this.isOpen)),this.updateButtonIcon(this.feedbackButton,this.isOpen),this.isOpen?this.form.show():this.form.hide();const e=new CustomEvent("beeport:toggle",{detail:{open:this.isOpen},bubbles:!0,composed:!0});this.hostElement.dispatchEvent(e)}updateButtonIcon(e,t){if(e.textContent="",t){const t=this.createSVGElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"}),n=this.createSVGElement("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"});t.appendChild(n),e.appendChild(t)}else{const t=this.createSVGElement("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none"}),n=this.createSVGElement("ellipse",{cx:"14",cy:"15",rx:"6",ry:"7.5",fill:"#FFC107",stroke:"currentColor","stroke-width":"1.5"}),r=this.createSVGElement("path",{d:"M8.5 13.5 Q14 12 19.5 13.5",stroke:"#1a1a1a","stroke-width":"1.8","stroke-linecap":"round",fill:"none"}),o=this.createSVGElement("path",{d:"M8.2 16.5 Q14 15 19.8 16.5",stroke:"#1a1a1a","stroke-width":"1.8","stroke-linecap":"round",fill:"none"}),i=this.createSVGElement("ellipse",{cx:"9.5",cy:"9",rx:"3.5",ry:"4",fill:"rgba(255,255,255,0.7)",stroke:"currentColor","stroke-width":"1",transform:"rotate(-15 9.5 9)"}),a=this.createSVGElement("ellipse",{cx:"18.5",cy:"9",rx:"3.5",ry:"4",fill:"rgba(255,255,255,0.7)",stroke:"currentColor","stroke-width":"1",transform:"rotate(15 18.5 9)"}),s=this.createSVGElement("circle",{cx:"14",cy:"7.5",r:"3",fill:"#1a1a1a"}),p=this.createSVGElement("circle",{cx:"12.8",cy:"7",r:"0.8",fill:"white"}),c=this.createSVGElement("circle",{cx:"15.2",cy:"7",r:"0.8",fill:"white"}),l=this.createSVGElement("path",{d:"M12.5 5 Q11 2.5 9.5 2",stroke:"#1a1a1a","stroke-width":"1.2","stroke-linecap":"round",fill:"none"}),d=this.createSVGElement("path",{d:"M15.5 5 Q17 2.5 18.5 2",stroke:"#1a1a1a","stroke-width":"1.2","stroke-linecap":"round",fill:"none"}),u=this.createSVGElement("circle",{cx:"9.3",cy:"1.8",r:"1",fill:"#FFC107"}),b=this.createSVGElement("circle",{cx:"18.7",cy:"1.8",r:"1",fill:"#FFC107"}),h=this.createSVGElement("path",{d:"M14 22.5 L14 24.5",stroke:"#1a1a1a","stroke-width":"1.5","stroke-linecap":"round"});t.appendChild(i),t.appendChild(a),t.appendChild(n),t.appendChild(r),t.appendChild(o),t.appendChild(s),t.appendChild(p),t.appendChild(c),t.appendChild(l),t.appendChild(d),t.appendChild(u),t.appendChild(b),t.appendChild(h),e.appendChild(t)}}createSVGElement(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg",e);for(const[r,o]of Object.entries(t))n.setAttribute(r,o);return n}show(){this.hostElement.style.display=""}hide(){this.hostElement.style.display="none"}destroy(){this.form.destroy(),this.themeCleanup&&(this.themeCleanup(),this.themeCleanup=null),this.hostElement.parentNode&&this.hostElement.parentNode.removeChild(this.hostElement)}setTheme(e){this.themeCleanup&&this.themeCleanup(),this.themeCleanup=t(this.container,e)}getContainer(){return this.container}}let A=null,N=null;e.destroy=function(){A&&(A.destroy(),A=null,N=null)},e.init=function(e){if(function(e){const t=e.endpoint&&""!==e.endpoint.trim(),n=e.token&&""!==e.token.trim();if(t&&n)throw new Error("Cannot use both endpoint and token. Choose one mode.");if(!t){if(!e.repo)throw new Error("repo is required (or use endpoint for proxy mode)");if(!e.repo.includes("/")||2!==e.repo.split("/").length)throw new Error('repo must be in format "owner/repo"');if(!n)throw new Error("token is required (or use endpoint for proxy mode)")}}(e),A&&N)return N;const t={...e,position:e.position??"bottom-right",theme:e.theme??"auto"};var n;return A=new S(t),n=A,N={show:()=>n.show(),hide:()=>n.hide(),destroy:()=>{n.destroy(),A=null,N=null},setTheme:e=>n.setTheme(e)},N},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
package/dist/beeport.mjs CHANGED
@@ -1 +1 @@
1
- function e(e,t){if(e.setAttribute("data-theme",t),"auto"!==t)return()=>{};if("undefined"==typeof window||!window.matchMedia)return()=>{};const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{};n.addEventListener("change",r);let o=!1;return()=>{o||(n.removeEventListener("change",r),o=!0)}}function t(e,t){const r=document.createElement("div");r.className="beeport-form-panel",r.style.display="none",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true");const o=document.createElement("div");o.className="beeport-form-header";const i=document.createElement("h3");i.className="beeport-form-title",i.id="beeport-form-title",i.textContent="Report to BeePort";const a=document.createElement("p");a.className="beeport-form-subtitle",a.textContent="Help us fix bugs and shape features in under a minute.",r.setAttribute("aria-labelledby","beeport-form-title");const s=document.createElement("button");s.className="beeport-form-close",s.textContent="×",s.setAttribute("aria-label","Close");const p=document.createElement("div");p.className="beeport-form-heading",p.appendChild(i),p.appendChild(a),o.appendChild(p),o.appendChild(s);const c=document.createElement("p");c.className="beeport-type-legend",c.textContent="What are you sharing?";const l=document.createElement("div");l.className="beeport-type-selector",l.setAttribute("role","tablist"),l.setAttribute("aria-label","Select feedback type");const d=n("bug","Bug report",!0),u=n("feature","Feature idea",!1);l.appendChild(d),l.appendChild(u);const b=document.createElement("div");b.className="beeport-input-wrapper";const h=document.createElement("label");h.textContent="Title",h.htmlFor="beeport-title-input",h.className="beeport-input-label";const m=document.createElement("input");m.type="text",m.id="beeport-title-input",m.className="beeport-input-title",m.placeholder="Example: Save button does nothing on Safari";const f=document.createElement("div");f.className="beeport-input-hint beeport-input-hint-title",f.textContent="Use a short summary (3+ characters).";const g=document.createElement("div");g.id="beeport-title-error",g.className="beeport-error-message",g.setAttribute("role","alert"),b.appendChild(h),b.appendChild(m),b.appendChild(f),b.appendChild(g);const x=document.createElement("div");x.className="beeport-input-wrapper";const y=document.createElement("label");y.textContent="Description",y.htmlFor="beeport-description-input",y.className="beeport-input-label";const v=document.createElement("textarea");v.id="beeport-description-input",v.className="beeport-input-description",v.placeholder="What happened? What did you expect instead? Include steps to reproduce.",v.maxLength=1e3,v.rows=5;const w=document.createElement("div");w.className="beeport-input-hint beeport-input-hint-description",w.textContent="Include context, expected result, and actual result (10+ characters).";const k=document.createElement("div");k.className="beeport-char-counter",k.textContent="0/1000 characters";const C=document.createElement("div");C.className="beeport-description-meta",C.appendChild(w),C.appendChild(k);const E=document.createElement("div");E.id="beeport-description-error",E.className="beeport-error-message",E.setAttribute("role","alert"),x.appendChild(y),x.appendChild(v),x.appendChild(C),x.appendChild(E);const S=document.createElement("div");S.className="beeport-status-message",S.setAttribute("aria-live","polite"),S.setAttribute("aria-atomic","true"),S.textContent="";const A=document.createElement("div");A.className="beeport-form-buttons";const N=document.createElement("button");N.className="beeport-cancel-button",N.textContent="Not now";const L=document.createElement("button");L.className="beeport-submit-button",L.textContent="Create Issue",A.appendChild(N),A.appendChild(L);const B=document.createElement("div");B.className="beeport-form-footer";const $=document.createElement("a");$.href="https://beeport.ai",$.target="_blank",$.rel="noopener noreferrer",$.className="beeport-footer-link";const P=document.createElement("span");P.className="beeport-footer-bee",P.textContent="🐝";const O=document.createElement("span");O.className="beeport-footer-text",O.textContent="Powered by ";const F=document.createElement("span");F.className="beeport-footer-brand",F.textContent="BeePort",$.appendChild(P),$.appendChild(O),$.appendChild(F),B.appendChild($),r.appendChild(o),r.appendChild(c),r.appendChild(l),r.appendChild(b),r.appendChild(x),r.appendChild(S),r.appendChild(A),r.appendChild(B);const R=document.createElement("style");R.textContent='\n /* Form Panel */\n .beeport-form-panel {\n position: absolute;\n bottom: 72px;\n right: 0;\n width: min(420px, calc(100vw - 24px));\n max-height: min(80vh, 680px);\n background:\n radial-gradient(circle at top left, rgba(250, 204, 21, 0.18), transparent 55%),\n var(--beeport-bg-primary);\n border: 1px solid rgba(245, 158, 11, 0.32);\n border-radius: 18px;\n box-shadow: 0 20px 44px rgba(17, 24, 39, 0.28), 0 6px 18px rgba(17, 24, 39, 0.16);\n padding: 0;\n color: var(--beeport-text-primary);\n font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;\n overflow: hidden;\n animation: beeport-form-enter 160ms cubic-bezier(0.22, 1, 0.36, 1);\n }\n\n /* Mobile responsive */\n @media (max-width: 500px) {\n .beeport-form-panel {\n right: 8px;\n bottom: 72px;\n width: calc(100vw - 16px);\n max-height: calc(100vh - 96px);\n border-radius: 14px;\n }\n }\n\n /* Header */\n .beeport-form-header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n padding: 18px 18px 14px;\n border-bottom: 1px solid rgba(245, 158, 11, 0.2);\n background: linear-gradient(180deg, rgba(250, 204, 21, 0.15) 0%, transparent 100%);\n }\n\n .beeport-form-heading {\n min-width: 0;\n flex: 1;\n }\n\n .beeport-form-title {\n margin: 0;\n font-size: 20px;\n font-weight: 700;\n color: var(--beeport-text-primary);\n line-height: 1.2;\n }\n\n .beeport-form-subtitle {\n margin: 6px 0 0;\n font-size: 12px;\n line-height: 1.4;\n color: var(--beeport-text-secondary);\n max-width: 32ch;\n }\n\n .beeport-form-close {\n background: var(--beeport-bg-secondary);\n border: 1px solid rgba(245, 158, 11, 0.3);\n font-size: 17px;\n line-height: 1;\n color: var(--beeport-text-primary);\n cursor: pointer;\n padding: 2px;\n width: 30px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n font-family: inherit;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-form-close:hover {\n border-color: #f59e0b;\n background: rgba(245, 158, 11, 0.18);\n transform: rotate(90deg);\n }\n\n .beeport-form-close:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-form-close:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-form-close:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-type-legend {\n margin: 12px 18px 8px;\n color: var(--beeport-text-secondary);\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.01em;\n }\n\n /* Type Selector */\n .beeport-type-selector {\n display: flex;\n gap: 8px;\n margin: 0 18px 14px;\n padding: 5px;\n min-height: 62px;\n border: 1px solid rgba(245, 158, 11, 0.28);\n border-radius: 12px;\n background: var(--beeport-bg-secondary);\n }\n\n .beeport-type-button {\n flex: 1;\n padding: 9px 10px;\n min-height: 52px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n border-radius: 9px;\n color: var(--beeport-text-secondary);\n font-size: 12px;\n font-weight: 700;\n font-family: inherit;\n letter-spacing: 0.01em;\n text-transform: none;\n cursor: pointer;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-type-button:last-child {\n border-right: 0;\n }\n\n .beeport-type-button:hover {\n background: rgba(245, 158, 11, 0.1);\n color: var(--beeport-text-primary);\n }\n\n .beeport-type-button.active {\n background: linear-gradient(135deg, #f59e0b, #facc15);\n color: #111827;\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);\n }\n\n .beeport-type-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: -2px;\n }\n\n .beeport-type-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-type-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: -2px;\n }\n\n /* Input Wrapper */\n .beeport-input-wrapper {\n position: relative;\n padding: 0 18px 14px;\n border-bottom: none;\n }\n\n /* Input Label */\n .beeport-input-label {\n display: block;\n margin-bottom: 6px;\n color: var(--beeport-text-secondary);\n font-size: 11px;\n font-weight: 600;\n font-family: inherit;\n letter-spacing: 0.01em;\n }\n\n /* Input and Textarea */\n .beeport-input-title,\n .beeport-input-description {\n width: 100%;\n padding: 10px 12px;\n background: var(--beeport-input-bg);\n border: 1px solid rgba(107, 114, 128, 0.45);\n border-radius: 11px;\n color: var(--beeport-text-primary);\n font-size: 14px;\n font-family: inherit;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n box-sizing: border-box;\n }\n\n .beeport-input-title::placeholder,\n .beeport-input-description::placeholder {\n color: var(--beeport-text-secondary);\n opacity: 0.8;\n }\n\n .beeport-input-title:focus,\n .beeport-input-description:focus {\n outline: none;\n border-color: #f59e0b;\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);\n }\n\n .beeport-input-title:focus:not(:focus-visible),\n .beeport-input-description:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-input-title:focus-visible,\n .beeport-input-description:focus-visible {\n outline: none;\n border-color: #f59e0b;\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);\n }\n\n .beeport-input-description {\n resize: vertical;\n min-height: 108px;\n max-height: 240px;\n }\n\n /* Error state */\n .beeport-input-title.error,\n .beeport-input-description.error {\n border-color: #dc2626;\n box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.16);\n }\n\n .beeport-input-hint {\n margin-top: 7px;\n font-size: 11px;\n color: var(--beeport-text-secondary);\n line-height: 1.3;\n }\n\n .beeport-error-message {\n color: #dc2626;\n font-size: 12px;\n margin-top: 6px;\n min-height: 16px;\n }\n\n /* Status Message (Live Region) */\n .beeport-status-message {\n margin: 0 18px 14px;\n padding: 8px 10px;\n border-radius: 10px;\n font-size: var(--beeport-font-size-sm);\n min-height: 0;\n }\n\n .beeport-status-message:empty {\n display: none;\n }\n\n .beeport-status-message.success {\n background-color: #d1fae5;\n color: #065f46;\n border: 1px solid #10b981;\n }\n\n .beeport-status-message.error {\n background-color: #fee2e2;\n color: #991b1b;\n border: 1px solid #dc2626;\n }\n\n .beeport-description-meta {\n margin-top: 7px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n }\n\n /* Character Counter */\n .beeport-char-counter {\n font-size: 11px;\n font-family: inherit;\n color: var(--beeport-text-secondary);\n opacity: 0.8;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transition: color var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-char-counter.warning {\n color: #b45309;\n }\n\n .beeport-char-counter.limit {\n color: #dc2626;\n font-weight: 700;\n }\n\n /* Form Buttons */\n .beeport-form-buttons {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n padding: 0 18px 16px;\n }\n\n .beeport-cancel-button,\n .beeport-submit-button {\n padding: 10px 16px;\n border-radius: 10px;\n font-size: 12px;\n font-weight: 700;\n font-family: inherit;\n letter-spacing: 0.02em;\n text-transform: none;\n cursor: pointer;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-cancel-button {\n background: transparent;\n border: 1px solid rgba(107, 114, 128, 0.45);\n color: var(--beeport-text-primary);\n }\n\n .beeport-cancel-button:hover {\n background: rgba(107, 114, 128, 0.1);\n color: var(--beeport-text-primary);\n border-color: rgba(107, 114, 128, 0.8);\n }\n\n .beeport-cancel-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-cancel-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-cancel-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-submit-button {\n background: linear-gradient(135deg, #f59e0b, #facc15);\n border: 1px solid #d97706;\n color: #ffffff;\n text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);\n }\n\n .beeport-submit-button:hover {\n transform: translateY(-1px);\n box-shadow: 0 8px 16px rgba(245, 158, 11, 0.34);\n }\n\n .beeport-submit-button:active {\n background: #f59e0b;\n border-color: #B45309;\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.28);\n transform: translateY(0);\n }\n\n .beeport-submit-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-submit-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-submit-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n /* Footer Branding */\n .beeport-form-footer {\n padding: 10px 16px 14px;\n text-align: center;\n background: linear-gradient(180deg, transparent 0%, rgba(245, 158, 11, 0.08) 100%);\n }\n\n .beeport-footer-link {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n text-decoration: none;\n color: var(--beeport-text-secondary);\n font-size: 11px;\n font-family: inherit;\n letter-spacing: 0.02em;\n transition: color var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-footer-link:hover {\n color: var(--beeport-text-primary);\n }\n\n .beeport-footer-link:hover .beeport-footer-brand {\n text-decoration: underline;\n }\n\n .beeport-footer-bee {\n font-size: 11px;\n line-height: 1;\n }\n\n .beeport-footer-text {\n opacity: 0.5;\n }\n\n .beeport-footer-brand {\n font-weight: 700;\n color: #F59E0B;\n letter-spacing: 0.02em;\n }\n\n @keyframes beeport-form-enter {\n from {\n opacity: 0;\n transform: translateY(8px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n }\n ',e.appendChild(R),e.appendChild(r);let z="bug",G=null;const T=e=>{z=e,[d,u].forEach(t=>{t.dataset.type===e?(t.classList.add("active"),t.setAttribute("aria-selected","true")):(t.classList.remove("active"),t.setAttribute("aria-selected","false"))})},j=()=>{t?.onCancel&&t.onCancel()},I=e=>{const t=e.target;"block"!==r.style.display||r.contains(t)||(r.style.display="none",V())},V=()=>{G&&(G.focus(),G=null)};return d.addEventListener("click",()=>T("bug")),u.addEventListener("click",()=>T("feature")),v.addEventListener("input",()=>{const e=v.value.length;k.textContent=`${e}/1000 characters`,k.classList.toggle("warning",e>=900&&e<1e3),k.classList.toggle("limit",e>=1e3)}),L.addEventListener("click",()=>{t?.onSubmit&&t.onSubmit()}),N.addEventListener("click",j),s.addEventListener("click",j),r.addEventListener("keydown",e=>{if("Escape"===e.key)return r.style.display="none",void V();if("Tab"===e.key){const t=(()=>{const e=r.querySelectorAll(["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(","));return Array.from(e)})();if(0===t.length)return;const n=t[0],o=t[t.length-1];e.shiftKey?document.activeElement===n&&o&&(e.preventDefault(),o.focus()):document.activeElement===o&&n&&(e.preventDefault(),n.focus())}}),e.addEventListener("click",I),{show(){G=document.activeElement,r.style.display="block",m.focus()},hide(){r.style.display="none",V()},reset(){m.value="",v.value="",z="bug",T("bug"),k.textContent="0/1000 characters",k.classList.remove("warning","limit"),m.classList.remove("error"),v.classList.remove("error"),m.removeAttribute("aria-invalid"),v.removeAttribute("aria-invalid"),m.removeAttribute("aria-describedby"),v.removeAttribute("aria-describedby"),g.textContent="",E.textContent=""},destroy(){e.removeEventListener("click",I),r.remove(),R.remove()},getValues:()=>({type:z,title:m.value,description:v.value}),validate:()=>(()=>{const e={},t=m.value.trim(),n=v.value.trim();return m.classList.remove("error"),v.classList.remove("error"),m.removeAttribute("aria-invalid"),v.removeAttribute("aria-invalid"),m.removeAttribute("aria-describedby"),v.removeAttribute("aria-describedby"),g.textContent="",E.textContent="",0===t.length?e.title="Title is required":t.length<3&&(e.title="Title must be at least 3 characters"),0===n.length?e.description="Description is required":n.length<10&&(e.description="Description must be at least 10 characters"),e.title&&(m.classList.add("error"),m.setAttribute("aria-invalid","true"),m.setAttribute("aria-describedby","beeport-title-error"),g.textContent=e.title),e.description&&(v.classList.add("error"),v.setAttribute("aria-invalid","true"),v.setAttribute("aria-describedby","beeport-description-error"),E.textContent=e.description),{valid:0===Object.keys(e).length,errors:e}})()}}function n(e,t,n){const r=document.createElement("button");return r.className="beeport-type-button",r.dataset.type=e,r.textContent=t,r.setAttribute("role","tab"),r.setAttribute("aria-selected",String(n)),r.setAttribute("aria-label",{bug:"Report a bug",feature:"Request a feature",question:"Ask a question"}[e]),n&&r.classList.add("active"),r}function r(e,t){try{return e()}catch{return t}}const o=["token","key","secret","password","auth","session","api_key","access_token"];function i(e){const t=function(e){try{const t=new URL(e),n=t.searchParams;return n.forEach((e,t)=>{const r=t.toLowerCase();o.some(e=>r.includes(e))&&n.set(t,"[REDACTED]")}),decodeURIComponent(t.toString())}catch{return e}}(e.url),n=e.cookiesEnabled?"Enabled":"Disabled";return`## Environment\n- **URL**: ${t}\n- **Browser**: ${e.browser.name} ${e.browser.version}\n- **OS**: ${e.os.name} ${e.os.version}\n- **Viewport**: ${e.viewport.width}x${e.viewport.height}\n- **Screen**: ${e.screen.width}x${e.screen.height} @${e.screen.pixelRatio}x\n- **Language**: ${e.language}\n- **Cookies**: ${n}\n- **Timestamp**: ${e.timestamp}`}function a(e){if(!e||0===e.length)return"No errors captured";const t=function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=t.get(n.message);e?(e.count++,e.errors.push(n)):t.set(n.message,{errors:[n],count:1})}return t}(e),n=[];let r=1;return t.forEach(e=>{const t=e.errors[0];if(!t)return;const o=function(e){const t=["TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError"];for(const n of t)if(e.startsWith(n))return n;return"Error"}(t.message),i=[`### Error ${r}`,`**Type**: ${o}`,`**Message**: ${t.message}`];if(e.count>1&&i.push(`**Occurrences**: (occurred ${e.count} times)`),t.stack){const e=function(e,t=20){const n=e.split("\n");if(n.length<=t)return e;const r=n.slice(0,t),o=n.length-t;return r.push(`... (${o} more lines)`),r.join("\n")}(t.stack);i.push(`**Stack trace**:\n\`\`\`\n${e}\n\`\`\``)}i.push(`**Timestamp**: ${t.timestamp}`),n.push(i.join("\n")),r++}),n.join("\n\n")}class s extends Error{constructor(e,t,n){super(e),this.status=t,this.response=n,this.name="GitHubError"}}class p extends s{constructor(e,t,n){super(e,t,n),this.name="GitHubAuthError"}}class c extends s{constructor(e,t,n){super(e,t,n),this.name="GitHubNotFoundError"}}class l extends s{constructor(e,t,n){super(e,t,n),this.name="GitHubValidationError"}}class d extends s{constructor(e,t,n,r){super(e,t,n),this.rateLimit=r,this.name="GitHubRateLimitError"}}class u extends s{constructor(e,t){super(e),this.cause=t,this.name="GitHubNetworkError"}}async function b(e){const{token:t,owner:n,repo:r,title:o,body:i,labels:a}=e,b=`https://api.github.com/repos/${n}/${r}/issues`,h={title:o,body:i};let m;a&&a.length>0&&(h.labels=a);try{m=await fetch(b,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","Content-Type":"application/json"},body:JSON.stringify(h)})}catch(g){throw new u("Network request failed",g instanceof Error?g:void 0)}if(!m.ok){let e;try{e=await m.json()}catch{e={}}const t=e.message||`HTTP ${m.status}`;switch(m.status){case 401:case 403:throw new p(t,m.status,e);case 404:throw new c(t,m.status,e);case 422:throw new l(t,m.status,e);case 429:{const n={limit:parseInt(m.headers.get("X-RateLimit-Limit")||"0",10),remaining:parseInt(m.headers.get("X-RateLimit-Remaining")||"0",10),reset:parseInt(m.headers.get("X-RateLimit-Reset")||"0",10)};throw new d(t,m.status,e,n)}default:throw new s(t,m.status,e)}}const f=await m.json();return{url:f.html_url,number:f.number,id:f.id}}function h(e,t){const n=e.toLowerCase().trim(),r=t.toLowerCase().trim();if(0===n.length&&0===r.length)return 1;if(0===n.length||0===r.length)return 0;const o=function(e,t){if(0===e.length)return t.length;if(0===t.length)return e.length;const n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++)t.charAt(r-1)===e.charAt(o-1)?n[r][o]=n[r-1][o-1]:n[r][o]=Math.min(n[r-1][o-1]+1,n[r][o-1]+1,n[r-1][o]+1);return n[t.length][e.length]}(n,r);return 1-o/Math.max(n.length,r.length)}function m(e){return e instanceof p?"Authentication failed. Check your GitHub token.":e instanceof c?"Repository not found. Check the repo setting.":e instanceof d?"Rate limit exceeded. Please try again later.":e instanceof l?"Invalid issue data. Please check your input.":e instanceof u?"Network error. Check your connection.":e instanceof Error?e.message:"An unknown error occurred."}async function f(e){const{config:t,formValues:n,errors:o}=e;try{const e={url:r(()=>window.location.href,"unknown"),viewport:r(()=>({width:window.innerWidth,height:window.innerHeight}),{width:0,height:0}),screen:r(()=>({width:window.screen.width,height:window.screen.height,pixelRatio:window.devicePixelRatio}),{width:0,height:0,pixelRatio:1}),browser:r(()=>{const e=navigator.userAgentData;if(e?.brands){const t=e.brands;for(const e of t){const t=e.brand.toLowerCase();if(t.includes("chrome")&&!t.includes("chromium"))return{name:"Chrome",version:e.version};if(t.includes("edge"))return{name:"Edge",version:e.version};if(t.includes("opera"))return{name:"Opera",version:e.version}}}return function(e){if(/Edg\//.test(e)){const t=e.match(/Edg\/([\d.]+)/);return{name:"Edge",version:t?.[1]||"unknown"}}if(/OPR\//.test(e)){const t=e.match(/OPR\/([\d.]+)/);return{name:"Opera",version:t?.[1]||"unknown"}}if(/Chrome\//.test(e)&&!/Edg\//.test(e)){const t=e.match(/Chrome\/([\d.]+)/);return{name:"Chrome",version:t?.[1]||"unknown"}}if(/Firefox\//.test(e)){const t=e.match(/Firefox\/([\d.]+)/);return{name:"Firefox",version:t?.[1]||"unknown"}}if(/Safari\//.test(e)&&!/Chrome\//.test(e)){const t=e.match(/Version\/([\d.]+)/);return{name:"Safari",version:t?.[1]||"unknown"}}return{name:"Unknown",version:"unknown"}}(navigator.userAgent)},{name:"Unknown",version:"unknown"}),os:r(()=>function(e){if(/iPhone|iPad|iPod/.test(e)){const t=e.match(/OS ([\d_]+)/);return{name:"iOS",version:t?.[1]?.replace(/_/g,".")||"unknown"}}if(/Windows NT/.test(e)){const t=e.match(/Windows NT ([\d.]+)/),n=t?.[1]||"unknown";return{name:"Windows",version:{"10.0":"10",6.3:"8.1",6.2:"8",6.1:"7"}[n]||n}}if(/Mac OS X/.test(e)){const t=e.match(/Mac OS X ([\d_]+)/);return{name:"macOS",version:t?.[1]?.replace(/_/g,".")||"unknown"}}if(/Android/.test(e)){const t=e.match(/Android ([\d.]+)/);return{name:"Android",version:t?.[1]||"unknown"}}return/Linux/.test(e)?{name:"Linux",version:"unknown"}:{name:"Unknown",version:"unknown"}}(navigator.userAgent),{name:"Unknown",version:"unknown"}),timestamp:/* @__PURE__ */(new Date).toISOString(),language:r(()=>navigator.language,"unknown"),cookiesEnabled:r(()=>navigator.cookieEnabled,!1),doNotTrack:r(()=>navigator.doNotTrack,null)},c=function(e,t){return`${{bug:"[Bug]",feature:"[Feature]",question:"[Question]"}[e]} ${t}`}(n.type,n.title),l=function(e){switch(e.type){case"bug":return function(e){return[`## Summary\n${e.description}`,"## Steps to Reproduce\nNot provided","## Expected Behavior\nNot provided","## Actual Behavior\nNot provided",i(e.context),`## Console Errors\n${a(e.errors)}`].join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);case"feature":return function(e){return[`## Summary\n${e.description}`,"## Use Case\nNot provided","## Proposed Solution\nNot provided",i(e.context)].join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);case"question":return function(e){return[`## Question\n${e.description}`,"## Context\nNot provided",i(e.context)].join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);default:throw new Error(`Unknown feedback type: ${e.type}`)}}({type:n.type,title:n.title,description:n.description,context:e,errors:o}),d=["bug"===(s=n.type)?"bug":"feature"===s?"enhancement":"question","beeport","agent-ready"];if(t.endpoint)return async function(e,t){let n;try{n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{return{status:"error",error:"Network error. Check your connection."}}if(!n.ok){const e=await n.json().catch(()=>({}));return{status:"error",error:"string"==typeof e.error?e.error:400===(r=n.status)?"Invalid issue data. Please check your input.":429===r?"Rate limit exceeded. Please try again later.":502===r||503===r?"Service temporarily unavailable. Please try again.":"An unexpected error occurred."}}var r;const o=await n.json();return{status:"success",issueUrl:o.issueUrl,issueNumber:o.issueNumber}}(t.endpoint,{title:c,body:l,labels:d});const{owner:u,repo:m}=function(e){const t=e.split("/");return{owner:t[0]||"",repo:t.slice(1).join("/")}}(t.repo);let f=[];try{f=await async function(e){const{token:t,owner:n,repo:r,title:o}=e;try{const e=`https://api.github.com/repos/${n}/${r}/issues?labels=beeport&state=open`,i=await fetch(e,{method:"GET",headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).map(e=>({number:e.number,title:e.title,url:e.html_url,similarity:h(o,e.title),state:e.state})).filter(e=>e.similarity>.7).sort((e,t)=>t.similarity-e.similarity).slice(0,5):(console.warn(`GitHub API error: ${i.status} ${i.statusText}`),[])}catch(i){return console.warn("Failed to search for duplicate issues:",i),[]}}({token:t.token,owner:u,repo:m,title:c})}catch(p){console.warn("Duplicate search failed, proceeding with submission:",p)}if(f.length>0)return{status:"duplicates_found",candidates:f,pendingSubmission:{title:c,body:l,labels:d,owner:u,repo:m,token:t.token}};const g=await b({token:t.token,owner:u,repo:m,title:c,body:l,labels:d});return{status:"success",issueUrl:g.url,issueNumber:g.number}}catch(p){return{status:"error",error:m(p)}}var s}const g=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,confirmSubmit:async function(e){try{const t=await b({token:e.token,owner:e.owner,repo:e.repo,title:e.title,body:e.body,labels:e.labels});return{status:"success",issueUrl:t.url,issueNumber:t.number}}catch(t){return{status:"error",error:m(t)}}},submitFeedback:f},Symbol.toStringTag,{value:"Module"}));class x{constructor(n){this.isOpen=!1,this.themeCleanup=null,this.config=n,this.hostElement=document.createElement("div"),this.hostElement.setAttribute("data-beeport-container",""),this.shadowRoot=this.hostElement.attachShadow({mode:"open"}),this.container=document.createElement("div"),this.container.className="beeport-container",this.container.setAttribute("data-open","false"),this.applyPosition(n.position??"bottom-right");const r=document.createElement("style");r.textContent='\n /* CSS Custom Properties (theme variables) */\n :host {\n --beeport-z-index: 999999;\n --beeport-spacing-sm: 8px;\n --beeport-spacing-md: 16px;\n --beeport-spacing-lg: 24px;\n --beeport-border-radius: 8px;\n --beeport-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n\n /* Typography */\n --beeport-font-size-sm: 12px;\n --beeport-font-size-md: 14px;\n --beeport-font-size-lg: 16px;\n --beeport-font-weight-normal: 400;\n --beeport-font-weight-medium: 500;\n --beeport-font-weight-bold: 600;\n\n /* Transitions */\n --beeport-transition-speed: 200ms;\n --beeport-transition-easing: ease-in-out;\n }\n\n /* Light theme colors */\n .beeport-container[data-theme="light"] {\n /* Base colors */\n --beeport-bg-primary: #ffffff;\n --beeport-bg-secondary: #f5f5f5;\n --beeport-text-primary: #1f2937;\n --beeport-text-secondary: #6b7280;\n --beeport-border-color: #d1d5db;\n --beeport-accent: #2563eb;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #1d4ed8;\n --beeport-button-primary-active: #1e40af;\n --beeport-button-disabled-bg: #e5e7eb;\n --beeport-button-disabled-text: #4b5563;\n\n /* Input states */\n --beeport-input-bg: #ffffff;\n --beeport-input-border: #9ca3af;\n --beeport-input-focus-border: #2563eb;\n\n /* Status colors */\n --beeport-success: #047857;\n --beeport-error: #dc2626;\n --beeport-warning: #b45309;\n }\n\n /* Dark theme colors */\n .beeport-container[data-theme="dark"] {\n /* Base colors */\n --beeport-bg-primary: #1f2937;\n --beeport-bg-secondary: #111827;\n --beeport-text-primary: #f9fafb;\n --beeport-text-secondary: #9ca3af;\n --beeport-border-color: #6b7280;\n --beeport-accent: #60a5fa;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #2563eb;\n --beeport-button-primary-active: #1d4ed8;\n --beeport-button-disabled-bg: #374151;\n --beeport-button-disabled-text: #d1d5db;\n\n /* Input states */\n --beeport-input-bg: #111827;\n --beeport-input-border: #6b7280;\n --beeport-input-focus-border: #60a5fa;\n\n /* Status colors */\n --beeport-success: #34d399;\n --beeport-error: #f87171;\n --beeport-warning: #fbbf24;\n }\n\n /* Auto theme - respect system preference */\n .beeport-container[data-theme="auto"] {\n /* Base colors */\n --beeport-bg-primary: #ffffff;\n --beeport-bg-secondary: #f5f5f5;\n --beeport-text-primary: #1f2937;\n --beeport-text-secondary: #6b7280;\n --beeport-border-color: #d1d5db;\n --beeport-accent: #2563eb;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #1d4ed8;\n --beeport-button-primary-active: #1e40af;\n --beeport-button-disabled-bg: #e5e7eb;\n --beeport-button-disabled-text: #4b5563;\n\n /* Input states */\n --beeport-input-bg: #ffffff;\n --beeport-input-border: #9ca3af;\n --beeport-input-focus-border: #2563eb;\n\n /* Status colors */\n --beeport-success: #047857;\n --beeport-error: #dc2626;\n --beeport-warning: #b45309;\n }\n\n @media (prefers-color-scheme: dark) {\n .beeport-container[data-theme="auto"] {\n /* Base colors */\n --beeport-bg-primary: #1f2937;\n --beeport-bg-secondary: #111827;\n --beeport-text-primary: #f9fafb;\n --beeport-text-secondary: #9ca3af;\n --beeport-border-color: #6b7280;\n --beeport-accent: #60a5fa;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #2563eb;\n --beeport-button-primary-active: #1d4ed8;\n --beeport-button-disabled-bg: #374151;\n --beeport-button-disabled-text: #d1d5db;\n\n /* Input states */\n --beeport-input-bg: #111827;\n --beeport-input-border: #6b7280;\n --beeport-input-focus-border: #60a5fa;\n\n /* Status colors */\n --beeport-success: #34d399;\n --beeport-error: #f87171;\n --beeport-warning: #fbbf24;\n }\n }\n\n /* Container base styles */\n .beeport-container {\n position: fixed;\n z-index: var(--beeport-z-index);\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n font-size: 14px;\n line-height: 1.5;\n box-sizing: border-box;\n }\n\n .beeport-container *,\n .beeport-container *::before,\n .beeport-container *::after {\n box-sizing: border-box;\n }\n\n /* Reset button styles for future components */\n .beeport-container button {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n cursor: pointer;\n }\n\n /* Feedback button - floating action button */\n .beeport-feedback-button {\n position: relative;\n width: 56px;\n height: 56px;\n border-radius: 50%;\n background: linear-gradient(135deg, #FFC107 0%, #F59E0B 50%, #D97706 100%);\n color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n border: none;\n cursor: pointer;\n outline: none;\n }\n\n .beeport-feedback-button:hover {\n background: linear-gradient(135deg, #FFD54F 0%, #FFC107 50%, #F59E0B 100%);\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);\n }\n\n .beeport-feedback-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-feedback-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-feedback-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-feedback-button:active {\n background: linear-gradient(135deg, #F59E0B 0%, #D97706 50%, #B45309 100%);\n transform: translateY(0);\n }\n\n .beeport-feedback-button svg {\n width: 28px;\n height: 28px;\n pointer-events: none;\n filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));\n }\n ',this.shadowRoot.appendChild(r),this.shadowRoot.appendChild(this.container),this.feedbackButton=this.createFeedbackButton(),this.container.appendChild(this.feedbackButton),this.form=t(this.container,{onSubmit:()=>{this.handleSubmit()},onCancel:()=>{this.isOpen&&this.toggleOpen()}}),document.body.appendChild(this.hostElement),this.themeCleanup=e(this.container,n.theme??"auto")}applyPosition(e){this.container.style.position="fixed",this.container.style.bottom="20px","bottom-right"===e?this.container.style.right="20px":this.container.style.left="20px"}createFeedbackButton(){const e=document.createElement("button");return e.className="beeport-feedback-button",e.setAttribute("aria-label","Send feedback"),e.setAttribute("aria-expanded","false"),e.setAttribute("tabindex","0"),this.updateButtonIcon(e,!1),e.addEventListener("click",e=>{e.stopPropagation(),this.toggleOpen()}),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggleOpen())}),e}async handleSubmit(){if(!this.form.validate().valid)return;const e=this.form.getValues(),t=await f({config:this.config,formValues:e});if("success"===t.status)this.form.reset(),this.toggleOpen(),console.log(`[BeePort] Issue created: ${t.issueUrl}`);else if("duplicates_found"===t.status){console.log("[BeePort] Potential duplicates found, submitting anyway");const{confirmSubmit:e}=await Promise.resolve().then(()=>g),n=await e(t.pendingSubmission);"success"===n.status?(this.form.reset(),this.toggleOpen(),console.log(`[BeePort] Issue created: ${n.issueUrl}`)):"error"===n.status&&console.error(`[BeePort] Submit failed: ${n.error}`)}else"error"===t.status&&console.error(`[BeePort] Submit failed: ${t.error}`)}toggleOpen(){this.isOpen=!this.isOpen,this.container.setAttribute("data-open",String(this.isOpen)),this.feedbackButton.setAttribute("aria-expanded",String(this.isOpen)),this.updateButtonIcon(this.feedbackButton,this.isOpen),this.isOpen?this.form.show():this.form.hide();const e=new CustomEvent("beeport:toggle",{detail:{open:this.isOpen},bubbles:!0,composed:!0});this.hostElement.dispatchEvent(e)}updateButtonIcon(e,t){if(e.textContent="",t){const t=this.createSVGElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"}),n=this.createSVGElement("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"});t.appendChild(n),e.appendChild(t)}else{const t=this.createSVGElement("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none"}),n=this.createSVGElement("ellipse",{cx:"14",cy:"15",rx:"6",ry:"7.5",fill:"#FFC107",stroke:"currentColor","stroke-width":"1.5"}),r=this.createSVGElement("path",{d:"M8.5 13.5 Q14 12 19.5 13.5",stroke:"#1a1a1a","stroke-width":"1.8","stroke-linecap":"round",fill:"none"}),o=this.createSVGElement("path",{d:"M8.2 16.5 Q14 15 19.8 16.5",stroke:"#1a1a1a","stroke-width":"1.8","stroke-linecap":"round",fill:"none"}),i=this.createSVGElement("ellipse",{cx:"9.5",cy:"9",rx:"3.5",ry:"4",fill:"rgba(255,255,255,0.7)",stroke:"currentColor","stroke-width":"1",transform:"rotate(-15 9.5 9)"}),a=this.createSVGElement("ellipse",{cx:"18.5",cy:"9",rx:"3.5",ry:"4",fill:"rgba(255,255,255,0.7)",stroke:"currentColor","stroke-width":"1",transform:"rotate(15 18.5 9)"}),s=this.createSVGElement("circle",{cx:"14",cy:"7.5",r:"3",fill:"#1a1a1a"}),p=this.createSVGElement("circle",{cx:"12.8",cy:"7",r:"0.8",fill:"white"}),c=this.createSVGElement("circle",{cx:"15.2",cy:"7",r:"0.8",fill:"white"}),l=this.createSVGElement("path",{d:"M12.5 5 Q11 2.5 9.5 2",stroke:"#1a1a1a","stroke-width":"1.2","stroke-linecap":"round",fill:"none"}),d=this.createSVGElement("path",{d:"M15.5 5 Q17 2.5 18.5 2",stroke:"#1a1a1a","stroke-width":"1.2","stroke-linecap":"round",fill:"none"}),u=this.createSVGElement("circle",{cx:"9.3",cy:"1.8",r:"1",fill:"#FFC107"}),b=this.createSVGElement("circle",{cx:"18.7",cy:"1.8",r:"1",fill:"#FFC107"}),h=this.createSVGElement("path",{d:"M14 22.5 L14 24.5",stroke:"#1a1a1a","stroke-width":"1.5","stroke-linecap":"round"});t.appendChild(i),t.appendChild(a),t.appendChild(n),t.appendChild(r),t.appendChild(o),t.appendChild(s),t.appendChild(p),t.appendChild(c),t.appendChild(l),t.appendChild(d),t.appendChild(u),t.appendChild(b),t.appendChild(h),e.appendChild(t)}}createSVGElement(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg",e);for(const[r,o]of Object.entries(t))n.setAttribute(r,o);return n}show(){this.hostElement.style.display=""}hide(){this.hostElement.style.display="none"}destroy(){this.form.destroy(),this.themeCleanup&&(this.themeCleanup(),this.themeCleanup=null),this.hostElement.parentNode&&this.hostElement.parentNode.removeChild(this.hostElement)}setTheme(t){this.themeCleanup&&this.themeCleanup(),this.themeCleanup=e(this.container,t)}getContainer(){return this.container}}let y=null,v=null;function w(e){if(function(e){const t=e.endpoint&&""!==e.endpoint.trim(),n=e.token&&""!==e.token.trim();if(t&&n)throw new Error("Cannot use both endpoint and token. Choose one mode.");if(!t){if(!e.repo)throw new Error("repo is required (or use endpoint for proxy mode)");if(!e.repo.includes("/")||2!==e.repo.split("/").length)throw new Error('repo must be in format "owner/repo"');if(!n)throw new Error("token is required (or use endpoint for proxy mode)")}}(e),y&&v)return v;const t={...e,position:e.position??"bottom-right",theme:e.theme??"auto"};var n;return y=new x(t),n=y,v={show:()=>n.show(),hide:()=>n.hide(),destroy:()=>{n.destroy(),y=null,v=null},setTheme:e=>n.setTheme(e)},v}function k(){y&&(y.destroy(),y=null,v=null)}export{k as destroy,w as init};
1
+ function e(e,t){if(e.setAttribute("data-theme",t),"auto"!==t)return()=>{};if("undefined"==typeof window||!window.matchMedia)return()=>{};const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{};n.addEventListener("change",r);let o=!1;return()=>{o||(n.removeEventListener("change",r),o=!0)}}const t=["image/png","image/jpeg","image/webp"],n=1920;function r(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function o(e){return new Promise(t=>{const r=new Image;r.onload=()=>{if(r.width<=n&&r.height<=n)return void t(e);const o=n/Math.max(r.width,r.height),i=document.createElement("canvas");i.width=Math.round(r.width*o),i.height=Math.round(r.height*o),i.getContext("2d").drawImage(r,0,0,i.width,i.height),t(i.toDataURL("image/jpeg",.85))},r.onerror=()=>t(e),r.src=e})}function i(e,n,i){const s=document.createElement("div");s.className="beeport-form-panel",s.style.display="none",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true");const p=document.createElement("div");p.className="beeport-form-header";const c=document.createElement("h3");c.className="beeport-form-title",c.id="beeport-form-title",c.textContent="Report to BeePort";const l=document.createElement("p");l.className="beeport-form-subtitle",l.textContent="Help us fix bugs and shape features in under a minute.",s.setAttribute("aria-labelledby","beeport-form-title");const d=document.createElement("button");d.className="beeport-form-close",d.textContent="×",d.setAttribute("aria-label","Close");const u=document.createElement("div");u.className="beeport-form-heading",u.appendChild(c),u.appendChild(l),p.appendChild(u),p.appendChild(d);const b=document.createElement("p");b.className="beeport-type-legend",b.textContent="What are you sharing?";const h=document.createElement("div");h.className="beeport-type-selector",h.setAttribute("role","tablist"),h.setAttribute("aria-label","Select feedback type");const m=a("bug","Bug report",!0),f=a("feature","Feature idea",!1);h.appendChild(m),h.appendChild(f);const g=document.createElement("div");g.className="beeport-input-wrapper";const x=document.createElement("label");x.textContent="Title",x.htmlFor="beeport-title-input",x.className="beeport-input-label";const v=document.createElement("input");v.type="text",v.id="beeport-title-input",v.className="beeport-input-title",v.placeholder="Example: Save button does nothing on Safari";const y=document.createElement("div");y.className="beeport-input-hint beeport-input-hint-title",y.textContent="Use a short summary (3+ characters).";const w=document.createElement("div");w.id="beeport-title-error",w.className="beeport-error-message",w.setAttribute("role","alert"),g.appendChild(x),g.appendChild(v),g.appendChild(y),g.appendChild(w);const k=document.createElement("div");k.className="beeport-input-wrapper";const E=document.createElement("label");E.textContent="Description",E.htmlFor="beeport-description-input",E.className="beeport-input-label";const C=document.createElement("textarea");C.id="beeport-description-input",C.className="beeport-input-description",C.placeholder="What happened? What did you expect instead? Include steps to reproduce.",C.maxLength=1e3,C.rows=5;const S=document.createElement("div");S.className="beeport-input-hint beeport-input-hint-description",S.textContent="Include context, expected result, and actual result (10+ characters).";const A=document.createElement("div");A.className="beeport-char-counter",A.textContent="0/1000 characters";const N=document.createElement("div");N.className="beeport-description-meta",N.appendChild(S),N.appendChild(A);const L=document.createElement("div");L.id="beeport-description-error",L.className="beeport-error-message",L.setAttribute("role","alert"),k.appendChild(E),k.appendChild(C),k.appendChild(N),k.appendChild(L);const $=document.createElement("div");$.className="beeport-status-message",$.setAttribute("aria-live","polite"),$.setAttribute("aria-atomic","true"),$.textContent="";const z=document.createElement("div");z.className="beeport-form-buttons";const B=document.createElement("button");B.className="beeport-cancel-button",B.textContent="Not now";const P=document.createElement("button");P.className="beeport-submit-button",P.textContent="Create Issue",z.appendChild(B),z.appendChild(P);const F=document.createElement("div");F.className="beeport-form-footer";const O=document.createElement("a");O.href="https://beeport.ai",O.target="_blank",O.rel="noopener noreferrer",O.className="beeport-footer-link";const R=document.createElement("span");R.className="beeport-footer-bee",R.textContent="🐝";const j=document.createElement("span");j.className="beeport-footer-text",j.textContent="Powered by ";const G=document.createElement("span");G.className="beeport-footer-brand",G.textContent="BeePort",O.appendChild(R),O.appendChild(j),O.appendChild(G),F.appendChild(O),s.appendChild(p),s.appendChild(b),s.appendChild(h),s.appendChild(g),s.appendChild(k),s.appendChild($),s.appendChild(z),s.appendChild(F);const T=document.createElement("style");T.textContent='\n /* Form Panel */\n .beeport-form-panel {\n position: absolute;\n bottom: 72px;\n right: 0;\n width: min(420px, calc(100vw - 24px));\n max-height: min(80vh, 680px);\n background:\n radial-gradient(circle at top left, rgba(250, 204, 21, 0.18), transparent 55%),\n var(--beeport-bg-primary);\n border: 1px solid rgba(245, 158, 11, 0.32);\n border-radius: 18px;\n box-shadow: 0 20px 44px rgba(17, 24, 39, 0.28), 0 6px 18px rgba(17, 24, 39, 0.16);\n padding: 0;\n color: var(--beeport-text-primary);\n font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;\n overflow-y: auto;\n overflow-x: hidden;\n animation: beeport-form-enter 160ms cubic-bezier(0.22, 1, 0.36, 1);\n }\n\n /* Scrollbar styling */\n .beeport-form-panel::-webkit-scrollbar {\n width: 6px;\n }\n .beeport-form-panel::-webkit-scrollbar-track {\n background: transparent;\n }\n .beeport-form-panel::-webkit-scrollbar-thumb {\n background: rgba(107, 114, 128, 0.3);\n border-radius: 3px;\n }\n .beeport-form-panel::-webkit-scrollbar-thumb:hover {\n background: rgba(107, 114, 128, 0.5);\n }\n\n /* Mobile responsive */\n @media (max-width: 500px) {\n .beeport-form-panel {\n right: 8px;\n bottom: 72px;\n width: calc(100vw - 16px);\n max-height: calc(100vh - 96px);\n border-radius: 14px;\n }\n }\n\n /* Header */\n .beeport-form-header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n padding: 18px 18px 14px;\n border-bottom: 1px solid rgba(245, 158, 11, 0.2);\n background: linear-gradient(180deg, rgba(250, 204, 21, 0.15) 0%, transparent 100%);\n }\n\n .beeport-form-heading {\n min-width: 0;\n flex: 1;\n }\n\n .beeport-form-title {\n margin: 0;\n font-size: 20px;\n font-weight: 700;\n color: var(--beeport-text-primary);\n line-height: 1.2;\n }\n\n .beeport-form-subtitle {\n margin: 6px 0 0;\n font-size: 12px;\n line-height: 1.4;\n color: var(--beeport-text-secondary);\n max-width: 32ch;\n }\n\n .beeport-form-close {\n background: var(--beeport-bg-secondary);\n border: 1px solid rgba(245, 158, 11, 0.3);\n font-size: 17px;\n line-height: 1;\n color: var(--beeport-text-primary);\n cursor: pointer;\n padding: 2px;\n width: 30px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n font-family: inherit;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-form-close:hover {\n border-color: #f59e0b;\n background: rgba(245, 158, 11, 0.18);\n transform: rotate(90deg);\n }\n\n .beeport-form-close:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-form-close:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-form-close:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-type-legend {\n margin: 12px 18px 8px;\n color: var(--beeport-text-secondary);\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.01em;\n }\n\n /* Type Selector */\n .beeport-type-selector {\n display: flex;\n gap: 8px;\n margin: 0 18px 14px;\n padding: 5px;\n min-height: 62px;\n border: 1px solid rgba(245, 158, 11, 0.28);\n border-radius: 12px;\n background: var(--beeport-bg-secondary);\n }\n\n .beeport-type-button {\n flex: 1;\n padding: 9px 10px;\n min-height: 52px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n border-radius: 9px;\n color: var(--beeport-text-secondary);\n font-size: 12px;\n font-weight: 700;\n font-family: inherit;\n letter-spacing: 0.01em;\n text-transform: none;\n cursor: pointer;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-type-button:last-child {\n border-right: 0;\n }\n\n .beeport-type-button:hover {\n background: rgba(245, 158, 11, 0.1);\n color: var(--beeport-text-primary);\n }\n\n .beeport-type-button.active {\n background: linear-gradient(135deg, #f59e0b, #facc15);\n color: #111827;\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);\n }\n\n .beeport-type-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: -2px;\n }\n\n .beeport-type-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-type-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: -2px;\n }\n\n /* Input Wrapper */\n .beeport-input-wrapper {\n position: relative;\n padding: 0 18px 14px;\n border-bottom: none;\n }\n\n /* Input Label */\n .beeport-input-label {\n display: block;\n margin-bottom: 6px;\n color: var(--beeport-text-secondary);\n font-size: 11px;\n font-weight: 600;\n font-family: inherit;\n letter-spacing: 0.01em;\n }\n\n /* Input and Textarea */\n .beeport-input-title,\n .beeport-input-description {\n width: 100%;\n padding: 10px 12px;\n background: var(--beeport-input-bg);\n border: 1px solid rgba(107, 114, 128, 0.45);\n border-radius: 11px;\n color: var(--beeport-text-primary);\n font-size: 14px;\n font-family: inherit;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n box-sizing: border-box;\n }\n\n .beeport-input-title::placeholder,\n .beeport-input-description::placeholder {\n color: var(--beeport-text-secondary);\n opacity: 0.8;\n }\n\n .beeport-input-title:focus,\n .beeport-input-description:focus {\n outline: none;\n border-color: #f59e0b;\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);\n }\n\n .beeport-input-title:focus:not(:focus-visible),\n .beeport-input-description:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-input-title:focus-visible,\n .beeport-input-description:focus-visible {\n outline: none;\n border-color: #f59e0b;\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);\n }\n\n .beeport-input-description {\n resize: vertical;\n min-height: 108px;\n max-height: 240px;\n }\n\n /* Error state */\n .beeport-input-title.error,\n .beeport-input-description.error {\n border-color: #dc2626;\n box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.16);\n }\n\n .beeport-input-hint {\n margin-top: 7px;\n font-size: 11px;\n color: var(--beeport-text-secondary);\n line-height: 1.3;\n }\n\n .beeport-error-message {\n color: #dc2626;\n font-size: 12px;\n margin-top: 6px;\n min-height: 16px;\n }\n\n /* Status Message (Live Region) */\n .beeport-status-message {\n margin: 0 18px 14px;\n padding: 8px 10px;\n border-radius: 10px;\n font-size: var(--beeport-font-size-sm);\n min-height: 0;\n }\n\n .beeport-status-message:empty {\n display: none;\n }\n\n .beeport-status-message.success {\n background-color: #d1fae5;\n color: #065f46;\n border: 1px solid #10b981;\n }\n\n .beeport-status-message.error {\n background-color: #fee2e2;\n color: #991b1b;\n border: 1px solid #dc2626;\n }\n\n .beeport-description-meta {\n margin-top: 7px;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 8px;\n }\n\n .beeport-description-meta .beeport-input-hint {\n flex: 1;\n min-width: 0;\n }\n\n /* Character Counter */\n .beeport-char-counter {\n font-size: 11px;\n font-family: inherit;\n color: var(--beeport-text-secondary);\n opacity: 0.8;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transition: color var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-char-counter.warning {\n color: #b45309;\n }\n\n .beeport-char-counter.limit {\n color: #dc2626;\n font-weight: 700;\n }\n\n /* Form Buttons */\n .beeport-form-buttons {\n display: flex;\n gap: 10px;\n padding: 4px 18px 18px;\n }\n\n .beeport-form-buttons .beeport-cancel-button,\n .beeport-form-buttons .beeport-submit-button {\n flex: 1;\n }\n\n .beeport-cancel-button,\n .beeport-submit-button {\n padding: 12px 32px;\n min-height: 48px;\n border-radius: 12px;\n font-size: 14px;\n font-weight: 700;\n font-family: inherit;\n letter-spacing: 0.02em;\n text-transform: none;\n cursor: pointer;\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-cancel-button {\n background: transparent;\n border: 1px solid rgba(107, 114, 128, 0.45);\n color: var(--beeport-text-primary);\n }\n\n .beeport-cancel-button:hover {\n background: rgba(107, 114, 128, 0.1);\n color: var(--beeport-text-primary);\n border-color: rgba(107, 114, 128, 0.8);\n }\n\n .beeport-cancel-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-cancel-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-cancel-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-submit-button {\n background: #ffffff;\n border: 1px solid #d97706;\n color: #b45309;\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.18);\n }\n\n .beeport-submit-button:hover {\n background: linear-gradient(135deg, #f59e0b, #facc15);\n color: #ffffff;\n text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);\n box-shadow: 0 8px 16px rgba(245, 158, 11, 0.34);\n transform: translateY(-1px);\n }\n\n .beeport-submit-button:active {\n background: #f59e0b;\n color: #ffffff;\n text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);\n border-color: #B45309;\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.28);\n transform: translateY(0);\n }\n\n .beeport-submit-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-submit-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-submit-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n /* Footer Branding */\n .beeport-form-footer {\n padding: 10px 16px 14px;\n text-align: center;\n background: linear-gradient(180deg, transparent 0%, rgba(245, 158, 11, 0.08) 100%);\n }\n\n .beeport-footer-link {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n text-decoration: none;\n color: var(--beeport-text-secondary);\n font-size: 11px;\n font-family: inherit;\n letter-spacing: 0.02em;\n transition: color var(--beeport-transition-speed) var(--beeport-transition-easing);\n }\n\n .beeport-footer-link:hover {\n color: var(--beeport-text-primary);\n }\n\n .beeport-footer-link:hover .beeport-footer-brand {\n text-decoration: underline;\n }\n\n .beeport-footer-bee {\n font-size: 11px;\n line-height: 1;\n }\n\n .beeport-footer-text {\n opacity: 0.5;\n }\n\n .beeport-footer-brand {\n font-weight: 700;\n color: #F59E0B;\n letter-spacing: 0.02em;\n }\n\n @keyframes beeport-form-enter {\n from {\n opacity: 0;\n transform: translateY(8px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n }\n ',e.appendChild(T),e.appendChild(s);const I=function(e,n){const i=[],a=document.createElement("div");a.className="beeport-screenshot-area";const s=document.createElement("div");s.className="beeport-drop-zone",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Upload screenshots");const p=document.createElement("input");p.type="file",p.accept=t.join(","),p.multiple=!0,p.className="beeport-screenshot-input",p.setAttribute("aria-hidden","true"),p.tabIndex=-1;const c=document.createElement("span");c.className="beeport-drop-zone-text",c.textContent="Drop images or click to upload";const l=document.createElement("span");l.className="beeport-drop-zone-hint",l.textContent=`PNG, JPEG, WebP. Max ${r(n.maxFileSize)} each.`,s.appendChild(p),s.appendChild(c),s.appendChild(l);const d=document.createElement("div");d.className="beeport-screenshot-previews";const u=document.createElement("div");u.className="beeport-screenshot-error",u.setAttribute("role","alert"),a.appendChild(s),a.appendChild(d),a.appendChild(u);const b=document.createElement("style");b.textContent="\n .beeport-screenshot-area {\n padding: 4px 18px 14px;\n }\n .beeport-drop-zone {\n border: 2px dashed rgba(107, 114, 128, 0.4);\n border-radius: 11px;\n padding: 14px;\n text-align: center;\n cursor: pointer;\n transition: all var(--beeport-transition-speed, 150ms) var(--beeport-transition-easing, ease);\n background: var(--beeport-input-bg, transparent);\n }\n .beeport-drop-zone:hover,\n .beeport-drop-zone.dragover {\n border-color: #f59e0b;\n background: rgba(245, 158, 11, 0.08);\n }\n .beeport-drop-zone:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border, #f59e0b);\n outline-offset: 2px;\n }\n .beeport-drop-zone-text {\n display: block;\n font-size: 12px;\n font-weight: 600;\n color: var(--beeport-text-secondary, #6b7280);\n margin-bottom: 3px;\n }\n .beeport-drop-zone-hint {\n display: block;\n font-size: 11px;\n color: var(--beeport-text-secondary, #6b7280);\n opacity: 0.7;\n }\n .beeport-screenshot-input { display: none; }\n .beeport-screenshot-previews {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-top: 10px;\n }\n .beeport-screenshot-previews:empty { margin-top: 0; }\n .beeport-preview-item {\n position: relative;\n width: 72px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid rgba(107, 114, 128, 0.3);\n }\n .beeport-preview-thumb {\n width: 72px;\n height: 72px;\n object-fit: cover;\n display: block;\n }\n .beeport-preview-remove {\n position: absolute;\n top: 2px;\n right: 2px;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.6);\n color: white;\n font-size: 13px;\n line-height: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n cursor: pointer;\n padding: 0;\n }\n .beeport-preview-remove:hover { background: rgba(220, 38, 38, 0.9); }\n .beeport-preview-remove:focus-visible {\n outline: 2px solid white;\n outline-offset: 1px;\n }\n .beeport-screenshot-error {\n color: #dc2626;\n font-size: 12px;\n margin-top: 6px;\n min-height: 0;\n }\n .beeport-screenshot-error:empty { display: none; }\n ",e.appendChild(b);const h=e.querySelector(".beeport-status-message");function m(e){u.textContent=e,setTimeout(()=>{u.textContent=""},4e3)}function f(e){const t=document.createElement("div");t.className="beeport-preview-item";const n=document.createElement("img");n.className="beeport-preview-thumb",n.src=e.dataUrl,n.alt=e.name;const r=document.createElement("button");r.className="beeport-preview-remove",r.textContent="×",r.setAttribute("aria-label",`Remove screenshot: ${e.name}`),r.addEventListener("click",()=>{const n=i.indexOf(e);-1!==n&&i.splice(n,1),t.remove(),g()}),t.appendChild(n),t.appendChild(r),d.appendChild(t)}function g(){s.style.display=i.length>=n.maxFiles?"none":""}async function x(e){for(const a of Array.from(e)){if(i.length>=n.maxFiles){m(`Maximum ${n.maxFiles} screenshots allowed.`);break}if(!t.includes(a.type)){m(`${a.name}: unsupported format. Use PNG, JPEG, or WebP.`);continue}if(a.size>n.maxFileSize){m(`${a.name}: exceeds ${r(n.maxFileSize)} limit.`);continue}const e=await v(a),s=await o(e),p={name:a.name,type:a.type,size:a.size,dataUrl:s};i.push(p),f(p),g()}}function v(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(e)})}h?e.insertBefore(a,h):e.appendChild(a),s.addEventListener("click",e=>{e.target!==p&&p.click()}),s.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p.click())}),p.addEventListener("change",()=>{p.files&&(x(p.files),p.value="")}),s.addEventListener("dragover",e=>{e.preventDefault(),s.classList.add("dragover")}),s.addEventListener("dragleave",()=>{s.classList.remove("dragover")}),s.addEventListener("drop",e=>{e.preventDefault(),s.classList.remove("dragover"),e.dataTransfer?.files&&x(e.dataTransfer.files)});const y=e=>{const n=e.clipboardData?.items;if(!n)return;const r=[];for(const o of Array.from(n))if("file"===o.kind&&t.includes(o.type)){const e=o.getAsFile();e&&r.push(e)}r.length>0&&(e.preventDefault(),x(r))};return e.addEventListener("paste",y),{getScreenshots:()=>[...i],reset(){for(i.length=0;d.firstChild;)d.removeChild(d.firstChild);u.textContent="",g()},destroy(){e.removeEventListener("paste",y),a.remove(),b.remove()}}}(s,{maxFiles:i?.maxScreenshots??3,maxFileSize:i?.maxFileSize??5242880});let U="bug",M=null;const V=e=>{U=e,[m,f].forEach(t=>{t.dataset.type===e?(t.classList.add("active"),t.setAttribute("aria-selected","true")):(t.classList.remove("active"),t.setAttribute("aria-selected","false"))})},D=()=>{n?.onCancel&&n.onCancel()},H=e=>{const t=e.target;"block"!==s.style.display||s.contains(t)||(s.style.display="none",_())},_=()=>{M&&(M.focus(),M=null)};return m.addEventListener("click",()=>V("bug")),f.addEventListener("click",()=>V("feature")),C.addEventListener("input",()=>{const e=C.value.length;A.textContent=`${e}/1000 characters`,A.classList.toggle("warning",e>=900&&e<1e3),A.classList.toggle("limit",e>=1e3)}),P.addEventListener("click",()=>{n?.onSubmit&&n.onSubmit()}),B.addEventListener("click",D),d.addEventListener("click",D),s.addEventListener("keydown",e=>{if("Escape"===e.key)return s.style.display="none",void _();if("Tab"===e.key){const t=(()=>{const e=s.querySelectorAll(["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(","));return Array.from(e)})();if(0===t.length)return;const n=t[0],r=t[t.length-1];e.shiftKey?document.activeElement===n&&r&&(e.preventDefault(),r.focus()):document.activeElement===r&&n&&(e.preventDefault(),n.focus())}}),e.addEventListener("click",H),{show(){M=document.activeElement,s.style.display="block",v.focus()},hide(){s.style.display="none",_()},reset(){v.value="",C.value="",U="bug",V("bug"),A.textContent="0/1000 characters",A.classList.remove("warning","limit"),I.reset(),v.classList.remove("error"),C.classList.remove("error"),v.removeAttribute("aria-invalid"),C.removeAttribute("aria-invalid"),v.removeAttribute("aria-describedby"),C.removeAttribute("aria-describedby"),w.textContent="",L.textContent=""},destroy(){I.destroy(),e.removeEventListener("click",H),s.remove(),T.remove()},getValues:()=>({type:U,title:v.value,description:C.value,screenshots:I.getScreenshots()}),validate:()=>(()=>{const e={},t=v.value.trim(),n=C.value.trim();return v.classList.remove("error"),C.classList.remove("error"),v.removeAttribute("aria-invalid"),C.removeAttribute("aria-invalid"),v.removeAttribute("aria-describedby"),C.removeAttribute("aria-describedby"),w.textContent="",L.textContent="",0===t.length?e.title="Title is required":t.length<3&&(e.title="Title must be at least 3 characters"),0===n.length?e.description="Description is required":n.length<10&&(e.description="Description must be at least 10 characters"),e.title&&(v.classList.add("error"),v.setAttribute("aria-invalid","true"),v.setAttribute("aria-describedby","beeport-title-error"),w.textContent=e.title),e.description&&(C.classList.add("error"),C.setAttribute("aria-invalid","true"),C.setAttribute("aria-describedby","beeport-description-error"),L.textContent=e.description),{valid:0===Object.keys(e).length,errors:e}})()}}function a(e,t,n){const r=document.createElement("button");return r.className="beeport-type-button",r.dataset.type=e,r.textContent=t,r.setAttribute("role","tab"),r.setAttribute("aria-selected",String(n)),r.setAttribute("aria-label",{bug:"Report a bug",feature:"Request a feature",question:"Ask a question"}[e]),n&&r.classList.add("active"),r}function s(e,t){try{return e()}catch{return t}}const p=["token","key","secret","password","auth","session","api_key","access_token"];function c(e){const t=function(e){try{const t=new URL(e),n=t.searchParams;return n.forEach((e,t)=>{const r=t.toLowerCase();p.some(e=>r.includes(e))&&n.set(t,"[REDACTED]")}),decodeURIComponent(t.toString())}catch{return e}}(e.url),n=e.cookiesEnabled?"Enabled":"Disabled";return`## Environment\n- **URL**: ${t}\n- **Browser**: ${e.browser.name} ${e.browser.version}\n- **OS**: ${e.os.name} ${e.os.version}\n- **Viewport**: ${e.viewport.width}x${e.viewport.height}\n- **Screen**: ${e.screen.width}x${e.screen.height} @${e.screen.pixelRatio}x\n- **Language**: ${e.language}\n- **Cookies**: ${n}\n- **Timestamp**: ${e.timestamp}`}function l(e){if(!e||0===e.length)return"No errors captured";const t=function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=t.get(n.message);e?(e.count++,e.errors.push(n)):t.set(n.message,{errors:[n],count:1})}return t}(e),n=[];let r=1;return t.forEach(e=>{const t=e.errors[0];if(!t)return;const o=function(e){const t=["TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError"];for(const n of t)if(e.startsWith(n))return n;return"Error"}(t.message),i=[`### Error ${r}`,`**Type**: ${o}`,`**Message**: ${t.message}`];if(e.count>1&&i.push(`**Occurrences**: (occurred ${e.count} times)`),t.stack){const e=function(e,t=20){const n=e.split("\n");if(n.length<=t)return e;const r=n.slice(0,t),o=n.length-t;return r.push(`... (${o} more lines)`),r.join("\n")}(t.stack);i.push(`**Stack trace**:\n\`\`\`\n${e}\n\`\`\``)}i.push(`**Timestamp**: ${t.timestamp}`),n.push(i.join("\n")),r++}),n.join("\n\n")}function d(e){return e&&0!==e.length?`## Screenshots\n${e.map((e,t)=>`![Screenshot ${t+1}: ${e.name}](${e.url})`).join("\n\n")}`:""}class u extends Error{constructor(e,t,n){super(e),this.status=t,this.response=n,this.name="GitHubError"}}class b extends u{constructor(e,t,n){super(e,t,n),this.name="GitHubAuthError"}}class h extends u{constructor(e,t,n){super(e,t,n),this.name="GitHubNotFoundError"}}class m extends u{constructor(e,t,n){super(e,t,n),this.name="GitHubValidationError"}}class f extends u{constructor(e,t,n,r){super(e,t,n),this.rateLimit=r,this.name="GitHubRateLimitError"}}class g extends u{constructor(e,t){super(e),this.cause=t,this.name="GitHubNetworkError"}}async function x(e){const{token:t,owner:n,repo:r,title:o,body:i,labels:a}=e,s=`https://api.github.com/repos/${n}/${r}/issues`,p={title:o,body:i};let c;a&&a.length>0&&(p.labels=a);try{c=await fetch(s,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","Content-Type":"application/json"},body:JSON.stringify(p)})}catch(d){throw new g("Network request failed",d instanceof Error?d:void 0)}if(!c.ok){let e;try{e=await c.json()}catch{e={}}const t=e.message||`HTTP ${c.status}`;switch(c.status){case 401:case 403:throw new b(t,c.status,e);case 404:throw new h(t,c.status,e);case 422:throw new m(t,c.status,e);case 429:{const n={limit:parseInt(c.headers.get("X-RateLimit-Limit")||"0",10),remaining:parseInt(c.headers.get("X-RateLimit-Remaining")||"0",10),reset:parseInt(c.headers.get("X-RateLimit-Reset")||"0",10)};throw new f(t,c.status,e,n)}default:throw new u(t,c.status,e)}}const l=await c.json();return{url:l.html_url,number:l.number,id:l.id}}function v(e,t){const n=e.toLowerCase().trim(),r=t.toLowerCase().trim();if(0===n.length&&0===r.length)return 1;if(0===n.length||0===r.length)return 0;const o=function(e,t){if(0===e.length)return t.length;if(0===t.length)return e.length;const n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++)t.charAt(r-1)===e.charAt(o-1)?n[r][o]=n[r-1][o-1]:n[r][o]=Math.min(n[r-1][o-1]+1,n[r][o-1]+1,n[r-1][o]+1);return n[t.length][e.length]}(n,r);return 1-o/Math.max(n.length,r.length)}async function y(e,t){return 0===t.length?[]:e?(await Promise.all(t.map(async t=>{try{const n=await async function(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,type:t.type,data:t.dataUrl})});if(!n.ok)throw new Error(`Screenshot upload failed: ${n.status}`);return(await n.json()).url}(e,t);return{name:t.name,url:n}}catch(n){return console.warn(`[BeePort] Failed to upload ${t.name}:`,n),null}}))).filter(e=>null!==e):(console.warn("[BeePort] Screenshots require uploadEndpoint. Screenshots will be omitted."),[])}function w(e){return e instanceof b?"Authentication failed. Check your GitHub token.":e instanceof h?"Repository not found. Check the repo setting.":e instanceof f?"Rate limit exceeded. Please try again later.":e instanceof m?"Invalid issue data. Please check your input.":e instanceof g?"Network error. Check your connection.":e instanceof Error?e.message:"An unknown error occurred."}async function k(e){const{config:t,formValues:n,errors:r}=e;try{const e={url:s(()=>window.location.href,"unknown"),viewport:s(()=>({width:window.innerWidth,height:window.innerHeight}),{width:0,height:0}),screen:s(()=>({width:window.screen.width,height:window.screen.height,pixelRatio:window.devicePixelRatio}),{width:0,height:0,pixelRatio:1}),browser:s(()=>{const e=navigator.userAgentData;if(e?.brands){const t=e.brands;for(const e of t){const t=e.brand.toLowerCase();if(t.includes("chrome")&&!t.includes("chromium"))return{name:"Chrome",version:e.version};if(t.includes("edge"))return{name:"Edge",version:e.version};if(t.includes("opera"))return{name:"Opera",version:e.version}}}return function(e){if(/Edg\//.test(e)){const t=e.match(/Edg\/([\d.]+)/);return{name:"Edge",version:t?.[1]||"unknown"}}if(/OPR\//.test(e)){const t=e.match(/OPR\/([\d.]+)/);return{name:"Opera",version:t?.[1]||"unknown"}}if(/Chrome\//.test(e)&&!/Edg\//.test(e)){const t=e.match(/Chrome\/([\d.]+)/);return{name:"Chrome",version:t?.[1]||"unknown"}}if(/Firefox\//.test(e)){const t=e.match(/Firefox\/([\d.]+)/);return{name:"Firefox",version:t?.[1]||"unknown"}}if(/Safari\//.test(e)&&!/Chrome\//.test(e)){const t=e.match(/Version\/([\d.]+)/);return{name:"Safari",version:t?.[1]||"unknown"}}return{name:"Unknown",version:"unknown"}}(navigator.userAgent)},{name:"Unknown",version:"unknown"}),os:s(()=>function(e){if(/iPhone|iPad|iPod/.test(e)){const t=e.match(/OS ([\d_]+)/);return{name:"iOS",version:t?.[1]?.replace(/_/g,".")||"unknown"}}if(/Windows NT/.test(e)){const t=e.match(/Windows NT ([\d.]+)/),n=t?.[1]||"unknown";return{name:"Windows",version:{"10.0":"10",6.3:"8.1",6.2:"8",6.1:"7"}[n]||n}}if(/Mac OS X/.test(e)){const t=e.match(/Mac OS X ([\d_]+)/);return{name:"macOS",version:t?.[1]?.replace(/_/g,".")||"unknown"}}if(/Android/.test(e)){const t=e.match(/Android ([\d.]+)/);return{name:"Android",version:t?.[1]||"unknown"}}return/Linux/.test(e)?{name:"Linux",version:"unknown"}:{name:"Unknown",version:"unknown"}}(navigator.userAgent),{name:"Unknown",version:"unknown"}),timestamp:/* @__PURE__ */(new Date).toISOString(),language:s(()=>navigator.language,"unknown"),cookiesEnabled:s(()=>navigator.cookieEnabled,!1),doNotTrack:s(()=>navigator.doNotTrack,null)},a=function(e,t){return`${{bug:"[Bug]",feature:"[Feature]",question:"[Question]"}[e]} ${t}`}(n.type,n.title),p=n.screenshots??[];let u=[];t.endpoint?t.uploadEndpoint&&p.length>0&&(u=await y(t.uploadEndpoint,p)):p.length>0&&(u=await y(t.uploadEndpoint,p));const b=function(e){switch(e.type){case"bug":return function(e){return[`## Summary\n${e.description}`,d(e.screenshots),"## Steps to Reproduce\nNot provided","## Expected Behavior\nNot provided","## Actual Behavior\nNot provided",c(e.context),`## Console Errors\n${l(e.errors)}`].filter(Boolean).join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);case"feature":return function(e){return[`## Summary\n${e.description}`,d(e.screenshots),"## Use Case\nNot provided","## Proposed Solution\nNot provided",c(e.context)].filter(Boolean).join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);case"question":return function(e){return[`## Question\n${e.description}`,d(e.screenshots),"## Context\nNot provided",c(e.context)].filter(Boolean).join("\n\n")+"\n---\n*Generated by [BeePort](https://beeport.ai) | agent-ready*"}(e);default:throw new Error(`Unknown feedback type: ${e.type}`)}}({type:n.type,title:n.title,description:n.description,context:e,errors:r,screenshots:u.length>0?u:void 0}),h=["bug"===(o=n.type)?"bug":"feature"===o?"enhancement":"question","beeport","agent-ready"];if(t.endpoint){const e=p.length>0?p.map(e=>({name:e.name,type:e.type,dataUrl:e.dataUrl})):void 0;return async function(e,t){let n;try{n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{return{status:"error",error:"Network error. Check your connection."}}if(!n.ok){const e=await n.json().catch(()=>({}));return{status:"error",error:"string"==typeof e.error?e.error:400===(r=n.status)?"Invalid issue data. Please check your input.":429===r?"Rate limit exceeded. Please try again later.":502===r||503===r?"Service temporarily unavailable. Please try again.":"An unexpected error occurred."}}var r;const o=await n.json();return{status:"success",issueUrl:o.issueUrl,issueNumber:o.issueNumber}}(t.endpoint,{title:a,body:b,labels:h,screenshots:e})}const{owner:m,repo:f}=function(e){const t=e.split("/");return{owner:t[0]||"",repo:t.slice(1).join("/")}}(t.repo);let g=[];try{g=await async function(e){const{token:t,owner:n,repo:r,title:o}=e;try{const e=`https://api.github.com/repos/${n}/${r}/issues?labels=beeport&state=open`,i=await fetch(e,{method:"GET",headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).map(e=>({number:e.number,title:e.title,url:e.html_url,similarity:v(o,e.title),state:e.state})).filter(e=>e.similarity>.7).sort((e,t)=>t.similarity-e.similarity).slice(0,5):(console.warn(`GitHub API error: ${i.status} ${i.statusText}`),[])}catch(i){return console.warn("Failed to search for duplicate issues:",i),[]}}({token:t.token,owner:m,repo:f,title:a})}catch(i){console.warn("Duplicate search failed, proceeding with submission:",i)}if(g.length>0)return{status:"duplicates_found",candidates:g,pendingSubmission:{title:a,body:b,labels:h,owner:m,repo:f,token:t.token}};const w=await x({token:t.token,owner:m,repo:f,title:a,body:b,labels:h});return{status:"success",issueUrl:w.url,issueNumber:w.number}}catch(i){return{status:"error",error:w(i)}}var o}const E=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,confirmSubmit:async function(e){try{const t=await x({token:e.token,owner:e.owner,repo:e.repo,title:e.title,body:e.body,labels:e.labels});return{status:"success",issueUrl:t.url,issueNumber:t.number}}catch(t){return{status:"error",error:w(t)}}},submitFeedback:k},Symbol.toStringTag,{value:"Module"}));class C{constructor(t){this.isOpen=!1,this.themeCleanup=null,this.config=t,this.hostElement=document.createElement("div"),this.hostElement.setAttribute("data-beeport-container",""),this.shadowRoot=this.hostElement.attachShadow({mode:"open"}),this.container=document.createElement("div"),this.container.className="beeport-container",this.container.setAttribute("data-open","false"),this.applyPosition(t.position??"bottom-right");const n=document.createElement("style");n.textContent='\n /* CSS Custom Properties (theme variables) */\n :host {\n --beeport-z-index: 999999;\n --beeport-spacing-sm: 8px;\n --beeport-spacing-md: 16px;\n --beeport-spacing-lg: 24px;\n --beeport-border-radius: 8px;\n --beeport-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n\n /* Typography */\n --beeport-font-size-sm: 12px;\n --beeport-font-size-md: 14px;\n --beeport-font-size-lg: 16px;\n --beeport-font-weight-normal: 400;\n --beeport-font-weight-medium: 500;\n --beeport-font-weight-bold: 600;\n\n /* Transitions */\n --beeport-transition-speed: 200ms;\n --beeport-transition-easing: ease-in-out;\n }\n\n /* Light theme colors */\n .beeport-container[data-theme="light"] {\n /* Base colors */\n --beeport-bg-primary: #ffffff;\n --beeport-bg-secondary: #f5f5f5;\n --beeport-text-primary: #1f2937;\n --beeport-text-secondary: #6b7280;\n --beeport-border-color: #d1d5db;\n --beeport-accent: #2563eb;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #1d4ed8;\n --beeport-button-primary-active: #1e40af;\n --beeport-button-disabled-bg: #e5e7eb;\n --beeport-button-disabled-text: #4b5563;\n\n /* Input states */\n --beeport-input-bg: #ffffff;\n --beeport-input-border: #9ca3af;\n --beeport-input-focus-border: #2563eb;\n\n /* Status colors */\n --beeport-success: #047857;\n --beeport-error: #dc2626;\n --beeport-warning: #b45309;\n }\n\n /* Dark theme colors */\n .beeport-container[data-theme="dark"] {\n /* Base colors */\n --beeport-bg-primary: #1f2937;\n --beeport-bg-secondary: #111827;\n --beeport-text-primary: #f9fafb;\n --beeport-text-secondary: #9ca3af;\n --beeport-border-color: #6b7280;\n --beeport-accent: #60a5fa;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #2563eb;\n --beeport-button-primary-active: #1d4ed8;\n --beeport-button-disabled-bg: #374151;\n --beeport-button-disabled-text: #d1d5db;\n\n /* Input states */\n --beeport-input-bg: #111827;\n --beeport-input-border: #6b7280;\n --beeport-input-focus-border: #60a5fa;\n\n /* Status colors */\n --beeport-success: #34d399;\n --beeport-error: #f87171;\n --beeport-warning: #fbbf24;\n }\n\n /* Auto theme - respect system preference */\n .beeport-container[data-theme="auto"] {\n /* Base colors */\n --beeport-bg-primary: #ffffff;\n --beeport-bg-secondary: #f5f5f5;\n --beeport-text-primary: #1f2937;\n --beeport-text-secondary: #6b7280;\n --beeport-border-color: #d1d5db;\n --beeport-accent: #2563eb;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #1d4ed8;\n --beeport-button-primary-active: #1e40af;\n --beeport-button-disabled-bg: #e5e7eb;\n --beeport-button-disabled-text: #4b5563;\n\n /* Input states */\n --beeport-input-bg: #ffffff;\n --beeport-input-border: #9ca3af;\n --beeport-input-focus-border: #2563eb;\n\n /* Status colors */\n --beeport-success: #047857;\n --beeport-error: #dc2626;\n --beeport-warning: #b45309;\n }\n\n @media (prefers-color-scheme: dark) {\n .beeport-container[data-theme="auto"] {\n /* Base colors */\n --beeport-bg-primary: #1f2937;\n --beeport-bg-secondary: #111827;\n --beeport-text-primary: #f9fafb;\n --beeport-text-secondary: #9ca3af;\n --beeport-border-color: #6b7280;\n --beeport-accent: #60a5fa;\n\n /* Button states */\n --beeport-button-primary-bg: #2563eb;\n --beeport-button-primary-hover: #2563eb;\n --beeport-button-primary-active: #1d4ed8;\n --beeport-button-disabled-bg: #374151;\n --beeport-button-disabled-text: #d1d5db;\n\n /* Input states */\n --beeport-input-bg: #111827;\n --beeport-input-border: #6b7280;\n --beeport-input-focus-border: #60a5fa;\n\n /* Status colors */\n --beeport-success: #34d399;\n --beeport-error: #f87171;\n --beeport-warning: #fbbf24;\n }\n }\n\n /* Container base styles */\n .beeport-container {\n position: fixed;\n z-index: var(--beeport-z-index);\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n font-size: 14px;\n line-height: 1.5;\n box-sizing: border-box;\n }\n\n .beeport-container *,\n .beeport-container *::before,\n .beeport-container *::after {\n box-sizing: border-box;\n }\n\n /* Reset button styles for future components */\n .beeport-container button {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n cursor: pointer;\n }\n\n /* Feedback button - floating action button */\n .beeport-feedback-button {\n position: relative;\n width: 56px;\n height: 56px;\n border-radius: 50%;\n background: linear-gradient(135deg, #FFC107 0%, #F59E0B 50%, #D97706 100%);\n color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);\n transition: all var(--beeport-transition-speed) var(--beeport-transition-easing);\n border: none;\n cursor: pointer;\n outline: none;\n }\n\n .beeport-feedback-button:hover {\n background: #ffffff;\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(245, 158, 11, 0.15);\n }\n\n .beeport-feedback-button:focus {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-feedback-button:focus:not(:focus-visible) {\n outline: none;\n }\n\n .beeport-feedback-button:focus-visible {\n outline: 2px solid var(--beeport-input-focus-border);\n outline-offset: 2px;\n }\n\n .beeport-feedback-button:active {\n background: linear-gradient(135deg, #F59E0B 0%, #D97706 50%, #B45309 100%);\n transform: translateY(0);\n box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);\n }\n\n .beeport-feedback-button svg {\n width: 28px;\n height: 28px;\n pointer-events: none;\n filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));\n }\n ',this.shadowRoot.appendChild(n),this.shadowRoot.appendChild(this.container),this.feedbackButton=this.createFeedbackButton(),this.container.appendChild(this.feedbackButton),this.form=i(this.container,{onSubmit:()=>{this.handleSubmit()},onCancel:()=>{this.isOpen&&this.toggleOpen()}},{maxScreenshots:t.maxScreenshots,maxFileSize:t.maxFileSize}),document.body.appendChild(this.hostElement),this.themeCleanup=e(this.container,t.theme??"auto")}applyPosition(e){this.container.style.position="fixed",this.container.style.bottom="20px","bottom-right"===e?this.container.style.right="20px":this.container.style.left="20px"}createFeedbackButton(){const e=document.createElement("button");return e.className="beeport-feedback-button",e.setAttribute("aria-label","Send feedback"),e.setAttribute("aria-expanded","false"),e.setAttribute("tabindex","0"),this.updateButtonIcon(e,!1),e.addEventListener("click",e=>{e.stopPropagation(),this.toggleOpen()}),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggleOpen())}),e}async handleSubmit(){if(!this.form.validate().valid)return;const e=this.form.getValues(),t=await k({config:this.config,formValues:e});if("success"===t.status)this.form.reset(),this.toggleOpen(),console.log(`[BeePort] Issue created: ${t.issueUrl}`);else if("duplicates_found"===t.status){console.log("[BeePort] Potential duplicates found, submitting anyway");const{confirmSubmit:e}=await Promise.resolve().then(()=>E),n=await e(t.pendingSubmission);"success"===n.status?(this.form.reset(),this.toggleOpen(),console.log(`[BeePort] Issue created: ${n.issueUrl}`)):"error"===n.status&&console.error(`[BeePort] Submit failed: ${n.error}`)}else"error"===t.status&&console.error(`[BeePort] Submit failed: ${t.error}`)}toggleOpen(){this.isOpen=!this.isOpen,this.container.setAttribute("data-open",String(this.isOpen)),this.feedbackButton.setAttribute("aria-expanded",String(this.isOpen)),this.updateButtonIcon(this.feedbackButton,this.isOpen),this.isOpen?this.form.show():this.form.hide();const e=new CustomEvent("beeport:toggle",{detail:{open:this.isOpen},bubbles:!0,composed:!0});this.hostElement.dispatchEvent(e)}updateButtonIcon(e,t){if(e.textContent="",t){const t=this.createSVGElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"}),n=this.createSVGElement("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"});t.appendChild(n),e.appendChild(t)}else{const t=this.createSVGElement("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none"}),n=this.createSVGElement("ellipse",{cx:"14",cy:"15",rx:"6",ry:"7.5",fill:"#FFC107",stroke:"currentColor","stroke-width":"1.5"}),r=this.createSVGElement("path",{d:"M8.5 13.5 Q14 12 19.5 13.5",stroke:"#1a1a1a","stroke-width":"1.8","stroke-linecap":"round",fill:"none"}),o=this.createSVGElement("path",{d:"M8.2 16.5 Q14 15 19.8 16.5",stroke:"#1a1a1a","stroke-width":"1.8","stroke-linecap":"round",fill:"none"}),i=this.createSVGElement("ellipse",{cx:"9.5",cy:"9",rx:"3.5",ry:"4",fill:"rgba(255,255,255,0.7)",stroke:"currentColor","stroke-width":"1",transform:"rotate(-15 9.5 9)"}),a=this.createSVGElement("ellipse",{cx:"18.5",cy:"9",rx:"3.5",ry:"4",fill:"rgba(255,255,255,0.7)",stroke:"currentColor","stroke-width":"1",transform:"rotate(15 18.5 9)"}),s=this.createSVGElement("circle",{cx:"14",cy:"7.5",r:"3",fill:"#1a1a1a"}),p=this.createSVGElement("circle",{cx:"12.8",cy:"7",r:"0.8",fill:"white"}),c=this.createSVGElement("circle",{cx:"15.2",cy:"7",r:"0.8",fill:"white"}),l=this.createSVGElement("path",{d:"M12.5 5 Q11 2.5 9.5 2",stroke:"#1a1a1a","stroke-width":"1.2","stroke-linecap":"round",fill:"none"}),d=this.createSVGElement("path",{d:"M15.5 5 Q17 2.5 18.5 2",stroke:"#1a1a1a","stroke-width":"1.2","stroke-linecap":"round",fill:"none"}),u=this.createSVGElement("circle",{cx:"9.3",cy:"1.8",r:"1",fill:"#FFC107"}),b=this.createSVGElement("circle",{cx:"18.7",cy:"1.8",r:"1",fill:"#FFC107"}),h=this.createSVGElement("path",{d:"M14 22.5 L14 24.5",stroke:"#1a1a1a","stroke-width":"1.5","stroke-linecap":"round"});t.appendChild(i),t.appendChild(a),t.appendChild(n),t.appendChild(r),t.appendChild(o),t.appendChild(s),t.appendChild(p),t.appendChild(c),t.appendChild(l),t.appendChild(d),t.appendChild(u),t.appendChild(b),t.appendChild(h),e.appendChild(t)}}createSVGElement(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg",e);for(const[r,o]of Object.entries(t))n.setAttribute(r,o);return n}show(){this.hostElement.style.display=""}hide(){this.hostElement.style.display="none"}destroy(){this.form.destroy(),this.themeCleanup&&(this.themeCleanup(),this.themeCleanup=null),this.hostElement.parentNode&&this.hostElement.parentNode.removeChild(this.hostElement)}setTheme(t){this.themeCleanup&&this.themeCleanup(),this.themeCleanup=e(this.container,t)}getContainer(){return this.container}}let S=null,A=null;function N(e){if(function(e){const t=e.endpoint&&""!==e.endpoint.trim(),n=e.token&&""!==e.token.trim();if(t&&n)throw new Error("Cannot use both endpoint and token. Choose one mode.");if(!t){if(!e.repo)throw new Error("repo is required (or use endpoint for proxy mode)");if(!e.repo.includes("/")||2!==e.repo.split("/").length)throw new Error('repo must be in format "owner/repo"');if(!n)throw new Error("token is required (or use endpoint for proxy mode)")}}(e),S&&A)return A;const t={...e,position:e.position??"bottom-right",theme:e.theme??"auto"};var n;return S=new C(t),n=S,A={show:()=>n.show(),hide:()=>n.hide(),destroy:()=>{n.destroy(),S=null,A=null},setTheme:e=>n.setTheme(e)},A}function L(){S&&(S.destroy(),S=null,A=null)}export{L as destroy,N as init};
package/dist/form.d.ts CHANGED
@@ -2,10 +2,17 @@
2
2
  * Feedback form component
3
3
  */
4
4
  import type { FeedbackType } from './types';
5
+ import { type ScreenshotFile } from './screenshots';
6
+ export type { ScreenshotFile };
5
7
  export interface FormValues {
6
8
  type: FeedbackType;
7
9
  title: string;
8
10
  description: string;
11
+ screenshots: ScreenshotFile[];
12
+ }
13
+ export interface FormConfig {
14
+ maxScreenshots?: number;
15
+ maxFileSize?: number;
9
16
  }
10
17
  export interface FormCallbacks {
11
18
  onSubmit?: () => void;
@@ -26,7 +33,7 @@ export interface FormComponent {
26
33
  /**
27
34
  * Create feedback form component
28
35
  */
29
- export declare function createForm(parent: HTMLElement | ShadowRoot, callbacks?: FormCallbacks): FormComponent;
36
+ export declare function createForm(parent: HTMLElement | ShadowRoot, callbacks?: FormCallbacks, config?: FormConfig): FormComponent;
30
37
  /**
31
38
  * Get form styles
32
39
  */
@@ -18,12 +18,17 @@ export interface CapturedError {
18
18
  /**
19
19
  * Options for formatting an issue body
20
20
  */
21
+ export interface ScreenshotData {
22
+ name: string;
23
+ url: string;
24
+ }
21
25
  export interface FormatOptions {
22
26
  type: FeedbackType;
23
27
  title: string;
24
28
  description: string;
25
29
  context: BrowserContext;
26
30
  errors?: CapturedError[];
31
+ screenshots?: ScreenshotData[];
27
32
  }
28
33
  /**
29
34
  * Sanitizes a URL by replacing sensitive query parameter values with [REDACTED]
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Screenshot capture component
3
+ * Drop zone, file input, paste, preview thumbnails
4
+ */
5
+ export interface ScreenshotFile {
6
+ name: string;
7
+ type: string;
8
+ size: number;
9
+ dataUrl: string;
10
+ }
11
+ export interface ScreenshotConfig {
12
+ maxFiles: number;
13
+ maxFileSize: number;
14
+ }
15
+ export interface ScreenshotComponent {
16
+ getScreenshots(): ScreenshotFile[];
17
+ reset(): void;
18
+ destroy(): void;
19
+ }
20
+ export declare function createScreenshotArea(parent: HTMLElement, config: ScreenshotConfig): ScreenshotComponent;
21
+ export declare function getScreenshotStyles(): string;
package/dist/types.d.ts CHANGED
@@ -35,6 +35,22 @@ export interface BeePortConfig {
35
35
  * @default "auto"
36
36
  */
37
37
  theme?: Theme;
38
+ /**
39
+ * URL to upload screenshots to.
40
+ * POST receives { name, type, data } (base64 data URL), returns { url }.
41
+ * Without this, screenshots are omitted in direct mode.
42
+ */
43
+ uploadEndpoint?: string;
44
+ /**
45
+ * Maximum number of screenshots allowed per submission
46
+ * @default 3
47
+ */
48
+ maxScreenshots?: number;
49
+ /**
50
+ * Maximum file size per screenshot in bytes
51
+ * @default 5242880 (5MB)
52
+ */
53
+ maxFileSize?: number;
38
54
  }
39
55
  /**
40
56
  * Instance returned by BeePort.init()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beeport",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Embeddable feedback widget that turns user feedback into agent-ready GitHub issues",
6
6
  "main": "./dist/beeport.min.js",