@mhosaic/feedback 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/embed.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  }`,yf=(e,A)=>{If(e,`.${en}${Hf}${Rs}
5
5
  .${tn}${bf}${Rs}`,A)},If=(e,A,t)=>{let r=e.ownerDocument;if(r){let n=r.createElement("style");n.textContent=A,t&&(n.nonce=t),e.appendChild(n)}},xf=(e,A)=>{var n;let t=e.ownerDocument.createElement("base");t.href=A;let r=e.getElementsByTagName("head").item(0);r==null||r.insertBefore(t,(n=r==null?void 0:r.firstChild)!=null?n:null)},ge=class e{static getOrigin(A){let t=e._link;return t?(t.href=A,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"}static isSameOrigin(A){return e.getOrigin(A)===e._origin}static setContext(A){e._link=A.document.createElement("a"),e._origin=e.getOrigin(A.location.href)}};ge._origin="about:blank";rn=class{constructor(A,t){this.context=A,this._options=t,this._cache={}}addImage(A){let t=Promise.resolve();return this.has(A)||(xr(A)||Sf(A))&&(this._cache[A]=this.loadImage(A)).catch(()=>{}),t}match(A){return this._cache[A]}async loadImage(A){let t=typeof this._options.customIsSameOrigin=="function"?await this._options.customIsSameOrigin(A,ge.isSameOrigin):ge.isSameOrigin(A),r=!Ir(A)&&this._options.useCORS===!0&&z.SUPPORT_CORS_IMAGES&&!t,n=!Ir(A)&&!t&&!xr(A)&&typeof this._options.proxy=="string"&&z.SUPPORT_CORS_XHR&&!r;if(!t&&this._options.allowTaint===!1&&!Ir(A)&&!xr(A)&&!n&&!r)return;let s=A;return n&&(s=await this.proxy(s)),this.context.logger.debug(`Added image ${A.substring(0,256)}`),await new Promise((o,i)=>{let a=new Image;a.onload=()=>o(a),a.onerror=i,(Tf(s)||r)&&(a.crossOrigin="anonymous"),a.src=s,a.complete===!0&&setTimeout(()=>o(a),500),this._options.imageTimeout>0&&setTimeout(()=>i(`Timed out (${this._options.imageTimeout}ms) loading image`),this._options.imageTimeout)})}has(A){return typeof this._cache[A]!="undefined"}keys(){return Promise.resolve(Object.keys(this._cache))}proxy(A){let t=this._options.proxy;if(!t)throw new Error("No proxy defined");let r=A.substring(0,256);return new Promise((n,s)=>{let o=z.SUPPORT_RESPONSE_TYPE?"blob":"text",i=new XMLHttpRequest;i.onload=()=>{if(i.status===200)if(o==="text")n(i.response);else{let B=new FileReader;B.addEventListener("load",()=>n(B.result),!1),B.addEventListener("error",l=>s(l),!1),B.readAsDataURL(i.response)}else s(`Failed to proxy resource ${r} with status code ${i.status}`)},i.onerror=s;let a=t.indexOf("?")>-1?"&":"?";if(i.open("GET",`${t}${a}url=${encodeURIComponent(A)}&responseType=${o}`),o!=="text"&&i instanceof XMLHttpRequest&&(i.responseType=o),this._options.imageTimeout){let B=this._options.imageTimeout;i.timeout=B,i.ontimeout=()=>s(`Timed out (${B}ms) proxying ${r}`)}i.send()})}},_f=/^data:image\/svg\+xml/i,Lf=/^data:image\/.*;base64,/i,Kf=/^data:image\/.*/i,Sf=e=>z.SUPPORT_SVG_DRAWING||!vf(e),Ir=e=>Kf.test(e),Tf=e=>Lf.test(e),xr=e=>e.substr(0,4)==="blob",vf=e=>e.substr(-3).toLowerCase()==="svg"||_f.test(e),p=class e{constructor(A,t){this.type=0,this.x=A,this.y=t}add(A,t){return new e(this.x+A,this.y+t)}},ne=(e,A,t)=>new p(e.x+(A.x-e.x)*t,e.y+(A.y-e.y)*t),ae=class e{constructor(A,t,r,n){this.type=1,this.start=A,this.startControl=t,this.endControl=r,this.end=n}subdivide(A,t){let r=ne(this.start,this.startControl,A),n=ne(this.startControl,this.endControl,A),s=ne(this.endControl,this.end,A),o=ne(r,n,A),i=ne(n,s,A),a=ne(o,i,A);return t?new e(this.start,r,o,a):new e(a,i,s,this.end)}add(A,t){return new e(this.start.add(A,t),this.startControl.add(A,t),this.endControl.add(A,t),this.end.add(A,t))}reverse(){return new e(this.end,this.endControl,this.startControl,this.start)}},aA=e=>e.type===1,nn=class{constructor(A){let t=A.styles,r=A.bounds,[n,s]=xe(t.borderTopLeftRadius,r.width,r.height),[o,i]=xe(t.borderTopRightRadius,r.width,r.height),[a,B]=xe(t.borderBottomRightRadius,r.width,r.height),[l,c]=xe(t.borderBottomLeftRadius,r.width,r.height),g=[];g.push((n+o)/r.width),g.push((l+a)/r.width),g.push((s+c)/r.height),g.push((i+B)/r.height);let f=Math.max(...g);f>1&&(n/=f,s/=f,o/=f,i/=f,a/=f,B/=f,l/=f,c/=f);let u=r.width-o,Q=r.height-B,h=r.width-a,C=r.height-c,w=t.borderTopWidth,F=t.borderRightWidth,H=t.borderBottomWidth,m=t.borderLeftWidth,I=K(t.paddingTop,A.bounds.width),S=K(t.paddingRight,A.bounds.width),G=K(t.paddingBottom,A.bounds.width),y=K(t.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?R(r.left+m/3,r.top+w/3,n-m/3,s-w/3,T.TOP_LEFT):new p(r.left+m/3,r.top+w/3),this.topRightBorderDoubleOuterBox=n>0||s>0?R(r.left+u,r.top+w/3,o-F/3,i-w/3,T.TOP_RIGHT):new p(r.left+r.width-F/3,r.top+w/3),this.bottomRightBorderDoubleOuterBox=a>0||B>0?R(r.left+h,r.top+Q,a-F/3,B-H/3,T.BOTTOM_RIGHT):new p(r.left+r.width-F/3,r.top+r.height-H/3),this.bottomLeftBorderDoubleOuterBox=l>0||c>0?R(r.left+m/3,r.top+C,l-m/3,c-H/3,T.BOTTOM_LEFT):new p(r.left+m/3,r.top+r.height-H/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?R(r.left+m*2/3,r.top+w*2/3,n-m*2/3,s-w*2/3,T.TOP_LEFT):new p(r.left+m*2/3,r.top+w*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?R(r.left+u,r.top+w*2/3,o-F*2/3,i-w*2/3,T.TOP_RIGHT):new p(r.left+r.width-F*2/3,r.top+w*2/3),this.bottomRightBorderDoubleInnerBox=a>0||B>0?R(r.left+h,r.top+Q,a-F*2/3,B-H*2/3,T.BOTTOM_RIGHT):new p(r.left+r.width-F*2/3,r.top+r.height-H*2/3),this.bottomLeftBorderDoubleInnerBox=l>0||c>0?R(r.left+m*2/3,r.top+C,l-m*2/3,c-H*2/3,T.BOTTOM_LEFT):new p(r.left+m*2/3,r.top+r.height-H*2/3),this.topLeftBorderStroke=n>0||s>0?R(r.left+m/2,r.top+w/2,n-m/2,s-w/2,T.TOP_LEFT):new p(r.left+m/2,r.top+w/2),this.topRightBorderStroke=n>0||s>0?R(r.left+u,r.top+w/2,o-F/2,i-w/2,T.TOP_RIGHT):new p(r.left+r.width-F/2,r.top+w/2),this.bottomRightBorderStroke=a>0||B>0?R(r.left+h,r.top+Q,a-F/2,B-H/2,T.BOTTOM_RIGHT):new p(r.left+r.width-F/2,r.top+r.height-H/2),this.bottomLeftBorderStroke=l>0||c>0?R(r.left+m/2,r.top+C,l-m/2,c-H/2,T.BOTTOM_LEFT):new p(r.left+m/2,r.top+r.height-H/2),this.topLeftBorderBox=n>0||s>0?R(r.left,r.top,n,s,T.TOP_LEFT):new p(r.left,r.top),this.topRightBorderBox=o>0||i>0?R(r.left+u,r.top,o,i,T.TOP_RIGHT):new p(r.left+r.width,r.top),this.bottomRightBorderBox=a>0||B>0?R(r.left+h,r.top+Q,a,B,T.BOTTOM_RIGHT):new p(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=l>0||c>0?R(r.left,r.top+C,l,c,T.BOTTOM_LEFT):new p(r.left,r.top+r.height),this.topLeftPaddingBox=n>0||s>0?R(r.left+m,r.top+w,Math.max(0,n-m),Math.max(0,s-w),T.TOP_LEFT):new p(r.left+m,r.top+w),this.topRightPaddingBox=o>0||i>0?R(r.left+Math.min(u,r.width-F),r.top+w,u>r.width+F?0:Math.max(0,o-F),Math.max(0,i-w),T.TOP_RIGHT):new p(r.left+r.width-F,r.top+w),this.bottomRightPaddingBox=a>0||B>0?R(r.left+Math.min(h,r.width-m),r.top+Math.min(Q,r.height-H),Math.max(0,a-F),Math.max(0,B-H),T.BOTTOM_RIGHT):new p(r.left+r.width-F,r.top+r.height-H),this.bottomLeftPaddingBox=l>0||c>0?R(r.left+m,r.top+Math.min(C,r.height-H),Math.max(0,l-m),Math.max(0,c-H),T.BOTTOM_LEFT):new p(r.left+m,r.top+r.height-H),this.topLeftContentBox=n>0||s>0?R(r.left+m+y,r.top+w+I,Math.max(0,n-(m+y)),Math.max(0,s-(w+I)),T.TOP_LEFT):new p(r.left+m+y,r.top+w+I),this.topRightContentBox=o>0||i>0?R(r.left+Math.min(u,r.width+m+y),r.top+w+I,u>r.width+m+y?0:o-m+y,i-(w+I),T.TOP_RIGHT):new p(r.left+r.width-(F+S),r.top+w+I),this.bottomRightContentBox=a>0||B>0?R(r.left+Math.min(h,r.width-(m+y)),r.top+Math.min(Q,r.height+w+I),Math.max(0,a-(F+S)),B-(H+G),T.BOTTOM_RIGHT):new p(r.left+r.width-(F+S),r.top+r.height-(H+G)),this.bottomLeftContentBox=l>0||c>0?R(r.left+m+y,r.top+C,Math.max(0,l-(m+y)),c-(H+G),T.BOTTOM_LEFT):new p(r.left+m+y,r.top+r.height-(H+G))}};(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(T||(T={}));R=(e,A,t,r,n)=>{let s=4*((Math.sqrt(2)-1)/3),o=t*s,i=r*s,a=e+t,B=A+r;switch(n){case T.TOP_LEFT:return new ae(new p(e,B),new p(e,B-i),new p(a-o,A),new p(a,A));case T.TOP_RIGHT:return new ae(new p(e,A),new p(e+o,A),new p(a,B-i),new p(a,B));case T.BOTTOM_RIGHT:return new ae(new p(a,A),new p(a,A+i),new p(e+o,B),new p(e,B));case T.BOTTOM_LEFT:default:return new ae(new p(a,B),new p(a-o,B),new p(e,A+i),new p(e,A))}},_t=e=>[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox],Df=e=>[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox],Lt=e=>[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox],Kt=class{constructor(A,t,r){this.offsetX=A,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}},Be=class{constructor(A,t){this.path=A,this.target=t,this.type=1}},sn=class{constructor(A){this.opacity=A,this.type=2,this.target=6}},Mf=e=>e.type===0,Do=e=>e.type===1,Of=e=>e.type===2,ks=(e,A)=>e.length===A.length?e.some((t,r)=>t===A[r]):!1,Rf=(e,A,t,r,n)=>e.map((s,o)=>{switch(o){case 0:return s.add(A,t);case 1:return s.add(A+r,t);case 2:return s.add(A+r,t+n);case 3:return s.add(A,t+n)}return s}),St=class{constructor(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}},Tt=class{constructor(A,t){if(this.container=A,this.parent=t,this.effects=[],this.curves=new nn(this.container),this.container.styles.opacity<1&&this.effects.push(new sn(this.container.styles.opacity)),this.container.styles.rotate!==null){let r=this.container.styles.transformOrigin,n=this.container.bounds.left+K(r[0],this.container.bounds.width),s=this.container.bounds.top+K(r[1],this.container.bounds.height),i=this.container.styles.rotate*Math.PI/180,a=Math.cos(i),B=Math.sin(i),l=[a,B,-B,a,0,0];this.effects.push(new Kt(n,s,l))}if(this.container.styles.transform!==null){let r=this.container.styles.transformOrigin,n=this.container.bounds.left+K(r[0],this.container.bounds.width),s=this.container.bounds.top+K(r[1],this.container.bounds.height),o=this.container.styles.transform;this.effects.push(new Kt(n,s,o))}if(this.container.styles.overflowX!==0){let r=_t(this.curves),n=Lt(this.curves);ks(r,n)?this.effects.push(new Be(r,6)):(this.effects.push(new Be(r,2)),this.effects.push(new Be(n,4)))}}getEffects(A){let t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,n=this.effects.slice(0);for(;r;){let s=r.effects.filter(o=>!Do(o));if(t||r.container.styles.position!==0||!r.parent){if(t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){let o=_t(r.curves),i=Lt(r.curves);ks(o,i)||n.unshift(new Be(i,6))}n.unshift(...s)}else n.unshift(...s);r=r.parent}return n.filter(s=>k(s.target,A))}},on=(e,A,t,r)=>{e.container.elements.forEach(n=>{let s=k(n.flags,4),o=k(n.flags,2),i=new Tt(n,e);k(n.styles.display,2048)&&r.push(i);let a=k(n.flags,8)?[]:r;if(s||o){let B=s||n.styles.isPositioned()?t:A,l=new St(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){let c=n.styles.zIndex.order;if(c<0){let g=0;B.negativeZIndex.some((f,u)=>c>f.element.container.styles.zIndex.order?(g=u,!1):g>0),B.negativeZIndex.splice(g,0,l)}else if(c>0){let g=0;B.positiveZIndex.some((f,u)=>c>=f.element.container.styles.zIndex.order?(g=u+1,!1):g>0),B.positiveZIndex.splice(g,0,l)}else B.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?B.nonPositionedFloats.push(l):B.nonPositionedInlineLevel.push(l);on(i,l,s?l:t,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(i):A.nonInlineLevel.push(i),on(i,A,t,a);k(n.flags,8)&&Mo(n,a)})},Mo=(e,A)=>{let t=e instanceof Re?e.start:1,r=e instanceof Re?e.reversed:!1;for(let n=0;n<A.length;n++){let s=A[n];s.container instanceof pt&&typeof s.container.value=="number"&&s.container.value!==0&&(t=s.container.value),s.listValue=ke(t,s.container.styles.listStyleType,!0),t+=r?-1:1}},kf=e=>{let A=new Tt(e,null),t=new St(A),r=[];return on(A,t,t,r),Mo(A.container,r),t},Gs=(e,A)=>{switch(A){case 0:return cA(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return cA(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return cA(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);default:return cA(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Gf=(e,A)=>{switch(A){case 0:return cA(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return cA(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return cA(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);default:return cA(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},Nf=(e,A)=>{switch(A){case 0:return cA(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return cA(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return cA(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);default:return cA(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},Vf=(e,A)=>{switch(A){case 0:return st(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return st(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return st(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return st(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},st=(e,A)=>{let t=[];return aA(e)?t.push(e.subdivide(.5,!1)):t.push(e),aA(A)?t.push(A.subdivide(.5,!0)):t.push(A),t},cA=(e,A,t,r)=>{let n=[];return aA(e)?n.push(e.subdivide(.5,!1)):n.push(e),aA(t)?n.push(t.subdivide(.5,!0)):n.push(t),aA(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),aA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},Oo=e=>{let A=e.bounds,t=e.styles;return A.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},De=e=>{let A=e.styles,t=e.bounds,r=K(A.paddingLeft,t.width),n=K(A.paddingRight,t.width),s=K(A.paddingTop,t.width),o=K(A.paddingBottom,t.width);return t.add(r+A.borderLeftWidth,s+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+r+n),-(A.borderTopWidth+A.borderBottomWidth+s+o))},Pf=(e,A)=>e===0?A.bounds:e===2?De(A):Oo(A),Xf=(e,A)=>e===0?A.bounds:e===2?De(A):Oo(A),_r=(e,A,t)=>{let r=Pf(ie(e.styles.backgroundOrigin,A),e),n=Xf(ie(e.styles.backgroundClip,A),e),s=Jf(ie(e.styles.backgroundSize,A),t,r),[o,i]=s,a=xe(ie(e.styles.backgroundPosition,A),r.width-o,r.height-i),B=Wf(ie(e.styles.backgroundRepeat,A),a,s,r,n),l=Math.round(r.left+a[0]),c=Math.round(r.top+a[1]);return o=Math.max(1,o),i=Math.max(1,i),[B,l,c,o,i]},se=e=>x(e)&&e.value===le.AUTO,ot=e=>typeof e=="number",Jf=(e,[A,t,r],n)=>{let[s,o]=e;if(!s)return[0,0];if(O(s)&&o&&O(o))return[K(s,n.width),K(o,n.height)];let i=ot(r);if(x(s)&&(s.value===le.CONTAIN||s.value===le.COVER))return ot(r)?n.width/n.height<r!=(s.value===le.COVER)?[n.width,n.width/r]:[n.height*r,n.height]:[n.width,n.height];let a=ot(A),B=ot(t),l=a||B;if(se(s)&&(!o||se(o))){if(a&&B)return[A,t];if(!i&&!l)return[n.width,n.height];if(l&&i){let Q=a?A:t*r,h=B?t:A/r;return[Q,h]}let f=a?A:n.width,u=B?t:n.height;return[f,u]}if(i){let f=0,u=0;return O(s)?f=K(s,n.width):O(o)&&(u=K(o,n.height)),se(s)?f=u*r:(!o||se(o))&&(u=f/r),[f,u]}let c=null,g=null;if(O(s)?c=K(s,n.width):o&&O(o)&&(g=K(o,n.height)),c!==null&&(!o||se(o))&&(g=a&&B?c/A*t:n.height),g!==null&&se(s)&&(c=a&&B?g/t*A:n.width),c!==null&&g!==null)return[c,g];throw new Error("Unable to calculate background-size for element")},ie=(e,A)=>{let t=e[A];return typeof t=="undefined"?e[0]:t},Wf=(e,[A,t],[r,n],s,o)=>{switch(e){case 2:return[new p(Math.round(s.left),Math.round(s.top+t)),new p(Math.round(s.left+s.width),Math.round(s.top+t)),new p(Math.round(s.left+s.width),Math.round(n+s.top+t)),new p(Math.round(s.left),Math.round(n+s.top+t))];case 3:return[new p(Math.round(s.left+A),Math.round(s.top)),new p(Math.round(s.left+A+r),Math.round(s.top)),new p(Math.round(s.left+A+r),Math.round(s.height+s.top)),new p(Math.round(s.left+A),Math.round(s.height+s.top))];case 1:return[new p(Math.round(s.left+A),Math.round(s.top+t)),new p(Math.round(s.left+A+r),Math.round(s.top+t)),new p(Math.round(s.left+A+r),Math.round(s.top+t+n)),new p(Math.round(s.left+A),Math.round(s.top+t+n))];default:return[new p(Math.round(o.left),Math.round(o.top)),new p(Math.round(o.left+o.width),Math.round(o.top)),new p(Math.round(o.left+o.width),Math.round(o.height+o.top)),new p(Math.round(o.left),Math.round(o.height+o.top))]}},Yf="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Ns="Hidden Text",an=class{constructor(A){this._data={},this._document=A}parseMetrics(A,t){let r=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=A,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),n.src=Yf,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=A,s.style.fontSize=t,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Ns)),r.appendChild(s),r.appendChild(n);let i=n.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(Ns)),r.style.lineHeight="normal",n.style.verticalAlign="super";let a=n.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:i,middle:a}}getMetrics(A,t){let r=`${A} ${t}`;return typeof this._data[r]=="undefined"&&(this._data[r]=this.parseMetrics(A,t)),this._data[r]}},vt=class{constructor(A,t){this.context=A,this.options=t}},Zf=1e4,Bn=class e extends vt{constructor(A,t){super(A,t),this._activeEffects=[],this.canvas=t.canvas?t.canvas:document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),t.canvas||(this.canvas.width=Math.floor(t.width*t.scale),this.canvas.height=Math.floor(t.height*t.scale),this.canvas.style.width=`${t.width}px`,this.canvas.style.height=`${t.height}px`),this.fontMetrics=new an(document),this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-t.x,-t.y),this.ctx.textBaseline="bottom",this._activeEffects=[],this.context.logger.debug(`Canvas renderer initialized (${t.width}x${t.height}) with scale ${t.scale}`)}applyEffects(A){for(;this._activeEffects.length;)this.popEffect();A.forEach(t=>this.applyEffect(t))}applyEffect(A){this.ctx.save(),Of(A)&&(this.ctx.globalAlpha=A.opacity),Mf(A)&&(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)),Do(A)&&(this.path(A.path),this.ctx.clip()),this._activeEffects.push(A)}popEffect(){this._activeEffects.pop(),this.ctx.restore()}async renderStack(A){A.element.container.styles.isVisible()&&await this.renderStackContent(A)}async renderNode(A){if(k(A.container.flags,16))debugger;A.container.styles.isVisible()&&(await this.renderNodeBackgroundAndBorders(A),await this.renderNodeContent(A))}renderTextWithLetterSpacing(A,t,r){t===0?this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+r):dA(A.text).reduce((s,o)=>(this.ctx.fillText(o,s,A.bounds.top+r),s+this.ctx.measureText(o).width),A.bounds.left)}renderTextBoundWithPaintOrder(A,t,r){r.forEach(n=>{switch(n){case 0:this.ctx.fillStyle=M(t.color),this.renderTextWithLetterSpacing(A,t.letterSpacing,t.fontSize.number);break;case 1:t.webkitTextStrokeWidth&&A.text.trim().length&&(this.ctx.strokeStyle=M(t.webkitTextStrokeColor),this.ctx.lineWidth=t.webkitTextStrokeWidth,this.ctx.lineJoin=window.chrome?"miter":"round",this.renderTextWithLetterSpacing(A,t.letterSpacing,t.fontSize.number));break}})}renderTextDecoration(A,t){this.ctx.fillStyle=M(t.textDecorationColor||t.color);let r=1;typeof t.textDecorationThickness=="number"?r=t.textDecorationThickness:t.textDecorationThickness==="from-font"&&(r=Math.max(1,Math.floor(t.fontSize.number*.05)));let n=0;typeof t.textUnderlineOffset=="number"&&(n=t.textUnderlineOffset);let s=t.textDecorationStyle;t.textDecorationLine.forEach(o=>{let i=0;switch(o){case 1:i=A.top+A.height-r+n;break;case 2:i=A.top;break;case 3:i=A.top+(A.height/2-r/2);break;default:return}this.drawDecorationLine(A.left,i,A.width,r,s)})}drawDecorationLine(A,t,r,n,s){switch(s){case 0:this.ctx.fillRect(A,t,r,n);break;case 1:let o=Math.max(1,n);this.ctx.fillRect(A,t,r,n),this.ctx.fillRect(A,t+n+o,r,n);break;case 2:this.ctx.save(),this.ctx.beginPath(),this.ctx.setLineDash([n,n*2]),this.ctx.lineWidth=n,this.ctx.strokeStyle=this.ctx.fillStyle,this.ctx.moveTo(A,t+n/2),this.ctx.lineTo(A+r,t+n/2),this.ctx.stroke(),this.ctx.restore();break;case 3:this.ctx.save(),this.ctx.beginPath(),this.ctx.setLineDash([n*3,n*2]),this.ctx.lineWidth=n,this.ctx.strokeStyle=this.ctx.fillStyle,this.ctx.moveTo(A,t+n/2),this.ctx.lineTo(A+r,t+n/2),this.ctx.stroke(),this.ctx.restore();break;case 4:this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=n,this.ctx.strokeStyle=this.ctx.fillStyle;let i=n*2,a=n*4,B=A;for(this.ctx.moveTo(B,t+n/2);B<A+r;){let l=Math.min(B+a/2,A+r);if(this.ctx.quadraticCurveTo(B+a/4,t+n/2-i,l,t+n/2),B=l,B<A+r){let c=Math.min(B+a/2,A+r);this.ctx.quadraticCurveTo(B+a/4,t+n/2+i,c,t+n/2),B=c}}this.ctx.stroke(),this.ctx.restore();break;default:this.ctx.fillRect(A,t,r,n)}}truncateTextWithEllipsis(A,t,r){let s=this.ctx.measureText("...").width;if(r===0){let o=A;for(;this.ctx.measureText(o).width+s>t&&o.length>0;)o=o.slice(0,-1);return o+"..."}else{let o=dA(A),i=s,a=[];for(let B of o){let l=this.ctx.measureText(B).width+r;if(i+l>t)break;a.push(B),i+=l}return a.join("")+"..."}}createFontStyle(A){let t=A.fontVariant.filter(s=>s==="normal"||s==="small-caps").join(""),r=Au(A.fontFamily).join(", "),n=UA(A.fontSize)?`${A.fontSize.number}${A.fontSize.unit}`:`${A.fontSize.number}px`;return[[A.fontStyle,t,A.fontWeight,n,r].join(" "),r,n]}async renderTextNode(A,t,r){let[n]=this.createFontStyle(t);this.ctx.font=n,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic";let s=t.paintOrder,o=t.fontSize.number*1.5;if(t.webkitLineClamp>0&&(t.display&2)!==0&&t.overflowY===1&&A.textBounds.length>0){let c=[],g=[],f=A.textBounds[0].bounds.top;A.textBounds.forEach(Q=>{Math.abs(Q.bounds.top-f)>=o*.5?(g.length>0&&c.push(g),g=[Q],f=Q.bounds.top):g.push(Q)}),g.length>0&&c.push(g);let u=t.webkitLineClamp;if(c.length>u){for(let h=0;h<u-1;h++)c[h].forEach(C=>{this.renderTextBoundWithPaintOrder(C,t,s)});let Q=c[u-1];if(Q&&Q.length>0&&r){let h=Q.map(H=>H.text).join(""),C=Q[0],w=r.width-(C.bounds.left-r.left),F=this.truncateTextWithEllipsis(h,w,t.letterSpacing);s.forEach(H=>{switch(H){case 0:this.ctx.fillStyle=M(t.color),t.letterSpacing===0?this.ctx.fillText(F,C.bounds.left,C.bounds.top+t.fontSize.number):dA(F).reduce((I,S)=>(this.ctx.fillText(S,I,C.bounds.top+t.fontSize.number),I+this.ctx.measureText(S).width+t.letterSpacing),C.bounds.left);break;case 1:t.webkitTextStrokeWidth&&F.trim().length&&(this.ctx.strokeStyle=M(t.webkitTextStrokeColor),this.ctx.lineWidth=t.webkitTextStrokeWidth,this.ctx.lineJoin=window.chrome?"miter":"round",t.letterSpacing===0?this.ctx.strokeText(F,C.bounds.left,C.bounds.top+t.fontSize.number):dA(F).reduce((I,S)=>(this.ctx.strokeText(S,I,C.bounds.top+t.fontSize.number),I+this.ctx.measureText(S).width+t.letterSpacing),C.bounds.left));break}})}return}}let a=t.textOverflow===1&&r&&t.overflowX===1&&A.textBounds.length>0,B=!1,l="";if(a){let c=A.textBounds[0].bounds.top;if(A.textBounds.every(f=>Math.abs(f.bounds.top-c)<o*.5)){let f=A.textBounds.map(h=>h.text).join("");f=f.replace(/\s+/g," ").trim();let u=this.ctx.measureText(f).width,Q=r.width;u>Q&&(B=!0,l=this.truncateTextWithEllipsis(f,Q,t.letterSpacing))}}if(B){let c=A.textBounds[0];s.forEach(g=>{switch(g){case 0:this.ctx.fillStyle=M(t.color),t.letterSpacing===0?this.ctx.fillText(l,c.bounds.left,c.bounds.top+t.fontSize.number):dA(l).reduce((Q,h)=>(this.ctx.fillText(h,Q,c.bounds.top+t.fontSize.number),Q+this.ctx.measureText(h).width+t.letterSpacing),c.bounds.left);let f=t.textShadow;f.length&&l.trim().length&&(f.slice(0).reverse().forEach(u=>{this.ctx.shadowColor=M(u.color),this.ctx.shadowOffsetX=u.offsetX.number*this.options.scale,this.ctx.shadowOffsetY=u.offsetY.number*this.options.scale,this.ctx.shadowBlur=u.blur.number,t.letterSpacing===0?this.ctx.fillText(l,c.bounds.left,c.bounds.top+t.fontSize.number):dA(l).reduce((h,C)=>(this.ctx.fillText(C,h,c.bounds.top+t.fontSize.number),h+this.ctx.measureText(C).width+t.letterSpacing),c.bounds.left)}),this.ctx.shadowColor="",this.ctx.shadowOffsetX=0,this.ctx.shadowOffsetY=0,this.ctx.shadowBlur=0);break;case 1:t.webkitTextStrokeWidth&&l.trim().length&&(this.ctx.strokeStyle=M(t.webkitTextStrokeColor),this.ctx.lineWidth=t.webkitTextStrokeWidth,this.ctx.lineJoin=window.chrome?"miter":"round",t.letterSpacing===0?this.ctx.strokeText(l,c.bounds.left,c.bounds.top+t.fontSize.number):dA(l).reduce((Q,h)=>(this.ctx.strokeText(h,Q,c.bounds.top+t.fontSize.number),Q+this.ctx.measureText(h).width+t.letterSpacing),c.bounds.left));break}});return}A.textBounds.forEach(c=>{s.forEach(g=>{switch(g){case 0:this.ctx.fillStyle=M(t.color),this.renderTextWithLetterSpacing(c,t.letterSpacing,t.fontSize.number);let f=t.textShadow;f.length&&c.text.trim().length&&(f.slice(0).reverse().forEach(u=>{this.ctx.shadowColor=M(u.color),this.ctx.shadowOffsetX=u.offsetX.number*this.options.scale,this.ctx.shadowOffsetY=u.offsetY.number*this.options.scale,this.ctx.shadowBlur=u.blur.number,this.renderTextWithLetterSpacing(c,t.letterSpacing,t.fontSize.number)}),this.ctx.shadowColor="",this.ctx.shadowOffsetX=0,this.ctx.shadowOffsetY=0,this.ctx.shadowBlur=0),t.textDecorationLine.length&&this.renderTextDecoration(c.bounds,t);break;case 1:if(t.webkitTextStrokeWidth&&c.text.trim().length){this.ctx.strokeStyle=M(t.webkitTextStrokeColor),this.ctx.lineWidth=t.webkitTextStrokeWidth,this.ctx.lineJoin=window.chrome?"miter":"round";let u=t.fontSize.number;t.letterSpacing===0?this.ctx.strokeText(c.text,c.bounds.left,c.bounds.top+u):dA(c.text).reduce((h,C)=>(this.ctx.strokeText(C,h,c.bounds.top+u),h+this.ctx.measureText(C).width),c.bounds.left)}this.ctx.strokeStyle="",this.ctx.lineWidth=0,this.ctx.lineJoin="miter";break}})})}renderReplacedElement(A,t,r){let n=r.naturalWidth||A.intrinsicWidth,s=r.naturalHeight||A.intrinsicHeight;if(r&&n>0&&s>0){let o=De(A),i=Lt(t);this.path(i),this.ctx.save(),this.ctx.clip();let a=0,B=0,l=n,c=s,g=o.left,f=o.top,u=o.width,Q=o.height,{objectFit:h}=A.styles,C=u/Q,w=l/c;if(h===2)w>C?(Q=u/w,f+=(o.height-Q)/2):(u=Q*w,g+=(o.width-u)/2);else if(h===4)w>C?(l=c*C,a+=(n-l)/2):(c=l/C,B+=(s-c)/2);else if(h===8)l>u?(a+=(l-u)/2,l=u):(g+=(u-l)/2,u=l),c>Q?(B+=(c-Q)/2,c=Q):(f+=(Q-c)/2,Q=c);else if(h===16){let F=w>C?u:Q*w,H=l>u?l:u;F<H?w>C?(Q=u/w,f+=(o.height-Q)/2):(u=Q*w,g+=(o.width-u)/2):(l>u?(a+=(l-u)/2,l=u):(g+=(u-l)/2,u=l),c>Q?(B+=(c-Q)/2,c=Q):(f+=(Q-c)/2,Q=c))}this.ctx.drawImage(r,a,B,l,c,g,f,u,Q),this.ctx.restore()}}async renderNodeContent(A){this.applyEffects(A.getEffects(4));let t=A.container,r=A.curves,n=t.styles,s=De(t);for(let o of t.textNodes)await this.renderTextNode(o,n,s);if(t instanceof dt)try{let o=await this.context.cache.match(t.src);this.renderReplacedElement(t,r,o)}catch(o){this.context.logger.error(`Error loading image ${t.src}`)}if(t instanceof Ct&&this.renderReplacedElement(t,r,t.canvas),t instanceof Ut)try{let o=await this.context.cache.match(t.svg);this.renderReplacedElement(t,r,o)}catch(o){this.context.logger.error(`Error loading svg ${t.svg.substring(0,255)}`)}if(t instanceof bt&&t.tree){let i=await new e(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}).render(t.tree);t.width&&t.height&&this.ctx.drawImage(i,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height)}if(t instanceof YA){let o=Math.min(t.bounds.width,t.bounds.height);t.type===Ft?t.checked&&(this.ctx.save(),this.path([new p(t.bounds.left+o*.39363,t.bounds.top+o*.79),new p(t.bounds.left+o*.16,t.bounds.top+o*.5549),new p(t.bounds.left+o*.27347,t.bounds.top+o*.44071),new p(t.bounds.left+o*.39694,t.bounds.top+o*.5649),new p(t.bounds.left+o*.72983,t.bounds.top+o*.23),new p(t.bounds.left+o*.84,t.bounds.top+o*.34085),new p(t.bounds.left+o*.39363,t.bounds.top+o*.79)]),this.ctx.fillStyle=M(xs),this.ctx.fill(),this.ctx.restore()):t.type===mt&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+o/2,t.bounds.top+o/2,o/4,0,Math.PI*2,!0),this.ctx.fillStyle=M(xs),this.ctx.fill(),this.ctx.restore())}if(zf(t)&&t.value.length){let[o,i,a]=this.createFontStyle(n),{baseline:B}=this.fontMetrics.getMetrics(i,a);this.ctx.font=o;let l=t instanceof YA&&t.isPlaceholder;this.ctx.fillStyle=M(l?of:n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=$f(t.styles.textAlign);let c=De(t),g=0;switch(t.styles.textAlign){case 1:g+=c.width/2;break;case 2:g+=c.width;break}let f=0;if(t instanceof YA){let Q=K(n.fontSize,0);f=(c.height-Q)/2}let u=c.add(g,f,0,0);this.ctx.save(),this.path([new p(c.left,c.top),new p(c.left+c.width,c.top),new p(c.left+c.width,c.top+c.height),new p(c.left,c.top+c.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new WA(t.value,u),n.letterSpacing,B),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(k(t.styles.display,2048)){if(t.styles.listStyleImage!==null){let o=t.styles.listStyleImage;if(o.type===0){let i,a=o.url;try{i=await this.context.cache.match(a),this.ctx.drawImage(i,t.bounds.left-(i.width+10),t.bounds.top)}catch(B){this.context.logger.error(`Error loading list-style-image ${a}`)}}}else if(A.listValue&&t.styles.listStyleType!==-1){let[o]=this.createFontStyle(n);this.ctx.font=o,this.ctx.fillStyle=M(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right";let i=new nA(t.bounds.left,t.bounds.top+K(t.styles.paddingTop,t.bounds.width),t.bounds.width,fs(n.lineHeight,n.fontSize.number)/2+1);this.renderTextWithLetterSpacing(new WA(A.listValue,i),n.letterSpacing,fs(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"}}}async renderStackContent(A){if(k(A.element.container.flags,16))debugger;await this.renderNodeBackgroundAndBorders(A.element);for(let t of A.negativeZIndex)await this.renderStack(t);await this.renderNodeContent(A.element);for(let t of A.nonInlineLevel)await this.renderNode(t);for(let t of A.nonPositionedFloats)await this.renderStack(t);for(let t of A.nonPositionedInlineLevel)await this.renderStack(t);for(let t of A.inlineLevel)await this.renderNode(t);for(let t of A.zeroOrAutoZIndexOrTransformedOrOpacity)await this.renderStack(t);for(let t of A.positiveZIndex)await this.renderStack(t)}mask(A){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.options.width,0),this.ctx.lineTo(this.options.width,this.options.height),this.ctx.lineTo(0,this.options.height),this.ctx.lineTo(0,0),this.formatPath(A.slice(0).reverse()),this.ctx.closePath()}path(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()}formatPath(A){A.forEach((t,r)=>{let n=aA(t)?t.start:t;r===0?this.ctx.moveTo(n.x,n.y):this.ctx.lineTo(n.x,n.y),aA(t)&&this.ctx.bezierCurveTo(t.startControl.x,t.startControl.y,t.endControl.x,t.endControl.y,t.end.x,t.end.y)})}renderRepeat(A,t,r,n){this.path(A),this.ctx.fillStyle=t,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)}resizeImage(A,t,r){var i;let s=((i=this.canvas.ownerDocument)!=null?i:document).createElement("canvas");return s.width=Math.max(1,t),s.height=Math.max(1,r),s.getContext("2d").drawImage(A,0,0,A.width,A.height,0,0,t,r),s}async renderBackgroundImage(A){let t=A.styles.backgroundImage.length-1;for(let r of A.styles.backgroundImage.slice(0).reverse()){if(r.type===0){let n,s=r.url;try{n=await this.context.cache.match(s)}catch(o){this.context.logger.error(`Error loading background-image ${s}`)}if(n){let o=isNaN(n.width)||n.width===0?1:n.width,i=isNaN(n.height)||n.height===0?1:n.height,[a,B,l,c,g]=_r(A,t,[o,i,o/i]),f=this.ctx.createPattern(this.resizeImage(n,c,g),"repeat");this.renderRepeat(a,f,B,l)}}else if(Sc(r)){let[n,s,o,i,a]=_r(A,t,[null,null,null]),[B,l,c,g,f]=Ic(r.angle,i,a),u=document.createElement("canvas");u.width=i,u.height=a;let Q=u.getContext("2d"),h=Q.createLinearGradient(l,g,c,f);if(ls(r.stops,B||1).forEach(C=>h.addColorStop(C.stop,M(C.color))),Q.fillStyle=h,Q.fillRect(0,0,i,a),i>0&&a>0){let C=this.ctx.createPattern(u,"repeat");this.renderRepeat(n,C,s,o)}}else if(Tc(r)){let[n,s,o,i,a]=_r(A,t,[null,null,null]),B=r.position.length===0?[gn]:r.position,l=K(B[0],i),c=K(B[B.length-1],a),[g,f]=xc(r,l,c,i,a);if((g===0||f===0)&&(g=Math.max(g,.01),f=Math.max(f,.01)),g>0&&f>0){let u=this.ctx.createRadialGradient(s+l,o+c,0,s+l,o+c,g);if(ls(r.stops,g*2).forEach(Q=>u.addColorStop(Q.stop,M(Q.color))),this.path(n),this.ctx.fillStyle=u,g!==f){let Q=A.bounds.left+.5*A.bounds.width,h=A.bounds.top+.5*A.bounds.height,C=f/g,w=1/C;this.ctx.save(),this.ctx.translate(Q,h),this.ctx.transform(1,0,0,C,0,0),this.ctx.translate(-Q,-h),this.ctx.fillRect(s,w*(o-h)+h,i,a*w),this.ctx.restore()}else this.ctx.fill()}}t--}}async renderSolidBorder(A,t,r){this.path(Gs(r,t)),this.ctx.fillStyle=M(A),this.ctx.fill()}async renderDoubleBorder(A,t,r,n){if(t<3){await this.renderSolidBorder(A,r,n);return}let s=Gf(n,r);this.path(s),this.ctx.fillStyle=M(A),this.ctx.fill();let o=Nf(n,r);this.path(o),this.ctx.fill()}async renderNodeBackgroundAndBorders(A){this.applyEffects(A.getEffects(2));let t=A.container.styles,r=!vA(t.backgroundColor)||t.backgroundImage.length,n=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],s=qf(ie(t.backgroundClip,0),A.curves);(r||t.boxShadow.length)&&(this.ctx.save(),this.path(s),this.ctx.clip(),vA(t.backgroundColor)||(this.ctx.fillStyle=M(t.backgroundColor),this.ctx.fill()),await this.renderBackgroundImage(A.container),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(i=>{this.ctx.save();let a=_t(A.curves),B=i.inset?0:Zf,l=Rf(a,-B+(i.inset?1:-1)*i.spread.number,(i.inset?1:-1)*i.spread.number,i.spread.number*(i.inset?-2:2),i.spread.number*(i.inset?-2:2));i.inset?(this.path(a),this.ctx.clip(),this.mask(l)):(this.mask(a),this.ctx.clip(),this.path(l)),this.ctx.shadowOffsetX=i.offsetX.number+B,this.ctx.shadowOffsetY=i.offsetY.number,this.ctx.shadowColor=M(i.color),this.ctx.shadowBlur=i.blur.number,this.ctx.fillStyle=i.inset?M(i.color):"rgba(0,0,0,1)",this.ctx.fill(),this.ctx.restore()}));let o=0;for(let i of n)i.style!==0&&!vA(i.color)&&i.width>0&&(i.style===2?await this.renderDashedDottedBorder(i.color,i.width,o,A.curves,2):i.style===3?await this.renderDashedDottedBorder(i.color,i.width,o,A.curves,3):i.style===4?await this.renderDoubleBorder(i.color,i.width,o,A.curves):await this.renderSolidBorder(i.color,o,A.curves)),o++}async renderDashedDottedBorder(A,t,r,n,s){this.ctx.save();let o=Vf(n,r),i=Gs(n,r);s===2&&(this.path(i),this.ctx.clip());let a,B,l,c;aA(i[0])?(a=i[0].start.x,B=i[0].start.y):(a=i[0].x,B=i[0].y),aA(i[1])?(l=i[1].end.x,c=i[1].end.y):(l=i[1].x,c=i[1].y);let g;r===0||r===2?g=Math.abs(a-l):g=Math.abs(B-c),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(i.slice(0,2));let f=t<3?t*3:t*2,u=t<3?t*2:t;s===3&&(f=t,u=t);let Q=!0;if(g<=f*2)Q=!1;else if(g<=f*2+u){let h=g/(2*f+u);f*=h,u*=h}else{let h=Math.floor((g+u)/(f+u)),C=(g-h*f)/(h-1),w=(g-(h+1)*f)/h;u=w<=0||Math.abs(u-C)<Math.abs(u-w)?C:w}if(Q&&(s===3?this.ctx.setLineDash([0,f+u]):this.ctx.setLineDash([f,u])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=M(A),this.ctx.stroke(),this.ctx.setLineDash([]),s===2){if(aA(i[0])){let h=i[3],C=i[0];this.ctx.beginPath(),this.formatPath([new p(h.end.x,h.end.y),new p(C.start.x,C.start.y)]),this.ctx.stroke()}if(aA(i[1])){let h=i[1],C=i[2];this.ctx.beginPath(),this.formatPath([new p(h.end.x,h.end.y),new p(C.start.x,C.start.y)]),this.ctx.stroke()}}this.ctx.restore()}async render(A){this.options.backgroundColor&&(this.ctx.fillStyle=M(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height));let t=kf(A);return await this.renderStack(t),this.applyEffects([]),this.canvas}},zf=e=>e instanceof Ht||e instanceof Et?!0:e instanceof YA&&e.type!==mt&&e.type!==Ft,qf=(e,A)=>{switch(e){case 0:return _t(A);case 2:return Df(A);default:return Lt(A)}},$f=e=>{switch(e){case 1:return"center";case 2:return"right";default:return"left"}},jf=["-apple-system","system-ui"],Au=e=>/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(A=>jf.indexOf(A)===-1):e,cn=class extends vt{constructor(A,t){super(A,t),this.canvas=t.canvas?t.canvas:document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),this.options=t,this.canvas.width=Math.floor(t.width*t.scale),this.canvas.height=Math.floor(t.height*t.scale),this.canvas.style.width=`${t.width}px`,this.canvas.style.height=`${t.height}px`,this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-t.x,-t.y),this.context.logger.debug(`EXPERIMENTAL ForeignObject renderer initialized (${t.width}x${t.height} at ${t.x},${t.y}) with scale ${t.scale}`)}async render(A){let t=Zr(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,A),r=await eu(t);return this.options.backgroundColor&&(this.ctx.fillStyle=M(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),this.canvas}},eu=e=>new Promise((A,t)=>{let r=new Image;r.onload=()=>{A(r)},r.onerror=t,r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(e))}`}),Dt=class{constructor({id:A,enabled:t}){this.id=A,this.enabled=t,this.start=Date.now()}debug(...A){this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.debug=="function"?console.debug(this.id,`${this.getTime()}ms`,...A):this.info(...A))}getTime(){return Date.now()-this.start}info(...A){this.enabled&&typeof window!="undefined"&&window.console&&typeof console.info=="function"&&console.info(this.id,`${this.getTime()}ms`,...A)}warn(...A){this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.warn=="function"?console.warn(this.id,`${this.getTime()}ms`,...A):this.info(...A))}error(...A){this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.error=="function"?console.error(this.id,`${this.getTime()}ms`,...A):this.info(...A))}};Dt.instances={};Mt=class e{constructor(A,t){var r;this.windowBounds=t,this.instanceName=`#${e.instanceCount++}`,this.logger=new Dt({id:this.instanceName,enabled:A.logging}),this.cache=(r=A.cache)!=null?r:new rn(this,A)}};Mt.instanceCount=1;ko=e=>{Ro=e},Go=(e,A={})=>tu(e,A);Go.setCspNonce=ko;typeof window!="undefined"&&ge.setContext(window);tu=async(e,A)=>{var m,I,S,G,y,Z,mA,E,L,D,sA,oA,QA,b,V,fA,IA;if(!e||typeof e!="object")return Promise.reject("Invalid element provided as first argument");let t=e.ownerDocument;if(!t)throw new Error("Element is not attached to a Document");let r=t.defaultView;if(!r)throw new Error("Document is not attached to a Window");let n={allowTaint:(m=A.allowTaint)!=null?m:!1,imageTimeout:(I=A.imageTimeout)!=null?I:15e3,proxy:A.proxy,useCORS:(S=A.useCORS)!=null?S:!1,customIsSameOrigin:A.customIsSameOrigin},s={logging:(G=A.logging)!=null?G:!0,cache:A.cache,...n},o={windowWidth:(y=A.windowWidth)!=null?y:r.innerWidth,windowHeight:(Z=A.windowHeight)!=null?Z:r.innerHeight,scrollX:(mA=A.scrollX)!=null?mA:r.pageXOffset,scrollY:(E=A.scrollY)!=null?E:r.pageYOffset},i=new nA(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),a=new Mt(s,i),B=(L=A.foreignObjectRendering)!=null?L:!1,l={allowTaint:(D=A.allowTaint)!=null?D:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,iframeContainer:A.iframeContainer,inlineImages:B,copyStyles:B,cspNonce:Ro};a.logger.debug(`Starting document clone with size ${i.width}x${i.height} scrolled to ${-i.left},${-i.top}`);let c=new xt(a,e,l),g=c.clonedReferenceElement;if(!g)return Promise.reject("Unable to find element in cloned iframe");let f=await c.toIFrame(t,i),{width:u,height:Q,left:h,top:C}=hn(g)||uf(g)?Gi(g.ownerDocument):Ot(a,g),w=ru(a,g,A.backgroundColor),F={canvas:A.canvas,backgroundColor:w,scale:(oA=(sA=A.scale)!=null?sA:r.devicePixelRatio)!=null?oA:1,x:((QA=A.x)!=null?QA:0)+h,y:((b=A.y)!=null?b:0)+C,width:(V=A.width)!=null?V:Math.ceil(u),height:(fA=A.height)!=null?fA:Math.ceil(Q)},H;if(B)a.logger.debug("Document cloned, using foreign object rendering"),H=await new cn(a,F).render(g);else{a.logger.debug(`Document cloned, element located at ${h},${C} with size ${u}x${Q} using computed rendering`),a.logger.debug("Starting DOM parsing");let GA=_o(a,g);w===GA.styles.backgroundColor&&(GA.styles.backgroundColor=CA.TRANSPARENT),a.logger.debug(`Starting renderer for element at ${F.x},${F.y} with size ${F.width}x${F.height}`),H=await new Bn(a,F).render(GA)}return((IA=A.removeContainer)==null||IA)&&(xt.destroy(f)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),H},ru=(e,A,t)=>{let r=A.ownerDocument,n=r.documentElement?ce(e,getComputedStyle(r.documentElement).backgroundColor):CA.TRANSPARENT,s=r.body?ce(e,getComputedStyle(r.body).backgroundColor):CA.TRANSPARENT,o=typeof t=="string"?ce(e,t):t===null?CA.TRANSPARENT:4294967295;return A===r.documentElement?vA(n)?vA(s)?o:s:n:o}});var Oi=["description","feedback_type","severity","env","page_url","user_agent","capture_method"];function Tn(e){var n,s;let A=((n=e.endpoint)!=null?n:"").replace(/\/+$/,"");if(!A)throw new Error('[mhosaic-feedback] `endpoint` is required (e.g. "https://feedback.example.com").');let t=(s=e.fetch)!=null?s:globalThis.fetch;async function r(o){let i=o;if(e.beforeSend&&(i=await e.beforeSend(o)),i===!1)throw new Error("Submission cancelled by beforeSend");let a=new FormData;for(let l of Oi)a.append(l,String(i[l]));a.append("technical_context",JSON.stringify(i.technical_context)),i.screenshot&&a.append("screenshot",i.screenshot,"screenshot.png"),i.synthetic&&a.append("synthetic","true");let B=await t(`${A}/api/feedback/v1/reports/`,{method:"POST",headers:{Authorization:`Bearer ${e.apiKey}`},body:a});if(!B.ok){let l=await B.text().catch(()=>"");throw new Error(`Feedback submit failed: ${B.status} ${l}`)}return B.json()}return{submitReport:r}}var Ri=/token|key|password|secret|auth|session|sig/i;function vn(e){try{let A=/^https?:\/\//i.test(e),t=e.startsWith("/");if(!A&&!t)return e;let r=typeof window!="undefined"?window.location.origin:"http://localhost",n=new URL(e,r),s=new URLSearchParams;return n.searchParams.forEach((o,i)=>{s.set(i,Ri.test(i)?"[redacted]":o)}),n.search=s.toString(),n.toString()}catch(A){return e}}function Dn(){var n;let e=navigator,A=(n=e.connection)==null?void 0:n.effectiveType,t=e.deviceMemory,r=document.referrer||void 0;return{viewport:{w:window.innerWidth,h:window.innerHeight,dpr:window.devicePixelRatio||1},screen:{w:window.screen.width,h:window.screen.height},platform:e.platform,language:e.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset(),...A!==void 0&&{connection:A},online:e.onLine,...t!==void 0&&{deviceMemory:t},hardwareConcurrency:e.hardwareConcurrency,...r!==void 0&&{referrer:r},title:document.title,pathname:window.location.pathname}}function ki(e){if(e==null)return String(e);if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(e instanceof Error)return`${e.name}: ${e.message}`;if(e instanceof Element)return`<${e.tagName.toLowerCase()}>`;try{return JSON.stringify(e,(A,t)=>typeof t=="bigint"?t.toString():t)}catch(A){try{return String(e)}catch(t){return"[unserializable]"}}}function Mn(e){let A=["log","info","warn","error","debug"],t={};for(let r of A){let n=console[r];typeof n=="function"&&(t[r]=n,console[r]=function(...o){try{let i=o.map(ki).join(" ").slice(0,2e3),a={level:r,message:i,ts:Date.now()};if(r==="error"){let B=new Error().stack;B&&(a.stack=B.split(`
6
6
  `).slice(2,8).join(`
7
- `))}e.push(a)}catch(i){}n.apply(console,o)})}return()=>{for(let[r,n]of Object.entries(t))console[r]=n}}function On(e,A){if(typeof window=="undefined"||typeof window.fetch!="function")return()=>{};let t=window.fetch.bind(window);return window.fetch=async function(n,s){let o=performance.now(),i=typeof n=="string"?n:n instanceof URL?n.toString():n.url,a=((s==null?void 0:s.method)||(n instanceof Request?n.method:"GET")).toUpperCase();try{let B=await t(n,s);return e.push({url:A(i),method:a,status:B.status,durationMs:Math.round(performance.now()-o),ts:Date.now()}),B}catch(B){throw e.push({url:A(i),method:a,status:0,durationMs:Math.round(performance.now()-o),ts:Date.now(),error:B instanceof Error?B.message:String(B)}),B}},()=>{window.fetch=t}}function Rn(e,A){if(typeof window=="undefined"||typeof window.XMLHttpRequest!="function")return()=>{};let t=window.XMLHttpRequest,r=t.prototype.open,n=t.prototype.send;return t.prototype.open=function(o,i){return this.__mfb={method:o.toUpperCase(),url:typeof i=="string"?i:i.toString(),start:performance.now()},r.apply(this,arguments)},t.prototype.send=function(o){return this.addEventListener("loadend",()=>{try{let i=this.__mfb;if(!i)return;e.push({url:A(i.url),method:i.method,status:this.status,durationMs:Math.round(performance.now()-i.start),ts:Date.now()})}catch(i){}}),n.call(this,o!=null?o:null)},()=>{t.prototype.open=r,t.prototype.send=n}}function kn(e){if(typeof window=="undefined")return()=>{};let A=r=>{let n=r.error instanceof Error?r.error.stack:void 0;e.push({message:r.message||"Unknown error",...n!==void 0&&{stack:n},ts:Date.now(),source:"window.error"})},t=r=>{let n=r.reason,s=n instanceof Error?n.message:typeof n=="string"?n:(()=>{try{return JSON.stringify(n)}catch(i){return String(n)}})(),o=n instanceof Error?n.stack:void 0;e.push({message:s,...o!==void 0&&{stack:o},ts:Date.now(),source:"unhandledrejection"})};return window.addEventListener("error",A),window.addEventListener("unhandledrejection",t),()=>{window.removeEventListener("error",A),window.removeEventListener("unhandledrejection",t)}}function Gn(e=1e3){let A=[],t=[],r=null;if(typeof PerformanceObserver!="undefined")try{r=new PerformanceObserver(n=>{for(let s of n.getEntries())if(s.entryType==="longtask")for(A.push({duration:s.duration,startTime:s.startTime});A.length>20;)A.shift();else if(s.entryType==="resource"){let o=s;if(o.duration>e)for(t.push({name:o.name,duration:o.duration,initiatorType:o.initiatorType});t.length>20;)t.shift()}}),r.observe({entryTypes:["longtask","resource"]})}catch(n){}return{snapshot(){let n=typeof performance!="undefined"?performance.getEntriesByType("navigation")[0]:void 0,s=n?{type:n.type,duration:n.duration}:void 0;return{...s!==void 0&&{navigation:s},longTasks:A.slice(),slowResources:t.slice()}},dispose(){r==null||r.disconnect()}}}var jA=class{constructor(A){ar(this,"max",A);ar(this,"items",[])}push(A){for(this.items.push(A);this.items.length>this.max;)this.items.shift()}snapshot(){return this.items.slice()}clear(){this.items.length=0}};function Nn(e={}){var f;let{maxConsole:A=50,maxNetwork:t=50,maxErrors:r=20}=e,n=(f=e.sanitizeUrl)!=null?f:vn,s=new jA(A),o=new jA(t),i=new jA(r),a=Mn(s),B=On(o,n),l=Rn(o,n),c=kn(i),g=Gn();return{snapshot(){return{consoleLogs:s.snapshot(),networkRequests:o.snapshot(),errors:i.snapshot(),device:Dn(),capturedAt:Date.now()}},clear(){s.clear(),o.clear(),i.clear()},dispose(){a(),B(),l(),c(),g.dispose()}}}function Po(e){return e.hasAttribute("data-mfb-mask")||e.classList.contains("mfb-mask")}function nu(e){let A=e.join(",").trim();return A?t=>Po(t)||t.matches(A):Po}async function Xo(e,A={}){var t;if(typeof document=="undefined")return null;try{let r=(await Promise.resolve().then(()=>(Vo(),No))).default,n=nu((t=A.mask)!=null?t:[]),s=await r(e,{ignoreElements:o=>n(o),useCORS:!0,logging:!1,backgroundColor:null});return await new Promise(o=>s.toBlob(o,"image/png"))}catch(r){return null}}var su={"fab.label":"Send feedback","form.title":"Send feedback","form.description.label":"What happened?","form.description.placeholder":"Describe the issue or idea in one or two sentences.","form.type.label":"Type","form.severity.label":"Severity","form.submit":"Send","form.cancel":"Cancel","form.close":"Close","form.submitting":"Sending\u2026","form.success":"Thanks \u2014 your feedback was sent.","form.error":"Could not send. Please try again.","form.screenshot.label":"Screenshot","form.screenshot.cta_click":"Click","form.screenshot.cta_rest":"drop, or paste an image","form.screenshot.formats":"PNG, JPEG or WebP \u2014 up to 10 MB","form.screenshot.remove":"Remove screenshot","form.screenshot.annotate":"Annotate","form.screenshot.error_type":"Unsupported file type. Use PNG, JPEG or WebP.","form.screenshot.error_size":"File too large (max {max} MB).","form.context.label":"Page","type.bug":"Bug","type.feature":"Feature request","type.question":"Question","type.praise":"Praise","type.typo":"Typo","severity.blocker":"Blocker","severity.high":"High","severity.medium":"Medium","severity.low":"Low","annotator.title":"Annotate screenshot","annotator.tool.rectangle":"Rectangle","annotator.tool.arrow":"Arrow","annotator.tool.freehand":"Freehand","annotator.tool.text":"Text","annotator.text_prompt":"Enter text:","annotator.undo":"Undo","annotator.clear":"Clear all","annotator.count_suffix":"annotations","annotator.loading":"Loading\u2026","annotator.apply":"Apply","annotator.applying":"Applying\u2026"},ou={"fab.label":"Envoyer un commentaire","form.title":"Envoyer un commentaire","form.description.label":"Qu\u2019est-il arriv\xE9 ?","form.description.placeholder":"D\xE9crivez le probl\xE8me ou l\u2019id\xE9e en une ou deux phrases.","form.type.label":"Type","form.severity.label":"S\xE9v\xE9rit\xE9","form.submit":"Envoyer","form.cancel":"Annuler","form.close":"Fermer","form.submitting":"Envoi\u2026","form.success":"Merci \u2014 votre commentaire a \xE9t\xE9 envoy\xE9.","form.error":"\xC9chec d\u2019envoi. Veuillez r\xE9essayer.","form.screenshot.label":"Capture d\u2019\xE9cran","form.screenshot.cta_click":"Cliquez","form.screenshot.cta_rest":"d\xE9posez ou collez une image","form.screenshot.formats":"PNG, JPEG ou WebP \u2014 jusqu\u2019\xE0 10 Mo","form.screenshot.remove":"Retirer la capture","form.screenshot.annotate":"Annoter","form.screenshot.error_type":"Format non support\xE9. Utilisez PNG, JPEG ou WebP.","form.screenshot.error_size":"Fichier trop volumineux (max {max} Mo).","form.context.label":"Page","type.bug":"Bogue","type.feature":"Suggestion","type.question":"Question","type.praise":"Compliment","type.typo":"Coquille","severity.blocker":"Bloquant","severity.high":"\xC9lev\xE9e","severity.medium":"Moyenne","severity.low":"Faible","annotator.title":"Annoter la capture","annotator.tool.rectangle":"Rectangle","annotator.tool.arrow":"Fl\xE8che","annotator.tool.freehand":"Dessin libre","annotator.tool.text":"Texte","annotator.text_prompt":"Entrez le texte :","annotator.undo":"Annuler","annotator.clear":"Tout effacer","annotator.count_suffix":"annotations","annotator.loading":"Chargement\u2026","annotator.apply":"Appliquer","annotator.applying":"Application\u2026"},iu={fr:ou};function au(e){var t;if(!e)return null;let A=e.toLowerCase().split(/[-_]/)[0];return(t=iu[A])!=null?t:null}function Jo(e,A={}){var r;let t=(r=au(A.locale))!=null?r:{};return{...su,...t,...e}}var nr,v,qo,Bu,RA,Wo,$o,jo,dn,$t,Ne,Ai,Fn,Cn,Un,cu,er={},tr=[],lu=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,sr=Array.isArray;function yA(e,A){for(var t in A)e[t]=A[t];return e}function mn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function En(e,A,t){var r,n,s,o={};for(s in A)s=="key"?r=A[s]:s=="ref"?n=A[s]:o[s]=A[s];if(arguments.length>2&&(o.children=arguments.length>3?nr.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return jt(e,o,r,n,null)}function jt(e,A,t,r,n){var s={type:e,props:A,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n==null?++qo:n,__i:-1,__u:0};return n==null&&v.vnode!=null&&v.vnode(s),s}function kA(e){return e.children}function Ar(e,A){this.props=e,this.context=A}function we(e,A){if(A==null)return e.__?we(e.__,e.__i+1):null;for(var t;A<e.__k.length;A++)if((t=e.__k[A])!=null&&t.__e!=null)return t.__e;return typeof e.type=="function"?we(e):null}function gu(e){if(e.__P&&e.__d){var A=e.__v,t=A.__e,r=[],n=[],s=yA({},A);s.__v=A.__v+1,v.vnode&&v.vnode(s),Hn(e.__P,s,A,e.__n,e.__P.namespaceURI,32&A.__u?[t]:null,r,t==null?we(A):t,!!(32&A.__u),n),s.__v=A.__v,s.__.__k[s.__i]=s,ni(r,s,n),A.__e=A.__=null,s.__e!=t&&ei(s)}}function ei(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(A){if(A!=null&&A.__e!=null)return e.__e=e.__c.base=A.__e}),ei(e)}function Yo(e){(!e.__d&&(e.__d=!0)&&RA.push(e)&&!rr.__r++||Wo!=v.debounceRendering)&&((Wo=v.debounceRendering)||$o)(rr)}function rr(){try{for(var e,A=1;RA.length;)RA.length>A&&RA.sort(jo),e=RA.shift(),A=RA.length,gu(e)}finally{RA.length=rr.__r=0}}function ti(e,A,t,r,n,s,o,i,a,B,l){var c,g,f,u,Q,h,C,w=r&&r.__k||tr,F=A.length;for(a=fu(t,A,w,a,F),c=0;c<F;c++)(f=t.__k[c])!=null&&(g=f.__i!=-1&&w[f.__i]||er,f.__i=c,h=Hn(e,f,g,n,s,o,i,a,B,l),u=f.__e,f.ref&&g.ref!=f.ref&&(g.ref&&bn(g.ref,null,f),l.push(f.ref,f.__c||u,f)),Q==null&&u!=null&&(Q=u),(C=!!(4&f.__u))||g.__k===f.__k?(a=ri(f,a,e,C),C&&g.__e&&(g.__e=null)):typeof f.type=="function"&&h!==void 0?a=h:u&&(a=u.nextSibling),f.__u&=-7);return t.__e=Q,a}function fu(e,A,t,r,n){var s,o,i,a,B,l=t.length,c=l,g=0;for(e.__k=new Array(n),s=0;s<n;s++)(o=A[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[s]=jt(null,o,null,null,null):sr(o)?o=e.__k[s]=jt(kA,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[s]=jt(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[s]=o,a=s+g,o.__=e,o.__b=e.__b+1,i=null,(B=o.__i=uu(o,t,a,c))!=-1&&(c--,(i=t[B])&&(i.__u|=2)),i==null||i.__v==null?(B==-1&&(n>l?g--:n<l&&g++),typeof o.type!="function"&&(o.__u|=4)):B!=a&&(B==a-1?g--:B==a+1?g++:(B>a?g--:g++,o.__u|=4))):e.__k[s]=null;if(c)for(s=0;s<l;s++)(i=t[s])!=null&&(2&i.__u)==0&&(i.__e==r&&(r=we(i)),oi(i,i));return r}function ri(e,A,t,r){var n,s;if(typeof e.type=="function"){for(n=e.__k,s=0;n&&s<n.length;s++)n[s]&&(n[s].__=e,A=ri(n[s],A,t,r));return A}e.__e!=A&&(r&&(A&&e.type&&!A.parentNode&&(A=we(e)),t.insertBefore(e.__e,A||null)),A=e.__e);do A=A&&A.nextSibling;while(A!=null&&A.nodeType==8);return A}function uu(e,A,t,r){var n,s,o,i=e.key,a=e.type,B=A[t],l=B!=null&&(2&B.__u)==0;if(B===null&&i==null||l&&i==B.key&&a==B.type)return t;if(r>(l?1:0)){for(n=t-1,s=t+1;n>=0||s<A.length;)if((B=A[o=n>=0?n--:s++])!=null&&(2&B.__u)==0&&i==B.key&&a==B.type)return o}return-1}function Zo(e,A,t){A[0]=="-"?e.setProperty(A,t==null?"":t):e[A]=t==null?"":typeof t!="number"||lu.test(A)?t:t+"px"}function qt(e,A,t,r,n){var s,o;A:if(A=="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(A in r)t&&A in t||Zo(e.style,A,"");if(t)for(A in t)r&&t[A]==r[A]||Zo(e.style,A,t[A])}else if(A[0]=="o"&&A[1]=="n")s=A!=(A=A.replace(Ai,"$1")),o=A.toLowerCase(),A=o in e||A=="onFocusOut"||A=="onFocusIn"?o.slice(2):A.slice(2),e.l||(e.l={}),e.l[A+s]=t,t?r?t[Ne]=r[Ne]:(t[Ne]=Fn,e.addEventListener(A,s?Un:Cn,s)):e.removeEventListener(A,s?Un:Cn,s);else{if(n=="http://www.w3.org/2000/svg")A=A.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(A!="width"&&A!="height"&&A!="href"&&A!="list"&&A!="form"&&A!="tabIndex"&&A!="download"&&A!="rowSpan"&&A!="colSpan"&&A!="role"&&A!="popover"&&A in e)try{e[A]=t==null?"":t;break A}catch(i){}typeof t=="function"||(t==null||t===!1&&A[4]!="-"?e.removeAttribute(A):e.setAttribute(A,A=="popover"&&t==1?"":t))}}function zo(e){return function(A){if(this.l){var t=this.l[A.type+e];if(A[$t]==null)A[$t]=Fn++;else if(A[$t]<t[Ne])return;return t(v.event?v.event(A):A)}}}function Hn(e,A,t,r,n,s,o,i,a,B){var l,c,g,f,u,Q,h,C,w,F,H,m,I,S,G,y=A.type;if(A.constructor!==void 0)return null;128&t.__u&&(a=!!(32&t.__u),s=[i=A.__e=t.__e]),(l=v.__b)&&l(A);A:if(typeof y=="function")try{if(C=A.props,w=y.prototype&&y.prototype.render,F=(l=y.contextType)&&r[l.__c],H=l?F?F.props.value:l.__:r,t.__c?h=(c=A.__c=t.__c).__=c.__E:(w?A.__c=c=new y(C,H):(A.__c=c=new Ar(C,H),c.constructor=y,c.render=Qu),F&&F.sub(c),c.state||(c.state={}),c.__n=r,g=c.__d=!0,c.__h=[],c._sb=[]),w&&c.__s==null&&(c.__s=c.state),w&&y.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=yA({},c.__s)),yA(c.__s,y.getDerivedStateFromProps(C,c.__s))),f=c.props,u=c.state,c.__v=A,g)w&&y.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),w&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(w&&y.getDerivedStateFromProps==null&&C!==f&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(C,H),A.__v==t.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(C,c.__s,H)===!1){A.__v!=t.__v&&(c.props=C,c.state=c.__s,c.__d=!1),A.__e=t.__e,A.__k=t.__k,A.__k.some(function(Z){Z&&(Z.__=A)}),tr.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&o.push(c);break A}c.componentWillUpdate!=null&&c.componentWillUpdate(C,c.__s,H),w&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(f,u,Q)})}if(c.context=H,c.props=C,c.__P=e,c.__e=!1,m=v.__r,I=0,w)c.state=c.__s,c.__d=!1,m&&m(A),l=c.render(c.props,c.state,c.context),tr.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,m&&m(A),l=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++I<25);c.state=c.__s,c.getChildContext!=null&&(r=yA(yA({},r),c.getChildContext())),w&&!g&&c.getSnapshotBeforeUpdate!=null&&(Q=c.getSnapshotBeforeUpdate(f,u)),S=l!=null&&l.type===kA&&l.key==null?si(l.props.children):l,i=ti(e,sr(S)?S:[S],A,t,r,n,s,o,i,a,B),c.base=A.__e,A.__u&=-161,c.__h.length&&o.push(c),h&&(c.__E=c.__=null)}catch(Z){if(A.__v=null,a||s!=null)if(Z.then){for(A.__u|=a?160:128;i&&i.nodeType==8&&i.nextSibling;)i=i.nextSibling;s[s.indexOf(i)]=null,A.__e=i}else{for(G=s.length;G--;)mn(s[G]);pn(A)}else A.__e=t.__e,A.__k=t.__k,Z.then||pn(A);v.__e(Z,A,t)}else s==null&&A.__v==t.__v?(A.__k=t.__k,A.__e=t.__e):i=A.__e=wu(t.__e,A,t,r,n,s,o,a,B);return(l=v.diffed)&&l(A),128&A.__u?void 0:i}function pn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(pn))}function ni(e,A,t){for(var r=0;r<t.length;r++)bn(t[r],t[++r],t[++r]);v.__c&&v.__c(A,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(s){s.call(n)})}catch(s){v.__e(s,n.__v)}})}function si(e){return typeof e!="object"||e==null||e.__b>0?e:sr(e)?e.map(si):yA({},e)}function wu(e,A,t,r,n,s,o,i,a){var B,l,c,g,f,u,Q,h=t.props||er,C=A.props,w=A.type;if(w=="svg"?n="http://www.w3.org/2000/svg":w=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),s!=null){for(B=0;B<s.length;B++)if((f=s[B])&&"setAttribute"in f==!!w&&(w?f.localName==w:f.nodeType==3)){e=f,s[B]=null;break}}if(e==null){if(w==null)return document.createTextNode(C);e=document.createElementNS(n,w,C.is&&C),i&&(v.__m&&v.__m(A,s),i=!1),s=null}if(w==null)h===C||i&&e.data==C||(e.data=C);else{if(s=s&&nr.call(e.childNodes),!i&&s!=null)for(h={},B=0;B<e.attributes.length;B++)h[(f=e.attributes[B]).name]=f.value;for(B in h)f=h[B],B=="dangerouslySetInnerHTML"?c=f:B=="children"||B in C||B=="value"&&"defaultValue"in C||B=="checked"&&"defaultChecked"in C||qt(e,B,null,f,n);for(B in C)f=C[B],B=="children"?g=f:B=="dangerouslySetInnerHTML"?l=f:B=="value"?u=f:B=="checked"?Q=f:i&&typeof f!="function"||h[B]===f||qt(e,B,f,h[B],n);if(l)i||c&&(l.__html==c.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),A.__k=[];else if(c&&(e.innerHTML=""),ti(A.type=="template"?e.content:e,sr(g)?g:[g],A,t,r,w=="foreignObject"?"http://www.w3.org/1999/xhtml":n,s,o,s?s[0]:t.__k&&we(t,0),i,a),s!=null)for(B=s.length;B--;)mn(s[B]);i||(B="value",w=="progress"&&u==null?e.removeAttribute("value"):u!=null&&(u!==e[B]||w=="progress"&&!u||w=="option"&&u!=h[B])&&qt(e,B,u,h[B],n),B="checked",Q!=null&&Q!=e[B]&&qt(e,B,Q,h[B],n))}return e}function bn(e,A,t){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&A==null||(e.__u=e(A))}else e.current=A}catch(n){v.__e(n,t)}}function oi(e,A,t){var r,n;if(v.unmount&&v.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||bn(r,null,A)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){v.__e(s,A)}r.base=r.__P=null}if(r=e.__k)for(n=0;n<r.length;n++)r[n]&&oi(r[n],A,t||typeof e.type!="function");t||mn(e.__e),e.__c=e.__=e.__e=void 0}function Qu(e,A,t){return this.constructor(e,t)}function yn(e,A,t){var r,n,s,o;A==document&&(A=document.documentElement),v.__&&v.__(e,A),n=(r=typeof t=="function")?null:t&&t.__k||A.__k,s=[],o=[],Hn(A,e=(!r&&t||A).__k=En(kA,null,[e]),n||er,er,A.namespaceURI,!r&&t?[t]:n?null:A.firstChild?nr.call(A.childNodes):null,s,!r&&t?t:n?n.__e:A.firstChild,r,o),ni(s,e,o)}nr=tr.slice,v={__e:function(e,A,t,r){for(var n,s,o;A=A.__;)if((n=A.__c)&&!n.__)try{if((s=n.constructor)&&s.getDerivedStateFromError!=null&&(n.setState(s.getDerivedStateFromError(e)),o=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,r||{}),o=n.__d),o)return n.__E=n}catch(i){e=i}throw e}},qo=0,Bu=function(e){return e!=null&&e.constructor===void 0},Ar.prototype.setState=function(e,A){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=yA({},this.state),typeof e=="function"&&(e=e(yA({},t),this.props)),e&&yA(t,e),e!=null&&this.__v&&(A&&this._sb.push(A),Yo(this))},Ar.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Yo(this))},Ar.prototype.render=kA,RA=[],$o=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jo=function(e,A){return e.__v.__b-A.__v.__b},rr.__r=0,dn=Math.random().toString(8),$t="__d"+dn,Ne="__a"+dn,Ai=/(PointerCapture)$|Capture$/i,Fn=0,Cn=zo(!1),Un=zo(!0),cu=0;var Ve,J,In,ii,Pe=0,wi=[],Y=v,ai=Y.__b,Bi=Y.__r,ci=Y.diffed,li=Y.__c,gi=Y.unmount,fi=Y.__;function _n(e,A){Y.__h&&Y.__h(J,e,Pe||A),Pe=0;var t=J.__H||(J.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function AA(e){return Pe=1,hu(Ci,e)}function hu(e,A,t){var r=_n(Ve++,2);if(r.t=e,!r.__c&&(r.__=[t?t(A):Ci(void 0,A),function(i){var a=r.__N?r.__N[0]:r.__[0],B=r.t(a,i);a!==B&&(r.__N=[B,r.__[1]],r.__c.setState({}))}],r.__c=J,!J.__f)){var n=function(i,a,B){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(g){return g.__c});if(l.every(function(g){return!g.__N}))return!s||s.call(this,i,a,B);var c=r.__c.props!==i;return l.some(function(g){if(g.__N){var f=g.__[0];g.__=g.__N,g.__N=void 0,f!==g.__[0]&&(c=!0)}}),s&&s.call(this,i,a,B)||c};J.__f=!0;var s=J.shouldComponentUpdate,o=J.componentWillUpdate;J.componentWillUpdate=function(i,a,B){if(this.__e){var l=s;s=void 0,n(i,a,B),s=l}o&&o.call(this,i,a,B)},J.shouldComponentUpdate=n}return r.__N||r.__}function FA(e,A){var t=_n(Ve++,3);!Y.__s&&di(t.__H,A)&&(t.__=e,t.u=A,J.__H.__h.push(t))}function gA(e){return Pe=5,Qi(function(){return{current:e}},[])}function Qi(e,A){var t=_n(Ve++,7);return di(t.__H,A)&&(t.__=e(),t.__H=A,t.__h=e),t.__}function hi(e,A){return Pe=8,Qi(function(){return e},A)}function du(){for(var e;e=wi.shift();){var A=e.__H;if(e.__P&&A)try{A.__h.some(or),A.__h.some(xn),A.__h=[]}catch(t){A.__h=[],Y.__e(t,e.__v)}}}Y.__b=function(e){J=null,ai&&ai(e)},Y.__=function(e,A){e&&A.__k&&A.__k.__m&&(e.__m=A.__k.__m),fi&&fi(e,A)},Y.__r=function(e){Bi&&Bi(e),Ve=0;var A=(J=e.__c).__H;A&&(In===J?(A.__h=[],J.__h=[],A.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(A.__h.some(or),A.__h.some(xn),A.__h=[],Ve=0)),In=J},Y.diffed=function(e){ci&&ci(e);var A=e.__c;A&&A.__H&&(A.__H.__h.length&&(wi.push(A)!==1&&ii===Y.requestAnimationFrame||((ii=Y.requestAnimationFrame)||Cu)(du)),A.__H.__.some(function(t){t.u&&(t.__H=t.u),t.u=void 0})),In=J=null},Y.__c=function(e,A){A.some(function(t){try{t.__h.some(or),t.__h=t.__h.filter(function(r){return!r.__||xn(r)})}catch(r){A.some(function(n){n.__h&&(n.__h=[])}),A=[],Y.__e(r,t.__v)}}),li&&li(e,A)},Y.unmount=function(e){gi&&gi(e);var A,t=e.__c;t&&t.__H&&(t.__H.__.some(function(r){try{or(r)}catch(n){A=n}}),t.__H=void 0,A&&Y.__e(A,t.__v))};var ui=typeof requestAnimationFrame=="function";function Cu(e){var A,t=function(){clearTimeout(r),ui&&cancelAnimationFrame(A),setTimeout(e)},r=setTimeout(t,35);ui&&(A=requestAnimationFrame(t))}function or(e){var A=J,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),J=A}function xn(e){var A=J;e.__c=e.__(),J=A}function di(e,A){return!e||e.length!==A.length||A.some(function(t,r){return t!==e[r]})}function Ci(e,A){return typeof A=="function"?A(e):A}var Uu=0;function d(e,A,t,r,n,s){A||(A={});var o,i,a=A;if("ref"in a)for(i in a={},A)i=="ref"?o=A[i]:a[i]=A[i];var B={type:e,props:a,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Uu,__i:-1,__u:0,__source:n,__self:s};if(typeof e=="function"&&(o=e.defaultProps))for(i in o)a[i]===void 0&&(a[i]=o[i]);return v.vnode&&v.vnode(B),B}function Ui({label:e,onClick:A}){return d("button",{type:"button",class:"fab","aria-label":e,onClick:A,children:"\u{1F4AC}"})}var pi=["#ef4444","#f59e0b","#10b981","#3b82f6","#ffffff"];function Fi(e,A){if(e.save(),e.strokeStyle=A.color,e.fillStyle=A.color,e.lineWidth=A.lineWidth,e.lineCap="round",e.lineJoin="round",A.kind==="rectangle")e.strokeRect(A.x,A.y,A.w,A.h);else if(A.kind==="arrow")pu(e,A.x1,A.y1,A.x2,A.y2);else if(A.kind==="freehand"){if(A.points.length<2){e.restore();return}e.beginPath(),e.moveTo(A.points[0].x,A.points[0].y);for(let t=1;t<A.points.length;t++)e.lineTo(A.points[t].x,A.points[t].y);e.stroke()}else if(A.kind==="text"){e.font=`bold ${A.fontSize}px -apple-system, BlinkMacSystemFont, sans-serif`,e.textBaseline="top";let t=e.measureText(A.text),r=4,n=t.width+r*2,s=A.fontSize+r*2;e.fillStyle="rgba(0, 0, 0, 0.6)",e.fillRect(A.x-r,A.y-r,n,s),e.fillStyle=A.color,e.fillText(A.text,A.x,A.y)}e.restore()}function pu(e,A,t,r,n){let o=Math.atan2(n-t,r-A);e.beginPath(),e.moveTo(A,t),e.lineTo(r,n),e.stroke(),e.beginPath(),e.moveTo(r,n),e.lineTo(r-14*Math.cos(o-Math.PI/6),n-14*Math.sin(o-Math.PI/6)),e.lineTo(r-14*Math.cos(o+Math.PI/6),n-14*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var qA={rect:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("rect",{x:"2",y:"3",width:"12",height:"10",fill:"none",stroke:"currentColor","stroke-width":"1.5"})}),arrow:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M2 8h11M9 4l4 4-4 4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),pencil:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"})}),text:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M3 3h10M8 3v10M5 13h6",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})}),undo:d("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M4 7l3-3M4 7l3 3M4 7h6a3 3 0 0 1 0 6H7",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),trash:d("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M3 4h10M6 4V2.5h4V4M5 4l.5 9h5L11 4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),close:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M4 4l8 8M12 4l-8 8",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})})};function mi({imageBlob:e,strings:A,onSave:t,onCancel:r}){let n=gA(null),s=gA(null),o=gA(null),[i,a]=AA("rectangle"),[B,l]=AA(pi[0]),[c,g]=AA([]),f=gA(!1),[u,Q]=AA(null),[h,C]=AA(!1),[w,F]=AA(!1),H=gA(1);FA(()=>{let E=L=>{L.key==="Escape"&&(L.stopPropagation(),r())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[r]),FA(()=>{let E=URL.createObjectURL(e),L=new Image;return L.onload=()=>{o.current=L,C(!0)},L.src=E,()=>URL.revokeObjectURL(E)},[e]),FA(()=>{if(!h||!n.current||!o.current||!s.current)return;let E=o.current,D=s.current.clientWidth-16,sA=window.innerHeight*.6,oA=Math.min(D/E.width,sA/E.height,1);H.current=oA;let QA=n.current;QA.width=E.width,QA.height=E.height,QA.style.width=`${E.width*oA}px`,QA.style.height=`${E.height*oA}px`,m()},[h]),FA(()=>{m()},[c,u]);function m(){let E=n.current,L=o.current;if(!E||!L)return;let D=E.getContext("2d");if(D){D.clearRect(0,0,E.width,E.height),D.drawImage(L,0,0);for(let sA of c)Fi(D,sA);u&&Fi(D,u)}}function I(E){let D=n.current.getBoundingClientRect();return{x:(E.clientX-D.left)/H.current,y:(E.clientY-D.top)/H.current}}let S=E=>{if(!h)return;let{x:L,y:D}=I(E),sA=Math.max(3,Math.round(n.current.width/400));if(i==="text"){let oA=window.prompt(A["annotator.text_prompt"]);oA&&oA.trim()&&g(QA=>[...QA,{kind:"text",x:L,y:D,text:oA.trim(),color:B,fontSize:Math.max(16,Math.round(n.current.width/50)),lineWidth:1}]);return}f.current=!0,i==="rectangle"?Q({kind:"rectangle",x:L,y:D,w:0,h:0,color:B,lineWidth:sA}):i==="arrow"?Q({kind:"arrow",x1:L,y1:D,x2:L,y2:D,color:B,lineWidth:sA}):i==="freehand"&&Q({kind:"freehand",points:[{x:L,y:D}],color:B,lineWidth:sA})},G=E=>{if(!f.current||!u)return;let{x:L,y:D}=I(E);u.kind==="rectangle"?Q({...u,w:L-u.x,h:D-u.y}):u.kind==="arrow"?Q({...u,x2:L,y2:D}):u.kind==="freehand"&&Q({...u,points:[...u.points,{x:L,y:D}]})},y=()=>{f.current&&u&&(u.kind==="rectangle"&&Math.abs(u.w)<4&&Math.abs(u.h)<4||u.kind==="arrow"&&Math.hypot(u.x2-u.x1,u.y2-u.y1)<4||u.kind==="freehand"&&u.points.length<3||g(L=>[...L,u])),f.current=!1,Q(null)},Z=async()=>{let E=n.current;if(E){F(!0);try{let L=await new Promise(D=>E.toBlob(D,"image/png",.92));L&&t(L)}finally{F(!1)}}},mA=[{id:"rectangle",icon:qA.rect,label:A["annotator.tool.rectangle"]},{id:"arrow",icon:qA.arrow,label:A["annotator.tool.arrow"]},{id:"freehand",icon:qA.pencil,label:A["annotator.tool.freehand"]},{id:"text",icon:qA.text,label:A["annotator.tool.text"]}];return d("div",{class:"annotator-backdrop",role:"presentation",onClick:E=>{E.target===E.currentTarget&&r()},children:d("div",{class:"annotator",role:"dialog","aria-modal":"true","aria-label":A["annotator.title"],children:[d("div",{class:"annotator-header",children:[d("span",{children:A["annotator.title"]}),d("button",{type:"button",class:"modal-close","aria-label":A["form.close"],onClick:r,children:qA.close})]}),d("div",{class:"annotator-toolbar",children:[d("div",{class:"annotator-tools",children:mA.map(E=>d("button",{type:"button",onClick:()=>a(E.id),title:E.label,"aria-label":E.label,"aria-pressed":i===E.id,class:`annotator-tool ${i===E.id?"is-active":""}`,children:E.icon},E.id))}),d("span",{class:"annotator-sep"}),d("div",{class:"annotator-colors",children:pi.map(E=>d("button",{type:"button",onClick:()=>l(E),"aria-label":E,"aria-pressed":B===E,class:`annotator-color ${B===E?"is-active":""}`,style:{backgroundColor:E}},E))}),d("span",{class:"annotator-sep"}),d("button",{type:"button",class:"annotator-btn",onClick:()=>g(E=>E.slice(0,-1)),disabled:c.length===0,children:[qA.undo,d("span",{children:A["annotator.undo"]})]}),d("button",{type:"button",class:"annotator-btn",onClick:()=>g([]),disabled:c.length===0,children:[qA.trash,d("span",{children:A["annotator.clear"]})]}),d("span",{class:"annotator-spacer"}),d("span",{class:"annotator-count",children:[c.length," ",A["annotator.count_suffix"]]})]}),d("div",{ref:s,class:"annotator-canvas-wrap",children:h?d("canvas",{ref:n,onMouseDown:S,onMouseMove:G,onMouseUp:y,onMouseLeave:y,class:"annotator-canvas"}):d("span",{class:"annotator-loading",children:A["annotator.loading"]})}),d("div",{class:"annotator-footer",children:[d("button",{type:"button",class:"btn",onClick:r,children:A["form.cancel"]}),d("button",{type:"button",class:"btn btn--primary",onClick:Z,disabled:w||!h,children:w?A["annotator.applying"]:A["annotator.apply"]})]})]})})}var Fu=["image/png","image/jpeg","image/webp"];function Ei(e){return Fu.includes(e.type)?e.size>10485760?{kind:"size",maxMb:10485760/(1024*1024)}:null:{kind:"type"}}function Hi(e,A=80){if(e.length<=A)return e;let t=Math.floor((A-1)/2),r=A-1-t;return`${e.slice(0,t)}\u2026${e.slice(e.length-r)}`}var mu=["bug","feature","question","praise","typo"],Eu=["blocker","high","medium","low"];function bi({strings:e,onSubmit:A,onCancel:t,status:r,errorMessage:n}){let[s,o]=AA(""),[i,a]=AA("bug"),[B,l]=AA("medium"),[c,g]=AA(""),[f,u]=AA(null),[Q,h]=AA(null),[C,w]=AA(!1),[F,H]=AA(!1),m=gA(null),I=gA(null),S=r==="submitting",G=S?e["form.submitting"]:e["form.submit"],y=typeof window!="undefined"?window.location.href:"";FA(()=>()=>{Q&&URL.revokeObjectURL(Q)},[Q]);let Z=b=>{if(g(""),b instanceof File){let V=Ei(b);if(V){g(V.kind==="type"?e["form.screenshot.error_type"]:e["form.screenshot.error_size"].replace("{max}",String(V.maxMb)));return}}Q&&URL.revokeObjectURL(Q),u(b),h(URL.createObjectURL(b))},mA=()=>{Q&&URL.revokeObjectURL(Q),h(null),u(null),g(""),m.current&&(m.current.value="")},E=b=>{var fA;let V=(fA=b.target.files)==null?void 0:fA[0];V&&Z(V)},L=b=>{b.preventDefault(),b.stopPropagation(),w(!0)},D=b=>{b.preventDefault(),b.stopPropagation(),b.currentTarget===b.target&&w(!1)},sA=b=>{var fA,IA;b.preventDefault(),b.stopPropagation(),w(!1);let V=(IA=(fA=b.dataTransfer)==null?void 0:fA.files)==null?void 0:IA[0];V&&Z(V)};FA(()=>{let b=I.current;if(!b)return;let V=fA=>{var GA;let IA=(GA=fA.clipboardData)==null?void 0:GA.items;if(IA){for(let Xe of Array.from(IA))if(Xe.kind==="file"&&Xe.type.startsWith("image/")){let Kn=Xe.getAsFile();if(Kn){fA.preventDefault(),Z(Kn);return}}}};return b.addEventListener("paste",V),()=>b.removeEventListener("paste",V)},[Q]);let oA=b=>{Q&&URL.revokeObjectURL(Q),u(b),h(URL.createObjectURL(b)),H(!1)};return d("form",{onSubmit:b=>{if(b.preventDefault(),!s.trim()){g(e["form.description.placeholder"]);return}g("");let V={description:s.trim(),feedback_type:i,severity:B};f&&(V.screenshot=f),A(V)},children:[d("h2",{children:e["form.title"]}),d("div",{class:"field",children:[d("label",{for:"mfb-desc",children:e["form.description.label"]}),d("textarea",{id:"mfb-desc",value:s,placeholder:e["form.description.placeholder"],onInput:b=>o(b.target.value)})]}),d("div",{class:"row",children:[d("div",{class:"field",children:[d("label",{for:"mfb-type",children:e["form.type.label"]}),d("select",{id:"mfb-type",value:i,onChange:b=>a(b.target.value),children:mu.map(b=>d("option",{value:b,children:e[`type.${b}`]}))})]}),d("div",{class:"field",children:[d("label",{for:"mfb-sev",children:e["form.severity.label"]}),d("select",{id:"mfb-sev",value:B,onChange:b=>l(b.target.value),children:Eu.map(b=>d("option",{value:b,children:e[`severity.${b}`]}))})]})]}),d("div",{class:"field",children:[d("label",{children:e["form.screenshot.label"]}),d("input",{ref:m,type:"file",accept:"image/png,image/jpeg,image/webp",class:"mfb-sr-only",onChange:E,"aria-hidden":"true",tabIndex:-1}),Q?d("div",{class:"screenshot-preview",children:[d("img",{src:Q,alt:""}),d("button",{type:"button",class:"screenshot-remove",onClick:mA,"aria-label":e["form.screenshot.remove"],children:"\xD7"}),d("button",{type:"button",class:"btn screenshot-annotate",onClick:()=>H(!0),children:e["form.screenshot.annotate"]})]}):d("div",{ref:I,class:`screenshot-dropzone ${C?"is-dragover":""}`,tabIndex:0,role:"button","aria-label":e["form.screenshot.label"],onClick:()=>{var b;return(b=m.current)==null?void 0:b.click()},onKeyDown:b=>{var V;(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),(V=m.current)==null||V.click())},onDragOver:L,onDragLeave:D,onDrop:sA,children:[d("div",{class:"screenshot-cta",children:[d("strong",{children:e["form.screenshot.cta_click"]}),", ",e["form.screenshot.cta_rest"]]}),d("div",{class:"screenshot-formats",children:e["form.screenshot.formats"]})]})]}),y&&d("div",{class:"page-context",title:y,children:[d("span",{class:"page-context-label",children:e["form.context.label"]}),d("span",{class:"page-context-url",children:Hi(y,90)})]}),c&&d("div",{class:"error",children:c}),r==="error"&&n&&d("div",{class:"error",children:n}),r==="success"&&d("div",{class:"success",children:e["form.success"]}),d("div",{class:"actions",children:[d("button",{type:"button",class:"btn",onClick:t,disabled:S,children:e["form.cancel"]}),d("button",{type:"submit",class:"btn btn--primary",disabled:S,children:G})]}),F&&f&&d(mi,{imageBlob:f,strings:e,onCancel:()=>H(!1),onSave:oA})]})}function yi({onDismiss:e,children:A,closeLabel:t="Close"}){let r=gA(null),n=gA(null);return FA(()=>{var i;n.current=document.activeElement;let s=a=>{a.key==="Escape"&&(a.stopPropagation(),e())};window.addEventListener("keydown",s);let o=(i=r.current)==null?void 0:i.querySelector("textarea, input, select, button");return o==null||o.focus(),()=>{window.removeEventListener("keydown",s);let a=n.current;a&&typeof a.focus=="function"&&a.focus()}},[e]),d("div",{class:"backdrop",role:"presentation",onClick:s=>{s.target===s.currentTarget&&e()},children:d("div",{ref:r,class:"modal",role:"dialog","aria-modal":"true",children:[d("button",{type:"button",class:"modal-close","aria-label":t,onClick:e,children:"\xD7"}),A]})})}var Ii=`
7
+ `))}e.push(a)}catch(i){}n.apply(console,o)})}return()=>{for(let[r,n]of Object.entries(t))console[r]=n}}function On(e,A){if(typeof window=="undefined"||typeof window.fetch!="function")return()=>{};let t=window.fetch.bind(window);return window.fetch=async function(n,s){let o=performance.now(),i=typeof n=="string"?n:n instanceof URL?n.toString():n.url,a=((s==null?void 0:s.method)||(n instanceof Request?n.method:"GET")).toUpperCase();try{let B=await t(n,s);return e.push({url:A(i),method:a,status:B.status,durationMs:Math.round(performance.now()-o),ts:Date.now()}),B}catch(B){throw e.push({url:A(i),method:a,status:0,durationMs:Math.round(performance.now()-o),ts:Date.now(),error:B instanceof Error?B.message:String(B)}),B}},()=>{window.fetch=t}}function Rn(e,A){if(typeof window=="undefined"||typeof window.XMLHttpRequest!="function")return()=>{};let t=window.XMLHttpRequest,r=t.prototype.open,n=t.prototype.send;return t.prototype.open=function(o,i){return this.__mfb={method:o.toUpperCase(),url:typeof i=="string"?i:i.toString(),start:performance.now()},r.apply(this,arguments)},t.prototype.send=function(o){return this.addEventListener("loadend",()=>{try{let i=this.__mfb;if(!i)return;e.push({url:A(i.url),method:i.method,status:this.status,durationMs:Math.round(performance.now()-i.start),ts:Date.now()})}catch(i){}}),n.call(this,o!=null?o:null)},()=>{t.prototype.open=r,t.prototype.send=n}}function kn(e){if(typeof window=="undefined")return()=>{};let A=r=>{let n=r.error instanceof Error?r.error.stack:void 0;e.push({message:r.message||"Unknown error",...n!==void 0&&{stack:n},ts:Date.now(),source:"window.error"})},t=r=>{let n=r.reason,s=n instanceof Error?n.message:typeof n=="string"?n:(()=>{try{return JSON.stringify(n)}catch(i){return String(n)}})(),o=n instanceof Error?n.stack:void 0;e.push({message:s,...o!==void 0&&{stack:o},ts:Date.now(),source:"unhandledrejection"})};return window.addEventListener("error",A),window.addEventListener("unhandledrejection",t),()=>{window.removeEventListener("error",A),window.removeEventListener("unhandledrejection",t)}}function Gn(e=1e3){let A=[],t=[],r=null;if(typeof PerformanceObserver!="undefined")try{r=new PerformanceObserver(n=>{for(let s of n.getEntries())if(s.entryType==="longtask")for(A.push({duration:s.duration,startTime:s.startTime});A.length>20;)A.shift();else if(s.entryType==="resource"){let o=s;if(o.duration>e)for(t.push({name:o.name,duration:o.duration,initiatorType:o.initiatorType});t.length>20;)t.shift()}}),r.observe({entryTypes:["longtask","resource"]})}catch(n){}return{snapshot(){let n=typeof performance!="undefined"?performance.getEntriesByType("navigation")[0]:void 0,s=n?{type:n.type,duration:n.duration}:void 0;return{...s!==void 0&&{navigation:s},longTasks:A.slice(),slowResources:t.slice()}},dispose(){r==null||r.disconnect()}}}var jA=class{constructor(A){ar(this,"max",A);ar(this,"items",[])}push(A){for(this.items.push(A);this.items.length>this.max;)this.items.shift()}snapshot(){return this.items.slice()}clear(){this.items.length=0}};function Nn(e={}){var f;let{maxConsole:A=50,maxNetwork:t=50,maxErrors:r=20}=e,n=(f=e.sanitizeUrl)!=null?f:vn,s=new jA(A),o=new jA(t),i=new jA(r),a=Mn(s),B=On(o,n),l=Rn(o,n),c=kn(i),g=Gn();return{snapshot(){return{consoleLogs:s.snapshot(),networkRequests:o.snapshot(),errors:i.snapshot(),device:Dn(),capturedAt:Date.now()}},clear(){s.clear(),o.clear(),i.clear()},dispose(){a(),B(),l(),c(),g.dispose()}}}function Po(e){return e.hasAttribute("data-mfb-mask")||e.classList.contains("mfb-mask")}function nu(e){let A=e.join(",").trim();return A?t=>Po(t)||t.matches(A):Po}async function Xo(e,A={}){var t;if(typeof document=="undefined")return null;try{let r=(await Promise.resolve().then(()=>(Vo(),No))).default,n=nu((t=A.mask)!=null?t:[]),s=await r(e,{ignoreElements:o=>n(o),useCORS:!0,logging:!1,backgroundColor:null});return await new Promise(o=>s.toBlob(o,"image/png"))}catch(r){return null}}var su={"fab.label":"Send feedback","form.title":"Send feedback","form.description.label":"What happened?","form.description.placeholder":"Describe the issue or idea in one or two sentences.","form.type.label":"Type","form.severity.label":"Severity","form.submit":"Send","form.cancel":"Cancel","form.close":"Close","form.submitting":"Sending\u2026","form.success":"Thanks \u2014 your feedback was sent.","form.error":"Could not send. Please try again.","form.screenshot.label":"Screenshot","form.screenshot.cta_click":"Click","form.screenshot.cta_rest":"drop, or paste an image","form.screenshot.formats":"PNG, JPEG or WebP \u2014 up to 10 MB","form.screenshot.remove":"Remove screenshot","form.screenshot.annotate":"Annotate","form.screenshot.error_type":"Unsupported file type. Use PNG, JPEG or WebP.","form.screenshot.error_size":"File too large (max {max} MB).","form.context.label":"Page","type.bug":"Bug","type.feature":"Feature request","type.question":"Question","type.praise":"Praise","type.typo":"Typo","severity.blocker":"Blocker","severity.high":"High","severity.medium":"Medium","severity.low":"Low","annotator.title":"Annotate screenshot","annotator.tool.rectangle":"Rectangle","annotator.tool.arrow":"Arrow","annotator.tool.freehand":"Freehand","annotator.tool.text":"Text","annotator.text_prompt":"Enter text:","annotator.undo":"Undo","annotator.clear":"Clear all","annotator.count_suffix":"annotations","annotator.loading":"Loading\u2026","annotator.apply":"Apply","annotator.applying":"Applying\u2026"},ou={"fab.label":"Envoyer un commentaire","form.title":"Envoyer un commentaire","form.description.label":"Qu\u2019est-il arriv\xE9 ?","form.description.placeholder":"D\xE9crivez le probl\xE8me ou l\u2019id\xE9e en une ou deux phrases.","form.type.label":"Type","form.severity.label":"S\xE9v\xE9rit\xE9","form.submit":"Envoyer","form.cancel":"Annuler","form.close":"Fermer","form.submitting":"Envoi\u2026","form.success":"Merci \u2014 votre commentaire a \xE9t\xE9 envoy\xE9.","form.error":"\xC9chec d\u2019envoi. Veuillez r\xE9essayer.","form.screenshot.label":"Capture d\u2019\xE9cran","form.screenshot.cta_click":"Cliquez","form.screenshot.cta_rest":"d\xE9posez ou collez une image","form.screenshot.formats":"PNG, JPEG ou WebP \u2014 jusqu\u2019\xE0 10 Mo","form.screenshot.remove":"Retirer la capture","form.screenshot.annotate":"Annoter","form.screenshot.error_type":"Format non support\xE9. Utilisez PNG, JPEG ou WebP.","form.screenshot.error_size":"Fichier trop volumineux (max {max} Mo).","form.context.label":"Page","type.bug":"Bogue","type.feature":"Suggestion","type.question":"Question","type.praise":"Compliment","type.typo":"Coquille","severity.blocker":"Bloquant","severity.high":"\xC9lev\xE9e","severity.medium":"Moyenne","severity.low":"Faible","annotator.title":"Annoter la capture","annotator.tool.rectangle":"Rectangle","annotator.tool.arrow":"Fl\xE8che","annotator.tool.freehand":"Dessin libre","annotator.tool.text":"Texte","annotator.text_prompt":"Entrez le texte :","annotator.undo":"Annuler","annotator.clear":"Tout effacer","annotator.count_suffix":"annotations","annotator.loading":"Chargement\u2026","annotator.apply":"Appliquer","annotator.applying":"Application\u2026"},iu={fr:ou};function au(e){var t;if(!e)return null;let A=e.toLowerCase().split(/[-_]/)[0];return(t=iu[A])!=null?t:null}function Jo(e,A={}){var r;let t=(r=au(A.locale))!=null?r:{};return{...su,...t,...e}}var nr,v,qo,Bu,RA,Wo,$o,jo,dn,$t,Ne,Ai,Fn,Cn,Un,cu,er={},tr=[],lu=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,sr=Array.isArray;function yA(e,A){for(var t in A)e[t]=A[t];return e}function mn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function En(e,A,t){var r,n,s,o={};for(s in A)s=="key"?r=A[s]:s=="ref"?n=A[s]:o[s]=A[s];if(arguments.length>2&&(o.children=arguments.length>3?nr.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return jt(e,o,r,n,null)}function jt(e,A,t,r,n){var s={type:e,props:A,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n==null?++qo:n,__i:-1,__u:0};return n==null&&v.vnode!=null&&v.vnode(s),s}function kA(e){return e.children}function Ar(e,A){this.props=e,this.context=A}function we(e,A){if(A==null)return e.__?we(e.__,e.__i+1):null;for(var t;A<e.__k.length;A++)if((t=e.__k[A])!=null&&t.__e!=null)return t.__e;return typeof e.type=="function"?we(e):null}function gu(e){if(e.__P&&e.__d){var A=e.__v,t=A.__e,r=[],n=[],s=yA({},A);s.__v=A.__v+1,v.vnode&&v.vnode(s),Hn(e.__P,s,A,e.__n,e.__P.namespaceURI,32&A.__u?[t]:null,r,t==null?we(A):t,!!(32&A.__u),n),s.__v=A.__v,s.__.__k[s.__i]=s,ni(r,s,n),A.__e=A.__=null,s.__e!=t&&ei(s)}}function ei(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(A){if(A!=null&&A.__e!=null)return e.__e=e.__c.base=A.__e}),ei(e)}function Yo(e){(!e.__d&&(e.__d=!0)&&RA.push(e)&&!rr.__r++||Wo!=v.debounceRendering)&&((Wo=v.debounceRendering)||$o)(rr)}function rr(){try{for(var e,A=1;RA.length;)RA.length>A&&RA.sort(jo),e=RA.shift(),A=RA.length,gu(e)}finally{RA.length=rr.__r=0}}function ti(e,A,t,r,n,s,o,i,a,B,l){var c,g,f,u,Q,h,C,w=r&&r.__k||tr,F=A.length;for(a=fu(t,A,w,a,F),c=0;c<F;c++)(f=t.__k[c])!=null&&(g=f.__i!=-1&&w[f.__i]||er,f.__i=c,h=Hn(e,f,g,n,s,o,i,a,B,l),u=f.__e,f.ref&&g.ref!=f.ref&&(g.ref&&bn(g.ref,null,f),l.push(f.ref,f.__c||u,f)),Q==null&&u!=null&&(Q=u),(C=!!(4&f.__u))||g.__k===f.__k?(a=ri(f,a,e,C),C&&g.__e&&(g.__e=null)):typeof f.type=="function"&&h!==void 0?a=h:u&&(a=u.nextSibling),f.__u&=-7);return t.__e=Q,a}function fu(e,A,t,r,n){var s,o,i,a,B,l=t.length,c=l,g=0;for(e.__k=new Array(n),s=0;s<n;s++)(o=A[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[s]=jt(null,o,null,null,null):sr(o)?o=e.__k[s]=jt(kA,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[s]=jt(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[s]=o,a=s+g,o.__=e,o.__b=e.__b+1,i=null,(B=o.__i=uu(o,t,a,c))!=-1&&(c--,(i=t[B])&&(i.__u|=2)),i==null||i.__v==null?(B==-1&&(n>l?g--:n<l&&g++),typeof o.type!="function"&&(o.__u|=4)):B!=a&&(B==a-1?g--:B==a+1?g++:(B>a?g--:g++,o.__u|=4))):e.__k[s]=null;if(c)for(s=0;s<l;s++)(i=t[s])!=null&&(2&i.__u)==0&&(i.__e==r&&(r=we(i)),oi(i,i));return r}function ri(e,A,t,r){var n,s;if(typeof e.type=="function"){for(n=e.__k,s=0;n&&s<n.length;s++)n[s]&&(n[s].__=e,A=ri(n[s],A,t,r));return A}e.__e!=A&&(r&&(A&&e.type&&!A.parentNode&&(A=we(e)),t.insertBefore(e.__e,A||null)),A=e.__e);do A=A&&A.nextSibling;while(A!=null&&A.nodeType==8);return A}function uu(e,A,t,r){var n,s,o,i=e.key,a=e.type,B=A[t],l=B!=null&&(2&B.__u)==0;if(B===null&&i==null||l&&i==B.key&&a==B.type)return t;if(r>(l?1:0)){for(n=t-1,s=t+1;n>=0||s<A.length;)if((B=A[o=n>=0?n--:s++])!=null&&(2&B.__u)==0&&i==B.key&&a==B.type)return o}return-1}function Zo(e,A,t){A[0]=="-"?e.setProperty(A,t==null?"":t):e[A]=t==null?"":typeof t!="number"||lu.test(A)?t:t+"px"}function qt(e,A,t,r,n){var s,o;A:if(A=="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(A in r)t&&A in t||Zo(e.style,A,"");if(t)for(A in t)r&&t[A]==r[A]||Zo(e.style,A,t[A])}else if(A[0]=="o"&&A[1]=="n")s=A!=(A=A.replace(Ai,"$1")),o=A.toLowerCase(),A=o in e||A=="onFocusOut"||A=="onFocusIn"?o.slice(2):A.slice(2),e.l||(e.l={}),e.l[A+s]=t,t?r?t[Ne]=r[Ne]:(t[Ne]=Fn,e.addEventListener(A,s?Un:Cn,s)):e.removeEventListener(A,s?Un:Cn,s);else{if(n=="http://www.w3.org/2000/svg")A=A.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(A!="width"&&A!="height"&&A!="href"&&A!="list"&&A!="form"&&A!="tabIndex"&&A!="download"&&A!="rowSpan"&&A!="colSpan"&&A!="role"&&A!="popover"&&A in e)try{e[A]=t==null?"":t;break A}catch(i){}typeof t=="function"||(t==null||t===!1&&A[4]!="-"?e.removeAttribute(A):e.setAttribute(A,A=="popover"&&t==1?"":t))}}function zo(e){return function(A){if(this.l){var t=this.l[A.type+e];if(A[$t]==null)A[$t]=Fn++;else if(A[$t]<t[Ne])return;return t(v.event?v.event(A):A)}}}function Hn(e,A,t,r,n,s,o,i,a,B){var l,c,g,f,u,Q,h,C,w,F,H,m,I,S,G,y=A.type;if(A.constructor!==void 0)return null;128&t.__u&&(a=!!(32&t.__u),s=[i=A.__e=t.__e]),(l=v.__b)&&l(A);A:if(typeof y=="function")try{if(C=A.props,w=y.prototype&&y.prototype.render,F=(l=y.contextType)&&r[l.__c],H=l?F?F.props.value:l.__:r,t.__c?h=(c=A.__c=t.__c).__=c.__E:(w?A.__c=c=new y(C,H):(A.__c=c=new Ar(C,H),c.constructor=y,c.render=Qu),F&&F.sub(c),c.state||(c.state={}),c.__n=r,g=c.__d=!0,c.__h=[],c._sb=[]),w&&c.__s==null&&(c.__s=c.state),w&&y.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=yA({},c.__s)),yA(c.__s,y.getDerivedStateFromProps(C,c.__s))),f=c.props,u=c.state,c.__v=A,g)w&&y.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),w&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(w&&y.getDerivedStateFromProps==null&&C!==f&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(C,H),A.__v==t.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(C,c.__s,H)===!1){A.__v!=t.__v&&(c.props=C,c.state=c.__s,c.__d=!1),A.__e=t.__e,A.__k=t.__k,A.__k.some(function(Z){Z&&(Z.__=A)}),tr.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&o.push(c);break A}c.componentWillUpdate!=null&&c.componentWillUpdate(C,c.__s,H),w&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(f,u,Q)})}if(c.context=H,c.props=C,c.__P=e,c.__e=!1,m=v.__r,I=0,w)c.state=c.__s,c.__d=!1,m&&m(A),l=c.render(c.props,c.state,c.context),tr.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,m&&m(A),l=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++I<25);c.state=c.__s,c.getChildContext!=null&&(r=yA(yA({},r),c.getChildContext())),w&&!g&&c.getSnapshotBeforeUpdate!=null&&(Q=c.getSnapshotBeforeUpdate(f,u)),S=l!=null&&l.type===kA&&l.key==null?si(l.props.children):l,i=ti(e,sr(S)?S:[S],A,t,r,n,s,o,i,a,B),c.base=A.__e,A.__u&=-161,c.__h.length&&o.push(c),h&&(c.__E=c.__=null)}catch(Z){if(A.__v=null,a||s!=null)if(Z.then){for(A.__u|=a?160:128;i&&i.nodeType==8&&i.nextSibling;)i=i.nextSibling;s[s.indexOf(i)]=null,A.__e=i}else{for(G=s.length;G--;)mn(s[G]);pn(A)}else A.__e=t.__e,A.__k=t.__k,Z.then||pn(A);v.__e(Z,A,t)}else s==null&&A.__v==t.__v?(A.__k=t.__k,A.__e=t.__e):i=A.__e=wu(t.__e,A,t,r,n,s,o,a,B);return(l=v.diffed)&&l(A),128&A.__u?void 0:i}function pn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(pn))}function ni(e,A,t){for(var r=0;r<t.length;r++)bn(t[r],t[++r],t[++r]);v.__c&&v.__c(A,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(s){s.call(n)})}catch(s){v.__e(s,n.__v)}})}function si(e){return typeof e!="object"||e==null||e.__b>0?e:sr(e)?e.map(si):yA({},e)}function wu(e,A,t,r,n,s,o,i,a){var B,l,c,g,f,u,Q,h=t.props||er,C=A.props,w=A.type;if(w=="svg"?n="http://www.w3.org/2000/svg":w=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),s!=null){for(B=0;B<s.length;B++)if((f=s[B])&&"setAttribute"in f==!!w&&(w?f.localName==w:f.nodeType==3)){e=f,s[B]=null;break}}if(e==null){if(w==null)return document.createTextNode(C);e=document.createElementNS(n,w,C.is&&C),i&&(v.__m&&v.__m(A,s),i=!1),s=null}if(w==null)h===C||i&&e.data==C||(e.data=C);else{if(s=s&&nr.call(e.childNodes),!i&&s!=null)for(h={},B=0;B<e.attributes.length;B++)h[(f=e.attributes[B]).name]=f.value;for(B in h)f=h[B],B=="dangerouslySetInnerHTML"?c=f:B=="children"||B in C||B=="value"&&"defaultValue"in C||B=="checked"&&"defaultChecked"in C||qt(e,B,null,f,n);for(B in C)f=C[B],B=="children"?g=f:B=="dangerouslySetInnerHTML"?l=f:B=="value"?u=f:B=="checked"?Q=f:i&&typeof f!="function"||h[B]===f||qt(e,B,f,h[B],n);if(l)i||c&&(l.__html==c.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),A.__k=[];else if(c&&(e.innerHTML=""),ti(A.type=="template"?e.content:e,sr(g)?g:[g],A,t,r,w=="foreignObject"?"http://www.w3.org/1999/xhtml":n,s,o,s?s[0]:t.__k&&we(t,0),i,a),s!=null)for(B=s.length;B--;)mn(s[B]);i||(B="value",w=="progress"&&u==null?e.removeAttribute("value"):u!=null&&(u!==e[B]||w=="progress"&&!u||w=="option"&&u!=h[B])&&qt(e,B,u,h[B],n),B="checked",Q!=null&&Q!=e[B]&&qt(e,B,Q,h[B],n))}return e}function bn(e,A,t){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&A==null||(e.__u=e(A))}else e.current=A}catch(n){v.__e(n,t)}}function oi(e,A,t){var r,n;if(v.unmount&&v.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||bn(r,null,A)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){v.__e(s,A)}r.base=r.__P=null}if(r=e.__k)for(n=0;n<r.length;n++)r[n]&&oi(r[n],A,t||typeof e.type!="function");t||mn(e.__e),e.__c=e.__=e.__e=void 0}function Qu(e,A,t){return this.constructor(e,t)}function yn(e,A,t){var r,n,s,o;A==document&&(A=document.documentElement),v.__&&v.__(e,A),n=(r=typeof t=="function")?null:t&&t.__k||A.__k,s=[],o=[],Hn(A,e=(!r&&t||A).__k=En(kA,null,[e]),n||er,er,A.namespaceURI,!r&&t?[t]:n?null:A.firstChild?nr.call(A.childNodes):null,s,!r&&t?t:n?n.__e:A.firstChild,r,o),ni(s,e,o)}nr=tr.slice,v={__e:function(e,A,t,r){for(var n,s,o;A=A.__;)if((n=A.__c)&&!n.__)try{if((s=n.constructor)&&s.getDerivedStateFromError!=null&&(n.setState(s.getDerivedStateFromError(e)),o=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,r||{}),o=n.__d),o)return n.__E=n}catch(i){e=i}throw e}},qo=0,Bu=function(e){return e!=null&&e.constructor===void 0},Ar.prototype.setState=function(e,A){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=yA({},this.state),typeof e=="function"&&(e=e(yA({},t),this.props)),e&&yA(t,e),e!=null&&this.__v&&(A&&this._sb.push(A),Yo(this))},Ar.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Yo(this))},Ar.prototype.render=kA,RA=[],$o=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jo=function(e,A){return e.__v.__b-A.__v.__b},rr.__r=0,dn=Math.random().toString(8),$t="__d"+dn,Ne="__a"+dn,Ai=/(PointerCapture)$|Capture$/i,Fn=0,Cn=zo(!1),Un=zo(!0),cu=0;var Ve,J,In,ii,Pe=0,wi=[],Y=v,ai=Y.__b,Bi=Y.__r,ci=Y.diffed,li=Y.__c,gi=Y.unmount,fi=Y.__;function _n(e,A){Y.__h&&Y.__h(J,e,Pe||A),Pe=0;var t=J.__H||(J.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function AA(e){return Pe=1,hu(Ci,e)}function hu(e,A,t){var r=_n(Ve++,2);if(r.t=e,!r.__c&&(r.__=[t?t(A):Ci(void 0,A),function(i){var a=r.__N?r.__N[0]:r.__[0],B=r.t(a,i);a!==B&&(r.__N=[B,r.__[1]],r.__c.setState({}))}],r.__c=J,!J.__f)){var n=function(i,a,B){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(g){return g.__c});if(l.every(function(g){return!g.__N}))return!s||s.call(this,i,a,B);var c=r.__c.props!==i;return l.some(function(g){if(g.__N){var f=g.__[0];g.__=g.__N,g.__N=void 0,f!==g.__[0]&&(c=!0)}}),s&&s.call(this,i,a,B)||c};J.__f=!0;var s=J.shouldComponentUpdate,o=J.componentWillUpdate;J.componentWillUpdate=function(i,a,B){if(this.__e){var l=s;s=void 0,n(i,a,B),s=l}o&&o.call(this,i,a,B)},J.shouldComponentUpdate=n}return r.__N||r.__}function FA(e,A){var t=_n(Ve++,3);!Y.__s&&di(t.__H,A)&&(t.__=e,t.u=A,J.__H.__h.push(t))}function gA(e){return Pe=5,Qi(function(){return{current:e}},[])}function Qi(e,A){var t=_n(Ve++,7);return di(t.__H,A)&&(t.__=e(),t.__H=A,t.__h=e),t.__}function hi(e,A){return Pe=8,Qi(function(){return e},A)}function du(){for(var e;e=wi.shift();){var A=e.__H;if(e.__P&&A)try{A.__h.some(or),A.__h.some(xn),A.__h=[]}catch(t){A.__h=[],Y.__e(t,e.__v)}}}Y.__b=function(e){J=null,ai&&ai(e)},Y.__=function(e,A){e&&A.__k&&A.__k.__m&&(e.__m=A.__k.__m),fi&&fi(e,A)},Y.__r=function(e){Bi&&Bi(e),Ve=0;var A=(J=e.__c).__H;A&&(In===J?(A.__h=[],J.__h=[],A.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(A.__h.some(or),A.__h.some(xn),A.__h=[],Ve=0)),In=J},Y.diffed=function(e){ci&&ci(e);var A=e.__c;A&&A.__H&&(A.__H.__h.length&&(wi.push(A)!==1&&ii===Y.requestAnimationFrame||((ii=Y.requestAnimationFrame)||Cu)(du)),A.__H.__.some(function(t){t.u&&(t.__H=t.u),t.u=void 0})),In=J=null},Y.__c=function(e,A){A.some(function(t){try{t.__h.some(or),t.__h=t.__h.filter(function(r){return!r.__||xn(r)})}catch(r){A.some(function(n){n.__h&&(n.__h=[])}),A=[],Y.__e(r,t.__v)}}),li&&li(e,A)},Y.unmount=function(e){gi&&gi(e);var A,t=e.__c;t&&t.__H&&(t.__H.__.some(function(r){try{or(r)}catch(n){A=n}}),t.__H=void 0,A&&Y.__e(A,t.__v))};var ui=typeof requestAnimationFrame=="function";function Cu(e){var A,t=function(){clearTimeout(r),ui&&cancelAnimationFrame(A),setTimeout(e)},r=setTimeout(t,35);ui&&(A=requestAnimationFrame(t))}function or(e){var A=J,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),J=A}function xn(e){var A=J;e.__c=e.__(),J=A}function di(e,A){return!e||e.length!==A.length||A.some(function(t,r){return t!==e[r]})}function Ci(e,A){return typeof A=="function"?A(e):A}var Uu=0;function d(e,A,t,r,n,s){A||(A={});var o,i,a=A;if("ref"in a)for(i in a={},A)i=="ref"?o=A[i]:a[i]=A[i];var B={type:e,props:a,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Uu,__i:-1,__u:0,__source:n,__self:s};if(typeof e=="function"&&(o=e.defaultProps))for(i in o)a[i]===void 0&&(a[i]=o[i]);return v.vnode&&v.vnode(B),B}function Ui({label:e,onClick:A}){return d("button",{type:"button",class:"fab","aria-label":e,onClick:A,children:"\u{1F4AC}"})}var pi=["#ef4444","#f59e0b","#10b981","#3b82f6","#ffffff"];function Fi(e,A){if(e.save(),e.strokeStyle=A.color,e.fillStyle=A.color,e.lineWidth=A.lineWidth,e.lineCap="round",e.lineJoin="round",A.kind==="rectangle")e.strokeRect(A.x,A.y,A.w,A.h);else if(A.kind==="arrow")pu(e,A.x1,A.y1,A.x2,A.y2);else if(A.kind==="freehand"){if(A.points.length<2){e.restore();return}e.beginPath(),e.moveTo(A.points[0].x,A.points[0].y);for(let t=1;t<A.points.length;t++)e.lineTo(A.points[t].x,A.points[t].y);e.stroke()}else if(A.kind==="text"){e.font=`bold ${A.fontSize}px -apple-system, BlinkMacSystemFont, sans-serif`,e.textBaseline="top";let t=e.measureText(A.text),r=4,n=t.width+r*2,s=A.fontSize+r*2;e.fillStyle="rgba(0, 0, 0, 0.6)",e.fillRect(A.x-r,A.y-r,n,s),e.fillStyle=A.color,e.fillText(A.text,A.x,A.y)}e.restore()}function pu(e,A,t,r,n){let o=Math.atan2(n-t,r-A);e.beginPath(),e.moveTo(A,t),e.lineTo(r,n),e.stroke(),e.beginPath(),e.moveTo(r,n),e.lineTo(r-14*Math.cos(o-Math.PI/6),n-14*Math.sin(o-Math.PI/6)),e.lineTo(r-14*Math.cos(o+Math.PI/6),n-14*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var qA={rect:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("rect",{x:"2",y:"3",width:"12",height:"10",fill:"none",stroke:"currentColor","stroke-width":"1.5"})}),arrow:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M2 8h11M9 4l4 4-4 4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),pencil:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"})}),text:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M3 3h10M8 3v10M5 13h6",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})}),undo:d("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M4 7l3-3M4 7l3 3M4 7h6a3 3 0 0 1 0 6H7",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),trash:d("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M3 4h10M6 4V2.5h4V4M5 4l.5 9h5L11 4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),close:d("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:d("path",{d:"M4 4l8 8M12 4l-8 8",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})})};function mi({imageBlob:e,strings:A,onSave:t,onCancel:r}){let n=gA(null),s=gA(null),o=gA(null),[i,a]=AA("rectangle"),[B,l]=AA(pi[0]),[c,g]=AA([]),f=gA(!1),[u,Q]=AA(null),[h,C]=AA(!1),[w,F]=AA(!1),H=gA(1);FA(()=>{let E=L=>{L.key==="Escape"&&(L.stopPropagation(),r())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[r]),FA(()=>{let E=URL.createObjectURL(e),L=new Image;return L.onload=()=>{o.current=L,C(!0)},L.src=E,()=>URL.revokeObjectURL(E)},[e]),FA(()=>{if(!h||!n.current||!o.current||!s.current)return;let E=o.current,D=s.current.clientWidth-16,sA=window.innerHeight*.6,oA=Math.min(D/E.width,sA/E.height,1);H.current=oA;let QA=n.current;QA.width=E.width,QA.height=E.height,QA.style.width=`${E.width*oA}px`,QA.style.height=`${E.height*oA}px`,m()},[h]),FA(()=>{m()},[c,u]);function m(){let E=n.current,L=o.current;if(!E||!L)return;let D=E.getContext("2d");if(D){D.clearRect(0,0,E.width,E.height),D.drawImage(L,0,0);for(let sA of c)Fi(D,sA);u&&Fi(D,u)}}function I(E){let D=n.current.getBoundingClientRect();return{x:(E.clientX-D.left)/H.current,y:(E.clientY-D.top)/H.current}}let S=E=>{if(!h)return;let{x:L,y:D}=I(E),sA=Math.max(3,Math.round(n.current.width/400));if(i==="text"){let oA=window.prompt(A["annotator.text_prompt"]);oA&&oA.trim()&&g(QA=>[...QA,{kind:"text",x:L,y:D,text:oA.trim(),color:B,fontSize:Math.max(16,Math.round(n.current.width/50)),lineWidth:1}]);return}f.current=!0,i==="rectangle"?Q({kind:"rectangle",x:L,y:D,w:0,h:0,color:B,lineWidth:sA}):i==="arrow"?Q({kind:"arrow",x1:L,y1:D,x2:L,y2:D,color:B,lineWidth:sA}):i==="freehand"&&Q({kind:"freehand",points:[{x:L,y:D}],color:B,lineWidth:sA})},G=E=>{if(!f.current||!u)return;let{x:L,y:D}=I(E);u.kind==="rectangle"?Q({...u,w:L-u.x,h:D-u.y}):u.kind==="arrow"?Q({...u,x2:L,y2:D}):u.kind==="freehand"&&Q({...u,points:[...u.points,{x:L,y:D}]})},y=()=>{f.current&&u&&(u.kind==="rectangle"&&Math.abs(u.w)<4&&Math.abs(u.h)<4||u.kind==="arrow"&&Math.hypot(u.x2-u.x1,u.y2-u.y1)<4||u.kind==="freehand"&&u.points.length<3||g(L=>[...L,u])),f.current=!1,Q(null)},Z=async()=>{let E=n.current;if(E){F(!0);try{let L=await new Promise(D=>E.toBlob(D,"image/png",.92));L&&t(L)}finally{F(!1)}}},mA=[{id:"rectangle",icon:qA.rect,label:A["annotator.tool.rectangle"]},{id:"arrow",icon:qA.arrow,label:A["annotator.tool.arrow"]},{id:"freehand",icon:qA.pencil,label:A["annotator.tool.freehand"]},{id:"text",icon:qA.text,label:A["annotator.tool.text"]}];return d("div",{class:"annotator-backdrop",role:"presentation",onClick:E=>{E.target===E.currentTarget&&r()},children:d("div",{class:"annotator",role:"dialog","aria-modal":"true","aria-label":A["annotator.title"],children:[d("div",{class:"annotator-header",children:[d("span",{children:A["annotator.title"]}),d("button",{type:"button",class:"modal-close","aria-label":A["form.close"],onClick:r,children:qA.close})]}),d("div",{class:"annotator-toolbar",children:[d("div",{class:"annotator-tools",children:mA.map(E=>d("button",{type:"button",onClick:()=>a(E.id),title:E.label,"aria-label":E.label,"aria-pressed":i===E.id,class:`annotator-tool ${i===E.id?"is-active":""}`,children:E.icon},E.id))}),d("span",{class:"annotator-sep"}),d("div",{class:"annotator-colors",children:pi.map(E=>d("button",{type:"button",onClick:()=>l(E),"aria-label":E,"aria-pressed":B===E,class:`annotator-color ${B===E?"is-active":""}`,style:{backgroundColor:E}},E))}),d("span",{class:"annotator-sep"}),d("button",{type:"button",class:"annotator-btn",onClick:()=>g(E=>E.slice(0,-1)),disabled:c.length===0,children:[qA.undo,d("span",{children:A["annotator.undo"]})]}),d("button",{type:"button",class:"annotator-btn",onClick:()=>g([]),disabled:c.length===0,children:[qA.trash,d("span",{children:A["annotator.clear"]})]}),d("span",{class:"annotator-spacer"}),d("span",{class:"annotator-count",children:[c.length," ",A["annotator.count_suffix"]]})]}),d("div",{ref:s,class:"annotator-canvas-wrap",children:h?d("canvas",{ref:n,onMouseDown:S,onMouseMove:G,onMouseUp:y,onMouseLeave:y,class:"annotator-canvas"}):d("span",{class:"annotator-loading",children:A["annotator.loading"]})}),d("div",{class:"annotator-footer",children:[d("button",{type:"button",class:"btn",onClick:r,children:A["form.cancel"]}),d("button",{type:"button",class:"btn btn--primary",onClick:Z,disabled:w||!h,children:w?A["annotator.applying"]:A["annotator.apply"]})]})]})})}var Fu=["image/png","image/jpeg","image/webp"];function Ei(e){return Fu.includes(e.type)?e.size>10485760?{kind:"size",maxMb:10485760/(1024*1024)}:null:{kind:"type"}}function Hi(e,A=80){if(e.length<=A)return e;let t=Math.floor((A-1)/2),r=A-1-t;return`${e.slice(0,t)}\u2026${e.slice(e.length-r)}`}var mu=["bug","feature","question","praise","typo"],Eu=["blocker","high","medium","low"];function bi({strings:e,onSubmit:A,onCancel:t,status:r,errorMessage:n}){let[s,o]=AA(""),[i,a]=AA("bug"),[B,l]=AA("medium"),[c,g]=AA(""),[f,u]=AA(null),[Q,h]=AA(null),[C,w]=AA(!1),[F,H]=AA(!1),m=gA(null),I=gA(null),S=r==="submitting",G=S?e["form.submitting"]:e["form.submit"],y=typeof window!="undefined"?window.location.href:"";FA(()=>()=>{Q&&URL.revokeObjectURL(Q)},[Q]);let Z=b=>{if(g(""),b instanceof File){let V=Ei(b);if(V){g(V.kind==="type"?e["form.screenshot.error_type"]:e["form.screenshot.error_size"].replace("{max}",String(V.maxMb)));return}}Q&&URL.revokeObjectURL(Q),u(b),h(URL.createObjectURL(b))},mA=()=>{Q&&URL.revokeObjectURL(Q),h(null),u(null),g(""),m.current&&(m.current.value="")},E=b=>{var fA;let V=(fA=b.target.files)==null?void 0:fA[0];V&&Z(V)},L=b=>{b.preventDefault(),b.stopPropagation(),w(!0)},D=b=>{b.preventDefault(),b.stopPropagation(),b.currentTarget===b.target&&w(!1)},sA=b=>{var fA,IA;b.preventDefault(),b.stopPropagation(),w(!1);let V=(IA=(fA=b.dataTransfer)==null?void 0:fA.files)==null?void 0:IA[0];V&&Z(V)};FA(()=>{let b=I.current;if(!b)return;let V=fA=>{var GA;let IA=(GA=fA.clipboardData)==null?void 0:GA.items;if(IA){for(let Xe of Array.from(IA))if(Xe.kind==="file"&&Xe.type.startsWith("image/")){let Kn=Xe.getAsFile();if(Kn){fA.preventDefault(),Z(Kn);return}}}};return b.addEventListener("paste",V),()=>b.removeEventListener("paste",V)},[Q]);let oA=b=>{Q&&URL.revokeObjectURL(Q),u(b),h(URL.createObjectURL(b)),H(!1)};return d("form",{onSubmit:b=>{if(b.preventDefault(),!s.trim()){g(e["form.description.placeholder"]);return}g("");let V={description:s.trim(),feedback_type:i,severity:B};f&&(V.screenshot=f),A(V)},children:[d("h2",{children:e["form.title"]}),d("div",{class:"field",children:[d("label",{for:"mfb-desc",children:e["form.description.label"]}),d("textarea",{id:"mfb-desc",value:s,placeholder:e["form.description.placeholder"],onInput:b=>o(b.target.value)})]}),d("div",{class:"row",children:[d("div",{class:"field",children:[d("label",{for:"mfb-type",children:e["form.type.label"]}),d("select",{id:"mfb-type",value:i,onChange:b=>a(b.target.value),children:mu.map(b=>d("option",{value:b,children:e[`type.${b}`]}))})]}),d("div",{class:"field",children:[d("label",{for:"mfb-sev",children:e["form.severity.label"]}),d("select",{id:"mfb-sev",value:B,onChange:b=>l(b.target.value),children:Eu.map(b=>d("option",{value:b,children:e[`severity.${b}`]}))})]})]}),d("div",{class:"field",children:[d("label",{children:e["form.screenshot.label"]}),d("input",{ref:m,type:"file",accept:"image/png,image/jpeg,image/webp",class:"mfb-sr-only",onChange:E,"aria-hidden":"true",tabIndex:-1}),Q?d("div",{class:"screenshot-preview",children:[d("img",{src:Q,alt:""}),d("button",{type:"button",class:"screenshot-remove",onClick:mA,"aria-label":e["form.screenshot.remove"],children:"\xD7"}),d("button",{type:"button",class:"btn screenshot-annotate",onClick:()=>H(!0),children:e["form.screenshot.annotate"]})]}):d("div",{ref:I,class:`screenshot-dropzone ${C?"is-dragover":""}`,tabIndex:0,role:"button","aria-label":e["form.screenshot.label"],onClick:()=>{var b;return(b=m.current)==null?void 0:b.click()},onKeyDown:b=>{var V;(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),(V=m.current)==null||V.click())},onDragOver:L,onDragLeave:D,onDrop:sA,children:[d("div",{class:"screenshot-cta",children:[d("strong",{children:e["form.screenshot.cta_click"]}),", ",e["form.screenshot.cta_rest"]]}),d("div",{class:"screenshot-formats",children:e["form.screenshot.formats"]})]})]}),y&&d("div",{class:"page-context",title:y,children:[d("span",{class:"page-context-label",children:e["form.context.label"]}),d("span",{class:"page-context-url",children:Hi(y,90)})]}),c&&d("div",{class:"error",children:c}),r==="error"&&n&&d("div",{class:"error",children:n}),r==="success"&&d("div",{class:"success",children:e["form.success"]}),d("div",{class:"actions",children:[d("button",{type:"button",class:"btn",onClick:t,disabled:S,children:e["form.cancel"]}),d("button",{type:"submit",class:"btn btn--primary",disabled:S,children:G})]}),F&&f&&d(mi,{imageBlob:f,strings:e,onCancel:()=>H(!1),onSave:oA})]})}function yi({onDismiss:e,children:A,closeLabel:t="Close"}){let r=gA(null),n=gA(null);return FA(()=>{var i;n.current=document.activeElement;let s=a=>{var l;if(a.key!=="Escape")return;let B=(l=r.current)==null?void 0:l.getRootNode();B instanceof ShadowRoot&&B.querySelector(".annotator-backdrop")||(a.stopPropagation(),e())};window.addEventListener("keydown",s);let o=(i=r.current)==null?void 0:i.querySelector("textarea, input, select, button");return o==null||o.focus(),()=>{window.removeEventListener("keydown",s);let a=n.current;a&&typeof a.focus=="function"&&a.focus()}},[e]),d("div",{class:"backdrop",role:"presentation",onClick:s=>{s.target===s.currentTarget&&e()},children:d("div",{ref:r,class:"modal",role:"dialog","aria-modal":"true",children:[d("button",{type:"button",class:"modal-close","aria-label":t,onClick:e,children:"\xD7"}),A]})})}var Ii=`
8
8
  :host {
9
9
  --mfb-accent: #3b82f6;
10
10
  --mfb-accent-contrast: #ffffff;