@zappway/embeds 2.0.3 → 2.0.4
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/chatbox/index.global.js +69 -69
- package/dist/chatbox/index.js +3 -3
- package/dist/chatbox/legacy.js +1 -1
- package/dist/form/index.js +2 -2
- package/dist/pdfviewer/index.js +3 -3
- package/dist/zappflux/index.js +1 -1
- package/dist/zappflux/web.global.js +1 -1
- package/dist/zappflux/web.js +1 -1
- package/package.json +3 -3
package/dist/pdfviewer/index.js
CHANGED
|
@@ -64,7 +64,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
64
64
|
`)}`,this.#l();let d=new Range,f=Math.sumPrecise(c.map(h=>h.length));for(let{firstChild:h}of this.editorDiv.childNodes)if(h.nodeType===Node.TEXT_NODE){let m=h.nodeValue.length;if(f<=m){d.setStart(h,f),d.setEnd(h,f);break}f-=m}o.removeAllRanges(),o.addRange(d)}#l(){if(this.editorDiv.replaceChildren(),!!this.#t)for(let t of this.#t.split(`
|
|
65
65
|
`)){let r=document.createElement("div");r.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(r)}}#f(){return this.#t.replaceAll(" "," ")}static#d(t){return t.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}getPDFRect(){let t=e._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,r,n){let i=null;if(t instanceof Qp){let{data:{defaultAppearanceData:{fontSize:s,fontColor:a},rect:l,rotation:c,id:u,popupRef:d,richText:f,contentsObj:h,creationDate:m,modificationDate:y},textContent:x,textPosition:g,parent:{page:{pageNumber:v}}}=t;if(!x||x.length===0)return null;i=t={annotationType:pt.FREETEXT,color:Array.from(a),fontSize:s,value:x.join(`
|
|
66
66
|
`),position:g,pageIndex:v-1,rect:l.slice(0),rotation:c,annotationElementId:u,id:u,deleted:!1,popupRef:d,comment:h?.str||null,richText:f,creationDate:m,modificationDate:y}}let o=await super.deserialize(t,r,n);return o.#n=t.fontSize,o.color=W.makeHexColor(...t.color),o.#t=e.#d(t.value),o._initialData=i,t.comment&&o.setCommentData(t),o}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let r=Vt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(t),{color:r,fontSize:this.#n,value:this.#f()});return this.addComment(n),t?(n.isCopy=!0,n):this.annotationElementId&&!this.#h(n)?null:(n.id=this.annotationElementId,n)}#h(t){let{value:r,fontSize:n,color:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==r||t.fontSize!==n||t.color.some((s,a)=>s!==i[a])||t.pageIndex!==o}renderAnnotationElement(t){let r=super.renderAnnotationElement(t);if(!r)return null;let{style:n}=r;n.fontSize=`calc(${this.#n}px * var(--total-scale-factor))`,n.color=this.color,r.replaceChildren();for(let i of this.#t.split(`
|
|
67
|
-
`)){let o=document.createElement("div");o.append(i?document.createTextNode(i):document.createElement("br")),r.append(o)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#t}}),r}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}},tt=class{static PRECISION=1e-4;toSVGPath(){$t("Abstract method `toSVGPath` must be implemented.")}get box(){$t("Abstract getter `box` must be implemented.")}serialize(t,r){$t("Abstract method `serialize` must be implemented.")}static _rescale(t,r,n,i,o,s){s||=new Float32Array(t.length);for(let a=0,l=t.length;a<l;a+=2)s[a]=r+t[a]*i,s[a+1]=n+t[a+1]*o;return s}static _rescaleAndSwap(t,r,n,i,o,s){s||=new Float32Array(t.length);for(let a=0,l=t.length;a<l;a+=2)s[a]=r+t[a+1]*i,s[a+1]=n+t[a]*o;return s}static _translate(t,r,n,i){i||=new Float32Array(t.length);for(let o=0,s=t.length;o<s;o+=2)i[o]=r+t[o],i[o+1]=n+t[o+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,r,n,i,o){switch(o){case 90:return[1-r/n,t/i];case 180:return[1-t/n,1-r/i];case 270:return[r/n,1-t/i];default:return[t/n,r/i]}}static createBezierPoints(t,r,n,i,o,s){return[(t+5*n)/6,(r+5*i)/6,(5*n+o)/6,(5*i+s)/6,(n+o)/2,(i+s)/2]}},rh=class e{#t;#e=[];#r;#n;#i=[];#s=new Float32Array(18);#o;#a;#c;#l;#f;#d;#h=[];static#g=8;static#m=2;static#u=e.#g+e.#m;constructor({x:t,y:r},n,i,o,s,a=0){this.#t=n,this.#d=o*i,this.#n=s,this.#s.set([NaN,NaN,NaN,NaN,t,r],6),this.#r=a,this.#l=e.#g*i,this.#c=e.#u*i,this.#f=i,this.#h.push(t,r)}isEmpty(){return isNaN(this.#s[8])}#p(){let t=this.#s.subarray(4,6),r=this.#s.subarray(16,18),[n,i,o,s]=this.#t;return[(this.#o+(t[0]-r[0])/2-n)/o,(this.#a+(t[1]-r[1])/2-i)/s,(this.#o+(r[0]-t[0])/2-n)/o,(this.#a+(r[1]-t[1])/2-i)/s]}add({x:t,y:r}){this.#o=t,this.#a=r;let[n,i,o,s]=this.#t,[a,l,c,u]=this.#s.subarray(8,12),d=t-c,f=r-u,h=Math.hypot(d,f);if(h<this.#c)return!1;let m=h-this.#l,y=m/h,x=y*d,g=y*f,v=a,b=l;a=c,l=u,c+=x,u+=g,this.#h?.push(t,r);let w=-g/m,T=x/m,C=w*this.#d,E=T*this.#d;return this.#s.set(this.#s.subarray(2,8),0),this.#s.set([c+C,u+E],4),this.#s.set(this.#s.subarray(14,18),12),this.#s.set([c-C,u-E],16),isNaN(this.#s[6])?(this.#i.length===0&&(this.#s.set([a+C,l+E],2),this.#i.push(NaN,NaN,NaN,NaN,(a+C-n)/o,(l+E-i)/s),this.#s.set([a-C,l-E],14),this.#e.push(NaN,NaN,NaN,NaN,(a-C-n)/o,(l-E-i)/s)),this.#s.set([v,b,a,l,c,u],6),!this.isEmpty()):(this.#s.set([v,b,a,l,c,u],6),Math.abs(Math.atan2(b-l,v-a)-Math.atan2(g,x))<Math.PI/2?([a,l,c,u]=this.#s.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((a+c)/2-n)/o,((l+u)/2-i)/s),[a,l,v,b]=this.#s.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((v+a)/2-n)/o,((b+l)/2-i)/s),!0):([v,b,a,l,c,u]=this.#s.subarray(0,6),this.#i.push(((v+5*a)/6-n)/o,((b+5*l)/6-i)/s,((5*a+c)/6-n)/o,((5*l+u)/6-i)/s,((a+c)/2-n)/o,((l+u)/2-i)/s),[c,u,a,l,v,b]=this.#s.subarray(12,18),this.#e.push(((v+5*a)/6-n)/o,((b+5*l)/6-i)/s,((5*a+c)/6-n)/o,((5*l+u)/6-i)/s,((a+c)/2-n)/o,((l+u)/2-i)/s),!0))}toSVGPath(){if(this.isEmpty())return"";let t=this.#i,r=this.#e;if(isNaN(this.#s[6])&&!this.isEmpty())return this.#y();let n=[];n.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?n.push(`L${t[i+4]} ${t[i+5]}`):n.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);this.#b(n);for(let i=r.length-6;i>=6;i-=6)isNaN(r[i])?n.push(`L${r[i+4]} ${r[i+5]}`):n.push(`C${r[i]} ${r[i+1]} ${r[i+2]} ${r[i+3]} ${r[i+4]} ${r[i+5]}`);return this.#v(n),n.join(" ")}#y(){let[t,r,n,i]=this.#t,[o,s,a,l]=this.#p();return`M${(this.#s[2]-t)/n} ${(this.#s[3]-r)/i} L${(this.#s[4]-t)/n} ${(this.#s[5]-r)/i} L${o} ${s} L${a} ${l} L${(this.#s[16]-t)/n} ${(this.#s[17]-r)/i} L${(this.#s[14]-t)/n} ${(this.#s[15]-r)/i} Z`}#v(t){let r=this.#e;t.push(`L${r[4]} ${r[5]} Z`)}#b(t){let[r,n,i,o]=this.#t,s=this.#s.subarray(4,6),a=this.#s.subarray(16,18),[l,c,u,d]=this.#p();t.push(`L${(s[0]-r)/i} ${(s[1]-n)/o} L${l} ${c} L${u} ${d} L${(a[0]-r)/i} ${(a[1]-n)/o}`)}newFreeDrawOutline(t,r,n,i,o,s){return new nh(t,r,n,i,o,s)}getOutlines(){let t=this.#i,r=this.#e,n=this.#s,[i,o,s,a]=this.#t,l=new Float32Array((this.#h?.length??0)+2);for(let d=0,f=l.length-2;d<f;d+=2)l[d]=(this.#h[d]-i)/s,l[d+1]=(this.#h[d+1]-o)/a;if(l[l.length-2]=(this.#o-i)/s,l[l.length-1]=(this.#a-o)/a,isNaN(n[6])&&!this.isEmpty())return this.#w(l);let c=new Float32Array(this.#i.length+24+this.#e.length),u=t.length;for(let d=0;d<u;d+=2){if(isNaN(t[d])){c[d]=c[d+1]=NaN;continue}c[d]=t[d],c[d+1]=t[d+1]}u=this.#x(c,u);for(let d=r.length-6;d>=6;d-=6)for(let f=0;f<6;f+=2){if(isNaN(r[d+f])){c[u]=c[u+1]=NaN,u+=2;continue}c[u]=r[d+f],c[u+1]=r[d+f+1],u+=2}return this.#C(c,u),this.newFreeDrawOutline(c,l,this.#t,this.#f,this.#r,this.#n)}#w(t){let r=this.#s,[n,i,o,s]=this.#t,[a,l,c,u]=this.#p(),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(r[2]-n)/o,(r[3]-i)/s,NaN,NaN,NaN,NaN,(r[4]-n)/o,(r[5]-i)/s,NaN,NaN,NaN,NaN,a,l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,(r[16]-n)/o,(r[17]-i)/s,NaN,NaN,NaN,NaN,(r[14]-n)/o,(r[15]-i)/s],0),this.newFreeDrawOutline(d,t,this.#t,this.#f,this.#r,this.#n)}#C(t,r){let n=this.#e;return t.set([NaN,NaN,NaN,NaN,n[4],n[5]],r),r+=6}#x(t,r){let n=this.#s.subarray(4,6),i=this.#s.subarray(16,18),[o,s,a,l]=this.#t,[c,u,d,f]=this.#p();return t.set([NaN,NaN,NaN,NaN,(n[0]-o)/a,(n[1]-s)/l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,(i[0]-o)/a,(i[1]-s)/l],r),r+=24}},nh=class extends tt{#t;#e=new Float32Array(4);#r;#n;#i;#s;#o;constructor(t,r,n,i,o,s){super(),this.#o=t,this.#i=r,this.#t=n,this.#s=i,this.#r=o,this.#n=s,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#a(s);let[a,l,c,u]=this.#e;for(let d=0,f=t.length;d<f;d+=2)t[d]=(t[d]-a)/c,t[d+1]=(t[d+1]-l)/u;for(let d=0,f=r.length;d<f;d+=2)r[d]=(r[d]-a)/c,r[d+1]=(r[d+1]-l)/u}toSVGPath(){let t=[`M${this.#o[4]} ${this.#o[5]}`];for(let r=6,n=this.#o.length;r<n;r+=6){if(isNaN(this.#o[r])){t.push(`L${this.#o[r+4]} ${this.#o[r+5]}`);continue}t.push(`C${this.#o[r]} ${this.#o[r+1]} ${this.#o[r+2]} ${this.#o[r+3]} ${this.#o[r+4]} ${this.#o[r+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,r,n,i],o){let s=n-t,a=i-r,l,c;switch(o){case 0:l=tt._rescale(this.#o,t,i,s,-a),c=tt._rescale(this.#i,t,i,s,-a);break;case 90:l=tt._rescaleAndSwap(this.#o,t,r,s,a),c=tt._rescaleAndSwap(this.#i,t,r,s,a);break;case 180:l=tt._rescale(this.#o,n,r,-s,a),c=tt._rescale(this.#i,n,r,-s,a);break;case 270:l=tt._rescaleAndSwap(this.#o,n,i,-s,-a),c=tt._rescaleAndSwap(this.#i,n,i,-s,-a);break}return{outline:Array.from(l),points:[Array.from(c)]}}#a(t){let r=this.#o,n=r[4],i=r[5],o=[n,i,n,i],s=n,a=i,l=n,c=i,u=t?Math.max:Math.min,d=new Float32Array(4);for(let h=6,m=r.length;h<m;h+=6){let y=r[h+4],x=r[h+5];isNaN(r[h])?(W.pointBoundingBox(y,x,o),a>x?(s=y,a=x):a===x&&(s=u(s,y)),c<x?(l=y,c=x):c===x&&(l=u(l,y))):(d.set(oo,0),W.bezierBoundingBox(n,i,...r.slice(h,h+6),d),W.rectBoundingBox(...d,o),a>d[1]?(s=d[0],a=d[1]):a===d[1]&&(s=u(s,d[0])),c<d[3]?(l=d[2],c=d[3]):c===d[3]&&(l=u(l,d[2]))),n=y,i=x}let f=this.#e;f[0]=o[0]-this.#r,f[1]=o[1]-this.#r,f[2]=o[2]-o[0]+2*this.#r,f[3]=o[3]-o[1]+2*this.#r,this.firstPoint=[s,a],this.lastPoint=[l,c]}get box(){return this.#e}newOutliner(t,r,n,i,o,s=0){return new rh(t,r,n,i,o,s)}getNewOutline(t,r){let[n,i,o,s]=this.#e,[a,l,c,u]=this.#t,d=o*c,f=s*u,h=n*c+a,m=i*u+l,y=this.newOutliner({x:this.#i[0]*d+h,y:this.#i[1]*f+m},this.#t,this.#s,t,this.#n,r??this.#r);for(let x=2;x<this.#i.length;x+=2)y.add({x:this.#i[x]*d+h,y:this.#i[x+1]*f+m});return y.getOutlines()}},cd=class{#t;#e;#r;#n=[];#i=[];constructor(t,r=0,n=0,i=!0){let o=oo.slice(),a=10**-4;for(let{x,y:g,width:v,height:b}of t){let w=Math.floor((x-r)/a)*a,T=Math.ceil((x+v+r)/a)*a,C=Math.floor((g-r)/a)*a,E=Math.ceil((g+b+r)/a)*a,A=[w,C,E,!0],_=[T,C,E,!1];this.#n.push(A,_),W.rectBoundingBox(w,C,T,E,o)}let l=o[2]-o[0]+2*n,c=o[3]-o[1]+2*n,u=o[0]-n,d=o[1]-n,f=i?-1/0:1/0,h=1/0,m=this.#n.at(i?-1:-2),y=[m[0],m[2]];for(let x of this.#n){let[g,v,b,w]=x;!w&&i?v<h?(h=v,f=g):v===h&&(f=Math.max(f,g)):w&&!i&&(v<h?(h=v,f=g):v===h&&(f=Math.min(f,g))),x[0]=(g-u)/l,x[1]=(v-d)/c,x[2]=(b-d)/c}this.#t=new Float32Array([u,d,l,c]),this.#e=[f,h],this.#r=y}getOutlines(){this.#n.sort((r,n)=>r[0]-n[0]||r[1]-n[1]||r[2]-n[2]);let t=[];for(let r of this.#n)r[3]?(t.push(...this.#l(r)),this.#a(r)):(this.#c(r),t.push(...this.#l(r)));return this.#s(t)}#s(t){let r=[],n=new Set;for(let s of t){let[a,l,c]=s;r.push([a,l,s],[a,c,s])}r.sort((s,a)=>s[1]-a[1]||s[0]-a[0]);for(let s=0,a=r.length;s<a;s+=2){let l=r[s][2],c=r[s+1][2];l.push(c),c.push(l),n.add(l),n.add(c)}let i=[],o;for(;n.size>0;){let s=n.values().next().value,[a,l,c,u,d]=s;n.delete(s);let f=a,h=l;for(o=[a,c],i.push(o);;){let m;if(n.has(u))m=u;else if(n.has(d))m=d;else break;n.delete(m),[a,l,c,u,d]=m,f!==a&&(o.push(f,h,a,h===l?l:c),f=a),h=h===l?c:l}o.push(f,h)}return new Lb(i,this.#t,this.#e,this.#r)}#o(t){let r=this.#i,n=0,i=r.length-1;for(;n<=i;){let o=n+i>>1,s=r[o][0];if(s===t)return o;s<t?n=o+1:i=o-1}return i+1}#a([,t,r]){let n=this.#o(t);this.#i.splice(n,0,[t,r])}#c([,t,r]){let n=this.#o(t);for(let i=n;i<this.#i.length;i++){let[o,s]=this.#i[i];if(o!==t)break;if(o===t&&s===r){this.#i.splice(i,1);return}}for(let i=n-1;i>=0;i--){let[o,s]=this.#i[i];if(o!==t)break;if(o===t&&s===r){this.#i.splice(i,1);return}}}#l(t){let[r,n,i]=t,o=[[r,n,i]],s=this.#o(i);for(let a=0;a<s;a++){let[l,c]=this.#i[a];for(let u=0,d=o.length;u<d;u++){let[,f,h]=o[u];if(!(c<=f||h<=l)){if(f>=l){if(h>c)o[u][1]=c;else{if(d===1)return[];o.splice(u,1),u--,d--}continue}o[u][2]=l,h>c&&o.push([r,c,h])}}}return o}},Lb=class extends tt{#t;#e;constructor(t,r,n,i){super(),this.#e=t,this.#t=r,this.firstPoint=n,this.lastPoint=i}toSVGPath(){let t=[];for(let r of this.#e){let[n,i]=r;t.push(`M${n} ${i}`);for(let o=2;o<r.length;o+=2){let s=r[o],a=r[o+1];s===n?(t.push(`V${a}`),i=a):a===i&&(t.push(`H${s}`),n=s)}t.push("Z")}return t.join(" ")}serialize([t,r,n,i],o){let s=[],a=n-t,l=i-r;for(let c of this.#e){let u=new Array(c.length);for(let d=0;d<c.length;d+=2)u[d]=t+c[d]*a,u[d+1]=i-c[d+1]*l;s.push(u)}return s}get box(){return this.#t}get classNamesForOutlining(){return["highlightOutline"]}},ud=class extends rh{newFreeDrawOutline(t,r,n,i,o,s){return new Nb(t,r,n,i,o,s)}},Nb=class extends nh{newOutliner(t,r,n,i,o,s=0){return new ud(t,r,n,i,o,s)}},ih=class e extends Vt{#t=null;#e=0;#r;#n=null;#i=null;#s=null;#o=null;#a=0;#c=null;#l=null;#f=null;#d=!1;#h=null;#g=null;#m=null;#u="";#p;#y="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=pt.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=e.prototype;return ht(this,"_keyboardManager",new ea([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||e._defaultColor,this.#p=t.thickness||e._defaultThickness,this.opacity=t.opacity||e._defaultOpacity,this.#r=t.boxes||null,this.#y=t.methodOfCreation||"",this.#u=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(this.#d=!0,this.#b(t),this.#T()):this.#r&&(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#o=t.focusNode,this.#a=t.focusOffset,this.#v(),this.#T(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert(Vt._l10nAlert.highlight)}get telemetryInitialData(){return{action:"added",type:this.#d?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#p,methodOfCreation:this.#y}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#v(){let t=new cd(this.#r,.001);this.#l=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#l.box;let r=new cd(this.#r,.0025,.001,this._uiManager.direction==="ltr");this.#s=r.getOutlines();let{firstPoint:n}=this.#l;this.#h=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height];let{lastPoint:i}=this.#s;this.#g=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#b({highlightOutlines:t,highlightId:r,clipPathId:n}){this.#l=t;let i=1.5;if(this.#s=t.getNewOutline(this.#p/2+i,.0025),r>=0)this.#f=r,this.#n=n,this.parent.drawLayer.finalizeDraw(r,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#m=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#s.box,path:{d:this.#s.toSVGPath()}},!0);else if(this.parent){let d=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#f,{bbox:e.#_(this.#l.box,(d-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#m,{bbox:e.#_(this.#s.box,d),path:{d:this.#s.toSVGPath()}})}let[o,s,a,l]=t.box;switch(this.rotation){case 0:this.x=o,this.y=s,this.width=a,this.height=l;break;case 90:{let[d,f]=this.parentDimensions;this.x=s,this.y=1-o,this.width=a*f/d,this.height=l*d/f;break}case 180:this.x=1-o,this.y=1-s,this.width=a,this.height=l;break;case 270:{let[d,f]=this.parentDimensions;this.x=1-s,this.y=o,this.width=a*f/d,this.height=l*d/f;break}}let{firstPoint:c}=t;this.#h=[(c[0]-o)/a,(c[1]-s)/l];let{lastPoint:u}=this.#s;this.#g=[(u[0]-o)/a,(u[1]-s)/l]}static initialize(t,r){Vt.initialize(t,r),e._defaultColor||=r.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,r){switch(t){case yt.HIGHLIGHT_COLOR:e._defaultColor=r;break;case yt.HIGHLIGHT_THICKNESS:e._defaultThickness=r;break}}translateInPage(t,r){}get toolbarPosition(){return this.#g}get commentButtonPosition(){return this.#h}updateParams(t,r){switch(t){case yt.HIGHLIGHT_COLOR:this.#w(r);break;case yt.HIGHLIGHT_THICKNESS:this.#C(r);break}}static get defaultPropertiesToUpdate(){return[[yt.HIGHLIGHT_COLOR,e._defaultColor],[yt.HIGHLIGHT_THICKNESS,e._defaultThickness]]}get propertiesToUpdate(){return[[yt.HIGHLIGHT_COLOR,this.color||e._defaultColor],[yt.HIGHLIGHT_THICKNESS,this.#p||e._defaultThickness],[yt.HIGHLIGHT_FREE,this.#d]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#f,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#i?.updateColor(this.color),super.onUpdatedColor()}#w(t){let r=(o,s)=>{this.color=o,this.opacity=s,this.onUpdatedColor()},n=this.color,i=this.opacity;this.addCommands({cmd:r.bind(this,t,e._defaultOpacity),undo:r.bind(this,n,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:yt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#C(t){let r=this.#p,n=i=>{this.#p=i,this.#x(i)};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:yt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#i=new od({editor:this})]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#P())}getBaseTranslation(){return[0,0]}getRect(t,r){return super.getRect(t,r,this.#P())}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this.#E(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#T(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let r=!1;this.parent&&!t?this.#E():t&&(this.#T(t),r=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),r&&this.select()}#x(t){this.#d&&(this.#b({highlightOutlines:this.#l.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())}#E(){this.#f===null||!this.parent||(this.parent.drawLayer.remove(this.#f),this.#f=null,this.parent.drawLayer.remove(this.#m),this.#m=null)}#T(t=this.parent){this.#f===null&&({id:this.#f,clipPathId:this.#n}=t.drawLayer.draw({bbox:this.#l.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#d},path:{d:this.#l.toSVGPath()}},!1,!0),this.#m=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#d},bbox:this.#s.box,path:{d:this.#s.toSVGPath()}},this.#d),this.#c&&(this.#c.style.clipPath=this.#n))}static#_([t,r,n,i],o){switch(o){case 90:return[1-r-i,t,i,n];case 180:return[1-t-n,1-r-i,n,i];case 270:return[r,1-t-n,i,n]}return[t,r,n,i]}rotate(t){let{drawLayer:r}=this.parent,n;this.#d?(t=(t-this.rotation+360)%360,n=e.#_(this.#l.box,t)):n=e.#_([this.x,this.y,this.width,this.height],t),r.updateProperties(this.#f,{bbox:n,root:{"data-main-rotation":t}}),r.updateProperties(this.#m,{bbox:e.#_(this.#s.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();this.#u&&(t.setAttribute("aria-label",this.#u),t.setAttribute("role","mark")),this.#d?t.classList.add("free"):this.div.addEventListener("keydown",this.#R.bind(this),{signal:this._uiManager._signal});let r=this.#c=document.createElement("div");return t.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=this.#n,this.setDims(),FE(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1}})}#R(t){e._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#k(!0);break;case 1:case 3:this.#k(!1);break}}#k(t){if(!this.#t)return;let r=window.getSelection();t?r.setPosition(this.#t,this.#e):r.setPosition(this.#o,this.#a)}select(){super.select(),this.#m&&this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#m&&(this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{selected:!1}}),this.#d||this.#k(!1))}get _mustFixPosition(){return!this.#d}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(this.#f,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#m,{rootClass:{hidden:!t}}))}#P(){return this.#d?this.rotation:0}#M(){if(this.#d)return null;let[t,r]=this.pageDimensions,[n,i]=this.pageTranslation,o=this.#r,s=new Float32Array(o.length*8),a=0;for(let{x:l,y:c,width:u,height:d}of o){let f=l*t+n,h=(1-c)*r+i;s[a]=s[a+4]=f,s[a+1]=s[a+3]=h,s[a+2]=s[a+6]=f+u*t,s[a+5]=s[a+7]=h-d*r,a+=8}return s}#L(t){return this.#l.serialize(t,this.#P())}static startHighlighting(t,r,{target:n,x:i,y:o}){let{x:s,y:a,width:l,height:c}=n.getBoundingClientRect(),u=new AbortController,d=t.combinedSignal(u),f=h=>{u.abort(),this.#N(t,h)};window.addEventListener("blur",f,{signal:d}),window.addEventListener("pointerup",f,{signal:d}),window.addEventListener("pointerdown",ve,{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",ln,{signal:d}),n.addEventListener("pointermove",this.#D.bind(this,t),{signal:d}),this._freeHighlight=new ud({x:i,y:o},[s,a,l,c],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static#D(t,r){this._freeHighlight.add(r)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#N(t,r){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(t,r,n){let i=null;if(t instanceof th){let{data:{quadPoints:y,rect:x,rotation:g,id:v,color:b,opacity:w,popupRef:T,richText:C,contentsObj:E,creationDate:A,modificationDate:_},parent:{page:{pageNumber:P}}}=t;i=t={annotationType:pt.HIGHLIGHT,color:Array.from(b),opacity:w,quadPoints:y,boxes:null,pageIndex:P-1,rect:x.slice(0),rotation:g,annotationElementId:v,id:v,deleted:!1,popupRef:T,richText:C,comment:E?.str||null,creationDate:A,modificationDate:_}}else if(t instanceof ld){let{data:{inkLists:y,rect:x,rotation:g,id:v,color:b,borderStyle:{rawWidth:w},popupRef:T,richText:C,contentsObj:E,creationDate:A,modificationDate:_},parent:{page:{pageNumber:P}}}=t;i=t={annotationType:pt.HIGHLIGHT,color:Array.from(b),thickness:w,inkLists:y,boxes:null,pageIndex:P-1,rect:x.slice(0),rotation:g,annotationElementId:v,id:v,deleted:!1,popupRef:T,richText:C,comment:E?.str||null,creationDate:A,modificationDate:_}}let{color:o,quadPoints:s,inkLists:a,outlines:l,opacity:c}=t,u=await super.deserialize(t,r,n);u.color=W.makeHexColor(...o),u.opacity=c||1,a&&(u.#p=t.thickness),u._initialData=i,t.comment&&u.setCommentData(t);let[d,f]=u.pageDimensions,[h,m]=u.pageTranslation;if(s){let y=u.#r=[];for(let x=0;x<s.length;x+=8)y.push({x:(s[x]-h)/d,y:1-(s[x+1]-m)/f,width:(s[x+2]-s[x])/d,height:(s[x+1]-s[x+5])/f});u.#v(),u.#T(),u.rotate(u.rotation)}else if(a||l){u.#d=!0;let y=(a||l.points)[0],x={x:y[0]-h,y:f-(y[1]-m)},g=new ud(x,[0,0,d,f],1,u.#p/2,!0,.001);for(let w=0,T=y.length;w<T;w+=2)x.x=y[w]-h,x.y=f-(y[w+1]-m),g.add(x);let{id:v,clipPathId:b}=r.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:u.color,"fill-opacity":u._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:g.toSVGPath()}},!0,!0);u.#b({highlightOutlines:g.getOutlines(),highlightId:v,clipPathId:b}),u.#T(),u.rotate(u.parentRotation)}return u}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let r=Vt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),n=super.serialize(t);return Object.assign(n,{color:r,opacity:this.opacity,thickness:this.#p,quadPoints:this.#M(),outlines:this.#L(n.rect)}),this.addComment(n),this.annotationElementId&&!this.#B(n)?null:(n.id=this.annotationElementId,n)}#B(t){let{color:r}=this._initialData;return this.hasEditedComment||t.color.some((n,i)=>n!==r[i])}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}},oh=class{#t=Object.create(null);updateProperty(t,r){this[t]=r,this.updateSVGProperty(t,r)}updateProperties(t){if(t)for(let[r,n]of Object.entries(t))r.startsWith("_")||this.updateProperty(r,n)}updateSVGProperty(t,r){this.#t[t]=r}toSVGProperties(){let t=this.#t;return this.#t=Object.create(null),{root:t}}reset(){this.#t=Object.create(null)}updateAll(t=this){this.updateProperties(t)}clone(){$t("Not implemented")}},sh=class e extends Vt{#t=null;#e;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#r=null;static#n=null;static#i=null;static _INNER_MARGIN=3;constructor(t){super(t),this.#e=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(t){t.drawOutlines&&(this.#s(t),this.#c())}#s({drawOutlines:t,drawId:r,drawingOptions:n}){this.#t=t,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(Vt._l10nAlert[this.editorType]),r>=0?(this._drawId=r,this.parent.drawLayer.finalizeDraw(r,t.defaultProperties)):this._drawId=this.#o(t,this.parent),this.#d(t.box)}#o(t,r){let{id:n}=r.drawLayer.draw(e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(t,r){let n=new Set(Object.keys(t));for(let[i,o]of Object.entries(r))n.has(i)?Object.assign(t[i],o):t[i]=o;return t}static getDefaultDrawingOptions(t){$t("Not implemented")}static get typesMap(){$t("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,r){let n=this.typesMap.get(t);n&&this._defaultDrawingOptions.updateProperty(n,r),this._currentParent&&(e.#r.updateProperty(n,r),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,r){let n=this.constructor.typesMap.get(t);n&&this._updateProperty(t,n,r)}static get defaultPropertiesToUpdate(){let t=[],r=this._defaultDrawingOptions;for(let[n,i]of this.typesMap)t.push([n,r[i]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:r}=this;for(let[n,i]of this.constructor.typesMap)t.push([n,r[i]]);return t}_updateProperty(t,r,n){let i=this._drawingOptions,o=i[r],s=a=>{i.updateProperty(r,a);let l=this.#t.updateProperty(r,a);l&&this.#d(l),this.parent?.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:s.bind(this,n),undo:s.bind(this,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,r){let n=this.constructor.typesMap.get(this.colorType),i=this.constructor.typesMap.get(this.opacityType),o=this._drawingOptions,s=o[n],a=o[i],l=(c,u)=>{o.updateProperty(n,c),o.updateProperty(i,u),this.#t.updateProperty(n,c),this.#t.updateProperty(i,u),this.parent?.drawLayer.updateProperties(this._drawId,o.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:l.bind(this,t,r),undo:l.bind(this,s,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:yt.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#t.getPathResizingSVGProperties(this.#f()),{bbox:this.#h()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#t.getPathResizedSVGProperties(this.#f()),{bbox:this.#h()}))}_onTranslating(t,r){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#h()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#t.getPathTranslatedSVGProperties(this.#f(),this.parentDimensions),{bbox:this.#h()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#e&&(this.#e=!1,this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){this.#a(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#c(),this.#d(this.#t.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let r=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),this.#a()):t&&(this._uiManager.addShouldRescale(this),this.#c(t),r=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),r&&this.select()}#a(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#c(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#o(this.#t,t)}}#l([t,r,n,i]){let{parentDimensions:[o,s],rotation:a}=this;switch(a){case 90:return[r,1-t,n*(s/o),i*(o/s)];case 180:return[1-t,1-r,n,i];case 270:return[1-r,t,n*(s/o),i*(o/s)];default:return[t,r,n,i]}}#f(){let{x:t,y:r,width:n,height:i,parentDimensions:[o,s],rotation:a}=this;switch(a){case 90:return[1-r,t,n*(o/s),i*(s/o)];case 180:return[1-t,1-r,n,i];case 270:return[r,1-t,n*(o/s),i*(s/o)];default:return[t,r,n,i]}}#d(t){[this.x,this.y,this.width,this.height]=this.#l(t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#h(){let{x:t,y:r,width:n,height:i,rotation:o,parentRotation:s,parentDimensions:[a,l]}=this;switch((o*4+s)/90){case 1:return[1-r-i,t,i,n];case 2:return[1-t-n,1-r-i,n,i];case 3:return[r,1-t-n,i,n];case 4:return[t,r-n*(a/l),i*(l/a),n*(a/l)];case 5:return[1-r,t,n*(a/l),i*(l/a)];case 6:return[1-t-i*(l/a),1-r,i*(l/a),n*(a/l)];case 7:return[r-n*(a/l),1-t-i*(l/a),n*(a/l),i*(l/a)];case 8:return[t-n,r-i,n,i];case 9:return[1-r,t-n,i,n];case 10:return[1-t,1-r,n,i];case 11:return[r-i,1-t,i,n];case 12:return[t-i*(l/a),r,i*(l/a),n*(a/l)];case 13:return[1-r-n*(a/l),t-i*(l/a),n*(a/l),i*(l/a)];case 14:return[1-t,1-r-n*(a/l),i*(l/a),n*(a/l)];case 15:return[r,1-t,n*(a/l),i*(l/a)];default:return[t,r,n,i]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties({bbox:this.#h()},this.#t.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#d(this.#t.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,r;this._isCopy&&(t=this.x,r=this.y);let n=super.render();n.classList.add("draw");let i=document.createElement("div");return n.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,r),n}static createDrawerInstance(t,r,n,i,o){$t("Not implemented")}static startDrawing(t,r,n,i){let{target:o,offsetX:s,offsetY:a,pointerId:l,pointerType:c}=i;if(_r.isInitializedAndDifferentPointerType(c))return;let{viewport:{rotation:u}}=t,{width:d,height:f}=o.getBoundingClientRect(),h=e.#n=new AbortController,m=t.combinedSignal(h);if(_r.setPointer(c,l),window.addEventListener("pointerup",y=>{_r.isSamePointerIdOrRemove(y.pointerId)&&this._endDraw(y)},{signal:m}),window.addEventListener("pointercancel",y=>{_r.isSamePointerIdOrRemove(y.pointerId)&&this._currentParent.endDrawingSession()},{signal:m}),window.addEventListener("pointerdown",y=>{_r.isSamePointerType(y.pointerType)&&(_r.initializeAndAddPointerId(y.pointerId),e.#r.isCancellable()&&(e.#r.removeLastElement(),e.#r.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",ln,{signal:m}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),o.addEventListener("touchmove",y=>{_r.isSameTimeStamp(y.timeStamp)&&ve(y)},{signal:m}),t.toggleDrawing(),r._editorUndoBar?.hide(),e.#r){t.drawLayer.updateProperties(this._currentDrawId,e.#r.startNew(s,a,d,f,u));return}r.updateUIForDefaultProperties(this),e.#r=this.createDrawerInstance(s,a,d,f,u),e.#i=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(e.#i.toSVGProperties(),e.#r.defaultSVGProperties),!0,!1)}static _drawMove(t){if(_r.isSameTimeStamp(t.timeStamp),!e.#r)return;let{offsetX:r,offsetY:n,pointerId:i}=t;if(_r.isSamePointerId(i)){if(_r.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,e.#r.add(r,n)),_r.setTimeStamp(t.timeStamp),ve(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#r=null,e.#i=null,_r.clearTimeStamp()),e.#n&&(e.#n.abort(),e.#n=null,_r.clearPointerIds())}static _endDraw(t){let r=this._currentParent;if(r){if(r.toggleDrawing(!0),this._cleanup(!1),t?.target===r.div&&r.drawLayer.updateProperties(this._currentDrawId,e.#r.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let n=e.#r,i=this._currentDrawId,o=n.getLastElement();r.addCommands({cmd:()=>{r.drawLayer.updateProperties(i,n.setLastElement(o))},undo:()=>{r.drawLayer.updateProperties(i,n.removeLastElement())},mustExec:!1,type:yt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let r=this._currentParent;if(!r)return null;if(r.toggleDrawing(!0),r.cleanUndoStack(yt.DRAW_STEP),!e.#r.isEmpty()){let{pageDimensions:[n,i],scale:o}=r,s=r.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:e.#r.getOutlines(n*o,i*o,o,this._INNER_MARGIN),drawingOptions:e.#i,mustBeCommitted:!t});return this._cleanup(!0),s}return r.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,r,n,i,o,s){$t("Not implemented")}static async deserialize(t,r,n){let{rawDims:{pageWidth:i,pageHeight:o,pageX:s,pageY:a}}=r.viewport,l=this.deserializeDraw(s,a,i,o,this._INNER_MARGIN,t),c=await super.deserialize(t,r,n);return c.createDrawingOptions(t),c.#s({drawOutlines:l}),c.#c(),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){let[r,n]=this.pageTranslation,[i,o]=this.pageDimensions;return this.#t.serialize([r,n,i,o],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},Ib=class{#t=new Float64Array(6);#e;#r;#n;#i;#s;#o="";#a=0;#c=new ia;#l;#f;constructor(t,r,n,i,o,s){this.#l=n,this.#f=i,this.#n=o,this.#i=s,[t,r]=this.#d(t,r);let a=this.#e=[NaN,NaN,NaN,NaN,t,r];this.#s=[t,r],this.#r=[{line:a,points:this.#s}],this.#t.set(a,0)}updateProperty(t,r){t==="stroke-width"&&(this.#i=r)}#d(t,r){return tt._normalizePoint(t,r,this.#l,this.#f,this.#n)}isEmpty(){return!this.#r||this.#r.length===0}isCancellable(){return this.#s.length<=10}add(t,r){[t,r]=this.#d(t,r);let[n,i,o,s]=this.#t.subarray(2,6),a=t-o,l=r-s;return Math.hypot(this.#l*a,this.#f*l)<=2?null:(this.#s.push(t,r),isNaN(n)?(this.#t.set([o,s,t,r],2),this.#e.push(NaN,NaN,NaN,NaN,t,r),{path:{d:this.toSVGPath()}}):(isNaN(this.#t[0])&&this.#e.splice(6,6),this.#t.set([n,i,o,s,t,r],0),this.#e.push(...tt.createBezierPoints(n,i,o,s,t,r)),{path:{d:this.toSVGPath()}}))}end(t,r){let n=this.add(t,r);return n||(this.#s.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,r,n,i,o){this.#l=n,this.#f=i,this.#n=o,[t,r]=this.#d(t,r);let s=this.#e=[NaN,NaN,NaN,NaN,t,r];this.#s=[t,r];let a=this.#r.at(-1);return a&&(a.line=new Float32Array(a.line),a.points=new Float32Array(a.points)),this.#r.push({line:s,points:this.#s}),this.#t.set(s,0),this.#a=0,this.toSVGPath(),null}getLastElement(){return this.#r.at(-1)}setLastElement(t){return this.#r?(this.#r.push(t),this.#e=t.line,this.#s=t.points,this.#a=0,{path:{d:this.toSVGPath()}}):this.#c.setLastElement(t)}removeLastElement(){if(!this.#r)return this.#c.removeLastElement();this.#r.pop(),this.#o="";for(let t=0,r=this.#r.length;t<r;t++){let{line:n,points:i}=this.#r[t];this.#e=n,this.#s=i,this.#a=0,this.toSVGPath()}return{path:{d:this.#o}}}toSVGPath(){let t=tt.svgRound(this.#e[4]),r=tt.svgRound(this.#e[5]);if(this.#s.length===2)return this.#o=`${this.#o} M ${t} ${r} Z`,this.#o;if(this.#s.length<=6){let i=this.#o.lastIndexOf("M");this.#o=`${this.#o.slice(0,i)} M ${t} ${r}`,this.#a=6}if(this.#s.length===4){let i=tt.svgRound(this.#e[10]),o=tt.svgRound(this.#e[11]);return this.#o=`${this.#o} L ${i} ${o}`,this.#a=12,this.#o}let n=[];this.#a===0&&(n.push(`M ${t} ${r}`),this.#a=6);for(let i=this.#a,o=this.#e.length;i<o;i+=6){let[s,a,l,c,u,d]=this.#e.slice(i,i+6).map(tt.svgRound);n.push(`C${s} ${a} ${l} ${c} ${u} ${d}`)}return this.#o+=n.join(" "),this.#a=this.#e.length,this.#o}getOutlines(t,r,n,i){let o=this.#r.at(-1);return o.line=new Float32Array(o.line),o.points=new Float32Array(o.points),this.#c.build(this.#r,t,r,n,this.#n,this.#i,i),this.#t=null,this.#e=null,this.#r=null,this.#o=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}},ia=class extends tt{#t;#e=0;#r;#n;#i;#s;#o;#a;#c;build(t,r,n,i,o,s,a){this.#i=r,this.#s=n,this.#o=i,this.#a=o,this.#c=s,this.#r=a??0,this.#n=t,this.#d()}get thickness(){return this.#c}setLastElement(t){return this.#n.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#n.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:r}of this.#n){if(t.push(`M${tt.svgRound(r[4])} ${tt.svgRound(r[5])}`),r.length===6){t.push("Z");continue}if(r.length===12&&isNaN(r[6])){t.push(`L${tt.svgRound(r[10])} ${tt.svgRound(r[11])}`);continue}for(let n=6,i=r.length;n<i;n+=6){let[o,s,a,l,c,u]=r.subarray(n,n+6).map(tt.svgRound);t.push(`C${o} ${s} ${a} ${l} ${c} ${u}`)}}return t.join("")}serialize([t,r,n,i],o){let s=[],a=[],[l,c,u,d]=this.#f(),f,h,m,y,x,g,v,b,w;switch(this.#a){case 0:w=tt._rescale,f=t,h=r+i,m=n,y=-i,x=t+l*n,g=r+(1-c-d)*i,v=t+(l+u)*n,b=r+(1-c)*i;break;case 90:w=tt._rescaleAndSwap,f=t,h=r,m=n,y=i,x=t+c*n,g=r+l*i,v=t+(c+d)*n,b=r+(l+u)*i;break;case 180:w=tt._rescale,f=t+n,h=r,m=-n,y=i,x=t+(1-l-u)*n,g=r+c*i,v=t+(1-l)*n,b=r+(c+d)*i;break;case 270:w=tt._rescaleAndSwap,f=t+n,h=r+i,m=-n,y=-i,x=t+(1-c-d)*n,g=r+(1-l-u)*i,v=t+(1-c)*n,b=r+(1-l)*i;break}for(let{line:T,points:C}of this.#n)s.push(w(T,f,h,m,y,o?new Array(T.length):null)),a.push(w(C,f,h,m,y,o?new Array(C.length):null));return{lines:s,points:a,rect:[x,g,v,b]}}static deserialize(t,r,n,i,o,{paths:{lines:s,points:a},rotation:l,thickness:c}){let u=[],d,f,h,m,y;switch(l){case 0:y=tt._rescale,d=-t/n,f=r/i+1,h=1/n,m=-1/i;break;case 90:y=tt._rescaleAndSwap,d=-r/i,f=-t/n,h=1/i,m=1/n;break;case 180:y=tt._rescale,d=t/n+1,f=-r/i,h=-1/n,m=1/i;break;case 270:y=tt._rescaleAndSwap,d=r/i+1,f=t/n+1,h=-1/i,m=-1/n;break}if(!s){s=[];for(let g of a){let v=g.length;if(v===2){s.push(new Float32Array([NaN,NaN,NaN,NaN,g[0],g[1]]));continue}if(v===4){s.push(new Float32Array([NaN,NaN,NaN,NaN,g[0],g[1],NaN,NaN,NaN,NaN,g[2],g[3]]));continue}let b=new Float32Array(3*(v-2));s.push(b);let[w,T,C,E]=g.subarray(0,4);b.set([NaN,NaN,NaN,NaN,w,T],0);for(let A=4;A<v;A+=2){let _=g[A],P=g[A+1];b.set(tt.createBezierPoints(w,T,C,E,_,P),(A-2)*3),[w,T,C,E]=[C,E,_,P]}}}for(let g=0,v=s.length;g<v;g++)u.push({line:y(s[g].map(b=>b??NaN),d,f,h,m),points:y(a[g].map(b=>b??NaN),d,f,h,m)});let x=new this.prototype.constructor;return x.build(u,n,i,1,l,c,o),x}#l(t=this.#c){let r=this.#r+t/2*this.#o;return this.#a%180===0?[r/this.#i,r/this.#s]:[r/this.#s,r/this.#i]}#f(){let[t,r,n,i]=this.#t,[o,s]=this.#l(0);return[t+o,r+s,n-2*o,i-2*s]}#d(){let t=this.#t=Qs.slice();for(let{line:i}of this.#n){if(i.length<=12){for(let a=4,l=i.length;a<l;a+=6)W.pointBoundingBox(i[a],i[a+1],t);continue}let o=i[4],s=i[5];for(let a=6,l=i.length;a<l;a+=6){let[c,u,d,f,h,m]=i.subarray(a,a+6);W.bezierBoundingBox(o,s,c,u,d,f,h,m,t),o=h,s=m}}let[r,n]=this.#l();t[0]=fe(t[0]-r,0,1),t[1]=fe(t[1]-n,0,1),t[2]=fe(t[2]+r,0,1),t[3]=fe(t[3]+n,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#t}updateProperty(t,r){return t==="stroke-width"?this.#h(r):null}#h(t){let[r,n]=this.#l();this.#c=t;let[i,o]=this.#l(),[s,a]=[i-r,o-n],l=this.#t;return l[0]-=s,l[1]-=a,l[2]+=2*s,l[3]+=2*a,l}updateParentDimensions([t,r],n){let[i,o]=this.#l();this.#i=t,this.#s=r,this.#o=n;let[s,a]=this.#l(),l=s-i,c=a-o,u=this.#t;return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u}updateRotation(t){return this.#e=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#t.map(tt.svgRound).join(" ")}get defaultProperties(){let[t,r]=this.#t;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`}}}get rotationTransform(){let[,,t,r]=this.#t,n=0,i=0,o=0,s=0,a=0,l=0;switch(this.#e){case 90:i=r/t,o=-t/r,a=t;break;case 180:n=-1,s=-1,a=t,l=r;break;case 270:i=-r/t,o=t/r,l=r;break;default:return""}return`matrix(${n} ${i} ${o} ${s} ${tt.svgRound(a)} ${tt.svgRound(l)})`}getPathResizingSVGProperties([t,r,n,i]){let[o,s]=this.#l(),[a,l,c,u]=this.#t;if(Math.abs(c-o)<=tt.PRECISION||Math.abs(u-s)<=tt.PRECISION){let y=t+n/2-(a+c/2),x=r+i/2-(l+u/2);return{path:{"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`,transform:`${this.rotationTransform} translate(${y} ${x})`}}}let d=(n-2*o)/(c-2*o),f=(i-2*s)/(u-2*s),h=c/n,m=u/i;return{path:{"transform-origin":`${tt.svgRound(a)} ${tt.svgRound(l)}`,transform:`${this.rotationTransform} scale(${h} ${m}) translate(${tt.svgRound(o)} ${tt.svgRound(s)}) scale(${d} ${f}) translate(${tt.svgRound(-o)} ${tt.svgRound(-s)})`}}}getPathResizedSVGProperties([t,r,n,i]){let[o,s]=this.#l(),a=this.#t,[l,c,u,d]=a;if(a[0]=t,a[1]=r,a[2]=n,a[3]=i,Math.abs(u-o)<=tt.PRECISION||Math.abs(d-s)<=tt.PRECISION){let x=t+n/2-(l+u/2),g=r+i/2-(c+d/2);for(let{line:v,points:b}of this.#n)tt._translate(v,x,g,v),tt._translate(b,x,g,b);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let f=(n-2*o)/(u-2*o),h=(i-2*s)/(d-2*s),m=-f*(l+o)+t+o,y=-h*(c+s)+r+s;if(f!==1||h!==1||m!==0||y!==0)for(let{line:x,points:g}of this.#n)tt._rescale(x,m,y,f,h,x),tt._rescale(g,m,y,f,h,g);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,r],n){let[i,o]=n,s=this.#t,a=t-s[0],l=r-s[1];if(this.#i===i&&this.#s===o)for(let{line:c,points:u}of this.#n)tt._translate(c,a,l,c),tt._translate(u,a,l,u);else{let c=this.#i/i,u=this.#s/o;this.#i=i,this.#s=o;for(let{line:d,points:f}of this.#n)tt._rescale(d,a,l,c,u,d),tt._rescale(f,a,l,c,u,f);s[2]*=c,s[3]*=u}return s[0]=t,s[1]=r,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`}}}get defaultSVGProperties(){let t=this.#t;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${tt.svgRound(t[0])} ${tt.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}},ah=class e extends oh{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:Vt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,r){t==="stroke-width"&&(r??=this["stroke-width"],r*=this._viewParameters.realScale),super.updateSVGProperty(t,r)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},Bb=class e extends sh{static _type="ink";static _editorType=pt.INK;static _defaultDrawingOptions=null;constructor(t){super({...t,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,r){Vt.initialize(t,r),this._defaultDrawingOptions=new ah(r.viewParameters)}static getDefaultDrawingOptions(t){let r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!0}static get typesMap(){return ht(this,"typesMap",new Map([[yt.INK_THICKNESS,"stroke-width"],[yt.INK_COLOR,"stroke"],[yt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,r,n,i,o){return new Ib(t,r,n,i,o,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,r,n,i,o,s){return ia.deserialize(t,r,n,i,o,s)}static async deserialize(t,r,n){let i=null;if(t instanceof ld){let{data:{inkLists:s,rect:a,rotation:l,id:c,color:u,opacity:d,borderStyle:{rawWidth:f},popupRef:h,richText:m,contentsObj:y,creationDate:x,modificationDate:g},parent:{page:{pageNumber:v}}}=t;i=t={annotationType:pt.INK,color:Array.from(u),thickness:f,opacity:d,paths:{points:s},boxes:null,pageIndex:v-1,rect:a.slice(0),rotation:l,annotationElementId:c,id:c,deleted:!1,popupRef:h,richText:m,comment:y?.str||null,creationDate:x,modificationDate:g}}let o=await super.deserialize(t,r,n);return o._initialData=i,t.comment&&o.setCommentData(t),o}get toolbarButtons(){return this._colorPicker||=new Xp(this),[["colorPicker",this._colorPicker]]}get colorType(){return yt.INK_COLOR}get colorAndOpacityType(){return yt.INK_COLOR_AND_OPACITY}get opacityType(){return yt.INK_OPACITY}updateParams(t,r){if(t===yt.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(r.color,r.opacity);return}super.updateParams(t,r)}static updateDefaultParams(t,r){if(t===yt.INK_COLOR_AND_OPACITY){super.updateDefaultParams(yt.INK_COLOR,r.color),super.updateDefaultParams(yt.INK_OPACITY,r.opacity);return}super.updateDefaultParams(t,r)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:t,_drawingOptions:r,parent:n}=this;r.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(t,r.toSVGProperties())}static onScaleChangingWhenDrawing(){let t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:r,opacity:n}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:W.makeHexColor(...t),"stroke-width":r,"stroke-opacity":n})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:r,points:n}=this.serializeDraw(t),{_drawingOptions:{stroke:i,"stroke-opacity":o,"stroke-width":s}}=this,a=Object.assign(super.serialize(t),{color:Vt._colorManager.convert(i),opacity:o,thickness:s,paths:{lines:r,points:n}});return this.addComment(a),t?(a.isCopy=!0,a):this.annotationElementId&&!this.#t(a)?null:(a.id=this.annotationElementId,a)}#t(t){let{color:r,thickness:n,opacity:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((s,a)=>s!==r[a])||t.thickness!==n||t.opacity!==i||t.pageIndex!==o}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let{points:r,rect:n}=this.serializeDraw(!1);return t.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:r,popup:this.comment}),null}},dd=class extends ia{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},Op=8,Hu=3,io=class{static#t={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#e(t,r,n,i){return n-=t,i-=r,n===0?i>0?0:4:n===1?i+6:2-i}static#r=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#n(t,r,n,i,o,s,a){let l=this.#e(n,i,o,s);for(let c=0;c<8;c++){let u=(-c+l-a+16)%8,d=this.#r[2*u],f=this.#r[2*u+1];if(t[(n+d)*r+(i+f)]!==0)return u}return-1}static#i(t,r,n,i,o,s,a){let l=this.#e(n,i,o,s);for(let c=0;c<8;c++){let u=(c+l+a+16)%8,d=this.#r[2*u],f=this.#r[2*u+1];if(t[(n+d)*r+(i+f)]!==0)return u}return-1}static#s(t,r,n,i){let o=t.length,s=new Int32Array(o);for(let u=0;u<o;u++)s[u]=t[u]<=i?1:0;for(let u=1;u<n-1;u++)s[u*r]=s[u*r+r-1]=0;for(let u=0;u<r;u++)s[u]=s[r*n-1-u]=0;let a=1,l,c=[];for(let u=1;u<n-1;u++){l=1;for(let d=1;d<r-1;d++){let f=u*r+d,h=s[f];if(h===0)continue;let m=u,y=d;if(h===1&&s[f-1]===0)a+=1,y-=1;else if(h>=1&&s[f+1]===0)a+=1,y+=1,h>1&&(l=h);else{h!==1&&(l=Math.abs(h));continue}let x=[d,u],g=y===d+1,v={isHole:g,points:x,id:a,parent:0};c.push(v);let b;for(let k of c)if(k.id===l){b=k;break}b?b.isHole?v.parent=g?b.parent:l:v.parent=g?l:b.parent:v.parent=g?l:0;let w=this.#n(s,r,u,d,m,y,0);if(w===-1){s[f]=-a,s[f]!==1&&(l=Math.abs(s[f]));continue}let T=this.#r[2*w],C=this.#r[2*w+1],E=u+T,A=d+C;m=E,y=A;let _=u,P=d;for(;;){let k=this.#i(s,r,_,P,m,y,1);T=this.#r[2*k],C=this.#r[2*k+1];let I=_+T,M=P+C;x.push(M,I);let z=_*r+P;if(s[z+1]===0?s[z]=-a:s[z]===1&&(s[z]=a),I===u&&M===d&&_===E&&P===A){s[f]!==1&&(l=Math.abs(s[f]));break}else m=_,y=P,_=I,P=M}}}return c}static#o(t,r,n,i){if(n-r<=4){for(let E=r;E<n-2;E+=2)i.push(t[E],t[E+1]);return}let o=t[r],s=t[r+1],a=t[n-4]-o,l=t[n-3]-s,c=Math.hypot(a,l),u=a/c,d=l/c,f=u*s-d*o,h=l/a,m=1/c,y=Math.atan(h),x=Math.cos(y),g=Math.sin(y),v=m*(Math.abs(x)+Math.abs(g)),b=m*(1-v+v**2),w=Math.max(Math.atan(Math.abs(g+x)*b),Math.atan(Math.abs(g-x)*b)),T=0,C=r;for(let E=r+2;E<n-2;E+=2){let A=Math.abs(f-u*t[E+1]+d*t[E]);A>T&&(C=E,T=A)}T>(c*w)**2?(this.#o(t,r,C+2,i),this.#o(t,C,n,i)):i.push(o,s)}static#a(t){let r=[],n=t.length;return this.#o(t,0,n,r),r.push(t[n-2],t[n-1]),r.length<=4?null:r}static#c(t,r,n,i,o,s){let a=new Float32Array(s**2),l=-2*i**2,c=s>>1;for(let y=0;y<s;y++){let x=(y-c)**2;for(let g=0;g<s;g++)a[y*s+g]=Math.exp((x+(g-c)**2)/l)}let u=new Float32Array(256),d=-2*o**2;for(let y=0;y<256;y++)u[y]=Math.exp(y**2/d);let f=t.length,h=new Uint8Array(f),m=new Uint32Array(256);for(let y=0;y<n;y++)for(let x=0;x<r;x++){let g=y*r+x,v=t[g],b=0,w=0;for(let C=0;C<s;C++){let E=y+C-c;if(!(E<0||E>=n))for(let A=0;A<s;A++){let _=x+A-c;if(_<0||_>=r)continue;let P=t[E*r+_],k=a[C*s+A]*u[Math.abs(P-v)];b+=P*k,w+=k}}let T=h[g]=Math.round(b/w);m[T]++}return[h,m]}static#l(t){let r=new Uint32Array(256);for(let n of t)r[n]++;return r}static#f(t){let r=t.length,n=new Uint8ClampedArray(r>>2),i=-1/0,o=1/0;for(let a=0,l=n.length;a<l;a++){let c=n[a]=t[a<<2];i=Math.max(i,c),o=Math.min(o,c)}let s=255/(i-o);for(let a=0,l=n.length;a<l;a++)n[a]=(n[a]-o)*s;return n}static#d(t){let r,n=-1/0,i=-1/0,o=t.findIndex(l=>l!==0),s=o,a=o;for(r=o;r<256;r++){let l=t[r];l>n&&(r-s>i&&(i=r-s,a=r-1),n=l,s=r)}for(r=a-1;r>=0&&!(t[r]>t[r+1]);r--);return r}static#h(t){let r=t,{width:n,height:i}=t,{maxDim:o}=this.#t,s=n,a=i;if(n>o||i>o){let f=n,h=i,m=Math.log2(Math.max(n,i)/o),y=Math.floor(m);m=m===y?y-1:y;for(let g=0;g<m;g++){s=Math.ceil(f/2),a=Math.ceil(h/2);let v=new OffscreenCanvas(s,a);v.getContext("2d").drawImage(t,0,0,f,h,0,0,s,a),f=s,h=a,t!==r&&t.close(),t=v.transferToImageBitmap()}let x=Math.min(o/s,o/a);s=Math.round(s*x),a=Math.round(a*x)}let c=new OffscreenCanvas(s,a).getContext("2d",{willReadFrequently:!0});c.fillStyle="white",c.fillRect(0,0,s,a),c.filter="grayscale(1)",c.drawImage(t,0,0,t.width,t.height,0,0,s,a);let u=c.getImageData(0,0,s,a).data;return[this.#f(u),s,a]}static extractContoursFromText(t,{fontFamily:r,fontStyle:n,fontWeight:i},o,s,a,l){let c=new OffscreenCanvas(1,1),u=c.getContext("2d",{alpha:!1}),d=200,f=u.font=`${n} ${i} ${d}px ${r}`,{actualBoundingBoxLeft:h,actualBoundingBoxRight:m,actualBoundingBoxAscent:y,actualBoundingBoxDescent:x,fontBoundingBoxAscent:g,fontBoundingBoxDescent:v,width:b}=u.measureText(t),w=1.5,T=Math.ceil(Math.max(Math.abs(h)+Math.abs(m)||0,b)*w),C=Math.ceil(Math.max(Math.abs(y)+Math.abs(x)||d,Math.abs(g)+Math.abs(v)||d)*w);c=new OffscreenCanvas(T,C),u=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),u.font=f,u.filter="grayscale(1)",u.fillStyle="white",u.fillRect(0,0,T,C),u.fillStyle="black",u.fillText(t,T*(w-1)/2,C*(3-w)/2);let E=this.#f(u.getImageData(0,0,T,C).data),A=this.#l(E),_=this.#d(A),P=this.#s(E,T,C,_);return this.processDrawnLines({lines:{curves:P,width:T,height:C},pageWidth:o,pageHeight:s,rotation:a,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,r,n,i,o){let[s,a,l]=this.#h(t),[c,u]=this.#c(s,a,l,Math.hypot(a,l)*this.#t.sigmaSFactor,this.#t.sigmaR,this.#t.kernelSize),d=this.#d(u),f=this.#s(c,a,l,d);return this.processDrawnLines({lines:{curves:f,width:a,height:l},pageWidth:r,pageHeight:n,rotation:i,innerMargin:o,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:r,pageHeight:n,rotation:i,innerMargin:o,mustSmooth:s,areContours:a}){i%180!==0&&([r,n]=[n,r]);let{curves:l,width:c,height:u}=t,d=t.thickness??0,f=[],h=Math.min(r/c,n/u),m=h/r,y=h/n,x=[];for(let{points:v}of l){let b=s?this.#a(v):v;if(!b)continue;x.push(b);let w=b.length,T=new Float32Array(w),C=new Float32Array(3*(w===2?2:w-2));if(f.push({line:C,points:T}),w===2){T[0]=b[0]*m,T[1]=b[1]*y,C.set([NaN,NaN,NaN,NaN,T[0],T[1]],0);continue}let[E,A,_,P]=b;E*=m,A*=y,_*=m,P*=y,T.set([E,A,_,P],0),C.set([NaN,NaN,NaN,NaN,E,A],0);for(let k=4;k<w;k+=2){let I=T[k]=b[k]*m,M=T[k+1]=b[k+1]*y;C.set(tt.createBezierPoints(E,A,_,P,I,M),(k-2)*3),[E,A,_,P]=[_,P,I,M]}}if(f.length===0)return null;let g=a?new dd:new ia;return g.build(f,r,n,1,i,a?0:d,o),{outline:g,newCurves:x,areContours:a,thickness:d,width:c,height:u}}static async compressSignature({outlines:t,areContours:r,thickness:n,width:i,height:o}){let s=1/0,a=-1/0,l=0;for(let v of t){l+=v.length;for(let b=2,w=v.length;b<w;b++){let T=v[b]-v[b-2];s=Math.min(s,T),a=Math.max(a,T)}}let c;s>=-128&&a<=127?c=Int8Array:s>=-32768&&a<=32767?c=Int16Array:c=Int32Array;let u=t.length,d=Op+Hu*u,f=new Uint32Array(d),h=0;f[h++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*u)*c.BYTES_PER_ELEMENT,f[h++]=0,f[h++]=i,f[h++]=o,f[h++]=r?0:1,f[h++]=Math.max(0,Math.floor(n??0)),f[h++]=u,f[h++]=c.BYTES_PER_ELEMENT;for(let v of t)f[h++]=v.length-2,f[h++]=v[0],f[h++]=v[1];let m=new CompressionStream("deflate-raw"),y=m.writable.getWriter();await y.ready,y.write(f);let x=c.prototype.constructor;for(let v of t){let b=new x(v.length-2);for(let w=2,T=v.length;w<T;w++)b[w-2]=v[w]-v[w-2];y.write(b)}return y.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(t){try{let r=Uint8Array.fromBase64(t),{readable:n,writable:i}=new DecompressionStream("deflate-raw"),o=i.getWriter();await o.ready,o.write(r).then(async()=>{await o.ready,await o.close()}).catch(()=>{});let s=null,a=0;for await(let b of n)s||=new Uint8Array(new Uint32Array(b.buffer,0,4)[0]),s.set(b,a),a+=b.length;let l=new Uint32Array(s.buffer,0,s.length>>2),c=l[1];if(c!==0)throw new Error(`Invalid version: ${c}`);let u=l[2],d=l[3],f=l[4]===0,h=l[5],m=l[6],y=l[7],x=[],g=(Op+Hu*m)*Uint32Array.BYTES_PER_ELEMENT,v;switch(y){case Int8Array.BYTES_PER_ELEMENT:v=new Int8Array(s.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:v=new Int16Array(s.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:v=new Int32Array(s.buffer,g);break}a=0;for(let b=0;b<m;b++){let w=l[Hu*b+Op],T=new Float32Array(w+2);x.push(T);for(let C=0;C<Hu-1;C++)T[C]=l[Hu*b+Op+C+1];for(let C=0;C<w;C++)T[C+2]=T[C]+v[a++]}return{areContours:f,thickness:h,outlines:x,width:u,height:d}}catch(r){return vt(`decompressSignature: ${r}`),null}}},zb=class e extends oh{constructor(){super(),super.updateProperties({fill:Vt._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},Fb=class e extends ah{constructor(t){super(t),super.updateProperties({stroke:Vt._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},$b=class e extends sh{#t=!1;#e=null;#r=null;#n=null;static _type="signature";static _editorType=pt.SIGNATURE;static _defaultDrawingOptions=null;constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#r=t.signatureData||null,this.#e=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,r){Vt.initialize(t,r),this._defaultDrawingOptions=new zb,this._defaultDrawnSignatureOptions=new Fb(r.viewParameters)}static getDefaultDrawingOptions(t){let r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!1}static get typesMap(){return ht(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#e}}static computeTelemetryFinalData(t){let r=t.get("hasDescription");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,r,{_isCopy:n}=this;if(n&&(this._isCopy=!1,t=this.x,r=this.y),super.render(),this._drawId===null)if(this.#r){let{lines:i,mustSmooth:o,areContours:s,description:a,uuid:l,heightInPage:c}=this.#r,{rawDims:{pageWidth:u,pageHeight:d},rotation:f}=this.parent.viewport,h=io.processDrawnLines({lines:i,pageWidth:u,pageHeight:d,rotation:f,innerMargin:e._INNER_MARGIN,mustSmooth:o,areContours:s});this.addSignature(h,c,a,l)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#e||""}));return n&&(this._isCopy=!0,this._moveAfterPaste(t,r)),this.div}setUuid(t){this.#n=t,this.addEditToolbar()}getUuid(){return this.#n}get description(){return this.#e}set description(t){this.#e=t,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(r=>{r?.updateEditSignatureButton(t)}))}getSignaturePreview(){let{newCurves:t,areContours:r,thickness:n,width:i,height:o}=this.#r,s=Math.max(i,o),a=io.processDrawnLines({lines:{curves:t.map(l=>({points:l})),thickness:n,width:i,height:o},pageWidth:s,pageHeight:s,rotation:0,innerMargin:0,mustSmooth:!1,areContours:r});return{areContours:r,outline:a.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,r,n,i){let{x:o,y:s}=this,{outline:a}=this.#r=t;this.#t=a instanceof dd,this.description=n;let l;this.#t?l=e.getDefaultDrawingOptions():(l=e._defaultDrawnSignatureOptions.clone(),l.updateProperties({"stroke-width":a.thickness})),this._addOutlines({drawOutlines:a,drawingOptions:l});let[,c]=this.pageDimensions,u=r/c;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=o,this.y=s,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:r,pageHeight:n},rotation:i}=this.parent.viewport;return io.process(t,r,n,i,e._INNER_MARGIN)}getFromText(t,r){let{rawDims:{pageWidth:n,pageHeight:i},rotation:o}=this.parent.viewport;return io.extractContoursFromText(t,r,n,i,o,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:r,pageHeight:n},rotation:i}=this.parent.viewport;return io.processDrawnLines({lines:t,pageWidth:r,pageHeight:n,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:r}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":r}))}serialize(t=!1){if(this.isEmpty())return null;let{lines:r,points:n}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":i}}=this,o=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#t,color:[0,0,0],thickness:this.#t?0:i});return this.addComment(o),t?(o.paths={lines:r,points:n},o.uuid=this.#n,o.isCopy=!0):o.lines=r,this.#e&&(o.accessibilityData={type:"Figure",alt:this.#e}),o}static deserializeDraw(t,r,n,i,o,s){return s.areContours?dd.deserialize(t,r,n,i,o,s):ia.deserialize(t,r,n,i,o,s)}static async deserialize(t,r,n){let i=await super.deserialize(t,r,n);return i.#t=t.areContours,i.description=t.accessibilityData?.alt||"",i.#n=t.uuid,i}},jb=class extends Vt{#t=null;#e=null;#r=null;#n=null;#i=null;#s="";#o=null;#a=!1;#c=null;#l=!1;#f=!1;static _type="stamp";static _editorType=pt.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#n=t.bitmapUrl,this.#i=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,r){Vt.initialize(t,r)}static isHandlingMimeForPasting(t){return Fp.includes(t)}static paste(t,r){r.pasteEditor({mode:pt.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){let r=t.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}#d(t,r=!1){if(!t){this.remove();return}this.#t=t.bitmap,r||(this.#e=t.id,this.#l=t.isSvg),t.file&&(this.#s=t.file.name),this.#m()}#h(){if(this.#r=null,this._uiManager.enableWaiting(!1),!!this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(t=null,r=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:i,width:o,height:s}=t||this.copyCanvas(null,null,!0).imageData,a=await n.guess({name:"altText",request:{data:i,width:o,height:s,channels:i.length/(o*s)}});if(!a)throw new Error("No response from the AI service.");if(a.error)throw new Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw new Error("No valid response from the AI service.");let l=a.output;return await this.setGuessedAltText(l),r&&!this.hasAltTextData()&&(this.altTextData={alt:l,decorative:!1}),l}#g(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then(n=>this.#d(n,!0)).finally(()=>this.#h());return}if(this.#n){let n=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#r=this._uiManager.imageManager.getFromUrl(n).then(i=>this.#d(i)).finally(()=>this.#h());return}if(this.#i){let n=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#r=this._uiManager.imageManager.getFromFile(n).then(i=>this.#d(i)).finally(()=>this.#h());return}let t=document.createElement("input");t.type="file",t.accept=Fp.join(",");let r=this._uiManager._signal;this.#r=new Promise(n=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let i=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(i)}n()},{signal:r}),t.addEventListener("cancel",()=>{this.remove(),n()},{signal:r})}).finally(()=>this.#h()),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#o?.remove(),this.#o=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#g();return}super.rebuild(),this.div!==null&&(this.#e&&this.#o===null&&this.#g(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(this.#r||this.#t||this.#n||this.#i||this.#e||this.#a)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,r;return this._isCopy&&(t=this.x,r=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#a||(this.#t?this.#m():this.#g()),this._isCopy&&this._moveAfterPaste(t,r),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,r){let{id:n,bitmap:i}=this._uiManager.imageManager.getFromCanvas(t,r);r.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#e=n,i&&(this.#t=i),this.#a=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#c!==null&&clearTimeout(this.#c);let t=200;this.#c=setTimeout(()=>{this.#c=null,this.#p()},t)}#m(){let{div:t}=this,{width:r,height:n}=this.#t,[i,o]=this.pageDimensions,s=.75;if(this.width)r=this.width*i,n=this.height*o;else if(r>s*i||n>s*o){let l=Math.min(s*i/r,s*o/n);r*=l,n*=l}this._uiManager.enableWaiting(!1);let a=this.#o=document.createElement("canvas");a.setAttribute("role","img"),this.addContainer(a),this.width=r/i,this.height=n/o,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),this.#p(),this.#f||(this.parent.addUndoableEditor(this),this.#f=!0),this._reportTelemetry({action:"inserted_image"}),this.#s&&this.div.setAttribute("aria-description",this.#s),this.annotationElementId||this._uiManager.a11yAlert(Vt._l10nAlert.stamp)}copyCanvas(t,r,n=!1){t||(t=224);let{width:i,height:o}=this.#t,s=new Mi,a=this.#t,l=i,c=o,u=null;if(r){if(i>r||o>r){let C=Math.min(r/i,r/o);l=Math.floor(i*C),c=Math.floor(o*C)}u=document.createElement("canvas");let f=u.width=Math.ceil(l*s.sx),h=u.height=Math.ceil(c*s.sy);this.#l||(a=this.#u(f,h));let m=u.getContext("2d");m.filter=this._uiManager.hcmFilter;let y="white",x="#cfcfd8";this._uiManager.hcmFilter!=="none"?x="black":pv.isDarkMode&&(y="#8f8f9d",x="#42414d");let g=15,v=g*s.sx,b=g*s.sy,w=new OffscreenCanvas(v*2,b*2),T=w.getContext("2d");T.fillStyle=y,T.fillRect(0,0,v*2,b*2),T.fillStyle=x,T.fillRect(0,0,v,b),T.fillRect(v,b,v,b),m.fillStyle=m.createPattern(w,"repeat"),m.fillRect(0,0,f,h),m.drawImage(a,0,0,a.width,a.height,0,0,f,h)}let d=null;if(n){let f,h;if(s.symmetric&&a.width<t&&a.height<t)f=a.width,h=a.height;else if(a=this.#t,i>t||o>t){let x=Math.min(t/i,t/o);f=Math.floor(i*x),h=Math.floor(o*x),this.#l||(a=this.#u(f,h))}let y=new OffscreenCanvas(f,h).getContext("2d",{willReadFrequently:!0});y.drawImage(a,0,0,a.width,a.height,0,0,f,h),d={width:f,height:h,data:y.getImageData(0,0,f,h).data}}return{canvas:u,width:l,height:c,imageData:d}}#u(t,r){let{width:n,height:i}=this.#t,o=n,s=i,a=this.#t;for(;o>2*t||s>2*r;){let l=o,c=s;o>2*t&&(o=Math.ceil(o/2)),s>2*r&&(s=Math.ceil(s/2));let u=new OffscreenCanvas(o,s);u.getContext("2d").drawImage(a,0,0,l,c,0,0,o,s),a=u.transferToImageBitmap()}return a}#p(){let[t,r]=this.parentDimensions,{width:n,height:i}=this,o=new Mi,s=Math.ceil(n*t*o.sx),a=Math.ceil(i*r*o.sy),l=this.#o;if(!l||l.width===s&&l.height===a)return;l.width=s,l.height=a;let c=this.#l?this.#t:this.#u(s,a),u=l.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,s,a)}#y(t){if(t){if(this.#l){let i=this._uiManager.imageManager.getSvgUrl(this.#e);if(i)return i}let r=document.createElement("canvas");return{width:r.width,height:r.height}=this.#t,r.getContext("2d").drawImage(this.#t,0,0),r.toDataURL()}if(this.#l){let[r,n]=this.pageDimensions,i=Math.round(this.width*r*so.PDF_TO_CSS_UNITS),o=Math.round(this.height*n*so.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,o);return s.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,i,o),s.transferToImageBitmap()}return structuredClone(this.#t)}static async deserialize(t,r,n){let i=null,o=!1;if(t instanceof eh){let{data:{rect:y,rotation:x,id:g,structParent:v,popupRef:b,richText:w,contentsObj:T,creationDate:C,modificationDate:E},container:A,parent:{page:{pageNumber:_}},canvas:P}=t,k,I;P?(delete t.canvas,{id:k,bitmap:I}=n.imageManager.getFromCanvas(A.id,P),P.remove()):(o=!0,t._hasNoCanvas=!0);let M=(await r._structTree.getAriaAttributes(`${_l}${g}`))?.get("aria-label")||"";i=t={annotationType:pt.STAMP,bitmapId:k,bitmap:I,pageIndex:_-1,rect:y.slice(0),rotation:x,annotationElementId:g,id:g,deleted:!1,accessibilityData:{decorative:!1,altText:M},isSvg:!1,structParent:v,popupRef:b,richText:w,comment:T?.str||null,creationDate:C,modificationDate:E}}let s=await super.deserialize(t,r,n),{rect:a,bitmap:l,bitmapUrl:c,bitmapId:u,isSvg:d,accessibilityData:f}=t;o?(n.addMissingCanvas(t.id,s),s.#a=!0):u&&n.imageManager.isValidId(u)?(s.#e=u,l&&(s.#t=l)):s.#n=c,s.#l=d;let[h,m]=s.pageDimensions;return s.width=(a[2]-a[0])/h,s.height=(a[3]-a[1])/m,f&&(s.altTextData=f),s._initialData=i,t.comment&&s.setCommentData(t),s.#f=!!i,s}serialize(t=!1,r=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(t),{bitmapId:this.#e,isSvg:this.#l});if(this.addComment(n),t)return n.bitmapUrl=this.#y(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:i,altText:o}=this.serializeAltText(!1);if(!i&&o&&(n.accessibilityData={type:"Figure",alt:o}),this.annotationElementId){let a=this.#v(n);return a.isSame?null:(a.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(r===null)return n;r.stamps||=new Map;let s=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!r.stamps.has(this.#e))r.stamps.set(this.#e,{area:s,serialized:n}),n.bitmap=this.#y(!1);else if(this.#l){let a=r.stamps.get(this.#e);s>a.area&&(a.area=s,a.serialized.bitmap.close(),a.serialized.bitmap=this.#y(!1))}return n}#v(t){let{pageIndex:r,accessibilityData:{altText:n}}=this._initialData,i=t.pageIndex===r,o=(t.accessibilityData?.alt||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&o,isSameAltText:o}}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},lh=class e{#t;#e=!1;#r=null;#n=null;#i=null;#s=new Map;#o=!1;#a=!1;#c=!1;#l=null;#f=null;#d=null;#h=null;#g=null;#m=-1;#u;static _initialized=!1;static#p=new Map([Mb,Bb,jb,ih,$b].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:r,div:n,structTreeLayer:i,accessibilityManager:o,annotationLayer:s,drawLayer:a,textLayer:l,viewport:c,l10n:u}){let d=[...e.#p.values()];if(!e._initialized){e._initialized=!0;for(let f of d)f.initialize(u,t)}t.registerEditorTypes(d),this.#u=t,this.pageIndex=r,this.div=n,this.#t=o,this.#r=s,this.viewport=c,this.#d=l,this.drawLayer=a,this._structTree=i,this.#u.addLayer(this)}get isEmpty(){return this.#s.size===0}get isInvisible(){return this.isEmpty&&this.#u.getMode()===pt.NONE}updateToolbar(t){this.#u.updateToolbar(t)}updateMode(t=this.#u.getMode()){switch(this.#x(),t){case pt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case pt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case pt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:r}=this.div;if(r.toggle("nonEditing",!1),t===pt.POPUP)r.toggle("commentEditing",!0);else{r.toggle("commentEditing",!1);for(let n of e.#p.values())r.toggle(`${n._type}Editing`,t===n._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===this.#d?.div}setEditingState(t){this.#u.setEditingState(t)}addCommands(t){this.#u.addCommands(t)}cleanUndoStack(t){this.#u.cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#r?.togglePointerEvents(t)}get#y(){return this.#s.size!==0?this.#s.values():this.#u.getEditors(this.pageIndex)}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#g?.abort(),this.#g=null;let t=new Set;for(let n of this.#y)n.enableEditing(),n.show(!0),n.annotationElementId&&(this.#u.removeChangedExistingAnnotation(n),t.add(n.annotationElementId));let r=this.#r;if(r)for(let n of r.getEditableAnnotations()){if(n.hide(),this.#u.isDeletedAnnotationElement(n.data.id)||t.has(n.data.id))continue;let i=await this.deserialize(n);i&&(this.addOrRebuild(i),i.enableEditing())}this.#c=!1,this.#u._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#a=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#d&&!this.#g){this.#g=new AbortController;let i=this.#u.combinedSignal(this.#g);this.#d.div.addEventListener("pointerdown",o=>{let{clientX:a,clientY:l,timeStamp:c}=o,u=this.#m;if(c-u>500){this.#m=c;return}this.#m=-1;let{classList:d}=this.div;d.toggle("getElements",!0);let f=document.elementsFromPoint(a,l);if(d.toggle("getElements",!1),!this.div.contains(f[0]))return;let h,m=new RegExp(`^${qu}[0-9]+$`);for(let x of f)if(m.test(x.id)){h=x.id;break}if(!h)return;let y=this.#s.get(h);y?.annotationElementId===null&&(ve(o),y.dblclick(o))},{signal:i,capture:!0})}let t=this.#r,r=[];if(t){let i=new Map,o=new Map;for(let s of this.#y){if(s.disableEditing(),!s.annotationElementId){r.push(s);continue}if(s.serialize()!==null){i.set(s.annotationElementId,s);continue}else o.set(s.annotationElementId,s);this.getEditableAnnotation(s.annotationElementId)?.show(),s.remove()}for(let s of t.getEditableAnnotations()){let{id:a}=s.data;if(this.#u.isDeletedAnnotationElement(a)){s.updateEdited({deleted:!0});continue}let l=o.get(a);if(l){l.resetAnnotationElement(s),l.show(!1),s.show();continue}l=i.get(a),l&&(this.#u.addChangedExistingAnnotation(l),l.renderAnnotationElement(s)&&l.show(!1)),s.show()}}this.#x(),this.isEmpty&&(this.div.hidden=!0);let{classList:n}=this.div;for(let i of e.#p.values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(r),this.#a=!1}getEditableAnnotation(t){return this.#r?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#u.getActive()!==t&&this.#u.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#h){this.#h=new AbortController;let t=this.#u.combinedSignal(this.#h);this.#d.div.addEventListener("pointerdown",this.#v.bind(this),{signal:t}),this.#d.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#h&&(this.#h.abort(),this.#h=null,this.#d.div.classList.remove("highlighting"))}#v(t){this.#u.unselectAll();let{target:r}=t;if(r===this.#d.div||(r.getAttribute("role")==="img"||r.classList.contains("endOfContent")||r.classList.contains("textLayerImages")||r.classList.contains("textLayerImagePlaceholder"))&&this.#d.div.contains(r)){let{isMac:n}=Kt.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#u.showAllEditors("highlight",!0,!0),this.#d.div.classList.add("free"),this.toggleDrawing(),ih.startHighlighting(this,this.#u.direction==="ltr",{target:this.#d.div,x:t.x,y:t.y}),this.#d.div.addEventListener("pointerup",()=>{this.#d.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#u._signal}),t.preventDefault()}}enableClick(){if(this.#n)return;this.#n=new AbortController;let t=this.#u.combinedSignal(this.#n);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let r=this.pointerup.bind(this);this.div.addEventListener("pointerup",r,{signal:t}),this.div.addEventListener("pointercancel",r,{signal:t})}disableClick(){this.#n?.abort(),this.#n=null}attach(t){this.#s.set(t.id,t);let{annotationElementId:r}=t;r&&this.#u.isDeletedAnnotationElement(r)&&this.#u.removeDeletedAnnotationElement(t)}detach(t){this.#s.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#a&&t.annotationElementId&&this.#u.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#u.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#u.addDeletedAnnotationElement(t),Vt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),this.#u.addEditor(t),this.attach(t),!t.isAttachedToDOM){let r=t.render();this.div.append(r),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#c),this.#u.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:r}=document;t.div.contains(r)&&!this.#i&&(t._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#u._signal}),r.focus())},0)),t._structTreeParentId=this.#t?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){let r=()=>t._uiManager.rebuild(t),n=()=>{t.remove()};this.addCommands({cmd:r,undo:n,mustExec:!1})}getEditorByUID(t){for(let r of this.#s.values())if(r.uid===t)return r;return null}get#b(){return e.#p.get(this.#u.getMode())}combinedSignal(t){return this.#u.combinedSignal(t)}#w(t){let r=this.#b;return r?new r.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#b?.canCreateNewEmptyEditor()}async pasteEditor(t,r){this.updateToolbar(t),await this.#u.updateMode(t.mode);let{offsetX:n,offsetY:i}=this.#C(),o=this.#u.getId(),s=this.#w({parent:this,id:o,x:n,y:i,uiManager:this.#u,isCentered:!0,...r});s&&this.add(s)}async deserialize(t){return await e.#p.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#u)||null}createAndAddNewEditor(t,r,n={}){let i=this.#u.getId(),o=this.#w({parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:this.#u,isCentered:r,...n});return o&&this.add(o),o}get boundingClientRect(){return this.div.getBoundingClientRect()}#C(){let{x:t,y:r,width:n,height:i}=this.boundingClientRect,o=Math.max(0,t),s=Math.max(0,r),a=Math.min(window.innerWidth,t+n),l=Math.min(window.innerHeight,r+i),c=(o+a)/2-t,u=(s+l)/2-r,[d,f]=this.viewport.rotation%180===0?[c,u]:[u,c];return{offsetX:d,offsetY:f}}addNewEditor(t={}){this.createAndAddNewEditor(this.#C(),!0,t)}setSelected(t){this.#u.setSelected(t)}toggleSelected(t){this.#u.toggleSelected(t)}unselect(t){this.#u.unselect(t)}pointerup(t){let{isMac:r}=Kt.platform;if(t.button!==0||t.ctrlKey&&r||t.target!==this.div||!this.#o||(this.#o=!1,this.#b?.isDrawer&&this.#b.supportMultipleDrawings))return;if(!this.#e){this.#e=!0;return}let n=this.#u.getMode();if(n===pt.STAMP||n===pt.POPUP||n===pt.SIGNATURE){this.#u.unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(this.#u.getMode()===pt.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:r}=Kt.platform;if(t.button!==0||t.ctrlKey&&r||t.target!==this.div)return;if(this.#o=!0,this.#b?.isDrawer){this.startDrawingSession(t);return}let n=this.#u.getActive();this.#e=!n||n.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#l){this.#b.startDrawing(this,this.#u,!1,t);return}this.#u.setCurrentDrawingSession(this),this.#l=new AbortController;let r=this.#u.combinedSignal(this.#l);this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(this.#f=null,this.commitOrRemove())},{signal:r}),this.#b.startDrawing(this,this.#u,!1,t)}pause(t){if(t){let{activeElement:r}=document;this.div.contains(r)&&(this.#f=r);return}this.#f&&setTimeout(()=>{this.#f?.focus(),this.#f=null},0)}endDrawingSession(t=!1){return this.#l?(this.#u.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#f=null,this.#b.endDrawing(t)):null}findNewParent(t,r,n){let i=this.#u.findParent(r,n);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#b.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#u.getActive()?.parent===this&&(this.#u.commitOrRemove(),this.#u.setActiveEditor(null)),this.#i&&(clearTimeout(this.#i),this.#i=null);for(let t of this.#s.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#s.clear(),this.#u.removeLayer(this)}#x(){for(let t of this.#s.values())t.isEmpty()&&t.remove()}async render({viewport:t}){this.viewport=t,Ko(this.div,t);for(let r of this.#u.getEditors(this.pageIndex))this.add(r),r.rebuild();await this.#u.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){this.#u.commitOrRemove(),this.#x();let r=this.viewport.rotation,n=t.rotation;if(this.viewport=t,Ko(this.div,{rotation:n}),r!==n)for(let i of this.#s.values())i.rotate(n)}get pageDimensions(){let{pageWidth:t,pageHeight:r}=this.viewport.rawDims;return[t,r]}get scale(){return this.#u.viewParameters.realScale}};function Vz(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Dp(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(".textLayer"):e.parentElement?.closest(".textLayer")||null:null}function Gz(e,t,r,n){if(e===r)return t<=n;let i=e.compareDocumentPosition(r);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function kE(e,t,r){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains("textLayer")||t!==e.childNodes.length)return{container:e,offset:t};let n=e.lastChild;return n?.nodeType===Node.ELEMENT_NODE&&n.classList.contains("endOfContent")&&(n=n.previousSibling),!n||!r.contains(n)?null:n.nodeType===Node.TEXT_NODE?{container:n,offset:n.textContent.length}:{container:n,offset:n.childNodes.length}}var ch=class e{#t=null;#e=new Map;#r=null;#n=null;#i=null;#s=null;#o=new Map;static#a=0;static#c=0;static#l=null;static#f=new Set;static#d=!1;static#h=new Set;static#g=new WeakMap;constructor({filterFactory:t=null,pageColors:r=null,pageIndex:n,textLayer:i=null}){if(this.pageIndex=n,this.#n=t,this.#i=r,i){let o=e.#g.get(i);if(o?.selectionDiv&&(o.selectionDiv.remove(),e.#f.delete(o.selectionDiv)),e.#g.set(i,{drawLayer:this}),e.#h.add(i),this.#r=i,this.#s=new MutationObserver(s=>{if(!(!this.#t||!this.#r?.isConnected||!e.#u())){for(let{addedNodes:a}of s)for(let l of a)if(l.nodeType===Node.ELEMENT_NODE&&l.classList.contains("endOfContent")){e.#y();return}}}),this.#s.observe(i,{childList:!0}),e.#l===null){e.#l=new AbortController;let{signal:s}=e.#l;document.addEventListener("selectionchange",e.#y.bind(e),{signal:s}),document.addEventListener("pointerdown",()=>{e.#d=!0},{signal:s}),document.addEventListener("pointerup",()=>{e.#d=!1},{signal:s}),window.addEventListener("blur",()=>{e.#d=!1},{signal:s})}}}setParent(t){if(!this.#t){this.#t=t,this.#r?.isConnected&&e.#u()&&e.#y();return}if(this.#t!==t){if(this.#e.size>0)for(let r of this.#e.values())r.remove(),t.append(r);this.#t=t}}static#m(t){let r=this.#g.get(t);r?.selectionDiv&&(r.selectionDiv.remove(),this.#f.delete(r.selectionDiv),r.selectionDiv=null,r.path=null)}static#u(){let t=document.getSelection();return!!t&&!t.isCollapsed}static#p(){return[...this.#h].filter(t=>t.isConnected).sort(Vz)}static#y(){let t=document.getSelection();if(!t||t.isCollapsed){for(let s of this.#f)s.remove();this.#f.clear();return}let r=new WeakMap,n=this.#p(),i=[];for(let s=0,a=t.rangeCount;s<a;s++){let l=t.getRangeAt(s);if(l.collapsed)continue;let{startContainer:c,startOffset:u,endContainer:d,endOffset:f}=l,h=Dp(c),m=Dp(d),y=h===null,x=m===null;if(this.#d&&y!==x)return;if(t.rangeCount===1){let{anchorNode:b,anchorOffset:w,focusNode:T,focusOffset:C}=t,E=Dp(b),A=Dp(T),_=Gz(b,w,T,C);E&&A&&_!==null&&(_?(c=b,u=w,h=E,d=T,f=C,m=A):(c=T,u=C,h=A,d=b,f=w,m=E))}let g=n.filter(b=>l.intersectsNode(b));if(g.length===0)continue;let v=!1;if(h||(h=g[0],c=h,u=0,v=!0),m||(m=g.at(-1),d=m,f=m.childNodes.length,v=!0),d.nodeType===Node.ELEMENT_NODE){if(d.classList.contains("endOfContent")){let b=d.previousSibling;if(!b)continue;d=b,f=b.nodeType===Node.TEXT_NODE?b.textContent.length:b.childNodes.length}else if(d.classList.contains("textLayer")&&d.childNodes.length===f){let b=kE(d,f,m);if(!b)continue;d=b.container,f=b.offset}}if(c.nodeType===Node.ELEMENT_NODE){let b=kE(c,u,h);if(!b)continue;c=b.container,u=b.offset}if(h===m&&!v&&g.includes(h)){i.push([l,h]);continue}for(let b of g){let w=b.firstChild;if(!w)continue;let T=document.createRange();if(b===h?T.setStart(c,u):T.setStartBefore(w),b===m)T.setEnd(d,f);else{let C=b.lastChild;if(!C)continue;if(C.nodeType===Node.ELEMENT_NODE&&C.classList.contains("endOfContent")){let E=C.previousSibling;if(!E)continue;T.setEndAfter(E)}else T.setEndAfter(C)}T.collapsed||i.push([T,b])}}let o=new Set(i.map(s=>s[1]));for(let s of this.#h)o.has(s)||this.#m(s);for(let[s,a]of i){let l=e.#g.get(a);if(!l)continue;let c=r.get(a);if(!c){let m=a.getBoundingClientRect();c=(y,x,g,v)=>({x:(y-m.x)/m.width,y:(x-m.y)/m.height,width:g/m.width,height:v/m.height}),r.set(a,c)}let u=[];for(let{x:m,y,width:x,height:g}of s.getClientRects())x===0||g===0||({x:m,y,width:x,height:g}=c(m,y,x,g),!(x===1&&g===1)&&u.push(`M${m} ${y} h${x} v${g} h-${x} Z`));if(u.length===0)continue;let d=l.drawLayer,f=l.selectionDiv,h=l.path;if(!f){let m=`clip_selection_${e.#c++}`;f=document.createElement("div"),f.className="selection",f.style.clipPath=`url(#${m})`;let y=d.#n?.createSelectionStyle(d.#i);if(y)for(let[v,b]of Object.entries(y))f.style.setProperty(v,b);let x=e._svgFactory.create(1,1,!0);x.setAttribute("aria-hidden","true"),x.setAttribute("width","100%"),x.setAttribute("height","100%");let g=e._svgFactory.createElement("clipPath");g.setAttribute("id",m),g.setAttribute("clipPathUnits","objectBoundingBox"),h=e._svgFactory.createElement("path"),g.append(h),x.append(g),f.append(x),l.path=h,l.selectionDiv=f}!f.parentNode&&d.#t&&(d.#t.append(f),this.#f.add(f)),h.setAttribute("d",u.join(" "))}}static get _svgFactory(){return ht(this,"_svgFactory",new ra)}static#v(t,[r,n,i,o]){let{style:s}=t;s.top=`${100*n}%`,s.left=`${100*r}%`,s.width=`${100*i}%`,s.height=`${100*o}%`}#b(){let t=e._svgFactory.create(1,1,!0);return this.#t.append(t),t.setAttribute("aria-hidden","true"),t}#w(t,r){let n=e._svgFactory.createElement("clipPath");t.append(n);let i=`clip_${r}`;n.setAttribute("id",i),n.setAttribute("clipPathUnits","objectBoundingBox");let o=e._svgFactory.createElement("use");return n.append(o),o.setAttribute("href",`#${r}`),o.classList.add("clip"),i}#C(t,r){for(let[n,i]of Object.entries(r))i===null?t.removeAttribute(n):t.setAttribute(n,i)}draw(t,r=!1,n=!1){let i=e.#a++,o=this.#b(),s=e._svgFactory.createElement("defs");o.append(s);let a=e._svgFactory.createElement("path");s.append(a);let l=`path_${i}`;a.setAttribute("id",l),a.setAttribute("vector-effect","non-scaling-stroke"),r&&this.#o.set(i,a);let c=n?this.#w(s,l):null,u=e._svgFactory.createElement("use");return o.append(u),u.setAttribute("href",`#${l}`),this.updateProperties(o,t),this.#e.set(i,o),{id:i,clipPathId:`url(#${c})`}}drawOutline(t,r){let n=e.#a++,i=this.#b(),o=e._svgFactory.createElement("defs");i.append(o);let s=e._svgFactory.createElement("path");o.append(s);let a=`path_${n}`;s.setAttribute("id",a),s.setAttribute("vector-effect","non-scaling-stroke");let l;if(r){let d=e._svgFactory.createElement("mask");o.append(d),l=`mask_${n}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");let f=e._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let h=e._svgFactory.createElement("use");d.append(h),h.setAttribute("href",`#${a}`),h.setAttribute("stroke","none"),h.setAttribute("fill","black"),h.setAttribute("fill-rule","nonzero"),h.classList.add("mask")}let c=e._svgFactory.createElement("use");i.append(c),c.setAttribute("href",`#${a}`),l&&c.setAttribute("mask",`url(#${l})`);let u=c.cloneNode();return i.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),this.updateProperties(i,t),this.#e.set(n,i),n}finalizeDraw(t,r){this.#o.delete(t),this.updateProperties(t,r)}updateProperties(t,r){if(!r)return;let{root:n,bbox:i,rootClass:o,path:s}=r,a=typeof t=="number"?this.#e.get(t):t;if(a){if(n&&this.#C(a,n),i&&e.#v(a,i),o){let{classList:l}=a;for(let[c,u]of Object.entries(o))l.toggle(c,u)}if(s){let c=a.firstElementChild.firstElementChild;this.#C(c,s)}}}updateParent(t,r){if(r===this)return;let n=this.#e.get(t);n&&(r.#t.append(n),this.#e.delete(t),r.#e.set(t,n))}remove(t){this.#o.delete(t),this.#t!==null&&(this.#e.get(t).remove(),this.#e.delete(t))}destroy(){this.#t=null;for(let t of this.#e.values())t.remove();this.#e.clear(),this.#o.clear(),this.#s?.disconnect(),this.#s=null,this.#r&&(e.#g.get(this.#r)?.drawLayer===this&&(e.#m(this.#r),e.#g.delete(this.#r),e.#h.delete(this.#r),e.#h.size===0&&(e.#l?.abort(),e.#l=null,e.#d=!1)),this.#r=null)}};function Mp(e){return`${(e*100).toFixed(2)}%`}var uh=class e{#t=[];#e=new Map;#r=null;#n=0;#i=0;#s=0;static#o=null;constructor(t,r,n,i){this.#n=t,this.#t=r,this.#i=n.rawDims.pageWidth,this.#s=n.rawDims.pageHeight,this.#r=i}render(){let t=document.createElement("div");t.className="textLayerImages";for(let r=0;r<this.#t.length;r+=6){let n=this.#a(this.#t.subarray(r,r+6));n&&t.append(n)}return t.addEventListener("contextmenu",r=>{if(!(r.target instanceof HTMLCanvasElement))return;let n=r.target,i=this.#e.get(n);if(!i)return;let o=e.#o?.deref();if(o===n)return;o&&(o.width=0,o.height=0),e.#o=new WeakRef(n);let{inverseTransform:s,x1:a,y1:l,width:c,height:u}=i,d=this.#r(),f=Math.ceil(a*d.width),h=Math.ceil(l*d.height),m=Math.floor((a+c/this.#i)*d.width),y=Math.floor((l+u/this.#s)*d.height);n.width=m-f,n.height=y-h;let x=n.getContext("2d");x.setTransform(...s),x.translate(-f,-h),x.drawImage(d,0,0)}),t}#a([t,r,n,i,o,s]){let a=Math.hypot((o-t)*this.#i,(s-r)*this.#s),l=Math.hypot((n-t)*this.#i,(i-r)*this.#s);if(a<this.#n||l<this.#n)return null;let c=[(o-t)*this.#i/a,(s-r)*this.#s/a,(n-t)*this.#i/l,(i-r)*this.#s/l,0,0],u=W.inverseTransform(c),d=document.createElement("canvas");return d.className="textLayerImagePlaceholder",d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:"absolute",left:Mp(t),top:Mp(r),width:Mp(a/this.#i),height:Mp(l/this.#s),transformOrigin:"0% 0%",transform:`matrix(${c.join(",")})`}),this.#e.set(d,{inverseTransform:u,width:a,height:l,x1:t,y1:r}),d}};globalThis._pdfjsTestingUtils={HighlightOutliner:cd};globalThis.pdfjsLib={AbortException:ci,AnnotationEditorLayer:lh,AnnotationEditorParamsType:yt,AnnotationEditorType:pt,AnnotationEditorUIManager:Zo,AnnotationLayer:Bl,AnnotationMode:li,AnnotationType:Ne,applyOpacity:IE,build:XE,ColorPicker:od,createValidAbsoluteUrl:Hb,CSSConstants:$p,DOMSVGFactory:ra,DrawLayer:ch,FeatureTest:Kt,fetchData:gh,findContrastColor:BE,getDocument:wh,getFilenameFromUrl:LE,getPdfFilenameFromUrl:NE,getRGB:Fl,getRGBA:zl,getUuid:Vb,GlobalWorkerOptions:Di,ImageKind:Uu,InvalidPDFException:kl,isDataScheme:pd,isPdfFile:yh,isValidExplicitDest:$E,makeArr:hh,makeMap:mh,makeObj:Bp,MathClamp:fe,noContextMenu:ln,normalizeUnicode:ME,OPS:Oi,OutputScale:Mi,PasswordResponses:DE,PDFDataRangeTransport:id,PDFDateString:Dl,PDFWorker:Il,PermissionFlag:OE,PixelsPerInch:so,RenderingCancelledException:Ol,renderRichText:Gb,ResponseException:ta,setLayerDimensions:Ko,shadow:ht,SignatureExtractor:io,stopEvent:ve,SupportedImageMimeTypes:Fp,TextLayer:Qo,TextLayerImages:uh,TouchManager:Qu,updateUrlHash:Ub,Util:W,VerbosityLevel:fd,version:qE,XfaLayer:Zu};p();var $l=D(Z(),1),pe=D(F(),1);rr();p();var tA=Object.prototype.hasOwnProperty;function eA(e,t,r){for(r of e.keys())if(sa(r,t))return r}function sa(e,t){var r,n,i;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((n=e.length)===t.length)for(;n--&&sa(e[n],t[n]););return n===-1}if(r===Set){if(e.size!==t.size)return!1;for(n of e)if(i=n,i&&typeof i=="object"&&(i=eA(t,i),!i)||!t.has(i))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(n of e)if(i=n[0],i&&typeof i=="object"&&(i=eA(t,i),!i)||!sa(n[1],t.get(i)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(!r||typeof e=="object"){n=0;for(r in e)if(tA.call(e,r)&&++n&&!tA.call(t,r)||!(r in t)||!sa(e[r],t[r]))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}p();function ui(e){let t=!1;return{promise:new Promise((n,i)=>{e.then(o=>!t&&n(o)).catch(o=>!t&&i(o))}),cancel(){t=!0}}}p();var Xz=["onCopy","onCut","onPaste"],Kz=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],Zz=["onFocus","onBlur"],Qz=["onInput","onInvalid","onReset","onSubmit"],Jz=["onLoad","onError"],t3=["onKeyDown","onKeyPress","onKeyUp"],e3=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],r3=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],n3=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],i3=["onSelect"],o3=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],s3=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],a3=["onScroll"],l3=["onWheel"],c3=["onAnimationStart","onAnimationEnd","onAnimationIteration"],u3=["onTransitionEnd"],d3=["onToggle"],f3=["onChange"],p3=[...Xz,...Kz,...Zz,...Qz,...Jz,...t3,...e3,...r3,...n3,...i3,...o3,...s3,...a3,...l3,...c3,...u3,...f3,...d3];function hd(e,t){let r={};for(let n of p3){let i=e[n];i&&(t?r[n]=(o=>i(o,t(n))):r[n]=i)}return r}p();var h3=!0,Wb="Invariant failed";function Ct(e,t){if(!e){if(h3)throw new Error(Wb);var r=typeof t=="function"?t():t,n=r?"".concat(Wb,": ").concat(r):Wb;throw new Error(n)}}var jl=D(Jo(),1);p();var oA=D(F(),1),g3=(0,oA.createContext)(null),Eh=g3;p();var y3="noopener noreferrer nofollow",md=class{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Ct(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){Ct(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}addLinkAttributes(t,r,n){t.href=r,t.rel=this.externalLinkRel||y3,t.target=n?"_blank":this.externalLinkTarget||""}goToDestination(t){return new Promise(r=>{Ct(this.pdfDocument,"PDF document not loaded."),Ct(t,"Destination is not specified."),typeof t=="string"?this.pdfDocument.getDestination(t).then(r):Array.isArray(t)?r(t):t.then(r)}).then(r=>{Ct(Array.isArray(r),`"${r}" is not a valid destination array.`);let n=r[0];new Promise(i=>{Ct(this.pdfDocument,"PDF document not loaded."),n instanceof Object?this.pdfDocument.getPageIndex(n).then(o=>{i(o)}).catch(()=>{Ct(!1,`"${n}" is not a valid page reference.`)}):typeof n=="number"?i(n):Ct(!1,`"${n}" is not a valid destination reference.`)}).then(i=>{let o=i+1;Ct(this.pdfViewer,"PDF viewer is not initialized."),Ct(o>=1&&o<=this.pagesCount,`"${o}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:r,pageIndex:i,pageNumber:o})})})}goToPage(t){let r=t-1;Ct(this.pdfViewer,"PDF viewer is not initialized."),Ct(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:r,pageNumber:t})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(t){this.goToDestination(t)}};p();var sA=D(Z(),1);function lo({children:e,type:t}){return(0,sA.jsx)("div",{className:`react-pdf__message react-pdf__message--${t}`,children:e})}p();var v3={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Yb=v3;p();var aA=D(F(),1);function b3(e,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return e}}function On(){return(0,aA.useReducer)(b3,{value:void 0,error:void 0})}p();var qb=D(Jo(),1),gd=typeof window<"u",lA=gd&&window.location.protocol==="file:";function x3(e){return typeof e<"u"}function Dn(e){return x3(e)&&e!==null}function S3(e){return typeof e=="string"}function cA(e){return e instanceof ArrayBuffer}function uA(e){return Ct(gd,"isBlob can only be used in a browser environment"),e instanceof Blob}function Ah(e){return S3(e)&&/^data:/.test(e)}function Xb(e){Ct(Ah(e),"Invalid data URI.");let[t="",r=""]=e.split(",");return t.split(";").indexOf("base64")!==-1?atob(r):unescape(r)}function dA(){return gd&&window.devicePixelRatio||1}var fA="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Kb(){(0,qb.default)(!lA,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${fA}`)}function pA(){(0,qb.default)(!lA,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${fA}`)}function cn(e){e?.cancel&&e.cancel()}function yd(e,t){return Object.defineProperty(e,"width",{get(){return this.getViewport({scale:t}).width},configurable:!0}),Object.defineProperty(e,"height",{get(){return this.getViewport({scale:t}).height},configurable:!0}),Object.defineProperty(e,"originalWidth",{get(){return this.getViewport({scale:1}).width},configurable:!0}),Object.defineProperty(e,"originalHeight",{get(){return this.getViewport({scale:1}).height},configurable:!0}),e}function _h(e){return e.name==="AbortException"||e.name==="RenderingCancelledException"}function hA(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{if(!n.result)return r(new Error("Error while reading a file."));t(n.result)},n.onerror=i=>{if(!i.target)return r(new Error("Error while reading a file."));let{error:o}=i.target;if(!o)return r(new Error("Error while reading a file."));switch(o.code){case o.NOT_FOUND_ERR:return r(new Error("Error while reading a file: File not found."));case o.SECURITY_ERR:return r(new Error("Error while reading a file: Security error."));case o.ABORT_ERR:return r(new Error("Error while reading a file: Aborted."));default:return r(new Error("Error while reading a file."))}},n.readAsArrayBuffer(e)})}var{PDFDataRangeTransport:T3}=Li,w3=(e,t)=>{switch(t){case Yb.NEED_PASSWORD:{let r=prompt("Enter the password to open this PDF file.");e(r);break}case Yb.INCORRECT_PASSWORD:{let r=prompt("Invalid password. Please try again.");e(r);break}default:}};function mA(e){return typeof e=="object"&&e!==null&&("data"in e||"range"in e||"url"in e)}var C3=(0,pe.forwardRef)(function({children:t,className:r,error:n="Failed to load PDF file.",externalLinkRel:i,externalLinkTarget:o,file:s,inputRef:a,imageResourcesPath:l,loading:c="Loading PDF…",noData:u="No PDF file specified.",onItemClick:d,onLoadError:f,onLoadProgress:h,onLoadSuccess:m,onPassword:y=w3,onSourceError:x,onSourceSuccess:g,options:v,renderMode:b,rotate:w,scale:T,...C},E){let[A,_]=On(),{value:P,error:k}=A,[I,M]=On(),{value:z,error:B}=I,R=(0,pe.useRef)(new md),L=(0,pe.useRef)([]),G=(0,pe.useRef)(void 0),U=(0,pe.useRef)(void 0);s&&s!==G.current&&mA(s)&&((0,jl.default)(!sa(s,G.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),G.current=s),v&&v!==U.current&&((0,jl.default)(!sa(v,U.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),U.current=v);let X=(0,pe.useRef)({scrollPageIntoView:Tt=>{let{dest:Nt,pageNumber:kt,pageIndex:te=kt-1}=Tt;if(d){d({dest:Nt,pageIndex:te,pageNumber:kt});return}let Xt=L.current[te];if(Xt){Xt.scrollIntoView();return}(0,jl.default)(!1,`An internal link leading to page ${kt} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});(0,pe.useImperativeHandle)(E,()=>({linkService:R,pages:L,viewer:X}),[]);function J(){g&&g()}function Y(){k&&((0,jl.default)(!1,k.toString()),x&&x(k))}function et(){_({type:"RESET"})}(0,pe.useEffect)(et,[s,_]);let ct=(0,pe.useCallback)(async()=>{if(!s)return null;if(typeof s=="string")return Ah(s)?{data:Xb(s)}:(Kb(),{url:s});if(s instanceof T3)return{range:s};if(cA(s))return{data:s};if(gd&&uA(s))return{data:await hA(s)};if(Ct(typeof s=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),Ct(mA(s),"Invalid parameter object: need either .data, .range or .url"),"url"in s&&typeof s.url=="string"){if(Ah(s.url)){let{url:Tt,...Nt}=s;return{data:Xb(Tt),...Nt}}Kb()}return s},[s]);(0,pe.useEffect)(()=>{let Tt=ui(ct());return Tt.promise.then(Nt=>{_({type:"RESOLVE",value:Nt})}).catch(Nt=>{_({type:"REJECT",error:Nt})}),()=>{cn(Tt)}},[ct,_]),(0,pe.useEffect)(()=>{if(!(typeof P>"u")){if(P===!1){Y();return}J()}},[P]);function St(){z&&(m&&m(z),L.current=new Array(z.numPages),R.current.setDocument(z))}function ot(){B&&((0,jl.default)(!1,B.toString()),f&&f(B))}(0,pe.useEffect)(function(){M({type:"RESET"})},[M,P]),(0,pe.useEffect)(function(){if(!P)return;let Nt=v?{...P,...v}:P,kt=wh(Nt);h&&(kt.onProgress=h),y&&(kt.onPassword=y);let te=kt;return te.promise.then(Xt=>{te.destroyed||M({type:"RESOLVE",value:Xt})}).catch(Xt=>{te.destroyed||M({type:"REJECT",error:Xt})}),()=>{te.destroy()}},[v,M,P]),(0,pe.useEffect)(()=>{if(!(typeof z>"u")){if(z===!1){ot();return}St()}},[z]),(0,pe.useEffect)(function(){R.current.setViewer(X.current),R.current.setExternalLinkRel(i),R.current.setExternalLinkTarget(o)},[i,o]);let q=(0,pe.useCallback)((Tt,Nt)=>{L.current[Tt]=Nt},[]),j=(0,pe.useCallback)(Tt=>{delete L.current[Tt]},[]),K=(0,pe.useMemo)(()=>({imageResourcesPath:l,linkService:R.current,onItemClick:d,pdf:z,registerPage:q,renderMode:b,rotate:w,scale:T,unregisterPage:j}),[l,d,z,q,b,w,T,j]),nt=(0,pe.useMemo)(()=>hd(C,()=>z),[C,z]);function mt(){function Tt(kt){return!!kt?.pdf}if(!Tt(K))throw new Error("pdf is undefined");let Nt=typeof t=="function"?t(K):t;return(0,$l.jsx)(Eh.Provider,{value:K,children:Nt})}function lt(){return s?z==null?(0,$l.jsx)(lo,{type:"loading",children:typeof c=="function"?c():c}):z===!1?(0,$l.jsx)(lo,{type:"error",children:typeof n=="function"?n():n}):mt():(0,$l.jsx)(lo,{type:"no-data",children:typeof u=="function"?u():u})}return(0,$l.jsx)("div",{className:Lt("react-pdf__Document",r),ref:a,...nt,children:lt()})}),Ph=C3;p();var gA=D(F(),1);function aa(){return(0,gA.useContext)(Eh)}p();var di=D(Z(),1),fi=D(F(),1);rr();p();function vd(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(Boolean);if(r.length<=1){var n=r[0];return n||null}return function(o){for(var s=0,a=r;s<a.length;s++){var l=a[s];typeof l=="function"?l(o):l&&(l.current=o)}}}var OA=D(Jo(),1);p();var bA=D(Z(),1),uo=D(F(),1);rr();var kh=D(Jo(),1);p();var vA=D(F(),1);p();var yA=D(F(),1),E3=(0,yA.createContext)(null),Rh=E3;function co(){return(0,vA.useContext)(Rh)}function Zb(){let e=aa(),t=co();Ct(t,"Unable to find Page context.");let r={...e,...t},{filterAnnotations:n,imageResourcesPath:i,linkService:o,onGetAnnotationsError:s,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:l,onRenderAnnotationLayerSuccess:c,page:u,pdf:d,renderForms:f,rotate:h,scale:m=1}=r;Ct(d,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Ct(u,"Attempted to load page annotations, but no page was specified."),Ct(o,"Attempted to load page annotations, but no linkService was specified.");let[y,x]=On(),{value:g,error:v}=y,b=(0,uo.useRef)(null);(0,kh.default)(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function w(){g&&a&&a(g)}function T(){v&&((0,kh.default)(!1,v.toString()),s&&s(v))}(0,uo.useEffect)(function(){x({type:"RESET"})},[x,u]),(0,uo.useEffect)(function(){if(!u)return;let P=ui(u.getAnnotations()),k=P;return P.promise.then(I=>{x({type:"RESOLVE",value:I})}).catch(I=>{x({type:"REJECT",error:I})}),()=>{cn(k)}},[x,u]),(0,uo.useEffect)(()=>{if(g!==void 0){if(g===!1){T();return}w()}},[g]);function C(){c&&c()}function E(_){(0,kh.default)(!1,`${_}`),l&&l(_)}let A=(0,uo.useMemo)(()=>u.getViewport({scale:m,rotation:h}),[u,h,m]);return(0,uo.useEffect)(function(){if(!d||!u||!o||!g)return;let{current:P}=b;if(!P)return;let k=A.clone({dontFlip:!0}),I={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:d.annotationStorage,commentManager:null,div:P,l10n:null,linkService:o,page:u,structTreeLayer:null,viewport:k},M={annotations:n?n({annotations:g}):g,annotationStorage:d.annotationStorage,div:P,imageResourcesPath:i,linkService:o,page:u,renderForms:f,viewport:k};P.innerHTML="";try{new Bl(I).render(M),C()}catch(z){E(z)}return()=>{}},[g,n,i,o,u,d,f,A]),(0,bA.jsx)("div",{className:Lt("react-pdf__Page__annotations","annotationLayer"),ref:b})}p();var nx=D(Z(),1),Ni=D(F(),1);var AA=D(Jo(),1);p();var wA=D(Z(),1),Dh=D(F(),1);var CA=D(Jo(),1);p();var tx=D(Z(),1),ex=D(F(),1);p();p();var Qb={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},xA=/^H(\d+)$/;function A3(e){return e in Qb}function bd(e){return"children"in e}function Jb(e){return bd(e)?e.children.length===1&&0 in e.children&&"id"in e.children[0]:!1}function _3(e){let t={};if(bd(e)){let{role:r}=e,n=r.match(xA);if(n)t.role="heading",t["aria-level"]=Number(n[1]);else if(A3(r)){let i=Qb[r];i&&(t.role=i)}}return t}function SA(e){let t={};if(bd(e)){if(e.alt!==void 0&&(t["aria-label"]=e.alt),e.lang!==void 0&&(t.lang=e.lang),Jb(e)){let[r]=e.children;if(r){let n=SA(r);return{...t,...n}}}}else"id"in e&&(t["aria-owns"]=e.id);return t}function TA(e){return e?{..._3(e),...SA(e)}:null}function Oh({className:e,node:t}){let r=(0,ex.useMemo)(()=>TA(t),[t]),n=(0,ex.useMemo)(()=>!bd(t)||Jb(t)?null:t.children.map((i,o)=>(0,tx.jsx)(Oh,{node:i},o)),[t]);return(0,tx.jsx)("span",{className:e,...r,children:n})}function rx(){let e=co();Ct(e,"Unable to find Page context.");let{onGetStructTreeError:t,onGetStructTreeSuccess:r}=e,[n,i]=On(),{value:o,error:s}=n,{customTextRenderer:a,page:l}=e;function c(){o&&r&&r(o)}function u(){s&&((0,CA.default)(!1,s.toString()),t&&t(s))}return(0,Dh.useEffect)(function(){i({type:"RESET"})},[i,l]),(0,Dh.useEffect)(function(){if(a||!l)return;let f=ui(l.getStructTree()),h=f;return f.promise.then(m=>{i({type:"RESOLVE",value:m})}).catch(m=>{i({type:"REJECT",error:m})}),()=>cn(h)},[a,l,i]),(0,Dh.useEffect)(()=>{if(o!==void 0){if(o===!1){u();return}c()}},[o]),o?(0,wA.jsx)(Oh,{className:"react-pdf__Page__structTree structTree",node:o}):null}var EA=li;function ix(e){let t=co();Ct(t,"Unable to find Page context.");let r={...t,...e},{_className:n,canvasBackground:i,devicePixelRatio:o=dA(),onRenderError:s,onRenderSuccess:a,page:l,renderForms:c,renderTextLayer:u,pageColors:d,rotate:f,scale:h}=r,{canvasRef:m}=e;Ct(l,"Attempted to render page canvas, but no page was specified.");let y=(0,Ni.useRef)(null);function x(){l&&a&&a(yd(l,h))}function g(T){_h(T)||((0,AA.default)(!1,T.toString()),s&&s(T))}let v=(0,Ni.useMemo)(()=>l.getViewport({scale:h*o,rotation:f}),[o,l,f,h]),b=(0,Ni.useMemo)(()=>l.getViewport({scale:h,rotation:f}),[l,f,h]);(0,Ni.useEffect)(function(){if(!l)return;l.cleanup();let{current:C}=y;if(!C)return;C.width=v.width,C.height=v.height,C.style.width=`${Math.floor(b.width)}px`,C.style.height=`${Math.floor(b.height)}px`,C.style.visibility="hidden";let E={annotationMode:c?EA.ENABLE_FORMS:EA.ENABLE,canvas:C,canvasContext:C.getContext("2d",{alpha:!1}),pageColors:d,viewport:v};i&&(E.background=i);let A=l.render(E),_=A;return A.promise.then(()=>{C.style.visibility="",x()}).catch(g),()=>cn(_)},[i,l,d,c,v,b]);let w=(0,Ni.useCallback)(()=>{let{current:T}=y;T&&(T.width=0,T.height=0)},[]);return(0,Ni.useEffect)(()=>w,[w]),(0,nx.jsx)("canvas",{className:`${n}__canvas`,dir:"ltr",ref:vd(m,y),style:{display:"block",userSelect:"none"},children:u?(0,nx.jsx)(rx,{}):null})}p();var _A=D(Z(),1),un=D(F(),1);rr();var Mh=D(Jo(),1);function P3(e){return"str"in e}var R3=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),k3=new Set(["action","formaction","href","poster","src","xlink:href"]);function O3(e){let t="";for(let r of e){let n=r.charCodeAt(0);n<=32||n===127||(t+=r.toLowerCase())}return t.startsWith("javascript:")||t.startsWith("vbscript:")}function D3(e){return e.nodeType===Node.ELEMENT_NODE}function PA(e){return D3(e)&&e instanceof HTMLElement}function M3(e){return PA(e)&&R3.has(e.tagName.toLowerCase())}function L3(e){let t=document.createElement(e.tagName.toLowerCase());return Array.from(e.attributes).forEach(r=>{let n=r.name.toLowerCase();n.startsWith("on")||n==="srcdoc"||k3.has(n)&&O3(r.value)||t.setAttribute(r.name,r.value)}),Array.from(e.childNodes).forEach(r=>{t.append(RA(r))}),t}function RA(e){var t;return PA(e)&&!M3(e)?L3(e):document.createTextNode((t=e.textContent)!==null&&t!==void 0?t:"")}function N3(e,t){let r=document.createElement("template");r.innerHTML=t;let n=document.createDocumentFragment();Array.from(r.content.childNodes).forEach(i=>{n.append(RA(i))}),e.replaceChildren(n)}function ox(){let e=co();Ct(e,"Unable to find Page context.");let{customTextRenderer:t,onGetTextError:r,onGetTextSuccess:n,onRenderTextLayerError:i,onRenderTextLayerSuccess:o,page:s,pageIndex:a,pageNumber:l,rotate:c,scale:u}=e;Ct(s,"Attempted to load page text content, but no page was specified.");let[d,f]=On(),{value:h,error:m}=d,y=(0,un.useRef)(null);(0,Mh.default)(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function x(){h&&n&&n(h)}function g(){m&&((0,Mh.default)(!1,m.toString()),r&&r(m))}(0,un.useEffect)(function(){f({type:"RESET"})},[s,f]),(0,un.useEffect)(function(){if(!s)return;let A=ui(s.getTextContent()),_=A;return A.promise.then(P=>{f({type:"RESOLVE",value:P})}).catch(P=>{f({type:"REJECT",error:P})}),()=>cn(_)},[s,f]),(0,un.useEffect)(()=>{if(h!==void 0){if(h===!1){g();return}x()}},[h]);let v=(0,un.useCallback)(()=>{o&&o()},[o]),b=(0,un.useCallback)(E=>{_h(E)||((0,Mh.default)(!1,E.toString()),i&&i(E))},[i]);function w(){let E=y.current;E&&E.classList.add("selecting")}function T(){let E=y.current;E&&E.classList.remove("selecting")}let C=(0,un.useMemo)(()=>s.getViewport({scale:u,rotation:c}),[s,c,u]);return(0,un.useLayoutEffect)(function(){if(!s||!h)return;let{current:A}=y;if(!A)return;A.innerHTML="";let _=s.streamTextContent({includeMarkedContent:!0}),P={container:A,textContentSource:_,viewport:C},k=new Qo(P),I=k;return k.render().then(()=>{let M=document.createElement("div");M.className="endOfContent",A.append(M);let z=A.querySelectorAll('[role="presentation"]');if(t){let B=0;h.items.forEach((R,L)=>{if(!P3(R))return;let G=z[B];if(!G)return;let U=t({pageIndex:a,pageNumber:l,itemIndex:L,...R});N3(G,U),B+=R.str&&R.hasEOL?2:1})}v()}).catch(b),()=>cn(I)},[t,b,v,s,a,l,h,C]),(0,_A.jsx)("div",{className:Lt("react-pdf__Page__textContent","textLayer"),onMouseUp:T,onMouseDown:w,ref:y})}var kA=1;function Hl(e){let r={...aa(),...e},{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:o,canvasRef:s,children:a,className:l,customRenderer:c,customTextRenderer:u,devicePixelRatio:d,error:f="Failed to load the page.",filterAnnotations:h,height:m,inputRef:y,loading:x="Loading page…",noData:g="No page specified.",onGetAnnotationsError:v,onGetAnnotationsSuccess:b,onGetStructTreeError:w,onGetStructTreeSuccess:T,onGetTextError:C,onGetTextSuccess:E,onLoadError:A,onLoadSuccess:_,onRenderAnnotationLayerError:P,onRenderAnnotationLayerSuccess:k,onRenderError:I,onRenderSuccess:M,onRenderTextLayerError:z,onRenderTextLayerSuccess:B,pageColors:R,pageIndex:L,pageNumber:G,pdf:U,registerPage:X,renderAnnotationLayer:J=!0,renderForms:Y=!1,renderMode:et="canvas",renderTextLayer:ct=!0,rotate:St,scale:ot=kA,unregisterPage:q,width:j,...K}=r,[nt,mt]=On(),{value:lt,error:Tt}=nt,Nt=(0,fi.useRef)(null);Ct(U,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");let kt=Dn(G)?G-1:L??null,te=G??(Dn(L)?L+1:null),Xt=St??(lt?lt.rotate:null),Ut=(0,fi.useMemo)(()=>{if(!lt)return null;let ee=1,ae=ot??kA;if(j||m){let hr=lt.getViewport({scale:1,rotation:Xt});j?ee=j/hr.width:m&&(ee=m/hr.height)}return ae*ee},[m,lt,Xt,ot,j]);(0,fi.useEffect)(function(){return()=>{Dn(kt)&&i&&q&&q(kt)}},[i,U,kt,q]);function Pi(){if(_){if(!lt||!Ut)return;_(yd(lt,Ut))}if(i&&X){if(!Dn(kt)||!Nt.current)return;X(kt,Nt.current)}}function Ar(){Tt&&((0,OA.default)(!1,Tt.toString()),A&&A(Tt))}(0,fi.useEffect)(function(){mt({type:"RESET"})},[mt,U,kt]),(0,fi.useEffect)(function(){if(!U||!te)return;let ae=ui(U.getPage(te)),hr=ae;return ae.promise.then(Ks=>{mt({type:"RESOLVE",value:Ks})}).catch(Ks=>{mt({type:"REJECT",error:Ks})}),()=>cn(hr)},[mt,U,te]),(0,fi.useEffect)(()=>{if(lt!==void 0){if(lt===!1){Ar();return}Pi()}},[lt,Ut]);let Lr=(0,fi.useMemo)(()=>Dn(kt)&&te&&Dn(Xt)&&Dn(Ut)?{_className:n,canvasBackground:o,customTextRenderer:u,devicePixelRatio:d,filterAnnotations:h,onGetAnnotationsError:v,onGetAnnotationsSuccess:b,onGetStructTreeError:w,onGetStructTreeSuccess:T,onGetTextError:C,onGetTextSuccess:E,onRenderAnnotationLayerError:P,onRenderAnnotationLayerSuccess:k,onRenderError:I,onRenderSuccess:M,onRenderTextLayerError:z,onRenderTextLayerSuccess:B,page:lt,pageColors:R,pageIndex:kt,pageNumber:te,renderForms:Y,renderTextLayer:ct,rotate:Xt,scale:Ut}:null,[n,o,u,d,h,v,b,w,T,C,E,P,k,I,M,z,B,lt,R,kt,te,Y,ct,Xt,Ut]),oi=(0,fi.useMemo)(()=>hd(K,()=>lt&&(Ut?yd(lt,Ut):void 0)),[K,lt,Ut]),Ee=`${kt}@${Ut}/${Xt}`;function Ur(){switch(et){case"custom":return Ct(c,'renderMode was set to "custom", but no customRenderer was passed.'),(0,di.jsx)(c,{},`${Ee}_custom`);case"none":return null;default:return(0,di.jsx)(ix,{canvasRef:s},`${Ee}_canvas`)}}function H(){return ct?(0,di.jsx)(ox,{},`${Ee}_text`):null}function st(){return J?(0,di.jsx)(Zb,{},`${Ee}_annotations`):null}function er(){function ee(hr){return!!hr?.page}if(!ee(Lr))throw new Error("page is undefined");let ae=typeof a=="function"?a(Lr):a;return(0,di.jsxs)(Rh.Provider,{value:Lr,children:[Ur(),H(),st(),ae]})}function pr(){return te?U===null||lt===void 0||lt===null?(0,di.jsx)(lo,{type:"loading",children:typeof x=="function"?x():x}):U===!1||lt===!1?(0,di.jsx)(lo,{type:"error",children:typeof f=="function"?f():f}):er():(0,di.jsx)(lo,{type:"no-data",children:typeof g=="function"?g():g})}return(0,di.jsx)("div",{className:Lt(n,l),"data-page-number":te,ref:vd(y,Nt),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${Ut}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:o||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...oi,children:pr()})}p();var sx=D(Z(),1);rr();function Lh(e){let r={...aa(),...e},{className:n,linkService:i,onItemClick:o,pageIndex:s,pageNumber:a,pdf:l}=r;Ct(l,"Attempted to load a thumbnail, but no document was specified. Wrap <Thumbnail /> in a <Document /> or pass explicit `pdf` prop.");let c=Dn(a)?a-1:s??null,u=a??(Dn(s)?s+1:null);function d(y){y.preventDefault(),!(!Dn(c)||!u)&&(Ct(o||i,"Either onItemClick callback or linkService must be defined in order to navigate to an outline item."),o?o({pageIndex:c,pageNumber:u}):i&&i.goToPage(u))}let{className:f,onItemClick:h,...m}=e;return(0,sx.jsx)("a",{className:Lt("react-pdf__Thumbnail",n),href:u?"#":void 0,onClick:d,children:(0,sx.jsx)(Hl,{...m,_className:"react-pdf__Thumbnail__page",_enableRegisterUnregisterPage:!1,renderAnnotationLayer:!1,renderTextLayer:!1})})}pA();Di.workerSrc="pdf.worker.mjs";p();p();var nF=D(F(),1);p();var Cd=D(F(),1);p();var ft=e=>typeof e=="string",xd=()=>{let e,t,r=new Promise((n,i)=>{e=n,t=i});return r.resolve=e,r.reject=t,r},DA=e=>e==null?"":String(e),I3=(e,t,r)=>{e.forEach(n=>{t[n]&&(r[n]=t[n])})},B3=/###/g,MA=e=>e&&e.includes("###")?e.replace(B3,"."):e,LA=e=>!e||ft(e),Sd=(e,t,r)=>{let n=ft(t)?t.split("."):t,i=0;for(;i<n.length-1;){if(LA(e))return{};let o=MA(n[i]);!e[o]&&r&&(e[o]=new r),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++i}return LA(e)?{}:{obj:e,k:MA(n[i])}},NA=(e,t,r)=>{let{obj:n,k:i}=Sd(e,t,Object);if(n!==void 0||t.length===1){n[i]=r;return}let o=t[t.length-1],s=t.slice(0,t.length-1),a=Sd(e,s,Object);for(;a.obj===void 0&&s.length;)o=`${s[s.length-1]}.${o}`,s=s.slice(0,s.length-1),a=Sd(e,s,Object),a?.obj&&typeof a.obj[`${a.k}.${o}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${o}`]=r},z3=(e,t,r,n)=>{let{obj:i,k:o}=Sd(e,t,Object);i[o]=i[o]||[],i[o].push(r)},Ih=(e,t)=>{let{obj:r,k:n}=Sd(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},F3=(e,t,r)=>{let n=Ih(e,r);return n!==void 0?n:Ih(t,r)},jA=(e,t,r)=>{for(let n in t)n!=="__proto__"&&n!=="constructor"&&(n in e?ft(e[n])||e[n]instanceof String||ft(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):jA(e[n],t[n],r):e[n]=t[n]);return e},fo=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),$3={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},j3=e=>ft(e)?e.replace(/[&<>"'\/]/g,t=>$3[t]):e,ux=class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){let r=this.regExpMap.get(t);if(r!==void 0)return r;let n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}},H3=[" ",",","?","!",";"],U3=new ux(20),V3=(e,t,r)=>{t=t||"",r=r||"";let n=H3.filter(s=>!t.includes(s)&&!r.includes(s));if(n.length===0)return!0;let i=U3.getRegExp(`(${n.map(s=>s==="?"?"\\?":s).join("|")})`),o=!i.test(e);if(!o){let s=e.indexOf(r);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o},dx=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let n=t.split(r),i=e;for(let o=0;o<n.length;){if(!i||typeof i!="object")return;let s,a="";for(let l=o;l<n.length;++l)if(l!==o&&(a+=r),a+=n[l],s=i[a],s!==void 0){if(["string","number","boolean"].includes(typeof s)&&l<n.length-1)continue;o+=l-o+1;break}i=s}return i},Td=e=>e?.replace(/_/g,"-"),G3={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}},fx=class e{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||G3,this.options=r,this.debug=r.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,n,i){return i&&!this.debug?null:(t=t.map(o=>ft(o)?o.replace(/[\r\n\x00-\x1F\x7F]/g," "):o),ft(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Ii=new fx,Ul=class{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let i=this.observers[n].get(r)||0;this.observers[n].set(r,i+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}once(t,r){let n=(...i)=>{r(...i),this.off(t,n)};return this.on(t,n),this}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([i,o])=>{for(let s=0;s<o;s++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,o])=>{for(let s=0;s<o;s++)i(t,...r)})}},Bh=class extends Ul{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){let r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,n,i={}){let o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,a;t.includes(".")?a=t.split("."):(a=[t,r],n&&(Array.isArray(n)?a.push(...n):ft(n)&&o?a.push(...n.split(o)):a.push(n)));let l=Ih(this.data,a);return!l&&!r&&!n&&t.includes(".")&&(t=a[0],r=a[1],n=a.slice(2).join(".")),l||!s||!ft(n)?l:dx(this.data?.[t]?.[r],n,o)}addResource(t,r,n,i,o={silent:!1}){let s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,a=[t,r];n&&(a=a.concat(s?n.split(s):n)),t.includes(".")&&(a=t.split("."),i=r,r=a[1]),this.addNamespaces(r),NA(this.data,a,i),o.silent||this.emit("added",t,r,n,i)}addResources(t,r,n,i={silent:!1}){for(let o in n)(ft(n[o])||Array.isArray(n[o]))&&this.addResource(t,r,o,n[o],{silent:!0});i.silent||this.emit("added",t,r,n)}addResourceBundle(t,r,n,i,o,s={silent:!1,skipCopy:!1}){let a=[t,r];t.includes(".")&&(a=t.split("."),i=n,n=r,r=a[1]),this.addNamespaces(r);let l=Ih(this.data,a)||{};s.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?jA(l,n,o):l={...l,...n},NA(this.data,a,l),s.silent||this.emit("added",t,r,n)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){let r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},HA={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(o=>{t=this.processors[o]?.process(t,r,n,i)??t}),t}},UA=Symbol("i18next/PATH_KEY");function W3(){let e=[],t=Object.create(null),r;return t.get=(n,i)=>(r?.revoke?.(),i===UA?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}function la(e,t){let{[UA]:r}=e(W3()),n=t?.keySeparator??".",i=t?.nsSeparator??":",o=t?.enableSelector==="strict";if(r.length>1&&i){let s=t?.ns,a=o?Array.isArray(s)?s:s?[s]:null:Array.isArray(s)?s:null;if(a&&(o?a:a.length>1?a.slice(1):[]).includes(r[0]))return`${r[0]}${i}${r.slice(1).join(n)}`}return r.join(n)}var ax=e=>!ft(e)&&typeof e!="boolean"&&typeof e!="number",zh=class e extends Ul{constructor(t,r={}){super(),I3(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ii.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){let n={...r};if(t==null)return!1;let i=this.resolve(t,n);if(i?.res===void 0)return!1;let o=ax(i.res);return!(n.returnObjects===!1&&o)}extractFromKey(t,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");let i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,o=r.ns||this.options.defaultNS||[],s=n&&t.includes(n),a=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!V3(t,n,i);if(s&&!a){let l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:ft(o)?[o]:o};let c=t.split(n);(n!==i||n===i&&this.options.ns.includes(c[0]))&&(o=c.shift()),t=c.join(i)}return{key:t,namespaces:ft(o)?[o]:o}}translate(t,r,n){let i=typeof r=="object"?{...r}:r;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),t==null)return"";typeof t=="function"&&(t=la(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(M=>typeof M=="function"?la(M,{...this.options,...i}):String(M));let o=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],i),c=l[l.length-1],u=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return f?o?{res:`${c}${u}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:`${c}${u}${a}`:o?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:a;let h=this.resolve(t,i),m=h?.res,y=h?.usedKey||a,x=h?.exactUsedKey||a,g=["[object Number]","[object Function]","[object RegExp]"],v=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,w=i.count!==void 0&&!ft(i.count),T=e.hasDefaultValue(i),C=w?this.pluralResolver.getSuffix(d,i.count,i):"",E=i.ordinal&&w?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):"",A=w&&!i.ordinal&&i.count===0,_=A&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${C}`]||i[`defaultValue${E}`]||i.defaultValue,P=m;b&&!m&&T&&(P=_);let k=ax(P),I=Object.prototype.toString.apply(P);if(b&&P&&k&&!g.includes(I)&&!(ft(v)&&Array.isArray(P))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,P,{...i,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return o?(h.res=M,h.usedParams=this.getUsedParamsDetails(i),h):M}if(s){let M=Array.isArray(P),z=M?[]:{},B=M?x:y;for(let R in P)if(Object.prototype.hasOwnProperty.call(P,R)){let L=`${B}${s}${R}`;T&&!m?z[R]=this.translate(L,{...i,defaultValue:ax(_)?_[R]:void 0,joinArrays:!1,ns:l}):z[R]=this.translate(L,{...i,joinArrays:!1,ns:l}),z[R]===L&&(z[R]=P[R])}m=z}}else if(b&&ft(v)&&Array.isArray(m))m=m.join(v),m&&(m=this.extendTranslation(m,t,i,n));else{let M=!1,z=!1;!this.isValidLookup(m)&&T&&(M=!0,m=_),this.isValidLookup(m)||(z=!0,m=a);let R=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&z?void 0:m,L=T&&_!==m&&this.options.updateMissing;if(z||M||L){if(this.logger.log(L?"updateKey":"missingKey",d,c,w&&!L?`${a}${this.pluralResolver.getSuffix(d,i.count,i)}`:a,L?_:m),s){let J=this.resolve(a,{...i,keySeparator:!1});J&&J.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let G=[],U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let J=0;J<U.length;J++)G.push(U[J]);else this.options.saveMissingTo==="all"?G=this.languageUtils.toResolveHierarchy(i.lng||this.language):G.push(i.lng||this.language);let X=(J,Y,et)=>{let ct=T&&et!==m?et:R;this.options.missingKeyHandler?this.options.missingKeyHandler(J,c,Y,ct,L,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(J,c,Y,ct,L,i),this.emit("missingKey",J,c,Y,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?G.forEach(J=>{let Y=this.pluralResolver.getSuffixes(J,i);A&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!Y.includes(`${this.options.pluralSeparator}zero`)&&Y.push(`${this.options.pluralSeparator}zero`),Y.forEach(et=>{X([J],a+et,i[`defaultValue${et}`]||_)})}):X(G,a,_))}m=this.extendTranslation(m,t,i,h,n),z&&m===a&&this.options.appendNamespaceToMissingKey&&(m=`${c}${u}${a}`),(z||M)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${u}${a}`:a,M?m:void 0,i))}return o?(h.res=m,h.usedParams=this.getUsedParamsDetails(i),h):m}extendTranslation(t,r,n,i,o){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let l=ft(t)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),c;if(l){let d=t.match(this.interpolator.nestingRegexp);c=d&&d.length}let u=n.replace&&!ft(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),t=this.interpolator.interpolate(t,u,n.lng||this.language||i.usedLng,n),l){let d=t.match(this.interpolator.nestingRegexp),f=d&&d.length;c<f&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(t=this.interpolator.nest(t,(...d)=>o?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}let s=n.postProcess||this.options.postProcess,a=ft(s)?[s]:s;return t!=null&&a?.length&&n.applyPostProcessor!==!1&&(t=HA.handle(a,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t,r={}){let n,i,o,s,a;return ft(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(l=>typeof l=="function"?la(l,{...this.options,...r}):l)),t.forEach(l=>{if(this.isValidLookup(n))return;let c=this.extractFromKey(l,r),u=c.key;i=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));let f=r.count!==void 0&&!ft(r.count),h=f&&!r.ordinal&&r.count===0,m=r.context!==void 0&&(ft(r.context)||typeof r.context=="number")&&r.context!=="",y=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(x=>{this.isValidLookup(n)||(a=x,!this.checkedLoadedFor[`${y[0]}-${x}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(this.checkedLoadedFor[`${y[0]}-${x}`]=!0,this.logger.warn(`key "${i}" for languages "${y.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(g=>{if(this.isValidLookup(n))return;s=g;let v=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,g,x,r);else{let w;f&&(w=this.pluralResolver.getSuffix(g,r.count,r));let T=`${this.options.pluralSeparator}zero`,C=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&w.startsWith(C)&&v.push(u+w.replace(C,this.options.pluralSeparator)),v.push(u+w),h&&v.push(u+T)),m){let E=`${u}${this.options.contextSeparator||"_"}${r.context}`;v.push(E),f&&(r.ordinal&&w.startsWith(C)&&v.push(E+w.replace(C,this.options.pluralSeparator)),v.push(E+w),h&&v.push(E+T))}}let b;for(;b=v.pop();)this.isValidLookup(n)||(o=b,n=this.getResource(g,x,b,r))}))})}),{res:n,usedKey:i,exactUsedKey:o,usedLng:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,r,n,i):this.resourceStore.getResource(t,r,n,i)}getUsedParamsDetails(t={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!ft(t.replace),i=n?t.replace:t;if(n&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let o of r)delete i[o]}return i}static hasDefaultValue(t){let r="defaultValue";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.startsWith(r)&&t[n]!==void 0)return!0;return!1}},Fh=class{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ii.create("languageUtils")}getScriptPartFromCode(t){if(t=Td(t),!t||!t.includes("-"))return null;let r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=Td(t),!t||!t.includes("-"))return t;let r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(ft(t)&&t.includes("-")){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&t.forEach(n=>{if(r)return;let i=this.getScriptPartFromCode(n);if(this.isSupportedCode(i))return r=i;let o=this.getLanguagePartFromCode(n);if(this.isSupportedCode(o))return r=o;r=this.options.supportedLngs.find(s=>s===o?!0:!s.includes("-")&&!o.includes("-")?!1:!!(s.includes("-")&&!o.includes("-")&&s.slice(0,s.indexOf("-"))===o||s.startsWith(o)&&o.length>1))}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),ft(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let n=t[r];return n||(n=t[this.getScriptPartFromCode(r)]),n||(n=t[this.formatLanguageCode(r)]),n||(n=t[this.getLanguagePartFromCode(r)]),n||(n=t.default),n||[]}toResolveHierarchy(t,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],t),i=[],o=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return ft(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):ft(t)&&o(this.formatLanguageCode(t)),n.forEach(s=>{i.includes(s)||o(this.formatLanguageCode(s))}),i}},IA={zero:0,one:1,two:2,few:3,many:4,other:5},BA={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},px=class{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=Ii.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){let n=Td(t==="dev"?"en":t),i=r.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let s;try{s=new Intl.PluralRules(n,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),BA;if(!t.match(/-|_/))return BA;let l=this.languageUtils.getLanguagePartFromCode(t);s=this.getRule(l,r)}return this.pluralRulesCache[o]=s,s}needsPlural(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,r,n={}){return this.getSuffixes(t,n).map(i=>`${r}${i}`)}getSuffixes(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,o)=>IA[i]-IA[o]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(t,r,n={}){let i=this.getRule(t,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,n))}},zA=(e,t,r,n=".",i=!0)=>{let o=F3(e,t,r);return!o&&i&&ft(r)&&(o=dx(e,r,n),o===void 0&&(o=dx(t,r,n))),o},lx=e=>e.replace(/\$/g,"$$$$"),$h=class{constructor(t={}){this.logger=Ii.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});let{escape:r,escapeValue:n,useRawValueToEscape:i,prefix:o,prefixEscaped:s,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:m,nestingSuffixEscaped:y,nestingOptionsSeparator:x,maxReplaces:g,alwaysFormat:v}=t.interpolation;this.escape=r!==void 0?r:j3,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=o?fo(o):s||"{{",this.suffix=a?fo(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":d?fo(d):"-",this.unescapeSuffix=this.unescapePrefix?"":u?fo(u):"",this.nestingPrefix=f?fo(f):h||fo("$t("),this.nestingSuffix=m?fo(m):y||fo(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=g||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let t=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,r,n,i){let o,s,a,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=h=>{if(!h.includes(this.formatSeparator)){let g=zA(r,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,n,{...i,...r,interpolationkey:h}):g}let m=h.split(this.formatSeparator),y=m.shift().trim(),x=m.join(this.formatSeparator).trim();return this.format(zA(r,l,y,this.options.keySeparator,this.options.ignoreJSONStructure),x,n,{...i,...r,interpolationkey:y})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");let u=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>lx(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?lx(this.escape(h)):lx(h)}].forEach(h=>{for(a=0;o=h.regex.exec(t);){let m=o[1].trim();if(s=c(m),s===void 0)if(typeof u=="function"){let x=u(t,o,i);s=ft(x)?x:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))s="";else if(d){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),s="";else!ft(s)&&!this.useRawValueToEscape&&(s=DA(s));let y=h.safeValue(s);if(t=t.replace(o[0],y),d?(h.regex.lastIndex+=s.length,h.regex.lastIndex-=o[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,r,n={}){let i,o,s,a=(l,c)=>{let u=this.nestingOptionsSeparator;if(!l.includes(u))return l;let d=l.split(new RegExp(`${fo(u)}[ ]*{`)),f=`{${d[1]}`;l=d[0],f=this.interpolate(f,s);let h=f.match(/'/g),m=f.match(/"/g);((h?.length??0)%2===0&&!m||(m?.length??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),c&&(s={...c,...s})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,y),`${l}${u}${f}`}return s.defaultValue&&s.defaultValue.includes(this.prefix)&&delete s.defaultValue,l};for(;i=this.nestingRegexp.exec(t);){let l=[];s={...n},s=s.replace&&!ft(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let c=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(c!==-1&&(l=i[1].slice(c).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),i[1]=i[1].slice(0,c)),o=r(a.call(this,i[1].trim(),s),s),o&&i[0]===t&&!ft(o))return o;ft(o)||(o=DA(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),l.length&&(o=l.reduce((u,d)=>this.format(u,d,n.lng,{...n,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}},Y3=e=>{let t=e.toLowerCase().trim(),r={};if(e.includes("(")){let n=e.split("(");t=n[0].toLowerCase().trim();let i=n[1].slice(0,-1);t==="currency"&&!i.includes(":")?r.currency||(r.currency=i.trim()):t==="relativetime"&&!i.includes(":")?r.range||(r.range=i.trim()):i.split(";").forEach(s=>{if(s){let[a,...l]=s.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=a.trim();r[u]||(r[u]=c),c==="false"&&(r[u]=!1),c==="true"&&(r[u]=!0),isNaN(c)||(r[u]=parseInt(c,10))}})}return{formatName:t,formatOptions:r}},FA=e=>{let t={};return(r,n,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});let s=n+JSON.stringify(o),a=t[s];return a||(a=e(Td(n),i),t[s]=a),a(r)}},q3=e=>(t,r,n)=>e(Td(r),n)(t),hx=class{constructor(t={}){this.logger=Ii.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?FA:q3;this.formats={number:n((i,o)=>{let s=new Intl.NumberFormat(i,{...o});return a=>s.format(a)}),currency:n((i,o)=>{let s=new Intl.NumberFormat(i,{...o,style:"currency"});return a=>s.format(a)}),datetime:n((i,o)=>{let s=new Intl.DateTimeFormat(i,{...o});return a=>s.format(a)}),relativetime:n((i,o)=>{let s=new Intl.RelativeTimeFormat(i,{...o});return a=>s.format(a,o.range||"day")}),list:n((i,o)=>{let s=new Intl.ListFormat(i,{...o});return a=>s.format(a)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=FA(r)}format(t,r,n,i={}){if(!r||t==null)return t;let o=r.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&!o[0].includes(")")&&o.find(a=>a.includes(")"))){let a=o.findIndex(l=>l.includes(")"));o[0]=[o[0],...o.splice(1,a)].join(this.formatSeparator)}return o.reduce((a,l)=>{let{formatName:c,formatOptions:u}=Y3(l);if(this.formats[c]){let d=a;try{let f=i?.formatParams?.[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||n;d=this.formats[c](a,h,{...u,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${c}`);return a},t)}},X3=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},mx=class extends Ul{constructor(t,r,n,i={}){super(),this.backend=t,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=Ii.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,i.backend,i)}queueLoad(t,r,n,i){let o={},s={},a={},l={};return t.forEach(c=>{let u=!0;r.forEach(d=>{let f=`${c}|${d}`;!n.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,u=!1,s[f]===void 0&&(s[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(a[c]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,r,n){let i=t.split("|"),o=i[0],s=i[1];r&&this.emit("failedLoading",o,s,r),!r&&n&&this.store.addResourceBundle(o,s,n,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&n&&(this.state[t]=0);let a={};this.queue.forEach(l=>{z3(l.loaded,[o],s),X3(l,t),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});let u=l.loaded[c];u.length&&u.forEach(d=>{a[c][d]===void 0&&(a[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,r,n,i=0,o=this.retryTimeout,s){if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:n,tried:i,wait:o,callback:s});return}this.readingCalls++;let a=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){let d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&i<this.maxRetries){setTimeout(()=>{this.read(t,r,n,i+1,o*2,s)},o);return}s(c,u)},l=this.backend[n].bind(this.backend);if(l.length===2){try{let c=l(t,r);c&&typeof c.then=="function"?c.then(u=>a(null,u)).catch(a):a(null,c)}catch(c){a(c)}return}return l(t,r,a)}prepareLoading(t,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();ft(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ft(r)&&(r=[r]);let o=this.queueLoad(t,r,n,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,r,n){this.prepareLoading(t,r,{},n)}reload(t,r,n){this.prepareLoading(t,r,{reload:!0},n)}loadOne(t,r=""){let n=t.split("|"),i=n[0],o=n[1];this.read(i,o,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${r}loading namespace ${o} for language ${i} failed`,s),!s&&a&&this.logger.log(`${r}loaded namespace ${o} for language ${i}`,a),this.loaded(t,s,a)})}saveMissing(t,r,n,i,o,s={},a=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){let l={...s,isUpdate:o},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(t,r,n,i,l):u=c(t,r,n,i),u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}else c(t,r,n,i,a,l)}!t||!t[0]||this.store.addResource(t[0],r,n,i)}}},cx=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ft(e[1])&&(t.defaultValue=e[1]),ft(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){let r=e[3]||e[2];Object.keys(r).forEach(n=>{t[n]=r[n]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),$A=e=>(ft(e.ns)&&(e.ns=[e.ns]),ft(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ft(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Nh=()=>{},K3=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})},gx=class e extends Ul{constructor(t={},r){if(super(),this.options=$A(t),this.services={},this.logger=Ii,this.modules={external:[]},K3(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=t,t={}),t.defaultNS==null&&t.ns&&(ft(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));let n=cx();this.options={...n,...this.options,...$A(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Ii.init(i(this.modules.logger),this.options):Ii.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=hx;let u=new Fh(this.options);this.store=new Bh(this.options.resources,this.options);let d=this.services;d.logger=Ii,d.resourceStore=this.store,d.languageUtils=u,d.pluralResolver=new px(u,{prepend:this.options.pluralSeparator}),c&&(d.formatter=i(c),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new $h(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new mx(i(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.languageDetector&&(d.languageDetector=i(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=i(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new zh(this.services,this.options),this.translator.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Nh),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...u)=>this.store[c](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...u)=>(this.store[c](...u),this)});let a=xd(),l=()=>{let c=(u,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(d),r(u,d)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),a}loadResources(t,r=Nh){let n=r,i=ft(t)?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let o=[],s=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&(o.includes(c)||o.push(c))})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload?.forEach?.(a=>s(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(a)})}else n(null)}reloadResources(t,r,n){let i=xd();return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),n||(n=Nh),this.services.backendConnector.reload(t,r,o=>{i.resolve(),n(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&HA.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!["cimode","dev"].includes(n)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,r){this.isLanguageChangingTo=t;let n=xd();this.emit("languageChanging",t);let i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},o=(a,l)=>{l?this.isLanguageChangingTo===t&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(a,(...c)=>this.t(...c))},s=a=>{!t&&!a&&this.services.languageDetector&&(a=[]);let l=ft(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(ft(a)?[a]:a);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,u=>{o(u,c)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),n}getFixedT(t,r,n,i){let o=i?.scopeNs,s=(a,l,...c)=>{let u;typeof l!="object"?u=this.options.overloadTranslationOptionHandler([a,l].concat(c)):u={...l},u.lng=u.lng||s.lng,u.lngs=u.lngs||s.lngs;let d=u.ns!==void 0&&u.ns!==null;u.ns=u.ns||s.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||n||s.keyPrefix);let f={...this.options,...u};Array.isArray(o)&&!d&&(f.ns=o),typeof u.keyPrefix=="function"&&(u.keyPrefix=la(u.keyPrefix,f));let h=this.options.keySeparator||".",m;return u.keyPrefix&&Array.isArray(a)?m=a.map(y=>(typeof y=="function"&&(y=la(y,f)),`${u.keyPrefix}${h}${y}`)):(typeof a=="function"&&(a=la(a,f)),m=u.keyPrefix?`${u.keyPrefix}${h}${a}`:a),this.t(m,u)};return ft(t)?s.lng=t:s.lngs=t,s.ns=r,s.keyPrefix=n,s}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let s=(a,l)=>{let c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(r.precheck){let a=r.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(n,t)&&(!i||s(o,t)))}loadNamespaces(t,r){let n=xd();return this.options.ns?(ft(t)&&(t=[t]),t.forEach(i=>{this.options.ns.includes(i)||this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(t,r){let n=xd();ft(t)&&(t=[t]);let i=this.options.preload||[],o=t.filter(s=>!i.includes(s)&&this.services.languageUtils.isSupportedCode(s));return o.length?(this.options.preload=i.concat(o),this.loadResources(s=>{n.resolve(),r&&r(s)}),n):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{let i=new Intl.Locale(t);if(i&&i.getTextInfo){let o=i.getTextInfo();if(o&&o.direction)return o.direction}}catch{}let r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new Fh(cx());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.includes(n.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){let n=new e(t,r);return n.createInstance=e.createInstance,n}cloneInstance(t={},r=Nh){let n=t.forkResourceStore;n&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},o=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n){let a=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((u,d)=>(u[d]={...l[c][d]},u),l[c]),l),{});o.store=new Bh(a,i),o.services.resourceStore=o.store}if(t.interpolation){let l={...cx().interpolation,...this.options.interpolation,...t.interpolation},c={...i,interpolation:l};o.services.interpolator=new $h(c)}return o.translator=new zh(o.services,i),o.translator.on("*",(a,...l)=>{o.emit(a,...l)}),o.init(i,r),o.translator.options=i,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},nr=gx.createInstance(),VA=nr.createInstance,fq=nr.dir,pq=nr.init,hq=nr.loadResources,mq=nr.reloadResources,gq=nr.use,yq=nr.changeLanguage,vq=nr.getFixedT,bq=nr.t,xq=nr.exists,Sq=nr.setDefaultNamespace,Tq=nr.hasLoadedNamespace,wq=nr.loadNamespaces,Cq=nr.loadLanguages;p();var Z3=D(WA());p();var jh=(e,t,r,n)=>{let i=[r,{code:t,...n||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,"warn","react-i18next::",!0);pi(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},YA={},ts=(e,t,r,n)=>{pi(r)&&YA[r]||(pi(r)&&(YA[r]=new Date),jh(e,t,r,n))},qA=(e,t)=>()=>{if(e.isInitialized)t();else{let r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},Hh=(e,t,r)=>{e.loadNamespaces(t,qA(e,r))},yx=(e,t,r,n)=>{if(pi(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Hh(e,r,n);r.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,qA(e,n))},XA=(e,t,r={})=>!t.languages||!t.languages.length?(ts(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:r.lng,precheck:(n,i)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!i(n.isLanguageChangingTo,e))return!1}});var pi=e=>typeof e=="string",vx=e=>typeof e=="object"&&e!==null;p();p();var Q3=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,J3={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},tF=e=>J3[e],bx=e=>e.replace(Q3,tF);var xx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:bx,transDefaultProps:void 0},Uh=(e={})=>{xx={...xx,...e}},wd=()=>xx;p();var KA,Vh=e=>{KA=e},hi=()=>KA;p();var ZA=D(F(),1);p();var Gh={type:"3rdParty",init(e){Uh(e.options.react),Vh(e)}};var po=(0,ZA.createContext)(),Wh=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}};p();var r_=D(F(),1);p();var ca=D(F(),1);p();p();var Vl=class e extends Error{constructor(t,r,n){super(t),this.name="TranslationParserError",this.position=r,this.translationString=n,Error.captureStackTrace&&Error.captureStackTrace(this,e)}};p();var QA={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'","©":"©","®":"®","™":"™","…":"…","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","•":"•","′":"′","″":"″","‹":"‹","›":"›","§":"§","¶":"¶","·":"·"," ":" "," ":" "," ":" ","€":"€","£":"£","¥":"¥","¢":"¢","¤":"¤","×":"×","÷":"÷","−":"−","±":"±","≠":"≠","≤":"≤","≥":"≥","≈":"≈","≡":"≡","∞":"∞","∫":"∫","∑":"∑","∏":"∏","√":"√","∂":"∂","‰":"‰","°":"°","µ":"µ","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"⇐","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","À":"À","Á":"Á","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Å","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"Ì","Í":"Í","Î":"Î","Ï":"Ï","Ð":"Ð","Ñ":"Ñ","Ò":"Ò","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ý","Þ":"Þ","ß":"ß","à":"à","á":"á","â":"â","ã":"ã","ä":"ä","å":"å","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"í","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ","¡":"¡","¿":"¿","ƒ":"ƒ","ˆ":"ˆ","˜":"˜","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ª":"ª","º":"º","¯":"¯","´":"´","¸":"¸","¹":"¹","²":"²","³":"³","¼":"¼","½":"½","¾":"¾","♠":"♠","♣":"♣","♥":"♥","♦":"♦","◊":"◊","‾":"‾","⁄":"⁄","℘":"℘","ℑ":"ℑ","ℜ":"ℜ","ℵ":"ℵ"},iF=new RegExp(Object.keys(QA).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"g"),JA=e=>e.replace(iF,t=>QA[t]).replace(/&#(\d+);/g,(t,r)=>String.fromCharCode(parseInt(r,10))).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>String.fromCharCode(parseInt(r,16)));p();var t_=e=>{let t=[],r=0,n="",i=()=>{n&&(t.push({type:"Text",value:n,position:r-n.length}),n="")};for(;r<e.length;){let o=e[r];if(o==="<"){let s=e.slice(r).match(/^<(\d+)>/);if(s)i(),t.push({type:"TagOpen",value:s[0],position:r,tagNumber:parseInt(s[1],10)}),r+=s[0].length;else{let a=e.slice(r).match(/^<\/(\d+)>/);a?(i(),t.push({type:"TagClose",value:a[0],position:r,tagNumber:parseInt(a[1],10)}),r+=a[0].length):(n+=o,r+=1)}}else n+=o,r+=1}return i(),t};p();var Ed=D(F(),1);var oF=(e,t,r)=>{let{type:n,props:i={}}=e;if(i.children&&Array.isArray(i.children)&&r){let{children:o,...s}=i;return Ed.default.createElement(n,s,...t)}return t.length===0?Ed.default.createElement(n,i):t.length===1?Ed.default.createElement(n,i,t[0]):Ed.default.createElement(n,i,...t)},e_=(e,t=[])=>{if(!e)return[];let r=t_(e),n=[],i=[],o=new Set,s=()=>{if(i.length===0)return t;let a=i[i.length-1];return a.declaration.props?.children&&Array.isArray(a.declaration.props.children)?a.declaration.props.children:a.declarations};if(r.forEach(a=>{switch(a.type){case"Text":{let l=JA(a.value);(i.length>0?i[i.length-1].children:n).push(l)}break;case"TagOpen":{let{tagNumber:l}=a,c=s(),u=c[l];if(!u){o.add(l);let d=`<${l}>`;(i.length>0?i[i.length-1].children:n).push(d);break}i.push({tagNumber:l,children:[],position:a.position,declaration:u,declarations:c})}break;case"TagClose":{let{tagNumber:l}=a;if(o.has(l)){let f=`</${l}>`;(i.length>0?i[i.length-1].children:n).push(f),o.delete(l);break}if(i.length===0)throw new Vl(`Unexpected closing tag </${l}> at position ${a.position}`,a.position,e);let c=i.pop();if(c.tagNumber!==l)throw new Vl(`Mismatched tags: expected </${c.tagNumber}> but got </${l}> at position ${a.position}`,a.position,e);let u=oF(c.declaration,c.children,c.declarations);(i.length>0?i[i.length-1].children:n).push(u)}break}}),i.length>0){let a=i[i.length-1];throw new Vl(`Unclosed tag <${a.tagNumber}> at position ${a.position}`,a.position,e)}return n};function Yh({i18nKey:e,defaultTranslation:t,content:r,ns:n,values:i={},i18n:o,t:s}){let a=o||hi();if(!a)return ts(a,"NO_I18NEXT_INSTANCE","IcuTrans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:e}),ca.default.createElement(ca.default.Fragment,{},t);let l=s||a.t?.bind(a)||(f=>f),c=n||l.ns||a.options?.defaultNS;c=pi(c)?[c]:c||["translation"];let u=i;a.options?.interpolation?.defaultVariables&&(u=i&&Object.keys(i).length>0?{...i,...a.options.interpolation.defaultVariables}:{...a.options.interpolation.defaultVariables});let d=l(e,{defaultValue:t,...u,ns:c});try{let f=e_(d,r);return ca.default.createElement(ca.default.Fragment,{},...f)}catch(f){return jh(a,"ICU_TRANS_RENDER_ERROR",`IcuTrans component error for key "${e}": ${f.message}`,{i18nKey:e,error:f}),ca.default.createElement(ca.default.Fragment,{},d)}}Yh.displayName="IcuTransWithoutContext";function n_({i18nKey:e,defaultTranslation:t,content:r,ns:n,values:i={},i18n:o,t:s}){let{i18n:a,defaultNS:l}=(0,r_.useContext)(po)||{},c=o||a||hi(),u=s||c?.t.bind(c);return Yh({i18nKey:e,defaultTranslation:t,content:r,ns:n||u?.ns||l||c?.options?.defaultNS,values:i,i18n:c,t:s})}n_.displayName="IcuTrans";p();var ir=D(F(),1),l_=D(a_(),1);var mF=(e,t)=>{if(pi(t))return t;if(vx(t)&&pi(t.defaultValue))return t.defaultValue;if(typeof e=="function")return"";if(Array.isArray(e)){let r=e[e.length-1];return typeof r=="function"?"":r}return e},gF={t:mF,ready:!1},yF=()=>()=>{},Wl=(e,t={})=>{let{i18n:r}=t,{i18n:n,defaultNS:i}=(0,ir.useContext)(po)||{},o=r||n||hi();o&&!o.reportNamespaces&&(o.reportNamespaces=new Wh),o||ts(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");let s=(0,ir.useMemo)(()=>({...wd(),...o?.options?.react,...t}),[o,t]),{useSuspense:a,keyPrefix:l}=s,c=e||i||o?.options?.defaultNS,u=pi(c)?[c]:c||["translation"],d=(0,ir.useMemo)(()=>u,u);o?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,ir.useRef)(0),h=(0,ir.useCallback)(_=>{if(!o)return yF;let{bindI18n:P,bindI18nStore:k}=s,I=()=>{f.current+=1,_()};return P&&o.on(P,I),k&&o.store.on(k,I),()=>{P&&P.split(" ").forEach(M=>o.off(M,I)),k&&k.split(" ").forEach(M=>o.store.off(M,I))}},[o,s]),m=(0,ir.useRef)(),y=(0,ir.useCallback)(()=>{if(!o)return gF;let _=!!(o.isInitialized||o.initializedStoreOnce)&&d.every(B=>XA(B,o,s)),P=t.lng||o.language,k=f.current,I=m.current;if(I&&I.ready===_&&I.lng===P&&I.keyPrefix===l&&I.revision===k)return I;let z={t:o.getFixedT(P,s.nsMode==="fallback"?d:d[0],l,{scopeNs:d}),ready:_,lng:P,keyPrefix:l,revision:k};return m.current=z,z},[o,d,l,s,t.lng]),[x,g]=(0,ir.useState)(0),{t:v,ready:b}=(0,l_.useSyncExternalStore)(h,y,y);(0,ir.useEffect)(()=>{if(o&&!b&&!a){let _=()=>g(P=>P+1);t.lng?yx(o,t.lng,d,_):Hh(o,d,_)}},[o,t.lng,d,b,a,x]);let w=o||{},T=(0,ir.useRef)(null),C=(0,ir.useRef)(),E=_=>{let P=Object.getOwnPropertyDescriptors(_);P.__original&&delete P.__original;let k=Object.create(Object.getPrototypeOf(_),P);if(!Object.prototype.hasOwnProperty.call(k,"__original"))try{Object.defineProperty(k,"__original",{value:_,writable:!1,enumerable:!1,configurable:!1})}catch{}return k},A=(0,ir.useMemo)(()=>{let _=w,P=_?.language,k=_;_&&(T.current&&T.current.__original===_?C.current!==P?(k=E(_),T.current=k,C.current=P):k=T.current:(k=E(_),T.current=k,C.current=P));let I=!b&&!a?(...z)=>(ts(o,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),v(...z)):v,M=[I,k,b];return M.t=I,M.i18n=k,M.ready=b,M},[v,w,b,w.resolvedLanguage,w.language,w.languages]);if(o&&a&&!b)throw new Promise(_=>{let P=()=>_();t.lng?yx(o,t.lng,d,P):Hh(o,d,P)});return A};p();var c_=D(F(),1);p();p();var qh=D(F(),1);function Tx({i18n:e,defaultNS:t,children:r}){let n=(0,qh.useMemo)(()=>({i18n:e,defaultNS:t}),[e,t]);return(0,qh.createElement)(po.Provider,{value:n},r)}p();var TF=D(F(),1);p();var bF=D(F(),1);fa();var WM=D(Mk()),YM=D(Lk()),qM=D(Nk()),XM=D(Ik()),KM=D(Bk()),ZM=D(zk()),lT=D(Fk()),QM=D(jk()),JM=D(Hk()),tL=D(Uk()),eL=D(Vk());p();p();p();var gj={grey:{50:"#FBFCFE",100:"#F0F4F8",200:"#DDE7EE",300:"#CDD7E1",400:"#9FA6AD",500:"#636B74",600:"#555E68",700:"#32383E",800:"#171A1C",900:"#0B0D0E"},blue:{50:"#EDF5FD",100:"#E3EFFB",200:"#C7DFF7",300:"#97C3F0",400:"#4393E4",500:"#0B6BCB",600:"#185EA5",700:"#12467B",800:"#0A2744",900:"#051423"},yellow:{50:"#FEFAF6",100:"#FDF0E1",200:"#FCE1C2",300:"#F3C896",400:"#EA9A3E",500:"#9A5B13",600:"#72430D",700:"#492B08",800:"#2E1B05",900:"#1D1002"},red:{50:"#FEF6F6",100:"#FCE4E4",200:"#F7C5C5",300:"#F09898",400:"#E47474",500:"#C41C1C",600:"#A51818",700:"#7D1212",800:"#430A0A",900:"#240505"},green:{50:"#F6FEF6",100:"#E3FBE3",200:"#C7F7C7",300:"#A1E8A1",400:"#51BC51",500:"#1F7A1F",600:"#136C13",700:"#0A470A",800:"#042F04",900:"#021D02"}},Na=gj;p();p();var ps="$$joy";p();p();xo();p();p();var kct=D(F());xo();p();Pa();p();var Gk=D(F());xo();function yj(e){return Object.keys(e).length===0}function vj(e=null){let t=Gk.useContext(Nn);return!t||yj(t)?e:t}var Sc=vj;var bj=Ui();function xj(e=bj){return Sc(e)}var Tc=xj;var Wk=D(Z());function H1(e){let t=fc(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function Sj({styles:e,themeId:t,defaultTheme:r={}}){let n=Tc(r),i=t&&n[t]||n,o=typeof e=="function"?e(i):e;return i.modularCssLayers&&(Array.isArray(o)?o=o.map(s=>H1(typeof s=="function"?s(i):s)):o=H1(o)),(0,Wk.jsx)($i,{styles:o})}var U1=Sj;E1();A1();_1();P1();Ea();ds();Ra();p();Gt();vi();var Yk=D(F());rr();xo();Ra();var qk=D(Z()),Tj=["className","component"];function Sg(e={}){let{themeId:t,defaultTheme:r,defaultClassName:n="MuiBox-root",generateClassName:i}=e,o=dc("div",{shouldForwardProp:a=>a!=="theme"&&a!=="sx"&&a!=="as"})(hn);return Yk.forwardRef(function(l,c){let u=Tc(r),d=Vi(l),{className:f,component:h="div"}=d,m=be(d,Tj);return(0,qk.jsx)(o,V({as:h,ref:c,className:Lt(f,i?i(n):n),theme:t&&u[t]||u},m))})}p();Gt();vi();xo();Wr();Pa();Ra();var wj=["ownerState"],Cj=["variants"],Ej=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Aj(e){return Object.keys(e).length===0}function _j(e){return typeof e=="string"&&e.charCodeAt(0)>96}function V1(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Xk(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}var Pj=Ui(),Rj=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function Tg({defaultTheme:e,theme:t,themeId:r}){return Aj(t)?e:t[r]||t}function kj(e){return e?(t,r)=>r[e]:null}function wg(e,t,r){let{ownerState:n}=t,i=be(t,wj),o=typeof e=="function"?e(V({ownerState:n},i)):e;if(Array.isArray(o))return o.flatMap(s=>wg(s,V({ownerState:n},i),r));if(o&&typeof o=="object"&&Array.isArray(o.variants)){let{variants:s=[]}=o,l=be(o,Cj);return s.forEach(c=>{let u=!0;if(typeof c.props=="function"?u=c.props(V({ownerState:n},i,n)):Object.keys(c.props).forEach(d=>{n?.[d]!==c.props[d]&&i[d]!==c.props[d]&&(u=!1)}),u){Array.isArray(l)||(l=[l]);let d=typeof c.style=="function"?c.style(V({ownerState:n},i,n)):c.style;l.push(r?Xk(fc(d),r):d)}}),l}return r?Xk(fc(o),r):o}function wc(e={}){let{themeId:t,defaultTheme:r=Pj,rootShouldForwardProp:n=V1,slotShouldForwardProp:i=V1}=e,o=s=>hn(V({},s,{theme:Tg(V({},s,{defaultTheme:r,themeId:t}))}));return o.__mui_systemSx=!0,(s,a={})=>{v1(s,C=>C.filter(E=>!(E!=null&&E.__mui_systemSx)));let{name:l,slot:c,skipVariantsResolver:u,skipSx:d,overridesResolver:f=kj(Rj(c))}=a,h=be(a,Ej),m=l&&l.startsWith("Mui")||c?"components":"custom",y=u!==void 0?u:c&&c!=="Root"&&c!=="root"||!1,x=d||!1,g,v=V1;c==="Root"||c==="root"?v=n:c?v=i:_j(s)&&(v=void 0);let b=dc(s,V({shouldForwardProp:v,label:g},h)),w=C=>typeof C=="function"&&C.__emotion_real!==C||gi(C)?E=>{let A=Tg({theme:E.theme,defaultTheme:r,themeId:t});return wg(C,V({},E,{theme:A}),A.modularCssLayers?m:void 0)}:C,T=(C,...E)=>{let A=w(C),_=E?E.map(w):[];l&&f&&_.push(I=>{let M=Tg(V({},I,{defaultTheme:r,themeId:t}));if(!M.components||!M.components[l]||!M.components[l].styleOverrides)return null;let z=M.components[l].styleOverrides,B={};return Object.entries(z).forEach(([R,L])=>{B[R]=wg(L,V({},I,{theme:M}),M.modularCssLayers?"theme":void 0)}),f(I,B)}),l&&!y&&_.push(I=>{var M;let z=Tg(V({},I,{defaultTheme:r,themeId:t})),B=z==null||(M=z.components)==null||(M=M[l])==null?void 0:M.variants;return wg({variants:B},V({},I,{theme:z}),z.modularCssLayers?"theme":void 0)}),x||_.push(o);let P=_.length-E.length;if(Array.isArray(C)&&P>0){let I=new Array(P).fill("");A=[...C,...I],A.raw=[...C.raw,...I]}let k=b(A,..._);return s.muiName&&(k.muiName=s.muiName),k};return b.withConfig&&(T.withConfig=b.withConfig),T}}p();var Oj=wc(),Kk=Oj;qm();C1();p();p();p();Jx();function Cg(e){let{theme:t,name:r,props:n}=e;return!t||!t.components||!t.components[r]||!t.components[r].defaultProps?n:ss(t.components[r].defaultProps,n)}function Ia({props:e,name:t,defaultTheme:r,themeId:n}){let i=Tc(r);return n&&(i=i[n]||i),Cg({theme:i,name:t,props:e})}p();is();function Dj(e){e=e.slice(1);let t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g"),r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),r?`rgb${r.length===4?"a":""}(${r.map((n,i)=>i<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function Zk(e){if(e.type)return e;if(e.charAt(0)==="#")return Zk(Dj(e));let t=e.indexOf("("),r=e.substring(0,t);if(["rgb","rgba","hsl","hsla","color"].indexOf(r)===-1)throw new Error(yr(9,e));let n=e.substring(t+1,e.length-1),i;if(r==="color"){if(n=n.split(" "),i=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i)===-1)throw new Error(yr(10,i))}else n=n.split(",");return n=n.map(o=>parseFloat(o)),{type:r,values:n,colorSpace:i}}var hs=e=>{let t=Zk(e);return t.values.slice(0,3).map((r,n)=>t.type.indexOf("hsl")!==-1&&n!==0?`${r}%`:r).join(" ")};p();p();Gt();var aO=D(F());p();p();p();Gt();var tO=D(F());p();var Qk=D(F()),Mj=Qk.createContext(null),Eg=Mj;p();p();var G1=D(F());function So(){return G1.useContext(Eg)}p();var Lj=typeof Symbol=="function"&&Symbol.for,Jk=Lj?Symbol.for("mui.nested"):"__THEME_NESTED__";var eO=D(Z());function Nj(e,t){return typeof t=="function"?t(e):V({},e,t)}function Ij(e){let{children:t,theme:r}=e,n=So(),i=tO.useMemo(()=>{let o=n===null?r:Nj(n,r);return o!=null&&(o[Jk]=n!==null),o},[r,n]);return(0,eO.jsx)(Eg.Provider,{value:i,children:t})}var Ag=Ij;xo();p();Gt();vi();var W1=D(F());var rO=D(Z()),Bj=["value"],zj=W1.createContext();function Fj(e){let{value:t}=e,r=be(e,Bj);return(0,rO.jsx)(zj.Provider,V({value:t??!0},r))}var nO=Fj;f1();p();var Gut=D(F());Fd();Bm();var iO=D(Z());function Y1(e){let t=Sc(),r=zr()||"",{modularCssLayers:n}=e,i="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!n||t!==null?i="":typeof n=="string"?i=n.replace(/mui(?!\.)/g,i):i=`@layer ${i};`,Xe(()=>{let o=document.querySelector("head");if(!o)return;let s=o.firstChild;if(i){var a;if(s&&(a=s.hasAttribute)!=null&&a.call(s,"data-mui-layer-order")&&s.getAttribute("data-mui-layer-order")===r)return;let c=document.createElement("style");c.setAttribute("data-mui-layer-order",r),c.textContent=i,o.prepend(c)}else{var l;(l=o.querySelector(`style[data-mui-layer-order="${r}"]`))==null||l.remove()}},[i,r]),i?(0,iO.jsx)(U1,{styles:i}):null}var lO=D(Z()),_g=D(Z()),oO={};function sO(e,t,r,n=!1){return aO.useMemo(()=>{let i=e&&t[e]||t;if(typeof r=="function"){let o=r(i),s=e?V({},t,{[e]:o}):o;return n?()=>s:s}return e?V({},t,{[e]:r}):V({},t,r)},[e,t,r,n])}function $j(e){let{children:t,theme:r,themeId:n}=e,i=Sc(oO),o=So()||oO,s=sO(n,i,r),a=sO(n,o,r,!0),l=s.direction==="rtl",c=Y1(s);return(0,_g.jsx)(Ag,{theme:a,children:(0,_g.jsx)(Nn.Provider,{value:s,children:(0,_g.jsx)(nO,{value:l,children:(0,lO.jsxs)(Wm,{value:s?.components,children:[c,t]})})})})}var q1=$j;p();Gt();vi();is();var Pr=D(F());Wr();xo();p();var udt=D(F()),cO=D(Z()),Kd="mode",Zd="color-scheme",X1="data-color-scheme";function K1(e){let{defaultMode:t="light",defaultLightColorScheme:r="light",defaultDarkColorScheme:n="dark",modeStorageKey:i=Kd,colorSchemeStorageKey:o=Zd,attribute:s=X1,colorSchemeNode:a="document.documentElement",nonce:l}=e||{};return(0,cO.jsx)("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?l:"",dangerouslySetInnerHTML:{__html:`(function() {
|
|
67
|
+
`)){let o=document.createElement("div");o.append(i?document.createTextNode(i):document.createElement("br")),r.append(o)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#t}}),r}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}},tt=class{static PRECISION=1e-4;toSVGPath(){$t("Abstract method `toSVGPath` must be implemented.")}get box(){$t("Abstract getter `box` must be implemented.")}serialize(t,r){$t("Abstract method `serialize` must be implemented.")}static _rescale(t,r,n,i,o,s){s||=new Float32Array(t.length);for(let a=0,l=t.length;a<l;a+=2)s[a]=r+t[a]*i,s[a+1]=n+t[a+1]*o;return s}static _rescaleAndSwap(t,r,n,i,o,s){s||=new Float32Array(t.length);for(let a=0,l=t.length;a<l;a+=2)s[a]=r+t[a+1]*i,s[a+1]=n+t[a]*o;return s}static _translate(t,r,n,i){i||=new Float32Array(t.length);for(let o=0,s=t.length;o<s;o+=2)i[o]=r+t[o],i[o+1]=n+t[o+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,r,n,i,o){switch(o){case 90:return[1-r/n,t/i];case 180:return[1-t/n,1-r/i];case 270:return[r/n,1-t/i];default:return[t/n,r/i]}}static createBezierPoints(t,r,n,i,o,s){return[(t+5*n)/6,(r+5*i)/6,(5*n+o)/6,(5*i+s)/6,(n+o)/2,(i+s)/2]}},rh=class e{#t;#e=[];#r;#n;#i=[];#s=new Float32Array(18);#o;#a;#c;#l;#f;#d;#h=[];static#g=8;static#m=2;static#u=e.#g+e.#m;constructor({x:t,y:r},n,i,o,s,a=0){this.#t=n,this.#d=o*i,this.#n=s,this.#s.set([NaN,NaN,NaN,NaN,t,r],6),this.#r=a,this.#l=e.#g*i,this.#c=e.#u*i,this.#f=i,this.#h.push(t,r)}isEmpty(){return isNaN(this.#s[8])}#p(){let t=this.#s.subarray(4,6),r=this.#s.subarray(16,18),[n,i,o,s]=this.#t;return[(this.#o+(t[0]-r[0])/2-n)/o,(this.#a+(t[1]-r[1])/2-i)/s,(this.#o+(r[0]-t[0])/2-n)/o,(this.#a+(r[1]-t[1])/2-i)/s]}add({x:t,y:r}){this.#o=t,this.#a=r;let[n,i,o,s]=this.#t,[a,l,c,u]=this.#s.subarray(8,12),d=t-c,f=r-u,h=Math.hypot(d,f);if(h<this.#c)return!1;let m=h-this.#l,y=m/h,x=y*d,g=y*f,v=a,b=l;a=c,l=u,c+=x,u+=g,this.#h?.push(t,r);let w=-g/m,T=x/m,C=w*this.#d,E=T*this.#d;return this.#s.set(this.#s.subarray(2,8),0),this.#s.set([c+C,u+E],4),this.#s.set(this.#s.subarray(14,18),12),this.#s.set([c-C,u-E],16),isNaN(this.#s[6])?(this.#i.length===0&&(this.#s.set([a+C,l+E],2),this.#i.push(NaN,NaN,NaN,NaN,(a+C-n)/o,(l+E-i)/s),this.#s.set([a-C,l-E],14),this.#e.push(NaN,NaN,NaN,NaN,(a-C-n)/o,(l-E-i)/s)),this.#s.set([v,b,a,l,c,u],6),!this.isEmpty()):(this.#s.set([v,b,a,l,c,u],6),Math.abs(Math.atan2(b-l,v-a)-Math.atan2(g,x))<Math.PI/2?([a,l,c,u]=this.#s.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((a+c)/2-n)/o,((l+u)/2-i)/s),[a,l,v,b]=this.#s.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((v+a)/2-n)/o,((b+l)/2-i)/s),!0):([v,b,a,l,c,u]=this.#s.subarray(0,6),this.#i.push(((v+5*a)/6-n)/o,((b+5*l)/6-i)/s,((5*a+c)/6-n)/o,((5*l+u)/6-i)/s,((a+c)/2-n)/o,((l+u)/2-i)/s),[c,u,a,l,v,b]=this.#s.subarray(12,18),this.#e.push(((v+5*a)/6-n)/o,((b+5*l)/6-i)/s,((5*a+c)/6-n)/o,((5*l+u)/6-i)/s,((a+c)/2-n)/o,((l+u)/2-i)/s),!0))}toSVGPath(){if(this.isEmpty())return"";let t=this.#i,r=this.#e;if(isNaN(this.#s[6])&&!this.isEmpty())return this.#y();let n=[];n.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?n.push(`L${t[i+4]} ${t[i+5]}`):n.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);this.#b(n);for(let i=r.length-6;i>=6;i-=6)isNaN(r[i])?n.push(`L${r[i+4]} ${r[i+5]}`):n.push(`C${r[i]} ${r[i+1]} ${r[i+2]} ${r[i+3]} ${r[i+4]} ${r[i+5]}`);return this.#v(n),n.join(" ")}#y(){let[t,r,n,i]=this.#t,[o,s,a,l]=this.#p();return`M${(this.#s[2]-t)/n} ${(this.#s[3]-r)/i} L${(this.#s[4]-t)/n} ${(this.#s[5]-r)/i} L${o} ${s} L${a} ${l} L${(this.#s[16]-t)/n} ${(this.#s[17]-r)/i} L${(this.#s[14]-t)/n} ${(this.#s[15]-r)/i} Z`}#v(t){let r=this.#e;t.push(`L${r[4]} ${r[5]} Z`)}#b(t){let[r,n,i,o]=this.#t,s=this.#s.subarray(4,6),a=this.#s.subarray(16,18),[l,c,u,d]=this.#p();t.push(`L${(s[0]-r)/i} ${(s[1]-n)/o} L${l} ${c} L${u} ${d} L${(a[0]-r)/i} ${(a[1]-n)/o}`)}newFreeDrawOutline(t,r,n,i,o,s){return new nh(t,r,n,i,o,s)}getOutlines(){let t=this.#i,r=this.#e,n=this.#s,[i,o,s,a]=this.#t,l=new Float32Array((this.#h?.length??0)+2);for(let d=0,f=l.length-2;d<f;d+=2)l[d]=(this.#h[d]-i)/s,l[d+1]=(this.#h[d+1]-o)/a;if(l[l.length-2]=(this.#o-i)/s,l[l.length-1]=(this.#a-o)/a,isNaN(n[6])&&!this.isEmpty())return this.#w(l);let c=new Float32Array(this.#i.length+24+this.#e.length),u=t.length;for(let d=0;d<u;d+=2){if(isNaN(t[d])){c[d]=c[d+1]=NaN;continue}c[d]=t[d],c[d+1]=t[d+1]}u=this.#x(c,u);for(let d=r.length-6;d>=6;d-=6)for(let f=0;f<6;f+=2){if(isNaN(r[d+f])){c[u]=c[u+1]=NaN,u+=2;continue}c[u]=r[d+f],c[u+1]=r[d+f+1],u+=2}return this.#C(c,u),this.newFreeDrawOutline(c,l,this.#t,this.#f,this.#r,this.#n)}#w(t){let r=this.#s,[n,i,o,s]=this.#t,[a,l,c,u]=this.#p(),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(r[2]-n)/o,(r[3]-i)/s,NaN,NaN,NaN,NaN,(r[4]-n)/o,(r[5]-i)/s,NaN,NaN,NaN,NaN,a,l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,(r[16]-n)/o,(r[17]-i)/s,NaN,NaN,NaN,NaN,(r[14]-n)/o,(r[15]-i)/s],0),this.newFreeDrawOutline(d,t,this.#t,this.#f,this.#r,this.#n)}#C(t,r){let n=this.#e;return t.set([NaN,NaN,NaN,NaN,n[4],n[5]],r),r+=6}#x(t,r){let n=this.#s.subarray(4,6),i=this.#s.subarray(16,18),[o,s,a,l]=this.#t,[c,u,d,f]=this.#p();return t.set([NaN,NaN,NaN,NaN,(n[0]-o)/a,(n[1]-s)/l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,(i[0]-o)/a,(i[1]-s)/l],r),r+=24}},nh=class extends tt{#t;#e=new Float32Array(4);#r;#n;#i;#s;#o;constructor(t,r,n,i,o,s){super(),this.#o=t,this.#i=r,this.#t=n,this.#s=i,this.#r=o,this.#n=s,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#a(s);let[a,l,c,u]=this.#e;for(let d=0,f=t.length;d<f;d+=2)t[d]=(t[d]-a)/c,t[d+1]=(t[d+1]-l)/u;for(let d=0,f=r.length;d<f;d+=2)r[d]=(r[d]-a)/c,r[d+1]=(r[d+1]-l)/u}toSVGPath(){let t=[`M${this.#o[4]} ${this.#o[5]}`];for(let r=6,n=this.#o.length;r<n;r+=6){if(isNaN(this.#o[r])){t.push(`L${this.#o[r+4]} ${this.#o[r+5]}`);continue}t.push(`C${this.#o[r]} ${this.#o[r+1]} ${this.#o[r+2]} ${this.#o[r+3]} ${this.#o[r+4]} ${this.#o[r+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,r,n,i],o){let s=n-t,a=i-r,l,c;switch(o){case 0:l=tt._rescale(this.#o,t,i,s,-a),c=tt._rescale(this.#i,t,i,s,-a);break;case 90:l=tt._rescaleAndSwap(this.#o,t,r,s,a),c=tt._rescaleAndSwap(this.#i,t,r,s,a);break;case 180:l=tt._rescale(this.#o,n,r,-s,a),c=tt._rescale(this.#i,n,r,-s,a);break;case 270:l=tt._rescaleAndSwap(this.#o,n,i,-s,-a),c=tt._rescaleAndSwap(this.#i,n,i,-s,-a);break}return{outline:Array.from(l),points:[Array.from(c)]}}#a(t){let r=this.#o,n=r[4],i=r[5],o=[n,i,n,i],s=n,a=i,l=n,c=i,u=t?Math.max:Math.min,d=new Float32Array(4);for(let h=6,m=r.length;h<m;h+=6){let y=r[h+4],x=r[h+5];isNaN(r[h])?(W.pointBoundingBox(y,x,o),a>x?(s=y,a=x):a===x&&(s=u(s,y)),c<x?(l=y,c=x):c===x&&(l=u(l,y))):(d.set(oo,0),W.bezierBoundingBox(n,i,...r.slice(h,h+6),d),W.rectBoundingBox(...d,o),a>d[1]?(s=d[0],a=d[1]):a===d[1]&&(s=u(s,d[0])),c<d[3]?(l=d[2],c=d[3]):c===d[3]&&(l=u(l,d[2]))),n=y,i=x}let f=this.#e;f[0]=o[0]-this.#r,f[1]=o[1]-this.#r,f[2]=o[2]-o[0]+2*this.#r,f[3]=o[3]-o[1]+2*this.#r,this.firstPoint=[s,a],this.lastPoint=[l,c]}get box(){return this.#e}newOutliner(t,r,n,i,o,s=0){return new rh(t,r,n,i,o,s)}getNewOutline(t,r){let[n,i,o,s]=this.#e,[a,l,c,u]=this.#t,d=o*c,f=s*u,h=n*c+a,m=i*u+l,y=this.newOutliner({x:this.#i[0]*d+h,y:this.#i[1]*f+m},this.#t,this.#s,t,this.#n,r??this.#r);for(let x=2;x<this.#i.length;x+=2)y.add({x:this.#i[x]*d+h,y:this.#i[x+1]*f+m});return y.getOutlines()}},cd=class{#t;#e;#r;#n=[];#i=[];constructor(t,r=0,n=0,i=!0){let o=oo.slice(),a=10**-4;for(let{x,y:g,width:v,height:b}of t){let w=Math.floor((x-r)/a)*a,T=Math.ceil((x+v+r)/a)*a,C=Math.floor((g-r)/a)*a,E=Math.ceil((g+b+r)/a)*a,A=[w,C,E,!0],_=[T,C,E,!1];this.#n.push(A,_),W.rectBoundingBox(w,C,T,E,o)}let l=o[2]-o[0]+2*n,c=o[3]-o[1]+2*n,u=o[0]-n,d=o[1]-n,f=i?-1/0:1/0,h=1/0,m=this.#n.at(i?-1:-2),y=[m[0],m[2]];for(let x of this.#n){let[g,v,b,w]=x;!w&&i?v<h?(h=v,f=g):v===h&&(f=Math.max(f,g)):w&&!i&&(v<h?(h=v,f=g):v===h&&(f=Math.min(f,g))),x[0]=(g-u)/l,x[1]=(v-d)/c,x[2]=(b-d)/c}this.#t=new Float32Array([u,d,l,c]),this.#e=[f,h],this.#r=y}getOutlines(){this.#n.sort((r,n)=>r[0]-n[0]||r[1]-n[1]||r[2]-n[2]);let t=[];for(let r of this.#n)r[3]?(t.push(...this.#l(r)),this.#a(r)):(this.#c(r),t.push(...this.#l(r)));return this.#s(t)}#s(t){let r=[],n=new Set;for(let s of t){let[a,l,c]=s;r.push([a,l,s],[a,c,s])}r.sort((s,a)=>s[1]-a[1]||s[0]-a[0]);for(let s=0,a=r.length;s<a;s+=2){let l=r[s][2],c=r[s+1][2];l.push(c),c.push(l),n.add(l),n.add(c)}let i=[],o;for(;n.size>0;){let s=n.values().next().value,[a,l,c,u,d]=s;n.delete(s);let f=a,h=l;for(o=[a,c],i.push(o);;){let m;if(n.has(u))m=u;else if(n.has(d))m=d;else break;n.delete(m),[a,l,c,u,d]=m,f!==a&&(o.push(f,h,a,h===l?l:c),f=a),h=h===l?c:l}o.push(f,h)}return new Lb(i,this.#t,this.#e,this.#r)}#o(t){let r=this.#i,n=0,i=r.length-1;for(;n<=i;){let o=n+i>>1,s=r[o][0];if(s===t)return o;s<t?n=o+1:i=o-1}return i+1}#a([,t,r]){let n=this.#o(t);this.#i.splice(n,0,[t,r])}#c([,t,r]){let n=this.#o(t);for(let i=n;i<this.#i.length;i++){let[o,s]=this.#i[i];if(o!==t)break;if(o===t&&s===r){this.#i.splice(i,1);return}}for(let i=n-1;i>=0;i--){let[o,s]=this.#i[i];if(o!==t)break;if(o===t&&s===r){this.#i.splice(i,1);return}}}#l(t){let[r,n,i]=t,o=[[r,n,i]],s=this.#o(i);for(let a=0;a<s;a++){let[l,c]=this.#i[a];for(let u=0,d=o.length;u<d;u++){let[,f,h]=o[u];if(!(c<=f||h<=l)){if(f>=l){if(h>c)o[u][1]=c;else{if(d===1)return[];o.splice(u,1),u--,d--}continue}o[u][2]=l,h>c&&o.push([r,c,h])}}}return o}},Lb=class extends tt{#t;#e;constructor(t,r,n,i){super(),this.#e=t,this.#t=r,this.firstPoint=n,this.lastPoint=i}toSVGPath(){let t=[];for(let r of this.#e){let[n,i]=r;t.push(`M${n} ${i}`);for(let o=2;o<r.length;o+=2){let s=r[o],a=r[o+1];s===n?(t.push(`V${a}`),i=a):a===i&&(t.push(`H${s}`),n=s)}t.push("Z")}return t.join(" ")}serialize([t,r,n,i],o){let s=[],a=n-t,l=i-r;for(let c of this.#e){let u=new Array(c.length);for(let d=0;d<c.length;d+=2)u[d]=t+c[d]*a,u[d+1]=i-c[d+1]*l;s.push(u)}return s}get box(){return this.#t}get classNamesForOutlining(){return["highlightOutline"]}},ud=class extends rh{newFreeDrawOutline(t,r,n,i,o,s){return new Nb(t,r,n,i,o,s)}},Nb=class extends nh{newOutliner(t,r,n,i,o,s=0){return new ud(t,r,n,i,o,s)}},ih=class e extends Vt{#t=null;#e=0;#r;#n=null;#i=null;#s=null;#o=null;#a=0;#c=null;#l=null;#f=null;#d=!1;#h=null;#g=null;#m=null;#u="";#p;#y="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=pt.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=e.prototype;return ht(this,"_keyboardManager",new ea([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||e._defaultColor,this.#p=t.thickness||e._defaultThickness,this.opacity=t.opacity||e._defaultOpacity,this.#r=t.boxes||null,this.#y=t.methodOfCreation||"",this.#u=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(this.#d=!0,this.#b(t),this.#T()):this.#r&&(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#o=t.focusNode,this.#a=t.focusOffset,this.#v(),this.#T(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert(Vt._l10nAlert.highlight)}get telemetryInitialData(){return{action:"added",type:this.#d?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#p,methodOfCreation:this.#y}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#v(){let t=new cd(this.#r,.001);this.#l=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#l.box;let r=new cd(this.#r,.0025,.001,this._uiManager.direction==="ltr");this.#s=r.getOutlines();let{firstPoint:n}=this.#l;this.#h=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height];let{lastPoint:i}=this.#s;this.#g=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#b({highlightOutlines:t,highlightId:r,clipPathId:n}){this.#l=t;let i=1.5;if(this.#s=t.getNewOutline(this.#p/2+i,.0025),r>=0)this.#f=r,this.#n=n,this.parent.drawLayer.finalizeDraw(r,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#m=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#s.box,path:{d:this.#s.toSVGPath()}},!0);else if(this.parent){let d=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#f,{bbox:e.#_(this.#l.box,(d-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#m,{bbox:e.#_(this.#s.box,d),path:{d:this.#s.toSVGPath()}})}let[o,s,a,l]=t.box;switch(this.rotation){case 0:this.x=o,this.y=s,this.width=a,this.height=l;break;case 90:{let[d,f]=this.parentDimensions;this.x=s,this.y=1-o,this.width=a*f/d,this.height=l*d/f;break}case 180:this.x=1-o,this.y=1-s,this.width=a,this.height=l;break;case 270:{let[d,f]=this.parentDimensions;this.x=1-s,this.y=o,this.width=a*f/d,this.height=l*d/f;break}}let{firstPoint:c}=t;this.#h=[(c[0]-o)/a,(c[1]-s)/l];let{lastPoint:u}=this.#s;this.#g=[(u[0]-o)/a,(u[1]-s)/l]}static initialize(t,r){Vt.initialize(t,r),e._defaultColor||=r.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,r){switch(t){case yt.HIGHLIGHT_COLOR:e._defaultColor=r;break;case yt.HIGHLIGHT_THICKNESS:e._defaultThickness=r;break}}translateInPage(t,r){}get toolbarPosition(){return this.#g}get commentButtonPosition(){return this.#h}updateParams(t,r){switch(t){case yt.HIGHLIGHT_COLOR:this.#w(r);break;case yt.HIGHLIGHT_THICKNESS:this.#C(r);break}}static get defaultPropertiesToUpdate(){return[[yt.HIGHLIGHT_COLOR,e._defaultColor],[yt.HIGHLIGHT_THICKNESS,e._defaultThickness]]}get propertiesToUpdate(){return[[yt.HIGHLIGHT_COLOR,this.color||e._defaultColor],[yt.HIGHLIGHT_THICKNESS,this.#p||e._defaultThickness],[yt.HIGHLIGHT_FREE,this.#d]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#f,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#i?.updateColor(this.color),super.onUpdatedColor()}#w(t){let r=(o,s)=>{this.color=o,this.opacity=s,this.onUpdatedColor()},n=this.color,i=this.opacity;this.addCommands({cmd:r.bind(this,t,e._defaultOpacity),undo:r.bind(this,n,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:yt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#C(t){let r=this.#p,n=i=>{this.#p=i,this.#x(i)};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:yt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#i=new od({editor:this})]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#P())}getBaseTranslation(){return[0,0]}getRect(t,r){return super.getRect(t,r,this.#P())}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this.#E(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#T(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let r=!1;this.parent&&!t?this.#E():t&&(this.#T(t),r=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),r&&this.select()}#x(t){this.#d&&(this.#b({highlightOutlines:this.#l.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())}#E(){this.#f===null||!this.parent||(this.parent.drawLayer.remove(this.#f),this.#f=null,this.parent.drawLayer.remove(this.#m),this.#m=null)}#T(t=this.parent){this.#f===null&&({id:this.#f,clipPathId:this.#n}=t.drawLayer.draw({bbox:this.#l.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#d},path:{d:this.#l.toSVGPath()}},!1,!0),this.#m=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#d},bbox:this.#s.box,path:{d:this.#s.toSVGPath()}},this.#d),this.#c&&(this.#c.style.clipPath=this.#n))}static#_([t,r,n,i],o){switch(o){case 90:return[1-r-i,t,i,n];case 180:return[1-t-n,1-r-i,n,i];case 270:return[r,1-t-n,i,n]}return[t,r,n,i]}rotate(t){let{drawLayer:r}=this.parent,n;this.#d?(t=(t-this.rotation+360)%360,n=e.#_(this.#l.box,t)):n=e.#_([this.x,this.y,this.width,this.height],t),r.updateProperties(this.#f,{bbox:n,root:{"data-main-rotation":t}}),r.updateProperties(this.#m,{bbox:e.#_(this.#s.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();this.#u&&(t.setAttribute("aria-label",this.#u),t.setAttribute("role","mark")),this.#d?t.classList.add("free"):this.div.addEventListener("keydown",this.#R.bind(this),{signal:this._uiManager._signal});let r=this.#c=document.createElement("div");return t.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=this.#n,this.setDims(),FE(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1}})}#R(t){e._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#k(!0);break;case 1:case 3:this.#k(!1);break}}#k(t){if(!this.#t)return;let r=window.getSelection();t?r.setPosition(this.#t,this.#e):r.setPosition(this.#o,this.#a)}select(){super.select(),this.#m&&this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#m&&(this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{selected:!1}}),this.#d||this.#k(!1))}get _mustFixPosition(){return!this.#d}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(this.#f,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#m,{rootClass:{hidden:!t}}))}#P(){return this.#d?this.rotation:0}#M(){if(this.#d)return null;let[t,r]=this.pageDimensions,[n,i]=this.pageTranslation,o=this.#r,s=new Float32Array(o.length*8),a=0;for(let{x:l,y:c,width:u,height:d}of o){let f=l*t+n,h=(1-c)*r+i;s[a]=s[a+4]=f,s[a+1]=s[a+3]=h,s[a+2]=s[a+6]=f+u*t,s[a+5]=s[a+7]=h-d*r,a+=8}return s}#L(t){return this.#l.serialize(t,this.#P())}static startHighlighting(t,r,{target:n,x:i,y:o}){let{x:s,y:a,width:l,height:c}=n.getBoundingClientRect(),u=new AbortController,d=t.combinedSignal(u),f=h=>{u.abort(),this.#N(t,h)};window.addEventListener("blur",f,{signal:d}),window.addEventListener("pointerup",f,{signal:d}),window.addEventListener("pointerdown",ve,{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",ln,{signal:d}),n.addEventListener("pointermove",this.#D.bind(this,t),{signal:d}),this._freeHighlight=new ud({x:i,y:o},[s,a,l,c],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static#D(t,r){this._freeHighlight.add(r)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#N(t,r){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(t,r,n){let i=null;if(t instanceof th){let{data:{quadPoints:y,rect:x,rotation:g,id:v,color:b,opacity:w,popupRef:T,richText:C,contentsObj:E,creationDate:A,modificationDate:_},parent:{page:{pageNumber:P}}}=t;i=t={annotationType:pt.HIGHLIGHT,color:Array.from(b),opacity:w,quadPoints:y,boxes:null,pageIndex:P-1,rect:x.slice(0),rotation:g,annotationElementId:v,id:v,deleted:!1,popupRef:T,richText:C,comment:E?.str||null,creationDate:A,modificationDate:_}}else if(t instanceof ld){let{data:{inkLists:y,rect:x,rotation:g,id:v,color:b,borderStyle:{rawWidth:w},popupRef:T,richText:C,contentsObj:E,creationDate:A,modificationDate:_},parent:{page:{pageNumber:P}}}=t;i=t={annotationType:pt.HIGHLIGHT,color:Array.from(b),thickness:w,inkLists:y,boxes:null,pageIndex:P-1,rect:x.slice(0),rotation:g,annotationElementId:v,id:v,deleted:!1,popupRef:T,richText:C,comment:E?.str||null,creationDate:A,modificationDate:_}}let{color:o,quadPoints:s,inkLists:a,outlines:l,opacity:c}=t,u=await super.deserialize(t,r,n);u.color=W.makeHexColor(...o),u.opacity=c||1,a&&(u.#p=t.thickness),u._initialData=i,t.comment&&u.setCommentData(t);let[d,f]=u.pageDimensions,[h,m]=u.pageTranslation;if(s){let y=u.#r=[];for(let x=0;x<s.length;x+=8)y.push({x:(s[x]-h)/d,y:1-(s[x+1]-m)/f,width:(s[x+2]-s[x])/d,height:(s[x+1]-s[x+5])/f});u.#v(),u.#T(),u.rotate(u.rotation)}else if(a||l){u.#d=!0;let y=(a||l.points)[0],x={x:y[0]-h,y:f-(y[1]-m)},g=new ud(x,[0,0,d,f],1,u.#p/2,!0,.001);for(let w=0,T=y.length;w<T;w+=2)x.x=y[w]-h,x.y=f-(y[w+1]-m),g.add(x);let{id:v,clipPathId:b}=r.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:u.color,"fill-opacity":u._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:g.toSVGPath()}},!0,!0);u.#b({highlightOutlines:g.getOutlines(),highlightId:v,clipPathId:b}),u.#T(),u.rotate(u.parentRotation)}return u}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let r=Vt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),n=super.serialize(t);return Object.assign(n,{color:r,opacity:this.opacity,thickness:this.#p,quadPoints:this.#M(),outlines:this.#L(n.rect)}),this.addComment(n),this.annotationElementId&&!this.#B(n)?null:(n.id=this.annotationElementId,n)}#B(t){let{color:r}=this._initialData;return this.hasEditedComment||t.color.some((n,i)=>n!==r[i])}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}},oh=class{#t=Object.create(null);updateProperty(t,r){this[t]=r,this.updateSVGProperty(t,r)}updateProperties(t){if(t)for(let[r,n]of Object.entries(t))r.startsWith("_")||this.updateProperty(r,n)}updateSVGProperty(t,r){this.#t[t]=r}toSVGProperties(){let t=this.#t;return this.#t=Object.create(null),{root:t}}reset(){this.#t=Object.create(null)}updateAll(t=this){this.updateProperties(t)}clone(){$t("Not implemented")}},sh=class e extends Vt{#t=null;#e;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#r=null;static#n=null;static#i=null;static _INNER_MARGIN=3;constructor(t){super(t),this.#e=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(t){t.drawOutlines&&(this.#s(t),this.#c())}#s({drawOutlines:t,drawId:r,drawingOptions:n}){this.#t=t,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(Vt._l10nAlert[this.editorType]),r>=0?(this._drawId=r,this.parent.drawLayer.finalizeDraw(r,t.defaultProperties)):this._drawId=this.#o(t,this.parent),this.#d(t.box)}#o(t,r){let{id:n}=r.drawLayer.draw(e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(t,r){let n=new Set(Object.keys(t));for(let[i,o]of Object.entries(r))n.has(i)?Object.assign(t[i],o):t[i]=o;return t}static getDefaultDrawingOptions(t){$t("Not implemented")}static get typesMap(){$t("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,r){let n=this.typesMap.get(t);n&&this._defaultDrawingOptions.updateProperty(n,r),this._currentParent&&(e.#r.updateProperty(n,r),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,r){let n=this.constructor.typesMap.get(t);n&&this._updateProperty(t,n,r)}static get defaultPropertiesToUpdate(){let t=[],r=this._defaultDrawingOptions;for(let[n,i]of this.typesMap)t.push([n,r[i]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:r}=this;for(let[n,i]of this.constructor.typesMap)t.push([n,r[i]]);return t}_updateProperty(t,r,n){let i=this._drawingOptions,o=i[r],s=a=>{i.updateProperty(r,a);let l=this.#t.updateProperty(r,a);l&&this.#d(l),this.parent?.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:s.bind(this,n),undo:s.bind(this,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,r){let n=this.constructor.typesMap.get(this.colorType),i=this.constructor.typesMap.get(this.opacityType),o=this._drawingOptions,s=o[n],a=o[i],l=(c,u)=>{o.updateProperty(n,c),o.updateProperty(i,u),this.#t.updateProperty(n,c),this.#t.updateProperty(i,u),this.parent?.drawLayer.updateProperties(this._drawId,o.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:l.bind(this,t,r),undo:l.bind(this,s,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:yt.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#t.getPathResizingSVGProperties(this.#f()),{bbox:this.#h()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#t.getPathResizedSVGProperties(this.#f()),{bbox:this.#h()}))}_onTranslating(t,r){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#h()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this.#t.getPathTranslatedSVGProperties(this.#f(),this.parentDimensions),{bbox:this.#h()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#e&&(this.#e=!1,this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){this.#a(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#c(),this.#d(this.#t.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let r=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),this.#a()):t&&(this._uiManager.addShouldRescale(this),this.#c(t),r=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),r&&this.select()}#a(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#c(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#o(this.#t,t)}}#l([t,r,n,i]){let{parentDimensions:[o,s],rotation:a}=this;switch(a){case 90:return[r,1-t,n*(s/o),i*(o/s)];case 180:return[1-t,1-r,n,i];case 270:return[1-r,t,n*(s/o),i*(o/s)];default:return[t,r,n,i]}}#f(){let{x:t,y:r,width:n,height:i,parentDimensions:[o,s],rotation:a}=this;switch(a){case 90:return[1-r,t,n*(o/s),i*(s/o)];case 180:return[1-t,1-r,n,i];case 270:return[r,1-t,n*(o/s),i*(s/o)];default:return[t,r,n,i]}}#d(t){[this.x,this.y,this.width,this.height]=this.#l(t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#h(){let{x:t,y:r,width:n,height:i,rotation:o,parentRotation:s,parentDimensions:[a,l]}=this;switch((o*4+s)/90){case 1:return[1-r-i,t,i,n];case 2:return[1-t-n,1-r-i,n,i];case 3:return[r,1-t-n,i,n];case 4:return[t,r-n*(a/l),i*(l/a),n*(a/l)];case 5:return[1-r,t,n*(a/l),i*(l/a)];case 6:return[1-t-i*(l/a),1-r,i*(l/a),n*(a/l)];case 7:return[r-n*(a/l),1-t-i*(l/a),n*(a/l),i*(l/a)];case 8:return[t-n,r-i,n,i];case 9:return[1-r,t-n,i,n];case 10:return[1-t,1-r,n,i];case 11:return[r-i,1-t,i,n];case 12:return[t-i*(l/a),r,i*(l/a),n*(a/l)];case 13:return[1-r-n*(a/l),t-i*(l/a),n*(a/l),i*(l/a)];case 14:return[1-t,1-r-n*(a/l),i*(l/a),n*(a/l)];case 15:return[r,1-t,n*(a/l),i*(l/a)];default:return[t,r,n,i]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties({bbox:this.#h()},this.#t.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#d(this.#t.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,r;this._isCopy&&(t=this.x,r=this.y);let n=super.render();n.classList.add("draw");let i=document.createElement("div");return n.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,r),n}static createDrawerInstance(t,r,n,i,o){$t("Not implemented")}static startDrawing(t,r,n,i){let{target:o,offsetX:s,offsetY:a,pointerId:l,pointerType:c}=i;if(_r.isInitializedAndDifferentPointerType(c))return;let{viewport:{rotation:u}}=t,{width:d,height:f}=o.getBoundingClientRect(),h=e.#n=new AbortController,m=t.combinedSignal(h);if(_r.setPointer(c,l),window.addEventListener("pointerup",y=>{_r.isSamePointerIdOrRemove(y.pointerId)&&this._endDraw(y)},{signal:m}),window.addEventListener("pointercancel",y=>{_r.isSamePointerIdOrRemove(y.pointerId)&&this._currentParent.endDrawingSession()},{signal:m}),window.addEventListener("pointerdown",y=>{_r.isSamePointerType(y.pointerType)&&(_r.initializeAndAddPointerId(y.pointerId),e.#r.isCancellable()&&(e.#r.removeLastElement(),e.#r.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",ln,{signal:m}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),o.addEventListener("touchmove",y=>{_r.isSameTimeStamp(y.timeStamp)&&ve(y)},{signal:m}),t.toggleDrawing(),r._editorUndoBar?.hide(),e.#r){t.drawLayer.updateProperties(this._currentDrawId,e.#r.startNew(s,a,d,f,u));return}r.updateUIForDefaultProperties(this),e.#r=this.createDrawerInstance(s,a,d,f,u),e.#i=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(e.#i.toSVGProperties(),e.#r.defaultSVGProperties),!0,!1)}static _drawMove(t){if(_r.isSameTimeStamp(t.timeStamp),!e.#r)return;let{offsetX:r,offsetY:n,pointerId:i}=t;if(_r.isSamePointerId(i)){if(_r.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,e.#r.add(r,n)),_r.setTimeStamp(t.timeStamp),ve(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#r=null,e.#i=null,_r.clearTimeStamp()),e.#n&&(e.#n.abort(),e.#n=null,_r.clearPointerIds())}static _endDraw(t){let r=this._currentParent;if(r){if(r.toggleDrawing(!0),this._cleanup(!1),t?.target===r.div&&r.drawLayer.updateProperties(this._currentDrawId,e.#r.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let n=e.#r,i=this._currentDrawId,o=n.getLastElement();r.addCommands({cmd:()=>{r.drawLayer.updateProperties(i,n.setLastElement(o))},undo:()=>{r.drawLayer.updateProperties(i,n.removeLastElement())},mustExec:!1,type:yt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let r=this._currentParent;if(!r)return null;if(r.toggleDrawing(!0),r.cleanUndoStack(yt.DRAW_STEP),!e.#r.isEmpty()){let{pageDimensions:[n,i],scale:o}=r,s=r.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:e.#r.getOutlines(n*o,i*o,o,this._INNER_MARGIN),drawingOptions:e.#i,mustBeCommitted:!t});return this._cleanup(!0),s}return r.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,r,n,i,o,s){$t("Not implemented")}static async deserialize(t,r,n){let{rawDims:{pageWidth:i,pageHeight:o,pageX:s,pageY:a}}=r.viewport,l=this.deserializeDraw(s,a,i,o,this._INNER_MARGIN,t),c=await super.deserialize(t,r,n);return c.createDrawingOptions(t),c.#s({drawOutlines:l}),c.#c(),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){let[r,n]=this.pageTranslation,[i,o]=this.pageDimensions;return this.#t.serialize([r,n,i,o],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},Ib=class{#t=new Float64Array(6);#e;#r;#n;#i;#s;#o="";#a=0;#c=new ia;#l;#f;constructor(t,r,n,i,o,s){this.#l=n,this.#f=i,this.#n=o,this.#i=s,[t,r]=this.#d(t,r);let a=this.#e=[NaN,NaN,NaN,NaN,t,r];this.#s=[t,r],this.#r=[{line:a,points:this.#s}],this.#t.set(a,0)}updateProperty(t,r){t==="stroke-width"&&(this.#i=r)}#d(t,r){return tt._normalizePoint(t,r,this.#l,this.#f,this.#n)}isEmpty(){return!this.#r||this.#r.length===0}isCancellable(){return this.#s.length<=10}add(t,r){[t,r]=this.#d(t,r);let[n,i,o,s]=this.#t.subarray(2,6),a=t-o,l=r-s;return Math.hypot(this.#l*a,this.#f*l)<=2?null:(this.#s.push(t,r),isNaN(n)?(this.#t.set([o,s,t,r],2),this.#e.push(NaN,NaN,NaN,NaN,t,r),{path:{d:this.toSVGPath()}}):(isNaN(this.#t[0])&&this.#e.splice(6,6),this.#t.set([n,i,o,s,t,r],0),this.#e.push(...tt.createBezierPoints(n,i,o,s,t,r)),{path:{d:this.toSVGPath()}}))}end(t,r){let n=this.add(t,r);return n||(this.#s.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,r,n,i,o){this.#l=n,this.#f=i,this.#n=o,[t,r]=this.#d(t,r);let s=this.#e=[NaN,NaN,NaN,NaN,t,r];this.#s=[t,r];let a=this.#r.at(-1);return a&&(a.line=new Float32Array(a.line),a.points=new Float32Array(a.points)),this.#r.push({line:s,points:this.#s}),this.#t.set(s,0),this.#a=0,this.toSVGPath(),null}getLastElement(){return this.#r.at(-1)}setLastElement(t){return this.#r?(this.#r.push(t),this.#e=t.line,this.#s=t.points,this.#a=0,{path:{d:this.toSVGPath()}}):this.#c.setLastElement(t)}removeLastElement(){if(!this.#r)return this.#c.removeLastElement();this.#r.pop(),this.#o="";for(let t=0,r=this.#r.length;t<r;t++){let{line:n,points:i}=this.#r[t];this.#e=n,this.#s=i,this.#a=0,this.toSVGPath()}return{path:{d:this.#o}}}toSVGPath(){let t=tt.svgRound(this.#e[4]),r=tt.svgRound(this.#e[5]);if(this.#s.length===2)return this.#o=`${this.#o} M ${t} ${r} Z`,this.#o;if(this.#s.length<=6){let i=this.#o.lastIndexOf("M");this.#o=`${this.#o.slice(0,i)} M ${t} ${r}`,this.#a=6}if(this.#s.length===4){let i=tt.svgRound(this.#e[10]),o=tt.svgRound(this.#e[11]);return this.#o=`${this.#o} L ${i} ${o}`,this.#a=12,this.#o}let n=[];this.#a===0&&(n.push(`M ${t} ${r}`),this.#a=6);for(let i=this.#a,o=this.#e.length;i<o;i+=6){let[s,a,l,c,u,d]=this.#e.slice(i,i+6).map(tt.svgRound);n.push(`C${s} ${a} ${l} ${c} ${u} ${d}`)}return this.#o+=n.join(" "),this.#a=this.#e.length,this.#o}getOutlines(t,r,n,i){let o=this.#r.at(-1);return o.line=new Float32Array(o.line),o.points=new Float32Array(o.points),this.#c.build(this.#r,t,r,n,this.#n,this.#i,i),this.#t=null,this.#e=null,this.#r=null,this.#o=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}},ia=class extends tt{#t;#e=0;#r;#n;#i;#s;#o;#a;#c;build(t,r,n,i,o,s,a){this.#i=r,this.#s=n,this.#o=i,this.#a=o,this.#c=s,this.#r=a??0,this.#n=t,this.#d()}get thickness(){return this.#c}setLastElement(t){return this.#n.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#n.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:r}of this.#n){if(t.push(`M${tt.svgRound(r[4])} ${tt.svgRound(r[5])}`),r.length===6){t.push("Z");continue}if(r.length===12&&isNaN(r[6])){t.push(`L${tt.svgRound(r[10])} ${tt.svgRound(r[11])}`);continue}for(let n=6,i=r.length;n<i;n+=6){let[o,s,a,l,c,u]=r.subarray(n,n+6).map(tt.svgRound);t.push(`C${o} ${s} ${a} ${l} ${c} ${u}`)}}return t.join("")}serialize([t,r,n,i],o){let s=[],a=[],[l,c,u,d]=this.#f(),f,h,m,y,x,g,v,b,w;switch(this.#a){case 0:w=tt._rescale,f=t,h=r+i,m=n,y=-i,x=t+l*n,g=r+(1-c-d)*i,v=t+(l+u)*n,b=r+(1-c)*i;break;case 90:w=tt._rescaleAndSwap,f=t,h=r,m=n,y=i,x=t+c*n,g=r+l*i,v=t+(c+d)*n,b=r+(l+u)*i;break;case 180:w=tt._rescale,f=t+n,h=r,m=-n,y=i,x=t+(1-l-u)*n,g=r+c*i,v=t+(1-l)*n,b=r+(c+d)*i;break;case 270:w=tt._rescaleAndSwap,f=t+n,h=r+i,m=-n,y=-i,x=t+(1-c-d)*n,g=r+(1-l-u)*i,v=t+(1-c)*n,b=r+(1-l)*i;break}for(let{line:T,points:C}of this.#n)s.push(w(T,f,h,m,y,o?new Array(T.length):null)),a.push(w(C,f,h,m,y,o?new Array(C.length):null));return{lines:s,points:a,rect:[x,g,v,b]}}static deserialize(t,r,n,i,o,{paths:{lines:s,points:a},rotation:l,thickness:c}){let u=[],d,f,h,m,y;switch(l){case 0:y=tt._rescale,d=-t/n,f=r/i+1,h=1/n,m=-1/i;break;case 90:y=tt._rescaleAndSwap,d=-r/i,f=-t/n,h=1/i,m=1/n;break;case 180:y=tt._rescale,d=t/n+1,f=-r/i,h=-1/n,m=1/i;break;case 270:y=tt._rescaleAndSwap,d=r/i+1,f=t/n+1,h=-1/i,m=-1/n;break}if(!s){s=[];for(let g of a){let v=g.length;if(v===2){s.push(new Float32Array([NaN,NaN,NaN,NaN,g[0],g[1]]));continue}if(v===4){s.push(new Float32Array([NaN,NaN,NaN,NaN,g[0],g[1],NaN,NaN,NaN,NaN,g[2],g[3]]));continue}let b=new Float32Array(3*(v-2));s.push(b);let[w,T,C,E]=g.subarray(0,4);b.set([NaN,NaN,NaN,NaN,w,T],0);for(let A=4;A<v;A+=2){let _=g[A],P=g[A+1];b.set(tt.createBezierPoints(w,T,C,E,_,P),(A-2)*3),[w,T,C,E]=[C,E,_,P]}}}for(let g=0,v=s.length;g<v;g++)u.push({line:y(s[g].map(b=>b??NaN),d,f,h,m),points:y(a[g].map(b=>b??NaN),d,f,h,m)});let x=new this.prototype.constructor;return x.build(u,n,i,1,l,c,o),x}#l(t=this.#c){let r=this.#r+t/2*this.#o;return this.#a%180===0?[r/this.#i,r/this.#s]:[r/this.#s,r/this.#i]}#f(){let[t,r,n,i]=this.#t,[o,s]=this.#l(0);return[t+o,r+s,n-2*o,i-2*s]}#d(){let t=this.#t=Qs.slice();for(let{line:i}of this.#n){if(i.length<=12){for(let a=4,l=i.length;a<l;a+=6)W.pointBoundingBox(i[a],i[a+1],t);continue}let o=i[4],s=i[5];for(let a=6,l=i.length;a<l;a+=6){let[c,u,d,f,h,m]=i.subarray(a,a+6);W.bezierBoundingBox(o,s,c,u,d,f,h,m,t),o=h,s=m}}let[r,n]=this.#l();t[0]=fe(t[0]-r,0,1),t[1]=fe(t[1]-n,0,1),t[2]=fe(t[2]+r,0,1),t[3]=fe(t[3]+n,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#t}updateProperty(t,r){return t==="stroke-width"?this.#h(r):null}#h(t){let[r,n]=this.#l();this.#c=t;let[i,o]=this.#l(),[s,a]=[i-r,o-n],l=this.#t;return l[0]-=s,l[1]-=a,l[2]+=2*s,l[3]+=2*a,l}updateParentDimensions([t,r],n){let[i,o]=this.#l();this.#i=t,this.#s=r,this.#o=n;let[s,a]=this.#l(),l=s-i,c=a-o,u=this.#t;return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u}updateRotation(t){return this.#e=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#t.map(tt.svgRound).join(" ")}get defaultProperties(){let[t,r]=this.#t;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`}}}get rotationTransform(){let[,,t,r]=this.#t,n=0,i=0,o=0,s=0,a=0,l=0;switch(this.#e){case 90:i=r/t,o=-t/r,a=t;break;case 180:n=-1,s=-1,a=t,l=r;break;case 270:i=-r/t,o=t/r,l=r;break;default:return""}return`matrix(${n} ${i} ${o} ${s} ${tt.svgRound(a)} ${tt.svgRound(l)})`}getPathResizingSVGProperties([t,r,n,i]){let[o,s]=this.#l(),[a,l,c,u]=this.#t;if(Math.abs(c-o)<=tt.PRECISION||Math.abs(u-s)<=tt.PRECISION){let y=t+n/2-(a+c/2),x=r+i/2-(l+u/2);return{path:{"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`,transform:`${this.rotationTransform} translate(${y} ${x})`}}}let d=(n-2*o)/(c-2*o),f=(i-2*s)/(u-2*s),h=c/n,m=u/i;return{path:{"transform-origin":`${tt.svgRound(a)} ${tt.svgRound(l)}`,transform:`${this.rotationTransform} scale(${h} ${m}) translate(${tt.svgRound(o)} ${tt.svgRound(s)}) scale(${d} ${f}) translate(${tt.svgRound(-o)} ${tt.svgRound(-s)})`}}}getPathResizedSVGProperties([t,r,n,i]){let[o,s]=this.#l(),a=this.#t,[l,c,u,d]=a;if(a[0]=t,a[1]=r,a[2]=n,a[3]=i,Math.abs(u-o)<=tt.PRECISION||Math.abs(d-s)<=tt.PRECISION){let x=t+n/2-(l+u/2),g=r+i/2-(c+d/2);for(let{line:v,points:b}of this.#n)tt._translate(v,x,g,v),tt._translate(b,x,g,b);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let f=(n-2*o)/(u-2*o),h=(i-2*s)/(d-2*s),m=-f*(l+o)+t+o,y=-h*(c+s)+r+s;if(f!==1||h!==1||m!==0||y!==0)for(let{line:x,points:g}of this.#n)tt._rescale(x,m,y,f,h,x),tt._rescale(g,m,y,f,h,g);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,r],n){let[i,o]=n,s=this.#t,a=t-s[0],l=r-s[1];if(this.#i===i&&this.#s===o)for(let{line:c,points:u}of this.#n)tt._translate(c,a,l,c),tt._translate(u,a,l,u);else{let c=this.#i/i,u=this.#s/o;this.#i=i,this.#s=o;for(let{line:d,points:f}of this.#n)tt._rescale(d,a,l,c,u,d),tt._rescale(f,a,l,c,u,f);s[2]*=c,s[3]*=u}return s[0]=t,s[1]=r,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${tt.svgRound(t)} ${tt.svgRound(r)}`}}}get defaultSVGProperties(){let t=this.#t;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${tt.svgRound(t[0])} ${tt.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}},ah=class e extends oh{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:Vt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,r){t==="stroke-width"&&(r??=this["stroke-width"],r*=this._viewParameters.realScale),super.updateSVGProperty(t,r)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},Bb=class e extends sh{static _type="ink";static _editorType=pt.INK;static _defaultDrawingOptions=null;constructor(t){super({...t,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,r){Vt.initialize(t,r),this._defaultDrawingOptions=new ah(r.viewParameters)}static getDefaultDrawingOptions(t){let r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!0}static get typesMap(){return ht(this,"typesMap",new Map([[yt.INK_THICKNESS,"stroke-width"],[yt.INK_COLOR,"stroke"],[yt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,r,n,i,o){return new Ib(t,r,n,i,o,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,r,n,i,o,s){return ia.deserialize(t,r,n,i,o,s)}static async deserialize(t,r,n){let i=null;if(t instanceof ld){let{data:{inkLists:s,rect:a,rotation:l,id:c,color:u,opacity:d,borderStyle:{rawWidth:f},popupRef:h,richText:m,contentsObj:y,creationDate:x,modificationDate:g},parent:{page:{pageNumber:v}}}=t;i=t={annotationType:pt.INK,color:Array.from(u),thickness:f,opacity:d,paths:{points:s},boxes:null,pageIndex:v-1,rect:a.slice(0),rotation:l,annotationElementId:c,id:c,deleted:!1,popupRef:h,richText:m,comment:y?.str||null,creationDate:x,modificationDate:g}}let o=await super.deserialize(t,r,n);return o._initialData=i,t.comment&&o.setCommentData(t),o}get toolbarButtons(){return this._colorPicker||=new Xp(this),[["colorPicker",this._colorPicker]]}get colorType(){return yt.INK_COLOR}get colorAndOpacityType(){return yt.INK_COLOR_AND_OPACITY}get opacityType(){return yt.INK_OPACITY}updateParams(t,r){if(t===yt.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(r.color,r.opacity);return}super.updateParams(t,r)}static updateDefaultParams(t,r){if(t===yt.INK_COLOR_AND_OPACITY){super.updateDefaultParams(yt.INK_COLOR,r.color),super.updateDefaultParams(yt.INK_OPACITY,r.opacity);return}super.updateDefaultParams(t,r)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:t,_drawingOptions:r,parent:n}=this;r.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(t,r.toSVGProperties())}static onScaleChangingWhenDrawing(){let t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:r,opacity:n}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:W.makeHexColor(...t),"stroke-width":r,"stroke-opacity":n})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:r,points:n}=this.serializeDraw(t),{_drawingOptions:{stroke:i,"stroke-opacity":o,"stroke-width":s}}=this,a=Object.assign(super.serialize(t),{color:Vt._colorManager.convert(i),opacity:o,thickness:s,paths:{lines:r,points:n}});return this.addComment(a),t?(a.isCopy=!0,a):this.annotationElementId&&!this.#t(a)?null:(a.id=this.annotationElementId,a)}#t(t){let{color:r,thickness:n,opacity:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((s,a)=>s!==r[a])||t.thickness!==n||t.opacity!==i||t.pageIndex!==o}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let{points:r,rect:n}=this.serializeDraw(!1);return t.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:r,popup:this.comment}),null}},dd=class extends ia{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},Op=8,Hu=3,io=class{static#t={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#e(t,r,n,i){return n-=t,i-=r,n===0?i>0?0:4:n===1?i+6:2-i}static#r=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#n(t,r,n,i,o,s,a){let l=this.#e(n,i,o,s);for(let c=0;c<8;c++){let u=(-c+l-a+16)%8,d=this.#r[2*u],f=this.#r[2*u+1];if(t[(n+d)*r+(i+f)]!==0)return u}return-1}static#i(t,r,n,i,o,s,a){let l=this.#e(n,i,o,s);for(let c=0;c<8;c++){let u=(c+l+a+16)%8,d=this.#r[2*u],f=this.#r[2*u+1];if(t[(n+d)*r+(i+f)]!==0)return u}return-1}static#s(t,r,n,i){let o=t.length,s=new Int32Array(o);for(let u=0;u<o;u++)s[u]=t[u]<=i?1:0;for(let u=1;u<n-1;u++)s[u*r]=s[u*r+r-1]=0;for(let u=0;u<r;u++)s[u]=s[r*n-1-u]=0;let a=1,l,c=[];for(let u=1;u<n-1;u++){l=1;for(let d=1;d<r-1;d++){let f=u*r+d,h=s[f];if(h===0)continue;let m=u,y=d;if(h===1&&s[f-1]===0)a+=1,y-=1;else if(h>=1&&s[f+1]===0)a+=1,y+=1,h>1&&(l=h);else{h!==1&&(l=Math.abs(h));continue}let x=[d,u],g=y===d+1,v={isHole:g,points:x,id:a,parent:0};c.push(v);let b;for(let k of c)if(k.id===l){b=k;break}b?b.isHole?v.parent=g?b.parent:l:v.parent=g?l:b.parent:v.parent=g?l:0;let w=this.#n(s,r,u,d,m,y,0);if(w===-1){s[f]=-a,s[f]!==1&&(l=Math.abs(s[f]));continue}let T=this.#r[2*w],C=this.#r[2*w+1],E=u+T,A=d+C;m=E,y=A;let _=u,P=d;for(;;){let k=this.#i(s,r,_,P,m,y,1);T=this.#r[2*k],C=this.#r[2*k+1];let I=_+T,M=P+C;x.push(M,I);let z=_*r+P;if(s[z+1]===0?s[z]=-a:s[z]===1&&(s[z]=a),I===u&&M===d&&_===E&&P===A){s[f]!==1&&(l=Math.abs(s[f]));break}else m=_,y=P,_=I,P=M}}}return c}static#o(t,r,n,i){if(n-r<=4){for(let E=r;E<n-2;E+=2)i.push(t[E],t[E+1]);return}let o=t[r],s=t[r+1],a=t[n-4]-o,l=t[n-3]-s,c=Math.hypot(a,l),u=a/c,d=l/c,f=u*s-d*o,h=l/a,m=1/c,y=Math.atan(h),x=Math.cos(y),g=Math.sin(y),v=m*(Math.abs(x)+Math.abs(g)),b=m*(1-v+v**2),w=Math.max(Math.atan(Math.abs(g+x)*b),Math.atan(Math.abs(g-x)*b)),T=0,C=r;for(let E=r+2;E<n-2;E+=2){let A=Math.abs(f-u*t[E+1]+d*t[E]);A>T&&(C=E,T=A)}T>(c*w)**2?(this.#o(t,r,C+2,i),this.#o(t,C,n,i)):i.push(o,s)}static#a(t){let r=[],n=t.length;return this.#o(t,0,n,r),r.push(t[n-2],t[n-1]),r.length<=4?null:r}static#c(t,r,n,i,o,s){let a=new Float32Array(s**2),l=-2*i**2,c=s>>1;for(let y=0;y<s;y++){let x=(y-c)**2;for(let g=0;g<s;g++)a[y*s+g]=Math.exp((x+(g-c)**2)/l)}let u=new Float32Array(256),d=-2*o**2;for(let y=0;y<256;y++)u[y]=Math.exp(y**2/d);let f=t.length,h=new Uint8Array(f),m=new Uint32Array(256);for(let y=0;y<n;y++)for(let x=0;x<r;x++){let g=y*r+x,v=t[g],b=0,w=0;for(let C=0;C<s;C++){let E=y+C-c;if(!(E<0||E>=n))for(let A=0;A<s;A++){let _=x+A-c;if(_<0||_>=r)continue;let P=t[E*r+_],k=a[C*s+A]*u[Math.abs(P-v)];b+=P*k,w+=k}}let T=h[g]=Math.round(b/w);m[T]++}return[h,m]}static#l(t){let r=new Uint32Array(256);for(let n of t)r[n]++;return r}static#f(t){let r=t.length,n=new Uint8ClampedArray(r>>2),i=-1/0,o=1/0;for(let a=0,l=n.length;a<l;a++){let c=n[a]=t[a<<2];i=Math.max(i,c),o=Math.min(o,c)}let s=255/(i-o);for(let a=0,l=n.length;a<l;a++)n[a]=(n[a]-o)*s;return n}static#d(t){let r,n=-1/0,i=-1/0,o=t.findIndex(l=>l!==0),s=o,a=o;for(r=o;r<256;r++){let l=t[r];l>n&&(r-s>i&&(i=r-s,a=r-1),n=l,s=r)}for(r=a-1;r>=0&&!(t[r]>t[r+1]);r--);return r}static#h(t){let r=t,{width:n,height:i}=t,{maxDim:o}=this.#t,s=n,a=i;if(n>o||i>o){let f=n,h=i,m=Math.log2(Math.max(n,i)/o),y=Math.floor(m);m=m===y?y-1:y;for(let g=0;g<m;g++){s=Math.ceil(f/2),a=Math.ceil(h/2);let v=new OffscreenCanvas(s,a);v.getContext("2d").drawImage(t,0,0,f,h,0,0,s,a),f=s,h=a,t!==r&&t.close(),t=v.transferToImageBitmap()}let x=Math.min(o/s,o/a);s=Math.round(s*x),a=Math.round(a*x)}let c=new OffscreenCanvas(s,a).getContext("2d",{willReadFrequently:!0});c.fillStyle="white",c.fillRect(0,0,s,a),c.filter="grayscale(1)",c.drawImage(t,0,0,t.width,t.height,0,0,s,a);let u=c.getImageData(0,0,s,a).data;return[this.#f(u),s,a]}static extractContoursFromText(t,{fontFamily:r,fontStyle:n,fontWeight:i},o,s,a,l){let c=new OffscreenCanvas(1,1),u=c.getContext("2d",{alpha:!1}),d=200,f=u.font=`${n} ${i} ${d}px ${r}`,{actualBoundingBoxLeft:h,actualBoundingBoxRight:m,actualBoundingBoxAscent:y,actualBoundingBoxDescent:x,fontBoundingBoxAscent:g,fontBoundingBoxDescent:v,width:b}=u.measureText(t),w=1.5,T=Math.ceil(Math.max(Math.abs(h)+Math.abs(m)||0,b)*w),C=Math.ceil(Math.max(Math.abs(y)+Math.abs(x)||d,Math.abs(g)+Math.abs(v)||d)*w);c=new OffscreenCanvas(T,C),u=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),u.font=f,u.filter="grayscale(1)",u.fillStyle="white",u.fillRect(0,0,T,C),u.fillStyle="black",u.fillText(t,T*(w-1)/2,C*(3-w)/2);let E=this.#f(u.getImageData(0,0,T,C).data),A=this.#l(E),_=this.#d(A),P=this.#s(E,T,C,_);return this.processDrawnLines({lines:{curves:P,width:T,height:C},pageWidth:o,pageHeight:s,rotation:a,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,r,n,i,o){let[s,a,l]=this.#h(t),[c,u]=this.#c(s,a,l,Math.hypot(a,l)*this.#t.sigmaSFactor,this.#t.sigmaR,this.#t.kernelSize),d=this.#d(u),f=this.#s(c,a,l,d);return this.processDrawnLines({lines:{curves:f,width:a,height:l},pageWidth:r,pageHeight:n,rotation:i,innerMargin:o,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:r,pageHeight:n,rotation:i,innerMargin:o,mustSmooth:s,areContours:a}){i%180!==0&&([r,n]=[n,r]);let{curves:l,width:c,height:u}=t,d=t.thickness??0,f=[],h=Math.min(r/c,n/u),m=h/r,y=h/n,x=[];for(let{points:v}of l){let b=s?this.#a(v):v;if(!b)continue;x.push(b);let w=b.length,T=new Float32Array(w),C=new Float32Array(3*(w===2?2:w-2));if(f.push({line:C,points:T}),w===2){T[0]=b[0]*m,T[1]=b[1]*y,C.set([NaN,NaN,NaN,NaN,T[0],T[1]],0);continue}let[E,A,_,P]=b;E*=m,A*=y,_*=m,P*=y,T.set([E,A,_,P],0),C.set([NaN,NaN,NaN,NaN,E,A],0);for(let k=4;k<w;k+=2){let I=T[k]=b[k]*m,M=T[k+1]=b[k+1]*y;C.set(tt.createBezierPoints(E,A,_,P,I,M),(k-2)*3),[E,A,_,P]=[_,P,I,M]}}if(f.length===0)return null;let g=a?new dd:new ia;return g.build(f,r,n,1,i,a?0:d,o),{outline:g,newCurves:x,areContours:a,thickness:d,width:c,height:u}}static async compressSignature({outlines:t,areContours:r,thickness:n,width:i,height:o}){let s=1/0,a=-1/0,l=0;for(let v of t){l+=v.length;for(let b=2,w=v.length;b<w;b++){let T=v[b]-v[b-2];s=Math.min(s,T),a=Math.max(a,T)}}let c;s>=-128&&a<=127?c=Int8Array:s>=-32768&&a<=32767?c=Int16Array:c=Int32Array;let u=t.length,d=Op+Hu*u,f=new Uint32Array(d),h=0;f[h++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*u)*c.BYTES_PER_ELEMENT,f[h++]=0,f[h++]=i,f[h++]=o,f[h++]=r?0:1,f[h++]=Math.max(0,Math.floor(n??0)),f[h++]=u,f[h++]=c.BYTES_PER_ELEMENT;for(let v of t)f[h++]=v.length-2,f[h++]=v[0],f[h++]=v[1];let m=new CompressionStream("deflate-raw"),y=m.writable.getWriter();await y.ready,y.write(f);let x=c.prototype.constructor;for(let v of t){let b=new x(v.length-2);for(let w=2,T=v.length;w<T;w++)b[w-2]=v[w]-v[w-2];y.write(b)}return y.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(t){try{let r=Uint8Array.fromBase64(t),{readable:n,writable:i}=new DecompressionStream("deflate-raw"),o=i.getWriter();await o.ready,o.write(r).then(async()=>{await o.ready,await o.close()}).catch(()=>{});let s=null,a=0;for await(let b of n)s||=new Uint8Array(new Uint32Array(b.buffer,0,4)[0]),s.set(b,a),a+=b.length;let l=new Uint32Array(s.buffer,0,s.length>>2),c=l[1];if(c!==0)throw new Error(`Invalid version: ${c}`);let u=l[2],d=l[3],f=l[4]===0,h=l[5],m=l[6],y=l[7],x=[],g=(Op+Hu*m)*Uint32Array.BYTES_PER_ELEMENT,v;switch(y){case Int8Array.BYTES_PER_ELEMENT:v=new Int8Array(s.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:v=new Int16Array(s.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:v=new Int32Array(s.buffer,g);break}a=0;for(let b=0;b<m;b++){let w=l[Hu*b+Op],T=new Float32Array(w+2);x.push(T);for(let C=0;C<Hu-1;C++)T[C]=l[Hu*b+Op+C+1];for(let C=0;C<w;C++)T[C+2]=T[C]+v[a++]}return{areContours:f,thickness:h,outlines:x,width:u,height:d}}catch(r){return vt(`decompressSignature: ${r}`),null}}},zb=class e extends oh{constructor(){super(),super.updateProperties({fill:Vt._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},Fb=class e extends ah{constructor(t){super(t),super.updateProperties({stroke:Vt._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},$b=class e extends sh{#t=!1;#e=null;#r=null;#n=null;static _type="signature";static _editorType=pt.SIGNATURE;static _defaultDrawingOptions=null;constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#r=t.signatureData||null,this.#e=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,r){Vt.initialize(t,r),this._defaultDrawingOptions=new zb,this._defaultDrawnSignatureOptions=new Fb(r.viewParameters)}static getDefaultDrawingOptions(t){let r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!1}static get typesMap(){return ht(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#e}}static computeTelemetryFinalData(t){let r=t.get("hasDescription");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,r,{_isCopy:n}=this;if(n&&(this._isCopy=!1,t=this.x,r=this.y),super.render(),this._drawId===null)if(this.#r){let{lines:i,mustSmooth:o,areContours:s,description:a,uuid:l,heightInPage:c}=this.#r,{rawDims:{pageWidth:u,pageHeight:d},rotation:f}=this.parent.viewport,h=io.processDrawnLines({lines:i,pageWidth:u,pageHeight:d,rotation:f,innerMargin:e._INNER_MARGIN,mustSmooth:o,areContours:s});this.addSignature(h,c,a,l)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#e||""}));return n&&(this._isCopy=!0,this._moveAfterPaste(t,r)),this.div}setUuid(t){this.#n=t,this.addEditToolbar()}getUuid(){return this.#n}get description(){return this.#e}set description(t){this.#e=t,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(r=>{r?.updateEditSignatureButton(t)}))}getSignaturePreview(){let{newCurves:t,areContours:r,thickness:n,width:i,height:o}=this.#r,s=Math.max(i,o),a=io.processDrawnLines({lines:{curves:t.map(l=>({points:l})),thickness:n,width:i,height:o},pageWidth:s,pageHeight:s,rotation:0,innerMargin:0,mustSmooth:!1,areContours:r});return{areContours:r,outline:a.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,r,n,i){let{x:o,y:s}=this,{outline:a}=this.#r=t;this.#t=a instanceof dd,this.description=n;let l;this.#t?l=e.getDefaultDrawingOptions():(l=e._defaultDrawnSignatureOptions.clone(),l.updateProperties({"stroke-width":a.thickness})),this._addOutlines({drawOutlines:a,drawingOptions:l});let[,c]=this.pageDimensions,u=r/c;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=o,this.y=s,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:r,pageHeight:n},rotation:i}=this.parent.viewport;return io.process(t,r,n,i,e._INNER_MARGIN)}getFromText(t,r){let{rawDims:{pageWidth:n,pageHeight:i},rotation:o}=this.parent.viewport;return io.extractContoursFromText(t,r,n,i,o,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:r,pageHeight:n},rotation:i}=this.parent.viewport;return io.processDrawnLines({lines:t,pageWidth:r,pageHeight:n,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:r}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":r}))}serialize(t=!1){if(this.isEmpty())return null;let{lines:r,points:n}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":i}}=this,o=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#t,color:[0,0,0],thickness:this.#t?0:i});return this.addComment(o),t?(o.paths={lines:r,points:n},o.uuid=this.#n,o.isCopy=!0):o.lines=r,this.#e&&(o.accessibilityData={type:"Figure",alt:this.#e}),o}static deserializeDraw(t,r,n,i,o,s){return s.areContours?dd.deserialize(t,r,n,i,o,s):ia.deserialize(t,r,n,i,o,s)}static async deserialize(t,r,n){let i=await super.deserialize(t,r,n);return i.#t=t.areContours,i.description=t.accessibilityData?.alt||"",i.#n=t.uuid,i}},jb=class extends Vt{#t=null;#e=null;#r=null;#n=null;#i=null;#s="";#o=null;#a=!1;#c=null;#l=!1;#f=!1;static _type="stamp";static _editorType=pt.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#n=t.bitmapUrl,this.#i=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,r){Vt.initialize(t,r)}static isHandlingMimeForPasting(t){return Fp.includes(t)}static paste(t,r){r.pasteEditor({mode:pt.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){let r=t.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}#d(t,r=!1){if(!t){this.remove();return}this.#t=t.bitmap,r||(this.#e=t.id,this.#l=t.isSvg),t.file&&(this.#s=t.file.name),this.#m()}#h(){if(this.#r=null,this._uiManager.enableWaiting(!1),!!this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(t=null,r=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:i,width:o,height:s}=t||this.copyCanvas(null,null,!0).imageData,a=await n.guess({name:"altText",request:{data:i,width:o,height:s,channels:i.length/(o*s)}});if(!a)throw new Error("No response from the AI service.");if(a.error)throw new Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw new Error("No valid response from the AI service.");let l=a.output;return await this.setGuessedAltText(l),r&&!this.hasAltTextData()&&(this.altTextData={alt:l,decorative:!1}),l}#g(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then(n=>this.#d(n,!0)).finally(()=>this.#h());return}if(this.#n){let n=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#r=this._uiManager.imageManager.getFromUrl(n).then(i=>this.#d(i)).finally(()=>this.#h());return}if(this.#i){let n=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#r=this._uiManager.imageManager.getFromFile(n).then(i=>this.#d(i)).finally(()=>this.#h());return}let t=document.createElement("input");t.type="file",t.accept=Fp.join(",");let r=this._uiManager._signal;this.#r=new Promise(n=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let i=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(i)}n()},{signal:r}),t.addEventListener("cancel",()=>{this.remove(),n()},{signal:r})}).finally(()=>this.#h()),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#o?.remove(),this.#o=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#g();return}super.rebuild(),this.div!==null&&(this.#e&&this.#o===null&&this.#g(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(this.#r||this.#t||this.#n||this.#i||this.#e||this.#a)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,r;return this._isCopy&&(t=this.x,r=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#a||(this.#t?this.#m():this.#g()),this._isCopy&&this._moveAfterPaste(t,r),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,r){let{id:n,bitmap:i}=this._uiManager.imageManager.getFromCanvas(t,r);r.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#e=n,i&&(this.#t=i),this.#a=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#c!==null&&clearTimeout(this.#c);let t=200;this.#c=setTimeout(()=>{this.#c=null,this.#p()},t)}#m(){let{div:t}=this,{width:r,height:n}=this.#t,[i,o]=this.pageDimensions,s=.75;if(this.width)r=this.width*i,n=this.height*o;else if(r>s*i||n>s*o){let l=Math.min(s*i/r,s*o/n);r*=l,n*=l}this._uiManager.enableWaiting(!1);let a=this.#o=document.createElement("canvas");a.setAttribute("role","img"),this.addContainer(a),this.width=r/i,this.height=n/o,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),this.#p(),this.#f||(this.parent.addUndoableEditor(this),this.#f=!0),this._reportTelemetry({action:"inserted_image"}),this.#s&&this.div.setAttribute("aria-description",this.#s),this.annotationElementId||this._uiManager.a11yAlert(Vt._l10nAlert.stamp)}copyCanvas(t,r,n=!1){t||(t=224);let{width:i,height:o}=this.#t,s=new Mi,a=this.#t,l=i,c=o,u=null;if(r){if(i>r||o>r){let C=Math.min(r/i,r/o);l=Math.floor(i*C),c=Math.floor(o*C)}u=document.createElement("canvas");let f=u.width=Math.ceil(l*s.sx),h=u.height=Math.ceil(c*s.sy);this.#l||(a=this.#u(f,h));let m=u.getContext("2d");m.filter=this._uiManager.hcmFilter;let y="white",x="#cfcfd8";this._uiManager.hcmFilter!=="none"?x="black":pv.isDarkMode&&(y="#8f8f9d",x="#42414d");let g=15,v=g*s.sx,b=g*s.sy,w=new OffscreenCanvas(v*2,b*2),T=w.getContext("2d");T.fillStyle=y,T.fillRect(0,0,v*2,b*2),T.fillStyle=x,T.fillRect(0,0,v,b),T.fillRect(v,b,v,b),m.fillStyle=m.createPattern(w,"repeat"),m.fillRect(0,0,f,h),m.drawImage(a,0,0,a.width,a.height,0,0,f,h)}let d=null;if(n){let f,h;if(s.symmetric&&a.width<t&&a.height<t)f=a.width,h=a.height;else if(a=this.#t,i>t||o>t){let x=Math.min(t/i,t/o);f=Math.floor(i*x),h=Math.floor(o*x),this.#l||(a=this.#u(f,h))}let y=new OffscreenCanvas(f,h).getContext("2d",{willReadFrequently:!0});y.drawImage(a,0,0,a.width,a.height,0,0,f,h),d={width:f,height:h,data:y.getImageData(0,0,f,h).data}}return{canvas:u,width:l,height:c,imageData:d}}#u(t,r){let{width:n,height:i}=this.#t,o=n,s=i,a=this.#t;for(;o>2*t||s>2*r;){let l=o,c=s;o>2*t&&(o=Math.ceil(o/2)),s>2*r&&(s=Math.ceil(s/2));let u=new OffscreenCanvas(o,s);u.getContext("2d").drawImage(a,0,0,l,c,0,0,o,s),a=u.transferToImageBitmap()}return a}#p(){let[t,r]=this.parentDimensions,{width:n,height:i}=this,o=new Mi,s=Math.ceil(n*t*o.sx),a=Math.ceil(i*r*o.sy),l=this.#o;if(!l||l.width===s&&l.height===a)return;l.width=s,l.height=a;let c=this.#l?this.#t:this.#u(s,a),u=l.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,s,a)}#y(t){if(t){if(this.#l){let i=this._uiManager.imageManager.getSvgUrl(this.#e);if(i)return i}let r=document.createElement("canvas");return{width:r.width,height:r.height}=this.#t,r.getContext("2d").drawImage(this.#t,0,0),r.toDataURL()}if(this.#l){let[r,n]=this.pageDimensions,i=Math.round(this.width*r*so.PDF_TO_CSS_UNITS),o=Math.round(this.height*n*so.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,o);return s.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,i,o),s.transferToImageBitmap()}return structuredClone(this.#t)}static async deserialize(t,r,n){let i=null,o=!1;if(t instanceof eh){let{data:{rect:y,rotation:x,id:g,structParent:v,popupRef:b,richText:w,contentsObj:T,creationDate:C,modificationDate:E},container:A,parent:{page:{pageNumber:_}},canvas:P}=t,k,I;P?(delete t.canvas,{id:k,bitmap:I}=n.imageManager.getFromCanvas(A.id,P),P.remove()):(o=!0,t._hasNoCanvas=!0);let M=(await r._structTree.getAriaAttributes(`${_l}${g}`))?.get("aria-label")||"";i=t={annotationType:pt.STAMP,bitmapId:k,bitmap:I,pageIndex:_-1,rect:y.slice(0),rotation:x,annotationElementId:g,id:g,deleted:!1,accessibilityData:{decorative:!1,altText:M},isSvg:!1,structParent:v,popupRef:b,richText:w,comment:T?.str||null,creationDate:C,modificationDate:E}}let s=await super.deserialize(t,r,n),{rect:a,bitmap:l,bitmapUrl:c,bitmapId:u,isSvg:d,accessibilityData:f}=t;o?(n.addMissingCanvas(t.id,s),s.#a=!0):u&&n.imageManager.isValidId(u)?(s.#e=u,l&&(s.#t=l)):s.#n=c,s.#l=d;let[h,m]=s.pageDimensions;return s.width=(a[2]-a[0])/h,s.height=(a[3]-a[1])/m,f&&(s.altTextData=f),s._initialData=i,t.comment&&s.setCommentData(t),s.#f=!!i,s}serialize(t=!1,r=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(t),{bitmapId:this.#e,isSvg:this.#l});if(this.addComment(n),t)return n.bitmapUrl=this.#y(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:i,altText:o}=this.serializeAltText(!1);if(!i&&o&&(n.accessibilityData={type:"Figure",alt:o}),this.annotationElementId){let a=this.#v(n);return a.isSame?null:(a.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(r===null)return n;r.stamps||=new Map;let s=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!r.stamps.has(this.#e))r.stamps.set(this.#e,{area:s,serialized:n}),n.bitmap=this.#y(!1);else if(this.#l){let a=r.stamps.get(this.#e);s>a.area&&(a.area=s,a.serialized.bitmap.close(),a.serialized.bitmap=this.#y(!1))}return n}#v(t){let{pageIndex:r,accessibilityData:{altText:n}}=this._initialData,i=t.pageIndex===r,o=(t.accessibilityData?.alt||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&o,isSameAltText:o}}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},lh=class e{#t;#e=!1;#r=null;#n=null;#i=null;#s=new Map;#o=!1;#a=!1;#c=!1;#l=null;#f=null;#d=null;#h=null;#g=null;#m=-1;#u;static _initialized=!1;static#p=new Map([Mb,Bb,jb,ih,$b].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:r,div:n,structTreeLayer:i,accessibilityManager:o,annotationLayer:s,drawLayer:a,textLayer:l,viewport:c,l10n:u}){let d=[...e.#p.values()];if(!e._initialized){e._initialized=!0;for(let f of d)f.initialize(u,t)}t.registerEditorTypes(d),this.#u=t,this.pageIndex=r,this.div=n,this.#t=o,this.#r=s,this.viewport=c,this.#d=l,this.drawLayer=a,this._structTree=i,this.#u.addLayer(this)}get isEmpty(){return this.#s.size===0}get isInvisible(){return this.isEmpty&&this.#u.getMode()===pt.NONE}updateToolbar(t){this.#u.updateToolbar(t)}updateMode(t=this.#u.getMode()){switch(this.#x(),t){case pt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case pt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case pt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:r}=this.div;if(r.toggle("nonEditing",!1),t===pt.POPUP)r.toggle("commentEditing",!0);else{r.toggle("commentEditing",!1);for(let n of e.#p.values())r.toggle(`${n._type}Editing`,t===n._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===this.#d?.div}setEditingState(t){this.#u.setEditingState(t)}addCommands(t){this.#u.addCommands(t)}cleanUndoStack(t){this.#u.cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#r?.togglePointerEvents(t)}get#y(){return this.#s.size!==0?this.#s.values():this.#u.getEditors(this.pageIndex)}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#g?.abort(),this.#g=null;let t=new Set;for(let n of this.#y)n.enableEditing(),n.show(!0),n.annotationElementId&&(this.#u.removeChangedExistingAnnotation(n),t.add(n.annotationElementId));let r=this.#r;if(r)for(let n of r.getEditableAnnotations()){if(n.hide(),this.#u.isDeletedAnnotationElement(n.data.id)||t.has(n.data.id))continue;let i=await this.deserialize(n);i&&(this.addOrRebuild(i),i.enableEditing())}this.#c=!1,this.#u._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#a=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#d&&!this.#g){this.#g=new AbortController;let i=this.#u.combinedSignal(this.#g);this.#d.div.addEventListener("pointerdown",o=>{let{clientX:a,clientY:l,timeStamp:c}=o,u=this.#m;if(c-u>500){this.#m=c;return}this.#m=-1;let{classList:d}=this.div;d.toggle("getElements",!0);let f=document.elementsFromPoint(a,l);if(d.toggle("getElements",!1),!this.div.contains(f[0]))return;let h,m=new RegExp(`^${qu}[0-9]+$`);for(let x of f)if(m.test(x.id)){h=x.id;break}if(!h)return;let y=this.#s.get(h);y?.annotationElementId===null&&(ve(o),y.dblclick(o))},{signal:i,capture:!0})}let t=this.#r,r=[];if(t){let i=new Map,o=new Map;for(let s of this.#y){if(s.disableEditing(),!s.annotationElementId){r.push(s);continue}if(s.serialize()!==null){i.set(s.annotationElementId,s);continue}else o.set(s.annotationElementId,s);this.getEditableAnnotation(s.annotationElementId)?.show(),s.remove()}for(let s of t.getEditableAnnotations()){let{id:a}=s.data;if(this.#u.isDeletedAnnotationElement(a)){s.updateEdited({deleted:!0});continue}let l=o.get(a);if(l){l.resetAnnotationElement(s),l.show(!1),s.show();continue}l=i.get(a),l&&(this.#u.addChangedExistingAnnotation(l),l.renderAnnotationElement(s)&&l.show(!1)),s.show()}}this.#x(),this.isEmpty&&(this.div.hidden=!0);let{classList:n}=this.div;for(let i of e.#p.values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(r),this.#a=!1}getEditableAnnotation(t){return this.#r?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#u.getActive()!==t&&this.#u.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#h){this.#h=new AbortController;let t=this.#u.combinedSignal(this.#h);this.#d.div.addEventListener("pointerdown",this.#v.bind(this),{signal:t}),this.#d.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#h&&(this.#h.abort(),this.#h=null,this.#d.div.classList.remove("highlighting"))}#v(t){this.#u.unselectAll();let{target:r}=t;if(r===this.#d.div||(r.getAttribute("role")==="img"||r.classList.contains("endOfContent")||r.classList.contains("textLayerImages")||r.classList.contains("textLayerImagePlaceholder"))&&this.#d.div.contains(r)){let{isMac:n}=Kt.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#u.showAllEditors("highlight",!0,!0),this.#d.div.classList.add("free"),this.toggleDrawing(),ih.startHighlighting(this,this.#u.direction==="ltr",{target:this.#d.div,x:t.x,y:t.y}),this.#d.div.addEventListener("pointerup",()=>{this.#d.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#u._signal}),t.preventDefault()}}enableClick(){if(this.#n)return;this.#n=new AbortController;let t=this.#u.combinedSignal(this.#n);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let r=this.pointerup.bind(this);this.div.addEventListener("pointerup",r,{signal:t}),this.div.addEventListener("pointercancel",r,{signal:t})}disableClick(){this.#n?.abort(),this.#n=null}attach(t){this.#s.set(t.id,t);let{annotationElementId:r}=t;r&&this.#u.isDeletedAnnotationElement(r)&&this.#u.removeDeletedAnnotationElement(t)}detach(t){this.#s.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#a&&t.annotationElementId&&this.#u.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#u.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#u.addDeletedAnnotationElement(t),Vt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),this.#u.addEditor(t),this.attach(t),!t.isAttachedToDOM){let r=t.render();this.div.append(r),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#c),this.#u.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:r}=document;t.div.contains(r)&&!this.#i&&(t._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#u._signal}),r.focus())},0)),t._structTreeParentId=this.#t?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){let r=()=>t._uiManager.rebuild(t),n=()=>{t.remove()};this.addCommands({cmd:r,undo:n,mustExec:!1})}getEditorByUID(t){for(let r of this.#s.values())if(r.uid===t)return r;return null}get#b(){return e.#p.get(this.#u.getMode())}combinedSignal(t){return this.#u.combinedSignal(t)}#w(t){let r=this.#b;return r?new r.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#b?.canCreateNewEmptyEditor()}async pasteEditor(t,r){this.updateToolbar(t),await this.#u.updateMode(t.mode);let{offsetX:n,offsetY:i}=this.#C(),o=this.#u.getId(),s=this.#w({parent:this,id:o,x:n,y:i,uiManager:this.#u,isCentered:!0,...r});s&&this.add(s)}async deserialize(t){return await e.#p.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#u)||null}createAndAddNewEditor(t,r,n={}){let i=this.#u.getId(),o=this.#w({parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:this.#u,isCentered:r,...n});return o&&this.add(o),o}get boundingClientRect(){return this.div.getBoundingClientRect()}#C(){let{x:t,y:r,width:n,height:i}=this.boundingClientRect,o=Math.max(0,t),s=Math.max(0,r),a=Math.min(window.innerWidth,t+n),l=Math.min(window.innerHeight,r+i),c=(o+a)/2-t,u=(s+l)/2-r,[d,f]=this.viewport.rotation%180===0?[c,u]:[u,c];return{offsetX:d,offsetY:f}}addNewEditor(t={}){this.createAndAddNewEditor(this.#C(),!0,t)}setSelected(t){this.#u.setSelected(t)}toggleSelected(t){this.#u.toggleSelected(t)}unselect(t){this.#u.unselect(t)}pointerup(t){let{isMac:r}=Kt.platform;if(t.button!==0||t.ctrlKey&&r||t.target!==this.div||!this.#o||(this.#o=!1,this.#b?.isDrawer&&this.#b.supportMultipleDrawings))return;if(!this.#e){this.#e=!0;return}let n=this.#u.getMode();if(n===pt.STAMP||n===pt.POPUP||n===pt.SIGNATURE){this.#u.unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(this.#u.getMode()===pt.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:r}=Kt.platform;if(t.button!==0||t.ctrlKey&&r||t.target!==this.div)return;if(this.#o=!0,this.#b?.isDrawer){this.startDrawingSession(t);return}let n=this.#u.getActive();this.#e=!n||n.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#l){this.#b.startDrawing(this,this.#u,!1,t);return}this.#u.setCurrentDrawingSession(this),this.#l=new AbortController;let r=this.#u.combinedSignal(this.#l);this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(this.#f=null,this.commitOrRemove())},{signal:r}),this.#b.startDrawing(this,this.#u,!1,t)}pause(t){if(t){let{activeElement:r}=document;this.div.contains(r)&&(this.#f=r);return}this.#f&&setTimeout(()=>{this.#f?.focus(),this.#f=null},0)}endDrawingSession(t=!1){return this.#l?(this.#u.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#f=null,this.#b.endDrawing(t)):null}findNewParent(t,r,n){let i=this.#u.findParent(r,n);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#b.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#u.getActive()?.parent===this&&(this.#u.commitOrRemove(),this.#u.setActiveEditor(null)),this.#i&&(clearTimeout(this.#i),this.#i=null);for(let t of this.#s.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#s.clear(),this.#u.removeLayer(this)}#x(){for(let t of this.#s.values())t.isEmpty()&&t.remove()}async render({viewport:t}){this.viewport=t,Ko(this.div,t);for(let r of this.#u.getEditors(this.pageIndex))this.add(r),r.rebuild();await this.#u.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){this.#u.commitOrRemove(),this.#x();let r=this.viewport.rotation,n=t.rotation;if(this.viewport=t,Ko(this.div,{rotation:n}),r!==n)for(let i of this.#s.values())i.rotate(n)}get pageDimensions(){let{pageWidth:t,pageHeight:r}=this.viewport.rawDims;return[t,r]}get scale(){return this.#u.viewParameters.realScale}};function Vz(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Dp(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(".textLayer"):e.parentElement?.closest(".textLayer")||null:null}function Gz(e,t,r,n){if(e===r)return t<=n;let i=e.compareDocumentPosition(r);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function kE(e,t,r){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains("textLayer")||t!==e.childNodes.length)return{container:e,offset:t};let n=e.lastChild;return n?.nodeType===Node.ELEMENT_NODE&&n.classList.contains("endOfContent")&&(n=n.previousSibling),!n||!r.contains(n)?null:n.nodeType===Node.TEXT_NODE?{container:n,offset:n.textContent.length}:{container:n,offset:n.childNodes.length}}var ch=class e{#t=null;#e=new Map;#r=null;#n=null;#i=null;#s=null;#o=new Map;static#a=0;static#c=0;static#l=null;static#f=new Set;static#d=!1;static#h=new Set;static#g=new WeakMap;constructor({filterFactory:t=null,pageColors:r=null,pageIndex:n,textLayer:i=null}){if(this.pageIndex=n,this.#n=t,this.#i=r,i){let o=e.#g.get(i);if(o?.selectionDiv&&(o.selectionDiv.remove(),e.#f.delete(o.selectionDiv)),e.#g.set(i,{drawLayer:this}),e.#h.add(i),this.#r=i,this.#s=new MutationObserver(s=>{if(!(!this.#t||!this.#r?.isConnected||!e.#u())){for(let{addedNodes:a}of s)for(let l of a)if(l.nodeType===Node.ELEMENT_NODE&&l.classList.contains("endOfContent")){e.#y();return}}}),this.#s.observe(i,{childList:!0}),e.#l===null){e.#l=new AbortController;let{signal:s}=e.#l;document.addEventListener("selectionchange",e.#y.bind(e),{signal:s}),document.addEventListener("pointerdown",()=>{e.#d=!0},{signal:s}),document.addEventListener("pointerup",()=>{e.#d=!1},{signal:s}),window.addEventListener("blur",()=>{e.#d=!1},{signal:s})}}}setParent(t){if(!this.#t){this.#t=t,this.#r?.isConnected&&e.#u()&&e.#y();return}if(this.#t!==t){if(this.#e.size>0)for(let r of this.#e.values())r.remove(),t.append(r);this.#t=t}}static#m(t){let r=this.#g.get(t);r?.selectionDiv&&(r.selectionDiv.remove(),this.#f.delete(r.selectionDiv),r.selectionDiv=null,r.path=null)}static#u(){let t=document.getSelection();return!!t&&!t.isCollapsed}static#p(){return[...this.#h].filter(t=>t.isConnected).sort(Vz)}static#y(){let t=document.getSelection();if(!t||t.isCollapsed){for(let s of this.#f)s.remove();this.#f.clear();return}let r=new WeakMap,n=this.#p(),i=[];for(let s=0,a=t.rangeCount;s<a;s++){let l=t.getRangeAt(s);if(l.collapsed)continue;let{startContainer:c,startOffset:u,endContainer:d,endOffset:f}=l,h=Dp(c),m=Dp(d),y=h===null,x=m===null;if(this.#d&&y!==x)return;if(t.rangeCount===1){let{anchorNode:b,anchorOffset:w,focusNode:T,focusOffset:C}=t,E=Dp(b),A=Dp(T),_=Gz(b,w,T,C);E&&A&&_!==null&&(_?(c=b,u=w,h=E,d=T,f=C,m=A):(c=T,u=C,h=A,d=b,f=w,m=E))}let g=n.filter(b=>l.intersectsNode(b));if(g.length===0)continue;let v=!1;if(h||(h=g[0],c=h,u=0,v=!0),m||(m=g.at(-1),d=m,f=m.childNodes.length,v=!0),d.nodeType===Node.ELEMENT_NODE){if(d.classList.contains("endOfContent")){let b=d.previousSibling;if(!b)continue;d=b,f=b.nodeType===Node.TEXT_NODE?b.textContent.length:b.childNodes.length}else if(d.classList.contains("textLayer")&&d.childNodes.length===f){let b=kE(d,f,m);if(!b)continue;d=b.container,f=b.offset}}if(c.nodeType===Node.ELEMENT_NODE){let b=kE(c,u,h);if(!b)continue;c=b.container,u=b.offset}if(h===m&&!v&&g.includes(h)){i.push([l,h]);continue}for(let b of g){let w=b.firstChild;if(!w)continue;let T=document.createRange();if(b===h?T.setStart(c,u):T.setStartBefore(w),b===m)T.setEnd(d,f);else{let C=b.lastChild;if(!C)continue;if(C.nodeType===Node.ELEMENT_NODE&&C.classList.contains("endOfContent")){let E=C.previousSibling;if(!E)continue;T.setEndAfter(E)}else T.setEndAfter(C)}T.collapsed||i.push([T,b])}}let o=new Set(i.map(s=>s[1]));for(let s of this.#h)o.has(s)||this.#m(s);for(let[s,a]of i){let l=e.#g.get(a);if(!l)continue;let c=r.get(a);if(!c){let m=a.getBoundingClientRect();c=(y,x,g,v)=>({x:(y-m.x)/m.width,y:(x-m.y)/m.height,width:g/m.width,height:v/m.height}),r.set(a,c)}let u=[];for(let{x:m,y,width:x,height:g}of s.getClientRects())x===0||g===0||({x:m,y,width:x,height:g}=c(m,y,x,g),!(x===1&&g===1)&&u.push(`M${m} ${y} h${x} v${g} h-${x} Z`));if(u.length===0)continue;let d=l.drawLayer,f=l.selectionDiv,h=l.path;if(!f){let m=`clip_selection_${e.#c++}`;f=document.createElement("div"),f.className="selection",f.style.clipPath=`url(#${m})`;let y=d.#n?.createSelectionStyle(d.#i);if(y)for(let[v,b]of Object.entries(y))f.style.setProperty(v,b);let x=e._svgFactory.create(1,1,!0);x.setAttribute("aria-hidden","true"),x.setAttribute("width","100%"),x.setAttribute("height","100%");let g=e._svgFactory.createElement("clipPath");g.setAttribute("id",m),g.setAttribute("clipPathUnits","objectBoundingBox"),h=e._svgFactory.createElement("path"),g.append(h),x.append(g),f.append(x),l.path=h,l.selectionDiv=f}!f.parentNode&&d.#t&&(d.#t.append(f),this.#f.add(f)),h.setAttribute("d",u.join(" "))}}static get _svgFactory(){return ht(this,"_svgFactory",new ra)}static#v(t,[r,n,i,o]){let{style:s}=t;s.top=`${100*n}%`,s.left=`${100*r}%`,s.width=`${100*i}%`,s.height=`${100*o}%`}#b(){let t=e._svgFactory.create(1,1,!0);return this.#t.append(t),t.setAttribute("aria-hidden","true"),t}#w(t,r){let n=e._svgFactory.createElement("clipPath");t.append(n);let i=`clip_${r}`;n.setAttribute("id",i),n.setAttribute("clipPathUnits","objectBoundingBox");let o=e._svgFactory.createElement("use");return n.append(o),o.setAttribute("href",`#${r}`),o.classList.add("clip"),i}#C(t,r){for(let[n,i]of Object.entries(r))i===null?t.removeAttribute(n):t.setAttribute(n,i)}draw(t,r=!1,n=!1){let i=e.#a++,o=this.#b(),s=e._svgFactory.createElement("defs");o.append(s);let a=e._svgFactory.createElement("path");s.append(a);let l=`path_${i}`;a.setAttribute("id",l),a.setAttribute("vector-effect","non-scaling-stroke"),r&&this.#o.set(i,a);let c=n?this.#w(s,l):null,u=e._svgFactory.createElement("use");return o.append(u),u.setAttribute("href",`#${l}`),this.updateProperties(o,t),this.#e.set(i,o),{id:i,clipPathId:`url(#${c})`}}drawOutline(t,r){let n=e.#a++,i=this.#b(),o=e._svgFactory.createElement("defs");i.append(o);let s=e._svgFactory.createElement("path");o.append(s);let a=`path_${n}`;s.setAttribute("id",a),s.setAttribute("vector-effect","non-scaling-stroke");let l;if(r){let d=e._svgFactory.createElement("mask");o.append(d),l=`mask_${n}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");let f=e._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let h=e._svgFactory.createElement("use");d.append(h),h.setAttribute("href",`#${a}`),h.setAttribute("stroke","none"),h.setAttribute("fill","black"),h.setAttribute("fill-rule","nonzero"),h.classList.add("mask")}let c=e._svgFactory.createElement("use");i.append(c),c.setAttribute("href",`#${a}`),l&&c.setAttribute("mask",`url(#${l})`);let u=c.cloneNode();return i.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),this.updateProperties(i,t),this.#e.set(n,i),n}finalizeDraw(t,r){this.#o.delete(t),this.updateProperties(t,r)}updateProperties(t,r){if(!r)return;let{root:n,bbox:i,rootClass:o,path:s}=r,a=typeof t=="number"?this.#e.get(t):t;if(a){if(n&&this.#C(a,n),i&&e.#v(a,i),o){let{classList:l}=a;for(let[c,u]of Object.entries(o))l.toggle(c,u)}if(s){let c=a.firstElementChild.firstElementChild;this.#C(c,s)}}}updateParent(t,r){if(r===this)return;let n=this.#e.get(t);n&&(r.#t.append(n),this.#e.delete(t),r.#e.set(t,n))}remove(t){this.#o.delete(t),this.#t!==null&&(this.#e.get(t).remove(),this.#e.delete(t))}destroy(){this.#t=null;for(let t of this.#e.values())t.remove();this.#e.clear(),this.#o.clear(),this.#s?.disconnect(),this.#s=null,this.#r&&(e.#g.get(this.#r)?.drawLayer===this&&(e.#m(this.#r),e.#g.delete(this.#r),e.#h.delete(this.#r),e.#h.size===0&&(e.#l?.abort(),e.#l=null,e.#d=!1)),this.#r=null)}};function Mp(e){return`${(e*100).toFixed(2)}%`}var uh=class e{#t=[];#e=new Map;#r=null;#n=0;#i=0;#s=0;static#o=null;constructor(t,r,n,i){this.#n=t,this.#t=r,this.#i=n.rawDims.pageWidth,this.#s=n.rawDims.pageHeight,this.#r=i}render(){let t=document.createElement("div");t.className="textLayerImages";for(let r=0;r<this.#t.length;r+=6){let n=this.#a(this.#t.subarray(r,r+6));n&&t.append(n)}return t.addEventListener("contextmenu",r=>{if(!(r.target instanceof HTMLCanvasElement))return;let n=r.target,i=this.#e.get(n);if(!i)return;let o=e.#o?.deref();if(o===n)return;o&&(o.width=0,o.height=0),e.#o=new WeakRef(n);let{inverseTransform:s,x1:a,y1:l,width:c,height:u}=i,d=this.#r(),f=Math.ceil(a*d.width),h=Math.ceil(l*d.height),m=Math.floor((a+c/this.#i)*d.width),y=Math.floor((l+u/this.#s)*d.height);n.width=m-f,n.height=y-h;let x=n.getContext("2d");x.setTransform(...s),x.translate(-f,-h),x.drawImage(d,0,0)}),t}#a([t,r,n,i,o,s]){let a=Math.hypot((o-t)*this.#i,(s-r)*this.#s),l=Math.hypot((n-t)*this.#i,(i-r)*this.#s);if(a<this.#n||l<this.#n)return null;let c=[(o-t)*this.#i/a,(s-r)*this.#s/a,(n-t)*this.#i/l,(i-r)*this.#s/l,0,0],u=W.inverseTransform(c),d=document.createElement("canvas");return d.className="textLayerImagePlaceholder",d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:"absolute",left:Mp(t),top:Mp(r),width:Mp(a/this.#i),height:Mp(l/this.#s),transformOrigin:"0% 0%",transform:`matrix(${c.join(",")})`}),this.#e.set(d,{inverseTransform:u,width:a,height:l,x1:t,y1:r}),d}};globalThis._pdfjsTestingUtils={HighlightOutliner:cd};globalThis.pdfjsLib={AbortException:ci,AnnotationEditorLayer:lh,AnnotationEditorParamsType:yt,AnnotationEditorType:pt,AnnotationEditorUIManager:Zo,AnnotationLayer:Bl,AnnotationMode:li,AnnotationType:Ne,applyOpacity:IE,build:XE,ColorPicker:od,createValidAbsoluteUrl:Hb,CSSConstants:$p,DOMSVGFactory:ra,DrawLayer:ch,FeatureTest:Kt,fetchData:gh,findContrastColor:BE,getDocument:wh,getFilenameFromUrl:LE,getPdfFilenameFromUrl:NE,getRGB:Fl,getRGBA:zl,getUuid:Vb,GlobalWorkerOptions:Di,ImageKind:Uu,InvalidPDFException:kl,isDataScheme:pd,isPdfFile:yh,isValidExplicitDest:$E,makeArr:hh,makeMap:mh,makeObj:Bp,MathClamp:fe,noContextMenu:ln,normalizeUnicode:ME,OPS:Oi,OutputScale:Mi,PasswordResponses:DE,PDFDataRangeTransport:id,PDFDateString:Dl,PDFWorker:Il,PermissionFlag:OE,PixelsPerInch:so,RenderingCancelledException:Ol,renderRichText:Gb,ResponseException:ta,setLayerDimensions:Ko,shadow:ht,SignatureExtractor:io,stopEvent:ve,SupportedImageMimeTypes:Fp,TextLayer:Qo,TextLayerImages:uh,TouchManager:Qu,updateUrlHash:Ub,Util:W,VerbosityLevel:fd,version:qE,XfaLayer:Zu};p();var $l=D(Z(),1),pe=D(F(),1);rr();p();var tA=Object.prototype.hasOwnProperty;function eA(e,t,r){for(r of e.keys())if(sa(r,t))return r}function sa(e,t){var r,n,i;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((n=e.length)===t.length)for(;n--&&sa(e[n],t[n]););return n===-1}if(r===Set){if(e.size!==t.size)return!1;for(n of e)if(i=n,i&&typeof i=="object"&&(i=eA(t,i),!i)||!t.has(i))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(n of e)if(i=n[0],i&&typeof i=="object"&&(i=eA(t,i),!i)||!sa(n[1],t.get(i)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(!r||typeof e=="object"){n=0;for(r in e)if(tA.call(e,r)&&++n&&!tA.call(t,r)||!(r in t)||!sa(e[r],t[r]))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}p();function ui(e){let t=!1;return{promise:new Promise((n,i)=>{e.then(o=>!t&&n(o)).catch(o=>!t&&i(o))}),cancel(){t=!0}}}p();var Xz=["onCopy","onCut","onPaste"],Kz=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],Zz=["onFocus","onBlur"],Qz=["onInput","onInvalid","onReset","onSubmit"],Jz=["onLoad","onError"],t3=["onKeyDown","onKeyPress","onKeyUp"],e3=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],r3=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],n3=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],i3=["onSelect"],o3=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],s3=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],a3=["onScroll"],l3=["onWheel"],c3=["onAnimationStart","onAnimationEnd","onAnimationIteration"],u3=["onTransitionEnd"],d3=["onToggle"],f3=["onChange"],p3=[...Xz,...Kz,...Zz,...Qz,...Jz,...t3,...e3,...r3,...n3,...i3,...o3,...s3,...a3,...l3,...c3,...u3,...f3,...d3];function hd(e,t){let r={};for(let n of p3){let i=e[n];i&&(t?r[n]=(o=>i(o,t(n))):r[n]=i)}return r}p();var h3=!0,Wb="Invariant failed";function Ct(e,t){if(!e){if(h3)throw new Error(Wb);var r=typeof t=="function"?t():t,n=r?"".concat(Wb,": ").concat(r):Wb;throw new Error(n)}}var jl=D(Jo(),1);p();var oA=D(F(),1),g3=(0,oA.createContext)(null),Eh=g3;p();var y3="noopener noreferrer nofollow",md=class{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Ct(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){Ct(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}addLinkAttributes(t,r,n){t.href=r,t.rel=this.externalLinkRel||y3,t.target=n?"_blank":this.externalLinkTarget||""}goToDestination(t){return new Promise(r=>{Ct(this.pdfDocument,"PDF document not loaded."),Ct(t,"Destination is not specified."),typeof t=="string"?this.pdfDocument.getDestination(t).then(r):Array.isArray(t)?r(t):t.then(r)}).then(r=>{Ct(Array.isArray(r),`"${r}" is not a valid destination array.`);let n=r[0];new Promise(i=>{Ct(this.pdfDocument,"PDF document not loaded."),n instanceof Object?this.pdfDocument.getPageIndex(n).then(o=>{i(o)}).catch(()=>{Ct(!1,`"${n}" is not a valid page reference.`)}):typeof n=="number"?i(n):Ct(!1,`"${n}" is not a valid destination reference.`)}).then(i=>{let o=i+1;Ct(this.pdfViewer,"PDF viewer is not initialized."),Ct(o>=1&&o<=this.pagesCount,`"${o}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:r,pageIndex:i,pageNumber:o})})})}goToPage(t){let r=t-1;Ct(this.pdfViewer,"PDF viewer is not initialized."),Ct(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:r,pageNumber:t})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(t){this.goToDestination(t)}};p();var sA=D(Z(),1);function lo({children:e,type:t}){return(0,sA.jsx)("div",{className:`react-pdf__message react-pdf__message--${t}`,children:e})}p();var v3={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Yb=v3;p();var aA=D(F(),1);function b3(e,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return e}}function On(){return(0,aA.useReducer)(b3,{value:void 0,error:void 0})}p();var qb=D(Jo(),1),gd=typeof window<"u",lA=gd&&window.location.protocol==="file:";function x3(e){return typeof e<"u"}function Dn(e){return x3(e)&&e!==null}function S3(e){return typeof e=="string"}function cA(e){return e instanceof ArrayBuffer}function uA(e){return Ct(gd,"isBlob can only be used in a browser environment"),e instanceof Blob}function Ah(e){return S3(e)&&/^data:/.test(e)}function Xb(e){Ct(Ah(e),"Invalid data URI.");let[t="",r=""]=e.split(",");return t.split(";").indexOf("base64")!==-1?atob(r):unescape(r)}function dA(){return gd&&window.devicePixelRatio||1}var fA="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Kb(){(0,qb.default)(!lA,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${fA}`)}function pA(){(0,qb.default)(!lA,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${fA}`)}function cn(e){e?.cancel&&e.cancel()}function yd(e,t){return Object.defineProperty(e,"width",{get(){return this.getViewport({scale:t}).width},configurable:!0}),Object.defineProperty(e,"height",{get(){return this.getViewport({scale:t}).height},configurable:!0}),Object.defineProperty(e,"originalWidth",{get(){return this.getViewport({scale:1}).width},configurable:!0}),Object.defineProperty(e,"originalHeight",{get(){return this.getViewport({scale:1}).height},configurable:!0}),e}function _h(e){return e.name==="AbortException"||e.name==="RenderingCancelledException"}function hA(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{if(!n.result)return r(new Error("Error while reading a file."));t(n.result)},n.onerror=i=>{if(!i.target)return r(new Error("Error while reading a file."));let{error:o}=i.target;if(!o)return r(new Error("Error while reading a file."));switch(o.code){case o.NOT_FOUND_ERR:return r(new Error("Error while reading a file: File not found."));case o.SECURITY_ERR:return r(new Error("Error while reading a file: Security error."));case o.ABORT_ERR:return r(new Error("Error while reading a file: Aborted."));default:return r(new Error("Error while reading a file."))}},n.readAsArrayBuffer(e)})}var{PDFDataRangeTransport:T3}=Li,w3=(e,t)=>{switch(t){case Yb.NEED_PASSWORD:{let r=prompt("Enter the password to open this PDF file.");e(r);break}case Yb.INCORRECT_PASSWORD:{let r=prompt("Invalid password. Please try again.");e(r);break}default:}};function mA(e){return typeof e=="object"&&e!==null&&("data"in e||"range"in e||"url"in e)}var C3=(0,pe.forwardRef)(function({children:t,className:r,error:n="Failed to load PDF file.",externalLinkRel:i,externalLinkTarget:o,file:s,inputRef:a,imageResourcesPath:l,loading:c="Loading PDF…",noData:u="No PDF file specified.",onItemClick:d,onLoadError:f,onLoadProgress:h,onLoadSuccess:m,onPassword:y=w3,onSourceError:x,onSourceSuccess:g,options:v,renderMode:b,rotate:w,scale:T,...C},E){let[A,_]=On(),{value:P,error:k}=A,[I,M]=On(),{value:z,error:B}=I,R=(0,pe.useRef)(new md),L=(0,pe.useRef)([]),G=(0,pe.useRef)(void 0),U=(0,pe.useRef)(void 0);s&&s!==G.current&&mA(s)&&((0,jl.default)(!sa(s,G.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),G.current=s),v&&v!==U.current&&((0,jl.default)(!sa(v,U.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),U.current=v);let X=(0,pe.useRef)({scrollPageIntoView:Tt=>{let{dest:Nt,pageNumber:kt,pageIndex:te=kt-1}=Tt;if(d){d({dest:Nt,pageIndex:te,pageNumber:kt});return}let Xt=L.current[te];if(Xt){Xt.scrollIntoView();return}(0,jl.default)(!1,`An internal link leading to page ${kt} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});(0,pe.useImperativeHandle)(E,()=>({linkService:R,pages:L,viewer:X}),[]);function J(){g&&g()}function Y(){k&&((0,jl.default)(!1,k.toString()),x&&x(k))}function et(){_({type:"RESET"})}(0,pe.useEffect)(et,[s,_]);let ct=(0,pe.useCallback)(async()=>{if(!s)return null;if(typeof s=="string")return Ah(s)?{data:Xb(s)}:(Kb(),{url:s});if(s instanceof T3)return{range:s};if(cA(s))return{data:s};if(gd&&uA(s))return{data:await hA(s)};if(Ct(typeof s=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),Ct(mA(s),"Invalid parameter object: need either .data, .range or .url"),"url"in s&&typeof s.url=="string"){if(Ah(s.url)){let{url:Tt,...Nt}=s;return{data:Xb(Tt),...Nt}}Kb()}return s},[s]);(0,pe.useEffect)(()=>{let Tt=ui(ct());return Tt.promise.then(Nt=>{_({type:"RESOLVE",value:Nt})}).catch(Nt=>{_({type:"REJECT",error:Nt})}),()=>{cn(Tt)}},[ct,_]),(0,pe.useEffect)(()=>{if(!(typeof P>"u")){if(P===!1){Y();return}J()}},[P]);function St(){z&&(m&&m(z),L.current=new Array(z.numPages),R.current.setDocument(z))}function ot(){B&&((0,jl.default)(!1,B.toString()),f&&f(B))}(0,pe.useEffect)(function(){M({type:"RESET"})},[M,P]),(0,pe.useEffect)(function(){if(!P)return;let Nt=v?{...P,...v}:P,kt=wh(Nt);h&&(kt.onProgress=h),y&&(kt.onPassword=y);let te=kt;return te.promise.then(Xt=>{te.destroyed||M({type:"RESOLVE",value:Xt})}).catch(Xt=>{te.destroyed||M({type:"REJECT",error:Xt})}),()=>{te.destroy()}},[v,M,P]),(0,pe.useEffect)(()=>{if(!(typeof z>"u")){if(z===!1){ot();return}St()}},[z]),(0,pe.useEffect)(function(){R.current.setViewer(X.current),R.current.setExternalLinkRel(i),R.current.setExternalLinkTarget(o)},[i,o]);let q=(0,pe.useCallback)((Tt,Nt)=>{L.current[Tt]=Nt},[]),j=(0,pe.useCallback)(Tt=>{delete L.current[Tt]},[]),K=(0,pe.useMemo)(()=>({imageResourcesPath:l,linkService:R.current,onItemClick:d,pdf:z,registerPage:q,renderMode:b,rotate:w,scale:T,unregisterPage:j}),[l,d,z,q,b,w,T,j]),nt=(0,pe.useMemo)(()=>hd(C,()=>z),[C,z]);function mt(){function Tt(kt){return!!kt?.pdf}if(!Tt(K))throw new Error("pdf is undefined");let Nt=typeof t=="function"?t(K):t;return(0,$l.jsx)(Eh.Provider,{value:K,children:Nt})}function lt(){return s?z==null?(0,$l.jsx)(lo,{type:"loading",children:typeof c=="function"?c():c}):z===!1?(0,$l.jsx)(lo,{type:"error",children:typeof n=="function"?n():n}):mt():(0,$l.jsx)(lo,{type:"no-data",children:typeof u=="function"?u():u})}return(0,$l.jsx)("div",{className:Lt("react-pdf__Document",r),ref:a,...nt,children:lt()})}),Ph=C3;p();var gA=D(F(),1);function aa(){return(0,gA.useContext)(Eh)}p();var di=D(Z(),1),fi=D(F(),1);rr();p();function vd(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(Boolean);if(r.length<=1){var n=r[0];return n||null}return function(o){for(var s=0,a=r;s<a.length;s++){var l=a[s];typeof l=="function"?l(o):l&&(l.current=o)}}}var OA=D(Jo(),1);p();var bA=D(Z(),1),uo=D(F(),1);rr();var kh=D(Jo(),1);p();var vA=D(F(),1);p();var yA=D(F(),1),E3=(0,yA.createContext)(null),Rh=E3;function co(){return(0,vA.useContext)(Rh)}function Zb(){let e=aa(),t=co();Ct(t,"Unable to find Page context.");let r={...e,...t},{filterAnnotations:n,imageResourcesPath:i,linkService:o,onGetAnnotationsError:s,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:l,onRenderAnnotationLayerSuccess:c,page:u,pdf:d,renderForms:f,rotate:h,scale:m=1}=r;Ct(d,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Ct(u,"Attempted to load page annotations, but no page was specified."),Ct(o,"Attempted to load page annotations, but no linkService was specified.");let[y,x]=On(),{value:g,error:v}=y,b=(0,uo.useRef)(null);(0,kh.default)(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function w(){g&&a&&a(g)}function T(){v&&((0,kh.default)(!1,v.toString()),s&&s(v))}(0,uo.useEffect)(function(){x({type:"RESET"})},[x,u]),(0,uo.useEffect)(function(){if(!u)return;let P=ui(u.getAnnotations()),k=P;return P.promise.then(I=>{x({type:"RESOLVE",value:I})}).catch(I=>{x({type:"REJECT",error:I})}),()=>{cn(k)}},[x,u]),(0,uo.useEffect)(()=>{if(g!==void 0){if(g===!1){T();return}w()}},[g]);function C(){c&&c()}function E(_){(0,kh.default)(!1,`${_}`),l&&l(_)}let A=(0,uo.useMemo)(()=>u.getViewport({scale:m,rotation:h}),[u,h,m]);return(0,uo.useEffect)(function(){if(!d||!u||!o||!g)return;let{current:P}=b;if(!P)return;let k=A.clone({dontFlip:!0}),I={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:d.annotationStorage,commentManager:null,div:P,l10n:null,linkService:o,page:u,structTreeLayer:null,viewport:k},M={annotations:n?n({annotations:g}):g,annotationStorage:d.annotationStorage,div:P,imageResourcesPath:i,linkService:o,page:u,renderForms:f,viewport:k};P.innerHTML="";try{new Bl(I).render(M),C()}catch(z){E(z)}return()=>{}},[g,n,i,o,u,d,f,A]),(0,bA.jsx)("div",{className:Lt("react-pdf__Page__annotations","annotationLayer"),ref:b})}p();var nx=D(Z(),1),Ni=D(F(),1);var AA=D(Jo(),1);p();var wA=D(Z(),1),Dh=D(F(),1);var CA=D(Jo(),1);p();var tx=D(Z(),1),ex=D(F(),1);p();p();var Qb={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},xA=/^H(\d+)$/;function A3(e){return e in Qb}function bd(e){return"children"in e}function Jb(e){return bd(e)?e.children.length===1&&0 in e.children&&"id"in e.children[0]:!1}function _3(e){let t={};if(bd(e)){let{role:r}=e,n=r.match(xA);if(n)t.role="heading",t["aria-level"]=Number(n[1]);else if(A3(r)){let i=Qb[r];i&&(t.role=i)}}return t}function SA(e){let t={};if(bd(e)){if(e.alt!==void 0&&(t["aria-label"]=e.alt),e.lang!==void 0&&(t.lang=e.lang),Jb(e)){let[r]=e.children;if(r){let n=SA(r);return{...t,...n}}}}else"id"in e&&(t["aria-owns"]=e.id);return t}function TA(e){return e?{..._3(e),...SA(e)}:null}function Oh({className:e,node:t}){let r=(0,ex.useMemo)(()=>TA(t),[t]),n=(0,ex.useMemo)(()=>!bd(t)||Jb(t)?null:t.children.map((i,o)=>(0,tx.jsx)(Oh,{node:i},o)),[t]);return(0,tx.jsx)("span",{className:e,...r,children:n})}function rx(){let e=co();Ct(e,"Unable to find Page context.");let{onGetStructTreeError:t,onGetStructTreeSuccess:r}=e,[n,i]=On(),{value:o,error:s}=n,{customTextRenderer:a,page:l}=e;function c(){o&&r&&r(o)}function u(){s&&((0,CA.default)(!1,s.toString()),t&&t(s))}return(0,Dh.useEffect)(function(){i({type:"RESET"})},[i,l]),(0,Dh.useEffect)(function(){if(a||!l)return;let f=ui(l.getStructTree()),h=f;return f.promise.then(m=>{i({type:"RESOLVE",value:m})}).catch(m=>{i({type:"REJECT",error:m})}),()=>cn(h)},[a,l,i]),(0,Dh.useEffect)(()=>{if(o!==void 0){if(o===!1){u();return}c()}},[o]),o?(0,wA.jsx)(Oh,{className:"react-pdf__Page__structTree structTree",node:o}):null}var EA=li;function ix(e){let t=co();Ct(t,"Unable to find Page context.");let r={...t,...e},{_className:n,canvasBackground:i,devicePixelRatio:o=dA(),onRenderError:s,onRenderSuccess:a,page:l,renderForms:c,renderTextLayer:u,pageColors:d,rotate:f,scale:h}=r,{canvasRef:m}=e;Ct(l,"Attempted to render page canvas, but no page was specified.");let y=(0,Ni.useRef)(null);function x(){l&&a&&a(yd(l,h))}function g(T){_h(T)||((0,AA.default)(!1,T.toString()),s&&s(T))}let v=(0,Ni.useMemo)(()=>l.getViewport({scale:h*o,rotation:f}),[o,l,f,h]),b=(0,Ni.useMemo)(()=>l.getViewport({scale:h,rotation:f}),[l,f,h]);(0,Ni.useEffect)(function(){if(!l)return;l.cleanup();let{current:C}=y;if(!C)return;C.width=v.width,C.height=v.height,C.style.width=`${Math.floor(b.width)}px`,C.style.height=`${Math.floor(b.height)}px`,C.style.visibility="hidden";let E={annotationMode:c?EA.ENABLE_FORMS:EA.ENABLE,canvas:C,canvasContext:C.getContext("2d",{alpha:!1}),pageColors:d,viewport:v};i&&(E.background=i);let A=l.render(E),_=A;return A.promise.then(()=>{C.style.visibility="",x()}).catch(g),()=>cn(_)},[i,l,d,c,v,b]);let w=(0,Ni.useCallback)(()=>{let{current:T}=y;T&&(T.width=0,T.height=0)},[]);return(0,Ni.useEffect)(()=>w,[w]),(0,nx.jsx)("canvas",{className:`${n}__canvas`,dir:"ltr",ref:vd(m,y),style:{display:"block",userSelect:"none"},children:u?(0,nx.jsx)(rx,{}):null})}p();var _A=D(Z(),1),un=D(F(),1);rr();var Mh=D(Jo(),1);function P3(e){return"str"in e}var R3=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),k3=new Set(["action","formaction","href","poster","src","xlink:href"]);function O3(e){let t="";for(let r of e){let n=r.charCodeAt(0);n<=32||n===127||(t+=r.toLowerCase())}return t.startsWith("javascript:")||t.startsWith("vbscript:")}function D3(e){return e.nodeType===Node.ELEMENT_NODE}function PA(e){return D3(e)&&e instanceof HTMLElement}function M3(e){return PA(e)&&R3.has(e.tagName.toLowerCase())}function L3(e){let t=document.createElement(e.tagName.toLowerCase());return Array.from(e.attributes).forEach(r=>{let n=r.name.toLowerCase();n.startsWith("on")||n==="srcdoc"||k3.has(n)&&O3(r.value)||t.setAttribute(r.name,r.value)}),Array.from(e.childNodes).forEach(r=>{t.append(RA(r))}),t}function RA(e){var t;return PA(e)&&!M3(e)?L3(e):document.createTextNode((t=e.textContent)!==null&&t!==void 0?t:"")}function N3(e,t){let r=document.createElement("template");r.innerHTML=t;let n=document.createDocumentFragment();Array.from(r.content.childNodes).forEach(i=>{n.append(RA(i))}),e.replaceChildren(n)}function ox(){let e=co();Ct(e,"Unable to find Page context.");let{customTextRenderer:t,onGetTextError:r,onGetTextSuccess:n,onRenderTextLayerError:i,onRenderTextLayerSuccess:o,page:s,pageIndex:a,pageNumber:l,rotate:c,scale:u}=e;Ct(s,"Attempted to load page text content, but no page was specified.");let[d,f]=On(),{value:h,error:m}=d,y=(0,un.useRef)(null);(0,Mh.default)(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function x(){h&&n&&n(h)}function g(){m&&((0,Mh.default)(!1,m.toString()),r&&r(m))}(0,un.useEffect)(function(){f({type:"RESET"})},[s,f]),(0,un.useEffect)(function(){if(!s)return;let A=ui(s.getTextContent()),_=A;return A.promise.then(P=>{f({type:"RESOLVE",value:P})}).catch(P=>{f({type:"REJECT",error:P})}),()=>cn(_)},[s,f]),(0,un.useEffect)(()=>{if(h!==void 0){if(h===!1){g();return}x()}},[h]);let v=(0,un.useCallback)(()=>{o&&o()},[o]),b=(0,un.useCallback)(E=>{_h(E)||((0,Mh.default)(!1,E.toString()),i&&i(E))},[i]);function w(){let E=y.current;E&&E.classList.add("selecting")}function T(){let E=y.current;E&&E.classList.remove("selecting")}let C=(0,un.useMemo)(()=>s.getViewport({scale:u,rotation:c}),[s,c,u]);return(0,un.useLayoutEffect)(function(){if(!s||!h)return;let{current:A}=y;if(!A)return;A.innerHTML="";let _=s.streamTextContent({includeMarkedContent:!0}),P={container:A,textContentSource:_,viewport:C},k=new Qo(P),I=k;return k.render().then(()=>{let M=document.createElement("div");M.className="endOfContent",A.append(M);let z=A.querySelectorAll('[role="presentation"]');if(t){let B=0;h.items.forEach((R,L)=>{if(!P3(R))return;let G=z[B];if(!G)return;let U=t({pageIndex:a,pageNumber:l,itemIndex:L,...R});N3(G,U),B+=R.str&&R.hasEOL?2:1})}v()}).catch(b),()=>cn(I)},[t,b,v,s,a,l,h,C]),(0,_A.jsx)("div",{className:Lt("react-pdf__Page__textContent","textLayer"),onMouseUp:T,onMouseDown:w,ref:y})}var kA=1;function Hl(e){let r={...aa(),...e},{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:o,canvasRef:s,children:a,className:l,customRenderer:c,customTextRenderer:u,devicePixelRatio:d,error:f="Failed to load the page.",filterAnnotations:h,height:m,inputRef:y,loading:x="Loading page…",noData:g="No page specified.",onGetAnnotationsError:v,onGetAnnotationsSuccess:b,onGetStructTreeError:w,onGetStructTreeSuccess:T,onGetTextError:C,onGetTextSuccess:E,onLoadError:A,onLoadSuccess:_,onRenderAnnotationLayerError:P,onRenderAnnotationLayerSuccess:k,onRenderError:I,onRenderSuccess:M,onRenderTextLayerError:z,onRenderTextLayerSuccess:B,pageColors:R,pageIndex:L,pageNumber:G,pdf:U,registerPage:X,renderAnnotationLayer:J=!0,renderForms:Y=!1,renderMode:et="canvas",renderTextLayer:ct=!0,rotate:St,scale:ot=kA,unregisterPage:q,width:j,...K}=r,[nt,mt]=On(),{value:lt,error:Tt}=nt,Nt=(0,fi.useRef)(null);Ct(U,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");let kt=Dn(G)?G-1:L??null,te=G??(Dn(L)?L+1:null),Xt=St??(lt?lt.rotate:null),Ut=(0,fi.useMemo)(()=>{if(!lt)return null;let ee=1,ae=ot??kA;if(j||m){let hr=lt.getViewport({scale:1,rotation:Xt});j?ee=j/hr.width:m&&(ee=m/hr.height)}return ae*ee},[m,lt,Xt,ot,j]);(0,fi.useEffect)(function(){return()=>{Dn(kt)&&i&&q&&q(kt)}},[i,U,kt,q]);function Pi(){if(_){if(!lt||!Ut)return;_(yd(lt,Ut))}if(i&&X){if(!Dn(kt)||!Nt.current)return;X(kt,Nt.current)}}function Ar(){Tt&&((0,OA.default)(!1,Tt.toString()),A&&A(Tt))}(0,fi.useEffect)(function(){mt({type:"RESET"})},[mt,U,kt]),(0,fi.useEffect)(function(){if(!U||!te)return;let ae=ui(U.getPage(te)),hr=ae;return ae.promise.then(Ks=>{mt({type:"RESOLVE",value:Ks})}).catch(Ks=>{mt({type:"REJECT",error:Ks})}),()=>cn(hr)},[mt,U,te]),(0,fi.useEffect)(()=>{if(lt!==void 0){if(lt===!1){Ar();return}Pi()}},[lt,Ut]);let Lr=(0,fi.useMemo)(()=>Dn(kt)&&te&&Dn(Xt)&&Dn(Ut)?{_className:n,canvasBackground:o,customTextRenderer:u,devicePixelRatio:d,filterAnnotations:h,onGetAnnotationsError:v,onGetAnnotationsSuccess:b,onGetStructTreeError:w,onGetStructTreeSuccess:T,onGetTextError:C,onGetTextSuccess:E,onRenderAnnotationLayerError:P,onRenderAnnotationLayerSuccess:k,onRenderError:I,onRenderSuccess:M,onRenderTextLayerError:z,onRenderTextLayerSuccess:B,page:lt,pageColors:R,pageIndex:kt,pageNumber:te,renderForms:Y,renderTextLayer:ct,rotate:Xt,scale:Ut}:null,[n,o,u,d,h,v,b,w,T,C,E,P,k,I,M,z,B,lt,R,kt,te,Y,ct,Xt,Ut]),oi=(0,fi.useMemo)(()=>hd(K,()=>lt&&(Ut?yd(lt,Ut):void 0)),[K,lt,Ut]),Ee=`${kt}@${Ut}/${Xt}`;function Ur(){switch(et){case"custom":return Ct(c,'renderMode was set to "custom", but no customRenderer was passed.'),(0,di.jsx)(c,{},`${Ee}_custom`);case"none":return null;default:return(0,di.jsx)(ix,{canvasRef:s},`${Ee}_canvas`)}}function H(){return ct?(0,di.jsx)(ox,{},`${Ee}_text`):null}function st(){return J?(0,di.jsx)(Zb,{},`${Ee}_annotations`):null}function er(){function ee(hr){return!!hr?.page}if(!ee(Lr))throw new Error("page is undefined");let ae=typeof a=="function"?a(Lr):a;return(0,di.jsxs)(Rh.Provider,{value:Lr,children:[Ur(),H(),st(),ae]})}function pr(){return te?U===null||lt===void 0||lt===null?(0,di.jsx)(lo,{type:"loading",children:typeof x=="function"?x():x}):U===!1||lt===!1?(0,di.jsx)(lo,{type:"error",children:typeof f=="function"?f():f}):er():(0,di.jsx)(lo,{type:"no-data",children:typeof g=="function"?g():g})}return(0,di.jsx)("div",{className:Lt(n,l),"data-page-number":te,ref:vd(y,Nt),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${Ut}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:o||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...oi,children:pr()})}p();var sx=D(Z(),1);rr();function Lh(e){let r={...aa(),...e},{className:n,linkService:i,onItemClick:o,pageIndex:s,pageNumber:a,pdf:l}=r;Ct(l,"Attempted to load a thumbnail, but no document was specified. Wrap <Thumbnail /> in a <Document /> or pass explicit `pdf` prop.");let c=Dn(a)?a-1:s??null,u=a??(Dn(s)?s+1:null);function d(y){y.preventDefault(),!(!Dn(c)||!u)&&(Ct(o||i,"Either onItemClick callback or linkService must be defined in order to navigate to an outline item."),o?o({pageIndex:c,pageNumber:u}):i&&i.goToPage(u))}let{className:f,onItemClick:h,...m}=e;return(0,sx.jsx)("a",{className:Lt("react-pdf__Thumbnail",n),href:u?"#":void 0,onClick:d,children:(0,sx.jsx)(Hl,{...m,_className:"react-pdf__Thumbnail__page",_enableRegisterUnregisterPage:!1,renderAnnotationLayer:!1,renderTextLayer:!1})})}pA();Di.workerSrc="pdf.worker.mjs";p();p();var nF=D(F(),1);p();var Cd=D(F(),1);p();var ft=e=>typeof e=="string",xd=()=>{let e,t,r=new Promise((n,i)=>{e=n,t=i});return r.resolve=e,r.reject=t,r},DA=e=>e==null?"":String(e),I3=(e,t,r)=>{e.forEach(n=>{t[n]&&(r[n]=t[n])})},B3=/###/g,MA=e=>e&&e.includes("###")?e.replace(B3,"."):e,LA=e=>!e||ft(e),Sd=(e,t,r)=>{let n=ft(t)?t.split("."):t,i=0;for(;i<n.length-1;){if(LA(e))return{};let o=MA(n[i]);!e[o]&&r&&(e[o]=new r),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++i}return LA(e)?{}:{obj:e,k:MA(n[i])}},NA=(e,t,r)=>{let{obj:n,k:i}=Sd(e,t,Object);if(n!==void 0||t.length===1){n[i]=r;return}let o=t[t.length-1],s=t.slice(0,t.length-1),a=Sd(e,s,Object);for(;a.obj===void 0&&s.length;)o=`${s[s.length-1]}.${o}`,s=s.slice(0,s.length-1),a=Sd(e,s,Object),a?.obj&&typeof a.obj[`${a.k}.${o}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${o}`]=r},z3=(e,t,r,n)=>{let{obj:i,k:o}=Sd(e,t,Object);i[o]=i[o]||[],i[o].push(r)},Ih=(e,t)=>{let{obj:r,k:n}=Sd(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},F3=(e,t,r)=>{let n=Ih(e,r);return n!==void 0?n:Ih(t,r)},jA=(e,t,r)=>{for(let n in t)n!=="__proto__"&&n!=="constructor"&&(n in e?ft(e[n])||e[n]instanceof String||ft(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):jA(e[n],t[n],r):e[n]=t[n]);return e},fo=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),$3={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},j3=e=>ft(e)?e.replace(/[&<>"'\/]/g,t=>$3[t]):e,ux=class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){let r=this.regExpMap.get(t);if(r!==void 0)return r;let n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}},H3=[" ",",","?","!",";"],U3=new ux(20),V3=(e,t,r)=>{t=t||"",r=r||"";let n=H3.filter(s=>!t.includes(s)&&!r.includes(s));if(n.length===0)return!0;let i=U3.getRegExp(`(${n.map(s=>s==="?"?"\\?":s).join("|")})`),o=!i.test(e);if(!o){let s=e.indexOf(r);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o},dx=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let n=t.split(r),i=e;for(let o=0;o<n.length;){if(!i||typeof i!="object")return;let s,a="";for(let l=o;l<n.length;++l)if(l!==o&&(a+=r),a+=n[l],s=i[a],s!==void 0){if(["string","number","boolean"].includes(typeof s)&&l<n.length-1)continue;o+=l-o+1;break}i=s}return i},Td=e=>e?.replace(/_/g,"-"),G3={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}},fx=class e{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||G3,this.options=r,this.debug=r.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,n,i){return i&&!this.debug?null:(t=t.map(o=>ft(o)?o.replace(/[\r\n\x00-\x1F\x7F]/g," "):o),ft(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Ii=new fx,Ul=class{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let i=this.observers[n].get(r)||0;this.observers[n].set(r,i+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}once(t,r){let n=(...i)=>{r(...i),this.off(t,n)};return this.on(t,n),this}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([i,o])=>{for(let s=0;s<o;s++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,o])=>{for(let s=0;s<o;s++)i(t,...r)})}},Bh=class extends Ul{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){let r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,n,i={}){let o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,a;t.includes(".")?a=t.split("."):(a=[t,r],n&&(Array.isArray(n)?a.push(...n):ft(n)&&o?a.push(...n.split(o)):a.push(n)));let l=Ih(this.data,a);return!l&&!r&&!n&&t.includes(".")&&(t=a[0],r=a[1],n=a.slice(2).join(".")),l||!s||!ft(n)?l:dx(this.data?.[t]?.[r],n,o)}addResource(t,r,n,i,o={silent:!1}){let s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,a=[t,r];n&&(a=a.concat(s?n.split(s):n)),t.includes(".")&&(a=t.split("."),i=r,r=a[1]),this.addNamespaces(r),NA(this.data,a,i),o.silent||this.emit("added",t,r,n,i)}addResources(t,r,n,i={silent:!1}){for(let o in n)(ft(n[o])||Array.isArray(n[o]))&&this.addResource(t,r,o,n[o],{silent:!0});i.silent||this.emit("added",t,r,n)}addResourceBundle(t,r,n,i,o,s={silent:!1,skipCopy:!1}){let a=[t,r];t.includes(".")&&(a=t.split("."),i=n,n=r,r=a[1]),this.addNamespaces(r);let l=Ih(this.data,a)||{};s.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?jA(l,n,o):l={...l,...n},NA(this.data,a,l),s.silent||this.emit("added",t,r,n)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){let r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},HA={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(o=>{t=this.processors[o]?.process(t,r,n,i)??t}),t}},UA=Symbol("i18next/PATH_KEY");function W3(){let e=[],t=Object.create(null),r;return t.get=(n,i)=>(r?.revoke?.(),i===UA?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}function la(e,t){let{[UA]:r}=e(W3()),n=t?.keySeparator??".",i=t?.nsSeparator??":",o=t?.enableSelector==="strict";if(r.length>1&&i){let s=t?.ns,a=o?Array.isArray(s)?s:s?[s]:null:Array.isArray(s)?s:null;if(a&&(o?a:a.length>1?a.slice(1):[]).includes(r[0]))return`${r[0]}${i}${r.slice(1).join(n)}`}return r.join(n)}var ax=e=>!ft(e)&&typeof e!="boolean"&&typeof e!="number",zh=class e extends Ul{constructor(t,r={}){super(),I3(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ii.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){let n={...r};if(t==null)return!1;let i=this.resolve(t,n);if(i?.res===void 0)return!1;let o=ax(i.res);return!(n.returnObjects===!1&&o)}extractFromKey(t,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");let i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,o=r.ns||this.options.defaultNS||[],s=n&&t.includes(n),a=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!V3(t,n,i);if(s&&!a){let l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:ft(o)?[o]:o};let c=t.split(n);(n!==i||n===i&&this.options.ns.includes(c[0]))&&(o=c.shift()),t=c.join(i)}return{key:t,namespaces:ft(o)?[o]:o}}translate(t,r,n){let i=typeof r=="object"?{...r}:r;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),t==null)return"";typeof t=="function"&&(t=la(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(M=>typeof M=="function"?la(M,{...this.options,...i}):String(M));let o=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],i),c=l[l.length-1],u=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return f?o?{res:`${c}${u}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:`${c}${u}${a}`:o?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:a;let h=this.resolve(t,i),m=h?.res,y=h?.usedKey||a,x=h?.exactUsedKey||a,g=["[object Number]","[object Function]","[object RegExp]"],v=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,w=i.count!==void 0&&!ft(i.count),T=e.hasDefaultValue(i),C=w?this.pluralResolver.getSuffix(d,i.count,i):"",E=i.ordinal&&w?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):"",A=w&&!i.ordinal&&i.count===0,_=A&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${C}`]||i[`defaultValue${E}`]||i.defaultValue,P=m;b&&!m&&T&&(P=_);let k=ax(P),I=Object.prototype.toString.apply(P);if(b&&P&&k&&!g.includes(I)&&!(ft(v)&&Array.isArray(P))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,P,{...i,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return o?(h.res=M,h.usedParams=this.getUsedParamsDetails(i),h):M}if(s){let M=Array.isArray(P),z=M?[]:{},B=M?x:y;for(let R in P)if(Object.prototype.hasOwnProperty.call(P,R)){let L=`${B}${s}${R}`;T&&!m?z[R]=this.translate(L,{...i,defaultValue:ax(_)?_[R]:void 0,joinArrays:!1,ns:l}):z[R]=this.translate(L,{...i,joinArrays:!1,ns:l}),z[R]===L&&(z[R]=P[R])}m=z}}else if(b&&ft(v)&&Array.isArray(m))m=m.join(v),m&&(m=this.extendTranslation(m,t,i,n));else{let M=!1,z=!1;!this.isValidLookup(m)&&T&&(M=!0,m=_),this.isValidLookup(m)||(z=!0,m=a);let R=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&z?void 0:m,L=T&&_!==m&&this.options.updateMissing;if(z||M||L){if(this.logger.log(L?"updateKey":"missingKey",d,c,w&&!L?`${a}${this.pluralResolver.getSuffix(d,i.count,i)}`:a,L?_:m),s){let J=this.resolve(a,{...i,keySeparator:!1});J&&J.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let G=[],U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let J=0;J<U.length;J++)G.push(U[J]);else this.options.saveMissingTo==="all"?G=this.languageUtils.toResolveHierarchy(i.lng||this.language):G.push(i.lng||this.language);let X=(J,Y,et)=>{let ct=T&&et!==m?et:R;this.options.missingKeyHandler?this.options.missingKeyHandler(J,c,Y,ct,L,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(J,c,Y,ct,L,i),this.emit("missingKey",J,c,Y,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?G.forEach(J=>{let Y=this.pluralResolver.getSuffixes(J,i);A&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!Y.includes(`${this.options.pluralSeparator}zero`)&&Y.push(`${this.options.pluralSeparator}zero`),Y.forEach(et=>{X([J],a+et,i[`defaultValue${et}`]||_)})}):X(G,a,_))}m=this.extendTranslation(m,t,i,h,n),z&&m===a&&this.options.appendNamespaceToMissingKey&&(m=`${c}${u}${a}`),(z||M)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${u}${a}`:a,M?m:void 0,i))}return o?(h.res=m,h.usedParams=this.getUsedParamsDetails(i),h):m}extendTranslation(t,r,n,i,o){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let l=ft(t)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),c;if(l){let d=t.match(this.interpolator.nestingRegexp);c=d&&d.length}let u=n.replace&&!ft(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),t=this.interpolator.interpolate(t,u,n.lng||this.language||i.usedLng,n),l){let d=t.match(this.interpolator.nestingRegexp),f=d&&d.length;c<f&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(t=this.interpolator.nest(t,(...d)=>o?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}let s=n.postProcess||this.options.postProcess,a=ft(s)?[s]:s;return t!=null&&a?.length&&n.applyPostProcessor!==!1&&(t=HA.handle(a,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t,r={}){let n,i,o,s,a;return ft(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(l=>typeof l=="function"?la(l,{...this.options,...r}):l)),t.forEach(l=>{if(this.isValidLookup(n))return;let c=this.extractFromKey(l,r),u=c.key;i=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));let f=r.count!==void 0&&!ft(r.count),h=f&&!r.ordinal&&r.count===0,m=r.context!==void 0&&(ft(r.context)||typeof r.context=="number")&&r.context!=="",y=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(x=>{this.isValidLookup(n)||(a=x,!this.checkedLoadedFor[`${y[0]}-${x}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(this.checkedLoadedFor[`${y[0]}-${x}`]=!0,this.logger.warn(`key "${i}" for languages "${y.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(g=>{if(this.isValidLookup(n))return;s=g;let v=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,g,x,r);else{let w;f&&(w=this.pluralResolver.getSuffix(g,r.count,r));let T=`${this.options.pluralSeparator}zero`,C=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&w.startsWith(C)&&v.push(u+w.replace(C,this.options.pluralSeparator)),v.push(u+w),h&&v.push(u+T)),m){let E=`${u}${this.options.contextSeparator||"_"}${r.context}`;v.push(E),f&&(r.ordinal&&w.startsWith(C)&&v.push(E+w.replace(C,this.options.pluralSeparator)),v.push(E+w),h&&v.push(E+T))}}let b;for(;b=v.pop();)this.isValidLookup(n)||(o=b,n=this.getResource(g,x,b,r))}))})}),{res:n,usedKey:i,exactUsedKey:o,usedLng:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,r,n,i):this.resourceStore.getResource(t,r,n,i)}getUsedParamsDetails(t={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!ft(t.replace),i=n?t.replace:t;if(n&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let o of r)delete i[o]}return i}static hasDefaultValue(t){let r="defaultValue";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.startsWith(r)&&t[n]!==void 0)return!0;return!1}},Fh=class{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ii.create("languageUtils")}getScriptPartFromCode(t){if(t=Td(t),!t||!t.includes("-"))return null;let r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=Td(t),!t||!t.includes("-"))return t;let r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(ft(t)&&t.includes("-")){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&t.forEach(n=>{if(r)return;let i=this.getScriptPartFromCode(n);if(this.isSupportedCode(i))return r=i;let o=this.getLanguagePartFromCode(n);if(this.isSupportedCode(o))return r=o;r=this.options.supportedLngs.find(s=>s===o?!0:!s.includes("-")&&!o.includes("-")?!1:!!(s.includes("-")&&!o.includes("-")&&s.slice(0,s.indexOf("-"))===o||s.startsWith(o)&&o.length>1))}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),ft(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let n=t[r];return n||(n=t[this.getScriptPartFromCode(r)]),n||(n=t[this.formatLanguageCode(r)]),n||(n=t[this.getLanguagePartFromCode(r)]),n||(n=t.default),n||[]}toResolveHierarchy(t,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],t),i=[],o=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return ft(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):ft(t)&&o(this.formatLanguageCode(t)),n.forEach(s=>{i.includes(s)||o(this.formatLanguageCode(s))}),i}},IA={zero:0,one:1,two:2,few:3,many:4,other:5},BA={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},px=class{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=Ii.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){let n=Td(t==="dev"?"en":t),i=r.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let s;try{s=new Intl.PluralRules(n,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),BA;if(!t.match(/-|_/))return BA;let l=this.languageUtils.getLanguagePartFromCode(t);s=this.getRule(l,r)}return this.pluralRulesCache[o]=s,s}needsPlural(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,r,n={}){return this.getSuffixes(t,n).map(i=>`${r}${i}`)}getSuffixes(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,o)=>IA[i]-IA[o]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(t,r,n={}){let i=this.getRule(t,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,n))}},zA=(e,t,r,n=".",i=!0)=>{let o=F3(e,t,r);return!o&&i&&ft(r)&&(o=dx(e,r,n),o===void 0&&(o=dx(t,r,n))),o},lx=e=>e.replace(/\$/g,"$$$$"),$h=class{constructor(t={}){this.logger=Ii.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});let{escape:r,escapeValue:n,useRawValueToEscape:i,prefix:o,prefixEscaped:s,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:m,nestingSuffixEscaped:y,nestingOptionsSeparator:x,maxReplaces:g,alwaysFormat:v}=t.interpolation;this.escape=r!==void 0?r:j3,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=o?fo(o):s||"{{",this.suffix=a?fo(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":d?fo(d):"-",this.unescapeSuffix=this.unescapePrefix?"":u?fo(u):"",this.nestingPrefix=f?fo(f):h||fo("$t("),this.nestingSuffix=m?fo(m):y||fo(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=g||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let t=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,r,n,i){let o,s,a,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=h=>{if(!h.includes(this.formatSeparator)){let g=zA(r,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,n,{...i,...r,interpolationkey:h}):g}let m=h.split(this.formatSeparator),y=m.shift().trim(),x=m.join(this.formatSeparator).trim();return this.format(zA(r,l,y,this.options.keySeparator,this.options.ignoreJSONStructure),x,n,{...i,...r,interpolationkey:y})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");let u=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>lx(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?lx(this.escape(h)):lx(h)}].forEach(h=>{for(a=0;o=h.regex.exec(t);){let m=o[1].trim();if(s=c(m),s===void 0)if(typeof u=="function"){let x=u(t,o,i);s=ft(x)?x:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))s="";else if(d){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),s="";else!ft(s)&&!this.useRawValueToEscape&&(s=DA(s));let y=h.safeValue(s);if(t=t.replace(o[0],y),d?(h.regex.lastIndex+=s.length,h.regex.lastIndex-=o[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,r,n={}){let i,o,s,a=(l,c)=>{let u=this.nestingOptionsSeparator;if(!l.includes(u))return l;let d=l.split(new RegExp(`${fo(u)}[ ]*{`)),f=`{${d[1]}`;l=d[0],f=this.interpolate(f,s);let h=f.match(/'/g),m=f.match(/"/g);((h?.length??0)%2===0&&!m||(m?.length??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),c&&(s={...c,...s})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,y),`${l}${u}${f}`}return s.defaultValue&&s.defaultValue.includes(this.prefix)&&delete s.defaultValue,l};for(;i=this.nestingRegexp.exec(t);){let l=[];s={...n},s=s.replace&&!ft(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let c=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(c!==-1&&(l=i[1].slice(c).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),i[1]=i[1].slice(0,c)),o=r(a.call(this,i[1].trim(),s),s),o&&i[0]===t&&!ft(o))return o;ft(o)||(o=DA(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),l.length&&(o=l.reduce((u,d)=>this.format(u,d,n.lng,{...n,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}},Y3=e=>{let t=e.toLowerCase().trim(),r={};if(e.includes("(")){let n=e.split("(");t=n[0].toLowerCase().trim();let i=n[1].slice(0,-1);t==="currency"&&!i.includes(":")?r.currency||(r.currency=i.trim()):t==="relativetime"&&!i.includes(":")?r.range||(r.range=i.trim()):i.split(";").forEach(s=>{if(s){let[a,...l]=s.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=a.trim();r[u]||(r[u]=c),c==="false"&&(r[u]=!1),c==="true"&&(r[u]=!0),isNaN(c)||(r[u]=parseInt(c,10))}})}return{formatName:t,formatOptions:r}},FA=e=>{let t={};return(r,n,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});let s=n+JSON.stringify(o),a=t[s];return a||(a=e(Td(n),i),t[s]=a),a(r)}},q3=e=>(t,r,n)=>e(Td(r),n)(t),hx=class{constructor(t={}){this.logger=Ii.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?FA:q3;this.formats={number:n((i,o)=>{let s=new Intl.NumberFormat(i,{...o});return a=>s.format(a)}),currency:n((i,o)=>{let s=new Intl.NumberFormat(i,{...o,style:"currency"});return a=>s.format(a)}),datetime:n((i,o)=>{let s=new Intl.DateTimeFormat(i,{...o});return a=>s.format(a)}),relativetime:n((i,o)=>{let s=new Intl.RelativeTimeFormat(i,{...o});return a=>s.format(a,o.range||"day")}),list:n((i,o)=>{let s=new Intl.ListFormat(i,{...o});return a=>s.format(a)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=FA(r)}format(t,r,n,i={}){if(!r||t==null)return t;let o=r.split(this.formatSeparator),s=[];for(let l=0;l<o.length;l++){let c=o[l];for(;c.indexOf("(")>-1&&!c.includes(")")&&l+1<o.length;)c=`${c}${this.formatSeparator}${o[++l]}`;s.push(c)}return s.reduce((l,c)=>{let{formatName:u,formatOptions:d}=Y3(c);if(this.formats[u]){let f=l;try{let h=i?.formatParams?.[i.interpolationkey]||{},m=h.locale||h.lng||i.locale||i.lng||n;f=this.formats[u](l,m,{...d,...i,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${u}`);return l},t)}},X3=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},mx=class extends Ul{constructor(t,r,n,i={}){super(),this.backend=t,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=Ii.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,i.backend,i)}queueLoad(t,r,n,i){let o={},s={},a={},l={};return t.forEach(c=>{let u=!0;r.forEach(d=>{let f=`${c}|${d}`;!n.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,u=!1,s[f]===void 0&&(s[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(a[c]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,r,n){let i=t.split("|"),o=i[0],s=i[1];r&&this.emit("failedLoading",o,s,r),!r&&n&&this.store.addResourceBundle(o,s,n,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&n&&(this.state[t]=0);let a={};this.queue.forEach(l=>{z3(l.loaded,[o],s),X3(l,t),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});let u=l.loaded[c];u.length&&u.forEach(d=>{a[c][d]===void 0&&(a[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,r,n,i=0,o=this.retryTimeout,s){if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:n,tried:i,wait:o,callback:s});return}this.readingCalls++;let a=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){let d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&i<this.maxRetries){setTimeout(()=>{this.read(t,r,n,i+1,o*2,s)},o);return}s(c,u)},l=this.backend[n].bind(this.backend);if(l.length===2){try{let c=l(t,r);c&&typeof c.then=="function"?c.then(u=>a(null,u)).catch(a):a(null,c)}catch(c){a(c)}return}return l(t,r,a)}prepareLoading(t,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();ft(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ft(r)&&(r=[r]);let o=this.queueLoad(t,r,n,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,r,n){this.prepareLoading(t,r,{},n)}reload(t,r,n){this.prepareLoading(t,r,{reload:!0},n)}loadOne(t,r=""){let n=t.split("|"),i=n[0],o=n[1];this.read(i,o,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${r}loading namespace ${o} for language ${i} failed`,s),!s&&a&&this.logger.log(`${r}loaded namespace ${o} for language ${i}`,a),this.loaded(t,s,a)})}saveMissing(t,r,n,i,o,s={},a=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){let l={...s,isUpdate:o},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(t,r,n,i,l):u=c(t,r,n,i),u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}else c(t,r,n,i,a,l)}!t||!t[0]||this.store.addResource(t[0],r,n,i)}}},cx=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ft(e[1])&&(t.defaultValue=e[1]),ft(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){let r=e[3]||e[2];Object.keys(r).forEach(n=>{t[n]=r[n]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),$A=e=>(ft(e.ns)&&(e.ns=[e.ns]),ft(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ft(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Nh=()=>{},K3=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})},gx=class e extends Ul{constructor(t={},r){if(super(),this.options=$A(t),this.services={},this.logger=Ii,this.modules={external:[]},K3(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=t,t={}),t.defaultNS==null&&t.ns&&(ft(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));let n=cx();this.options={...n,...this.options,...$A(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Ii.init(i(this.modules.logger),this.options):Ii.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=hx;let u=new Fh(this.options);this.store=new Bh(this.options.resources,this.options);let d=this.services;d.logger=Ii,d.resourceStore=this.store,d.languageUtils=u,d.pluralResolver=new px(u,{prepend:this.options.pluralSeparator}),c&&(d.formatter=i(c),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new $h(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new mx(i(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.languageDetector&&(d.languageDetector=i(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=i(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new zh(this.services,this.options),this.translator.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Nh),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...u)=>this.store[c](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...u)=>(this.store[c](...u),this)});let a=xd(),l=()=>{let c=(u,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(d),r(u,d)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),a}loadResources(t,r=Nh){let n=r,i=ft(t)?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let o=[],s=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&(o.includes(c)||o.push(c))})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload?.forEach?.(a=>s(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(a)})}else n(null)}reloadResources(t,r,n){let i=xd();return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),n||(n=Nh),this.services.backendConnector.reload(t,r,o=>{i.resolve(),n(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&HA.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!["cimode","dev"].includes(n)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,r){this.isLanguageChangingTo=t;let n=xd();this.emit("languageChanging",t);let i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},o=(a,l)=>{l?this.isLanguageChangingTo===t&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(a,(...c)=>this.t(...c))},s=a=>{!t&&!a&&this.services.languageDetector&&(a=[]);let l=ft(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(ft(a)?[a]:a);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,u=>{o(u,c)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),n}getFixedT(t,r,n,i){let o=i?.scopeNs,s=(a,l,...c)=>{let u;typeof l!="object"?u=this.options.overloadTranslationOptionHandler([a,l].concat(c)):u={...l},u.lng=u.lng||s.lng,u.lngs=u.lngs||s.lngs;let d=u.ns!==void 0&&u.ns!==null;u.ns=u.ns||s.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||n||s.keyPrefix);let f={...this.options,...u};Array.isArray(o)&&!d&&(f.ns=o),typeof u.keyPrefix=="function"&&(u.keyPrefix=la(u.keyPrefix,f));let h=this.options.keySeparator||".",m;return u.keyPrefix&&Array.isArray(a)?m=a.map(y=>(typeof y=="function"&&(y=la(y,f)),`${u.keyPrefix}${h}${y}`)):(typeof a=="function"&&(a=la(a,f)),m=u.keyPrefix?`${u.keyPrefix}${h}${a}`:a),this.t(m,u)};return ft(t)?s.lng=t:s.lngs=t,s.ns=r,s.keyPrefix=n,s}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let s=(a,l)=>{let c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(r.precheck){let a=r.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(n,t)&&(!i||s(o,t)))}loadNamespaces(t,r){let n=xd();return this.options.ns?(ft(t)&&(t=[t]),t.forEach(i=>{this.options.ns.includes(i)||this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(t,r){let n=xd();ft(t)&&(t=[t]);let i=this.options.preload||[],o=t.filter(s=>!i.includes(s)&&this.services.languageUtils.isSupportedCode(s));return o.length?(this.options.preload=i.concat(o),this.loadResources(s=>{n.resolve(),r&&r(s)}),n):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{let i=new Intl.Locale(t);if(i&&i.getTextInfo){let o=i.getTextInfo();if(o&&o.direction)return o.direction}}catch{}let r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new Fh(cx());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.includes(n.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){let n=new e(t,r);return n.createInstance=e.createInstance,n}cloneInstance(t={},r=Nh){let n=t.forkResourceStore;n&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},o=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n){let a=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((u,d)=>(u[d]={...l[c][d]},u),l[c]),l),{});o.store=new Bh(a,i),o.services.resourceStore=o.store}if(t.interpolation){let l={...cx().interpolation,...this.options.interpolation,...t.interpolation},c={...i,interpolation:l};o.services.interpolator=new $h(c)}return o.translator=new zh(o.services,i),o.translator.on("*",(a,...l)=>{o.emit(a,...l)}),o.init(i,r),o.translator.options=i,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},nr=gx.createInstance(),VA=nr.createInstance,fq=nr.dir,pq=nr.init,hq=nr.loadResources,mq=nr.reloadResources,gq=nr.use,yq=nr.changeLanguage,vq=nr.getFixedT,bq=nr.t,xq=nr.exists,Sq=nr.setDefaultNamespace,Tq=nr.hasLoadedNamespace,wq=nr.loadNamespaces,Cq=nr.loadLanguages;p();var Z3=D(WA());p();var jh=(e,t,r,n)=>{let i=[r,{code:t,...n||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,"warn","react-i18next::",!0);pi(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},YA={},ts=(e,t,r,n)=>{pi(r)&&YA[r]||(pi(r)&&(YA[r]=new Date),jh(e,t,r,n))},qA=(e,t)=>()=>{if(e.isInitialized)t();else{let r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},Hh=(e,t,r)=>{e.loadNamespaces(t,qA(e,r))},yx=(e,t,r,n)=>{if(pi(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Hh(e,r,n);r.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,qA(e,n))},XA=(e,t,r={})=>!t.languages||!t.languages.length?(ts(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:r.lng,precheck:(n,i)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!i(n.isLanguageChangingTo,e))return!1}});var pi=e=>typeof e=="string",vx=e=>typeof e=="object"&&e!==null;p();p();var Q3=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,J3={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},tF=e=>J3[e],bx=e=>e.replace(Q3,tF);var xx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:bx,transDefaultProps:void 0},Uh=(e={})=>{xx={...xx,...e}},wd=()=>xx;p();var KA,Vh=e=>{KA=e},hi=()=>KA;p();var ZA=D(F(),1);p();var Gh={type:"3rdParty",init(e){Uh(e.options.react),Vh(e)}};var po=(0,ZA.createContext)(),Wh=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}};p();var r_=D(F(),1);p();var ca=D(F(),1);p();p();var Vl=class e extends Error{constructor(t,r,n){super(t),this.name="TranslationParserError",this.position=r,this.translationString=n,Error.captureStackTrace&&Error.captureStackTrace(this,e)}};p();var QA={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'","©":"©","®":"®","™":"™","…":"…","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","•":"•","′":"′","″":"″","‹":"‹","›":"›","§":"§","¶":"¶","·":"·"," ":" "," ":" "," ":" ","€":"€","£":"£","¥":"¥","¢":"¢","¤":"¤","×":"×","÷":"÷","−":"−","±":"±","≠":"≠","≤":"≤","≥":"≥","≈":"≈","≡":"≡","∞":"∞","∫":"∫","∑":"∑","∏":"∏","√":"√","∂":"∂","‰":"‰","°":"°","µ":"µ","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"⇐","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","À":"À","Á":"Á","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Å","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"Ì","Í":"Í","Î":"Î","Ï":"Ï","Ð":"Ð","Ñ":"Ñ","Ò":"Ò","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ý","Þ":"Þ","ß":"ß","à":"à","á":"á","â":"â","ã":"ã","ä":"ä","å":"å","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"í","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ","¡":"¡","¿":"¿","ƒ":"ƒ","ˆ":"ˆ","˜":"˜","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ª":"ª","º":"º","¯":"¯","´":"´","¸":"¸","¹":"¹","²":"²","³":"³","¼":"¼","½":"½","¾":"¾","♠":"♠","♣":"♣","♥":"♥","♦":"♦","◊":"◊","‾":"‾","⁄":"⁄","℘":"℘","ℑ":"ℑ","ℜ":"ℜ","ℵ":"ℵ"},iF=new RegExp(Object.keys(QA).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"g"),JA=e=>e.replace(iF,t=>QA[t]).replace(/&#(\d+);/g,(t,r)=>String.fromCharCode(parseInt(r,10))).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>String.fromCharCode(parseInt(r,16)));p();var t_=e=>{let t=[],r=0,n="",i=()=>{n&&(t.push({type:"Text",value:n,position:r-n.length}),n="")};for(;r<e.length;){let o=e[r];if(o==="<"){let s=e.slice(r).match(/^<(\d+)>/);if(s)i(),t.push({type:"TagOpen",value:s[0],position:r,tagNumber:parseInt(s[1],10)}),r+=s[0].length;else{let a=e.slice(r).match(/^<\/(\d+)>/);a?(i(),t.push({type:"TagClose",value:a[0],position:r,tagNumber:parseInt(a[1],10)}),r+=a[0].length):(n+=o,r+=1)}}else n+=o,r+=1}return i(),t};p();var Ed=D(F(),1);var oF=(e,t,r)=>{let{type:n,props:i={}}=e;if(i.children&&Array.isArray(i.children)&&r){let{children:o,...s}=i;return Ed.default.createElement(n,s,...t)}return t.length===0?Ed.default.createElement(n,i):t.length===1?Ed.default.createElement(n,i,t[0]):Ed.default.createElement(n,i,...t)},e_=(e,t=[])=>{if(!e)return[];let r=t_(e),n=[],i=[],o=new Set,s=()=>{if(i.length===0)return t;let a=i[i.length-1];return a.declaration.props?.children&&Array.isArray(a.declaration.props.children)?a.declaration.props.children:a.declarations};if(r.forEach(a=>{switch(a.type){case"Text":{let l=JA(a.value);(i.length>0?i[i.length-1].children:n).push(l)}break;case"TagOpen":{let{tagNumber:l}=a,c=s(),u=c[l];if(!u){o.add(l);let d=`<${l}>`;(i.length>0?i[i.length-1].children:n).push(d);break}i.push({tagNumber:l,children:[],position:a.position,declaration:u,declarations:c})}break;case"TagClose":{let{tagNumber:l}=a;if(o.has(l)){let f=`</${l}>`;(i.length>0?i[i.length-1].children:n).push(f),o.delete(l);break}if(i.length===0)throw new Vl(`Unexpected closing tag </${l}> at position ${a.position}`,a.position,e);let c=i.pop();if(c.tagNumber!==l)throw new Vl(`Mismatched tags: expected </${c.tagNumber}> but got </${l}> at position ${a.position}`,a.position,e);let u=oF(c.declaration,c.children,c.declarations);(i.length>0?i[i.length-1].children:n).push(u)}break}}),i.length>0){let a=i[i.length-1];throw new Vl(`Unclosed tag <${a.tagNumber}> at position ${a.position}`,a.position,e)}return n};function Yh({i18nKey:e,defaultTranslation:t,content:r,ns:n,values:i={},i18n:o,t:s}){let a=o||hi();if(!a)return ts(a,"NO_I18NEXT_INSTANCE","IcuTrans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:e}),ca.default.createElement(ca.default.Fragment,{},t);let l=s||a.t?.bind(a)||(f=>f),c=n||l.ns||a.options?.defaultNS;c=pi(c)?[c]:c||["translation"];let u=i;a.options?.interpolation?.defaultVariables&&(u=i&&Object.keys(i).length>0?{...i,...a.options.interpolation.defaultVariables}:{...a.options.interpolation.defaultVariables});let d=l(e,{defaultValue:t,...u,ns:c});try{let f=e_(d,r);return ca.default.createElement(ca.default.Fragment,{},...f)}catch(f){return jh(a,"ICU_TRANS_RENDER_ERROR",`IcuTrans component error for key "${e}": ${f.message}`,{i18nKey:e,error:f}),ca.default.createElement(ca.default.Fragment,{},d)}}Yh.displayName="IcuTransWithoutContext";function n_({i18nKey:e,defaultTranslation:t,content:r,ns:n,values:i={},i18n:o,t:s}){let{i18n:a,defaultNS:l}=(0,r_.useContext)(po)||{},c=o||a||hi(),u=s||c?.t.bind(c);return Yh({i18nKey:e,defaultTranslation:t,content:r,ns:n||u?.ns||l||c?.options?.defaultNS,values:i,i18n:c,t:s})}n_.displayName="IcuTrans";p();var ir=D(F(),1),l_=D(a_(),1);var mF=(e,t)=>{if(pi(t))return t;if(vx(t)&&pi(t.defaultValue))return t.defaultValue;if(typeof e=="function")return"";if(Array.isArray(e)){let r=e[e.length-1];return typeof r=="function"?"":r}return e},gF={t:mF,ready:!1},yF=()=>()=>{},Wl=(e,t={})=>{let{i18n:r}=t,{i18n:n,defaultNS:i}=(0,ir.useContext)(po)||{},o=r||n||hi();o&&!o.reportNamespaces&&(o.reportNamespaces=new Wh),o||ts(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");let s=(0,ir.useMemo)(()=>({...wd(),...o?.options?.react,...t}),[o,t]),{useSuspense:a,keyPrefix:l}=s,c=e||i||o?.options?.defaultNS,u=pi(c)?[c]:c||["translation"],d=(0,ir.useMemo)(()=>u,u);o?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,ir.useRef)(0),h=(0,ir.useCallback)(_=>{if(!o)return yF;let{bindI18n:P,bindI18nStore:k}=s,I=()=>{f.current+=1,_()};return P&&o.on(P,I),k&&o.store.on(k,I),()=>{P&&P.split(" ").forEach(M=>o.off(M,I)),k&&k.split(" ").forEach(M=>o.store.off(M,I))}},[o,s]),m=(0,ir.useRef)(),y=(0,ir.useCallback)(()=>{if(!o)return gF;let _=!!(o.isInitialized||o.initializedStoreOnce)&&d.every(B=>XA(B,o,s)),P=t.lng||o.language,k=f.current,I=m.current;if(I&&I.ready===_&&I.lng===P&&I.keyPrefix===l&&I.revision===k)return I;let z={t:o.getFixedT(P,s.nsMode==="fallback"?d:d[0],l,{scopeNs:d}),ready:_,lng:P,keyPrefix:l,revision:k};return m.current=z,z},[o,d,l,s,t.lng]),[x,g]=(0,ir.useState)(0),{t:v,ready:b}=(0,l_.useSyncExternalStore)(h,y,y);(0,ir.useEffect)(()=>{if(o&&!b&&!a){let _=()=>g(P=>P+1);t.lng?yx(o,t.lng,d,_):Hh(o,d,_)}},[o,t.lng,d,b,a,x]);let w=o||{},T=(0,ir.useRef)(null),C=(0,ir.useRef)(),E=_=>{let P=Object.getOwnPropertyDescriptors(_);P.__original&&delete P.__original;let k=Object.create(Object.getPrototypeOf(_),P);if(!Object.prototype.hasOwnProperty.call(k,"__original"))try{Object.defineProperty(k,"__original",{value:_,writable:!1,enumerable:!1,configurable:!1})}catch{}return k},A=(0,ir.useMemo)(()=>{let _=w,P=_?.language,k=_;_&&(T.current&&T.current.__original===_?C.current!==P?(k=E(_),T.current=k,C.current=P):k=T.current:(k=E(_),T.current=k,C.current=P));let I=!b&&!a?(...z)=>(ts(o,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),v(...z)):v,M=[I,k,b];return M.t=I,M.i18n=k,M.ready=b,M},[v,w,b,w.resolvedLanguage,w.language,w.languages]);if(o&&a&&!b)throw new Promise(_=>{let P=()=>_();t.lng?yx(o,t.lng,d,P):Hh(o,d,P)});return A};p();var c_=D(F(),1);p();p();var qh=D(F(),1);function Tx({i18n:e,defaultNS:t,children:r}){let n=(0,qh.useMemo)(()=>({i18n:e,defaultNS:t}),[e,t]);return(0,qh.createElement)(po.Provider,{value:n},r)}p();var TF=D(F(),1);p();var bF=D(F(),1);fa();var WM=D(Mk()),YM=D(Lk()),qM=D(Nk()),XM=D(Ik()),KM=D(Bk()),ZM=D(zk()),lT=D(Fk()),QM=D(jk()),JM=D(Hk()),tL=D(Uk()),eL=D(Vk());p();p();p();var gj={grey:{50:"#FBFCFE",100:"#F0F4F8",200:"#DDE7EE",300:"#CDD7E1",400:"#9FA6AD",500:"#636B74",600:"#555E68",700:"#32383E",800:"#171A1C",900:"#0B0D0E"},blue:{50:"#EDF5FD",100:"#E3EFFB",200:"#C7DFF7",300:"#97C3F0",400:"#4393E4",500:"#0B6BCB",600:"#185EA5",700:"#12467B",800:"#0A2744",900:"#051423"},yellow:{50:"#FEFAF6",100:"#FDF0E1",200:"#FCE1C2",300:"#F3C896",400:"#EA9A3E",500:"#9A5B13",600:"#72430D",700:"#492B08",800:"#2E1B05",900:"#1D1002"},red:{50:"#FEF6F6",100:"#FCE4E4",200:"#F7C5C5",300:"#F09898",400:"#E47474",500:"#C41C1C",600:"#A51818",700:"#7D1212",800:"#430A0A",900:"#240505"},green:{50:"#F6FEF6",100:"#E3FBE3",200:"#C7F7C7",300:"#A1E8A1",400:"#51BC51",500:"#1F7A1F",600:"#136C13",700:"#0A470A",800:"#042F04",900:"#021D02"}},Na=gj;p();p();var ps="$$joy";p();p();xo();p();p();var kct=D(F());xo();p();Pa();p();var Gk=D(F());xo();function yj(e){return Object.keys(e).length===0}function vj(e=null){let t=Gk.useContext(Nn);return!t||yj(t)?e:t}var Sc=vj;var bj=Ui();function xj(e=bj){return Sc(e)}var Tc=xj;var Wk=D(Z());function H1(e){let t=fc(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function Sj({styles:e,themeId:t,defaultTheme:r={}}){let n=Tc(r),i=t&&n[t]||n,o=typeof e=="function"?e(i):e;return i.modularCssLayers&&(Array.isArray(o)?o=o.map(s=>H1(typeof s=="function"?s(i):s)):o=H1(o)),(0,Wk.jsx)($i,{styles:o})}var U1=Sj;E1();A1();_1();P1();Ea();ds();Ra();p();Gt();vi();var Yk=D(F());rr();xo();Ra();var qk=D(Z()),Tj=["className","component"];function Sg(e={}){let{themeId:t,defaultTheme:r,defaultClassName:n="MuiBox-root",generateClassName:i}=e,o=dc("div",{shouldForwardProp:a=>a!=="theme"&&a!=="sx"&&a!=="as"})(hn);return Yk.forwardRef(function(l,c){let u=Tc(r),d=Vi(l),{className:f,component:h="div"}=d,m=be(d,Tj);return(0,qk.jsx)(o,V({as:h,ref:c,className:Lt(f,i?i(n):n),theme:t&&u[t]||u},m))})}p();Gt();vi();xo();Wr();Pa();Ra();var wj=["ownerState"],Cj=["variants"],Ej=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Aj(e){return Object.keys(e).length===0}function _j(e){return typeof e=="string"&&e.charCodeAt(0)>96}function V1(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Xk(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}var Pj=Ui(),Rj=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function Tg({defaultTheme:e,theme:t,themeId:r}){return Aj(t)?e:t[r]||t}function kj(e){return e?(t,r)=>r[e]:null}function wg(e,t,r){let{ownerState:n}=t,i=be(t,wj),o=typeof e=="function"?e(V({ownerState:n},i)):e;if(Array.isArray(o))return o.flatMap(s=>wg(s,V({ownerState:n},i),r));if(o&&typeof o=="object"&&Array.isArray(o.variants)){let{variants:s=[]}=o,l=be(o,Cj);return s.forEach(c=>{let u=!0;if(typeof c.props=="function"?u=c.props(V({ownerState:n},i,n)):Object.keys(c.props).forEach(d=>{n?.[d]!==c.props[d]&&i[d]!==c.props[d]&&(u=!1)}),u){Array.isArray(l)||(l=[l]);let d=typeof c.style=="function"?c.style(V({ownerState:n},i,n)):c.style;l.push(r?Xk(fc(d),r):d)}}),l}return r?Xk(fc(o),r):o}function wc(e={}){let{themeId:t,defaultTheme:r=Pj,rootShouldForwardProp:n=V1,slotShouldForwardProp:i=V1}=e,o=s=>hn(V({},s,{theme:Tg(V({},s,{defaultTheme:r,themeId:t}))}));return o.__mui_systemSx=!0,(s,a={})=>{v1(s,C=>C.filter(E=>!(E!=null&&E.__mui_systemSx)));let{name:l,slot:c,skipVariantsResolver:u,skipSx:d,overridesResolver:f=kj(Rj(c))}=a,h=be(a,Ej),m=l&&l.startsWith("Mui")||c?"components":"custom",y=u!==void 0?u:c&&c!=="Root"&&c!=="root"||!1,x=d||!1,g,v=V1;c==="Root"||c==="root"?v=n:c?v=i:_j(s)&&(v=void 0);let b=dc(s,V({shouldForwardProp:v,label:g},h)),w=C=>typeof C=="function"&&C.__emotion_real!==C||gi(C)?E=>{let A=Tg({theme:E.theme,defaultTheme:r,themeId:t});return wg(C,V({},E,{theme:A}),A.modularCssLayers?m:void 0)}:C,T=(C,...E)=>{let A=w(C),_=E?E.map(w):[];l&&f&&_.push(I=>{let M=Tg(V({},I,{defaultTheme:r,themeId:t}));if(!M.components||!M.components[l]||!M.components[l].styleOverrides)return null;let z=M.components[l].styleOverrides,B={};return Object.entries(z).forEach(([R,L])=>{B[R]=wg(L,V({},I,{theme:M}),M.modularCssLayers?"theme":void 0)}),f(I,B)}),l&&!y&&_.push(I=>{var M;let z=Tg(V({},I,{defaultTheme:r,themeId:t})),B=z==null||(M=z.components)==null||(M=M[l])==null?void 0:M.variants;return wg({variants:B},V({},I,{theme:z}),z.modularCssLayers?"theme":void 0)}),x||_.push(o);let P=_.length-E.length;if(Array.isArray(C)&&P>0){let I=new Array(P).fill("");A=[...C,...I],A.raw=[...C.raw,...I]}let k=b(A,..._);return s.muiName&&(k.muiName=s.muiName),k};return b.withConfig&&(T.withConfig=b.withConfig),T}}p();var Oj=wc(),Kk=Oj;qm();C1();p();p();p();Jx();function Cg(e){let{theme:t,name:r,props:n}=e;return!t||!t.components||!t.components[r]||!t.components[r].defaultProps?n:ss(t.components[r].defaultProps,n)}function Ia({props:e,name:t,defaultTheme:r,themeId:n}){let i=Tc(r);return n&&(i=i[n]||i),Cg({theme:i,name:t,props:e})}p();is();function Dj(e){e=e.slice(1);let t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g"),r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),r?`rgb${r.length===4?"a":""}(${r.map((n,i)=>i<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function Zk(e){if(e.type)return e;if(e.charAt(0)==="#")return Zk(Dj(e));let t=e.indexOf("("),r=e.substring(0,t);if(["rgb","rgba","hsl","hsla","color"].indexOf(r)===-1)throw new Error(yr(9,e));let n=e.substring(t+1,e.length-1),i;if(r==="color"){if(n=n.split(" "),i=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i)===-1)throw new Error(yr(10,i))}else n=n.split(",");return n=n.map(o=>parseFloat(o)),{type:r,values:n,colorSpace:i}}var hs=e=>{let t=Zk(e);return t.values.slice(0,3).map((r,n)=>t.type.indexOf("hsl")!==-1&&n!==0?`${r}%`:r).join(" ")};p();p();Gt();var aO=D(F());p();p();p();Gt();var tO=D(F());p();var Qk=D(F()),Mj=Qk.createContext(null),Eg=Mj;p();p();var G1=D(F());function So(){return G1.useContext(Eg)}p();var Lj=typeof Symbol=="function"&&Symbol.for,Jk=Lj?Symbol.for("mui.nested"):"__THEME_NESTED__";var eO=D(Z());function Nj(e,t){return typeof t=="function"?t(e):V({},e,t)}function Ij(e){let{children:t,theme:r}=e,n=So(),i=tO.useMemo(()=>{let o=n===null?r:Nj(n,r);return o!=null&&(o[Jk]=n!==null),o},[r,n]);return(0,eO.jsx)(Eg.Provider,{value:i,children:t})}var Ag=Ij;xo();p();Gt();vi();var W1=D(F());var rO=D(Z()),Bj=["value"],zj=W1.createContext();function Fj(e){let{value:t}=e,r=be(e,Bj);return(0,rO.jsx)(zj.Provider,V({value:t??!0},r))}var nO=Fj;f1();p();var Gut=D(F());Fd();Bm();var iO=D(Z());function Y1(e){let t=Sc(),r=zr()||"",{modularCssLayers:n}=e,i="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!n||t!==null?i="":typeof n=="string"?i=n.replace(/mui(?!\.)/g,i):i=`@layer ${i};`,Xe(()=>{let o=document.querySelector("head");if(!o)return;let s=o.firstChild;if(i){var a;if(s&&(a=s.hasAttribute)!=null&&a.call(s,"data-mui-layer-order")&&s.getAttribute("data-mui-layer-order")===r)return;let c=document.createElement("style");c.setAttribute("data-mui-layer-order",r),c.textContent=i,o.prepend(c)}else{var l;(l=o.querySelector(`style[data-mui-layer-order="${r}"]`))==null||l.remove()}},[i,r]),i?(0,iO.jsx)(U1,{styles:i}):null}var lO=D(Z()),_g=D(Z()),oO={};function sO(e,t,r,n=!1){return aO.useMemo(()=>{let i=e&&t[e]||t;if(typeof r=="function"){let o=r(i),s=e?V({},t,{[e]:o}):o;return n?()=>s:s}return e?V({},t,{[e]:r}):V({},t,r)},[e,t,r,n])}function $j(e){let{children:t,theme:r,themeId:n}=e,i=Sc(oO),o=So()||oO,s=sO(n,i,r),a=sO(n,o,r,!0),l=s.direction==="rtl",c=Y1(s);return(0,_g.jsx)(Ag,{theme:a,children:(0,_g.jsx)(Nn.Provider,{value:s,children:(0,_g.jsx)(nO,{value:l,children:(0,lO.jsxs)(Wm,{value:s?.components,children:[c,t]})})})})}var q1=$j;p();Gt();vi();is();var Pr=D(F());Wr();xo();p();var udt=D(F()),cO=D(Z()),Kd="mode",Zd="color-scheme",X1="data-color-scheme";function K1(e){let{defaultMode:t="light",defaultLightColorScheme:r="light",defaultDarkColorScheme:n="dark",modeStorageKey:i=Kd,colorSchemeStorageKey:o=Zd,attribute:s=X1,colorSchemeNode:a="document.documentElement",nonce:l}=e||{};return(0,cO.jsx)("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?l:"",dangerouslySetInnerHTML:{__html:`(function() {
|
|
68
68
|
try {
|
|
69
69
|
var mode = localStorage.getItem('${i}') || '${t}';
|
|
70
70
|
var colorScheme = '';
|
|
@@ -117,7 +117,7 @@ try {
|
|
|
117
117
|
animation: ${0}
|
|
118
118
|
var(--LinearProgress-circulation, 2.5s ease-in-out 0s infinite normal none running);
|
|
119
119
|
}
|
|
120
|
-
`),z8),({ownerState:e,theme:t})=>{let{borderRadius:r,height:n}=Nc({theme:t,ownerState:e},["borderRadius","height"]);return O({},r!==void 0&&{"--LinearProgress-radius":r},n!==void 0&&{"--LinearProgress-thickness":n})}),j8=cM.forwardRef(function(t,r){let n=zt({props:t,name:"JoyLinearProgress"}),{children:i,className:o,component:s,color:a="primary",size:l="md",variant:c="soft",thickness:u,determinate:d=!1,value:f=d?0:25,style:h,slots:m={},slotProps:y={}}=n,x=at(n,B8),g=O({},n,{component:s,color:a,size:l,variant:c,thickness:u,value:f,determinate:d,instanceSize:t.size}),v=F8(g),b=O({},x,{component:s,slots:m,slotProps:y}),[w,T]=xt("root",{ref:r,className:Lt(v.root,o),elementType:$8,externalForwardedProps:b,ownerState:g,additionalProps:O({as:s,role:"progressbar",style:O({},{"--LinearProgress-percent":f},h)},typeof f=="number"&&d&&{"aria-valuenow":Math.round(f)})});return(0,uM.jsx)(w,O({},T,{children:i}))}),Jg=j8;p();p();he();wt();var $c=D(F());Wt();p();function dM(e){return Yt("MuiMenu",e)}var qEt=qt("MuiMenu",["root","listbox","expanded","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid","sizeSm","sizeMd","sizeLg"]);var Fc=D(Z()),H8=["actions","children","color","component","disablePortal","keepMounted","id","invertedColors","onItemsChange","modifiers","variant","size","slots","slotProps"],U8=e=>{let{open:t,variant:r,color:n,size:i}=e,o={root:["root",t&&"expanded",r&&`variant${it(r)}`,n&&`color${it(n)}`,i&&`size${it(i)}`],listbox:["listbox"]};return Pt(o,dM,{})},fM=rt(LS,{name:"JoyMenu",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e,ownerState:t})=>{var r,n;let i=(r=e.variants[t.variant])==null?void 0:r[t.color];return[O({"--focus-outline-offset":`calc(${e.vars.focus.thickness} * -1)`,"--ListItem-stickyBackground":i?.backgroundColor||i?.background||e.vars.palette.background.popup,"--ListItem-stickyTop":"calc(var(--List-padding, var(--ListDivider-gap)) * -1)"},CD,{borderRadius:`var(--List-radius, ${e.vars.radius.sm})`,boxShadow:e.shadow.md,overflow:"auto",zIndex:`var(--unstable_popup-zIndex, ${e.vars.zIndex.popup})`},!(i!=null&&i.backgroundColor)&&{backgroundColor:e.vars.palette.background.popup},t.variant==="solid"&&t.color&&t.invertedColors&&df(t.color)(e),t.variant==="soft"&&t.color&&t.invertedColors&&ff(t.color)(e),(n=e.variants[t.variant])==null?void 0:n[t.color])]}),V8=$c.forwardRef(function(t,r){var n;let i=zt({props:t,name:"JoyMenu"}),{actions:o,children:s,color:a="neutral",component:l,disablePortal:c=!1,keepMounted:u=!1,id:d,invertedColors:f=!1,onItemsChange:h,modifiers:m,variant:y="outlined",size:x="md",slots:g={},slotProps:v={}}=i,b=at(i,H8),{contextValue:w,getListboxProps:T,dispatch:C,open:E,triggerElement:A}=dS({onItemsChange:h,id:d,listboxRef:r});$c.useImperativeHandle(o,()=>({dispatch:C,resetHighlight:()=>C({type:re.resetHighlight,event:null})}),[C]);let _=O({},i,{disablePortal:c,invertedColors:f,color:a,variant:y,size:x,open:E,nesting:!1,row:!1}),P=U8(_),k=O({},b,{component:l,slots:g,slotProps:v}),I=$c.useMemo(()=>[{name:"offset",options:{offset:[0,4]}},...m||[]],[m]),M=Sa({elementType:fM,getSlotProps:T,externalForwardedProps:k,externalSlotProps:{},ownerState:_,additionalProps:{anchorEl:A,open:E&&A!==null,disablePortal:c,keepMounted:u,modifiers:I},className:P.root});return(0,Fc.jsx)(fM,O({},M,!((n=i.slots)!=null&&n.root)&&{as:Lc,slots:{root:l||"ul"}},{children:(0,Fc.jsx)(FO,{value:w,children:(0,Fc.jsx)(LD,{variant:f?void 0:y,color:a,children:(0,Fc.jsx)(wD.Provider,{value:"menu",children:(0,Fc.jsx)(ED,{nested:!0,children:s})})})})}))}),ty=V8;p();p();he();wt();var ey=D(F());Wt();p();function pM(e){return Yt("MuiMenuButton",e)}var SAt=qt("MuiMenuButton",["root","colorPrimary","colorNeutral","colorDanger","colorInfo","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid","disabled","sizeSm","sizeMd","sizeLg","fullWidth","startDecorator","endDecorator","loading","loadingIndicatorCenter"]);var gf=D(Z()),hM=D(Z()),G8=["children","color","component","disabled","endDecorator","loading","loadingPosition","loadingIndicator","size","slotProps","slots","startDecorator","variant"],W8=e=>{let{color:t,disabled:r,fullWidth:n,size:i,variant:o,loading:s}=e,a={root:["root",r&&"disabled",n&&"fullWidth",o&&`variant${it(o)}`,t&&`color${it(t)}`,i&&`size${it(i)}`,s&&"loading"],startDecorator:["startDecorator"],endDecorator:["endDecorator"],loadingIndicatorCenter:["loadingIndicatorCenter"]};return Pt(a,pM,{})},Y8=rt("button",{name:"JoyMenuButton",slot:"Root",overridesResolver:(e,t)=>t.root})(US),q8=rt("span",{name:"JoyMenuButton",slot:"StartDecorator",overridesResolver:(e,t)=>t.startDecorator})({"--Icon-margin":"0 0 0 calc(var(--Button-gap) / -2)","--CircularProgress-margin":"0 0 0 calc(var(--Button-gap) / -2)",display:"inherit",marginRight:"var(--Button-gap)"}),X8=rt("span",{name:"JoyMenuButton",slot:"EndDecorator",overridesResolver:(e,t)=>t.endDecorator})({"--Icon-margin":"0 calc(var(--Button-gap) / -2) 0 0","--CircularProgress-margin":"0 calc(var(--Button-gap) / -2) 0 0",display:"inherit",marginLeft:"var(--Button-gap)"}),K8=rt("span",{name:"JoyMenuButton",slot:"LoadingCenter",overridesResolver:(e,t)=>t.loadingIndicatorCenter})(({theme:e,ownerState:t})=>{var r,n;return O({display:"inherit",position:"absolute",left:"50%",transform:"translateX(-50%)",color:(r=e.variants[t.variant])==null||(r=r[t.color])==null?void 0:r.color},t.disabled&&{color:(n=e.variants[`${t.variant}Disabled`])==null||(n=n[t.color])==null?void 0:n.color})}),Z8=ey.forwardRef(function(t,r){var n;let i=zt({props:t,name:"JoyMenuButton"}),{children:o,color:s="neutral",component:a,disabled:l=!1,endDecorator:c,loading:u=!1,loadingPosition:d="center",loadingIndicator:f,size:h="md",slotProps:m={},slots:y={},startDecorator:x,variant:g="outlined"}=i,v=at(i,G8),b=ey.useContext(Bc),w=t.variant||b.variant||g,T=t.size||b.size||h,C=(n=t.disabled)!=null?n:b.disabled||l||u,{getRootProps:E,open:A,active:_}=yS({rootRef:r,disabled:C}),P=f??(0,gf.jsx)(Wn,{color:s,thickness:{sm:2,md:3,lg:4}[T]||3}),k=O({},i,{active:_,color:s,disabled:C,open:A,size:T,variant:w}),I=W8(k),M=O({},v,{component:a,slots:y,slotProps:m}),[z,B]=xt("root",{elementType:Y8,getSlotProps:E,externalForwardedProps:M,ref:r,ownerState:k,className:I.root}),[R,L]=xt("startDecorator",{className:I.startDecorator,elementType:q8,externalForwardedProps:M,ownerState:k}),[G,U]=xt("endDecorator",{className:I.endDecorator,elementType:X8,externalForwardedProps:M,ownerState:k}),[X,J]=xt("loadingIndicatorCenter",{className:I.loadingIndicatorCenter,elementType:K8,externalForwardedProps:M,ownerState:k});return(0,hM.jsxs)(z,O({},B,{children:[(x||u&&d==="start")&&(0,gf.jsx)(R,O({},L,{children:u&&d==="start"?P:x})),o,u&&d==="center"&&(0,gf.jsx)(X,O({},J,{children:P})),(c||u&&d==="end")&&(0,gf.jsx)(G,O({},U,{children:u&&d==="end"?P:c}))]}))}),ry=Z8;p();p();wt();he();var Za=D(F());Wt();p();function mM(e){return Yt("MuiMenuItem",e)}var VAt=qt("MuiMenuItem",["root","focusVisible","disabled","selected","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantSoft","variantOutlined","variantSolid"]);var yf=D(Z()),Q8=["children","disabled","component","selected","color","orientation","variant","slots","slotProps","id"],J8=e=>{let{focusVisible:t,disabled:r,selected:n,color:i,variant:o}=e,s={root:["root",t&&"focusVisible",r&&"disabled",n&&"selected",i&&`color${it(i)}`,o&&`variant${it(o)}`]};return Pt(s,mM,{})},tV=rt(NS,{name:"JoyMenuItem",slot:"Root",overridesResolver:(e,t)=>t.root})({}),eV=Za.memo(Za.forwardRef(function(t,r){let n=zt({props:t,name:"JoyMenuItem"}),i=Za.useContext(Gg),{children:o,disabled:s=!1,component:a="li",selected:l=!1,color:c="neutral",orientation:u="horizontal",variant:d="plain",slots:f={},slotProps:h={},id:m}=n,y=at(n,Q8),{variant:x=d,color:g=c}=MD(t.variant,t.color),{getRootProps:v,disabled:b,focusVisible:w}=vS({id:m,disabled:s,rootRef:r}),T=O({},n,{component:a,color:g,disabled:b,focusVisible:w,orientation:u,selected:l,row:i,variant:x}),C=J8(T),E=O({},y,{component:a,slots:f,slotProps:h}),[A,_]=xt("root",{ref:r,elementType:tV,getSlotProps:v,externalForwardedProps:E,className:C.root,ownerState:T});return(0,yf.jsx)(PD.Provider,{value:u,children:(0,yf.jsx)(A,O({},_,{children:o}))})})),rV=Za.forwardRef(function(t,r){let{contextValue:n,id:i}=WO(t.id);return(0,yf.jsx)(ys.Provider,{value:n,children:(0,yf.jsx)(eV,O({},t,{id:i,ref:r}))})}),ny=rV;p();p();he();wt();var yM=D(F());rr();p();function gM(e){return Yt("MuiScopedCssBaseline",e)}var h_t=qt("MuiScopedCssBaseline",["root"]);var vM=D(Z()),nV=["className","component","disableColorScheme","slots","slotProps"],iV=()=>Pt({root:["root"]},gM,{}),oV=rt("div",{name:"JoyScopedCssBaseline",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e,ownerState:t})=>{let r={};return!t.disableColorScheme&&e.colorSchemes&&Object.entries(e.colorSchemes).forEach(([n,i])=>{var o;r[`&${e.getColorSchemeSelector(n).replace(/\s*&/,"")}`]={colorScheme:(o=i.palette)==null?void 0:o.mode}}),O({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",color:e.vars.palette.text.primary},e.typography["body-md"],{backgroundColor:e.vars.palette.background.body,"@media print":{backgroundColor:"#fff"},"& *, & *::before, & *::after":{boxSizing:"inherit"},"& strong, & b":{fontWeight:"bold"}},r)}),sV=yM.forwardRef(function(t,r){let n=zt({props:t,name:"JoyScopedCssBaseline"}),{className:i,component:o="div",disableColorScheme:s=!1,slots:a={},slotProps:l={}}=n,c=at(n,nV),u=O({},n,{component:o,disableColorScheme:s}),d=iV(),f=O({},c,{component:o,slots:a,slotProps:l}),[h,m]=xt("root",{ref:r,className:Lt(d.root,i),elementType:oV,externalForwardedProps:f,ownerState:u});return(0,vM.jsx)(h,O({},m))}),VS=sV;p();p();he();wt();var xM=D(F());rr();Wt();p();function bM(e){return Yt("MuiSheet",e)}var M_t=qt("MuiSheet",["root","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid"]);var SM=D(Z()),aV=["className","color","component","variant","invertedColors","slots","slotProps"],lV=e=>{let{variant:t,color:r}=e,n={root:["root",t&&`variant${it(t)}`,r&&`color${it(r)}`]};return Pt(n,bM,{})},cV=rt("div",{name:"JoySheet",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e,ownerState:t})=>{var r,n;let i=(r=e.variants[t.variant])==null?void 0:r[t.color],{borderRadius:o,bgcolor:s,backgroundColor:a,background:l}=Nc({theme:e,ownerState:t},["borderRadius","bgcolor","backgroundColor","background"]),c=ji(e,`palette.${s}`)||s||ji(e,`palette.${a}`)||a||l||i?.backgroundColor||i?.background||e.vars.palette.background.surface;return[O({"--Icon-color":t.color!=="neutral"||t.variant==="solid"?"currentColor":e.vars.palette.text.icon,"--ListItem-stickyBackground":c==="transparent"?"initial":c,"--Sheet-background":c==="transparent"?"initial":c},o!==void 0&&{"--List-radius":`calc(${o} - var(--variant-borderWidth, 0px))`,"--unstable_actionRadius":`calc(${o} - var(--variant-borderWidth, 0px))`},{backgroundColor:e.vars.palette.background.surface,position:"relative"}),O({},e.typography["body-md"],t.variant==="solid"&&t.color&&t.invertedColors&&df(t.color)(e),t.variant==="soft"&&t.color&&t.invertedColors&&ff(t.color)(e),(n=e.variants[t.variant])==null?void 0:n[t.color],i)]}),uV=xM.forwardRef(function(t,r){let n=zt({props:t,name:"JoySheet"}),{className:i,color:o="neutral",component:s="div",variant:a="plain",invertedColors:l=!1,slots:c={},slotProps:u={}}=n,d=at(n,aV),f=O({},n,{color:o,component:s,invertedColors:l,variant:a}),h=lV(f),m=O({},d,{component:s,slots:c,slotProps:u}),[y,x]=xt("root",{ref:r,className:Lt(h.root,i),elementType:cV,externalForwardedProps:m,ownerState:f});return(0,SM.jsx)(y,O({},x))}),vf=uV;p();p();var dV=Rg({createStyledComponent:rt("div",{name:"JoyStack",slot:"Root",overridesResolver:(e,t)=>t.root}),useThemeProps:e=>zt({props:e,name:"JoyStack"})}),Qa=dV;p();p();he();wt();var ze=D(F());rr();Wt();p();function TM(e){return Yt("MuiTooltip",e)}var fPt=qt("MuiTooltip",["root","tooltipArrow","arrow","touch","placementLeft","placementRight","placementTop","placementBottom","colorPrimary","colorDanger","colorNeutral","colorSuccess","colorWarning","colorContext","sizeSm","sizeMd","sizeLg","variantPlain","variantOutlined","variantSoft","variantSolid"]);var AM=D(Z()),GS=D(Z()),fV=["children","className","component","arrow","describeChild","disableFocusListener","disableHoverListener","disableInteractive","disableTouchListener","enterDelay","enterNextDelay","enterTouchDelay","followCursor","id","leaveDelay","leaveTouchDelay","onClose","onOpen","open","disablePortal","direction","keepMounted","modifiers","placement","title","color","variant","size","slots","slotProps"],pV=e=>{let{arrow:t,variant:r,color:n,size:i,placement:o,touch:s}=e,a={root:["root",t&&"tooltipArrow",s&&"touch",i&&`size${it(i)}`,n&&`color${it(n)}`,r&&`variant${it(r)}`,`tooltipPlacement${it(o.split("-")[0])}`],arrow:["arrow"]};return Pt(a,TM,{})},hV=rt("div",{name:"JoyTooltip",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e,theme:t})=>{var r,n,i;let o=(r=t.variants[e.variant])==null?void 0:r[e.color];return O({},e.size==="sm"&&{"--Icon-fontSize":t.vars.fontSize.md,"--Tooltip-arrowSize":"8px",padding:t.spacing(.25,.625)},e.size==="md"&&{"--Icon-fontSize":t.vars.fontSize.lg,"--Tooltip-arrowSize":"10px",padding:t.spacing(.5,.75)},e.size==="lg"&&{"--Icon-fontSize":t.vars.fontSize.xl,"--Tooltip-arrowSize":"12px",padding:t.spacing(.75,1)},{zIndex:t.vars.zIndex.tooltip,borderRadius:t.vars.radius.sm,boxShadow:t.shadow.sm,wordWrap:"break-word",position:"relative"},e.disableInteractive&&{pointerEvents:"none"},t.typography[`body-${{sm:"xs",md:"sm",lg:"md"}[e.size]}`],o,!o.backgroundColor&&{backgroundColor:t.vars.palette.background.surface},{"&::before":{content:'""',display:"block",position:"absolute",width:(n=e.placement)!=null&&n.match(/(top|bottom)/)?"100%":"calc(10px + var(--variant-borderWidth, 0px))",height:(i=e.placement)!=null&&i.match(/(top|bottom)/)?"calc(10px + var(--variant-borderWidth, 0px))":"100%"},'&[data-popper-placement*="bottom"]::before':{top:0,left:0,transform:"translateY(-100%)"},'&[data-popper-placement*="left"]::before':{top:0,right:0,transform:"translateX(100%)"},'&[data-popper-placement*="right"]::before':{top:0,left:0,transform:"translateX(-100%)"},'&[data-popper-placement*="top"]::before':{bottom:0,left:0,transform:"translateY(100%)"}})}),mV=rt("span",{name:"JoyTooltip",slot:"Arrow",overridesResolver:(e,t)=>t.arrow})(({theme:e,ownerState:t})=>{var r,n,i;let o=(r=e.variants[t.variant])==null?void 0:r[t.color];return{"--unstable_Tooltip-arrowRotation":0,width:"var(--Tooltip-arrowSize)",height:"var(--Tooltip-arrowSize)",boxSizing:"border-box","&::before":{content:'""',display:"block",position:"absolute",width:0,height:0,border:"calc(var(--Tooltip-arrowSize) / 2) solid",borderLeftColor:"transparent",borderBottomColor:"transparent",borderTopColor:(n=o?.backgroundColor)!=null?n:e.vars.palette.background.surface,borderRightColor:(i=o?.backgroundColor)!=null?i:e.vars.palette.background.surface,borderRadius:"0px 2px 0px 0px",boxShadow:`var(--variant-borderWidth, 0px) calc(-1 * var(--variant-borderWidth, 0px)) 0px 0px ${o.borderColor}`,transformOrigin:"center center",transform:"rotate(calc(-45deg + 90deg * var(--unstable_Tooltip-arrowRotation)))"},'[data-popper-placement*="bottom"] &':{top:"calc(0.5px + var(--Tooltip-arrowSize) * -1 / 2)"},'[data-popper-placement*="top"] &':{"--unstable_Tooltip-arrowRotation":2,bottom:"calc(0.5px + var(--Tooltip-arrowSize) * -1 / 2)"},'[data-popper-placement*="left"] &':{"--unstable_Tooltip-arrowRotation":1,right:"calc(0.5px + var(--Tooltip-arrowSize) * -1 / 2)"},'[data-popper-placement*="right"] &':{"--unstable_Tooltip-arrowRotation":3,left:"calc(0.5px + var(--Tooltip-arrowSize) * -1 / 2)"}}}),iy=!1,wM=new mo,bf={x:0,y:0};function CM(e,t){return r=>{t&&t(r),e(r)}}function EM(e,t){return(r,...n)=>{t&&t(r,...n),e(r,...n)}}var gV=ze.forwardRef(function(t,r){var n;let i=zt({props:t,name:"JoyTooltip"}),{children:o,className:s,component:a,arrow:l=!1,describeChild:c=!1,disableFocusListener:u=!1,disableHoverListener:d=!1,disableInteractive:f=!1,disableTouchListener:h=!1,enterDelay:m=100,enterNextDelay:y=0,enterTouchDelay:x=700,followCursor:g=!1,id:v,leaveDelay:b=0,leaveTouchDelay:w=1500,onClose:T,onOpen:C,open:E,disablePortal:A,direction:_,keepMounted:P,modifiers:k,placement:I="bottom",title:M,color:z="neutral",variant:B="solid",size:R="md",slots:L={},slotProps:G={}}=i,U=at(i,fV),[X,J]=ze.useState(),[Y,et]=ze.useState(null),ct=ze.useRef(!1),St=f||g,ot=os(),q=os(),j=os(),K=os(),[nt,mt]=ma({controlled:E,default:!1,name:"Tooltip",state:"open"}),lt=nt,Tt=zr(v),Nt=ze.useRef(void 0),kt=ga(()=>{Nt.current!==void 0&&(document.body.style.WebkitUserSelect=Nt.current,Nt.current=void 0),K.clear()});ze.useEffect(()=>kt,[kt]);let te=Ft=>{wM.clear(),iy=!0,mt(!0),C&&!lt&&C(Ft)},Xt=ga(Ft=>{wM.start(800+b,()=>{iy=!1}),mt(!1),T&<&&T(Ft),ot.start(150,()=>{ct.current=!1})}),Ut=Ft=>{ct.current&&Ft.type!=="touchstart"||(X&&X.removeAttribute("title"),q.clear(),j.clear(),m||iy&&y?q.start(iy?y:m,()=>{te(Ft)}):te(Ft))},Pi=Ft=>{q.clear(),j.start(b,()=>{Xt(Ft)})},{isFocusVisibleRef:Ar,onBlur:Lr,onFocus:oi,ref:Ee}=go(),[,Ur]=ze.useState(!1),H=Ft=>{Lr(Ft),Ar.current===!1&&(Ur(!1),Pi(Ft))},st=Ft=>{X||J(Ft.currentTarget),oi(Ft),Ar.current===!0&&(Ur(!0),Ut(Ft))},er=Ft=>{ct.current=!0;let eo=o.props;eo.onTouchStart&&eo.onTouchStart(Ft)},pr=Ft=>{er(Ft),j.clear(),ot.clear(),kt(),Nt.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",K.start(x,()=>{document.body.style.WebkitUserSelect=Nt.current,Ut(Ft)})},ee=Ft=>{o.props.onTouchEnd&&o.props.onTouchEnd(Ft),kt(),j.start(w,()=>{Xt(Ft)})};ze.useEffect(()=>{if(!lt)return;function Ft(eo){(eo.key==="Escape"||eo.key==="Esc")&&Xt(eo)}return document.addEventListener("keydown",Ft),()=>{document.removeEventListener("keydown",Ft)}},[Xt,lt]);let ae=Mt(J,r),hr=Mt(Ee,ae),Ks=Mt(Ta(o),hr);typeof M!="number"&&!M&&(lt=!1);let zu=ze.useRef(null),Pn=Ft=>{let eo=o.props;eo.onMouseMove&&eo.onMouseMove(Ft),bf={x:Ft.clientX,y:Ft.clientY},zu.current&&zu.current.update()},to={},K0=typeof M=="string";c?(to.title=!lt&&K0&&!d?M:null,to["aria-describedby"]=lt?Tt:null):(to["aria-label"]=K0?M:null,to["aria-labelledby"]=lt&&!K0?Tt:null);let si=O({},to,U,{component:a},o.props,{className:Lt(s,o.props.className),onTouchStart:er,ref:Ks},g?{onMouseMove:Pn}:{}),Fu={};h||(si.onTouchStart=pr,si.onTouchEnd=ee),d||(si.onMouseOver=CM(Ut,si.onMouseOver),si.onMouseLeave=CM(Pi,si.onMouseLeave),St||(Fu.onMouseOver=Ut,Fu.onMouseLeave=Pi)),u||(si.onFocus=EM(st,si.onFocus),si.onBlur=EM(H,si.onBlur),St||(Fu.onFocus=st,Fu.onBlur=H));let Z0=O({},i,{arrow:l,disableInteractive:St,placement:I,touch:ct.current,color:z,variant:B,size:R}),VC=pV(Z0),GC=O({},U,{component:a,slots:L,slotProps:G}),B5=ze.useMemo(()=>[{name:"arrow",enabled:!!Y,options:{element:Y,padding:6}},{name:"offset",options:{offset:[0,10]}},...k||[]],[Y,k]),[z5,F5]=xt("root",{additionalProps:O({id:Tt,popperRef:zu,placement:I,anchorEl:g?{getBoundingClientRect:()=>({top:bf.y,left:bf.x,right:bf.x,bottom:bf.y,width:0,height:0})}:X,open:X?lt:!1,disablePortal:A,keepMounted:P,direction:_,modifiers:B5},Fu),ref:null,className:VC.root,elementType:hV,externalForwardedProps:GC,ownerState:Z0}),[$5,j5]=xt("arrow",{ref:et,className:VC.arrow,elementType:mV,externalForwardedProps:GC,ownerState:Z0});return(0,GS.jsxs)(ze.Fragment,{children:[ze.isValidElement(o)&&ze.cloneElement(o,si),(0,GS.jsxs)(z5,O({},F5,!((n=i.slots)!=null&&n.root)&&{as:Lc,slots:{root:a||"div"}},{children:[M,l?(0,AM.jsx)($5,O({},j5)):null]}))]})}),Yn=gV;p();p();p();var oy=class e extends Error{type;status;description;constructor(t,r){let n=typeof r=="string"?r:void 0;if(super(n||t),this.type=t,this.description=n,typeof r=="number")this.status=r;else switch(t){case"UNAUTHORIZED":this.status=403;break;case"USAGE_LIMIT":case"PREMIUM_FEATURE":this.status=402;break;case"NOT_FOUND":this.status=404;break;case"INVALID_REQUEST":case"EMPTY_DATASOURCE":case"ALREADY_INVITED":case"INTEGRATION_VALIDATION_FAILED":this.status=400;break;case"INTEGRATION_CREDENTIALS_INVALID":this.status=403;break;case"RATE_LIMIT":this.status=429;break;case"NOT_IMPLEMENTED":this.status=501;break;case"INTERNAL_ERROR":this.status=500;break;case"CONFLICT":this.status=409;break;default:this.status=500;break}Object.setPrototypeOf(this,e.prototype)}};p();p();var ay=[{code:"en",nativeName:"English",englishName:"English",flagCode:"US",dir:"ltr",isDefault:!0},{code:"pt-BR",nativeName:"Português (BR)",englishName:"Portuguese (Brazil)",flagCode:"BR",dir:"ltr"},{code:"es",nativeName:"Español",englishName:"Spanish",flagCode:"ES",dir:"ltr"},{code:"ar",nativeName:"العربية",englishName:"Arabic",flagCode:"AE",dir:"rtl"},{code:"az",nativeName:"Azərbaycan dili",englishName:"Azerbaijani",flagCode:"AZ",dir:"ltr"},{code:"bg",nativeName:"Български",englishName:"Bulgarian",flagCode:"BG",dir:"ltr"},{code:"bn",nativeName:"বাংলা",englishName:"Bengali",flagCode:"BD",dir:"ltr"},{code:"ca",nativeName:"Català",englishName:"Catalan",flagCode:"ES",dir:"ltr"},{code:"cs",nativeName:"Čeština",englishName:"Czech",flagCode:"CZ",dir:"ltr"},{code:"da",nativeName:"Dansk",englishName:"Danish",flagCode:"DK",dir:"ltr"},{code:"de",nativeName:"Deutsch",englishName:"German",flagCode:"DE",dir:"ltr"},{code:"el",nativeName:"Ελληνικά",englishName:"Greek",flagCode:"GR",dir:"ltr"},{code:"eo",nativeName:"Esperanto",englishName:"Esperanto",flagCode:"EU",dir:"ltr"},{code:"et",nativeName:"Eesti",englishName:"Estonian",flagCode:"EE",dir:"ltr"},{code:"fa",nativeName:"فارسی",englishName:"Persian",flagCode:"IR",dir:"rtl"},{code:"fi",nativeName:"Suomi",englishName:"Finnish",flagCode:"FI",dir:"ltr"},{code:"fr",nativeName:"Français",englishName:"French",flagCode:"FR",dir:"ltr"},{code:"ga",nativeName:"Gaeilge",englishName:"Irish",flagCode:"IE",dir:"ltr"},{code:"he",nativeName:"עברית",englishName:"Hebrew",flagCode:"IL",dir:"rtl"},{code:"hi",nativeName:"हिन्दी",englishName:"Hindi",flagCode:"IN",dir:"ltr"},{code:"hu",nativeName:"Magyar",englishName:"Hungarian",flagCode:"HU",dir:"ltr"},{code:"id",nativeName:"Bahasa Indonesia",englishName:"Indonesian",flagCode:"ID",dir:"ltr"},{code:"it",nativeName:"Italiano",englishName:"Italian",flagCode:"IT",dir:"ltr"},{code:"ja",nativeName:"日本語",englishName:"Japanese",flagCode:"JP",dir:"ltr"},{code:"ko",nativeName:"한국어",englishName:"Korean",flagCode:"KR",dir:"ltr"},{code:"lt",nativeName:"Lietuvių",englishName:"Lithuanian",flagCode:"LT",dir:"ltr"},{code:"lv",nativeName:"Latviešu",englishName:"Latvian",flagCode:"LV",dir:"ltr"},{code:"ms",nativeName:"Bahasa Melayu",englishName:"Malay",flagCode:"MY",dir:"ltr"},{code:"nb",nativeName:"Norsk Bokmål",englishName:"Norwegian Bokmål",flagCode:"NO",dir:"ltr"},{code:"nl",nativeName:"Nederlands",englishName:"Dutch",flagCode:"NL",dir:"ltr"},{code:"pl",nativeName:"Polski",englishName:"Polish",flagCode:"PL",dir:"ltr"},{code:"pt",nativeName:"Português",englishName:"Portuguese",flagCode:"PT",dir:"ltr"},{code:"ro",nativeName:"Română",englishName:"Romanian",flagCode:"RO",dir:"ltr"},{code:"ru",nativeName:"Русский",englishName:"Russian",flagCode:"RU",dir:"ltr"},{code:"sk",nativeName:"Slovenčina",englishName:"Slovak",flagCode:"SK",dir:"ltr"},{code:"sl",nativeName:"Slovenščina",englishName:"Slovenian",flagCode:"SI",dir:"ltr"},{code:"sv",nativeName:"Svenska",englishName:"Swedish",flagCode:"SE",dir:"ltr"},{code:"th",nativeName:"ไทย",englishName:"Thai",flagCode:"TH",dir:"ltr"},{code:"tl",nativeName:"Tagalog",englishName:"Tagalog",flagCode:"PH",dir:"ltr"},{code:"tr",nativeName:"Türkçe",englishName:"Turkish",flagCode:"TR",dir:"ltr"},{code:"uk",nativeName:"Українська",englishName:"Ukrainian",flagCode:"UA",dir:"ltr"},{code:"ur",nativeName:"اردو",englishName:"Urdu",flagCode:"PK",dir:"rtl"},{code:"zh",nativeName:"中文",englishName:"Chinese",flagCode:"CN",dir:"ltr"}],WS="en",YS=ay.map(e=>e.code),PRt=new Set(YS),RRt=ay.map(e=>({code:e.code,name:e.nativeName,englishName:e.englishName,flag:e.flagCode,dir:e.dir})),yV=new Map(ay.map(e=>[e.code.toLowerCase(),e])),sy=new Map;for(let e of ay){let t=e.code.split("-")[0].toLowerCase();(!sy.has(t)||"isDefault"in e&&e.isDefault)&&sy.set(t,e.code)}function _M(e,t=WS){let r=e?.trim();if(!r)return t;let n=yV.get(r.toLowerCase());if(n)return n.code;let i=r.split("-")[0]?.toLowerCase();return i&&sy.has(i)?sy.get(i)??t:t}var Qe=WS,Te="translations",vV=!1,Ja="https://cdn.jsdelivr.net/npm/@zappway/embeds@2.0.2/dist/locales",QS=YS,MRt=new Set(QS),Sf={main:{localeDirectory:"locales-ZappWay",splitDirectories:["i18n-split"],browserDirectories:[],cdnDirectory:"locales-ZappWay",cdnSplit:!0},lp:{localeDirectory:"locales-ZappWay-LP",splitDirectories:["i18n-split-lp","i18n-split-zappway-lp"],browserDirectories:[],cdnDirectory:"locales-ZappWay-LP",cdnSplit:!1},integrations:{localeDirectory:"locales-Integrations",splitDirectories:["i18n-split-integrations"],browserDirectories:[],cdnDirectory:"locales-Integrations",cdnSplit:!1},emails:{localeDirectory:"locales-Emails",splitDirectories:["i18n-split-emails"],browserDirectories:[],cdnDirectory:"locales-Emails",cdnSplit:!1},workers:{localeDirectory:"locales-Workers",splitDirectories:["i18n-split-workers"],browserDirectories:[],cdnDirectory:"locales-Workers",cdnSplit:!1},zappflux:{localeDirectory:"locales-ZappFlux",splitDirectories:["i18n-split-zappflux"],browserDirectories:[],cdnDirectory:"locales-ZappFlux",cdnSplit:!1},"zappflux-lp":{localeDirectory:"locales-ZappFlux-LP",splitDirectories:["i18n-split-zappflux-lp"],browserDirectories:[],cdnDirectory:"locales-ZappFlux-LP",cdnSplit:!1},"zappflux-templates":{localeDirectory:"locales-ZappFlux-Templates",splitDirectories:["i18n-split-zappflux-templates"],browserDirectories:[],cdnDirectory:"locales-ZappFlux-Templates",cdnSplit:!1,namespaceFiles:!0},"pitch-deck":{localeDirectory:"locales-PitchDeck",splitDirectories:["i18n-split-pitch-deck"],browserDirectories:[],cdnDirectory:"locales-PitchDeck",cdnSplit:!1},reports:{localeDirectory:"locales-Reports",splitDirectories:["i18n-split-reports"],browserDirectories:[],cdnDirectory:"locales-Reports",cdnSplit:!1},rag:{localeDirectory:"locales-RAG",splitDirectories:["i18n-split-rag"],browserDirectories:[],cdnDirectory:"locales-RAG",cdnSplit:!1}},hy={lp:"lp",rag:"rag",flow:"zappflux",emails:"emails",workers:"workers",reports:"reports",zappflux:"zappflux",integrations:"integrations","pitch-deck":"pitch-deck","zappflux-lp":"zappflux-lp","zappflux-templates":"zappflux-templates",WhatsAppSettings:"integrations",WhatsAppIntegrationPage:"integrations",WhatsAppBusiness_IntegrationSettings:"integrations",TelegramSettings:"integrations",Telegram_IntegrationSettings:"integrations",InstagramSettings:"integrations",Instagram_IntegrationSettings:"integrations",MessengerSettings:"integrations",Messenger_IntegrationSettings:"integrations",TikTokSettings:"integrations",TikTok_IntegrationSettings:"integrations",ZendeskSettings:"integrations",Zendesk_IntegrationSettings:"integrations",SlackSettings:"integrations",ShopifySettings:"integrations",ConnectWhatsApp:"integrations",QRCode:"integrations",crisp:"integrations",crispConfig:"integrations",crispSettingsModal:"integrations"},ly=null,xf=null,Wi=null,XS=null,jc=null,Ts=null,cr=null,KS=null,bV=globalThis.eval;function xV(){if(Wi)return Wi;try{if(typeof __non_webpack_require__=="function")Wi=__non_webpack_require__;else if(typeof Q0=="function")Wi=Q0;else if(globalThis.require)Wi=globalThis.require;else{let e="require";Wi=globalThis[e]||bV(e)}return Wi}catch(e){return console.error(" [i18n-runtime-loader] Critical: Failed to obtain require function",e),null}}function Hc(){if(typeof window<"u")return!1;if(ly&&xf)return!0;try{let e=xV();return e?(ly=e("fs"),xf=e("path"),XS=ly.readFileSync,jc=ly.existsSync,Ts=xf.join,cr=xf.resolve,KS=xf.dirname,!0):!1}catch{return!1}}var cy=new Map,PM=new Map;function JS(e){if(Hc(),!jc)return[];let t=new Set;return e.filter(r=>!!r).filter(r=>t.has(r)||!jc(r)?!1:(t.add(r),!0))}function SV(e){if(Hc(),!(!Wi||!KS))try{let r=Wi.resolve.call(Wi,`${e}/package.json`);return KS(r)}catch{return}}var uy=null;function TV(){if(uy)return uy;if(Hc(),!cr)return[];let e=process.cwd(),t=S.ZW_I18N_CACHE_ROOT;return uy=JS([t,cr(e,".next/cache"),cr(e,"../.next/cache"),cr(e,"../../.next/cache"),cr(e,"apps/zappway/dashboard/.next/cache"),cr(e,"packages/zappflux/packages/app/.next/cache"),"/var/task/.next/cache","/var/task/apps/zappway/dashboard/.next/cache"]),uy}var dy=null;function wV(){if(dy)return dy;if(Hc(),!cr||!Ts)return[];let e=process.cwd(),t=SV("@zappway/lib");return dy=JS([t,cr(e,"packages/zappway/lib"),cr(e,"../packages/zappway/lib"),cr(e,"../../packages/zappway/lib"),cr(e,"../../../packages/zappway/lib"),cr(e,"../../../../packages/zappway/lib"),cr(e,"node_modules/@zappway/lib"),cr(e,"../node_modules/@zappway/lib"),cr(e,"../../node_modules/@zappway/lib"),cr(e,"../../../node_modules/@zappway/lib"),cr(e,"../../../../node_modules/@zappway/lib")]).filter(r=>jc(Ts(r,"locales"))),dy}var qS=new Map;function RM(e){if(qS.has(e))return qS.get(e);if(Hc(),!XS||!jc||!jc(e))return null;try{let t=XS(e,"utf8"),r=JSON.parse(t);return qS.set(e,r),r}catch{return null}}function ZS(e,t){if(!e)return null;let r=t||Te;if(r===Te)return e;if(e[r])return e[r];let n=r.split("."),i=e,o=!0;for(let s of n)if(i&&typeof i=="object"&&s in i)i=i[s];else{o=!1;break}return o&&i&&typeof i=="object"?i:r!==Te?{}:e}var fy=null;function CV(){return fy||(fy=JS([...TV(),...wV()]),fy)}function my(e){return _M(e,Qe)}function tT(e,t,r){if(typeof window<"u"||!Hc())return{};let n=my(e),i=r||Te,o=`node:${n}:${t}:${i}`,s=cy.get(o);if(s)return s;let a=Sf[t];if(t==="main"&&i!==Te&&hy[i])return cy.set(o,{}),{};let l=CV(),c=[];for(let d of l){for(let f of a.splitDirectories)c.push(Ts(d,f,n,`${i}.json`)),c.push(Ts(d,"locales",f,n,`${i}.json`));c.push(Ts(d,a.localeDirectory,n,`${i}.json`)),c.push(Ts(d,"locales",a.localeDirectory,n,`${i}.json`))}for(let d of c){let f=RM(d);if(f&&Object.keys(f).length>0)return cy.set(o,f),f}let u={};for(let d of l){let f=Ts(d,"locales",a.localeDirectory,n,"translations.json"),h=RM(f);if(h){if(u=ZS(h,r)||{},Object.keys(u).length>0)break}else vV&&r===Te&&console.warn(` [i18n] Bundle not found or empty: ${f} (CWD: ${typeof process<"u"?process.cwd():"unknown"})`)}return Object.keys(u).length===0&&n!==Qe?tT(Qe,t,r):(cy.set(o,u),u)}function eT(e,t,r){let n=t.map(i=>tT(e,i,r));return OM(n)}async function py(e,t=2e3){let r=new AbortController,n=setTimeout(()=>r.abort(),t);try{let i=await fetch(`${e}?v=${Date.now()}`,{signal:r.signal,cache:"force-cache"});return clearTimeout(n),i.ok?await i.json():null}catch{return clearTimeout(n),null}}async function EV(e,t,r){let n=my(e),i=r||Te,s=`${typeof window>"u"?"node":"browser"}:${n}:${t}:${i}`,a=PM.get(s);if(a)return await a||{};let l=Sf[t],c=(async()=>{if(typeof window>"u"){let u=tT(e,t,r);if(u&&Object.keys(u).length>0)return u;let d=t==="main"&&i!==Te&&!i.includes(".")?`${Ja}/${l.cdnDirectory}/${n}/${i}.json`:`${Ja}/${l.cdnDirectory}/${n}/translations.json`;try{let f=await py(d,3e3);if(f){let h=ZS(f,r);if(h&&Object.keys(h).length>0)return h}}catch{}}else{for(let h of l.browserDirectories){let m=await py(`/locales-runtime/${h}/${n}/${i}.json`);if(m)return m}let u=await py(`/api/i18n/${n}/${i}`);if(u)return u;let d=t==="main"&&i!==Te&&!i.includes(".")?`${Ja}/${l.cdnDirectory}/${n}/${i}.json`:`${Ja}/${l.cdnDirectory}/${n}/translations.json`,f=await py(d);if(f)return ZS(f,r)||{}}return{}})();return PM.set(s,c),c||{}}async function gy(e,t,r){let n=t.map(o=>EV(e,o,r)),i=await Promise.all(n);return OM(i)}function kM(e,t){let r={...e};for(let[n,i]of Object.entries(t||{})){let o=r[n];o&&typeof o=="object"&&i&&typeof i=="object"&&!Array.isArray(i)?r[n]=kM(o,i):r[n]=i}return r}function OM(e){return e.reduce((t,r)=>kM(t,r||{}),{})}var iT=["lp","rag","main","emails","reports","workers","zappflux","zappflux-lp","integrations","zappflux-templates"],rT={},Uc={},nT=new Map;function sT(){let e=typeof window<"u"?window.location.pathname.split("/")[1]:null,t=typeof window<"u"?new URL(window.location.href).searchParams.get("lang")||new URL(window.location.href).searchParams.get("locale"):null,r=e||t||typeof document>"u"?null:document.cookie.split(";").find(o=>o.trim().startsWith("NEXT_LOCALE="))?.split("=")[1],n=globalThis.headers?.get?.("accept-language")?.split(",")[0],i=typeof navigator<"u"?navigator.language:null;return vy(e||t||r||n||i||Qe)}function vy(e){return my(e)}function WV(e){let t=e&&e.length?e:[Te];return Array.from(new Set([Te,...t]))}function Tf(e){return!e||Object.keys(e).length===0}function yy(e,t){if(!e)return null;let r=t||Te;if(r===Te||r!==Te&&hy[r]===r)return e;if(e[r])return e[r];let n=e,i=!0,o=r.split(".");for(let s of o)if(n&&typeof n=="object"&&s in n)n=n[s];else{i=!1;break}return i&&n&&typeof n=="object"?n:r===Te?e:{}}function NM(e,t=Te){let r=vy(e),n=`fs:${r}:${t}`,i=Uc[n];if(i)return i;let o=t===Te?void 0:t,s=eT(r,iT,o);if(!Tf(s))return Uc[n]=s,s;let a=`fs:${Qe}:${t}`,l=Uc[a];if(l)return l;let c=eT(Qe,iT,o);if(!Tf(c))return Uc[a]=c,c;throw new oy("INTERNAL_ERROR",500)}async function oT(e,t=3e3){let r=new AbortController,n=setTimeout(()=>r.abort(),t);try{let i=await fetch(e,{signal:r.signal,cache:"force-cache"});return i.ok?await i.json():null}catch{return null}finally{clearTimeout(n)}}async function YV(e,t="main"){if(t==="main")return null;let r=Sf[t].cdnDirectory,n=`bundle:${e}:${r}`;if(nT.has(n))return nT.get(n);let i=(async()=>{let o=`${Ja}/${r}/${e}/translations.json`;return await oT(o,3e3)})();return nT.set(n,i),i}async function IM(e,t=Te,r){let n=vy(e),i=`cdn:${n}:${t}`,o=Uc[i];if(o)return o;let s=hy[t]||"main",a=Sf[s].cdnDirectory,l=async m=>{let y=t.split(".")[0],x=`${Ja}/${a}/${m}/${y}.json`,g=await oT(x,2e3);return g?yy(g,t):null},c=async m=>{if(!r)return null;let y=t.split(".")[0],x=`${r}/api/i18n/${m}/${y}`,g=await oT(x,2e3);return yy(g||{},t)},u=async m=>{try{let{loadManualTranslationsWithZappFlux:y}=await Promise.resolve().then(()=>(LM(),MM)),x=await y(m);return yy(x||{},t)}catch{return null}},d=async m=>{try{return await gy(m,iT,t)}catch{return null}},f=null;if(s==="main")f=await c(n),f||(f=await l(n)),f||(f=await u(n)),f||(f=await d(n)),f||(f=await c(Qe)),f||(f=await l(Qe)),f||(f=await u(Qe)),f||(f=await d(Qe));else{if(f=await c(n),Tf(f||{})){let m=await YV(n,s);f=yy(m||{},t)}Tf(f||{})&&(f=await u(n)),Tf(f||{})&&(f=await d(n))}let h=f||{};return Uc[i]=h,h}async function BM(e,t,r){let n=vy(e||sT()),i=WV(t),o=r||(typeof window<"u"?window.location.origin:void 0),s=typeof window>"u"?"node":"browser",a=`inst:${n}:${i.slice().sort().join("|")}:${s}`;if(rT[a])return rT[a];let l=typeof window>"u",c={[n]:{}};for(let d of i)c[n][d]=l?NM(n,d):await IM(n,d,o);if(n!==Qe){c[Qe]={};for(let d of i)c[Qe][d]=l?NM(Qe,d):await IM(Qe,d,o)}let u=VA();return await u.init({lng:n,fallbackLng:Qe,defaultNS:i[0],ns:i,resources:c,interpolation:{escapeValue:!1}}),rT[a]=u,u}p();p();var{slice:qV,forEach:XV}=[];function KV(e){return XV.call(qV.call(arguments,1),t=>{if(t)for(let r in t)e[r]===void 0&&(e[r]=t[r])}),e}function ZV(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(e))}var zM=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,QV=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},i=encodeURIComponent(t),o=`${e}=${i}`;if(n.maxAge>0){let s=n.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(s)}`}if(n.domain){if(!zM.test(n.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${n.domain}`}if(n.path){if(!zM.test(n.path))throw new TypeError("option path is invalid");o+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(o+="; Partitioned"),o},FM={create(e,t,r,n){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),n&&(i.domain=n),document.cookie=QV(e,t,i)},read(e){let t=`${e}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let i=r[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return i.substring(t.length,i.length)}return null},remove(e,t){this.create(e,"",-1,t)}},JV={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return FM.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:n,cookieDomain:i,cookieOptions:o}=t;r&&typeof document<"u"&&FM.create(r,e,n,i,o)}},t9={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,r;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));let o=n.substring(1).split("&");for(let s=0;s<o.length;s++){let a=o[s].indexOf("=");a>0&&o[s].substring(0,a)===t&&(r=o[s].substring(a+1))}}return r}},e9={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:r}=e,n;if(typeof window<"u"){let{hash:i}=window.location;if(i&&i.length>2){let o=i.substring(1);if(t){let s=o.split("&");for(let a=0;a<s.length;a++){let l=s[a].indexOf("=");l>0&&s[a].substring(0,l)===t&&(n=s[a].substring(l+1))}}if(n)return n;if(!n&&r>-1){let s=i.match(/\/([a-zA-Z-]*)/g);return Array.isArray(s)?s[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return n}},Vc=null,$M=()=>{if(Vc!==null)return Vc;try{if(Vc=typeof window<"u"&&window.localStorage!==null,!Vc)return!1;let e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Vc=!1}return Vc},r9={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&$M())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&$M()&&window.localStorage.setItem(r,e)}},Gc=null,jM=()=>{if(Gc!==null)return Gc;try{if(Gc=typeof window<"u"&&window.sessionStorage!==null,!Gc)return!1;let e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Gc=!1}return Gc},n9={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&jM())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&jM()&&window.sessionStorage.setItem(r,e)}},i9={name:"navigator",lookup(e){let t=[];if(typeof navigator<"u"){let{languages:r,userLanguage:n,language:i}=navigator;if(r)for(let o=0;o<r.length;o++)t.push(r[o]);n&&t.push(n),i&&t.push(i)}return t.length>0?t:void 0}},o9={name:"htmlTag",lookup(e){let{htmlTag:t}=e,r,n=t||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},s9={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;let r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof t=="number"?t:0]?.replace("/",""):void 0}},a9={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e,r=typeof t=="number"?t+1:1,n=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[r]}},HM=!1;try{document.cookie,HM=!0}catch{}var UM=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];HM||UM.splice(1,1);var l9=()=>({order:UM,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}),wf=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,r)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=KV(r,this.options||{},l9()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(JV),this.addDetector(t9),this.addDetector(r9),this.addDetector(n9),this.addDetector(i9),this.addDetector(o9),this.addDetector(s9),this.addDetector(a9),this.addDetector(e9)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return t.forEach(n=>{if(this.detectors[n]){let i=this.detectors[n].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(r=r.concat(i))}}),r=r.filter(n=>n!=null&&!ZV(n)).map(n=>this.options.convertDetectedLanguage(n)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(t,this.options)}))}};wf.type="languageDetector";var c9={type:"backend",init:()=>{},read:(e,t,r)=>{gy(e,["main"],t).then(n=>{t===Te&&n&&Object.entries(n).forEach(([i,o])=>{i!==Te&&o&&typeof o=="object"&&!Array.isArray(o)&&nr.addResourceBundle(e,i,o,!0,!0)}),r(null,n)}).catch(n=>{r(n,null)})}};nr.use(c9).use(wf).use(Gh).init({fallbackLng:Qe,supportedLngs:QS,ns:[Te],defaultNS:Te,partialBundledLanguages:!0,nonExplicitSupportedLngs:!0,nsSeparator:":",keySeparator:".",interpolation:{escapeValue:!1},detection:{order:["cookie","localStorage","sessionStorage","navigator"],lookupCookie:"NEXT_LOCALE",caches:["cookie"]}});var by=nr;p();var tl=D(F());function u9(){if(typeof document>"u")return;let e=document.documentElement.style.colorScheme;if(e==="light"||e==="dark")return e;if(document.body?.classList.contains("light"))return"light";if(document.body?.classList.contains("dark"))return"dark";if(typeof window<"u"&&window.matchMedia){if(window.matchMedia("(prefers-color-scheme: light)").matches)return"light";if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}}function aT(e,t){let{mode:r}=nS(),[n,i]=(0,tl.useState)(!1),[o,s]=(0,tl.useState)(void 0),a=t?.syncDocumentColorScheme??!0;(0,tl.useEffect)(()=>{s(u9())},[]),(0,tl.useEffect)(()=>{i(!0)},[]),(0,tl.useEffect)(()=>{!a||!n||!r||typeof document>"u"||document.documentElement.setAttribute("data-color-scheme",r)},[r,n,a]);let l=n?e??r:o;return{safeMode:l,hasMounted:n,isDark:l==="dark",isLight:l==="light"}}var Q=D(Z()),VM=mi`
|
|
120
|
+
`),z8),({ownerState:e,theme:t})=>{let{borderRadius:r,height:n}=Nc({theme:t,ownerState:e},["borderRadius","height"]);return O({},r!==void 0&&{"--LinearProgress-radius":r},n!==void 0&&{"--LinearProgress-thickness":n})}),j8=cM.forwardRef(function(t,r){let n=zt({props:t,name:"JoyLinearProgress"}),{children:i,className:o,component:s,color:a="primary",size:l="md",variant:c="soft",thickness:u,determinate:d=!1,value:f=d?0:25,style:h,slots:m={},slotProps:y={}}=n,x=at(n,B8),g=O({},n,{component:s,color:a,size:l,variant:c,thickness:u,value:f,determinate:d,instanceSize:t.size}),v=F8(g),b=O({},x,{component:s,slots:m,slotProps:y}),[w,T]=xt("root",{ref:r,className:Lt(v.root,o),elementType:$8,externalForwardedProps:b,ownerState:g,additionalProps:O({as:s,role:"progressbar",style:O({},{"--LinearProgress-percent":f},h)},typeof f=="number"&&d&&{"aria-valuenow":Math.round(f)})});return(0,uM.jsx)(w,O({},T,{children:i}))}),Jg=j8;p();p();he();wt();var $c=D(F());Wt();p();function dM(e){return Yt("MuiMenu",e)}var qEt=qt("MuiMenu",["root","listbox","expanded","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid","sizeSm","sizeMd","sizeLg"]);var Fc=D(Z()),H8=["actions","children","color","component","disablePortal","keepMounted","id","invertedColors","onItemsChange","modifiers","variant","size","slots","slotProps"],U8=e=>{let{open:t,variant:r,color:n,size:i}=e,o={root:["root",t&&"expanded",r&&`variant${it(r)}`,n&&`color${it(n)}`,i&&`size${it(i)}`],listbox:["listbox"]};return Pt(o,dM,{})},fM=rt(LS,{name:"JoyMenu",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e,ownerState:t})=>{var r,n;let i=(r=e.variants[t.variant])==null?void 0:r[t.color];return[O({"--focus-outline-offset":`calc(${e.vars.focus.thickness} * -1)`,"--ListItem-stickyBackground":i?.backgroundColor||i?.background||e.vars.palette.background.popup,"--ListItem-stickyTop":"calc(var(--List-padding, var(--ListDivider-gap)) * -1)"},CD,{borderRadius:`var(--List-radius, ${e.vars.radius.sm})`,boxShadow:e.shadow.md,overflow:"auto",zIndex:`var(--unstable_popup-zIndex, ${e.vars.zIndex.popup})`},!(i!=null&&i.backgroundColor)&&{backgroundColor:e.vars.palette.background.popup},t.variant==="solid"&&t.color&&t.invertedColors&&df(t.color)(e),t.variant==="soft"&&t.color&&t.invertedColors&&ff(t.color)(e),(n=e.variants[t.variant])==null?void 0:n[t.color])]}),V8=$c.forwardRef(function(t,r){var n;let i=zt({props:t,name:"JoyMenu"}),{actions:o,children:s,color:a="neutral",component:l,disablePortal:c=!1,keepMounted:u=!1,id:d,invertedColors:f=!1,onItemsChange:h,modifiers:m,variant:y="outlined",size:x="md",slots:g={},slotProps:v={}}=i,b=at(i,H8),{contextValue:w,getListboxProps:T,dispatch:C,open:E,triggerElement:A}=dS({onItemsChange:h,id:d,listboxRef:r});$c.useImperativeHandle(o,()=>({dispatch:C,resetHighlight:()=>C({type:re.resetHighlight,event:null})}),[C]);let _=O({},i,{disablePortal:c,invertedColors:f,color:a,variant:y,size:x,open:E,nesting:!1,row:!1}),P=U8(_),k=O({},b,{component:l,slots:g,slotProps:v}),I=$c.useMemo(()=>[{name:"offset",options:{offset:[0,4]}},...m||[]],[m]),M=Sa({elementType:fM,getSlotProps:T,externalForwardedProps:k,externalSlotProps:{},ownerState:_,additionalProps:{anchorEl:A,open:E&&A!==null,disablePortal:c,keepMounted:u,modifiers:I},className:P.root});return(0,Fc.jsx)(fM,O({},M,!((n=i.slots)!=null&&n.root)&&{as:Lc,slots:{root:l||"ul"}},{children:(0,Fc.jsx)(FO,{value:w,children:(0,Fc.jsx)(LD,{variant:f?void 0:y,color:a,children:(0,Fc.jsx)(wD.Provider,{value:"menu",children:(0,Fc.jsx)(ED,{nested:!0,children:s})})})})}))}),ty=V8;p();p();he();wt();var ey=D(F());Wt();p();function pM(e){return Yt("MuiMenuButton",e)}var SAt=qt("MuiMenuButton",["root","colorPrimary","colorNeutral","colorDanger","colorInfo","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid","disabled","sizeSm","sizeMd","sizeLg","fullWidth","startDecorator","endDecorator","loading","loadingIndicatorCenter"]);var gf=D(Z()),hM=D(Z()),G8=["children","color","component","disabled","endDecorator","loading","loadingPosition","loadingIndicator","size","slotProps","slots","startDecorator","variant"],W8=e=>{let{color:t,disabled:r,fullWidth:n,size:i,variant:o,loading:s}=e,a={root:["root",r&&"disabled",n&&"fullWidth",o&&`variant${it(o)}`,t&&`color${it(t)}`,i&&`size${it(i)}`,s&&"loading"],startDecorator:["startDecorator"],endDecorator:["endDecorator"],loadingIndicatorCenter:["loadingIndicatorCenter"]};return Pt(a,pM,{})},Y8=rt("button",{name:"JoyMenuButton",slot:"Root",overridesResolver:(e,t)=>t.root})(US),q8=rt("span",{name:"JoyMenuButton",slot:"StartDecorator",overridesResolver:(e,t)=>t.startDecorator})({"--Icon-margin":"0 0 0 calc(var(--Button-gap) / -2)","--CircularProgress-margin":"0 0 0 calc(var(--Button-gap) / -2)",display:"inherit",marginRight:"var(--Button-gap)"}),X8=rt("span",{name:"JoyMenuButton",slot:"EndDecorator",overridesResolver:(e,t)=>t.endDecorator})({"--Icon-margin":"0 calc(var(--Button-gap) / -2) 0 0","--CircularProgress-margin":"0 calc(var(--Button-gap) / -2) 0 0",display:"inherit",marginLeft:"var(--Button-gap)"}),K8=rt("span",{name:"JoyMenuButton",slot:"LoadingCenter",overridesResolver:(e,t)=>t.loadingIndicatorCenter})(({theme:e,ownerState:t})=>{var r,n;return O({display:"inherit",position:"absolute",left:"50%",transform:"translateX(-50%)",color:(r=e.variants[t.variant])==null||(r=r[t.color])==null?void 0:r.color},t.disabled&&{color:(n=e.variants[`${t.variant}Disabled`])==null||(n=n[t.color])==null?void 0:n.color})}),Z8=ey.forwardRef(function(t,r){var n;let i=zt({props:t,name:"JoyMenuButton"}),{children:o,color:s="neutral",component:a,disabled:l=!1,endDecorator:c,loading:u=!1,loadingPosition:d="center",loadingIndicator:f,size:h="md",slotProps:m={},slots:y={},startDecorator:x,variant:g="outlined"}=i,v=at(i,G8),b=ey.useContext(Bc),w=t.variant||b.variant||g,T=t.size||b.size||h,C=(n=t.disabled)!=null?n:b.disabled||l||u,{getRootProps:E,open:A,active:_}=yS({rootRef:r,disabled:C}),P=f??(0,gf.jsx)(Wn,{color:s,thickness:{sm:2,md:3,lg:4}[T]||3}),k=O({},i,{active:_,color:s,disabled:C,open:A,size:T,variant:w}),I=W8(k),M=O({},v,{component:a,slots:y,slotProps:m}),[z,B]=xt("root",{elementType:Y8,getSlotProps:E,externalForwardedProps:M,ref:r,ownerState:k,className:I.root}),[R,L]=xt("startDecorator",{className:I.startDecorator,elementType:q8,externalForwardedProps:M,ownerState:k}),[G,U]=xt("endDecorator",{className:I.endDecorator,elementType:X8,externalForwardedProps:M,ownerState:k}),[X,J]=xt("loadingIndicatorCenter",{className:I.loadingIndicatorCenter,elementType:K8,externalForwardedProps:M,ownerState:k});return(0,hM.jsxs)(z,O({},B,{children:[(x||u&&d==="start")&&(0,gf.jsx)(R,O({},L,{children:u&&d==="start"?P:x})),o,u&&d==="center"&&(0,gf.jsx)(X,O({},J,{children:P})),(c||u&&d==="end")&&(0,gf.jsx)(G,O({},U,{children:u&&d==="end"?P:c}))]}))}),ry=Z8;p();p();wt();he();var Za=D(F());Wt();p();function mM(e){return Yt("MuiMenuItem",e)}var VAt=qt("MuiMenuItem",["root","focusVisible","disabled","selected","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantSoft","variantOutlined","variantSolid"]);var yf=D(Z()),Q8=["children","disabled","component","selected","color","orientation","variant","slots","slotProps","id"],J8=e=>{let{focusVisible:t,disabled:r,selected:n,color:i,variant:o}=e,s={root:["root",t&&"focusVisible",r&&"disabled",n&&"selected",i&&`color${it(i)}`,o&&`variant${it(o)}`]};return Pt(s,mM,{})},tV=rt(NS,{name:"JoyMenuItem",slot:"Root",overridesResolver:(e,t)=>t.root})({}),eV=Za.memo(Za.forwardRef(function(t,r){let n=zt({props:t,name:"JoyMenuItem"}),i=Za.useContext(Gg),{children:o,disabled:s=!1,component:a="li",selected:l=!1,color:c="neutral",orientation:u="horizontal",variant:d="plain",slots:f={},slotProps:h={},id:m}=n,y=at(n,Q8),{variant:x=d,color:g=c}=MD(t.variant,t.color),{getRootProps:v,disabled:b,focusVisible:w}=vS({id:m,disabled:s,rootRef:r}),T=O({},n,{component:a,color:g,disabled:b,focusVisible:w,orientation:u,selected:l,row:i,variant:x}),C=J8(T),E=O({},y,{component:a,slots:f,slotProps:h}),[A,_]=xt("root",{ref:r,elementType:tV,getSlotProps:v,externalForwardedProps:E,className:C.root,ownerState:T});return(0,yf.jsx)(PD.Provider,{value:u,children:(0,yf.jsx)(A,O({},_,{children:o}))})})),rV=Za.forwardRef(function(t,r){let{contextValue:n,id:i}=WO(t.id);return(0,yf.jsx)(ys.Provider,{value:n,children:(0,yf.jsx)(eV,O({},t,{id:i,ref:r}))})}),ny=rV;p();p();he();wt();var yM=D(F());rr();p();function gM(e){return Yt("MuiScopedCssBaseline",e)}var h_t=qt("MuiScopedCssBaseline",["root"]);var vM=D(Z()),nV=["className","component","disableColorScheme","slots","slotProps"],iV=()=>Pt({root:["root"]},gM,{}),oV=rt("div",{name:"JoyScopedCssBaseline",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e,ownerState:t})=>{let r={};return!t.disableColorScheme&&e.colorSchemes&&Object.entries(e.colorSchemes).forEach(([n,i])=>{var o;r[`&${e.getColorSchemeSelector(n).replace(/\s*&/,"")}`]={colorScheme:(o=i.palette)==null?void 0:o.mode}}),O({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",color:e.vars.palette.text.primary},e.typography["body-md"],{backgroundColor:e.vars.palette.background.body,"@media print":{backgroundColor:"#fff"},"& *, & *::before, & *::after":{boxSizing:"inherit"},"& strong, & b":{fontWeight:"bold"}},r)}),sV=yM.forwardRef(function(t,r){let n=zt({props:t,name:"JoyScopedCssBaseline"}),{className:i,component:o="div",disableColorScheme:s=!1,slots:a={},slotProps:l={}}=n,c=at(n,nV),u=O({},n,{component:o,disableColorScheme:s}),d=iV(),f=O({},c,{component:o,slots:a,slotProps:l}),[h,m]=xt("root",{ref:r,className:Lt(d.root,i),elementType:oV,externalForwardedProps:f,ownerState:u});return(0,vM.jsx)(h,O({},m))}),VS=sV;p();p();he();wt();var xM=D(F());rr();Wt();p();function bM(e){return Yt("MuiSheet",e)}var M_t=qt("MuiSheet",["root","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid"]);var SM=D(Z()),aV=["className","color","component","variant","invertedColors","slots","slotProps"],lV=e=>{let{variant:t,color:r}=e,n={root:["root",t&&`variant${it(t)}`,r&&`color${it(r)}`]};return Pt(n,bM,{})},cV=rt("div",{name:"JoySheet",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e,ownerState:t})=>{var r,n;let i=(r=e.variants[t.variant])==null?void 0:r[t.color],{borderRadius:o,bgcolor:s,backgroundColor:a,background:l}=Nc({theme:e,ownerState:t},["borderRadius","bgcolor","backgroundColor","background"]),c=ji(e,`palette.${s}`)||s||ji(e,`palette.${a}`)||a||l||i?.backgroundColor||i?.background||e.vars.palette.background.surface;return[O({"--Icon-color":t.color!=="neutral"||t.variant==="solid"?"currentColor":e.vars.palette.text.icon,"--ListItem-stickyBackground":c==="transparent"?"initial":c,"--Sheet-background":c==="transparent"?"initial":c},o!==void 0&&{"--List-radius":`calc(${o} - var(--variant-borderWidth, 0px))`,"--unstable_actionRadius":`calc(${o} - var(--variant-borderWidth, 0px))`},{backgroundColor:e.vars.palette.background.surface,position:"relative"}),O({},e.typography["body-md"],t.variant==="solid"&&t.color&&t.invertedColors&&df(t.color)(e),t.variant==="soft"&&t.color&&t.invertedColors&&ff(t.color)(e),(n=e.variants[t.variant])==null?void 0:n[t.color],i)]}),uV=xM.forwardRef(function(t,r){let n=zt({props:t,name:"JoySheet"}),{className:i,color:o="neutral",component:s="div",variant:a="plain",invertedColors:l=!1,slots:c={},slotProps:u={}}=n,d=at(n,aV),f=O({},n,{color:o,component:s,invertedColors:l,variant:a}),h=lV(f),m=O({},d,{component:s,slots:c,slotProps:u}),[y,x]=xt("root",{ref:r,className:Lt(h.root,i),elementType:cV,externalForwardedProps:m,ownerState:f});return(0,SM.jsx)(y,O({},x))}),vf=uV;p();p();var dV=Rg({createStyledComponent:rt("div",{name:"JoyStack",slot:"Root",overridesResolver:(e,t)=>t.root}),useThemeProps:e=>zt({props:e,name:"JoyStack"})}),Qa=dV;p();p();he();wt();var ze=D(F());rr();Wt();p();function TM(e){return Yt("MuiTooltip",e)}var fPt=qt("MuiTooltip",["root","tooltipArrow","arrow","touch","placementLeft","placementRight","placementTop","placementBottom","colorPrimary","colorDanger","colorNeutral","colorSuccess","colorWarning","colorContext","sizeSm","sizeMd","sizeLg","variantPlain","variantOutlined","variantSoft","variantSolid"]);var AM=D(Z()),GS=D(Z()),fV=["children","className","component","arrow","describeChild","disableFocusListener","disableHoverListener","disableInteractive","disableTouchListener","enterDelay","enterNextDelay","enterTouchDelay","followCursor","id","leaveDelay","leaveTouchDelay","onClose","onOpen","open","disablePortal","direction","keepMounted","modifiers","placement","title","color","variant","size","slots","slotProps"],pV=e=>{let{arrow:t,variant:r,color:n,size:i,placement:o,touch:s}=e,a={root:["root",t&&"tooltipArrow",s&&"touch",i&&`size${it(i)}`,n&&`color${it(n)}`,r&&`variant${it(r)}`,`tooltipPlacement${it(o.split("-")[0])}`],arrow:["arrow"]};return Pt(a,TM,{})},hV=rt("div",{name:"JoyTooltip",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e,theme:t})=>{var r,n,i;let o=(r=t.variants[e.variant])==null?void 0:r[e.color];return O({},e.size==="sm"&&{"--Icon-fontSize":t.vars.fontSize.md,"--Tooltip-arrowSize":"8px",padding:t.spacing(.25,.625)},e.size==="md"&&{"--Icon-fontSize":t.vars.fontSize.lg,"--Tooltip-arrowSize":"10px",padding:t.spacing(.5,.75)},e.size==="lg"&&{"--Icon-fontSize":t.vars.fontSize.xl,"--Tooltip-arrowSize":"12px",padding:t.spacing(.75,1)},{zIndex:t.vars.zIndex.tooltip,borderRadius:t.vars.radius.sm,boxShadow:t.shadow.sm,wordWrap:"break-word",position:"relative"},e.disableInteractive&&{pointerEvents:"none"},t.typography[`body-${{sm:"xs",md:"sm",lg:"md"}[e.size]}`],o,!o.backgroundColor&&{backgroundColor:t.vars.palette.background.surface},{"&::before":{content:'""',display:"block",position:"absolute",width:(n=e.placement)!=null&&n.match(/(top|bottom)/)?"100%":"calc(10px + var(--variant-borderWidth, 0px))",height:(i=e.placement)!=null&&i.match(/(top|bottom)/)?"calc(10px + var(--variant-borderWidth, 0px))":"100%"},'&[data-popper-placement*="bottom"]::before':{top:0,left:0,transform:"translateY(-100%)"},'&[data-popper-placement*="left"]::before':{top:0,right:0,transform:"translateX(100%)"},'&[data-popper-placement*="right"]::before':{top:0,left:0,transform:"translateX(-100%)"},'&[data-popper-placement*="top"]::before':{bottom:0,left:0,transform:"translateY(100%)"}})}),mV=rt("span",{name:"JoyTooltip",slot:"Arrow",overridesResolver:(e,t)=>t.arrow})(({theme:e,ownerState:t})=>{var r,n,i;let o=(r=e.variants[t.variant])==null?void 0:r[t.color];return{"--unstable_Tooltip-arrowRotation":0,width:"var(--Tooltip-arrowSize)",height:"var(--Tooltip-arrowSize)",boxSizing:"border-box","&::before":{content:'""',display:"block",position:"absolute",width:0,height:0,border:"calc(var(--Tooltip-arrowSize) / 2) solid",borderLeftColor:"transparent",borderBottomColor:"transparent",borderTopColor:(n=o?.backgroundColor)!=null?n:e.vars.palette.background.surface,borderRightColor:(i=o?.backgroundColor)!=null?i:e.vars.palette.background.surface,borderRadius:"0px 2px 0px 0px",boxShadow:`var(--variant-borderWidth, 0px) calc(-1 * var(--variant-borderWidth, 0px)) 0px 0px ${o.borderColor}`,transformOrigin:"center center",transform:"rotate(calc(-45deg + 90deg * var(--unstable_Tooltip-arrowRotation)))"},'[data-popper-placement*="bottom"] &':{top:"calc(0.5px + var(--Tooltip-arrowSize) * -1 / 2)"},'[data-popper-placement*="top"] &':{"--unstable_Tooltip-arrowRotation":2,bottom:"calc(0.5px + var(--Tooltip-arrowSize) * -1 / 2)"},'[data-popper-placement*="left"] &':{"--unstable_Tooltip-arrowRotation":1,right:"calc(0.5px + var(--Tooltip-arrowSize) * -1 / 2)"},'[data-popper-placement*="right"] &':{"--unstable_Tooltip-arrowRotation":3,left:"calc(0.5px + var(--Tooltip-arrowSize) * -1 / 2)"}}}),iy=!1,wM=new mo,bf={x:0,y:0};function CM(e,t){return r=>{t&&t(r),e(r)}}function EM(e,t){return(r,...n)=>{t&&t(r,...n),e(r,...n)}}var gV=ze.forwardRef(function(t,r){var n;let i=zt({props:t,name:"JoyTooltip"}),{children:o,className:s,component:a,arrow:l=!1,describeChild:c=!1,disableFocusListener:u=!1,disableHoverListener:d=!1,disableInteractive:f=!1,disableTouchListener:h=!1,enterDelay:m=100,enterNextDelay:y=0,enterTouchDelay:x=700,followCursor:g=!1,id:v,leaveDelay:b=0,leaveTouchDelay:w=1500,onClose:T,onOpen:C,open:E,disablePortal:A,direction:_,keepMounted:P,modifiers:k,placement:I="bottom",title:M,color:z="neutral",variant:B="solid",size:R="md",slots:L={},slotProps:G={}}=i,U=at(i,fV),[X,J]=ze.useState(),[Y,et]=ze.useState(null),ct=ze.useRef(!1),St=f||g,ot=os(),q=os(),j=os(),K=os(),[nt,mt]=ma({controlled:E,default:!1,name:"Tooltip",state:"open"}),lt=nt,Tt=zr(v),Nt=ze.useRef(void 0),kt=ga(()=>{Nt.current!==void 0&&(document.body.style.WebkitUserSelect=Nt.current,Nt.current=void 0),K.clear()});ze.useEffect(()=>kt,[kt]);let te=Ft=>{wM.clear(),iy=!0,mt(!0),C&&!lt&&C(Ft)},Xt=ga(Ft=>{wM.start(800+b,()=>{iy=!1}),mt(!1),T&<&&T(Ft),ot.start(150,()=>{ct.current=!1})}),Ut=Ft=>{ct.current&&Ft.type!=="touchstart"||(X&&X.removeAttribute("title"),q.clear(),j.clear(),m||iy&&y?q.start(iy?y:m,()=>{te(Ft)}):te(Ft))},Pi=Ft=>{q.clear(),j.start(b,()=>{Xt(Ft)})},{isFocusVisibleRef:Ar,onBlur:Lr,onFocus:oi,ref:Ee}=go(),[,Ur]=ze.useState(!1),H=Ft=>{Lr(Ft),Ar.current===!1&&(Ur(!1),Pi(Ft))},st=Ft=>{X||J(Ft.currentTarget),oi(Ft),Ar.current===!0&&(Ur(!0),Ut(Ft))},er=Ft=>{ct.current=!0;let eo=o.props;eo.onTouchStart&&eo.onTouchStart(Ft)},pr=Ft=>{er(Ft),j.clear(),ot.clear(),kt(),Nt.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",K.start(x,()=>{document.body.style.WebkitUserSelect=Nt.current,Ut(Ft)})},ee=Ft=>{o.props.onTouchEnd&&o.props.onTouchEnd(Ft),kt(),j.start(w,()=>{Xt(Ft)})};ze.useEffect(()=>{if(!lt)return;function Ft(eo){(eo.key==="Escape"||eo.key==="Esc")&&Xt(eo)}return document.addEventListener("keydown",Ft),()=>{document.removeEventListener("keydown",Ft)}},[Xt,lt]);let ae=Mt(J,r),hr=Mt(Ee,ae),Ks=Mt(Ta(o),hr);typeof M!="number"&&!M&&(lt=!1);let zu=ze.useRef(null),Pn=Ft=>{let eo=o.props;eo.onMouseMove&&eo.onMouseMove(Ft),bf={x:Ft.clientX,y:Ft.clientY},zu.current&&zu.current.update()},to={},K0=typeof M=="string";c?(to.title=!lt&&K0&&!d?M:null,to["aria-describedby"]=lt?Tt:null):(to["aria-label"]=K0?M:null,to["aria-labelledby"]=lt&&!K0?Tt:null);let si=O({},to,U,{component:a},o.props,{className:Lt(s,o.props.className),onTouchStart:er,ref:Ks},g?{onMouseMove:Pn}:{}),Fu={};h||(si.onTouchStart=pr,si.onTouchEnd=ee),d||(si.onMouseOver=CM(Ut,si.onMouseOver),si.onMouseLeave=CM(Pi,si.onMouseLeave),St||(Fu.onMouseOver=Ut,Fu.onMouseLeave=Pi)),u||(si.onFocus=EM(st,si.onFocus),si.onBlur=EM(H,si.onBlur),St||(Fu.onFocus=st,Fu.onBlur=H));let Z0=O({},i,{arrow:l,disableInteractive:St,placement:I,touch:ct.current,color:z,variant:B,size:R}),VC=pV(Z0),GC=O({},U,{component:a,slots:L,slotProps:G}),B5=ze.useMemo(()=>[{name:"arrow",enabled:!!Y,options:{element:Y,padding:6}},{name:"offset",options:{offset:[0,10]}},...k||[]],[Y,k]),[z5,F5]=xt("root",{additionalProps:O({id:Tt,popperRef:zu,placement:I,anchorEl:g?{getBoundingClientRect:()=>({top:bf.y,left:bf.x,right:bf.x,bottom:bf.y,width:0,height:0})}:X,open:X?lt:!1,disablePortal:A,keepMounted:P,direction:_,modifiers:B5},Fu),ref:null,className:VC.root,elementType:hV,externalForwardedProps:GC,ownerState:Z0}),[$5,j5]=xt("arrow",{ref:et,className:VC.arrow,elementType:mV,externalForwardedProps:GC,ownerState:Z0});return(0,GS.jsxs)(ze.Fragment,{children:[ze.isValidElement(o)&&ze.cloneElement(o,si),(0,GS.jsxs)(z5,O({},F5,!((n=i.slots)!=null&&n.root)&&{as:Lc,slots:{root:a||"div"}},{children:[M,l?(0,AM.jsx)($5,O({},j5)):null]}))]})}),Yn=gV;p();p();p();var oy=class e extends Error{type;status;description;constructor(t,r){let n=typeof r=="string"?r:void 0;if(super(n||t),this.type=t,this.description=n,typeof r=="number")this.status=r;else switch(t){case"UNAUTHORIZED":this.status=403;break;case"USAGE_LIMIT":case"PREMIUM_FEATURE":this.status=402;break;case"NOT_FOUND":this.status=404;break;case"INVALID_REQUEST":case"EMPTY_DATASOURCE":case"ALREADY_INVITED":case"INTEGRATION_VALIDATION_FAILED":this.status=400;break;case"INTEGRATION_CREDENTIALS_INVALID":this.status=403;break;case"RATE_LIMIT":this.status=429;break;case"NOT_IMPLEMENTED":this.status=501;break;case"INTERNAL_ERROR":this.status=500;break;case"CONFLICT":this.status=409;break;default:this.status=500;break}Object.setPrototypeOf(this,e.prototype)}};p();p();var ay=[{code:"en",nativeName:"English",englishName:"English",flagCode:"US",dir:"ltr",isDefault:!0},{code:"pt-BR",nativeName:"Português (BR)",englishName:"Portuguese (Brazil)",flagCode:"BR",dir:"ltr"},{code:"es",nativeName:"Español",englishName:"Spanish",flagCode:"ES",dir:"ltr"},{code:"ar",nativeName:"العربية",englishName:"Arabic",flagCode:"AE",dir:"rtl"},{code:"az",nativeName:"Azərbaycan dili",englishName:"Azerbaijani",flagCode:"AZ",dir:"ltr"},{code:"bg",nativeName:"Български",englishName:"Bulgarian",flagCode:"BG",dir:"ltr"},{code:"bn",nativeName:"বাংলা",englishName:"Bengali",flagCode:"BD",dir:"ltr"},{code:"ca",nativeName:"Català",englishName:"Catalan",flagCode:"ES",dir:"ltr"},{code:"cs",nativeName:"Čeština",englishName:"Czech",flagCode:"CZ",dir:"ltr"},{code:"da",nativeName:"Dansk",englishName:"Danish",flagCode:"DK",dir:"ltr"},{code:"de",nativeName:"Deutsch",englishName:"German",flagCode:"DE",dir:"ltr"},{code:"el",nativeName:"Ελληνικά",englishName:"Greek",flagCode:"GR",dir:"ltr"},{code:"eo",nativeName:"Esperanto",englishName:"Esperanto",flagCode:"EU",dir:"ltr"},{code:"et",nativeName:"Eesti",englishName:"Estonian",flagCode:"EE",dir:"ltr"},{code:"fa",nativeName:"فارسی",englishName:"Persian",flagCode:"IR",dir:"rtl"},{code:"fi",nativeName:"Suomi",englishName:"Finnish",flagCode:"FI",dir:"ltr"},{code:"fr",nativeName:"Français",englishName:"French",flagCode:"FR",dir:"ltr"},{code:"ga",nativeName:"Gaeilge",englishName:"Irish",flagCode:"IE",dir:"ltr"},{code:"he",nativeName:"עברית",englishName:"Hebrew",flagCode:"IL",dir:"rtl"},{code:"hi",nativeName:"हिन्दी",englishName:"Hindi",flagCode:"IN",dir:"ltr"},{code:"hu",nativeName:"Magyar",englishName:"Hungarian",flagCode:"HU",dir:"ltr"},{code:"id",nativeName:"Bahasa Indonesia",englishName:"Indonesian",flagCode:"ID",dir:"ltr"},{code:"it",nativeName:"Italiano",englishName:"Italian",flagCode:"IT",dir:"ltr"},{code:"ja",nativeName:"日本語",englishName:"Japanese",flagCode:"JP",dir:"ltr"},{code:"ko",nativeName:"한국어",englishName:"Korean",flagCode:"KR",dir:"ltr"},{code:"lt",nativeName:"Lietuvių",englishName:"Lithuanian",flagCode:"LT",dir:"ltr"},{code:"lv",nativeName:"Latviešu",englishName:"Latvian",flagCode:"LV",dir:"ltr"},{code:"ms",nativeName:"Bahasa Melayu",englishName:"Malay",flagCode:"MY",dir:"ltr"},{code:"nb",nativeName:"Norsk Bokmål",englishName:"Norwegian Bokmål",flagCode:"NO",dir:"ltr"},{code:"nl",nativeName:"Nederlands",englishName:"Dutch",flagCode:"NL",dir:"ltr"},{code:"pl",nativeName:"Polski",englishName:"Polish",flagCode:"PL",dir:"ltr"},{code:"pt",nativeName:"Português",englishName:"Portuguese",flagCode:"PT",dir:"ltr"},{code:"ro",nativeName:"Română",englishName:"Romanian",flagCode:"RO",dir:"ltr"},{code:"ru",nativeName:"Русский",englishName:"Russian",flagCode:"RU",dir:"ltr"},{code:"sk",nativeName:"Slovenčina",englishName:"Slovak",flagCode:"SK",dir:"ltr"},{code:"sl",nativeName:"Slovenščina",englishName:"Slovenian",flagCode:"SI",dir:"ltr"},{code:"sv",nativeName:"Svenska",englishName:"Swedish",flagCode:"SE",dir:"ltr"},{code:"th",nativeName:"ไทย",englishName:"Thai",flagCode:"TH",dir:"ltr"},{code:"tl",nativeName:"Tagalog",englishName:"Tagalog",flagCode:"PH",dir:"ltr"},{code:"tr",nativeName:"Türkçe",englishName:"Turkish",flagCode:"TR",dir:"ltr"},{code:"uk",nativeName:"Українська",englishName:"Ukrainian",flagCode:"UA",dir:"ltr"},{code:"ur",nativeName:"اردو",englishName:"Urdu",flagCode:"PK",dir:"rtl"},{code:"zh",nativeName:"中文",englishName:"Chinese",flagCode:"CN",dir:"ltr"}],WS="en",YS=ay.map(e=>e.code),PRt=new Set(YS),RRt=ay.map(e=>({code:e.code,name:e.nativeName,englishName:e.englishName,flag:e.flagCode,dir:e.dir})),yV=new Map(ay.map(e=>[e.code.toLowerCase(),e])),sy=new Map;for(let e of ay){let t=e.code.split("-")[0].toLowerCase();(!sy.has(t)||"isDefault"in e&&e.isDefault)&&sy.set(t,e.code)}function _M(e,t=WS){let r=e?.trim();if(!r)return t;let n=yV.get(r.toLowerCase());if(n)return n.code;let i=r.split("-")[0]?.toLowerCase();return i&&sy.has(i)?sy.get(i)??t:t}var Qe=WS,Te="translations",vV=!1,Ja="https://cdn.jsdelivr.net/npm/@zappway/embeds@2.0.3/dist/locales",QS=YS,MRt=new Set(QS),Sf={main:{localeDirectory:"locales-ZappWay",splitDirectories:["i18n-split"],browserDirectories:[],cdnDirectory:"locales-ZappWay",cdnSplit:!0},lp:{localeDirectory:"locales-ZappWay-LP",splitDirectories:["i18n-split-lp","i18n-split-zappway-lp"],browserDirectories:[],cdnDirectory:"locales-ZappWay-LP",cdnSplit:!1},integrations:{localeDirectory:"locales-Integrations",splitDirectories:["i18n-split-integrations"],browserDirectories:[],cdnDirectory:"locales-Integrations",cdnSplit:!1},emails:{localeDirectory:"locales-Emails",splitDirectories:["i18n-split-emails"],browserDirectories:[],cdnDirectory:"locales-Emails",cdnSplit:!1},workers:{localeDirectory:"locales-Workers",splitDirectories:["i18n-split-workers"],browserDirectories:[],cdnDirectory:"locales-Workers",cdnSplit:!1},zappflux:{localeDirectory:"locales-ZappFlux",splitDirectories:["i18n-split-zappflux"],browserDirectories:[],cdnDirectory:"locales-ZappFlux",cdnSplit:!1},"zappflux-lp":{localeDirectory:"locales-ZappFlux-LP",splitDirectories:["i18n-split-zappflux-lp"],browserDirectories:[],cdnDirectory:"locales-ZappFlux-LP",cdnSplit:!1},"zappflux-templates":{localeDirectory:"locales-ZappFlux-Templates",splitDirectories:["i18n-split-zappflux-templates"],browserDirectories:[],cdnDirectory:"locales-ZappFlux-Templates",cdnSplit:!1,namespaceFiles:!0},"pitch-deck":{localeDirectory:"locales-PitchDeck",splitDirectories:["i18n-split-pitch-deck"],browserDirectories:[],cdnDirectory:"locales-PitchDeck",cdnSplit:!1},reports:{localeDirectory:"locales-Reports",splitDirectories:["i18n-split-reports"],browserDirectories:[],cdnDirectory:"locales-Reports",cdnSplit:!1},rag:{localeDirectory:"locales-RAG",splitDirectories:["i18n-split-rag"],browserDirectories:[],cdnDirectory:"locales-RAG",cdnSplit:!1}},hy={lp:"lp",rag:"rag",flow:"zappflux",emails:"emails",workers:"workers",reports:"reports",zappflux:"zappflux",integrations:"integrations","pitch-deck":"pitch-deck","zappflux-lp":"zappflux-lp","zappflux-templates":"zappflux-templates",WhatsAppSettings:"integrations",WhatsAppIntegrationPage:"integrations",WhatsAppBusiness_IntegrationSettings:"integrations",TelegramSettings:"integrations",Telegram_IntegrationSettings:"integrations",InstagramSettings:"integrations",Instagram_IntegrationSettings:"integrations",MessengerSettings:"integrations",Messenger_IntegrationSettings:"integrations",TikTokSettings:"integrations",TikTok_IntegrationSettings:"integrations",ZendeskSettings:"integrations",Zendesk_IntegrationSettings:"integrations",SlackSettings:"integrations",ShopifySettings:"integrations",ConnectWhatsApp:"integrations",QRCode:"integrations",crisp:"integrations",crispConfig:"integrations",crispSettingsModal:"integrations"},ly=null,xf=null,Wi=null,XS=null,jc=null,Ts=null,cr=null,KS=null,bV=globalThis.eval;function xV(){if(Wi)return Wi;try{if(typeof __non_webpack_require__=="function")Wi=__non_webpack_require__;else if(typeof Q0=="function")Wi=Q0;else if(globalThis.require)Wi=globalThis.require;else{let e="require";Wi=globalThis[e]||bV(e)}return Wi}catch(e){return console.error(" [i18n-runtime-loader] Critical: Failed to obtain require function",e),null}}function Hc(){if(typeof window<"u")return!1;if(ly&&xf)return!0;try{let e=xV();return e?(ly=e("fs"),xf=e("path"),XS=ly.readFileSync,jc=ly.existsSync,Ts=xf.join,cr=xf.resolve,KS=xf.dirname,!0):!1}catch{return!1}}var cy=new Map,PM=new Map;function JS(e){if(Hc(),!jc)return[];let t=new Set;return e.filter(r=>!!r).filter(r=>t.has(r)||!jc(r)?!1:(t.add(r),!0))}function SV(e){if(Hc(),!(!Wi||!KS))try{let r=Wi.resolve.call(Wi,`${e}/package.json`);return KS(r)}catch{return}}var uy=null;function TV(){if(uy)return uy;if(Hc(),!cr)return[];let e=process.cwd(),t=S.ZW_I18N_CACHE_ROOT;return uy=JS([t,cr(e,".next/cache"),cr(e,"../.next/cache"),cr(e,"../../.next/cache"),cr(e,"apps/zappway/dashboard/.next/cache"),cr(e,"packages/zappflux/packages/app/.next/cache"),"/var/task/.next/cache","/var/task/apps/zappway/dashboard/.next/cache"]),uy}var dy=null;function wV(){if(dy)return dy;if(Hc(),!cr||!Ts)return[];let e=process.cwd(),t=SV("@zappway/lib");return dy=JS([t,cr(e,"packages/zappway/lib"),cr(e,"../packages/zappway/lib"),cr(e,"../../packages/zappway/lib"),cr(e,"../../../packages/zappway/lib"),cr(e,"../../../../packages/zappway/lib"),cr(e,"node_modules/@zappway/lib"),cr(e,"../node_modules/@zappway/lib"),cr(e,"../../node_modules/@zappway/lib"),cr(e,"../../../node_modules/@zappway/lib"),cr(e,"../../../../node_modules/@zappway/lib")]).filter(r=>jc(Ts(r,"locales"))),dy}var qS=new Map;function RM(e){if(qS.has(e))return qS.get(e);if(Hc(),!XS||!jc||!jc(e))return null;try{let t=XS(e,"utf8"),r=JSON.parse(t);return qS.set(e,r),r}catch{return null}}function ZS(e,t){if(!e)return null;let r=t||Te;if(r===Te)return e;if(e[r])return e[r];let n=r.split("."),i=e,o=!0;for(let s of n)if(i&&typeof i=="object"&&s in i)i=i[s];else{o=!1;break}return o&&i&&typeof i=="object"?i:r!==Te?{}:e}var fy=null;function CV(){return fy||(fy=JS([...TV(),...wV()]),fy)}function my(e){return _M(e,Qe)}function tT(e,t,r){if(typeof window<"u"||!Hc())return{};let n=my(e),i=r||Te,o=`node:${n}:${t}:${i}`,s=cy.get(o);if(s)return s;let a=Sf[t];if(t==="main"&&i!==Te&&hy[i])return cy.set(o,{}),{};let l=CV(),c=[];for(let d of l){for(let f of a.splitDirectories)c.push(Ts(d,f,n,`${i}.json`)),c.push(Ts(d,"locales",f,n,`${i}.json`));c.push(Ts(d,a.localeDirectory,n,`${i}.json`)),c.push(Ts(d,"locales",a.localeDirectory,n,`${i}.json`))}for(let d of c){let f=RM(d);if(f&&Object.keys(f).length>0)return cy.set(o,f),f}let u={};for(let d of l){let f=Ts(d,"locales",a.localeDirectory,n,"translations.json"),h=RM(f);if(h){if(u=ZS(h,r)||{},Object.keys(u).length>0)break}else vV&&r===Te&&console.warn(` [i18n] Bundle not found or empty: ${f} (CWD: ${typeof process<"u"?process.cwd():"unknown"})`)}return Object.keys(u).length===0&&n!==Qe?tT(Qe,t,r):(cy.set(o,u),u)}function eT(e,t,r){let n=t.map(i=>tT(e,i,r));return OM(n)}async function py(e,t=2e3){let r=new AbortController,n=setTimeout(()=>r.abort(),t);try{let i=await fetch(`${e}?v=${Date.now()}`,{signal:r.signal,cache:"force-cache"});return clearTimeout(n),i.ok?await i.json():null}catch{return clearTimeout(n),null}}async function EV(e,t,r){let n=my(e),i=r||Te,s=`${typeof window>"u"?"node":"browser"}:${n}:${t}:${i}`,a=PM.get(s);if(a)return await a||{};let l=Sf[t],c=(async()=>{if(typeof window>"u"){let u=tT(e,t,r);if(u&&Object.keys(u).length>0)return u;let d=t==="main"&&i!==Te&&!i.includes(".")?`${Ja}/${l.cdnDirectory}/${n}/${i}.json`:`${Ja}/${l.cdnDirectory}/${n}/translations.json`;try{let f=await py(d,3e3);if(f){let h=ZS(f,r);if(h&&Object.keys(h).length>0)return h}}catch{}}else{for(let h of l.browserDirectories){let m=await py(`/locales-runtime/${h}/${n}/${i}.json`);if(m)return m}let u=await py(`/api/i18n/${n}/${i}`);if(u)return u;let d=t==="main"&&i!==Te&&!i.includes(".")?`${Ja}/${l.cdnDirectory}/${n}/${i}.json`:`${Ja}/${l.cdnDirectory}/${n}/translations.json`,f=await py(d);if(f)return ZS(f,r)||{}}return{}})();return PM.set(s,c),c||{}}async function gy(e,t,r){let n=t.map(o=>EV(e,o,r)),i=await Promise.all(n);return OM(i)}function kM(e,t){let r={...e};for(let[n,i]of Object.entries(t||{})){let o=r[n];o&&typeof o=="object"&&i&&typeof i=="object"&&!Array.isArray(i)?r[n]=kM(o,i):r[n]=i}return r}function OM(e){return e.reduce((t,r)=>kM(t,r||{}),{})}var iT=["lp","rag","main","emails","reports","workers","zappflux","zappflux-lp","integrations","zappflux-templates"],rT={},Uc={},nT=new Map;function sT(){let e=typeof window<"u"?window.location.pathname.split("/")[1]:null,t=typeof window<"u"?new URL(window.location.href).searchParams.get("lang")||new URL(window.location.href).searchParams.get("locale"):null,r=e||t||typeof document>"u"?null:document.cookie.split(";").find(o=>o.trim().startsWith("NEXT_LOCALE="))?.split("=")[1],n=globalThis.headers?.get?.("accept-language")?.split(",")[0],i=typeof navigator<"u"?navigator.language:null;return vy(e||t||r||n||i||Qe)}function vy(e){return my(e)}function WV(e){let t=e&&e.length?e:[Te];return Array.from(new Set([Te,...t]))}function Tf(e){return!e||Object.keys(e).length===0}function yy(e,t){if(!e)return null;let r=t||Te;if(r===Te||r!==Te&&hy[r]===r)return e;if(e[r])return e[r];let n=e,i=!0,o=r.split(".");for(let s of o)if(n&&typeof n=="object"&&s in n)n=n[s];else{i=!1;break}return i&&n&&typeof n=="object"?n:r===Te?e:{}}function NM(e,t=Te){let r=vy(e),n=`fs:${r}:${t}`,i=Uc[n];if(i)return i;let o=t===Te?void 0:t,s=eT(r,iT,o);if(!Tf(s))return Uc[n]=s,s;let a=`fs:${Qe}:${t}`,l=Uc[a];if(l)return l;let c=eT(Qe,iT,o);if(!Tf(c))return Uc[a]=c,c;throw new oy("INTERNAL_ERROR",500)}async function oT(e,t=3e3){let r=new AbortController,n=setTimeout(()=>r.abort(),t);try{let i=await fetch(e,{signal:r.signal,cache:"force-cache"});return i.ok?await i.json():null}catch{return null}finally{clearTimeout(n)}}async function YV(e,t="main"){if(t==="main")return null;let r=Sf[t].cdnDirectory,n=`bundle:${e}:${r}`;if(nT.has(n))return nT.get(n);let i=(async()=>{let o=`${Ja}/${r}/${e}/translations.json`;return await oT(o,3e3)})();return nT.set(n,i),i}async function IM(e,t=Te,r){let n=vy(e),i=`cdn:${n}:${t}`,o=Uc[i];if(o)return o;let s=hy[t]||"main",a=Sf[s].cdnDirectory,l=async m=>{let y=t.split(".")[0],x=`${Ja}/${a}/${m}/${y}.json`,g=await oT(x,2e3);return g?yy(g,t):null},c=async m=>{if(!r)return null;let y=t.split(".")[0],x=`${r}/api/i18n/${m}/${y}`,g=await oT(x,2e3);return yy(g||{},t)},u=async m=>{try{let{loadManualTranslationsWithZappFlux:y}=await Promise.resolve().then(()=>(LM(),MM)),x=await y(m);return yy(x||{},t)}catch{return null}},d=async m=>{try{return await gy(m,iT,t)}catch{return null}},f=null;if(s==="main")f=await c(n),f||(f=await l(n)),f||(f=await u(n)),f||(f=await d(n)),f||(f=await c(Qe)),f||(f=await l(Qe)),f||(f=await u(Qe)),f||(f=await d(Qe));else{if(f=await c(n),Tf(f||{})){let m=await YV(n,s);f=yy(m||{},t)}Tf(f||{})&&(f=await u(n)),Tf(f||{})&&(f=await d(n))}let h=f||{};return Uc[i]=h,h}async function BM(e,t,r){let n=vy(e||sT()),i=WV(t),o=r||(typeof window<"u"?window.location.origin:void 0),s=typeof window>"u"?"node":"browser",a=`inst:${n}:${i.slice().sort().join("|")}:${s}`;if(rT[a])return rT[a];let l=typeof window>"u",c={[n]:{}};for(let d of i)c[n][d]=l?NM(n,d):await IM(n,d,o);if(n!==Qe){c[Qe]={};for(let d of i)c[Qe][d]=l?NM(Qe,d):await IM(Qe,d,o)}let u=VA();return await u.init({lng:n,fallbackLng:Qe,defaultNS:i[0],ns:i,resources:c,interpolation:{escapeValue:!1}}),rT[a]=u,u}p();p();var{slice:qV,forEach:XV}=[];function KV(e){return XV.call(qV.call(arguments,1),t=>{if(t)for(let r in t)e[r]===void 0&&(e[r]=t[r])}),e}function ZV(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(e))}var zM=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,QV=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},i=encodeURIComponent(t),o=`${e}=${i}`;if(n.maxAge>0){let s=n.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(s)}`}if(n.domain){if(!zM.test(n.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${n.domain}`}if(n.path){if(!zM.test(n.path))throw new TypeError("option path is invalid");o+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(o+="; Partitioned"),o},FM={create(e,t,r,n){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),n&&(i.domain=n),document.cookie=QV(e,t,i)},read(e){let t=`${e}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let i=r[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return i.substring(t.length,i.length)}return null},remove(e,t){this.create(e,"",-1,t)}},JV={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return FM.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:n,cookieDomain:i,cookieOptions:o}=t;r&&typeof document<"u"&&FM.create(r,e,n,i,o)}},t9={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,r;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));let o=n.substring(1).split("&");for(let s=0;s<o.length;s++){let a=o[s].indexOf("=");a>0&&o[s].substring(0,a)===t&&(r=o[s].substring(a+1))}}return r}},e9={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:r}=e,n;if(typeof window<"u"){let{hash:i}=window.location;if(i&&i.length>2){let o=i.substring(1);if(t){let s=o.split("&");for(let a=0;a<s.length;a++){let l=s[a].indexOf("=");l>0&&s[a].substring(0,l)===t&&(n=s[a].substring(l+1))}}if(n)return n;if(!n&&r>-1){let s=i.match(/\/([a-zA-Z-]*)/g);return Array.isArray(s)?s[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return n}},Vc=null,$M=()=>{if(Vc!==null)return Vc;try{if(Vc=typeof window<"u"&&window.localStorage!==null,!Vc)return!1;let e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Vc=!1}return Vc},r9={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&$M())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&$M()&&window.localStorage.setItem(r,e)}},Gc=null,jM=()=>{if(Gc!==null)return Gc;try{if(Gc=typeof window<"u"&&window.sessionStorage!==null,!Gc)return!1;let e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Gc=!1}return Gc},n9={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&jM())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&jM()&&window.sessionStorage.setItem(r,e)}},i9={name:"navigator",lookup(e){let t=[];if(typeof navigator<"u"){let{languages:r,userLanguage:n,language:i}=navigator;if(r)for(let o=0;o<r.length;o++)t.push(r[o]);n&&t.push(n),i&&t.push(i)}return t.length>0?t:void 0}},o9={name:"htmlTag",lookup(e){let{htmlTag:t}=e,r,n=t||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},s9={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;let r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof t=="number"?t:0]?.replace("/",""):void 0}},a9={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e,r=typeof t=="number"?t+1:1,n=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[r]}},HM=!1;try{document.cookie,HM=!0}catch{}var UM=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];HM||UM.splice(1,1);var l9=()=>({order:UM,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}),wf=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,r)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=KV(r,this.options||{},l9()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(JV),this.addDetector(t9),this.addDetector(r9),this.addDetector(n9),this.addDetector(i9),this.addDetector(o9),this.addDetector(s9),this.addDetector(a9),this.addDetector(e9)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return t.forEach(n=>{if(this.detectors[n]){let i=this.detectors[n].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(r=r.concat(i))}}),r=r.filter(n=>n!=null&&!ZV(n)).map(n=>this.options.convertDetectedLanguage(n)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(t,this.options)}))}};wf.type="languageDetector";var c9={type:"backend",init:()=>{},read:(e,t,r)=>{gy(e,["main"],t).then(n=>{t===Te&&n&&Object.entries(n).forEach(([i,o])=>{i!==Te&&o&&typeof o=="object"&&!Array.isArray(o)&&nr.addResourceBundle(e,i,o,!0,!0)}),r(null,n)}).catch(n=>{r(n,null)})}};nr.use(c9).use(wf).use(Gh).init({fallbackLng:Qe,supportedLngs:QS,ns:[Te],defaultNS:Te,partialBundledLanguages:!0,nonExplicitSupportedLngs:!0,nsSeparator:":",keySeparator:".",interpolation:{escapeValue:!1},detection:{order:["cookie","localStorage","sessionStorage","navigator"],lookupCookie:"NEXT_LOCALE",caches:["cookie"]}});var by=nr;p();var tl=D(F());function u9(){if(typeof document>"u")return;let e=document.documentElement.style.colorScheme;if(e==="light"||e==="dark")return e;if(document.body?.classList.contains("light"))return"light";if(document.body?.classList.contains("dark"))return"dark";if(typeof window<"u"&&window.matchMedia){if(window.matchMedia("(prefers-color-scheme: light)").matches)return"light";if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}}function aT(e,t){let{mode:r}=nS(),[n,i]=(0,tl.useState)(!1),[o,s]=(0,tl.useState)(void 0),a=t?.syncDocumentColorScheme??!0;(0,tl.useEffect)(()=>{s(u9())},[]),(0,tl.useEffect)(()=>{i(!0)},[]),(0,tl.useEffect)(()=>{!a||!n||!r||typeof document>"u"||document.documentElement.setAttribute("data-color-scheme",r)},[r,n,a]);let l=n?e??r:o;return{safeMode:l,hasMounted:n,isDark:l==="dark",isLight:l==="light"}}var Q=D(Z()),VM=mi`
|
|
121
121
|
0% { background-position: -200% 0; }
|
|
122
122
|
100% { background-position: 200% 0; }
|
|
123
123
|
`,d9=mi`
|
|
@@ -517,7 +517,7 @@ try {
|
|
|
517
517
|
width: 100%;
|
|
518
518
|
display: inline-block;
|
|
519
519
|
}
|
|
520
|
-
`;fa();kd();var M5=D(k5());p();p();var HC={50:"#A3FFD7",100:"#8CFFCD",200:"#80FFD2",300:"#48D7A3",400:"#34D399",500:"#2EBD89",600:"#10B981",700:"#009A7E",800:"#006640",900:"#00331F"};var O5=(e="zappway")=>({modeStorageKey:e,colorSchemeStorageKey:`${e}-color-scheme`,attribute:`data-${e}`}),D5=(e={})=>Ac({cssVarPrefix:e.prefix,fontFamily:{body:"Inter, sans-serif",display:"Poppins, sans-serif"},typography:{display1:{background:"linear-gradient(-30deg, var(--joy-palette-primary-900), var(--joy-palette-primary-400))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",fontSize:"57px",lineHeight:"64px",letterSpacing:"-0.25px"},kbd:{background:"linear-gradient(to top, var(--joy-palette-background-level2), var(--joy-palette-background-surface))",border:"1px solid var(--joy-palette-neutral-outlinedBorder)",borderRadius:"var(--joy-radius-xs)",boxShadow:"var(--joy-shadow-sm)",padding:"0.125em 0.375em"}},fontSize:{xl7:"4.5rem",xl6:"3.75rem",xl5:"3rem",xs2:"0.625rem",xs3:"0.5rem"},fontWeight:{xs:200,xl2:800,xl3:900},components:{JoySelect:{defaultProps:{slotProps:{listbox:{container:e.container}}},styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyModal:{defaultProps:{container:e.container}},JoyCard:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyInput:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyTextarea:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyButton:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyIconButton:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}}},colorSchemes:{dark:{palette:{primary:HC}},light:{palette:{primary:HC,neutral:{solidBg:"#000"}}}}});var Iu=D(Z()),zG="CREATE_NEW_CONVERSATION",UC={"phone-number":"phoneNumber","user-id":"userId","first-name":"firstName","last-name":"lastName",email:"email"},L5="zappway-embeds",q0=O5(L5),Mr=typeof process<"u"&&!1,FG=typeof NEXT_PUBLIC_DASHBOARD_URL<"u"?NEXT_PUBLIC_DASHBOARD_URL:"https://app.zappway.ai",$G=(typeof NEXT_PUBLIC_ASSETS_BASE_URL<"u"?NEXT_PUBLIC_ASSETS_BASE_URL:"")||"https://cdn.jsdelivr.net/npm/@zappway/embeds@2.0.
|
|
520
|
+
`;fa();kd();var M5=D(k5());p();p();var HC={50:"#A3FFD7",100:"#8CFFCD",200:"#80FFD2",300:"#48D7A3",400:"#34D399",500:"#2EBD89",600:"#10B981",700:"#009A7E",800:"#006640",900:"#00331F"};var O5=(e="zappway")=>({modeStorageKey:e,colorSchemeStorageKey:`${e}-color-scheme`,attribute:`data-${e}`}),D5=(e={})=>Ac({cssVarPrefix:e.prefix,fontFamily:{body:"Inter, sans-serif",display:"Poppins, sans-serif"},typography:{display1:{background:"linear-gradient(-30deg, var(--joy-palette-primary-900), var(--joy-palette-primary-400))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",fontSize:"57px",lineHeight:"64px",letterSpacing:"-0.25px"},kbd:{background:"linear-gradient(to top, var(--joy-palette-background-level2), var(--joy-palette-background-surface))",border:"1px solid var(--joy-palette-neutral-outlinedBorder)",borderRadius:"var(--joy-radius-xs)",boxShadow:"var(--joy-shadow-sm)",padding:"0.125em 0.375em"}},fontSize:{xl7:"4.5rem",xl6:"3.75rem",xl5:"3rem",xs2:"0.625rem",xs3:"0.5rem"},fontWeight:{xs:200,xl2:800,xl3:900},components:{JoySelect:{defaultProps:{slotProps:{listbox:{container:e.container}}},styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyModal:{defaultProps:{container:e.container}},JoyCard:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyInput:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyTextarea:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyButton:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}},JoyIconButton:{styleOverrides:{root:t=>({borderRadius:t.theme.radius.sm})}}},colorSchemes:{dark:{palette:{primary:HC}},light:{palette:{primary:HC,neutral:{solidBg:"#000"}}}}});var Iu=D(Z()),zG="CREATE_NEW_CONVERSATION",UC={"phone-number":"phoneNumber","user-id":"userId","first-name":"firstName","last-name":"lastName",email:"email"},L5="zappway-embeds",q0=O5(L5),Mr=typeof process<"u"&&!1,FG=typeof NEXT_PUBLIC_DASHBOARD_URL<"u"?NEXT_PUBLIC_DASHBOARD_URL:"https://app.zappway.ai",$G=(typeof NEXT_PUBLIC_ASSETS_BASE_URL<"u"?NEXT_PUBLIC_ASSETS_BASE_URL:"")||"https://cdn.jsdelivr.net/npm/@zappway/embeds@2.0.3",jG=e=>{let t=e.getAttribute("locale");if(t)return Mr&&console.log("[ShadowDOM] Locale detectado via atributo direto:",t),t;let r=e.getAttribute("lang");if(r)return Mr&&console.log("[ShadowDOM] Locale detectado via atributo lang:",r),r;try{let o=e.ownerDocument?.documentElement?.lang;if(o)return Mr&&console.log("[ShadowDOM] Locale detectado via document.documentElement.lang:",o),o}catch(i){Mr&&console.warn("[ShadowDOM] Não foi possível acessar documento pai:",i)}try{let o=e.ownerDocument?.querySelector('meta[name="locale"]')?.getAttribute("content");if(o)return Mr&&console.log("[ShadowDOM] Locale detectado via meta tag:",o),o}catch(i){Mr&&console.warn("[ShadowDOM] Não foi possível acessar meta tags:",i)}let n=navigator.language||navigator.userLanguage;return n?(Mr&&console.log("[ShadowDOM] Locale detectado via navigator:",n),n):(Mr&&console.log("[ShadowDOM] Usando fallback en"),"en")},HG=e=>{let t=e.getAttribute("color-mode")||e.getAttribute("data-color-mode");if(t==="dark"||t==="light")return Mr&&console.log("[ShadowDOM] Color mode from attribute:",t),t;try{let r=e.ownerDocument,n=r?.documentElement,i=n?.className||"",o=r?.body?.className||"",s=n?.getAttribute("data-theme")||n?.getAttribute("data-mode"),a=r?.body?.getAttribute("data-theme")||r?.body?.getAttribute("data-mode");if(i.includes("dark")||o.includes("dark")||s==="dark"||a==="dark")return Mr&&console.log("[ShadowDOM] Color mode from parent class/data: dark"),"dark";if(i.includes("light")||o.includes("light")||s==="light"||a==="light")return Mr&&console.log("[ShadowDOM] Color mode from parent class/data: light"),"light";let l=n?.getAttribute("data-joy-color-scheme");if(l==="dark"||l==="light")return Mr&&console.log("[ShadowDOM] Color mode from Joy UI scheme:",l),l;if(window.matchMedia?.("(prefers-color-scheme: dark)").matches)return Mr&&console.log("[ShadowDOM] Color mode from media query: dark"),"dark"}catch(r){Mr&&console.warn("[ShadowDOM] Could not detect color mode:",r)}return Mr&&console.log("[ShadowDOM] Color mode fallback: light"),"light"};if(typeof window<"u"){let e=console.warn;console.warn=(...t)=>{t[0]&&typeof t[0]=="string"&&(t[0].includes("TextLayer styles not found")||t[0].includes("AnnotationLayer styles not found"))||e(...t)}}var UG=({name:e,widget:t,type:r})=>class extends HTMLElement{cssProvider=$G+`/dist/${r}/index.css`;root;cache;shadowRootElement;emotionRoot;instanceId;setIsOpen;isOpen;onEnd;locale;colorMode="light";constructor(i){super(),this.instanceId=i?.instanceId,this.onEnd=i?.onEnd;let o=this.attachShadow({mode:"open"}),s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.href="https://fonts.googleapis.com/css2?family=Poppins:wght@200..800&family=Inter:wght@100..900&display=swap";let a=document.createElement("link");if(a.rel="stylesheet",a.type="text/css",a.href=this.cssProvider,this.emotionRoot=document.createElement("style"),this.shadowRootElement=document.createElement("div"),this.shadowRootElement.className="zappway-widget",o.appendChild(s),o.appendChild(a),o.appendChild(this.emotionRoot),o.appendChild(this.shadowRootElement),r==="pdfviewer"){let l=document.createElement("style");if(l.innerHTML=rL+`
|
|
521
521
|
`+nL,o.appendChild(l),!document.getElementById("react-pdf-global-vars")){let u=document.createElement("style");u.id="react-pdf-global-vars",u.innerHTML="body { --react-pdf-text-layer: 1; --react-pdf-annotation-layer: 1; }",document.head.appendChild(u)}}this.cache=ic({key:e,prepend:!0,container:this.emotionRoot}),this.cache.compat=!0,this.root=(0,M5.createRoot)(this.shadowRootElement)}open(){this.setIsOpen?.(!0)}close(){this.setIsOpen?.(!1)}toggle(){this.setIsOpen?.(!this.isOpen)}destroy(){this.innerHTML="",this.instanceId&&(window[this.instanceId]=null)}createNewConversation(){this.dispatchEvent(new Event(zG,{bubbles:!0,composed:!0}))}Component=i=>{let[o,s]=(0,Bu.useState)(!1);this.setIsOpen=s,this.isOpen=o;let a={};for(let f in UC)if(UC.hasOwnProperty(f)){let h=UC[f],m=this.getAttribute(f);m&&(a[h]=m)}let l=this.getAttribute("context"),c={};try{c=JSON.parse(this.getAttribute("interface"))}catch{}let u=D5({container:this.shadowRootElement,prefix:L5}),d={...u,colorSchemes:{...u.colorSchemes,light:{...u.colorSchemes?.light,palette:{...u.colorSchemes?.light?.palette,mode:"light"}},dark:{...u.colorSchemes?.dark,palette:{...u.colorSchemes?.dark?.palette,mode:"dark"}}}};return(0,Iu.jsx)(Bu.StrictMode,{children:(0,Iu.jsx)(Bd,{value:this.cache,children:(0,Iu.jsx)(rS,{theme:d,defaultMode:this.colorMode,modeStorageKey:q0.modeStorageKey,attribute:q0.attribute,colorSchemeStorageKey:q0.colorSchemeStorageKey,colorSchemeNode:this.shadowRootElement,children:(0,Iu.jsx)(VS,{sx:{background:"transparent"},children:Bu.default.createElement(t,{...i,isOpen:o,onEnd:this.onEnd,initConfig:c,context:l,agentId:this.getAttribute("agent-id")||"",formId:this.getAttribute("form-id")||"",apiHost:FG,fileUrl:this.getAttribute("file-url")||void 0,datasourceId:this.getAttribute("datasource-id")||void 0,pageNumber:this.getAttribute("page-number")?parseInt(this.getAttribute("page-number"),10):void 0,search:this.getAttribute("search")||void 0,colorMode:this.colorMode,contact:a,locale:this.locale,styles:this.getAttribute("styles")?JSON.parse(this.getAttribute("styles")):{},onAgentLoaded:f=>{let h=f?.interfaceConfig?.customCSS;if(h){let m=document.createElement("style");m.innerHTML=h,this.shadowRootElement.appendChild(m)}}})})})})})};connectedCallback(){this.locale=jG(this),this.colorMode=HG(this),this.shadowRootElement.setAttribute(q0.attribute,this.colorMode),Mr&&console.log("[ShadowDOM] Element conectado com locale:",this.locale,"colorMode:",this.colorMode),this.root.render((0,Iu.jsx)(this.Component,{isOpen:this.isOpen,onEnd:this.onEnd}))}},N5=UG;var X0="zappway-pdfviewer",VG=N5({type:"pdfviewer",widget:cT,name:X0});typeof customElements<"u"&&!customElements.get(X0)&&customElements.define(X0,VG);var I5=e=>{let t=document.getElementById(e.containerId);if(!t)return console.error(`[PDFViewer] Container not found: ${e.containerId}`),e.onError?.(new Error(`Container not found: ${e.containerId}`)),null;let r=document.createElement(X0);e.fileUrl&&r.setAttribute("file-url",e.fileUrl),e.pageNumber&&r.setAttribute("page-number",e.pageNumber.toString()),e.search&&r.setAttribute("search",e.search),e.locale&&r.setAttribute("locale",e.locale),e.colorMode&&r.setAttribute("color-mode",e.colorMode),r.style.width="100%",r.style.height="100%",t.innerHTML="",t.appendChild(r);let n=!1,i=()=>{!n&&e.onLoad&&(n=!0,e.onLoad(1))};return setTimeout(()=>{i()},500),{pageNumber:e.pageNumber||1,numPages:1,goToPage:o=>{r.setAttribute("page-number",o.toString())},nextPage:()=>{let o=parseInt(r.getAttribute("page-number")||"1",10);r.setAttribute("page-number",(o+1).toString())},prevPage:()=>{let o=parseInt(r.getAttribute("page-number")||"1",10);r.setAttribute("page-number",Math.max(1,o-1).toString())},setScale:o=>{},getScale:()=>1,destroy:()=>{t.innerHTML=""}}},Kkt={init:I5};typeof window<"u"&&(window.ZappwayPDFViewer={init:I5});export{Kkt as default,I5 as init};
|
|
522
522
|
/*! Bundled license information:
|
|
523
523
|
|