(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,85398,t=>{"use strict";let e,n,r,i,a,o;var s=t.i(36792),l=t.i(82772),h=t.i(69744),u=t.i(34346),c=t.i(76584);let f=new Map;var d=t.i(74665),p=t.i(8204),g=t.i(27706);let m=(0,g.default)("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);function v(t){return t?t.split("-")[0]:""}function b({member:t,isRoot:e,isSpouse:n,onSelect:r,isHighlighted:i,relationMode:a,isSelected:o}){let{avatarUrl:l}=function(t){let[e,n]=(0,u.useState)(t?f.get(t):void 0),[r,i]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{if(!t)return void n(void 0);let e=f.get(t);if(e)return void n(e);let r=!0;return i(!0),c.db.images.get(t).then(e=>{if(e&&r){let r=URL.createObjectURL(e.blob);f.set(t,r),n(r)}}).catch(t=>{console.error("Failed to load avatar:",t)}).finally(()=>{r&&i(!1)}),()=>{r=!1}},[t]),{avatarUrl:e,isLoading:r}}(t?.avatarImageId),g=v(t.birthDate),m=v(t.deathDate),b=function(t,e){if(!t)return null;let n=new Date(t),r=e?new Date(e):new Date,i=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return(a<0||0===a&&r.getDate()r?.(t),children:[(0,s.jsxs)("div",{className:"absolute -top-3 bg-background border border-border px-2 py-0.5 rounded-full text-[10px] text-muted-foreground font-mono",children:[t.generation,"世"]}),(0,s.jsx)("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center text-muted-foreground overflow-hidden border border-border/50",children:l?(0,s.jsx)("img",{src:l,alt:t.fullName,className:"h-full w-full object-cover"}):"FEMALE"===t.gender?(0,s.jsx)(p.CircleUserRound,{className:"h-8 w-8 text-pink-400"}):(0,s.jsx)(d.CircleUser,{className:"h-8 w-8 text-blue-400"})}),(0,s.jsxs)("div",{className:"text-center w-full",children:[(0,s.jsxs)("div",{className:"font-serif font-bold text-foreground leading-tight",children:[t.surname," ",t.givenName]}),t.courtesyName&&(0,s.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["字 ",t.courtesyName]}),y&&(0,s.jsx)("div",{className:"text-[9px] text-muted-foreground/70 mt-1 font-mono",children:y}),w&&(0,s.jsx)("div",{className:"text-[9px] text-muted-foreground/60 font-mono",children:w}),t.phone&&(0,s.jsxs)("div",{className:"text-[9px] text-muted-foreground/60 font-mono truncate",children:["📱 ",t.phone]})]}),t.deathDate&&(0,s.jsx)("div",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-neutral-400 ring-2 ring-background"})]})}function y({member:t,spouse:e,spouses:n,isRoot:r,onSelect:i,isHighlighted:a,relationMode:o,isSelected:l}){let h=n||(e?[e]:[]);return 0===h.length?(0,s.jsx)(b,{member:t,isRoot:r,onSelect:i,isHighlighted:a,relationMode:o,isSelected:l}):(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(b,{member:t,isRoot:r,onSelect:i,isHighlighted:a,relationMode:o,isSelected:l}),h.map((t,e)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(m,{className:"h-4 w-4 text-red-400 flex-shrink-0"}),(0,s.jsx)(b,{member:t,isSpouse:!0,onSelect:i,relationMode:o})]},t.id))]})}var w=t.i(92879),_=t.i(69074);function x({rootId:t,onSelectMember:e,relationMode:n=!1,selectedMembers:r=[],onMemberClick:i}){let{getMember:a,treeData:o,highlightedMemberId:l}=(0,w.useFamily)(),h=a(t),c=(0,_.useRouter)(),f=(0,u.useRef)(null),[d,p]=(0,u.useState)([]),g=(0,u.useRef)(new Map),m=(0,u.useCallback)(t=>{n&&i?i(t.id):c.push(`/members/${t.id}`)},[n,i,c]),v=(0,u.useCallback)(()=>{let t=[],e=f.current?.getBoundingClientRect();e&&0!==g.current.size&&(g.current.forEach((n,r)=>{let i=a(r);if(!i||!i.childrenIds||0===i.childrenIds.length)return;let o=n.getBoundingClientRect(),s=o.left+o.width/2-e.left,l=o.bottom-e.top,h=l+24;t.push({from:{x:s,y:l},to:{x:s,y:h},type:"vertical"});let u=i.childrenIds.map(t=>{let n=g.current.get(t);if(!n)return null;let r=n.getBoundingClientRect();return{id:t,centerX:r.left+r.width/2-e.left,topY:r.top-e.top}}).filter(Boolean);if(0!==u.length){if(u.length>1){let e=Math.min(...u.map(t=>t.centerX)),n=Math.max(...u.map(t=>t.centerX));t.push({from:{x:e,y:h},to:{x:n,y:h},type:"horizontal"})}u.forEach(e=>{t.push({from:{x:e.centerX,y:h},to:{x:e.centerX,y:e.topY},type:"vertical"})})}}),p(t))},[a]);if((0,u.useEffect)(()=>{let t=[];return t.push(setTimeout(v,50)),t.push(setTimeout(v,150)),t.push(setTimeout(v,300)),t.push(setTimeout(v,500)),window.addEventListener("resize",v),()=>{t.forEach(t=>clearTimeout(t)),window.removeEventListener("resize",v)}},[v,o]),!h)return null;let b=({memberId:t,isRoot:e=!1})=>{let i=a(t);if(!i)return null;let o=i.childrenIds&&i.childrenIds.length>0,h=i.spouseIds&&i.spouseIds.length>0?i.spouseIds.map(t=>a(t)).filter(Boolean):[];return(0,s.jsxs)("div",{className:"flex flex-col items-center",children:[(0,s.jsx)("div",{ref:e=>{e?g.current.set(t,e):g.current.delete(t)},className:"relative z-10",children:(0,s.jsx)(y,{member:i,spouses:h,onSelect:m,isRoot:e,isHighlighted:i.id===l,relationMode:n,isSelected:r.includes(i.id)})}),o&&(0,s.jsx)("div",{className:"flex items-start relative",style:{marginTop:"48px",gap:"32px"},children:[...i.childrenIds].sort((t,e)=>{let n=a(t),r=a(e);if(!n||!r)return 0;let i=n.tags?.includes("始祖")||1===n.generation,o=r.tags?.includes("始祖")||1===r.generation;return i&&!o?-1:!i&&o?1:(n.birthDate||"").localeCompare(r.birthDate||"")}).map(t=>(0,s.jsx)(b,{memberId:t},t))})]})};return(0,s.jsx)("div",{className:"relative",children:(0,s.jsxs)("div",{ref:f,className:"p-12 min-w-fit relative",style:{minHeight:"100%"},children:[(0,s.jsx)("div",{className:"absolute inset-0 pointer-events-none",style:{zIndex:1},children:d.map((t,e)=>{let n="horizontal"===t.type,r=n?Math.abs(t.to.x-t.from.x):1,i=n?1:Math.abs(t.to.y-t.from.y),a=Math.min(t.from.x,t.to.x),o=Math.min(t.from.y,t.to.y);return r<=0||i<=0?null:(0,s.jsx)("div",{className:"absolute bg-black",style:{left:`${a}px`,top:`${o}px`,width:`${r}px`,height:`${i}px`,transform:n?"scaleY(0.5)":"scaleX(0.5)",transformOrigin:"top left"}},e)})}),(0,s.jsx)("div",{className:"relative",style:{zIndex:10},children:(0,s.jsx)(b,{memberId:t,isRoot:!0})})]})})}var N={value:()=>{}};function A(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw Error("unknown type: "+t);return{type:t,name:e}}),a=-1,o=i.length;if(arguments.length<2){for(;++a0)for(var n,r,i=Array(n),a=0;ae?1:t>=e?0:NaN}R.prototype={constructor:R,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var $="http://www.w3.org/1999/xhtml";let H={svg:"http://www.w3.org/2000/svg",xhtml:$,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function W(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),H.hasOwnProperty(e)?{space:H[e],local:t}:t}function X(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Y(t,e){return t.style.getPropertyValue(e)||X(t).getComputedStyle(t,null).getPropertyValue(e)}function V(t){return t.trim().split(/^|\s+/)}function G(t){return t.classList||new J(t)}function J(t){this._node=t,this._names=V(t.getAttribute("class")||"")}function Z(t,e){for(var n=G(t),r=-1,i=e.length;++rthis._names.indexOf(t)&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var tc=[null];function tf(t,e){this._groups=t,this._parents=e}function td(){return new tf([[document.documentElement]],tc)}function tp(t){return"string"==typeof t?new tf([[document.querySelector(t)]],[document.documentElement]):new tf([[t]],tc)}tf.prototype=td.prototype={constructor:tf,select:function(t){"function"!=typeof t&&(t=C(t));for(var e=this._groups,n=e.length,r=Array(n),i=0;i=x&&(x=_+1);!(w=m[x])&&++x=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=U);for(var n=this._groups,r=n.length,i=Array(r),a=0;a1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):Y(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=V(t+"");if(arguments.length<2){for(var r=G(this.node()),i=-1,a=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}),o=a.length;if(arguments.length<2){var s=this.node().__on;if(s){for(var l,h=0,u=s.length;h>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?tB(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?tB(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=tA.exec(t))?new tT(e[1],e[2],e[3],1):(e=tL.exec(t))?new tT(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=tk.exec(t))?tB(e[1],e[2],e[3],e[4]):(e=tS.exec(t))?tB(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=tC.exec(t))?t$(e[1],e[2]/100,e[3]/100,1):(e=tP.exec(t))?t$(e[1],e[2]/100,e[3]/100,e[4]):tE.hasOwnProperty(t)?tF(tE[t]):"transparent"===t?new tT(NaN,NaN,NaN,0):null}function tF(t){return new tT(t>>16&255,t>>8&255,255&t,1)}function tB(t,e,n,r){return r<=0&&(t=e=n=NaN),new tT(t,e,n,r)}function tO(t,e,n,r){var i;return 1==arguments.length?((i=t)instanceof ty||(i=tM(i)),i)?new tT((i=i.rgb()).r,i.g,i.b,i.opacity):new tT:new tT(t,e,n,null==r?1:r)}function tT(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function tR(){return`#${tU(this.r)}${tU(this.g)}${tU(this.b)}`}function tD(){let t=tz(this.opacity);return`${1===t?"rgb(":"rgba("}${tq(this.r)}, ${tq(this.g)}, ${tq(this.b)}${1===t?")":`, ${t})`}`}function tz(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function tq(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function tU(t){return((t=tq(t))<16?"0":"")+t.toString(16)}function t$(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new tW(t,e,n,r)}function tH(t){if(t instanceof tW)return new tW(t.h,t.s,t.l,t.opacity);if(t instanceof ty||(t=tM(t)),!t)return new tW;if(t instanceof tW)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=e===a?(n-r)/s+(n0&&l<1?0:o,new tW(o,s,l,t.opacity)}function tW(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function tX(t){return(t=(t||0)%360)<0?t+360:t}function tY(t){return Math.max(0,Math.min(1,t||0))}function tV(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}function tG(t,e,n,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*n+(1+3*t+3*a-3*o)*r+o*i)/6}tv(ty,tM,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:tI,formatHex:tI,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return tH(this).formatHsl()},formatRgb:tj,toString:tj}),tv(tT,tO,tb(ty,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new tT(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new tT(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new tT(tq(this.r),tq(this.g),tq(this.b),tz(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tR,formatHex:tR,formatHex8:function(){return`#${tU(this.r)}${tU(this.g)}${tU(this.b)}${tU((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:tD,toString:tD})),tv(tW,function(t,e,n,r){return 1==arguments.length?tH(t):new tW(t,e,n,null==r?1:r)},tb(ty,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new tW(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new tW(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new tT(tV(t>=240?t-240:t+120,i,r),tV(t,i,r),tV(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new tW(tX(this.h),tY(this.s),tY(this.l),tz(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=tz(this.opacity);return`${1===t?"hsl(":"hsla("}${tX(this.h)}, ${100*tY(this.s)}%, ${100*tY(this.l)}%${1===t?")":`, ${t})`}`}}));let tJ=t=>()=>t;function tZ(t,e){var n=e-t;return n?function(e){return t+e*n}:tJ(isNaN(t)?e:t)}let tK=function t(e){var n,r=1==(n=+e)?tZ:function(t,e){var r,i,a;return e-t?(r=t,i=e,r=Math.pow(r,a=n),i=Math.pow(i,a)-r,a=1/a,function(t){return Math.pow(r+t*i,a)}):tJ(isNaN(t)?e:t)};function i(t,e){var n=r((t=tO(t)).r,(e=tO(e)).r),i=r(t.g,e.g),a=r(t.b,e.b),o=tZ(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+""}}return i.gamma=t,i}(1);function tQ(t){return function(e){var n,r,i=e.length,a=Array(i),o=Array(i),s=Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,s=r=0&&e._call.call(void 0,t),e=e._next;--t6}finally{t6=0,function(){for(var t,e,n=t3,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:t3=e);t4=t,eu(r)}(),et=0}}function eh(){var t=en.now(),e=t-t9;e>1e3&&(ee-=e,t9=t)}function eu(t){!t6&&(t8&&(t8=clearTimeout(t8)),t-et>24?(t<1/0&&(t8=setTimeout(el,t-en.now()-ee)),t7&&(t7=clearInterval(t7))):(t7||(t9=en.now(),t7=setInterval(eh,1e3)),t6=1,er(el)))}function ec(t,e,n){var r=new eo;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}eo.prototype=es.prototype={constructor:eo,restart:function(t,e,n){if("function"!=typeof t)throw TypeError("callback is not a function");n=(null==n?ei():+n)+(null==e?0:+e),this._next||t4===this||(t4?t4._next=this:t3=this,t4=this),this._call=t,this._time=n,eu()},stop:function(){this._call&&(this._call=null,this._time=1/0,eu())}};var ef=A("start","end","cancel","interrupt"),ed=[];function ep(t,e,n,r,i,a){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(l){var h,u,c,f;if(1!==n.state)return s();for(h in i)if((f=i[h]).name===n.name){if(3===f.state)return ec(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[h]):+h0)throw Error("too late; already scheduled");return n}function em(t,e){var n=ev(t,e);if(n.state>3)throw Error("too late; already running");return n}function ev(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw Error("transition not found");return n}function eb(t,e){var n,r,i,a=t.__transition,o=!0;if(a){for(i in e=null==e?null:e+"",a){if((n=a[i]).name!==e){o=!1;continue}r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete a[i]}o&&delete t.__transition}}var ey=180/Math.PI,ew={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function e_(t,e,n,r,i,a){var o,s,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r180?l+=360:l-s>180&&(s+=360),f.push({i:c.push(i(c)+"rotate(",null,r)-2,x:t1(s,l)})):l&&c.push(i(c)+"rotate("+l+r),h=a.skewX,u=o.skewX,h!==u?f.push({i:c.push(i(c)+"skewX(",null,r)-2,x:t1(h,u)}):u&&c.push(i(c)+"skewX("+u+r),!function(t,e,n,r,a,o){if(t!==n||e!==r){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:t1(t,n)},{i:s-2,x:t1(e,r)})}else(1!==n||1!==r)&&a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,c,f),a=o=null,function(t){for(var e,n=-1,r=f.length;++ns&&(o=e.slice(s,o),h[l]?h[l]+=o:h[++l]=o),(i=i[0])===(a=a[0])?h[l]?h[l]+=a:h[++l]=a:(h[++l]=null,u.push({i:l,x:t1(i,a)})),s=t2.lastIndex;return s=0&&(t=t.slice(0,e)),!t||"start"===t})?eg:em,function(){var t=s(this,n),e=t.on;e!==a&&(o=(a=e).copy()).on(r,i),t.on=o}))},attr:function(t,e){var n=W(t),r="transform"===n?eA:ek;return this.attrTween(t,"function"==typeof e?(n.local?function(t,e,n){var r,i,a;return function(){var o,s,l=n(this);return null==l?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:o===r&&s===i?a:(i=s,a=e(r=o,l))}}:function(t,e,n){var r,i,a;return function(){var o,s,l=n(this);return null==l?void this.removeAttribute(t):(o=this.getAttribute(t))===(s=l+"")?null:o===r&&s===i?a:(i=s,a=e(r=o,l))}})(n,r,eL(this,"attr."+t,e)):null==e?(n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(n):(n.local?function(t,e,n){var r,i,a=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===a?null:o===r?i:i=e(r=o,n)}}:function(t,e,n){var r,i,a=n+"";return function(){var o=this.getAttribute(t);return o===a?null:o===r?i:i=e(r=o,n)}})(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw Error();var r=W(t);return this.tween(n,(r.local?function(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e){this.setAttributeNS(t.space,t.local,i.call(this,e))}),n}return i._value=e,i}:function(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e){this.setAttribute(t,i.call(this,e))}),n}return i._value=e,i})(r,e))},style:function(t,e,n){var r,i,a,o,s,l,h,u,c,f,d,p,g,m,v,b,y,w,_,x,N,A="transform"==(t+="")?eN:ek;return null==e?this.styleTween(t,(r=t,function(){var t=Y(this,r),e=(this.style.removeProperty(r),Y(this,r));return t===e?null:t===i&&e===a?o:o=A(i=t,a=e)})).on("end.style."+t,eC(t)):"function"==typeof e?this.styleTween(t,(s=t,l=eL(this,"style."+t,e),function(){var t=Y(this,s),e=l(this),n=e+"";return null==e&&(this.style.removeProperty(s),n=e=Y(this,s)),t===n?null:t===h&&n===u?c:(u=n,c=A(h=t,e))})).each((f=this._id,y="end."+(b="style."+(d=t)),function(){var t=em(this,f),e=t.on,n=null==t.value[b]?v||(v=eC(d)):void 0;(e!==p||m!==n)&&(g=(p=e).copy()).on(y,m=n),t.on=g})):this.styleTween(t,(w=t,N=e+"",function(){var t=Y(this,w);return t===N?null:t===_?x:x=A(_=t,e)}),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw Error();return this.tween(r,function(t,e,n){var r,i;function a(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&function(e){this.style.setProperty(t,a.call(this,e),n)}),r}return a._value=e,a}(t,e,null==n?"":n))},text:function(t){var e,n;return this.tween("text","function"==typeof t?(e=eL(this,"text",t),function(){var t=e(this);this.textContent=null==t?"":t}):(n=null==t?"":t+"",function(){this.textContent=n}))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw Error();return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){this.textContent=r.call(this,t)}),e}return r._value=t,r}(t))},remove:function(){var t;return this.on("end.remove",(t=this._id,function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=ev(this.node(),n).tween,a=0,o=i.length;a()=>t;function ez(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function eq(t,e,n){this.k=t,this.x=e,this.y=n}eq.prototype={constructor:eq,scale:function(t){return 1===t?this:new eq(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new eq(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var eU=new eq(1,0,0);function e$(t){t.stopImmediatePropagation()}function eH(t){t.preventDefault(),t.stopImmediatePropagation()}function eW(t){return(!t.ctrlKey||"wheel"===t.type)&&!t.button}function eX(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function eY(){return this.__zoom||eU}function eV(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function eG(){return navigator.maxTouchPoints||"ontouchstart"in this}function eJ(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],a=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function eZ(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function eK(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=e1)):void 0===e&&(e=eQ);for(var n,r,i,a,o,s=new e5(t),l=[s];n=l.pop();)if((i=e(n.data))&&(o=(i=Array.from(i)).length))for(n.children=i,a=o-1;a>=0;--a)l.push(r=i[a]=new e5(i[a])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(e2)}function eQ(t){return t.children}function e1(t){return Array.isArray(t)?t[1]:null}function e0(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function e2(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function e5(t){this.data=t,this.depth=this.height=0,this.parent=null}function e3(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function e4(t){return null==t?null:function(t){if("function"!=typeof t)throw Error();return t}(t)}eq.prototype,e5.prototype=eK.prototype={constructor:e5,count:function(){return this.eachAfter(eZ)},each:function(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,a=this,o=[a],s=[],l=-1;a=o.pop();)if(s.push(a),n=a.children)for(r=0,i=n.length;r=0;--r)a.push(n[r]);return this},find:function(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)r.push(e=e.parent);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return eK(this).eachBefore(e0)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,a=[i];do for(t=a.reverse(),a=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n1&&!nn(t,e););return t.slice(0,e)}function nn(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if((1&n)==0)return!0}return!1}function nr(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function ni(t,e){var n,r,i,a,o,s=new nl(t),l=+t.value&&(s.value=t.value),h=[s];for(null==e&&(e=na);n=h.pop();)if(l&&(n.value=+n.data.value),(i=e(n.data))&&(o=i.length))for(n.children=Array(o),a=o-1;a>=0;--a)h.push(r=n.children[a]=new nl(i[a])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(ns)}function na(t){return t.children}function no(t){t.data=t.data.data}function ns(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function nl(t){this.data=t,this.depth=this.height=0,this.parent=null}nl.prototype=ni.prototype={constructor:nl,count:function(){return this.eachAfter(nr)},each:function(t){var e,n,r,i,a=this,o=[a];do for(e=o.reverse(),o=[];a=e.pop();)if(t(a),n=a.children)for(r=0,i=n.length;r=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)r.push(e=e.parent);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return ni(this).eachBefore(no)}};let{version:nh}=t.i(5938).default,nu=Object.freeze({children:t=>t.children,nodeSize:t=>t.data.size,spacing:0});function nc(t){let e=Object.assign({},nu,t);function n(t){let n=e[t];return"function"==typeof n?n:()=>n}function r(t){let e,r,o,s=a((e=i(),r=n("nodeSize"),o=n("spacing"),class extends e{constructor(t){super(t),Object.assign(this,{x:0,y:0,relX:0,prelim:0,shift:0,change:0,lExt:this,lExtRelX:0,lThr:null,rExt:this,rExtRelX:0,rThr:null})}get size(){return r(this.data)}spacing(t){return o(this.data,t.data)}get x(){return this.data.x}set x(t){this.data.x=t}get y(){return this.data.y}set y(t){this.data.y=t}update(){return nf(this),nd(this),this}}),t,t=>t.children);return s.update(),s.data}function i(){let t=n("nodeSize"),e=n("spacing");return class n extends ni.prototype.constructor{constructor(t){super(t)}copy(){let t=a(this.constructor,this,t=>t.children);return t.each(t=>t.data=t.data.data),t}get size(){return t(this)}spacing(t){return e(this,t)}get nodes(){return this.descendants()}get xSize(){return this.size[0]}get ySize(){return this.size[1]}get top(){return this.y}get bottom(){return this.y+this.ySize}get left(){return this.x-this.xSize/2}get right(){return this.x+this.xSize/2}get root(){let t=this.ancestors();return t[t.length-1]}get numChildren(){return this.hasChildren?this.children.length:0}get hasChildren(){return!this.noChildren}get noChildren(){return null===this.children}get firstChild(){return this.hasChildren?this.children[0]:null}get lastChild(){return this.hasChildren?this.children[this.numChildren-1]:null}get extents(){return(this.children||[]).reduce((t,e)=>n.maxExtents(t,e.extents),this.nodeExtents)}get nodeExtents(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}static maxExtents(t,e){return{top:Math.min(t.top,e.top),bottom:Math.max(t.bottom,e.bottom),left:Math.min(t.left,e.left),right:Math.max(t.right,e.right)}}}}function a(t,e,n){let r=(e,i)=>{let a=new t(e);Object.assign(a,{parent:i,depth:null===i?0:i.depth+1,height:0,length:1});let o=n(e)||[];return a.children=0===o.length?null:o.map(t=>r(t,a)),a.children&&Object.assign(a,a.children.reduce((t,e)=>({height:Math.max(t.height,e.height+1),length:t.length+e.length}),a)),a};return r(e,null)}return Object.assign(r,{nodeSize(t){return arguments.length?(e.nodeSize=t,r):e.nodeSize},spacing(t){return arguments.length?(e.spacing=t,r):e.spacing},children(t){return arguments.length?(e.children=t,r):e.children},hierarchy(t,n){let r=void 0===n?e.children:n;return a(i(),t,r)},dump(t){let e=n("nodeSize"),r=t=>n=>{let i=t+" ",a=t+" ",{x:o,y:s}=n,l=e(n),h=n.children||[],u=0===h.length?" ":`,${i}children: [${a}${h.map(r(a)).join(a)}${i}],${t}`;return`{ size: [${l.join(", ")}],${i}x: ${o}, y: ${s}${u}},`};return r("\n")(t)}}),r}nc.version=nh;let nf=(t,e=0)=>(t.y=e,(t.children||[]).reduce((e,n)=>{let[r,i]=e;nf(n,t.y+t.ySize);let a=(0===r?n.lExt:n.rExt).bottom;0!==r&&ng(t,r,i);let o=nN(a,r,i);return[r+1,o]},[0,null]),np(t),nx(t),t),nd=(t,e,n)=>{void 0===e&&(e=-t.relX-t.prelim,n=0);let r=e+t.relX;return t.relX=r+t.prelim-n,t.prelim=0,t.x=n+t.relX,(t.children||[]).forEach(e=>nd(e,r,t.x)),t},np=t=>{(t.children||[]).reduce((t,e)=>{let[n,r]=t,i=n+e.shift,a=r+i+e.change;return e.relX+=a,[i,a]},[0,0])},ng=(t,e,n)=>{let r=t.children[e-1],i=t.children[e],a=r,o=r.relX,s=i,l=i.relX,h=!0;for(;a&&s;){a.bottom>n.lowY&&(n=n.next);let r=o+a.prelim-(l+s.prelim)+a.xSize/2+s.xSize/2+a.spacing(s);(r>0||r<0&&h)&&(l+=r,nm(i,r),nv(t,e,n.index,r)),h=!1;let u=a.bottom,c=s.bottom;u<=c&&(a=ny(a))&&(o+=a.relX),u>=c&&(s=nb(s))&&(l+=s.relX)}!a&&s?nw(t,e,s,l):a&&!s&&n_(t,e,a,o)},nm=(t,e)=>{t.relX+=e,t.lExtRelX+=e,t.rExtRelX+=e},nv=(t,e,n,r)=>{let i=t.children[e],a=e-n;if(a>1){let e=r/a;t.children[n+1].shift+=e,i.shift-=e,i.change-=r-e}},nb=t=>t.hasChildren?t.firstChild:t.lThr,ny=t=>t.hasChildren?t.lastChild:t.rThr,nw=(t,e,n,r)=>{let i=t.firstChild,a=i.lExt,o=t.children[e];a.lThr=n;let s=r-n.relX-i.lExtRelX;a.relX+=s,a.prelim-=s,i.lExt=o.lExt,i.lExtRelX=o.lExtRelX},n_=(t,e,n,r)=>{let i=t.children[e],a=i.rExt,o=t.children[e-1];a.rThr=n;let s=r-n.relX-i.rExtRelX;a.relX+=s,a.prelim-=s,i.rExt=o.rExt,i.rExtRelX=o.rExtRelX},nx=t=>{if(t.hasChildren){let e=t.firstChild,n=t.lastChild;Object.assign(t,{prelim:(e.prelim+e.relX-e.xSize/2+n.relX+n.prelim+n.xSize/2)/2,lExt:e.lExt,lExtRelX:e.lExtRelX,rExt:n.rExt,rExtRelX:n.rExtRelX})}},nN=(t,e,n)=>{for(;null!==n&&t>=n.lowY;)n=n.next;return{lowY:t,index:e,next:n}};var nA=Array.prototype.slice;function nL(t){return function(){return t}}class nk{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t*=1,e*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}function nS(t){return new nk(t,!0)}let nC=Math.PI,nP=2*nC,nE=nP-1e-6;function nI(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw Error(`invalid digits: ${t}`);if(e>15)return nI;let n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e1e-6)if(Math.abs(u*s-l*h)>1e-6&&i){let f=n-a,d=r-o,p=s*s+l*l,g=Math.sqrt(p),m=Math.sqrt(c),v=i*Math.tan((nC-Math.acos((p+c-(f*f+d*d))/(2*g*m)))/2),b=v/m,y=v/g;Math.abs(b-1)>1e-6&&this._append`L${t+b*h},${e+b*u}`,this._append`A${i},${i},0,0,${+(u*f>h*d)},${this._x1=t+y*s},${this._y1=e+y*l}`}else this._append`L${this._x1=t},${this._y1=e}`}arc(t,e,n,r,i,a){if(t*=1,e*=1,n*=1,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=t+o,h=e+s,u=1^a,c=a?r-i:i-r;null===this._x1?this._append`M${l},${h}`:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-h)>1e-6)&&this._append`L${l},${h}`,n&&(c<0&&(c=c%nP+nP),c>nE?this._append`A${n},${n},0,1,${u},${t-o},${e-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=h}`:c>1e-6&&this._append`A${n},${n},0,${+(c>=nC)},${u},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n*=1}v${+r}h${-n}Z`}toString(){return this._}}function nM(t){return t[0]}function nF(t){return t[1]}function nB(t){return t.source}function nO(t){return t.target}nj.prototype;let nT=function(t,e){let n;if(void 0===e)for(let e of t)null!=e&&(n=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n},nR=function(t,e){let n;if(void 0===e)for(let e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n},nD=function(t,e){let n=0;if(void 0===e)for(let e of t)(e*=1)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n},nz=function(t,e){var n=0,r=0;return Float64Array.from(t,void 0===e?t=>n+=+t||0:i=>n+=+e(i,r++,t)||0)},nq=function(){var t,e=e9,n=nt;function r(r){var i,a,o,s,l,h,u,c,f=Array.from(r),d=e,p=n,g=new Map;if(null!=t){let e=f.map((e,n)=>{var i;let a;return i=t(e,n,r),a=(i=`${i}`).length,nn(i,a-1)&&!nn(i,a-2)&&(i=i.slice(0,-1)),"/"===i[0]?i:`/${i}`}),n=e.map(ne),i=new Set(e).add("");for(let t of n)i.has(t)||(i.add(t),e.push(t),n.push(ne(t)),f.push(e7));d=(t,n)=>e[n],p=(t,e)=>n[e]}for(o=0,i=f.length;o=0&&(h=f[t]).data===e7;--t)h.data=null}if(s.parent=e6,s.eachBefore(function(t){t.depth=t.parent.depth+1,--i}).eachBefore(e2),s.parent=null,i>0)throw Error("cycle");return s}return r.id=function(t){return arguments.length?(e=e4(t),r):e},r.parentId=function(t){return arguments.length?(n=e4(t),r):n},r.path=function(e){return arguments.length?(t=e4(e),r):t},r},nU=function(){var t,e,n,r=eW,i=eX,a=eJ,o=eV,s=eG,l=[0,1/0],h=[[-1/0,-1/0],[1/0,1/0]],u=250,c=eR,f=A("start","zoom","end"),d=0,p=10;function g(t){t.property("__zoom",eY).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",L).filter(s).on("touchstart.zoom",k).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new eq(e,t.x,t.y)}function v(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new eq(t.k,r,i)}function b(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function y(t,e,n,r){t.on("start.zoom",function(){w(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(r).end()}).tween("zoom",function(){var t=arguments,a=w(this,t).event(r),o=i.apply(this,t),s=null==n?b(o):"function"==typeof n?n.apply(this,t):n,l=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),h=this.__zoom,u="function"==typeof e?e.apply(this,t):e,f=c(h.invert(s).concat(l/h.k),u.invert(s).concat(l/u.k));return function(t){if(1===t)t=u;else{var e=f(t),n=l/e[2];t=new eq(n,s[0]-e[0]*n,s[1]-e[1]*n)}a.zoom(null,t)}})}function w(t,e,n){return!n&&t.__zooming||new _(t,e)}function _(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function x(t,...e){if(r.apply(this,arguments)){var n=w(this,e).event(t),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,o.apply(this,arguments)))),u=t5(t);if(n.wheel)(n.mouse[0][0]!==u[0]||n.mouse[0][1]!==u[1])&&(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[u,i.invert(u)],eb(this),n.start()}eH(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",a(v(m(i,s),n.mouse[0],n.mouse[1]),n.extent,h))}}function N(t,...e){if(!n&&r.apply(this,arguments)){var i,o,s,l=t.currentTarget,u=w(this,e,!0).event(t),c=tp(t.view).on("mousemove.zoom",function(t){if(eH(t),!u.moved){var e=t.clientX-p,n=t.clientY-g;u.moved=e*e+n*n>d}u.event(t).zoom("mouse",a(v(u.that.__zoom,u.mouse[0]=t5(t,l),u.mouse[1]),u.extent,h))},!0).on("mouseup.zoom",function(t){var e,n,r,i;c.on("mousemove.zoom mouseup.zoom",null),e=t.view,n=u.moved,r=e.document.documentElement,i=tp(e).on("dragstart.drag",null),n&&(i.on("click.drag",tm,tg),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect),eH(t),u.event(t).end()},!0),f=t5(t,l),p=t.clientX,g=t.clientY;o=(i=t.view).document.documentElement,s=tp(i).on("dragstart.drag",tm,tg),"onselectstart"in o?s.on("selectstart.drag",tm,tg):(o.__noselect=o.style.MozUserSelect,o.style.MozUserSelect="none"),e$(t),u.mouse=[f,this.__zoom.invert(f)],eb(this),u.start()}}function L(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,o=t5(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(o),l=n.k*(t.shiftKey?.5:2),c=a(v(m(n,l),o,s),i.apply(this,e),h);eH(t),u>0?tp(this).transition().duration(u).call(y,c,o,t):tp(this).call(g.transform,c,o,t)}}function k(n,...i){if(r.apply(this,arguments)){var a,o,s,l,h=n.touches,u=h.length,c=w(this,i,n.changedTouches.length===u).event(n);for(e$(n),o=0;ot.nodeId||t.id,parentNodeId:t=>t.parentNodeId||t.parentId,rootMargin:40,nodeWidth:t=>250,nodeHeight:t=>150,neighbourMargin:(t,e)=>80,siblingsMargin:t=>20,childrenMargin:t=>60,compactMarginPair:t=>100,compactMarginBetween:t=>20,nodeButtonWidth:t=>40,nodeButtonHeight:t=>40,nodeButtonX:t=>-20,nodeButtonY:t=>-20,linkYOffset:30,pagingStep:t=>5,minPagingVisibleNodes:t=>2e3,scaleExtent:[.001,20],duration:400,imageName:"Chart",setActiveNodeCentered:!0,layout:"top",compact:!0,createZoom:t=>nU(),onZoomStart:t=>{},onZoom:t=>{},onZoomEnd:t=>{},onNodeClick:t=>t,onExpandOrCollapse:t=>t,nodeContent:t=>`
Sample Node(id=${t.id}), override using
chart.nodeContent({data}=>{
    return '' // Custom HTML
})

Or check different layout examples
`,buttonContent:({node:t,state:e})=>`
${({left:e=>e?`
${t.data._directSubordinatesPaging}
`:`
${t.data._directSubordinatesPaging}
`,bottom:e=>e?`
${t.data._directSubordinatesPaging}
`:`
${t.data._directSubordinatesPaging}
`,right:e=>e?`
${t.data._directSubordinatesPaging}
`:`
${t.data._directSubordinatesPaging}
`,top:e=>e?`
${t.data._directSubordinatesPaging}
`:`
${t.data._directSubordinatesPaging}
`})[e.layout](t.children)}
`,pagingButton:(t,e,n,r)=>{let i=r.pagingStep(t.parent),a=t.parent.data._pagingStep,o=Math.min(t.parent.data._directSubordinatesPaging-a,i);return`
Show next ${o} nodes
`},nodeUpdate:function(t,e,n){tp(this).select(".node-rect").attr("stroke",t=>t.data._highlighted||t.data._upToTheRootHighlighted?"#E27396":"none").attr("stroke-width",t.data._highlighted||t.data._upToTheRootHighlighted?10:1)},nodeEnter:t=>t,nodeExit:t=>t,linkUpdate:function(t,e,n){tp(this).attr("stroke",t=>t.data._upToTheRootHighlighted?"#E27396":"#E4E2E9").attr("stroke-width",t=>t.data._upToTheRootHighlighted?5:1),t.data._upToTheRootHighlighted&&tp(this).raise()},hdiagonal:function(t,e,n){let r=t.x,i=t.y,a=e.x,o=e.y,s=n&&null!=n.x?n.x:r,l=n&&null!=n.y?n.y:i,h=a-r<0?-1:1,u=o-i<0?-1:1,c=Math.abs(a-r)/2<35?Math.abs(a-r)/2:35,f=Math.abs(a-r)/2-(c=Math.abs(o-i)/2 ${e.map(e=>{let n=this.getTextWidth(e.label,{ctx:t.ctx,fontSize:2,defaultFont:t.defaultFont});return` ${e.label||""} `}).join("")} `},connectionsUpdate:function(t,e,n){tp(this).attr("stroke",t=>"#E27396").attr("stroke-linecap","round").attr("stroke-width",t=>"5").attr("pointer-events","none").attr("marker-start",t=>`url(#${t.from+"_"+t.to})`).attr("marker-end",t=>`url(#arrow-${t.from+"_"+t.to})`)},linkGroupArc:(function(t){let e,n=nB,r=nO,i=nM,a=nF,o=null,s=null,l=(e=3,h.digits=function(t){if(!arguments.length)return e;if(null==t)e=null;else{let n=Math.floor(t);if(!(n>=0))throw RangeError(`invalid digits: ${t}`);e=n}return h},()=>new nj(e));function h(){let e,h=nA.call(arguments),u=n.apply(this,h),c=r.apply(this,h);if(null==o&&(s=t(e=l())),s.lineStart(),h[0]=u,s.point(+i.apply(this,h),+a.apply(this,h)),h[0]=c,s.point(+i.apply(this,h),+a.apply(this,h)),s.lineEnd(),e)return s=null,e+""||null}return h.source=function(t){return arguments.length?(n=t,h):n},h.target=function(t){return arguments.length?(r=t,h):r},h.x=function(t){return arguments.length?(i="function"==typeof t?t:nL(+t),h):i},h.y=function(t){return arguments.length?(a="function"==typeof t?t:nL(+t),h):a},h.context=function(e){return arguments.length?(null==e?o=s=null:s=t(o=e),h):o},h})(nS).x(t=>t.x).y(t=>t.y),layoutBindings:{left:{nodeLeftX:t=>0,nodeRightX:t=>t.width,nodeTopY:t=>-t.height/2,nodeBottomY:t=>t.height/2,nodeJoinX:t=>t.x+t.width,nodeJoinY:t=>t.y-t.height/2,linkJoinX:t=>t.x+t.width,linkJoinY:t=>t.y,linkX:t=>t.x,linkY:t=>t.y,linkCompactXStart:t=>t.x+t.width/2,linkCompactYStart:t=>t.y+(t.compactEven?t.height/2:-t.height/2),compactLinkMidX:(t,e)=>t.firstCompactNode.x,compactLinkMidY:(t,e)=>t.firstCompactNode.y+t.firstCompactNode.flexCompactDim[0]/4+e.compactMarginPair(t)/4,linkParentX:t=>t.parent.x+t.parent.width,linkParentY:t=>t.parent.y,buttonX:t=>t.width,buttonY:t=>t.height/2,centerTransform:({root:t,rootMargin:e,centerY:n,scale:r,centerX:i})=>`translate(${e},${n}) scale(${r})`,compactDimension:{sizeColumn:t=>t.height,sizeRow:t=>t.width,reverse:t=>t.slice().reverse()},nodeFlexSize:({height:t,width:e,siblingsMargin:n,childrenMargin:r,state:i,node:a})=>i.compact&&a.flexCompactDim?[a.flexCompactDim[0],a.flexCompactDim[1]]:[t+n,e+r],zoomTransform:({centerY:t,scale:e})=>`translate(0,${t}) scale(${e})`,diagonal:this.hdiagonal.bind(this),swap:t=>{let e=t.x;t.x=t.y,t.y=e},nodeUpdateTransform:({x:t,y:e,width:n,height:r})=>`translate(${t},${e-r/2})`},top:{nodeLeftX:t=>-t.width/2,nodeRightX:t=>t.width/2,nodeTopY:t=>0,nodeBottomY:t=>t.height,nodeJoinX:t=>t.x-t.width/2,nodeJoinY:t=>t.y+t.height,linkJoinX:t=>t.x,linkJoinY:t=>t.y+t.height,linkCompactXStart:t=>t.x+(t.compactEven?t.width/2:-t.width/2),linkCompactYStart:t=>t.y+t.height/2,compactLinkMidX:(t,e)=>t.firstCompactNode.x+t.firstCompactNode.flexCompactDim[0]/4+e.compactMarginPair(t)/4,compactLinkMidY:t=>t.firstCompactNode.y,compactDimension:{sizeColumn:t=>t.width,sizeRow:t=>t.height,reverse:t=>t},linkX:t=>t.x,linkY:t=>t.y,linkParentX:t=>t.parent.x,linkParentY:t=>t.parent.y+t.parent.height,buttonX:t=>t.width/2,buttonY:t=>t.height,centerTransform:({root:t,rootMargin:e,centerY:n,scale:r,centerX:i})=>`translate(${i},${e}) scale(${r})`,nodeFlexSize:({height:t,width:e,siblingsMargin:n,childrenMargin:r,state:i,node:a,compactViewIndex:o})=>i.compact&&a.flexCompactDim?[a.flexCompactDim[0],a.flexCompactDim[1]]:[e+n,t+r],zoomTransform:({centerX:t,scale:e})=>`translate(${t},0}) scale(${e})`,diagonal:this.diagonal.bind(this),swap:t=>{},nodeUpdateTransform:({x:t,y:e,width:n,height:r})=>`translate(${t-n/2},${e})`},bottom:{nodeLeftX:t=>-t.width/2,nodeRightX:t=>t.width/2,nodeTopY:t=>-t.height,nodeBottomY:t=>0,nodeJoinX:t=>t.x-t.width/2,nodeJoinY:t=>t.y-t.height-t.height,linkJoinX:t=>t.x,linkJoinY:t=>t.y-t.height,linkCompactXStart:t=>t.x+(t.compactEven?t.width/2:-t.width/2),linkCompactYStart:t=>t.y-t.height/2,compactLinkMidX:(t,e)=>t.firstCompactNode.x+t.firstCompactNode.flexCompactDim[0]/4+e.compactMarginPair(t)/4,compactLinkMidY:t=>t.firstCompactNode.y,linkX:t=>t.x,linkY:t=>t.y,compactDimension:{sizeColumn:t=>t.width,sizeRow:t=>t.height,reverse:t=>t},linkParentX:t=>t.parent.x,linkParentY:t=>t.parent.y-t.parent.height,buttonX:t=>t.width/2,buttonY:t=>0,centerTransform:({root:t,rootMargin:e,centerY:n,scale:r,centerX:i,chartHeight:a})=>`translate(${i},${a-e}) scale(${r})`,nodeFlexSize:({height:t,width:e,siblingsMargin:n,childrenMargin:r,state:i,node:a})=>i.compact&&a.flexCompactDim?[a.flexCompactDim[0],a.flexCompactDim[1]]:[e+n,t+r],zoomTransform:({centerX:t,scale:e})=>`translate(${t},0}) scale(${e})`,diagonal:this.diagonal.bind(this),swap:t=>{t.y=-t.y},nodeUpdateTransform:({x:t,y:e,width:n,height:r})=>`translate(${t-n/2},${e-r})`},right:{nodeLeftX:t=>-t.width,nodeRightX:t=>0,nodeTopY:t=>-t.height/2,nodeBottomY:t=>t.height/2,nodeJoinX:t=>t.x-t.width-t.width,nodeJoinY:t=>t.y-t.height/2,linkJoinX:t=>t.x-t.width,linkJoinY:t=>t.y,linkX:t=>t.x,linkY:t=>t.y,linkParentX:t=>t.parent.x-t.parent.width,linkParentY:t=>t.parent.y,buttonX:t=>0,buttonY:t=>t.height/2,linkCompactXStart:t=>t.x-t.width/2,linkCompactYStart:t=>t.y+(t.compactEven?t.height/2:-t.height/2),compactLinkMidX:(t,e)=>t.firstCompactNode.x,compactLinkMidY:(t,e)=>t.firstCompactNode.y+t.firstCompactNode.flexCompactDim[0]/4+e.compactMarginPair(t)/4,centerTransform:({root:t,rootMargin:e,centerY:n,scale:r,centerX:i,chartWidth:a})=>`translate(${a-e},${n}) scale(${r})`,nodeFlexSize:({height:t,width:e,siblingsMargin:n,childrenMargin:r,state:i,node:a})=>i.compact&&a.flexCompactDim?[a.flexCompactDim[0],a.flexCompactDim[1]]:[t+n,e+r],compactDimension:{sizeColumn:t=>t.height,sizeRow:t=>t.width,reverse:t=>t.slice().reverse()},zoomTransform:({centerY:t,scale:e})=>`translate(0,${t}) scale(${e})`,diagonal:this.hdiagonal.bind(this),swap:t=>{let e=t.x;t.x=-t.y,t.y=e},nodeUpdateTransform:({x:t,y:e,width:n,height:r})=>`translate(${t-n},${e-r/2})`}}};this.getChartState=()=>t,Object.keys(t).forEach(e=>{this[e]=function(n){return arguments.length?(t[e]=n,this):t[e]}}),this.initializeEnterExitUpdatePattern()}initializeEnterExitUpdatePattern(){td.prototype.patternify=function(t){var e=t.selector,n=t.tag,r=t.data||[e],i=this.selectAll("."+e).data(r,(t,e)=>"object"==typeof t&&t.id?t.id:e);return i.exit().remove(),(i=i.enter().append(n).merge(i)).attr("class",e),i}}getNodeChildren({data:t,children:e,_children:n},r){return r.push(t),e&&e.forEach(t=>{this.getNodeChildren(t,r)}),n&&n.forEach(t=>{this.getNodeChildren(t,r)}),r}initialZoom(t){return this.getChartState().lastTransform.k=t,this}render(){let t=this.getChartState();if(!t.data||0==t.data.length)return console.log("ORG CHART - Data is empty"),t.container&&(tp(t.container).select(".nodes-wrapper").remove(),tp(t.container).select(".links-wrapper").remove(),tp(t.container).select(".connections-wrapper").remove()),this;let e=tp(t.container),n=e.node().getBoundingClientRect();n.width>0&&(t.svgWidth=n.width);let r={id:`ID${Math.floor(1e6*Math.random())}`,chartWidth:t.svgWidth,chartHeight:t.svgHeight};if(t.calc=r,r.centerX=r.chartWidth/2,r.centerY=r.chartHeight/2,t.firstDraw){let e={zoom:null};e.zoom=t.createZoom().clickDistance(10).on("start",(e,n)=>t.onZoomStart(e)).on("end",(e,n)=>t.onZoomEnd(e)).on("zoom",(e,n)=>{t.onZoom(e),this.zoomed(e,n)}).scaleExtent(t.scaleExtent),t.zoomBehavior=e.zoom}t.flexTreeLayout=nc({nodeSize:e=>{let n=t.nodeWidth(e),r=t.nodeHeight(e),i=t.siblingsMargin(e),a=t.childrenMargin(e);return t.layoutBindings[t.layout].nodeFlexSize({state:t,node:e,width:n,height:r,siblingsMargin:i,childrenMargin:a})}}).spacing((e,n)=>e.parent==n.parent?0:t.neighbourMargin(e,n)),this.setLayouts({expandNodesFirst:!1});let i=e.patternify({tag:"svg",selector:"svg-chart-container"}).attr("width",t.svgWidth).attr("height",t.svgHeight).attr("font-family",t.defaultFont);t.firstDraw&&i.call(t.zoomBehavior).on("dblclick.zoom",null).attr("cursor","move"),t.svg=i;let a=i.patternify({tag:"g",selector:"chart"});return t.centerG=a.patternify({tag:"g",selector:"center-group"}),t.linksWrapper=t.centerG.patternify({tag:"g",selector:"links-wrapper"}),t.nodesWrapper=t.centerG.patternify({tag:"g",selector:"nodes-wrapper"}),t.connectionsWrapper=t.centerG.patternify({tag:"g",selector:"connections-wrapper"}),t.defsWrapper=i.patternify({tag:"g",selector:"defs-wrapper"}),t.firstDraw&&t.centerG.attr("transform",()=>t.layoutBindings[t.layout].centerTransform({centerX:r.centerX,centerY:r.centerY,scale:t.lastTransform.k,rootMargin:t.rootMargin,root:t.root,chartHeight:r.chartHeight,chartWidth:r.chartWidth})),t.chart=a,this.update(t.root),tp(window).on(`resize.${t.id}`,()=>{let e=tp(t.container).node().getBoundingClientRect();t.svg.attr("width",e.width)}),t.firstDraw&&(t.firstDraw=!1),this}addNode(t){let e=this.getChartState();if(t&&(null==e.parentNodeId(t)||e.parentNodeId(t)==e.nodeId(t))&&0==e.data.length)return e.data.push(t),this.render(),this;let n=e.generateRoot(e.data).descendants(),r=n.filter(({data:n})=>e.nodeId(n).toString()===e.nodeId(t).toString())[0];return(n.filter(({data:n})=>e.nodeId(n).toString()===e.parentNodeId(t).toString())[0],r)?console.log(`ORG CHART - ADD - Node with id "${e.nodeId(t)}" already exists in tree`):(t._centered&&!t._expanded&&(t._expanded=!0),e.data.push(t),this.updateNodesState()),this}removeNode(t){let e=this.getChartState(),n=e.generateRoot(e.data).descendants().filter(({data:n})=>e.nodeId(n)==t)[0];return n?(n.descendants().forEach(t=>t.data._filteredOut=!0),e.data=e.data.filter(t=>!t._filteredOut),0==e.data.length?this.render():this.updateNodesState.bind(this)()):console.log(`ORG CHART - REMOVE - Node with id "${t}" not found in the tree`),this}groupBy(t,e,n){let r={};return t.forEach(t=>{let n=e(t);r[n]||(r[n]=[]),r[n].push(t)}),Object.keys(r).forEach(t=>{r[t]=n(r[t])}),Object.entries(r)}calculateCompactFlexDimensions(t){let e=this.getChartState();t.eachBefore(t=>{t.firstCompact=null,t.compactEven=null,t.flexCompactDim=null,t.firstCompactNode=null}),t.eachBefore(t=>{if(t.children&&t.children.length>1){let n=t.children.filter(t=>!t.children);if(n.length<2)return;n.forEach((t,e)=>{e||(t.firstCompact=!0),e%2?t.compactEven=!1:t.compactEven=!0,t.row=Math.floor(e/2)});let r=2*Math.max(nT(n.filter(t=>t.compactEven),e.layoutBindings[e.layout].compactDimension.sizeColumn),nT(n.filter(t=>!t.compactEven),e.layoutBindings[e.layout].compactDimension.sizeColumn)),i=nD(this.groupBy(n,t=>t.row,t=>nT(t,t=>e.layoutBindings[e.layout].compactDimension.sizeRow(t)+e.compactMarginBetween(t))).map(t=>t[1]));n.forEach(t=>{t.firstCompactNode=n[0],t.firstCompact?t.flexCompactDim=[r+e.compactMarginPair(t),i-e.compactMarginBetween(t)]:t.flexCompactDim=[0,0]}),t.flexCompactDim=null}})}calculateCompactFlexPositions(t){let e=this.getChartState();t.eachBefore(t=>{if(t.children){let n=t.children.filter(t=>t.flexCompactDim),r=n[0];if(!r)return;n.forEach((t,n,i)=>{0==n&&(r.x-=r.flexCompactDim[0]/2),n&n%2-1?t.x=r.x+.25*r.flexCompactDim[0]-e.compactMarginPair(t)/4:n&&(t.x=r.x+.75*r.flexCompactDim[0]+e.compactMarginPair(t)/4)});let i=r.x+.5*r.flexCompactDim[0];r.x=r.x+.25*r.flexCompactDim[0]-e.compactMarginPair(r)/4;let a=t.x-i;10>Math.abs(a)&&n.forEach(t=>t.x+=a);let o=nz(this.groupBy(n,t=>t.row,t=>nT(t,t=>e.layoutBindings[e.layout].compactDimension.sizeRow(t))).map(t=>t[1]+e.compactMarginBetween(t)));n.forEach((t,e)=>{t.row?t.y=r.y+o[t.row-1]:t.y=r.y})}})}update({x0:t,y0:e,x:n=0,y:r=0,width:i,height:a}){let o=this.getChartState();o.calc,o.compact&&this.calculateCompactFlexDimensions(o.root);let s=o.flexTreeLayout(o.root);o.compact&&this.calculateCompactFlexPositions(o.root);let l=s.descendants(),h=s.descendants().slice(1);l.forEach(o.layoutBindings[o.layout].swap);let u=o.connections,c={};o.allNodes.forEach(t=>c[o.nodeId(t.data)]=t);let f={};l.forEach(t=>f[o.nodeId(t.data)]=t),u.forEach(t=>{let e=c[t.from],n=c[t.to];t._source=e,t._target=n});let d=u.filter(t=>f[t.from]&&f[t.to]),p=o.defs.bind(this)(o,d);p!==o.defsWrapper.html()&&o.defsWrapper.html(p);let g=o.linksWrapper.selectAll("path.link").data(h,t=>o.nodeId(t.data)),m=g.enter().insert("path","g").attr("class","link").attr("d",n=>{let r={x:o.layoutBindings[o.layout].linkJoinX({x:t,y:e,width:i,height:a}),y:o.layoutBindings[o.layout].linkJoinY({x:t,y:e,width:i,height:a})};return o.layoutBindings[o.layout].diagonal(r,r,r)}).merge(g);m.attr("fill","none"),this.isEdge()?m.style("display",t=>t.data._pagingButton?"none":"auto"):m.attr("display",t=>t.data._pagingButton?"none":"auto"),m.each(o.linkUpdate),m.transition().duration(o.duration).attr("d",t=>{let e=o.compact&&t.flexCompactDim?{x:o.layoutBindings[o.layout].compactLinkMidX(t,o),y:o.layoutBindings[o.layout].compactLinkMidY(t,o)}:{x:o.layoutBindings[o.layout].linkX(t),y:o.layoutBindings[o.layout].linkY(t)},n={x:o.layoutBindings[o.layout].linkParentX(t),y:o.layoutBindings[o.layout].linkParentY(t)},r=o.compact&&t.flexCompactDim?{x:o.layoutBindings[o.layout].linkCompactXStart(t),y:o.layoutBindings[o.layout].linkCompactYStart(t)}:e;return o.layoutBindings[o.layout].diagonal(e,n,r,{sy:o.linkYOffset})}),g.exit().transition().duration(o.duration).attr("d",t=>{let e={x:o.layoutBindings[o.layout].linkJoinX({x:n,y:r,width:i,height:a}),y:o.layoutBindings[o.layout].linkJoinY({x:n,y:r,width:i,height:a})};return o.layoutBindings[o.layout].diagonal(e,e,null,{sy:o.linkYOffset})}).remove();let v=o.connectionsWrapper.selectAll("path.connection").data(d),b=v.enter().insert("path","g").attr("class","connection").attr("d",n=>{let r={x:o.layoutBindings[o.layout].linkJoinX({x:t,y:e,width:i,height:a}),y:o.layoutBindings[o.layout].linkJoinY({x:t,y:e,width:i,height:a})};return o.layoutBindings[o.layout].diagonal(r,r,null,{sy:o.linkYOffset})}).merge(v);b.attr("fill","none"),b.transition().duration(o.duration).attr("d",t=>{let e=o.layoutBindings[o.layout].linkX({x:t._source.x,y:t._source.y,width:t._source.width,height:t._source.height}),n=o.layoutBindings[o.layout].linkY({x:t._source.x,y:t._source.y,width:t._source.width,height:t._source.height}),r=o.layoutBindings[o.layout].linkJoinX({x:t._target.x,y:t._target.y,width:t._target.width,height:t._target.height}),i=o.layoutBindings[o.layout].linkJoinY({x:t._target.x,y:t._target.y,width:t._target.width,height:t._target.height});return o.linkGroupArc({source:{x:e,y:n},target:{x:r,y:i}})}),b.each(o.connectionsUpdate),v.exit().transition().duration(o.duration).attr("opacity",0).remove();let y=o.nodesWrapper.selectAll("g.node").data(l,({data:t})=>o.nodeId(t)),w=y.enter().append("g").attr("class","node").attr("transform",n=>{if(n==o.root)return`translate(${t},${e})`;let r=o.layoutBindings[o.layout].nodeJoinX({x:t,y:e,width:i,height:a}),s=o.layoutBindings[o.layout].nodeJoinY({x:t,y:e,width:i,height:a});return`translate(${r},${s})`}).attr("cursor","pointer").on("click.node",(t,e)=>{let{data:n}=e;if(![...t.srcElement.classList].includes("node-button-foreign-object")){if([...t.srcElement.classList].includes("paging-button-wrapper"))return void this.loadPagingNodes(e);if(!n._pagingButton)return void o.onNodeClick(e);console.log("event fired, no handlers")}}).on("keydown.node",(t,e)=>{let{data:n}=e;if("Enter"===t.key||" "===t.key||"Spacebar"===t.key){if([...t.srcElement.classList].includes("node-button-foreign-object"))return;if([...t.srcElement.classList].includes("paging-button-wrapper"))return void this.loadPagingNodes(e);("Enter"===t.key||" "===t.key||"Spacebar"===t.key)&&this.onButtonClick(t,e)}});w.each(o.nodeEnter),w.patternify({tag:"rect",selector:"node-rect",data:t=>[t]});let _=w.merge(y).style("font","12px sans-serif");_.patternify({tag:"foreignObject",selector:"node-foreign-object",data:t=>[t]}).style("overflow","visible").patternify({tag:"xhtml:div",selector:"node-foreign-object-div",data:t=>[t]}),this.restyleForeignObjectElements();let x=w.patternify({tag:"g",selector:"node-button-g",data:t=>[t]}).on("click",(t,e)=>this.onButtonClick(t,e)).on("keydown",(t,e)=>{("Enter"===t.key||" "===t.key||"Spacebar"===t.key)&&this.onButtonClick(t,e)});x.patternify({tag:"rect",selector:"node-button-rect",data:t=>[t]}).attr("opacity",0).attr("pointer-events","all").attr("width",t=>o.nodeButtonWidth(t)).attr("height",t=>o.nodeButtonHeight(t)).attr("x",t=>o.nodeButtonX(t)).attr("y",t=>o.nodeButtonY(t)),x.patternify({tag:"foreignObject",selector:"node-button-foreign-object",data:t=>[t]}).attr("width",t=>o.nodeButtonWidth(t)).attr("height",t=>o.nodeButtonHeight(t)).attr("x",t=>o.nodeButtonX(t)).attr("y",t=>o.nodeButtonY(t)).style("overflow","visible").patternify({tag:"xhtml:div",selector:"node-button-div",data:t=>[t]}).style("pointer-events","none").style("display","flex").style("width","100%").style("height","100%"),_.transition().attr("opacity",0).duration(o.duration).attr("transform",({x:t,y:e,width:n,height:r})=>o.layoutBindings[o.layout].nodeUpdateTransform({x:t,y:e,width:n,height:r})).attr("opacity",1),_.select(".node-rect").attr("width",({width:t})=>t).attr("height",({height:t})=>t).attr("x",({width:t})=>0).attr("y",({height:t})=>0).attr("cursor","pointer").attr("rx",3).attr("fill",o.nodeDefaultBackground),_.select(".node-button-g").attr("transform",({data:t,width:e,height:n})=>{let r=o.layoutBindings[o.layout].buttonX({width:e,height:n}),i=o.layoutBindings[o.layout].buttonY({width:e,height:n});return`translate(${r},${i})`}).attr("display",({data:t})=>t._directSubordinates>0?null:"none").attr("opacity",({data:t,children:e,_children:n})=>t._pagingButton?0:e||n?1:0),_.select(".node-button-foreign-object .node-button-div").html(t=>o.buttonContent({node:t,state:o})),_.select(".node-button-text").attr("text-anchor","middle").attr("alignment-baseline","middle").attr("font-size",({children:t})=>t?40:26).text(({children:t})=>t?"-":"+").attr("y",10*!!this.isEdge()),_.each(o.nodeUpdate);let N=y.exit();N.each(o.nodeExit);let A=N.data().reduce((t,e)=>t.depth{let{x:e,y:n,width:r,height:i}=A.parent||{},a=o.layoutBindings[o.layout].nodeJoinX({x:e,y:n,width:r,height:i}),s=o.layoutBindings[o.layout].nodeJoinY({x:e,y:n,width:r,height:i});return`translate(${a},${s})`}).on("end",function(){tp(this).remove()}).attr("opacity",0),l.forEach(t=>{t.x0=t.x,t.y0=t.y});let L=o.allNodes.filter(t=>t.data._centered)[0];if(L){let t=[L];L.data._centeredWithDescendants&&(t=o.compact?L.descendants().filter((t,e)=>e<7):L.descendants().filter((t,e,n)=>{let r=Math.round(n.length/2);return n.length%2?e>r-2&&er-2&&et).attr("height",({height:t})=>t).attr("x",({width:t})=>0).attr("y",({height:t})=>0),t.svg.selectAll(".node-foreign-object-div").style("width",({width:t})=>`${t}px`).style("height",({height:t})=>`${t}px`).html(function(e,n,r){return e.data._pagingButton?`
${t.pagingButton(e,n,r,t)}
`:t.nodeContent.bind(this)(e,n,r,t)})}onButtonClick(t,e){let n=this.getChartState();e.data._pagingButton||(n.setActiveNodeCentered&&(e.data._centered=!0,e.data._centeredWithDescendants=!0),e.children?(e._children=e.children,e.children=null,this.setExpansionFlagToChildren(e,!1)):(e.children=e._children,e._children=null,e.children&&e.children.forEach(({data:t})=>t._expanded=!0)),this.update(e),t.stopPropagation(),n.onExpandOrCollapse(e))}setExpansionFlagToChildren({data:t,children:e,_children:n},r){t._expanded=r,e&&e.forEach(t=>{this.setExpansionFlagToChildren(t,r)}),n&&n.forEach(t=>{this.setExpansionFlagToChildren(t,r)})}expandSomeNodes(t){if(t.data._expanded){let e=t.parent;for(;e&&e._children;)e.children=e._children,e._children=null,e=e.parent}t._children&&t._children.forEach(t=>this.expandSomeNodes(t)),t.children&&t.children.forEach(t=>this.expandSomeNodes(t))}updateNodesState(){let t=this.getChartState();this.setLayouts({expandNodesFirst:!0}),this.update(t.root)}setLayouts({expandNodesFirst:t=!0}){let e=this.getChartState();e.generateRoot=nq().id(t=>e.nodeId(t)).parentId(t=>e.parentNodeId(t)),e.root=e.generateRoot(e.data);let n=e.root.descendants();e.initialExpandLevel>1&&n.length>0&&(n.forEach(t=>{t.depth<=e.initialExpandLevel&&(t.data._expanded=!0)}),e.initialExpandLevel=1);let r={};e.root.descendants().filter(t=>t.children).filter(t=>!t.data._pagingStep).forEach(t=>{t.data._pagingStep=e.minPagingVisibleNodes(t)}),e.root.eachBefore((t,e)=>{t.data._directSubordinatesPaging=t.children?t.children.length:0,t.children&&t.children.forEach((e,n)=>{if(e.data._pagingButton=!1,n>t.data._pagingStep&&(r[e.id]=!0),n===t.data._pagingStep&&t.children.length-1>t.data._pagingStep&&(e.data._pagingButton=!0),r[e.parent.id]&&(r[e.id]=!0),e.data._expanded||e.data._centered||e.data._highlighted||e.data._upToTheRootHighlighted){let t=e;for(;t&&(r[t.id]||t.data._pagingButton);)r[t.id]=!1,t.data._pagingButton&&(t.data._pagingButton=!1,t.parent.children.forEach(t=>{t.data._expanded=!0,r[t.id]=!1})),t=t.parent}})}),e.root=nq().id(t=>e.nodeId(t)).parentId(t=>e.parentNodeId(t))(e.data.filter(t=>!0!==r[t.id])),e.root.each((t,n,r)=>{let i=t._hierarchyHeight||t.height,a=e.nodeWidth(t),o=e.nodeHeight(t);Object.assign(t,{width:a,height:o,_hierarchyHeight:i})}),e.root.x0=0,e.root.y0=0,e.allNodes=e.root.descendants(),e.allNodes.forEach(t=>{Object.assign(t.data,{_directSubordinates:t.children?t.children.length:0,_totalSubordinates:t.descendants().length-1})}),e.root.children&&(t&&e.root.children.forEach(this.expand),e.root.children.forEach(t=>this.collapse(t)),0==e.initialExpandLevel&&(e.root._children=e.root.children,e.root.children=null),[e.root].forEach(t=>this.expandSomeNodes(t)))}collapse(t){t.children&&(t._children=t.children,t._children.forEach(t=>this.collapse(t)),t.children=null)}expand(t){t._children&&(t.children=t._children,t.children.forEach(t=>this.expand(t)),t._children=null)}zoomed(t,e){let n=this.getChartState(),r=n.chart,i=t.transform;n.lastTransform=i,r.attr("transform",i),this.isEdge()&&this.restyleForeignObjectElements()}zoomTreeBounds({x0:t,x1:e,y0:n,y1:r,params:i={animate:!0,scale:!0,onCompleted:()=>{}}}){let{centerG:a,svgWidth:o,svgHeight:s,svg:l,zoomBehavior:h,duration:u,lastTransform:c}=this.getChartState(),f=Math.min(8,.9/Math.max((e-t)/o,(r-n)/s)),d=eU.translate(o/2,s/2);d=(d=d.scale(i.scale?f:c.k)).translate(-(t+e)/2,-(n+r)/2),l.transition().duration(i.animate?u:0).call(h.transform,d),a.transition().duration(i.animate?u:0).attr("transform","translate(0,0)").on("end",function(){i.onCompleted&&i.onCompleted()})}fit({animate:t=!0,nodes:e,scale:n=!0,onCompleted:r=()=>{}}={}){let i=this.getChartState(),{root:a}=i,o=e||a.descendants(),s=nR(o,t=>t.x+i.layoutBindings[i.layout].nodeLeftX(t)),l=nT(o,t=>t.x+i.layoutBindings[i.layout].nodeRightX(t)),h=nR(o,t=>t.y+i.layoutBindings[i.layout].nodeTopY(t)),u=nT(o,t=>t.y+i.layoutBindings[i.layout].nodeBottomY(t));return this.zoomTreeBounds({params:{animate:t,scale:n,onCompleted:r},x0:s-50,x1:l+50,y0:h-50,y1:u+50}),this}loadPagingNodes(t){let e=this.getChartState();t.data._pagingButton=!1;let n=t.parent.data._pagingStep,r=e.pagingStep(t.parent);t.parent.data._pagingStep=n+r,this.updateNodesState()}setExpanded(t,e=!0){let n=this.getChartState(),r=n.allNodes.filter(({data:e})=>n.nodeId(e)==t)[0];if(!r)return console.log(`ORG CHART - ${e?"EXPAND":"COLLAPSE"} - Node with id (${t}) not found in the tree`),this;if(r.data._expanded=e,!1==e){let t=r.parent||{descendants:()=>[]};t.descendants().filter(e=>e!=t).forEach(t=>t.data._expanded=!1)}return this}setCentered(t){let e=this.getChartState(),n=e.generateRoot(e.data).descendants().filter(({data:n})=>e.nodeId(n).toString()==t.toString())[0];return n?(n.ancestors().forEach(t=>t.data._expanded=!0),n.data._centered=!0,n.data._expanded=!0):console.log(`ORG CHART - CENTER - Node with id (${t}) not found in the tree`),this}setHighlighted(t){let e=this.getChartState(),n=e.generateRoot(e.data).descendants().filter(n=>e.nodeId(n.data).toString()===t.toString())[0];return n?(n.ancestors().forEach(t=>t.data._expanded=!0),n.data._highlighted=!0,n.data._expanded=!0,n.data._centered=!0):console.log(`ORG CHART - HIGHLIGHT - Node with id (${t}) not found in the tree`),this}setUpToTheRootHighlighted(t){let e=this.getChartState(),n=e.generateRoot(e.data).descendants().filter(n=>e.nodeId(n.data).toString()===t.toString())[0];return n?(n.ancestors().forEach(t=>t.data._expanded=!0),n.data._upToTheRootHighlighted=!0,n.data._expanded=!0,n.ancestors().forEach(t=>t.data._upToTheRootHighlighted=!0)):console.log(`ORG CHART - HIGHLIGHTROOT - Node with id (${t}) not found in the tree`),this}clearHighlighting(){let t=this.getChartState();return t.allNodes.forEach(t=>{t.data._highlighted=!1,t.data._upToTheRootHighlighted=!1}),this.update(t.root),this}fullscreen(t){let e=this.getChartState(),n=tp(t||e.container).node();tp(document).on("fullscreenchange."+e.id,function(t){(document.fullscreenElement||document.mozFullscreenElement||document.webkitFullscreenElement)==n?setTimeout(t=>{e.svg.attr("height",window.innerHeight-40)},500):e.svg.attr("height",e.svgHeight)}),n.requestFullscreen?n.requestFullscreen():n.mozRequestFullScreen?n.mozRequestFullScreen():n.webkitRequestFullscreen?n.webkitRequestFullscreen():n.msRequestFullscreen&&n.msRequestFullscreen()}zoomIn(){let{svg:t,zoomBehavior:e}=this.getChartState();t.transition().call(e.scaleBy,1.3)}zoomOut(){let{svg:t,zoomBehavior:e}=this.getChartState();t.transition().call(e.scaleBy,.78)}toDataURL(t,e){var n=new XMLHttpRequest;n.onload=function(){var t=new FileReader;t.onloadend=function(){e(t.result)},t.readAsDataURL(n.response)},n.open("GET",t),n.responseType="blob",n.send()}exportImg({full:t=!1,scale:e=3,onLoad:n=t=>t,save:r=!0,backgroundColor:i="#FAFAFA"}={}){let a=this,o=this.getChartState(),{svg:s,root:l}=o,h=0,u=s.selectAll("img"),c=u.size(),f=()=>{JSON.parse(JSON.stringify(a.lastTransform()));let s=a.duration();t&&a.fit();let{svg:h}=a.getChartState();setTimeout(t=>{a.downloadImage({node:h.node(),scale:e,isSvg:!1,backgroundColor:i,onAlreadySerialized:t=>{a.update(l)},imageName:o.imageName,onLoad:n,save:r})},t?s+10:0)};c>0?u.each(function(){a.toDataURL(this.src,t=>{this.src=t,++h==c&&f()})}):f()}exportSvg(){let{svg:t,imageName:e}=this.getChartState();return this.downloadImage({imageName:e,node:t.node(),scale:3,isSvg:!0}),this}expandAll(){let{allNodes:t,root:e,data:n}=this.getChartState();return n.forEach(t=>t._expanded=!0),this.render(),this}collapseAll(){let{allNodes:t,root:e}=this.getChartState();return t.forEach(t=>t.data._expanded=!1),this.initialExpandLevel(0),this.render(),this}downloadImage({node:t,scale:e=2,imageName:n="graph",isSvg:r=!1,save:i=!0,backgroundColor:a="#FAFAFA",onAlreadySerialized:o=t=>{},onLoad:s=t=>{}}){function l(t,e){var n=document.createElement("a");"string"==typeof n.download?(document.body.appendChild(n),n.download=e,n.href=t,n.click(),document.body.removeChild(n)):location.replace(t)}function h(t){let e="http://www.w3.org/2000/xmlns/";t=t.cloneNode(!0);let n=window.location.href+"#",r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null,!1);for(;r.nextNode();)for(let t of r.currentNode.attributes)t.value.includes(n)&&(t.value=t.value.replace(n,"#"));return t.setAttributeNS(e,"xmlns","http://www.w3.org/2000/svg"),t.setAttributeNS(e,"xmlns:xlink","http://www.w3.org/1999/xlink"),new XMLSerializer().serializeToString(t)}if(r){let e=h(t);var u="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e='\r\n'+e);l(u,n+".svg"),o();return}let c=document.createElement("img");c.onload=function(){let r=document.createElement("canvas"),o=t.getBoundingClientRect();r.width=o.width*e,r.height=o.height*e;let h=r.getContext("2d");h.fillStyle=a,h.fillRect(0,0,o.width*e,o.height*e),h.drawImage(c,0,0,o.width*e,o.height*e);let u=r.toDataURL("image/png");s&&s(u),i&&l(u,n+".png")};var u="data:image/svg+xml; charset=utf8, "+encodeURIComponent(h(t));o(),c.src=u}getTextWidth(t,{fontSize:e=14,fontWeight:n=400,defaultFont:r="Helvetice",ctx:i}={}){return i.font=`${n||""} ${e}px ${r} `,i.measureText(t).width}clear(){let t=this.getChartState();tp(window).on(`resize.${t.id}`,null),t.svg&&t.svg.selectAll("*").remove()}}var nH=t.i(97083),nW={},nX=function(t,e,n,r,i){var a=new Worker(nW[e]||(nW[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(t){var e=t.data,n=e.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],i(r,null)}else i(null,e)},a.postMessage(n,r),a},nY=Uint8Array,nV=Uint16Array,nG=Int32Array,nJ=new nY([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),nZ=new nY([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),nK=new nY([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nQ=function(t,e){for(var n=new nV(31),r=0;r<31;++r)n[r]=e+=1<>1|(21845&n8)<<1;n7=(61680&(n7=(52428&n7)>>2|(13107&n7)<<2))>>4|(3855&n7)<<4,n6[n8]=((65280&n7)>>8|(255&n7)<<8)>>1}for(var n9=function(t,e,n){for(var r,i=t.length,a=0,o=new nV(e);a>l]=h}else for(a=0,r=new nV(i);a>15-t[a]);return r},rt=new nY(288),n8=0;n8<144;++n8)rt[n8]=8;for(var n8=144;n8<256;++n8)rt[n8]=9;for(var n8=256;n8<280;++n8)rt[n8]=7;for(var n8=280;n8<288;++n8)rt[n8]=8;for(var re=new nY(32),n8=0;n8<32;++n8)re[n8]=5;var rn=n9(rt,9,0),rr=n9(rt,9,1),ri=n9(re,5,0),ra=n9(re,5,1),ro=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},rs=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},rl=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},rh=function(t){return(t+7)/8|0},ru=function(t,e,n){return(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length),new nY(t.subarray(e,n))},rc=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],rf=function(t,e,n){var r=Error(e||rc[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,rf),!n)throw r;return r},rd=function(t,e,n,r){var i=t.length,a=r?r.length:0;if(!i||e.f&&!e.l)return n||new nY(0);var o=!n,s=o||2!=e.i,l=e.i;o&&(n=new nY(3*i));var h=function(t){var e=n.length;if(t>e){var r=new nY(Math.max(2*e,t));r.set(n),n=r}},u=e.f||0,c=e.p||0,f=e.b||0,d=e.l,p=e.d,g=e.m,m=e.n,v=8*i;do{if(!d){u=rs(t,c,1);var b=rs(t,c+1,3);if(c+=3,b)if(1==b)d=rr,p=ra,g=9,m=5;else if(2==b){var y=rs(t,c,31)+257,w=rs(t,c+10,15)+4,_=y+rs(t,c+5,31)+1;c+=14;for(var x=new nY(_),N=new nY(19),A=0;A>4;if(P<16)x[A++]=P;else{var E=0,I=0;for(16==P?(I=3+rs(t,c,3),c+=2,E=x[A-1]):17==P?(I=3+rs(t,c,7),c+=3):18==P&&(I=11+rs(t,c,127),c+=7);I--;)x[A++]=E}}var j=x.subarray(0,y),M=x.subarray(y);g=ro(j),m=ro(M),d=n9(j,g,1),p=n9(M,m,1)}else rf(1);else{var P=rh(c)+4,F=t[P-4]|t[P-3]<<8,B=P+F;if(B>i){l&&rf(0);break}s&&h(f+F),n.set(t.subarray(P,B),f),e.b=f+=F,e.p=c=8*B,e.f=u;continue}if(c>v){l&&rf(0);break}}s&&h(f+131072);for(var O=(1<>4;if((c+=15&E)>v){l&&rf(0);break}if(E||rf(2),D<256)n[f++]=D;else if(256==D){R=c,d=null;break}else{var z=D-254;if(D>264){var A=D-257,q=nJ[A];z=rs(t,c,(1<>4;U||rf(3),c+=15&U;var M=n3[$];if($>3){var q=nZ[$];M+=rl(t,c)&(1<v){l&&rf(0);break}s&&h(f+131072);var H=f+z;if(f>8},rg=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>8,t[r+2]|=n>>16},rm=function(t,e){for(var n=[],r=0;rf&&(f=a[r].s);var d=new nV(f+1),p=rv(n[u-1],d,0);if(p>e){var r=0,g=0,m=p-e,v=1<e)g+=v-(1<>=m;g>0;){var y=a[r].s;d[y]=0&&g;--r){var w=a[r].s;d[w]==e&&(--d[w],++g)}p=e}return{t:new nY(d),l:p}},rv=function(t,e,n){return -1==t.s?Math.max(rv(t.l,e,n+1),rv(t.r,e,n+1)):e[t.s]=n},rb=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new nV(++e),r=0,i=t[0],a=1,o=function(t){n[r++]=t},s=1;s<=e;++s)if(t[s]==i&&s!=e)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=t[s]}return{c:n.subarray(0,r),n:e}},ry=function(t,e){for(var n=0,r=0;r>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a4&&!E[nK[j-1]];--j);var M=h+5<<3,F=ry(i,rt)+ry(a,re)+o,B=ry(i,m)+ry(a,y)+o+14+3*j+ry(S,E)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&M<=F&&M<=B)return rw(e,u,t.subarray(l,l+h));if(rp(e,u,1+(B15&&(rp(e,u,D[C]>>5&127),u+=D[C]>>12)}}else c=rn,f=rt,d=ri,p=re;for(var C=0;C255){var z=q>>18&31;rg(e,u,c[z+257]),u+=f[z+257],z>7&&(rp(e,u,q>>23&31),u+=nJ[z]);var U=31&q;rg(e,u,d[U]),u+=p[U],U>3&&(rg(e,u,q>>5&8191),u+=nZ[U])}else rg(e,u,c[q]),u+=f[q]}return rg(e,u,c[256]),u+f[256]},rx=new nG([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),rN=new nY(0),rA=function(t,e,n,r,i,a){var o=a.z||t.length,s=new nY(r+o+5*(1+Math.ceil(o/7e3))+i),l=s.subarray(r,s.length-i),h=a.l,u=7&(a.r||0);if(e){u&&(l[0]=a.r>>3);for(var c=rx[e-1],f=c>>13,d=8191&c,p=(1<7e3||k>24576)&&(j>423||!h)){u=r_(t,l,0,w,_,x,A,k,C,L-C,u),k=N=A=0,C=L;for(var M=0;M<286;++M)_[M]=0;for(var M=0;M<30;++M)x[M]=0}var F=2,B=0,O=d,T=E-I&32767;if(j>2&&P==y(L-T))for(var R=Math.min(f,j)-1,D=Math.min(32767,L),z=Math.min(258,j);T<=D&&--O&&E!=I;){if(t[L+F]==t[L+F-T]){for(var q=0;qF){if(F=q,B=T,q>R)break;for(var U=Math.min(T,q-2),$=0,M=0;M$&&($=X,I=H)}}}I=g[E=I],T+=E-I&32767}if(B){w[k++]=0x10000000|n2[F]<<18|n4[B];var Y=31&n2[F],V=31&n4[B];A+=nJ[Y]+nZ[V],++_[257+Y],++x[V],S=L+F,++N}else w[k++]=t[L],++_[t[L]]}}for(L=Math.max(L,S);L=o&&(l[u/8|0]=h,G=o),u=rw(l,u+1,t.subarray(L,G))}a.i=o}return ru(s,0,r+rh(u)+i)},rL=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&-0x12477ce0)^n>>>1;t[e]=n}return t}(),rk=function(){var t=-1;return{p:function(e){for(var n=t,r=0;r>>8;t=n},d:function(){return~t}}},rS=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,a=0|n.length,o=0;o!=a;){for(var s=Math.min(o+2655,a);o>16),i=(65535&i)+15*(i>>16)}t=r,e=i},d:function(){return t%=65521,e%=65521,(255&t)<<24|(65280&t)<<8|(255&e)<<8|e>>8}}},rC=function(t,e,n,r,i){if(!i&&(i={l:1},e.dictionary)){var a=e.dictionary.subarray(-32768),o=new nY(a.length+t.length);o.set(a),o.set(t,a.length),t=o,i.w=a.length}return rA(t,null==e.level?6:e.level,null==e.mem?i.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+e.mem,n,r,i)},rP=function(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n},rE=function(t,e,n){for(var r=t(),i=t.toString(),a=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o>>0},rH=function(t,e){return r$(t,e)+0x100000000*r$(t,e+4)},rW=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},rX=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:2*(9==e.level),t[9]=3,0!=e.mtime&&rW(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},rY=function(t){(31!=t[0]||139!=t[1]||8!=t[2])&&rf(6,"invalid gzip data");var e=t[3],n=10;4&e&&(n+=(t[10]|t[11]<<8)+2);for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[n++]);return n+(2&e)},rV=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},rG=function(t){return 10+(t.filename?t.filename.length+1:0)},rJ=function(t,e){var n=e.level;if(t[0]=120,t[1]=(0==n?0:n<6?1:9==n?3:2)<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var r=rS();r.p(e.dictionary),rW(t,2,r.d())}},rZ=function(t,e){return((15&t[0])!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&rf(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&rf(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function rK(t,e){return"function"==typeof t&&(e=t,t={}),this.ondata=e,t}var rQ=function(){function t(t,e){if("function"==typeof t&&(e=t,t={}),this.ondata=e,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new nY(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return t.prototype.p=function(t,e){this.ondata(rC(t,this.o,0,0,this.s),e)},t.prototype.push=function(t,e){this.ondata||rf(5),this.s.l&&rf(4);var n=t.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var r=new nY(-32768&n);r.set(this.b.subarray(0,this.s.z)),this.b=r}var i=this.b.length-this.s.z;this.b.set(t.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(i),32768),this.s.z=t.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=1&e,(this.s.z>this.s.w+8191||e)&&(this.p(this.b,e||!1),this.s.w=this.s.i,this.s.i-=2)},t.prototype.flush=function(){this.ondata||rf(5),this.s.l&&rf(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},t}(),r1=function(t,e){rq([rB,function(){return[rz,rQ]}],this,rK.call(this,t,e),function(t){onmessage=rz(new rQ(t.data))},6,1)};function r0(t,e){return rC(t,e||{},0,0)}var r2=function(){function t(t,e){"function"==typeof t&&(e=t,t={}),this.ondata=e;var n=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new nY(32768),this.p=new nY(0),n&&this.o.set(n)}return t.prototype.e=function(t){if(this.ondata||rf(5),this.d&&rf(4),this.p.length){if(t.length){var e=new nY(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,n=rd(this.p,this.s,this.o);this.ondata(ru(n,e,this.s.b),this.d),this.o=ru(n,this.s.b-32768),this.s.b=this.o.length,this.p=ru(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}(),r5=function(t,e){rq([rF,function(){return[rz,r2]}],this,rK.call(this,t,e),function(t){onmessage=rz(new r2(t.data))},7,0)};function r3(t,e){return rd(t,{i:2},e&&e.out,e&&e.dictionary)}(function(){function t(t,e){this.c=rk(),this.l=0,this.v=1,rQ.call(this,t,e)}t.prototype.push=function(t,e){this.c.p(t),this.l+=t.length,rQ.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){var n=rC(t,this.o,this.v&&rG(this.o),e&&8,this.s);this.v&&(rX(n,this.o),this.v=0),e&&(rW(n,n.length-8,this.c.d()),rW(n,n.length-4,this.l)),this.ondata(n,e)},t.prototype.flush=function(){rQ.prototype.flush.call(this)}})();var r4=function(){function t(t,e){this.v=1,this.r=0,r2.call(this,t,e)}return t.prototype.push=function(t,e){if(r2.prototype.e.call(this,t),this.r+=t.length,this.v){var n=this.p.subarray(this.v-1),r=n.length>3?rY(n):4;if(r>n.length){if(!e)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(r),this.v=0}r2.prototype.c.call(this,e),!this.s.f||this.s.l||e||(this.v=rh(this.s.p)+9,this.s={i:0},this.o=new nY(0),this.push(new nY(0),e))},t}(),r6=function(t,e){var n=this;rq([rF,rO,function(){return[rz,r2,r4]}],this,rK.call(this,t,e),function(t){var e=new r4(t.data);e.onmember=function(t){return postMessage(t)},onmessage=rz(e)},9,0,function(t){return n.onmember&&n.onmember(t)})};function r8(t,e){e||(e={});var n=rS();n.p(t);var r=rC(t,e,e.dictionary?6:2,4);return rJ(r,e),rW(r,r.length-4,n.d()),r}(function(){function t(t,e){this.c=rS(),this.v=1,rQ.call(this,t,e)}t.prototype.push=function(t,e){this.c.p(t),rQ.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){var n=rC(t,this.o,this.v&&(this.o.dictionary?6:2),e&&4,this.s);this.v&&(rJ(n,this.o),this.v=0),e&&rW(n,n.length-4,this.c.d()),this.ondata(n,e)},t.prototype.flush=function(){rQ.prototype.flush.call(this)}})();var r7=function(){function t(t,e){r2.call(this,t,e),this.v=t&&t.dictionary?2:1}return t.prototype.push=function(t,e){if(r2.prototype.e.call(this,t),this.v){if(this.p.length<6&&!e)return;this.p=this.p.subarray(rZ(this.p,this.v-1)),this.v=0}e&&(this.p.length<4&&rf(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),r2.prototype.c.call(this,e)},t}(),r9=function(t,e){rq([rF,rT,function(){return[rz,r2,r7]}],this,rK.call(this,t,e),function(t){onmessage=rz(new r7(t.data))},11,0)},it=function(){function t(t,e){this.o=rK.call(this,t,e)||{},this.G=r4,this.I=r2,this.Z=r7}return t.prototype.i=function(){var t=this;this.s.ondata=function(e,n){t.ondata(e,n)}},t.prototype.push=function(t,e){if(this.ondata||rf(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new nY(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):(15&this.p[0])!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,e),this.p=null)}},t}();function ie(t,e){it.call(this,t,e),this.queuedSize=0,this.G=r6,this.I=r5,this.Z=r9}ie.prototype.i=function(){var t=this;this.s.ondata=function(e,n,r){t.ondata(e,n,r)},this.s.ondrain=function(e){t.queuedSize-=e,t.ondrain&&t.ondrain(e)}},ie.prototype.push=function(t,e){this.queuedSize+=t.length,it.prototype.push.call(this,t,e)};var ir="undefined"!=typeof TextEncoder&&new TextEncoder,ii="undefined"!=typeof TextDecoder&&new TextDecoder,ia=0;try{ii.decode(rN,{stream:!0}),ia=1}catch(t){}var io=function(t){for(var e="",n=0;;){var r=t[n++],i=(r>127)+(r>223)+(r>239);if(n+i>t.length)return{s:e,r:ru(t,n-1)};i?3==i?e+=String.fromCharCode(55296|(r=((15&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536)>>10,56320|1023&r):1&i?e+=String.fromCharCode((31&r)<<6|63&t[n++]):e+=String.fromCharCode((15&r)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(r)}};function is(t,e){if(e){for(var n=new nY(t.length),r=0;r>1)),o=0,s=function(t){a[o++]=t},r=0;ra.length){var l=new nY(o+8+(i-r<<1));l.set(a),a=l}var h=t.charCodeAt(r);h<128||e?s(h):(h<2048?s(192|h>>6):(h>55295&&h<57344?(s(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++r))>>18),s(128|h>>12&63)):s(224|h>>12),s(128|h>>6&63)),s(128|63&h))}return ru(a,0,o)}(function(t){this.ondata=t,ia?this.t=new TextDecoder:this.p=rN}).prototype.push=function(t,e){if(this.ondata||rf(5),e=!!e,this.t){this.ondata(this.t.decode(t,{stream:!0}),e),e&&(this.t.decode().length&&rf(8),this.t=null);return}this.p||rf(4);var n=new nY(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var r=io(n),i=r.s,a=r.r;e?(a.length&&rf(8),this.p=null):this.p=a,this.ondata(i,e)},(function(t){this.ondata=t}).prototype.push=function(t,e){this.ondata||rf(5),this.d&&rf(4),this.ondata(is(t),this.d=e||!1)};var il=function(t){return 1==t?3:t<6?2:+(9==t)},ih=function(t,e){for(;1!=rU(t,e);e+=4+rU(t,e+2));return[rH(t,e+12),rH(t,e+4),rH(t,e+20)]},iu=function(t){var e=0;if(t)for(var n in t){var r=t[n].length;r>65535&&rf(9),e+=r+4}return e},ic=function(t,e,n,r,i,a,o,s){var l=r.length,h=n.extra,u=s&&s.length,c=iu(h);rW(t,e,null!=o?0x2014b50:0x4034b50),e+=4,null!=o&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(a<0&&8),t[e++]=i&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var f=new Date(null==n.mtime?Date.now():n.mtime),d=f.getFullYear()-1980;if((d<0||d>119)&&rf(10),rW(t,e,d<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),e+=4,-1!=a&&(rW(t,e,n.crc),rW(t,e+4,a<0?-a-2:a),rW(t,e+8,n.size)),rW(t,e+12,l),rW(t,e+14,c),e+=16,null!=o&&(rW(t,e,u),rW(t,e+6,n.attrs),rW(t,e+10,o),e+=14),t.set(r,e),e+=l,c)for(var p in h){var g=h[p],m=g.length;rW(t,e,+p),rW(t,e+2,m),t.set(g,e+4),e+=4+m}return u&&(t.set(s,e),e+=u),e},id=function(t,e,n,r,i){rW(t,e,0x6054b50),rW(t,e+8,n),rW(t,e+10,n),rW(t,e+12,r),rW(t,e+16,i)},ip=function(){function t(t){this.filename=t,this.c=rk(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){this.ondata||rf(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();function ig(t,e){var n=this;e||(e={}),ip.call(this,t),this.d=new rQ(e,function(t,e){n.ondata(null,t,e)}),this.compression=8,this.flag=il(e.level)}function im(t,e){var n=this;e||(e={}),ip.call(this,t),this.d=new r1(e,function(t,e,r){n.ondata(t,e,r)}),this.compression=8,this.flag=il(e.level),this.terminate=this.d.terminate}function iv(t){this.ondata=t,this.u=[],this.d=1}ig.prototype.process=function(t,e){try{this.d.push(t,e)}catch(t){this.ondata(t,null,e)}},ig.prototype.push=function(t,e){ip.prototype.push.call(this,t,e)},im.prototype.process=function(t,e){this.d.push(t,e)},im.prototype.push=function(t,e){ip.prototype.push.call(this,t,e)},iv.prototype.add=function(t){var e=this;if(this.ondata||rf(5),2&this.d)this.ondata(rf(4+(1&this.d)*8,0,1),null,!1);else{var n=is(t.filename),r=n.length,i=t.comment,a=i&&is(i),o=r!=t.filename.length||a&&i.length!=a.length,s=r+iu(t.extra)+30;r>65535&&this.ondata(rf(11,0,1),null,!1);var l=new nY(s);ic(l,0,t,n,o,-1);var h=[l],u=function(){for(var t=0,n=h;tt.length)&&(e=t.length);for(var n=0,r=Array(e);n0){var r=Math.min(this.c,t.length),i=t.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),(t=t.subarray(r)).length)return this.push(t,e)}else{var a=0,o=0,s=void 0,l=void 0;this.p.length?t.length?((l=new nY(this.p.length+t.length)).set(this.p),l.set(t,this.p.length)):l=this.p:l=t;for(var h=l.length,u=this.c,c=u&&this.d,f=this;oo+30+c+d){var p,g,m=[];f.k.unshift(m),a=2;var v=r$(l,o+18),b=r$(l,o+22),y=function(t,e){if(e){for(var n="",r=0;r=0&&(w.size=v,w.originalSize=b),f.onfile(w)}return"break"}if(u){if(0x8074b50==t)return s=o+=12+(-2==u&&8),a=3,f.c=0,"break";else if(0x2014b50==t)return s=o-=4,a=3,f.c=0,"break"}}();++o);if(this.p=rN,u<0){var d=a?l.subarray(0,s-12-(-2==u&&8)-(0x8074b50==r$(l,s-16)&&4)):l.subarray(0,o);c?c.push(d,!!a):this.k[+(2==a)].push(d)}if(2&a)return this.push(l.subarray(o),e);this.p=l.subarray(o)}e&&(this.c&&rf(13),this.p=null)},i_.prototype.register=function(t){this.o[t.compression]=t},"function"==typeof queueMicrotask&&queueMicrotask;let iL=new TextEncoder,ik=!((new Uint32Array((o=new Uint8Array(4)).buffer)[0]=1)&o[0]),iS={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class iC{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=8192,e={}){let n=!1;"number"==typeof t?t=new ArrayBuffer(t):(n=!0,this.lastWrittenByte=t.byteLength);const r=e.offset?e.offset>>>0:0,i=t.byteLength-r;let a=r;(ArrayBuffer.isView(t)||t instanceof iC)&&(t.byteLength!==t.buffer.byteLength&&(a=t.byteOffset+r),t=t.buffer),n?this.lastWrittenByte=i:this.lastWrittenByte=0,this.buffer=t,this.length=i,this.byteLength=i,this.byteOffset=a,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,a,i),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let t=this._marks.pop();if(void 0===t)throw Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){let e=2*(this.offset+t),n=new Uint8Array(e);n.set(new Uint8Array(this.buffer)),this.buffer=n.buffer,this.length=e,this.byteLength=e,this._data=new DataView(this.buffer)}return this}readBoolean(){return 0!==this.readUint8()}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,e){let n=iS[e].BYTES_PER_ELEMENT*t,r=this.byteOffset+this.offset,i=this.buffer.slice(r,r+n);if(this.littleEndian===ik&&"uint8"!==e&&"int8"!==e){let t=new Uint8Array(this.buffer.slice(r,r+n));t.reverse();let i=new iS[e](t.buffer);return this.offset+=n,i.reverse(),i}let a=new iS[e](i);return this.offset+=n,a}readInt16(){let t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){let t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){let t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){let t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){let t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){let t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){let t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){let t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let e="";for(let n=0;nthis.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function iP(t){let e=t.length;for(;--e>=0;)t[e]=0}let iE=573,iI=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ij=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),iM=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),iF=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),iB=Array(576);iP(iB);let iO=Array(60);iP(iO);let iT=Array(512);iP(iT);let iR=Array(256);iP(iR);let iD=Array(29);iP(iD);let iz=Array(30);function iq(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function iU(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}iP(iz);let i$=t=>t<256?iT[t]:iT[256+(t>>>7)],iH=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},iW=(t,e,n)=>{t.bi_valid>16-n?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<{iW(t,n[2*e],n[2*e+1])},iY=(t,e)=>{let n=0;do n|=1&t,t>>>=1,n<<=1;while(--e>0)return n>>>1},iV=(t,e,n)=>{let r,i,a=Array(16),o=0;for(r=1;r<=15;r++)o=o+n[r-1]<<1,a[r]=o;for(i=0;i<=e;i++){let e=t[2*i+1];0!==e&&(t[2*i]=iY(a[e]++,e))}},iG=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},iJ=t=>{t.bi_valid>8?iH(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},iZ=(t,e,n,r)=>{let i=2*e,a=2*n;return t[i]{let r=t.heap[n],i=n<<1;for(;i<=t.heap_len&&(i{let r,i,a,o,s=0;if(0!==t.sym_next)do r=(255&t.pending_buf[t.sym_buf+s++])+((255&t.pending_buf[t.sym_buf+s++])<<8),i=t.pending_buf[t.sym_buf+s++],0===r?iX(t,i,e):(iX(t,(a=iR[i])+256+1,e),0!==(o=iI[a])&&iW(t,i-=iD[a],o),iX(t,a=i$(--r),n),0!==(o=ij[a])&&iW(t,r-=iz[a],o));while(s{let n,r,i,a=e.dyn_tree,o=e.stat_desc.static_tree,s=e.stat_desc.has_stree,l=e.stat_desc.elems,h=-1;for(n=0,t.heap_len=0,t.heap_max=iE;n>1;n>=1;n--)iK(t,a,n);i=l;do n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],iK(t,a,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,a[2*i]=a[2*n]+a[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,a[2*n+1]=a[2*r+1]=i,t.heap[1]=i++,iK(t,a,1);while(t.heap_len>=2)t.heap[--t.heap_max]=t.heap[1],((t,e)=>{let n,r,i,a,o,s,l=e.dyn_tree,h=e.max_code,u=e.stat_desc.static_tree,c=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(a=0;a<=15;a++)t.bl_count[a]=0;for(l[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;np&&(a=p,g++),l[2*r+1]=a,!(r>h)&&(t.bl_count[a]++,o=0,r>=d&&(o=f[r-d]),s=l[2*r],t.opt_len+=s*(a+o),c&&(t.static_len+=s*(u[2*r+1]+o)));if(0!==g){do{for(a=p-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[p]--,g-=2}while(g>0)for(a=p;0!==a;a--)for(r=t.bl_count[a];0!==r;)!((i=t.heap[--n])>h)&&(l[2*i+1]!==a&&(t.opt_len+=(a-l[2*i+1])*l[2*i],l[2*i+1]=a),r--)}})(t,e),iV(a,h,t.bl_count)},i0=(t,e,n)=>{let r,i,a=-1,o=e[1],s=0,l=7,h=4;for(0===o&&(l=138,h=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)i=o,o=e[(r+1)*2+1],++s{let r,i,a=-1,o=e[1],s=0,l=7,h=4;for(0===o&&(l=138,h=3),r=0;r<=n;r++)if(i=o,o=e[(r+1)*2+1],!(++s{iW(t,0+ +!!r,3),iJ(t),iH(t,n),iH(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var i4={_tr_init:t=>{i5||((()=>{let t,i,a,o,s,l=Array(16);for(o=0,a=0;o<28;o++)for(t=0,iD[o]=a;t<1<>=7;o<30;o++)for(t=0,iz[o]=s<<7;t<1<{let i,a,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,n=0xf3ffc07f;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),i1(t,t.l_desc),i1(t,t.d_desc),o=(t=>{let e;for(i0(t,t.dyn_ltree,t.l_desc.max_code),i0(t,t.dyn_dtree,t.d_desc.max_code),i1(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*iF[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,(a=t.static_len+3+7>>>3)<=i&&(i=a)):i=a=n+5,n+4<=i&&-1!==e?i3(t,e,n,r):4===t.strategy||a===i?(iW(t,2+ +!!r,3),iQ(t,iB,iO)):(iW(t,4+ +!!r,3),((t,e,n,r)=>{let i;for(iW(t,e-257,5),iW(t,n-1,5),iW(t,r-4,4),i=0;i(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[(iR[n]+256+1)*2]++,t.dyn_dtree[2*i$(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{iW(t,2,3),iX(t,256,iB),16===t.bi_valid?(iH(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},i6=(t,e,n,r)=>{let i=65535&t,a=t>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do a=a+(i=i+e[r++]|0)|0;while(--o)i%=65521,a%=65521}return i|a<<16};let i8=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?0xedb88320^t>>>1:t>>>1;e[n]=t}return e})());var i7=(t,e,n,r)=>{let i=r+n;t^=-1;for(let n=r;n>>8^i8[(t^e[n])&255];return -1^t},i9={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},at={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};let{_tr_init:ae,_tr_stored_block:an,_tr_flush_block:ar,_tr_tally:ai,_tr_align:aa}=i4,{Z_NO_FLUSH:ao,Z_PARTIAL_FLUSH:as,Z_FULL_FLUSH:al,Z_FINISH:ah,Z_BLOCK:au,Z_OK:ac,Z_STREAM_END:af,Z_STREAM_ERROR:ad,Z_DATA_ERROR:ap,Z_BUF_ERROR:ag,Z_DEFAULT_COMPRESSION:am,Z_FILTERED:av,Z_HUFFMAN_ONLY:ab,Z_RLE:ay,Z_FIXED:aw,Z_DEFAULT_STRATEGY:a_,Z_UNKNOWN:ax,Z_DEFLATED:aN}=at,aA=573,aL=(t,e)=>(t.msg=i9[e],e),ak=t=>2*t-9*(t>4),aS=t=>{let e=t.length;for(;--e>=0;)t[e]=0},aC=t=>{let e,n,r,i=t.w_size;r=e=t.hash_size;do n=t.head[--r],t.head[r]=n>=i?n-i:0;while(--e)r=e=i;do n=t.prev[--r],t.prev[r]=n>=i?n-i:0;while(--e)},aP=(t,e,n)=>(e<{let e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))},aI=(t,e)=>{ar(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,aE(t.strm)},aj=(t,e)=>{t.pending_buf[t.pending++]=e},aM=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},aF=(t,e,n,r)=>{let i=t.avail_in;return(i>r&&(i=r),0===i)?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),n),1===t.state.wrap?t.adler=i6(t.adler,e,i,n):2===t.state.wrap&&(t.adler=i7(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},aB=(t,e)=>{let n,r,i=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,l=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,h=t.window,u=t.w_mask,c=t.prev,f=t.strstart+258,d=h[a+o-1],p=h[a+o];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(h[(n=e)+o]!==p||h[n+o-1]!==d||h[n]!==h[a]||h[++n]!==h[a+1])continue;a+=2,n++;do;while(h[++a]===h[++n]&&h[++a]===h[++n]&&h[++a]===h[++n]&&h[++a]===h[++n]&&h[++a]===h[++n]&&h[++a]===h[++n]&&h[++a]===h[++n]&&h[++a]===h[++n]&&ao){if(t.match_start=e,o=r,r>=s)break;d=h[a+o-1],p=h[a+o]}}while((e=c[e&u])>l&&0!=--i)return o<=t.lookahead?o:t.lookahead},aO=t=>{let e,n,r,i=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=i+(i-262)&&(t.window.set(t.window.subarray(i,i+i-n),0),t.match_start-=i,t.strstart-=i,t.block_start-=i,t.insert>t.strstart&&(t.insert=t.strstart),aC(t),n+=i),0===t.strm.avail_in)break;if(e=aF(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=e,t.lookahead+t.insert>=3)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=aP(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=aP(t,t.ins_h,t.window[r+3-1]),t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},aT=(t,e)=>{let n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r,i,a,o=0,s=t.strm.avail_in;do{if(r=65535,a=t.bi_valid+42>>3,t.strm.avail_out(i=t.strstart-t.block_start)+t.strm.avail_in&&(r=i+t.strm.avail_in),r>a&&(r=a),r>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,aE(t.strm),i&&(i>r&&(i=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,r-=i),r&&(aF(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(0===o)return((s-=t.strm.avail_in)&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_watera&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(aF(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water>3,n=(a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a)>t.w_size?t.w_size:a,((i=t.strstart-t.block_start)>=n||(i||e===ah)&&e!==ao&&0===t.strm.avail_in&&i<=a)&&(r=i>a?a:i,o=+(e===ah&&0===t.strm.avail_in&&r===i),an(t,t.block_start,r,o),t.block_start+=r,aE(t.strm)),o?3:1)},aR=(t,e)=>{let n,r;for(;;){if(t.lookahead<262){if(aO(t),t.lookahead<262&&e===ao)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=aP(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-262&&(t.match_length=aB(t,n)),t.match_length>=3)if(r=ai(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do t.strstart++,t.ins_h=aP(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(0!=--t.match_length)t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=aP(t,t.ins_h,t.window[t.strstart+1]);else r=ai(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(aI(t,!1),0===t.strm.avail_out))return 1}return(t.insert=t.strstart<2?t.strstart:2,e===ah)?(aI(t,!0),0===t.strm.avail_out)?3:4:t.sym_next&&(aI(t,!1),0===t.strm.avail_out)?1:2},aD=(t,e)=>{let n,r,i;for(;;){if(t.lookahead<262){if(aO(t),t.lookahead<262&&e===ao)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=aP(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,r=ai(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=aP(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(0!=--t.prev_length)if(t.match_available=0,t.match_length=2,t.strstart++,r&&(aI(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((r=ai(t,0,t.window[t.strstart-1]))&&aI(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return(t.match_available&&(r=ai(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===ah)?(aI(t,!0),0===t.strm.avail_out)?3:4:t.sym_next&&(aI(t,!1),0===t.strm.avail_out)?1:2};function az(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}let aq=[new az(0,0,0,0,aT),new az(4,4,8,4,aR),new az(4,5,16,8,aR),new az(4,6,32,32,aR),new az(4,4,16,16,aD),new az(8,16,32,32,aD),new az(8,16,128,128,aD),new az(8,32,128,256,aD),new az(32,128,258,1024,aD),new az(32,258,258,4096,aD)];function aU(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=aN,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*aA),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),aS(this.dyn_ltree),aS(this.dyn_dtree),aS(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),aS(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),aS(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let a$=t=>{if(!t)return 1;let e=t.state;return e&&e.strm===t&&(42===e.status||57===e.status||69===e.status||73===e.status||91===e.status||103===e.status||113===e.status||666===e.status)?0:1};var aH=(t,e)=>{if(a$(t)||e>au||e<0)return t?aL(t,ad):ad;let n=t.state;if(!t.output||0!==t.avail_in&&!t.input||666===n.status&&e!==ah)return aL(t,0===t.avail_out?ag:ad);let r=n.last_flush;if(n.last_flush=e,0!==n.pending){if(aE(t),0===t.avail_out)return n.last_flush=-1,ac}else if(0===t.avail_in&&ak(e)<=ak(r)&&e!==ah)return aL(t,ag);if(666===n.status&&0!==t.avail_in)return aL(t,ag);if(42===n.status&&0===n.wrap&&(n.status=113),42===n.status){let e=aN+(n.w_bits-8<<4)<<8;if(e|=(n.strategy>=ab||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(e|=32),aM(n,e+=31-e%31),0!==n.strstart&&(aM(n,t.adler>>>16),aM(n,65535&t.adler)),t.adler=1,n.status=113,aE(t),0!==n.pending)return n.last_flush=-1,ac}if(57===n.status){if(t.adler=0,aj(n,31),aj(n,139),aj(n,8),n.gzhead)aj(n,+!!n.gzhead.text+2*!!n.gzhead.hcrc+4*!!n.gzhead.extra+8*!!n.gzhead.name+16*!!n.gzhead.comment),aj(n,255&n.gzhead.time),aj(n,n.gzhead.time>>8&255),aj(n,n.gzhead.time>>16&255),aj(n,n.gzhead.time>>24&255),aj(n,9===n.level?2:4*(n.strategy>=ab||n.level<2)),aj(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(aj(n,255&n.gzhead.extra.length),aj(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=i7(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(aj(n,0),aj(n,0),aj(n,0),aj(n,0),aj(n,0),aj(n,9===n.level?2:4*(n.strategy>=ab||n.level<2)),aj(n,3),n.status=113,aE(t),0!==n.pending)return n.last_flush=-1,ac}if(69===n.status){if(n.gzhead.extra){let e=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=i7(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=i,aE(t),0!==n.pending)return n.last_flush=-1,ac;e=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>e&&(t.adler=i7(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let e,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(t.adler=i7(t.adler,n.pending_buf,n.pending-r,r)),aE(t),0!==n.pending)return n.last_flush=-1,ac;r=0}e=n.gzindexr&&(t.adler=i7(t.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(t.adler=i7(t.adler,n.pending_buf,n.pending-r,r)),aE(t),0!==n.pending)return n.last_flush=-1,ac;r=0}e=n.gzindexr&&(t.adler=i7(t.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(aE(t),0!==n.pending))return n.last_flush=-1,ac;aj(n,255&t.adler),aj(n,t.adler>>8&255),t.adler=0}if(n.status=113,aE(t),0!==n.pending)return n.last_flush=-1,ac}if(0!==t.avail_in||0!==n.lookahead||e!==ao&&666!==n.status){let r=0===n.level?aT(n,e):n.strategy===ab?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(aO(t),0===t.lookahead)){if(e===ao)return 1;break}if(t.match_length=0,n=ai(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(aI(t,!1),0===t.strm.avail_out))return 1}return(t.insert=0,e===ah)?(aI(t,!0),0===t.strm.avail_out)?3:4:t.sym_next&&(aI(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===ay?((t,e)=>{let n,r,i,a,o=t.window;for(;;){if(t.lookahead<=258){if(aO(t),t.lookahead<=258&&e===ao)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=o[i=t.strstart-1])===o[++i]&&r===o[++i]&&r===o[++i]){a=t.strstart+258;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=ai(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=ai(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(aI(t,!1),0===t.strm.avail_out))return 1}return(t.insert=0,e===ah)?(aI(t,!0),0===t.strm.avail_out)?3:4:t.sym_next&&(aI(t,!1),0===t.strm.avail_out)?1:2})(n,e):aq[n.level].func(n,e);if((3===r||4===r)&&(n.status=666),1===r||3===r)return 0===t.avail_out&&(n.last_flush=-1),ac;if(2===r&&(e===as?aa(n):e!==au&&(an(n,0,0,!1),e===al&&(aS(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),aE(t),0===t.avail_out))return n.last_flush=-1,ac}return e!==ah?ac:n.wrap<=0?af:(2===n.wrap?(aj(n,255&t.adler),aj(n,t.adler>>8&255),aj(n,t.adler>>16&255),aj(n,t.adler>>24&255),aj(n,255&t.total_in),aj(n,t.total_in>>8&255),aj(n,t.total_in>>16&255),aj(n,t.total_in>>24&255)):(aM(n,t.adler>>>16),aM(n,65535&t.adler)),aE(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?ac:af)},aW=t=>{if(a$(t))return ad;let e=t.state.status;return t.state=null,113===e?aL(t,ap):ac};let aX=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var aY=function(t){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let n=e.shift();if(n){if("object"!=typeof n)throw TypeError(n+"must be non-object");for(let e in n)aX(n,e)&&(t[e]=n[e])}}return t},aV=t=>{let e=0;for(let n=0,r=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;aJ[254]=aJ[254]=1;var aZ=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,n,r,i,a,o=t.length,s=0;for(i=0;i>>6:(n<65536?e[a++]=224|n>>>12:(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63),e[a++]=128|n>>>6&63),e[a++]=128|63&n);return e},aK=(t,e)=>{let n,r,i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let a=Array(2*i);for(r=0,n=0;n4){a[r++]=65533,n+=o-1;continue}for(e&=2===o?31:3===o?15:7;o>1&&n1){a[r++]=65533;continue}e<65536?a[r++]=e:(e-=65536,a[r++]=55296|e>>10&1023,a[r++]=56320|1023&e)}var o=r;if(o<65534&&a.subarray&&aG)return String.fromCharCode.apply(null,a.length===o?a:a.subarray(0,o));let s="";for(let t=0;t{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&(192&t[n])==128;)n--;return n<0||0===n?e:n+aJ[t[n]]>e?n:e},a1=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};let a0=Object.prototype.toString,{Z_NO_FLUSH:a2,Z_SYNC_FLUSH:a5,Z_FULL_FLUSH:a3,Z_FINISH:a4,Z_OK:a6,Z_STREAM_END:a8,Z_DEFAULT_COMPRESSION:a7,Z_DEFAULT_STRATEGY:a9,Z_DEFLATED:ot}=at;function oe(t){let e,n;this.options=aY({level:a7,method:ot,chunkSize:16384,windowBits:15,memLevel:8,strategy:a9},t||{});let r=this.options;r.raw&&r.windowBits>0?r.windowBits=-r.windowBits:r.gzip&&r.windowBits>0&&r.windowBits<16&&(r.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a1,this.strm.avail_out=0;let i=((t,e,n,r,i,a)=>{var o,s;let l;if(!t)return ad;let h=1;if(e===am&&(e=6),r<0?(h=0,r=-r):r>15&&(h=2,r-=16),i<1||i>9||n!==aN||r<8||r>15||e<0||e>9||a<0||a>aw||8===r&&1!==h)return aL(t,ad);8===r&&(r=9);let u=new aU;return t.state=u,u.strm=t,u.status=42,u.wrap=h,u.gzhead=null,u.w_bits=r,u.w_size=1<{if(a$(t))return aL(t,ad);t.total_in=t.total_out=0,t.data_type=ax;let e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?42:113,t.adler=+(2!==e.wrap),e.last_flush=-2,ae(e),ac})(o=t))===ac&&((s=o.state).window_size=2*s.w_size,aS(s.head),s.max_lazy_match=aq[s.level].max_lazy,s.good_match=aq[s.level].good_length,s.nice_match=aq[s.level].nice_length,s.max_chain_length=aq[s.level].max_chain,s.strstart=0,s.block_start=0,s.lookahead=0,s.insert=0,s.match_length=s.prev_length=2,s.match_available=0,s.ins_h=0),l})(this.strm,r.level,r.method,r.windowBits,r.memLevel,r.strategy);if(i!==a6)throw Error(i9[i]);if(r.header&&(e=this.strm,n=r.header,a$(e)||2!==e.state.wrap||(e.state.gzhead=n)),r.dictionary){let t;if(t="string"==typeof r.dictionary?aZ(r.dictionary):"[object ArrayBuffer]"===a0.call(r.dictionary)?new Uint8Array(r.dictionary):r.dictionary,(i=((t,e)=>{let n=e.length;if(a$(t))return ad;let r=t.state,i=r.wrap;if(2===i||1===i&&42!==r.status||r.lookahead)return ad;if(1===i&&(t.adler=i6(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){0===i&&(aS(r.head),r.strstart=0,r.block_start=0,r.insert=0);let t=new Uint8Array(r.w_size);t.set(e.subarray(n-r.w_size,n),0),e=t,n=r.w_size}let a=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,aO(r);r.lookahead>=3;){let t=r.strstart,e=r.lookahead-2;do r.ins_h=aP(r,r.ins_h,r.window[t+3-1]),r.prev[t&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=t,t++;while(--e)r.strstart=t,r.lookahead=2,aO(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,r.wrap=i,ac})(this.strm,t))!==a6)throw Error(i9[i]);this._dict_set=!0}}function on(t,e){let n=new oe(e);if(n.push(t,!0),n.err)throw n.msg||i9[n.err];return n.result}oe.prototype.push=function(t,e){let n,r,i=this.strm,a=this.options.chunkSize;if(this.ended)return!1;for(r=e===~~e?e:!0===e?a4:a2,"string"==typeof t?i.input=aZ(t):"[object ArrayBuffer]"===a0.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){if(0===i.avail_out&&(i.output=new Uint8Array(a),i.next_out=0,i.avail_out=a),(r===a5||r===a3)&&i.avail_out<=6){this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;continue}if((n=aH(i,r))===a8)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),n=aW(this.strm),this.onEnd(n),this.ended=!0,n===a6;if(0===i.avail_out){this.onData(i.output);continue}if(r>0&&i.next_out>0){this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;continue}if(0===i.avail_in)break}return!0},oe.prototype.onData=function(t){this.chunks.push(t)},oe.prototype.onEnd=function(t){t===a6&&(this.result=aV(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var or=function(t,e){let n,r,i,a,o,s,l,h,u,c,f,d,p,g,m,v,b,y,w,_,x,N,A,L,k=t.state;n=t.next_in,A=t.input,r=n+(t.avail_in-5),i=t.next_out,L=t.output,a=i-(e-t.avail_out),o=i+(t.avail_out-257),s=k.dmax,l=k.wsize,h=k.whave,u=k.wnext,c=k.window,f=k.hold,d=k.bits,p=k.lencode,g=k.distcode,m=(1<>>=y=b>>>24,d-=y,0==(y=b>>>16&255))L[i++]=65535&b;else if(16&y)for(w=65535&b,(y&=15)&&(d>>=y,d-=y),d<15&&(f+=A[n++]<>>=y=b>>>24,d-=y,16&(y=b>>>16&255)){if(_=65535&b,d<(y&=15)&&(f+=A[n++]<s){t.msg="invalid distance too far back",k.mode=16209;break t}if(f>>>=y,d-=y,_>(y=i-a)){if((y=_-y)>h&&k.sane){t.msg="invalid distance too far back",k.mode=16209;break t}if(x=0,N=c,0===u){if(x+=l-y,y2;)L[i++]=N[x++],L[i++]=N[x++],L[i++]=N[x++],w-=3;w&&(L[i++]=N[x++],w>1&&(L[i++]=N[x++]))}else{x=i-_;do L[i++]=L[x++],L[i++]=L[x++],L[i++]=L[x++],w-=3;while(w>2)w&&(L[i++]=L[x++],w>1&&(L[i++]=L[x++]))}}else if((64&y)==0){b=g[(65535&b)+(f&(1<>3,d-=w<<3,f&=(1<{let l,h,u,c,f,d,p,g,m,v=s.bits,b=0,y=0,w=0,_=0,x=0,N=0,A=0,L=0,k=0,S=0,C=null,P=new Uint16Array(16),E=new Uint16Array(16),I=null;for(b=0;b<=15;b++)P[b]=0;for(y=0;y=1&&0===P[_];_--);if(x>_&&(x=_),0===_)return i[a++]=0x1400000,i[a++]=0x1400000,s.bits=1,0;for(w=1;w<_&&0===P[w];w++);for(x0&&(0===t||1!==_))return -1;for(b=1,E[1]=0;b<15;b++)E[b+1]=E[b]+P[b];for(y=0;y852||2===t&&k>592)return 1;for(;;){p=b-A,o[y]+1=d?(g=I[o[y]-d],m=C[o[y]-d]):(g=96,m=0),l=1<>A)+(h-=l)]=p<<24|g<<16|m;while(0!==h)for(l=1<>=1;if(0!==l?(S&=l-1,S+=l):S=0,y++,0==--P[b]){if(b===_)break;b=e[n+o[y]]}if(b>x&&(S&c)!==u){for(0===A&&(A=x),f+=w,L=1<<(N=b-A);N+A<_&&!((L-=P[N+A])<=0);)N++,L<<=1;if(k+=1<852||2===t&&k>592)return 1;i[u=S&c]=x<<24|N<<16|f-a}}return 0!==S&&(i[f+S]=b-A<<24|4194304),s.bits=x,0};let{Z_FINISH:oh,Z_BLOCK:ou,Z_TREES:oc,Z_OK:of,Z_STREAM_END:od,Z_NEED_DICT:op,Z_STREAM_ERROR:og,Z_DATA_ERROR:om,Z_MEM_ERROR:ov,Z_BUF_ERROR:ob,Z_DEFLATED:oy}=at,ow=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function o_(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let ox=t=>{if(!t)return 1;let e=t.state;return+(!e||e.strm!==t||e.mode<16180||e.mode>16211)},oN=t=>{if(ox(t))return og;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,(t=>{if(ox(t))return og;let e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=16180,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,of})(t)},oA=!0,oL=t=>{if(oA){i=new Int32Array(512),a=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(ol(1,t.lens,0,288,i,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ol(2,t.lens,0,32,a,0,t.work,{bits:5}),oA=!1}t.lencode=i,t.lenbits=9,t.distcode=a,t.distbits=5},ok=(t,e,n,r)=>{let i,a=t.state;return null===a.window&&(a.wsize=1<=a.wsize?(a.window.set(e.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):((i=a.wsize-a.wnext)>r&&(i=r),a.window.set(e.subarray(n-r,n-r+i),a.wnext),(r-=i)?(a.window.set(e.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave{let n,r,i,a,o,s,l,h,u,c,f,d,p,g,m,v,b,y,w,_,x,N,A,L,k=0,S=new Uint8Array(4),C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ox(t)||!t.output||!t.input&&0!==t.avail_in)return og;16191===(n=t.state).mode&&(n.mode=16192),o=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,h=n.hold,u=n.bits,c=s,f=l,N=of;e:for(;;)switch(n.mode){case 16180:if(0===n.wrap){n.mode=16192;break}for(;u<16;){if(0===s)break e;s--,h+=r[a++]<>>8&255,n.check=i7(n.check,S,2,0),h=0,u=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",n.mode=16209;break}if((15&h)!==oy){t.msg="unknown compression method",n.mode=16209;break}if(h>>>=4,u-=4,x=(15&h)+8,0===n.wbits&&(n.wbits=x),x>15||x>n.wbits){t.msg="invalid window size",n.mode=16209;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&h,S[1]=h>>>8&255,n.check=i7(n.check,S,2,0)),h=0,u=0,n.mode=16182;case 16182:for(;u<32;){if(0===s)break e;s--,h+=r[a++]<>>8&255,S[2]=h>>>16&255,S[3]=h>>>24&255,n.check=i7(n.check,S,4,0)),h=0,u=0,n.mode=16183;case 16183:for(;u<16;){if(0===s)break e;s--,h+=r[a++]<>8),512&n.flags&&4&n.wrap&&(S[0]=255&h,S[1]=h>>>8&255,n.check=i7(n.check,S,2,0)),h=0,u=0,n.mode=16184;case 16184:if(1024&n.flags){for(;u<16;){if(0===s)break e;s--,h+=r[a++]<>>8&255,n.check=i7(n.check,S,2,0)),h=0,u=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&((d=n.length)>s&&(d=s),d&&(n.head&&(x=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+d),x)),512&n.flags&&4&n.wrap&&(n.check=i7(n.check,r,d,a)),s-=d,a+=d,n.length-=d),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===s)break e;d=0;do x=r[a+d++],n.head&&x&&n.length<65536&&(n.head.name+=String.fromCharCode(x));while(x&&d>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=16191;break;case 16189:for(;u<32;){if(0===s)break e;s--,h+=r[a++]<>>=7&u,u-=7&u,n.mode=16206;break}for(;u<3;){if(0===s)break e;s--,h+=r[a++]<>>=1)){case 0:n.mode=16193;break;case 1:if(oL(n),n.mode=16199,e===oc){h>>>=2,u-=2;break e}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=16209}h>>>=2,u-=2;break;case 16193:for(h>>>=7&u,u-=7&u;u<32;){if(0===s)break e;s--,h+=r[a++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=16209;break}if(n.length=65535&h,h=0,u=0,n.mode=16194,e===oc)break e;case 16194:n.mode=16195;case 16195:if(d=n.length){if(d>s&&(d=s),d>l&&(d=l),0===d)break e;i.set(r.subarray(a,a+d),o),s-=d,a+=d,l-=d,o+=d,n.length-=d;break}n.mode=16191;break;case 16196:for(;u<14;){if(0===s)break e;s--,h+=r[a++]<>>=5))+1,u-=5,n.ncode=(15&(h>>>=5))+4,h>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=16209;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,u-=3}for(;n.have<19;)n.lens[C[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},N=ol(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,N){t.msg="invalid code lengths set",n.mode=16209;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,v=k>>>16&255,b=65535&k,!(m<=u);){if(0===s)break e;s--,h+=r[a++]<>>=m,u-=m,n.lens[n.have++]=b;else{if(16===b){for(L=m+2;u>>=m,u-=m,0===n.have){t.msg="invalid bit length repeat",n.mode=16209;break}x=n.lens[n.have-1],d=3+(3&h),h>>>=2,u-=2}else if(17===b){for(L=m+3;u>>=m,u-=m,x=0,d=3+(7&h),h>>>=3,u-=3}else{for(L=m+7;u>>=m,u-=m,x=0,d=11+(127&h),h>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=16209;break}for(;d--;)n.lens[n.have++]=x}}if(16209===n.mode)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=16209;break}if(n.lenbits=9,A={bits:n.lenbits},N=ol(1,n.lens,0,n.nlen,n.lencode,0,n.work,A),n.lenbits=A.bits,N){t.msg="invalid literal/lengths set",n.mode=16209;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},N=ol(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,N){t.msg="invalid distances set",n.mode=16209;break}if(n.mode=16199,e===oc)break e;case 16199:n.mode=16200;case 16200:if(s>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=a,t.avail_in=s,n.hold=h,n.bits=u,or(t,f),o=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,h=n.hold,u=n.bits,16191===n.mode&&(n.back=-1);break}for(n.back=0;m=(k=n.lencode[h&(1<>>24,v=k>>>16&255,b=65535&k,!(m<=u);){if(0===s)break e;s--,h+=r[a++]<>y)])>>>24,v=k>>>16&255,b=65535&k,!(y+m<=u);){if(0===s)break e;s--,h+=r[a++]<>>=y,u-=y,n.back+=y}if(h>>>=m,u-=m,n.back+=m,n.length=b,0===v){n.mode=16205;break}if(32&v){n.back=-1,n.mode=16191;break}if(64&v){t.msg="invalid literal/length code",n.mode=16209;break}n.extra=15&v,n.mode=16201;case 16201:if(n.extra){for(L=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;m=(k=n.distcode[h&(1<>>24,v=k>>>16&255,b=65535&k,!(m<=u);){if(0===s)break e;s--,h+=r[a++]<>y)])>>>24,v=k>>>16&255,b=65535&k,!(y+m<=u);){if(0===s)break e;s--,h+=r[a++]<>>=y,u-=y,n.back+=y}if(h>>>=m,u-=m,n.back+=m,64&v){t.msg="invalid distance code",n.mode=16209;break}n.offset=b,n.extra=15&v,n.mode=16203;case 16203:if(n.extra){for(L=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=16209;break}n.mode=16204;case 16204:if(0===l)break e;if(d=f-l,n.offset>d){if((d=n.offset-d)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=16209;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),g=n.window}else g=i,p=o-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[o++]=g[p++];while(--d)0===n.length&&(n.mode=16200);break;case 16205:if(0===l)break e;i[o++]=n.length,l--,n.mode=16200;break;case 16206:if(n.wrap){for(;u<32;){if(0===s)break e;s--,h|=r[a++]<{if(ox(t))return og;let e=t.state;return e.window&&(e.window=null),t.state=null,of},oP=(t,e)=>{let n,r=e.length;return ox(t)||0!==(n=t.state).wrap&&16190!==n.mode?og:16190===n.mode&&i6(1,e,r,0)!==n.check?om:ok(t,e,r,r)?(n.mode=16210,ov):(n.havedict=1,of)},oE=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};let oI=Object.prototype.toString,{Z_NO_FLUSH:oj,Z_FINISH:oM,Z_OK:oF,Z_STREAM_END:oB,Z_NEED_DICT:oO,Z_STREAM_ERROR:oT,Z_DATA_ERROR:oR,Z_MEM_ERROR:oD}=at;function oz(t){this.options=aY({chunkSize:65536,windowBits:15,to:""},t||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits)==0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a1,this.strm.avail_out=0;let n=((t,e)=>{if(!t)return og;let n=new o_;t.state=n,n.strm=t,n.window=null,n.mode=16180;let r=((t,e)=>{let n;if(ox(t))return og;let r=t.state;return(e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15))?og:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,oN(t))})(t,e);return r!==of&&(t.state=null),r})(this.strm,e.windowBits);if(n!==oF||(this.header=new oE,((t,e)=>{if(ox(t))return;let n=t.state;return(2&n.wrap)==0||(n.head=e,e.done=!1)})(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=aZ(e.dictionary):"[object ArrayBuffer]"===oI.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw)&&(n=oP(this.strm,e.dictionary))!==oF))throw Error(i9[n])}function oq(t,e){let n=new oz(e);if(n.push(t),n.err)throw n.msg||i9[n.err];return n.result}oz.prototype.push=function(t,e){let n,r,i,a=this.strm,o=this.options.chunkSize,s=this.options.dictionary;if(this.ended)return!1;for(r=e===~~e?e:!0===e?oM:oj,"[object ArrayBuffer]"===oI.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(o),a.next_out=0,a.avail_out=o),(n=oS(a,r))===oO&&s&&((n=oP(a,s))===oF?n=oS(a,r):n===oR&&(n=oO));a.avail_in>0&&n===oB&&a.state.wrap>0&&0!==t[a.next_in];)oN(a),n=oS(a,r);switch(n){case oT:case oR:case oO:case oD:return this.onEnd(n),this.ended=!0,!1}if(i=a.avail_out,a.next_out&&(0===a.avail_out||n===oB))if("string"===this.options.to){let t=aQ(a.output,a.next_out),e=a.next_out-t,n=aK(a.output,t);a.next_out=e,a.avail_out=o-e,e&&a.output.set(a.output.subarray(t,t+e),0),this.onData(n)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(n!==oF||0!==i){if(n===oB)return n=oC(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},oz.prototype.onData=function(t){this.chunks.push(t)},oz.prototype.onEnd=function(t){t===oF&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=aV(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};let{Deflate:oU,deflate:o$,deflateRaw:oH,gzip:oW}={Deflate:oe,deflate:on,deflateRaw:function(t,e){return(e=e||{}).raw=!0,on(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,on(t,e)},constants:at},{Inflate:oX,inflate:oY,inflateRaw:oV,ungzip:oG}={Inflate:oz,inflate:oq,inflateRaw:function(t,e){return(e=e||{}).raw=!0,oq(t,e)},ungzip:oq,constants:at},oJ=[];for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=0xedb88320^e>>>1:e>>>=1;oJ[t]=e}function oZ(t,e,n){let r=t.readUint32(),i=(0xffffffff^function(t,e,n){let r=0xffffffff;for(let t=0;t>>8;return r}(0,new Uint8Array(t.buffer,t.byteOffset+t.offset-e-4,e),e))>>>0;if(i!==r)throw Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function oK(t,e,n){for(let r=0;r>1)&255}else{for(;a>1)&255;for(;a>1)&255}}function o2(t,e,n,r,i){let a=0;if(0===n.length){for(;a>8&255}return t}}let o8=Uint8Array.of(137,80,78,71,13,10,26,10);function o7(t){if(!function(t){if(t.length79)throw Error("keyword length must be between 1 and 79");return n}class sn extends iC{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(t,e={}){super(t);const{checkCrc:n=!1}=e;this._checkCrc=n,this._inflator=new oX,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=-1,this._filterMethod=-1,this._interlaceMethod=-1,this._colorType=-1,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(o7(this);!this._end;){let t=this.readUint32(),e=this.readChars(4);this.decodeChunk(t,e)}return this.decodeImage(),this._png}decodeApng(){for(o7(this);!this._end;){let t=this.readUint32(),e=this.readChars(4);this.decodeApngChunk(t,e)}return this.decodeApngImage(),this._apng}decodeChunk(t,e){let n=this.offset;switch(e){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(t);break;case"IDAT":this.decodeIDAT(t);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(t);break;case"iCCP":this.decodeiCCP(t);break;case"tEXt":var r,i,a;let o;r=this._png.text,r[o=se(this)]=(i=this,a=t-o.length-1,o9.decode(i.readBytes(a)));break;case"pHYs":this.decodepHYs();break;default:this.skip(t)}if(this.offset-n!==t)throw Error(`Length mismatch while decoding chunk ${e}`);this._checkCrc?oZ(this,t+4,e):this.skip(4)}decodeApngChunk(t,e){let n=this.offset;switch("fdAT"!==e&&"IDAT"!==e&&this._writingDataChunks&&this.pushDataToFrame(),e){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,e),this.offset=n+t}if(this.offset-n!==t)throw Error(`Length mismatch while decoding chunk ${e}`);this._checkCrc?oZ(this,t+4,e):this.skip(4)}decodeIHDR(){let t,e=this._png;e.width=this.readUint32(),e.height=this.readUint32(),e.depth=function(t){if(1!==t&&2!==t&&4!==t&&8!==t&&16!==t)throw Error(`invalid bit depth: ${t}`);return t}(this.readUint8());let n=this.readUint8();switch(this._colorType=n,n){case 0:case 3:t=1;break;case 2:t=3;break;case 4:t=2;break;case 6:t=4;break;default:throw Error(`Unknown color type: ${n}`)}if(this._png.channels=t,this._compressionMethod=this.readUint8(),0!==this._compressionMethod)throw Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){let t={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(t)}decodePLTE(t){if(t%3!=0)throw RangeError(`PLTE field length must be a multiple of 3. Got ${t}`);let e=t/3;this._hasPalette=!0;let n=[];this._palette=n;for(let t=0;tthis._png.width*this._png.height)throw Error(`tRNS chunk contains more alpha values than there are pixels (${t/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(t/2);for(let e=0;ethis._palette.length)throw Error(`tRNS chunk contains more alpha values than there are palette colors (${t} vs ${this._palette.length})`);let e=0;for(;e({index:((t+e.yOffset)*this._png.width+e.xOffset+n)*this._png.channels,frameIndex:(t*e.width+n)*this._png.channels});switch(e.blendOp){case 0:for(let n=0;n=n)&&!(o>=r))for(let t=0;t>8&255}return t}}({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){let t=this._inflator.result,e=this._frames.at(-1);e?e.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:0,blendOp:0,data:t}),this._inflator=new oX,this._writingDataChunks=!1}}(lL=hv||(hv={}))[lL.UNKNOWN=0]="UNKNOWN",lL[lL.METRE=1]="METRE";var sr="undefined"!=typeof window?window:t.g;function si(){sr.console&&"function"==typeof sr.console.log&&sr.console.log.apply(sr.console,arguments)}var sa=function(t){sr.console&&("function"==typeof sr.console.warn?sr.console.warn.apply(sr.console,arguments):si.call(null,arguments))},so=function(t){sr.console&&("function"==typeof sr.console.error?sr.console.error.apply(sr.console,arguments):si(t))};function ss(t,e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="blob",r.onload=function(){su(r.response,e,n)},r.onerror=function(){so("could not download file")},r.send()}function sl(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return e.status>=200&&e.status<=299}function sh(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(n){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var su=sr.saveAs||("object"!==("undefined"==typeof window?"undefined":(0,nH.default)(window))||window!==sr?function(){}:"undefined"!=typeof HTMLAnchorElement&&"download"in HTMLAnchorElement.prototype?function(t,e,n){var r=sr.URL||sr.webkitURL,i=document.createElement("a");i.download=e=e||t.name||"download",i.rel="noopener","string"==typeof t?(i.href=t,i.origin!==location.origin?sl(i.href)?ss(t,e,n):sh(i,i.target="_blank"):sh(i)):(i.href=r.createObjectURL(t),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){sh(i)},0))}:"msSaveOrOpenBlob"in navigator?function(t,e,n){if(e=e||t.name||"download","string"==typeof t)if(sl(t))ss(t,e,n);else{var r,i=document.createElement("a");i.href=t,i.target="_blank",setTimeout(function(){sh(i)})}else navigator.msSaveOrOpenBlob((void 0===(r=n)?r={autoBom:!1}:"object"!==(0,nH.default)(r)&&(sa("Deprecated: Expected third argument to be a object"),r={autoBom:!r}),r.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t),e)}:function(t,e,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof t)return ss(t,e,n);var i="application/octet-stream"===t.type,a=/constructor/i.test(sr.HTMLElement)||sr.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a)&&"object"===("undefined"==typeof FileReader?"undefined":(0,nH.default)(FileReader))){var s=new FileReader;s.onloadend=function(){var t=s.result;t=o?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=t:location=t,r=null},s.readAsDataURL(t)}else{var l=sr.URL||sr.webkitURL,h=l.createObjectURL(t);r?r.location=h:location.href=h,r=null,setTimeout(function(){l.revokeObjectURL(h)},4e4)}});function sc(t){var e;t=t||"",this.ok=!1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=({aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"})[t=(t=t.replace(/ /g,"")).toLowerCase()]||t;for(var n=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),n=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==n.length&&(n="0"+n),"#"+t+e+n}}var sf=sr.atob.bind(sr),sd=sr.btoa.bind(sr);function sp(t,e){var n=t[0],r=t[1],i=t[2],a=t[3];n=sm(n,r,i,a,e[0],7,-0x28955b88),a=sm(a,n,r,i,e[1],12,-0x173848aa),i=sm(i,a,n,r,e[2],17,0x242070db),r=sm(r,i,a,n,e[3],22,-0x3e423112),n=sm(n,r,i,a,e[4],7,-0xa83f051),a=sm(a,n,r,i,e[5],12,0x4787c62a),i=sm(i,a,n,r,e[6],17,-0x57cfb9ed),r=sm(r,i,a,n,e[7],22,-0x2b96aff),n=sm(n,r,i,a,e[8],7,0x698098d8),a=sm(a,n,r,i,e[9],12,-0x74bb0851),i=sm(i,a,n,r,e[10],17,-42063),r=sm(r,i,a,n,e[11],22,-0x76a32842),n=sm(n,r,i,a,e[12],7,0x6b901122),a=sm(a,n,r,i,e[13],12,-0x2678e6d),i=sm(i,a,n,r,e[14],17,-0x5986bc72),n=sv(n,r=sm(r,i,a,n,e[15],22,0x49b40821),i,a,e[1],5,-0x9e1da9e),a=sv(a,n,r,i,e[6],9,-0x3fbf4cc0),i=sv(i,a,n,r,e[11],14,0x265e5a51),r=sv(r,i,a,n,e[0],20,-0x16493856),n=sv(n,r,i,a,e[5],5,-0x29d0efa3),a=sv(a,n,r,i,e[10],9,0x2441453),i=sv(i,a,n,r,e[15],14,-0x275e197f),r=sv(r,i,a,n,e[4],20,-0x182c0438),n=sv(n,r,i,a,e[9],5,0x21e1cde6),a=sv(a,n,r,i,e[14],9,-0x3cc8f82a),i=sv(i,a,n,r,e[3],14,-0xb2af279),r=sv(r,i,a,n,e[8],20,0x455a14ed),n=sv(n,r,i,a,e[13],5,-0x561c16fb),a=sv(a,n,r,i,e[2],9,-0x3105c08),i=sv(i,a,n,r,e[7],14,0x676f02d9),n=sb(n,r=sv(r,i,a,n,e[12],20,-0x72d5b376),i,a,e[5],4,-378558),a=sb(a,n,r,i,e[8],11,-0x788e097f),i=sb(i,a,n,r,e[11],16,0x6d9d6122),r=sb(r,i,a,n,e[14],23,-0x21ac7f4),n=sb(n,r,i,a,e[1],4,-0x5b4115bc),a=sb(a,n,r,i,e[4],11,0x4bdecfa9),i=sb(i,a,n,r,e[7],16,-0x944b4a0),r=sb(r,i,a,n,e[10],23,-0x41404390),n=sb(n,r,i,a,e[13],4,0x289b7ec6),a=sb(a,n,r,i,e[0],11,-0x155ed806),i=sb(i,a,n,r,e[3],16,-0x2b10cf7b),r=sb(r,i,a,n,e[6],23,0x4881d05),n=sb(n,r,i,a,e[9],4,-0x262b2fc7),a=sb(a,n,r,i,e[12],11,-0x1924661b),i=sb(i,a,n,r,e[15],16,0x1fa27cf8),n=sy(n,r=sb(r,i,a,n,e[2],23,-0x3b53a99b),i,a,e[0],6,-0xbd6ddbc),a=sy(a,n,r,i,e[7],10,0x432aff97),i=sy(i,a,n,r,e[14],15,-0x546bdc59),r=sy(r,i,a,n,e[5],21,-0x36c5fc7),n=sy(n,r,i,a,e[12],6,0x655b59c3),a=sy(a,n,r,i,e[3],10,-0x70f3336e),i=sy(i,a,n,r,e[10],15,-1051523),r=sy(r,i,a,n,e[1],21,-0x7a7ba22f),n=sy(n,r,i,a,e[8],6,0x6fa87e4f),a=sy(a,n,r,i,e[15],10,-0x1d31920),i=sy(i,a,n,r,e[6],15,-0x5cfebcec),r=sy(r,i,a,n,e[13],21,0x4e0811a1),n=sy(n,r,i,a,e[4],6,-0x8ac817e),a=sy(a,n,r,i,e[11],10,-0x42c50dcb),i=sy(i,a,n,r,e[2],15,0x2ad7d2bb),r=sy(r,i,a,n,e[9],21,-0x14792c6f),t[0]=sL(n,t[0]),t[1]=sL(r,t[1]),t[2]=sL(i,t[2]),t[3]=sL(a,t[3])}function sg(t,e,n,r,i,a){return e=sL(sL(e,t),sL(r,a)),sL(e<>>32-i,n)}function sm(t,e,n,r,i,a,o){return sg(e&n|~e&r,t,e,i,a,o)}function sv(t,e,n,r,i,a,o){return sg(e&r|n&~r,t,e,i,a,o)}function sb(t,e,n,r,i,a,o){return sg(e^n^r,t,e,i,a,o)}function sy(t,e,n,r,i,a,o){return sg(n^(e|~r),t,e,i,a,o)}function sw(t){var e,n=t.length,r=[0x67452301,-0x10325477,-0x67452302,0x10325476];for(e=64;e<=t.length;e+=64)sp(r,function(t){var e,n=[];for(e=0;e<64;e+=4)n[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return n}(t.substring(e-64,e)));t=t.substring(e-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e>2]|=t.charCodeAt(e)<<(e%4<<3);if(i[e>>2]|=128<<(e%4<<3),e>55)for(sp(r,i),e=0;e<16;e++)i[e]=0;return i[14]=8*n,sp(r,i),r}var s_="0123456789abcdef".split("");function sx(t){return String.fromCharCode(255&t,(65280&t)>>8,(0xff0000&t)>>16,(0xff000000&t)>>24)}function sN(t){return sw(t).map(sx).join("")}var sA="5d41402abc4b2a76b9719d911017c592"!=function(t){for(var e=0;e>8*n+4&15]+s_[t>>8*n&15];return e}(t[e]);return t.join("")}(sw("hello"));function sL(t,e){if(sA){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}return t+e|0}function sk(t,e){if(t!==n){for(var n,r,i=Array(1+(256/t.length|0)+1).join(t),a=[],o=0;o<256;o++)a[o]=o;var s=0;for(o=0;o<256;o++){var l=a[o];s=(s+l+i.charCodeAt(o))%256,a[o]=a[s],a[s]=l}n=t,r=a}else a=r;var h=e.length,u=0,c=0,f="";for(o=0;o€/\f©þdSiz";var a=(e+this.padding).substr(0,32),o=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(a,o),this.P=-(1+(255^i)),this.encryptionKey=sN(a+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=sk(this.encryptionKey,this.padding)}function sP(t){if(/[^\u0000-\u00ff]/.test(t))throw Error("Invalid PDF Name Object: "+t+", Only accept ASCII characters.");for(var e="",n=t.length,r=0;r126?"#"+("0"+i.toString(16)).slice(-2):t[r]}return e}function sE(t){if("object"!==(0,nH.default)(t))throw Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var e={};this.subscribe=function(t,n,r){if(r=r||!1,"string"!=typeof t||"function"!=typeof n||"boolean"!=typeof r)throw Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");e.hasOwnProperty(t)||(e[t]={});var i=Math.random().toString(35);return e[t][i]=[n,!!r],i},this.unsubscribe=function(t){for(var n in e)if(e[n][t])return delete e[n][t],0===Object.keys(e[n]).length&&delete e[n],!0;return!1},this.publish=function(n){if(e.hasOwnProperty(n)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var a in e[n]){var o=e[n][a];try{o[0].apply(t,r)}catch(t){sr.console&&so("jsPDF PubSub Error",t.message,t)}o[1]&&i.push(a)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return e}}function sI(t){if(!(this instanceof sI))return new sI(t);var e="opacity,stroke-opacity".split(",");for(var n in t)t.hasOwnProperty(n)&&e.indexOf(n)>=0&&(this[n]=t[n]);this.id="",this.objectNumber=-1}function sj(t,e){this.gState=t,this.matrix=e,this.id="",this.objectNumber=-1}function sM(t,e,n,r,i){if(!(this instanceof sM))return new sM(t,e,n,r,i);this.type="axial"===t?2:3,this.coords=e,this.colors=n,sj.call(this,r,i)}function sF(t,e,n,r,i){if(!(this instanceof sF))return new sF(t,e,n,r,i);this.boundingBox=t,this.xStep=e,this.yStep=n,this.stream="",this.cloneIndex=0,sj.call(this,r,i)}function sB(t){var e,n="string"==typeof arguments[0]?arguments[0]:"p",r=arguments[1],i=arguments[2],a=arguments[3],o=[],s=1,l=16,h="S",u=null;"object"===(0,nH.default)(t=t||{})&&(n=t.orientation,r=t.unit||r,i=t.format||i,a=t.compress||t.compressPdf||a,null!==(u=t.encryption||null)&&(u.userPassword=u.userPassword||"",u.ownerPassword=u.ownerPassword||"",u.userPermissions=u.userPermissions||[]),s="number"==typeof t.userUnit?Math.abs(t.userUnit):1,void 0!==t.precision&&(e=t.precision),void 0!==t.floatPrecision&&(l=t.floatPrecision),h=t.defaultPathOperation||"S"),o=t.filters||(!0===a?["FlateEncode"]:o),r=r||"mm",n=(""+(n||"P")).toLowerCase();var c=t.putOnlyUsedFonts||!1,f={},d={internal:{},__private__:{}};d.__private__.PubSub=sE;var p="1.3",g=d.__private__.getPdfVersion=function(){return p};d.__private__.setPdfVersion=function(t){p=t};var m={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};d.__private__.getPageFormats=function(){return m};var v=d.__private__.getPageFormat=function(t){return m[t]};i=i||"a4";var b="compat",y="advanced",w=b;function _(){this.saveGraphicsState(),Z(new tI(tf,0,0,-tf,0,e2()*tf).toString()+" cm"),this.setFontSize(this.getFontSize()/tf),h="n",w=y}function x(){this.restoreGraphicsState(),h="S",w=b}var N=d.__private__.combineFontStyleAndFontWeight=function(t,e){if("bold"==t&&"normal"==e||"bold"==t&&400==e||"normal"==t&&"italic"==e||"bold"==t&&"italic"==e)throw Error("Invalid Combination of fontweight and fontstyle");return e&&(t=400==e||"normal"===e?"italic"===t?"italic":"normal":700!=e&&"bold"!==e||"normal"!==t?(700==e?"bold":e)+""+t:"bold"),t};d.advancedAPI=function(t){var e=w===b;return e&&_.call(this),"function"!=typeof t||(t(this),e&&x.call(this)),this},d.compatAPI=function(t){var e=w===y;return e&&x.call(this),"function"!=typeof t||(t(this),e&&_.call(this)),this},d.isAdvancedAPI=function(){return w===y};var A,L=function(t){if(w!==y)throw Error(t+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},k=d.roundToPrecision=d.__private__.roundToPrecision=function(t,n){var r=e||n;if(isNaN(t)||isNaN(r))throw Error("Invalid argument passed to jsPDF.roundToPrecision");return t.toFixed(r).replace(/0+$/,"")};A=d.hpf=d.__private__.hpf="number"==typeof l?function(t){if(isNaN(t))throw Error("Invalid argument passed to jsPDF.hpf");return k(t,l)}:"smart"===l?function(t){if(isNaN(t))throw Error("Invalid argument passed to jsPDF.hpf");return k(t,t>-1&&t<1?16:5)}:function(t){if(isNaN(t))throw Error("Invalid argument passed to jsPDF.hpf");return k(t,16)};var S=d.f2=d.__private__.f2=function(t){if(isNaN(t))throw Error("Invalid argument passed to jsPDF.f2");return k(t,2)},C=d.__private__.f3=function(t){if(isNaN(t))throw Error("Invalid argument passed to jsPDF.f3");return k(t,3)},P=d.scale=d.__private__.scale=function(t){if(isNaN(t))throw Error("Invalid argument passed to jsPDF.scale");return w===b?t*tf:w===y?t:void 0},E=function(t){return P(w===b?e2()-t:w===y?t:void 0)};d.__private__.setPrecision=d.setPrecision=function(t){"number"==typeof parseInt(t,10)&&(e=parseInt(t,10))};var I,j="00000000000000000000000000000000",M=d.__private__.getFileId=function(){return j},F=d.__private__.setFileId=function(t){return j=void 0!==t&&/^[a-fA-F0-9]{32}$/.test(t)?t.toUpperCase():j.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),null!==u&&(el=new sC(u.userPermissions,u.userPassword,u.ownerPassword,j)),j};d.setFileId=function(t){return F(t),this},d.getFileId=function(){return M()};var B=d.__private__.convertDateToPDFDate=function(t){var e=t.getTimezoneOffset(),n=Math.floor(Math.abs(e/60)),r=Math.abs(e%60),i=(e<0?"+":"-")+z(n)+"'"+z(r)+"'";return"D:"+t.getFullYear()+z(t.getMonth()+1)+z(t.getDate())+z(t.getHours())+z(t.getMinutes())+z(t.getSeconds())+i},O=d.__private__.convertPDFDateToDate=function(t){return new Date(parseInt(t.substr(2,4),10),parseInt(t.substr(6,2),10)-1,parseInt(t.substr(8,2),10),parseInt(t.substr(10,2),10),parseInt(t.substr(12,2),10),parseInt(t.substr(14,2),10),0)},T=d.__private__.setCreationDate=function(t){var e;if(void 0===t&&(t=new Date),t instanceof Date)e=B(t);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(t))throw Error("Invalid argument passed to jsPDF.setCreationDate");e=t}return I=e},R=d.__private__.getCreationDate=function(t){var e=I;return"jsDate"===t&&(e=O(I)),e};d.setCreationDate=function(t){return T(t),this},d.getCreationDate=function(t){return R(t)};var D,z=d.__private__.padd2=function(t){return("0"+parseInt(t)).slice(-2)},q=d.__private__.padd2Hex=function(t){return("00"+(t=t.toString())).substr(t.length)},U=0,$=[],H=[],W=0,X=[],Y=[],V=!1,G=H;d.__private__.setCustomOutputDestination=function(t){V=!0,G=t};var J=function(t){V||(G=t)};d.__private__.resetCustomOutputDestination=function(){V=!1,G=H};var Z=d.__private__.out=function(t){return t=t.toString(),W+=t.length+1,G.push(t),G},K=d.__private__.write=function(t){return Z(1==arguments.length?t.toString():Array.prototype.join.call(arguments," "))},Q=d.__private__.getArrayBuffer=function(t){for(var e=t.length,n=new ArrayBuffer(e),r=new Uint8Array(n);e--;)r[e]=t.charCodeAt(e);return n},tt=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];d.__private__.getStandardFonts=function(){return tt};var te=t.fontSize||16;d.__private__.setFontSize=d.setFontSize=function(t){return te=w===y?t/tf:t,this};var tn,tr=d.__private__.getFontSize=d.getFontSize=function(){return w===b?te:te*tf},ti=t.R2L||!1;d.__private__.setR2L=d.setR2L=function(t){return ti=t,this},d.__private__.getR2L=d.getR2L=function(){return ti};var ta,to=d.__private__.setZoomMode=function(t){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(t))tn=t;else if(isNaN(t)){if(-1===[void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(t))throw Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+t+'" is not recognized.');tn=t}else tn=parseInt(t,10)};d.__private__.getZoomMode=function(){return tn};var ts,tl=d.__private__.setPageMode=function(t){if(-1==[void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(t))throw Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+t+'" is not recognized.');ta=t};d.__private__.getPageMode=function(){return ta};var th=d.__private__.setLayoutMode=function(t){if(-1==[void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(t))throw Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+t+'" is not recognized.');ts=t};d.__private__.getLayoutMode=function(){return ts},d.__private__.setDisplayMode=d.setDisplayMode=function(t,e,n){return to(t),th(e),tl(n),this};var tu={title:"",subject:"",author:"",keywords:"",creator:""};d.__private__.getDocumentProperty=function(t){if(-1===Object.keys(tu).indexOf(t))throw Error("Invalid argument passed to jsPDF.getDocumentProperty");return tu[t]},d.__private__.getDocumentProperties=function(){return tu},d.__private__.setDocumentProperties=d.setProperties=d.setDocumentProperties=function(t){for(var e in tu)tu.hasOwnProperty(e)&&t[e]&&(tu[e]=t[e]);return this},d.__private__.setDocumentProperty=function(t,e){if(-1===Object.keys(tu).indexOf(t))throw Error("Invalid arguments passed to jsPDF.setDocumentProperty");return tu[t]=e};var tc,tf,td,tp,tg,tm={},tv={},tb=[],ty={},tw={},t_={},tx={},tN=null,tA=0,tL=[],tk=new sE(d),tS=t.hotfixes||[],tC={},tP={},tE=[],tI=function t(e,n,r,i,a,o){if(!(this instanceof t))return new t(e,n,r,i,a,o);isNaN(e)&&(e=1),isNaN(n)&&(n=0),isNaN(r)&&(r=0),isNaN(i)&&(i=1),isNaN(a)&&(a=0),isNaN(o)&&(o=0),this._matrix=[e,n,r,i,a,o]};Object.defineProperty(tI.prototype,"sx",{get:function(){return this._matrix[0]},set:function(t){this._matrix[0]=t}}),Object.defineProperty(tI.prototype,"shy",{get:function(){return this._matrix[1]},set:function(t){this._matrix[1]=t}}),Object.defineProperty(tI.prototype,"shx",{get:function(){return this._matrix[2]},set:function(t){this._matrix[2]=t}}),Object.defineProperty(tI.prototype,"sy",{get:function(){return this._matrix[3]},set:function(t){this._matrix[3]=t}}),Object.defineProperty(tI.prototype,"tx",{get:function(){return this._matrix[4]},set:function(t){this._matrix[4]=t}}),Object.defineProperty(tI.prototype,"ty",{get:function(){return this._matrix[5]},set:function(t){this._matrix[5]=t}}),Object.defineProperty(tI.prototype,"a",{get:function(){return this._matrix[0]},set:function(t){this._matrix[0]=t}}),Object.defineProperty(tI.prototype,"b",{get:function(){return this._matrix[1]},set:function(t){this._matrix[1]=t}}),Object.defineProperty(tI.prototype,"c",{get:function(){return this._matrix[2]},set:function(t){this._matrix[2]=t}}),Object.defineProperty(tI.prototype,"d",{get:function(){return this._matrix[3]},set:function(t){this._matrix[3]=t}}),Object.defineProperty(tI.prototype,"e",{get:function(){return this._matrix[4]},set:function(t){this._matrix[4]=t}}),Object.defineProperty(tI.prototype,"f",{get:function(){return this._matrix[5]},set:function(t){this._matrix[5]=t}}),Object.defineProperty(tI.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(tI.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(tI.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(tI.prototype,"isIdentity",{get:function(){return 1===this.sx&&0===this.shy&&0===this.shx&&1===this.sy&&0===this.tx&&0===this.ty}}),tI.prototype.join=function(t){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(A).join(t)},tI.prototype.multiply=function(t){return new tI(t.sx*this.sx+t.shy*this.shx,t.sx*this.shy+t.shy*this.sy,t.shx*this.sx+t.sy*this.shx,t.shx*this.shy+t.sy*this.sy,t.tx*this.sx+t.ty*this.shx+this.tx,t.tx*this.shy+t.ty*this.sy+this.ty)},tI.prototype.decompose=function(){var t=this.sx,e=this.shy,n=this.shx,r=this.sy,i=this.tx,a=this.ty,o=Math.sqrt(t*t+e*e),s=(t/=o)*n+(e/=o)*r,l=Math.sqrt((n-=t*s)*n+(r-=e*s)*r);return s/=l,t*(r/=l)>16&255,r=l>>8&255,i=255&l}if(void 0===r||void 0===a&&n===r&&r===i)e="string"==typeof n?n+" "+o[0]:2===t.precision?S(n/255)+" "+o[0]:C(n/255)+" "+o[0];else if(void 0===a||"object"===(0,nH.default)(a)){if(a&&!isNaN(a.a)&&0===a.a)return["1. 1. 1.",o[1]].join(" ");e="string"==typeof n?[n,r,i,o[1]].join(" "):2===t.precision?[S(n/255),S(r/255),S(i/255),o[1]].join(" "):[C(n/255),C(r/255),C(i/255),o[1]].join(" ")}else e="string"==typeof n?[n,r,i,a,o[2]].join(" "):2===t.precision?[S(n),S(r),S(i),S(a),o[2]].join(" "):[C(n),C(r),C(i),C(a),o[2]].join(" ");return e},tH=d.__private__.getFilters=function(){return o},tW=d.__private__.putStream=function(t){var e=(t=t||{}).data||"",n=t.filters||tH(),r=t.alreadyAppliedFilters||[],i=t.addLength1||!1,a=e.length,o=t.objectId,s=function(t){return t};if(null!==u&&void 0===o)throw Error("ObjectId must be passed to putStream for file encryption");null!==u&&(s=el.encryptor(o,0));var l={};!0===n&&(n=["FlateEncode"]);var h=t.additionalKeyValues||[],c=(l=void 0!==sB.API.processDataByFilters?sB.API.processDataByFilters(e,n):{data:e,reverseChain:[]}).reverseChain+(Array.isArray(r)?r.join(" "):r.toString());if(0!==l.data.length&&(h.push({key:"Length",value:l.data.length}),!0===i&&h.push({key:"Length1",value:a})),0!=c.length)if(c.split("/").length-1==1)h.push({key:"Filter",value:c});else{h.push({key:"Filter",value:"["+c+"]"});for(var f=0;f>"),0!==l.data.length&&(Z("stream"),Z(s(l.data)),Z("endstream"))},tX=d.__private__.putPage=function(t){var e=t.number,n=t.data,r=t.objId,i=t.contentsObjId;tR(r,!0),Z("<>"),Z("endobj");var a=n.join("\n");return w===y&&(a+="\nQ"),tR(i,!0),tW({data:a,filters:tH(),objectId:i}),Z("endobj"),r},tY=d.__private__.putPages=function(){var t,e,n=[];for(t=1;t<=tA;t++)tL[t].objId=tT(),tL[t].contentsObjId=tT();for(t=1;t<=tA;t++)n.push(tX({number:t,data:Y[t],objId:tL[t].objId,contentsObjId:tL[t].contentsObjId,mediaBox:tL[t].mediaBox,cropBox:tL[t].cropBox,bleedBox:tL[t].bleedBox,trimBox:tL[t].trimBox,artBox:tL[t].artBox,userUnit:tL[t].userUnit,rootDictionaryObjId:tz,resourceDictionaryObjId:tq}));tR(tz,!0),Z("<>"),Z("endobj"),tk.publish("postPutPages")},tV=function(t){tk.publish("putFont",{font:t,out:Z,newObject:tO,putStream:tW}),!0!==t.isAlreadyPutted&&(t.objectNumber=tO(),Z("<<"),Z("/Type /Font"),Z("/BaseFont /"+sP(t.postScriptName)),Z("/Subtype /Type1"),"string"==typeof t.encoding&&Z("/Encoding /"+t.encoding),Z("/FirstChar 32"),Z("/LastChar 255"),Z(">>"),Z("endobj"))},tG=function(t){t.objectNumber=tO();var e=[];e.push({key:"Type",value:"/XObject"}),e.push({key:"Subtype",value:"/Form"}),e.push({key:"BBox",value:"["+[A(t.x),A(t.y),A(t.x+t.width),A(t.y+t.height)].join(" ")+"]"}),e.push({key:"Matrix",value:"["+t.matrix.toString()+"]"}),tW({data:t.pages[1].join("\n"),additionalKeyValues:e,objectId:t.objectNumber}),Z("endobj")},tJ=function(t,e){e||(e=21);var n=tO(),r=function(t,e){var n,r=[],i=1/(e-1);for(n=0;n<1;n+=i)r.push(n);if(r.push(1),0!=t[0].offset){var a={offset:0,color:t[0].color};t.unshift(a)}if(1!=t[t.length-1].offset){var o={offset:1,color:t[t.length-1].color};t.push(o)}for(var s="",l=0,h=0;ht[l+1].offset;)l++;var u=t[l].offset,c=(n-u)/(t[l+1].offset-u),f=t[l].color,d=t[l+1].color;s+=q(Math.round((1-c)*f[0]+c*d[0]).toString(16))+q(Math.round((1-c)*f[1]+c*d[1]).toString(16))+q(Math.round((1-c)*f[2]+c*d[2]).toString(16))}return s.trim()}(t.colors,e),i=[];i.push({key:"FunctionType",value:"0"}),i.push({key:"Domain",value:"[0.0 1.0]"}),i.push({key:"Size",value:"["+e+"]"}),i.push({key:"BitsPerSample",value:"8"}),i.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),i.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),tW({data:r,additionalKeyValues:i,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:n}),Z("endobj"),t.objectNumber=tO(),Z("<< /ShadingType "+t.type),Z("/ColorSpace /DeviceRGB");var a="/Coords ["+A(parseFloat(t.coords[0]))+" "+A(parseFloat(t.coords[1]))+" ";2===t.type?a+=A(parseFloat(t.coords[2]))+" "+A(parseFloat(t.coords[3])):a+=A(parseFloat(t.coords[2]))+" "+A(parseFloat(t.coords[3]))+" "+A(parseFloat(t.coords[4]))+" "+A(parseFloat(t.coords[5])),Z(a+="]"),t.matrix&&Z("/Matrix ["+t.matrix.toString()+"]"),Z("/Function "+n+" 0 R"),Z("/Extend [true true]"),Z(">>"),Z("endobj")},tZ=function(t,e){var n=tT(),r=tO();e.push({resourcesOid:n,objectOid:r}),t.objectNumber=r;var i=[];i.push({key:"Type",value:"/Pattern"}),i.push({key:"PatternType",value:"1"}),i.push({key:"PaintType",value:"1"}),i.push({key:"TilingType",value:"1"}),i.push({key:"BBox",value:"["+t.boundingBox.map(A).join(" ")+"]"}),i.push({key:"XStep",value:A(t.xStep)}),i.push({key:"YStep",value:A(t.yStep)}),i.push({key:"Resources",value:n+" 0 R"}),t.matrix&&i.push({key:"Matrix",value:"["+t.matrix.toString()+"]"}),tW({data:t.stream,additionalKeyValues:i,objectId:t.objectNumber}),Z("endobj")},tK=function(t){for(var e in t.objectNumber=tO(),Z("<<"),t)switch(e){case"opacity":Z("/ca "+S(t[e]));break;case"stroke-opacity":Z("/CA "+S(t[e]))}Z(">>"),Z("endobj")},tQ=function(t){tR(t.resourcesOid,!0),Z("<<"),Z("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var t in Z("/Font <<"),tm)tm.hasOwnProperty(t)&&(!1===c||!0===c&&f.hasOwnProperty(t))&&Z("/"+t+" "+tm[t].objectNumber+" 0 R");Z(">>")}(),function(){if(Object.keys(ty).length>0){for(var t in Z("/Shading <<"),ty)ty.hasOwnProperty(t)&&ty[t]instanceof sM&&ty[t].objectNumber>=0&&Z("/"+t+" "+ty[t].objectNumber+" 0 R");tk.publish("putShadingPatternDict"),Z(">>")}}(),function(t){if(Object.keys(ty).length>0){for(var e in Z("/Pattern <<"),ty)ty.hasOwnProperty(e)&&ty[e]instanceof d.TilingPattern&&ty[e].objectNumber>=0&&ty[e].objectNumber>")}}(t.objectOid),function(){if(Object.keys(t_).length>0){var t;for(t in Z("/ExtGState <<"),t_)t_.hasOwnProperty(t)&&t_[t].objectNumber>=0&&Z("/"+t+" "+t_[t].objectNumber+" 0 R");tk.publish("putGStateDict"),Z(">>")}}(),function(){for(var t in Z("/XObject <<"),tC)tC.hasOwnProperty(t)&&tC[t].objectNumber>=0&&Z("/"+t+" "+tC[t].objectNumber+" 0 R");tk.publish("putXobjectDict"),Z(">>")}(),Z(">>"),Z("endobj")},t1=function(t){tv[t.fontName]=tv[t.fontName]||{},tv[t.fontName][t.fontStyle]=t.id},t0=function(t,e,n,r,i){var a={id:"F"+(Object.keys(tm).length+1).toString(10),postScriptName:t,fontName:e,fontStyle:n,encoding:r,isStandardFont:i||!1,metadata:{}};return tk.publish("addFont",{font:a,instance:this}),tm[a.id]=a,t1(a),a.id},t2=d.__private__.pdfEscape=d.pdfEscape=function(t,e){return(function(t,e){var n,r,i,a,o,s,l,h,u;if(i=(e=e||{}).sourceEncoding||"Unicode",o=e.outputEncoding,(e.autoencode||o)&&tm[tc].metadata&&tm[tc].metadata[i]&&tm[tc].metadata[i].encoding&&(a=tm[tc].metadata[i].encoding,!o&&tm[tc].encoding&&(o=tm[tc].encoding),!o&&a.codePages&&(o=a.codePages[0]),"string"==typeof o&&(o=a[o]),o)){for(l=!1,s=[],n=0,r=t.length;n>8&&(l=!0);t=s.join("")}for(n=t.length;void 0===l&&0!==n;)t.charCodeAt(n-1)>>8&&(l=!0),n--;if(!l)return t;for(s=e.noBOM?[]:[254,255],n=0,r=t.length;n>8)>>8)throw Error("Character at position "+n+" of string '"+t+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");s.push(u),s.push(h-(u<<8))}return String.fromCharCode.apply(void 0,s)})(t,e).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},t5=d.__private__.beginPage=function(t){Y[++tA]=[],tL[tA]={objId:0,contentsObjId:0,userUnit:Number(s),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(t[0]),topRightY:Number(t[1])}},t6(tA),J(Y[D])},t3=function(t,e){var r,a,o;switch(n=e||n,"string"==typeof t&&Array.isArray(r=v(t.toLowerCase()))&&(a=r[0],o=r[1]),Array.isArray(t)&&(a=t[0]*tf,o=t[1]*tf),isNaN(a)&&(a=i[0],o=i[1]),(a>14400||o>14400)&&(sa("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),a=Math.min(14400,a),o=Math.min(14400,o)),i=[a,o],n.substr(0,1)){case"l":o>a&&(i=[o,a]);break;case"p":a>o&&(i=[o,a])}t5(i),eC(ek),Z(eO),0!==eU&&Z(eU+" J"),0!==e$&&Z(e$+" j"),tk.publish("addPage",{pageNumber:tA})},t4=function(t){t>0&&t<=tA&&(Y.splice(t,1),tL.splice(t,1),tA--,D>tA&&(D=tA),this.setPage(D))},t6=function(t){t>0&&t<=tA&&(D=t)},t8=d.__private__.getNumberOfPages=d.getNumberOfPages=function(){return Y.length-1},t7=function(t,e,n){var r,i=void 0;return n=n||{},t=void 0!==t?t:tm[tc].fontName,e=void 0!==e?e:tm[tc].fontStyle,void 0!==tv[r=t.toLowerCase()]&&void 0!==tv[r][e]?i=tv[r][e]:void 0!==tv[t]&&void 0!==tv[t][e]?i=tv[t][e]:!1===n.disableWarning&&sa("Unable to look up font label for font '"+t+"', '"+e+"'. Refer to getFontList() for available fonts."),i||n.noFallback||null==(i=tv.times[e])&&(i=tv.times.normal),i},t9=d.__private__.putInfo=function(){var t=tO(),e=function(t){return t};for(var n in null!==u&&(e=el.encryptor(t,0)),Z("<<"),Z("/Producer ("+t2(e("jsPDF "+sB.version))+")"),tu)tu.hasOwnProperty(n)&&tu[n]&&Z("/"+n.substr(0,1).toUpperCase()+n.substr(1)+" ("+t2(e(tu[n]))+")");Z("/CreationDate ("+t2(e(I))+")"),Z(">>"),Z("endobj")},et=d.__private__.putCatalog=function(t){var e=(t=t||{}).rootDictionaryObjId||tz;switch(tO(),Z("<<"),Z("/Type /Catalog"),Z("/Pages "+e+" 0 R"),tn||(tn="fullwidth"),tn){case"fullwidth":Z("/OpenAction [3 0 R /FitH null]");break;case"fullheight":Z("/OpenAction [3 0 R /FitV null]");break;case"fullpage":Z("/OpenAction [3 0 R /Fit]");break;case"original":Z("/OpenAction [3 0 R /XYZ null null 1]");break;default:var n=""+tn;"%"===n.substr(n.length-1)&&(tn=parseInt(tn)/100),"number"==typeof tn&&Z("/OpenAction [3 0 R /XYZ null null "+S(tn)+"]")}switch(ts||(ts="continuous"),ts){case"continuous":Z("/PageLayout /OneColumn");break;case"single":Z("/PageLayout /SinglePage");break;case"two":case"twoleft":Z("/PageLayout /TwoColumnLeft");break;case"tworight":Z("/PageLayout /TwoColumnRight")}ta&&Z("/PageMode /"+ta),tk.publish("putCatalog"),Z(">>"),Z("endobj")},ee=d.__private__.putTrailer=function(){Z("trailer"),Z("<<"),Z("/Size "+(U+1)),Z("/Root "+U+" 0 R"),Z("/Info "+(U-1)+" 0 R"),null!==u&&Z("/Encrypt "+el.oid+" 0 R"),Z("/ID [ <"+j+"> <"+j+"> ]"),Z(">>")},en=d.__private__.putHeader=function(){Z("%PDF-"+p),Z("%ºß¬à")},er=d.__private__.putXRef=function(){var t="0000000000";Z("xref"),Z("0 "+(U+1)),Z("0000000000 65535 f ");for(var e=1;e<=U;e++)"function"==typeof $[e]?Z((t+$[e]()).slice(-10)+" 00000 n "):void 0!==$[e]?Z((t+$[e]).slice(-10)+" 00000 n "):Z("0000000000 00000 n ")},ei=d.__private__.buildDocument=function(){U=0,W=0,H=[],$=[],X=[],tz=tT(),tq=tT(),J(H),tk.publish("buildDocument"),en(),tY(),function(){tk.publish("putAdditionalObjects");for(var t=0;t"),Z("/O <"+el.toHexString(el.O)+">"),Z("/P "+el.P),Z(">>"),Z("endobj")),t9(),et();var t,e=W;return er(),ee(),Z("startxref"),Z(""+e),Z("%%EOF"),J(Y[D]),H.join("\n")},ea=d.__private__.getBlob=function(t){return new Blob([Q(t)],{type:"application/pdf"})},eo=d.output=d.__private__.output=((tB=function(t,e){switch("string"==typeof(e=e||{})?e={filename:e}:e.filename=e.filename||"generated.pdf",t){case void 0:return ei();case"save":d.save(e.filename);break;case"arraybuffer":return Q(ei());case"blob":return ea(ei());case"bloburi":case"bloburl":if(void 0!==sr.URL&&"function"==typeof sr.URL.createObjectURL)return sr.URL&&sr.URL.createObjectURL(ea(ei()))||void 0;sa("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var n="",r=ei();try{n=sd(r)}catch(t){n=sd(unescape(encodeURIComponent(r)))}return"data:application/pdf;filename="+e.filename+";base64,"+n;case"pdfobjectnewwindow":if("[object Window]"===Object.prototype.toString.call(sr)){var i="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",a=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';e.pdfObjectUrl&&(i=e.pdfObjectUrl,a="");var o='",s=sr.open();return null!==s&&s.document.write(o),s}throw Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if("[object Window]"===Object.prototype.toString.call(sr)){var l='',f=sr.open();if(null!==f&&(f.document.write(c),f.document.title=e.filename),f||"undefined"==typeof safari)return f;break;case"datauri":case"dataurl":return sr.document.location.href=this.output("datauristring",e);default:return null}}).foo=function(){try{return tB.apply(this,arguments)}catch(n){var t=n.stack||"";~t.indexOf(" at ")&&(t=t.split(" at ")[1]);var e="Error in function "+t.split("\n")[0].split("<")[0]+": "+n.message;if(!sr.console)throw Error(e);sr.console.error(e,n),sr.alert&&alert(e)}},tB.foo.bar=tB,tB.foo),es=function(t){return!0===Array.isArray(tS)&&tS.indexOf(t)>-1};switch(r){case"pt":tf=1;break;case"mm":tf=72/25.4;break;case"cm":tf=72/2.54;break;case"in":tf=72;break;case"px":tf=1==es("px_scaling")?.75:96/72;break;case"pc":case"em":tf=12;break;case"ex":tf=6;break;default:if("number"!=typeof r)throw Error("Invalid unit: "+r);tf=r}var el=null;T(),F();var eh=d.__private__.getPageInfo=d.getPageInfo=function(t){if(isNaN(t)||t%1!=0)throw Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:tL[t].objId,pageNumber:t,pageContext:tL[t]}},eu=d.__private__.getPageInfoByObjId=function(t){if(isNaN(t)||t%1!=0)throw Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var e in tL)if(tL[e].objId===t)break;return eh(e)},ec=d.__private__.getCurrentPageInfo=d.getCurrentPageInfo=function(){return{objId:tL[D].objId,pageNumber:D,pageContext:tL[D]}};d.addPage=function(){return t3.apply(this,arguments),this},d.setPage=function(){return t6.apply(this,arguments),J.call(this,Y[D]),this},d.insertPage=function(t){return this.addPage(),this.movePage(D,t),this},d.movePage=function(t,e){var n,r;if(t>e){n=Y[t],r=tL[t];for(var i=t;i>e;i--)Y[i]=Y[i-1],tL[i]=tL[i-1];Y[e]=n,tL[e]=r,this.setPage(e)}else if(t0&&("string"==typeof t?t=g.splitTextToSize(t,u):"[object Array]"===Object.prototype.toString.call(t)&&(t=t.reduce(function(t,e){return t.concat(g.splitTextToSize(e,u))},[]))),a={text:t,x:e,y:n,options:r,mutex:{pdfEscape:t2,activeFontKey:tc,fonts:tm,activeFontSize:te}},tk.publish("preProcessText",a),t=a.text,s=(r=a.options).angle,p instanceof tI==0&&s&&"number"==typeof s){s*=Math.PI/180,0===r.rotationDirection&&(s=-s),w===y&&(s=-s);var B=Math.cos(s),O=Math.sin(s);p=new tI(B,O,-O,B,0,0)}else s&&s instanceof tI&&(p=s);w!==y||p||(p=tM),void 0!==(h=r.charSpace||ez)&&(b+=A(P(h))+" Tc\n",this.setCharSpace(this.getCharSpace()||0)),void 0!==(d=r.horizontalScale)&&(b+=A(100*d)+" Tz\n"),r.lang;var T=-1,R=void 0!==r.renderingMode?r.renderingMode:r.stroke,D=g.internal.getCurrentPageInfo().pageContext;switch(R){case 0:case!1:case"fill":T=0;break;case 1:case!0:case"stroke":T=1;break;case 2:case"fillThenStroke":T=2;break;case 3:case"invisible":T=3;break;case 4:case"fillAndAddForClipping":T=4;break;case 5:case"strokeAndAddPathForClipping":T=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":T=6;break;case 7:case"addToPathForClipping":T=7}var z=void 0!==D.usedRenderingMode?D.usedRenderingMode:-1;-1!==T?b+=T+" Tr\n":-1!==z&&(b+="0 Tr\n"),-1!==T&&(D.usedRenderingMode=T),l=r.align||"left";var q,U=te*_,$=g.internal.pageSize.getWidth(),H=tm[tc];h=r.charSpace||ez,u=r.maxWidth||0,c=Object.assign({autoencode:!0,noBOM:!0},r.flags);var W=[],X=function(t){return g.getStringUnitWidth(t,{font:H,charSpace:h,fontSize:te,doKerning:!1})*te/x};if("[object Array]"===Object.prototype.toString.call(t)){o=N(t),"left"!==l&&(q=o.map(X));var Y,V,G=0;if("right"===l){e-=q[0],t=[],j=o.length;for(var J=0;J0?(u-q[tn])/tl:0;tn":")"),tf=parseFloat(o[ty][1]),td=parseFloat(o[ty][2]);break;case 0:tp=(v?"<":"(")+o[ty]+(v?">":")"),tf=ej(e),td=eM(n)}void 0!==W&&void 0!==W[ty]&&(tv=W[ty]+" Tw\n"),0===ty?t.push(tv+tb(tf,td,p)+tp):0===tg?t.push(tv+tp):1===tg&&t.push(tv+tb(tf,td,p)+tp)}t=(0===tg?t.join(" Tj\nT* "):t.join(" Tj\n"))+" Tj\n";var tw="BT\n/";return tw+=tc+" "+te+" Tf\n",tw+=A(te*_)+" TL\n",tw+=eR+"\n",tw+=b,tw+=t,Z(tw+="ET"),f[tc]=!0,g};var ef=d.__private__.clip=d.clip=function(t){return Z("evenodd"===t?"W*":"W"),this};d.clipEvenOdd=function(){return ef("evenodd")},d.__private__.discardPath=d.discardPath=function(){return Z("n"),this};var ed=d.__private__.isValidStyle=function(t){var e=!1;return -1!==[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(t)&&(e=!0),e};d.__private__.setDefaultPathOperation=d.setDefaultPathOperation=function(t){return ed(t)&&(h=t),this};var ep=d.__private__.getStyle=d.getStyle=function(t){var e=h;switch(t){case"D":case"S":e="S";break;case"F":e="f";break;case"FD":case"DF":e="B";break;case"f":case"f*":case"B":case"B*":e=t}return e},eg=d.close=function(){return Z("h"),this};d.stroke=function(){return Z("S"),this},d.fill=function(t){return em("f",t),this},d.fillEvenOdd=function(t){return em("f*",t),this},d.fillStroke=function(t){return em("B",t),this},d.fillStrokeEvenOdd=function(t){return em("B*",t),this};var em=function(t,e){"object"===(0,nH.default)(e)?ey(e,t):Z(t)},ev=function(t){null===t||w===y&&void 0===t||Z(t=ep(t))};function eb(t,e,n,r,i){var a=new sF(e||this.boundingBox,n||this.xStep,r||this.yStep,this.gState,i||this.matrix);return a.stream=this.stream,tF(t+"$$"+this.cloneIndex+++"$$",a),a}var ey=function(t,e){var n=tw[t.key],r=ty[n];if(r instanceof sM)Z("q"),Z(ew(e)),r.gState&&d.setGState(r.gState),Z(t.matrix.toString()+" cm"),Z("/"+n+" sh"),Z("Q");else if(r instanceof sF){var i=new tI(1,0,0,-1,0,e2());t.matrix&&(i=i.multiply(t.matrix||tM),n=eb.call(r,t.key,t.boundingBox,t.xStep,t.yStep,i).id),Z("q"),Z("/Pattern cs"),Z("/"+n+" scn"),r.gState&&d.setGState(r.gState),Z(e),Z("Q")}},ew=function(t){switch(t){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},e_=d.moveTo=function(t,e){return Z(A(P(t))+" "+A(E(e))+" m"),this},ex=d.lineTo=function(t,e){return Z(A(P(t))+" "+A(E(e))+" l"),this},eN=d.curveTo=function(t,e,n,r,i,a){return Z([A(P(t)),A(E(e)),A(P(n)),A(E(r)),A(P(i)),A(E(a)),"c"].join(" ")),this};d.__private__.line=d.line=function(t,e,n,r,i){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r)||!ed(i))throw Error("Invalid arguments passed to jsPDF.line");return w===b?this.lines([[n-t,r-e]],t,e,[1,1],i||"S"):this.lines([[n-t,r-e]],t,e,[1,1]).stroke()},d.__private__.lines=d.lines=function(t,e,n,r,i,a){var o,s,l,h,u,c,f,d,p,g,m,v;if("number"==typeof t&&(v=n,n=e,e=t,t=v),r=r||[1,1],a=a||!1,isNaN(e)||isNaN(n)||!Array.isArray(t)||!Array.isArray(r)||!ed(i)||"boolean"!=typeof a)throw Error("Invalid arguments passed to jsPDF.lines");for(e_(e,n),o=r[0],s=r[1],h=t.length,g=e,m=n,l=0;l>8&255,t>>16&255,t>>24&255)},sC.prototype.toHexString=function(t){return t.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},sC.prototype.hexToBytes=function(t){for(var e=[],n=0;n>8&255,t>>16&255,255&e,e>>8&255)).substr(0,10);return function(t){return sk(n,t)}},sI.prototype.equals=function(t){var e,n="id,objectNumber,equals";if(!t||(0,nH.default)(t)!==(0,nH.default)(this))return!1;var r=0;for(e in this)if(!(n.indexOf(e)>=0)){if(this.hasOwnProperty(e)&&!t.hasOwnProperty(e)||this[e]!==t[e])return!1;r++}for(e in t)t.hasOwnProperty(e)&&0>n.indexOf(e)&&r--;return 0===r},sB.API={events:[]},sB.version="3.0.4";var sO=sB.API,sT=1,sR=function(t){return t.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},sD=function(t){return t.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},sz=function(t){return t.toFixed(2)},sq=function(t){return t.toFixed(5)};sO.__acroform__={};var sU=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t},s$=function(t){return t*sT},sH=function(t){var e=new s8,n=lc.internal.getHeight(t)||0;return e.BBox=[0,0,Number(sz(lc.internal.getWidth(t)||0)),Number(sz(n))],e},sW=sO.__acroform__.setBit=function(t,e){if(e=e||0,isNaN(t=t||0)||isNaN(e))throw Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return t|1<0;){e="";var l,h,u=s1("3",t,--a).height,c=t.multiline?o-a:(o-u)/2,f=c+=2,d=0,p=0,g=0;if(a<=0){e="(...) Tj\n",e+="% Width of Text: "+s1(e,t,a=12).width+", FieldWidth:"+s+"\n";break}for(var m="",v=0,b=0;bo)continue n;m+=i[b][g],y=!0,p=b,b--}else{m=" "==(m+=i[b][g]+" ").substr(m.length-1)?m.substr(0,m.length-1):m;var w,_,x=parseInt(b),N=(w=m,_=a,x+1=i.length-1;if(N&&!A){m+=" ",g=0;continue}if(N||A){if(A)p=x;else if(t.multiline&&(u+2)*(v+2)+2>o)continue n}else{if(!t.multiline||(u+2)*(v+2)+2>o)continue n;p=x}}for(var L="",k=d;k<=p;k++){var S=i[k];if(t.multiline){if(k===p){L+=S[g]+" ",g=(g+1)%S.length;continue}if(k===d){L+=S[S.length-1]+" ";continue}}L+=S[0]+" "}switch(h=s1(L=" "==L.substr(L.length-1)?L.substr(0,L.length-1):L,t,a).width,t.textAlign){case"right":l=s-h-2;break;case"center":l=(s-h)/2;break;default:l=2}e+=sz(l)+" "+sz(f)+" Td\n",e+="("+sR(L)+") Tj\n",e+=-sz(l)+" 0 Td\n",f=-(a+2),h=0,d=y?p:p+1,v++,m=""}break}return r.text=e,r.fontSize=a,r},s1=function(t,e,n){var r=e.scope.internal.getFont(e.fontName,e.fontStyle),i=e.scope.getStringUnitWidth(t,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:e.scope.getStringUnitWidth("3",{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:i}},s0={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},s2=function(t,e){var n={type:"reference",object:t};void 0===e.internal.getPageInfo(t.page).pageContext.annotations.find(function(t){return t.type===n.type&&t.object===n.object})&&e.internal.getPageInfo(t.page).pageContext.annotations.push(n)},s5=function(t,e){if(e.scope=t,void 0!==t.internal&&(void 0===t.internal.acroformPlugin||!1===t.internal.acroformPlugin.isInitialized)){if(s9.FieldNum=0,t.internal.acroformPlugin=JSON.parse(JSON.stringify(s0)),t.internal.acroformPlugin.acroFormDictionaryRoot)throw Error("Exception while creating AcroformDictionary");sT=t.internal.scaleFactor,t.internal.acroformPlugin.acroFormDictionaryRoot=new s7,t.internal.acroformPlugin.acroFormDictionaryRoot.scope=t,t.internal.acroformPlugin.acroFormDictionaryRoot._eventID=t.internal.events.subscribe("postPutResources",function(){t.internal.events.unsubscribe(t.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete t.internal.acroformPlugin.acroFormDictionaryRoot._eventID,t.internal.acroformPlugin.printedOut=!0}),t.internal.events.subscribe("buildDocument",function(){t.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var e=t.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];r.objId=void 0,r.hasAnnotation&&s2(r,t)}}),t.internal.events.subscribe("putCatalog",function(){if(void 0===t.internal.acroformPlugin.acroFormDictionaryRoot)throw Error("putCatalogCallback: Root missing.");t.internal.write("/AcroForm "+t.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")}),t.internal.events.subscribe("postPutPages",function(e){!function(t,e){var n=!t;for(var r in t||(e.internal.newObjectDeferredBegin(e.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),e.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),t=t||e.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(t.hasOwnProperty(r)){var i=t[r],a=[],o=i.Rect;if(i.Rect&&(i.Rect=sZ(i.Rect,e)),e.internal.newObjectDeferredBegin(i.objId,!0),i.DA=lc.createDefaultAppearanceStream(i),"object"===(0,nH.default)(i)&&"function"==typeof i.getKeyValueListForStream&&(a=i.getKeyValueListForStream()),i.Rect=o,i.hasAppearanceStream&&!i.appearanceStreamContent){var s=sK(i);a.push({key:"AP",value:"<>"}),e.internal.acroformPlugin.xForms.push(s)}if(i.appearanceStreamContent){var l="";for(var h in i.appearanceStreamContent)if(i.appearanceStreamContent.hasOwnProperty(h)){var u=i.appearanceStreamContent[h];if(l+="/"+h+" <<",Object.keys(u).length>=1||Array.isArray(u)){for(var r in u)if(u.hasOwnProperty(r)){var c=u[r];"function"==typeof c&&(c=c.call(e,i)),l+="/"+r+" "+c+" ",e.internal.acroformPlugin.xForms.indexOf(c)>=0||e.internal.acroformPlugin.xForms.push(c)}}else"function"==typeof(c=u)&&(c=c.call(e,i)),l+="/"+r+" "+c,e.internal.acroformPlugin.xForms.indexOf(c)>=0||e.internal.acroformPlugin.xForms.push(c);l+=">>"}a.push({key:"AP",value:"<<\n"+l+">>"})}e.internal.putStream({additionalKeyValues:a,objectId:i.objId}),e.internal.out("endobj")}n&&function(t,e){for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];e.internal.newObjectDeferredBegin(r.objId,!0),"object"===(0,nH.default)(r)&&"function"==typeof r.putStream&&r.putStream(),delete t[n]}}(e.internal.acroformPlugin.xForms,e)}(e,t)}),t.internal.acroformPlugin.isInitialized=!0}},s3=sO.__acroform__.arrayToPdfArray=function(t,e,n){var r=function(t){return t};if(Array.isArray(t)){for(var i="[",a=0;a0?e:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return e}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(t){var e=function(t){return t};return this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),"("+sR(e(t))+")"}},set:function(e){t=e}})};sU(s7,s6);var s9=function t(){s6.call(this);var e=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return e},set:function(t){if(isNaN(t))throw Error('Invalid value "'+t+'" for attribute F supplied.');e=t}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!sV(e,3)},set:function(t){!0==!!t?this.F=sG(e,3):this.F=sJ(e,3)}});var n=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return n},set:function(t){if(isNaN(t))throw Error('Invalid value "'+t+'" for attribute Ff supplied.');n=t}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(0!==r.length)return r},set:function(t){r=void 0!==t?t:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(t){r[0]=t}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(t){r[1]=t}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(t){r[2]=t}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]},set:function(t){r[3]=t}});var i="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return i},set:function(t){switch(t){case"/Btn":case"/Tx":case"/Ch":case"/Sig":i=t;break;default:throw Error('Invalid value "'+t+'" for attribute FT supplied.')}}});var a=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!a||a.length<1){if(this instanceof ls)return;a="FieldObject"+t.FieldNum++}var e=function(t){return t};return this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),"("+sR(e(a))+")"},set:function(t){a=t.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return a},set:function(t){a=t}});var o="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return o},set:function(t){o=t}});var s="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return s},set:function(t){s=t}});var l=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return l},set:function(t){l=t}});var h=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return void 0===h?50/sT:h},set:function(t){h=t}});var u="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return u},set:function(t){u=t}});var c="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!c||this instanceof ls||this instanceof lh))return s4(c,this.objId,this.scope)},set:function(t){c=t.toString()}});var f=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(f)return this instanceof li==0?s4(f,this.objId,this.scope):f},set:function(t){t=t.toString(),f=this instanceof li==0?"("===t.substr(0,1)?sD(t.substr(1,t.length-2)):sD(t):t}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof li==1?sD(f.substr(1,f.length-1)):f},set:function(t){t=t.toString(),f=this instanceof li==1?"/"+t:t}});var d=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(d)return d},set:function(t){this.V=t}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(d)return this instanceof li==0?s4(d,this.objId,this.scope):d},set:function(t){t=t.toString(),d=this instanceof li==0?"("===t.substr(0,1)?sD(t.substr(1,t.length-2)):sD(t):t}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof li==1?sD(d.substr(1,d.length-1)):d},set:function(t){t=t.toString(),d=this instanceof li==1?"/"+t:t}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var p,g=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return g},set:function(t){g=!!t}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(p)return p},set:function(t){p=t}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,1)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,1):this.Ff=sJ(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,2)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,2):this.Ff=sJ(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,3)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,3):this.Ff=sJ(this.Ff,3)}});var m=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(null!==m)return m},set:function(t){if(-1===[0,1,2].indexOf(t))throw Error('Invalid value "'+t+'" for attribute Q supplied.');m=t}}),Object.defineProperty(this,"textAlign",{get:function(){var t;switch(m){case 0:default:t="left";break;case 1:t="center";break;case 2:t="right"}return t},configurable:!0,enumerable:!0,set:function(t){switch(t){case"right":case 2:m=2;break;case"center":case 1:m=1;break;default:m=0}}})};sU(s9,s6);var lt=function(){s9.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var t=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return t},set:function(e){t=e}});var e=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return s3(e,this.objId,this.scope)},set:function(t){var n;n=[],"string"==typeof t&&(n=function(t,e,n){n||(n=1);for(var r,i=[];r=e.exec(t);)i.push(r[n]);return i}(t,/\((.*?)\)/g)),e=n}}),this.getOptions=function(){return e},this.setOptions=function(t){e=t,this.sort&&e.sort()},this.addOption=function(t){t=(t=t||"").toString(),e.push(t),this.sort&&e.sort()},this.removeOption=function(t,n){for(n=n||!1,t=(t=t||"").toString();-1!==e.indexOf(t)&&(e.splice(e.indexOf(t),1),!1!==n););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,18)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,18):this.Ff=sJ(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,19)},set:function(t){!0===this.combo&&(!0==!!t?this.Ff=sG(this.Ff,19):this.Ff=sJ(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,20)},set:function(t){!0==!!t?(this.Ff=sG(this.Ff,20),e.sort()):this.Ff=sJ(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,22)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,22):this.Ff=sJ(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,23)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,23):this.Ff=sJ(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,27)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,27):this.Ff=sJ(this.Ff,27)}}),this.hasAppearanceStream=!1};sU(lt,s9);var le=function(){lt.call(this),this.fontName="helvetica",this.combo=!1};sU(le,lt);var ln=function(){le.call(this),this.combo=!0};sU(ln,le);var lr=function(){ln.call(this),this.edit=!0};sU(lr,ln);var li=function(){s9.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,15)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,15):this.Ff=sJ(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,16)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,16):this.Ff=sJ(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,17)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,17):this.Ff=sJ(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,26)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,26):this.Ff=sJ(this.Ff,26)}});var t,e={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var t=function(t){return t};if(this.scope&&(t=this.scope.internal.getEncryptor(this.objId)),0!==Object.keys(e).length){var n,r=[];for(n in r.push("<<"),e)r.push("/"+n+" ("+sR(t(e[n]))+")");return r.push(">>"),r.join("\n")}},set:function(t){"object"===(0,nH.default)(t)&&(e=t)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return e.CA||""},set:function(t){"string"==typeof t&&(e.CA=t)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return t.substr(1,t.length-1)},set:function(e){t="/"+e}})};sU(li,s9);var la=function(){li.call(this),this.pushButton=!0};sU(la,li);var lo=function(){li.call(this),this.radio=!0,this.pushButton=!1;var t=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=void 0!==e?e:[]}})};sU(lo,li);var ls=function(){s9.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return e},set:function(t){e=t}});var t,e,n,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var t=function(t){return t};this.scope&&(t=this.scope.internal.getEncryptor(this.objId));var e,n=[];for(e in n.push("<<"),r)n.push("/"+e+" ("+sR(t(r[e]))+")");return n.push(">>"),n.join("\n")},set:function(t){"object"===(0,nH.default)(t)&&(r=t)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||""},set:function(t){"string"==typeof t&&(r.CA=t)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(t){n=t}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(t){n="/"+t}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=lc.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};sU(ls,s9),lo.prototype.setAppearance=function(t){if(!("createAppearanceStream"in t)||!("getCA"in t))throw Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var e in this.Kids)if(this.Kids.hasOwnProperty(e)){var n=this.Kids[e];n.appearanceStreamContent=t.createAppearanceStream(n.optionName),n.caption=t.getCA()}},lo.prototype.createOption=function(t){var e=new ls;return e.Parent=this,e.optionName=t,this.Kids.push(e),lf.call(this.scope,e),e};var ll=function(){li.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=lc.CheckBox.createAppearanceStream()};sU(ll,li);var lh=function(){s9.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,13)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,13):this.Ff=sJ(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,21)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,21):this.Ff=sJ(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,23)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,23):this.Ff=sJ(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,24)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,24):this.Ff=sJ(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,25)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,25):this.Ff=sJ(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,26)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,26):this.Ff=sJ(this.Ff,26)}});var t=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return t},set:function(e){Number.isInteger(e)&&(t=e)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};sU(lh,s9);var lu=function(){lh.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!sV(this.Ff,14)},set:function(t){!0==!!t?this.Ff=sG(this.Ff,14):this.Ff=sJ(this.Ff,14)}}),this.password=!0};sU(lu,lh);var lc={CheckBox:{createAppearanceStream:function(){return{N:{On:lc.CheckBox.YesNormal},D:{On:lc.CheckBox.YesPushDown,Off:lc.CheckBox.OffPushDown}}},YesPushDown:function(t){var e=sH(t);e.scope=t.scope;var n=[],r=t.scope.internal.getFont(t.fontName,t.fontStyle).id,i=t.scope.__private__.encodeColorString(t.color),a=sQ(t,t.caption);return n.push("0.749023 g"),n.push("0 0 "+sz(lc.internal.getWidth(t))+" "+sz(lc.internal.getHeight(t))+" re"),n.push("f"),n.push("BMC"),n.push("q"),n.push("0 0 1 rg"),n.push("/"+r+" "+sz(a.fontSize)+" Tf "+i),n.push("BT"),n.push(a.text),n.push("ET"),n.push("Q"),n.push("EMC"),e.stream=n.join("\n"),e},YesNormal:function(t){var e=sH(t);e.scope=t.scope;var n=t.scope.internal.getFont(t.fontName,t.fontStyle).id,r=t.scope.__private__.encodeColorString(t.color),i=[],a=lc.internal.getHeight(t),o=lc.internal.getWidth(t),s=sQ(t,t.caption);return i.push("1 g"),i.push("0 0 "+sz(o)+" "+sz(a)+" re"),i.push("f"),i.push("q"),i.push("0 0 1 rg"),i.push("0 0 "+sz(o-1)+" "+sz(a-1)+" re"),i.push("W"),i.push("n"),i.push("0 g"),i.push("BT"),i.push("/"+n+" "+sz(s.fontSize)+" Tf "+r),i.push(s.text),i.push("ET"),i.push("Q"),e.stream=i.join("\n"),e},OffPushDown:function(t){var e=sH(t);e.scope=t.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+sz(lc.internal.getWidth(t))+" "+sz(lc.internal.getHeight(t))+" re"),n.push("f"),e.stream=n.join("\n"),e}},RadioButton:{Circle:{createAppearanceStream:function(t){var e={D:{Off:lc.RadioButton.Circle.OffPushDown},N:{}};return e.N[t]=lc.RadioButton.Circle.YesNormal,e.D[t]=lc.RadioButton.Circle.YesPushDown,e},getCA:function(){return"l"},YesNormal:function(t){var e=sH(t);e.scope=t.scope;var n=[],r=lc.internal.getWidth(t)<=lc.internal.getHeight(t)?lc.internal.getWidth(t)/4:lc.internal.getHeight(t)/4,i=Number(((r=Number((.9*r).toFixed(5)))*lc.internal.Bezier_C).toFixed(5));return n.push("q"),n.push("1 0 0 1 "+sq(lc.internal.getWidth(t)/2)+" "+sq(lc.internal.getHeight(t)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+i+" "+i+" "+r+" 0 "+r+" c"),n.push("-"+i+" "+r+" -"+r+" "+i+" -"+r+" 0 c"),n.push("-"+r+" -"+i+" -"+i+" -"+r+" 0 -"+r+" c"),n.push(i+" -"+r+" "+r+" -"+i+" "+r+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join("\n"),e},YesPushDown:function(t){var e=sH(t);e.scope=t.scope;var n=[],r=lc.internal.getWidth(t)<=lc.internal.getHeight(t)?lc.internal.getWidth(t)/4:lc.internal.getHeight(t)/4,i=Number((2*(r=Number((.9*r).toFixed(5)))).toFixed(5)),a=Number((i*lc.internal.Bezier_C).toFixed(5)),o=Number((r*lc.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+sq(lc.internal.getWidth(t)/2)+" "+sq(lc.internal.getHeight(t)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+a+" "+a+" "+i+" 0 "+i+" c"),n.push("-"+a+" "+i+" -"+i+" "+a+" -"+i+" 0 c"),n.push("-"+i+" -"+a+" -"+a+" -"+i+" 0 -"+i+" c"),n.push(a+" -"+i+" "+i+" -"+a+" "+i+" 0 c"),n.push("f"),n.push("Q"),n.push("0 g"),n.push("q"),n.push("1 0 0 1 "+sq(lc.internal.getWidth(t)/2)+" "+sq(lc.internal.getHeight(t)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+o+" "+o+" "+r+" 0 "+r+" c"),n.push("-"+o+" "+r+" -"+r+" "+o+" -"+r+" 0 c"),n.push("-"+r+" -"+o+" -"+o+" -"+r+" 0 -"+r+" c"),n.push(o+" -"+r+" "+r+" -"+o+" "+r+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join("\n"),e},OffPushDown:function(t){var e=sH(t);e.scope=t.scope;var n=[],r=lc.internal.getWidth(t)<=lc.internal.getHeight(t)?lc.internal.getWidth(t)/4:lc.internal.getHeight(t)/4,i=Number((2*(r=Number((.9*r).toFixed(5)))).toFixed(5)),a=Number((i*lc.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+sq(lc.internal.getWidth(t)/2)+" "+sq(lc.internal.getHeight(t)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+a+" "+a+" "+i+" 0 "+i+" c"),n.push("-"+a+" "+i+" -"+i+" "+a+" -"+i+" 0 c"),n.push("-"+i+" -"+a+" -"+a+" -"+i+" 0 -"+i+" c"),n.push(a+" -"+i+" "+i+" -"+a+" "+i+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join("\n"),e}},Cross:{createAppearanceStream:function(t){var e={D:{Off:lc.RadioButton.Cross.OffPushDown},N:{}};return e.N[t]=lc.RadioButton.Cross.YesNormal,e.D[t]=lc.RadioButton.Cross.YesPushDown,e},getCA:function(){return"8"},YesNormal:function(t){var e=sH(t);e.scope=t.scope;var n=[],r=lc.internal.calculateCross(t);return n.push("q"),n.push("1 1 "+sz(lc.internal.getWidth(t)-2)+" "+sz(lc.internal.getHeight(t)-2)+" re"),n.push("W"),n.push("n"),n.push(sz(r.x1.x)+" "+sz(r.x1.y)+" m"),n.push(sz(r.x2.x)+" "+sz(r.x2.y)+" l"),n.push(sz(r.x4.x)+" "+sz(r.x4.y)+" m"),n.push(sz(r.x3.x)+" "+sz(r.x3.y)+" l"),n.push("s"),n.push("Q"),e.stream=n.join("\n"),e},YesPushDown:function(t){var e=sH(t);e.scope=t.scope;var n=lc.internal.calculateCross(t),r=[];return r.push("0.749023 g"),r.push("0 0 "+sz(lc.internal.getWidth(t))+" "+sz(lc.internal.getHeight(t))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+sz(lc.internal.getWidth(t)-2)+" "+sz(lc.internal.getHeight(t)-2)+" re"),r.push("W"),r.push("n"),r.push(sz(n.x1.x)+" "+sz(n.x1.y)+" m"),r.push(sz(n.x2.x)+" "+sz(n.x2.y)+" l"),r.push(sz(n.x4.x)+" "+sz(n.x4.y)+" m"),r.push(sz(n.x3.x)+" "+sz(n.x3.y)+" l"),r.push("s"),r.push("Q"),e.stream=r.join("\n"),e},OffPushDown:function(t){var e=sH(t);e.scope=t.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+sz(lc.internal.getWidth(t))+" "+sz(lc.internal.getHeight(t))+" re"),n.push("f"),e.stream=n.join("\n"),e}}},createDefaultAppearanceStream:function(t){var e=t.scope.internal.getFont(t.fontName,t.fontStyle).id,n=t.scope.__private__.encodeColorString(t.color);return"/"+e+" "+t.fontSize+" Tf "+n}};lc.internal={Bezier_C:.551915024494,calculateCross:function(t){var e=lc.internal.getWidth(t),n=lc.internal.getHeight(t),r=Math.min(e,n);return{x1:{x:(e-r)/2,y:(n-r)/2+r},x2:{x:(e-r)/2+r,y:(n-r)/2},x3:{x:(e-r)/2,y:(n-r)/2},x4:{x:(e-r)/2+r,y:(n-r)/2+r}}}},lc.internal.getWidth=function(t){var e=0;return"object"===(0,nH.default)(t)&&(e=s$(t.Rect[2])),e},lc.internal.getHeight=function(t){var e=0;return"object"===(0,nH.default)(t)&&(e=s$(t.Rect[3])),e};var lf=sO.addField=function(t){if(s5(this,t),!(t instanceof s9))throw Error("Invalid argument passed to jsPDF.addField.");return t.scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),t.page=t.scope.internal.getCurrentPageInfo().pageNumber,this};function ld(t){return t.reduce(function(t,e,n){return t[e]=n,t},{})}sO.AcroFormChoiceField=lt,sO.AcroFormListBox=le,sO.AcroFormComboBox=ln,sO.AcroFormEditBox=lr,sO.AcroFormButton=li,sO.AcroFormPushButton=la,sO.AcroFormRadioButton=lo,sO.AcroFormCheckBox=ll,sO.AcroFormTextField=lh,sO.AcroFormPasswordField=lu,sO.AcroFormAppearance=lc,sO.AcroForm={ChoiceField:lt,ListBox:le,ComboBox:ln,EditBox:lr,Button:li,PushButton:la,RadioButton:lo,CheckBox:ll,TextField:lh,PasswordField:lu,Appearance:lc},sB.AcroForm={ChoiceField:lt,ListBox:le,ComboBox:ln,EditBox:lr,Button:li,PushButton:la,RadioButton:lo,CheckBox:ll,TextField:lh,PasswordField:lu,Appearance:lc},sB.AcroForm,lk=sB.API,lS="addImage_",lk.__addimage__={},lC="UNKNOWN",lP={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},lE=lk.__addimage__.getImageFileTypeByImageData=function(t,e){var n,r,i,a,o,s=lC;if("RGBA"===(e=e||lC)||void 0!==t.data&&t.data instanceof Uint8ClampedArray&&"height"in t&&"width"in t)return"RGBA";if(lV(t))for(o in lP)for(i=lP[o],n=0;n>"}),"transparency"in e&&Array.isArray(e.transparency)&&e.transparency.length>0){for(var o="",s=0,l=e.transparency.length;s>";var v=d.objId+" 0 R";r="<>",this.internal.write(d.objId,"0 R",p.objId,"0 R");break;case"freetext":n="/Rect ["+i(e.bounds.x)+" "+a(e.bounds.y)+" "+i(e.bounds.x+e.bounds.w)+" "+a(e.bounds.y+e.bounds.h)+"] ";var b=e.color||"#000000";r="<>",this.internal.write(r);break;case"link":if(e.options.name){var y=this.annotations._nameMap[e.options.name];e.options.pageNumber=y.page,e.options.top=y.y}else e.options.top||(e.options.top=0);if(n="/Rect ["+e.finalBounds.x+" "+e.finalBounds.y+" "+e.finalBounds.w+" "+e.finalBounds.h+"] ",r="",e.options.url)r="<>";else if(e.options.pageNumber)switch(r="<>",this.internal.write(r))}}this.internal.write("]")}}]),lQ.createAnnotation=function(t){var e=this.internal.getCurrentPageInfo();switch(t.type){case"link":this.link(t.bounds.x,t.bounds.y,t.bounds.w,t.bounds.h,t);break;case"text":case"freetext":e.pageContext.annotations.push(t)}},lQ.link=function(t,e,n,r,i){var a=this.internal.getCurrentPageInfo(),o=this.internal.getCoordinateString,s=this.internal.getVerticalCoordinateString;a.pageContext.annotations.push({finalBounds:{x:o(t),y:s(e),w:o(t+n),h:s(e+r)},options:i,type:"link"})},lQ.textWithLink=function(t,e,n,r){var i,a,o=this.getTextWidth(t),s=this.internal.getLineHeight()/this.internal.scaleFactor;return void 0!==r.maxWidth?(a=r.maxWidth,i=Math.ceil(s*this.splitTextToSize(t,a).length)):(a=o,i=s),this.text(t,e,n,r),n+=.2*s,"center"===r.align&&(e-=o/2),"right"===r.align&&(e-=o),this.link(e,n-s,a,i,r),o},lQ.getTextWidth=function(t){var e=this.internal.getFontSize();return this.getStringUnitWidth(t)*e/this.internal.scaleFactor},l0=sB.API,l2={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},l5={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},l3={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},l4=[1570,1571,1573,1575],l0.__arabicParser__={},l6=l0.__arabicParser__.isInArabicSubstitutionA=function(t){return void 0!==l2[t.charCodeAt(0)]},l8=l0.__arabicParser__.isArabicLetter=function(t){return"string"==typeof t&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(t)},l7=l0.__arabicParser__.isArabicEndLetter=function(t){return l8(t)&&l6(t)&&l2[t.charCodeAt(0)].length<=2},l9=l0.__arabicParser__.isArabicAlfLetter=function(t){return l8(t)&&l4.indexOf(t.charCodeAt(0))>=0},l0.__arabicParser__.arabicLetterHasIsolatedForm=function(t){return l8(t)&&l6(t)&&l2[t.charCodeAt(0)].length>=1},ht=l0.__arabicParser__.arabicLetterHasFinalForm=function(t){return l8(t)&&l6(t)&&l2[t.charCodeAt(0)].length>=2},l0.__arabicParser__.arabicLetterHasInitialForm=function(t){return l8(t)&&l6(t)&&l2[t.charCodeAt(0)].length>=3},he=l0.__arabicParser__.arabicLetterHasMedialForm=function(t){return l8(t)&&l6(t)&&4==l2[t.charCodeAt(0)].length},hn=l0.__arabicParser__.resolveLigatures=function(t){var e=0,n=l5,r="",i=0;for(e=0;e>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+e+" 0 R")})),this},ho=sB.API,(hs=function(){var t=void 0;Object.defineProperty(this,"pdf",{get:function(){return t},set:function(e){t=e}});var e=150;Object.defineProperty(this,"width",{get:function(){return e},set:function(t){e=isNaN(t)||!1===Number.isInteger(t)||t<0?150:t,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=e+1)}});var n=300;Object.defineProperty(this,"height",{get:function(){return n},set:function(t){n=isNaN(t)||!1===Number.isInteger(t)||t<0?300:t,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=n+1)}});var r=[];Object.defineProperty(this,"childNodes",{get:function(){return r},set:function(t){r=t}});var i={};Object.defineProperty(this,"style",{get:function(){return i},set:function(t){i=t}}),Object.defineProperty(this,"parentNode",{})}).prototype.getContext=function(t,e){var n;if("2d"!==(t=t||"2d"))return null;for(n in e)this.pdf.context2d.hasOwnProperty(n)&&(this.pdf.context2d[n]=e[n]);return this.pdf.context2d._canvas=this,this.pdf.context2d},hs.prototype.toDataURL=function(){throw Error("toDataURL is not implemented.")},ho.events.push(["initialized",function(){this.canvas=new hs,this.canvas.pdf=this}]),hl=sB.API,hh={left:0,top:0,bottom:0,right:0},hu=!1,hc=function(){void 0===this.internal.__cell__&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},hh),this.internal.__cell__.margins.width=this.getPageWidth(),hf.call(this))},hf=function(){this.internal.__cell__.lastCell=new hd,this.internal.__cell__.pages=1},(hd=function(){var t=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return t},set:function(e){t=e}});var e=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return e},set:function(t){e=t}});var n=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return n},set:function(t){n=t}});var r=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return r},set:function(t){r=t}});var i=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return i},set:function(t){i=t}});var a=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return a},set:function(t){a=t}});var o=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return o},set:function(t){o=t}}),this}).prototype.clone=function(){return new hd(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},hd.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},hl.setHeaderFunction=function(t){return hc.call(this),this.internal.__cell__.headerFunction="function"==typeof t?t:void 0,this},hl.getTextDimensions=function(t,e){hc.call(this);var n=(e=e||{}).fontSize||this.getFontSize(),r=e.font||this.getFont(),i=e.scaleFactor||this.internal.scaleFactor,a=0,o=0,s=0,l=this;if(!Array.isArray(t)&&"string"!=typeof t){if("number"!=typeof t)throw Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");t=String(t)}var h=e.maxWidth;h>0?"string"==typeof t?t=this.splitTextToSize(t,h):"[object Array]"===Object.prototype.toString.call(t)&&(t=t.reduce(function(t,e){return t.concat(l.splitTextToSize(e,h))},[])):t=Array.isArray(t)?t:[t];for(var u=0;uthis.getPageHeight()?(this.cellAddPage(),t.y=r.top,a&&i&&(this.printHeaderRow(t.lineNumber,!0),t.y+=i[0].height)):t.y=e.y+e.height||t.y),void 0!==t.text[0]&&(this.rect(t.x,t.y,t.width,t.height,!0===hu?"FD":void 0),"right"===t.align?this.text(t.text,t.x+t.width-n,t.y+n,{align:"right",baseline:"top"}):"center"===t.align?this.text(t.text,t.x+t.width/2,t.y+n,{align:"center",baseline:"top",maxWidth:t.width-n-n}):this.text(t.text,t.x+n,t.y+n,{align:"left",baseline:"top",maxWidth:t.width-n-n})),this.internal.__cell__.lastCell=t,this},hl.table=function(t,e,n,r,i){if(hc.call(this),!n)throw Error("No data for PDF table.");var a,o,s,l,h=[],u=[],c=[],f={},d={},p=[],g=[],m=(i=i||{}).autoSize||!1,v=!1!==i.printHeaders,b=i.css&&void 0!==i.css["font-size"]?16*i.css["font-size"]:i.fontSize||12,y=i.margins||Object.assign({width:this.getPageWidth()},hh),w="number"==typeof i.padding?i.padding:3,_=i.headerBackgroundColor||"#c8c8c8",x=i.headerTextColor||"#000";if(hf.call(this),this.internal.__cell__.printHeaders=v,this.internal.__cell__.margins=y,this.internal.__cell__.table_font_size=b,this.internal.__cell__.padding=w,this.internal.__cell__.headerBackgroundColor=_,this.internal.__cell__.headerTextColor=x,this.setFontSize(b),null==r)u=h=Object.keys(n[0]),c=h.map(function(){return"left"});else if(Array.isArray(r)&&"object"===(0,nH.default)(r[0]))for(h=r.map(function(t){return t.name}),u=r.map(function(t){return t.prompt||t.name||""}),c=r.map(function(t){return t.align||"left"}),a=0;a0&&this.setTableHeaderRow(i),this.setFont(void 0,"normal"),hu=!1};var lp={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},lg=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],lm=ld(lg),lv=[100,200,300,400,500,600,700,800,900],lb=ld(lv);function ly(t){var e,n,r,i=t.family.replace(/"|'/g,"").toLowerCase(),a=lp[e=(e=t.style)||"normal"]?e:"normal",o=(n=t.weight)?"number"==typeof n?n>=100&&n<=900&&n%100==0?n:400:/^\d00$/.test(n)?parseInt(n):"bold"===n?700:400:400,s="number"==typeof lm[r=(r=t.stretch)||"normal"]?r:"normal";return{family:i,style:a,weight:o,stretch:s,src:t.src||[],ref:t.ref||{name:i,style:[s,a,o].join(" ")}}}function lw(t,e,n,r){var i;for(i=n;i>=0&&i=0&&i>>1)&255}return i}function hI(t,e,n){var r=t.length,i=[];i[0]=4;for(var a=0;a>a&(1<>8&255)}function hF(t,e){return e+1>7&&(o=e,s=a,e+=3*a);var l=!0,h=[],u=0,c=null,f=0,d=null;for(this.width=n,this.height=r;l&&e=0))throw Error("Invalid block size");if(0===g)break;e+=g}break;case 249:if(4!==t[e++]||0!==t[e+4])throw Error("Invalid graphics extension block.");var p=t[e++];u=t[e++]|t[e++]<<8,c=t[e++],1&p||(c=null),f=p>>2&7,e++;break;case 254:for(;;){if(!((g=t[e++])>=0))throw Error("Invalid block size");if(0===g)break;e+=g}break;default:throw Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var g,m=t[e++]|t[e++]<<8,v=t[e++]|t[e++]<<8,b=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,w=t[e++],_=w>>6&1,x=1<<1+(7&w),N=o,A=s,L=!1;w>>7&&(L=!0,N=e,A=x,e+=3*x);var k=e;for(e++;;){if(!((g=t[e++])>=0))throw Error("Invalid block size");if(0===g)break;e+=g}h.push({x:m,y:v,width:b,height:y,has_local_palette:L,palette_offset:N,palette_size:A,data_offset:k,data_length:e-k,transparent_index:c,interlaced:!!_,delay:u,disposal:f});break;case 59:l=!1;break;default:throw Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return h.length},this.loopCount=function(){return d},this.frameInfo=function(t){if(t<0||t>=h.length)throw Error("Frame index out of range.");return h[t]},this.decodeAndBlitFrameBGRA=function(e,r){var i=this.frameInfo(e),a=i.width*i.height,o=new Uint8Array(a);hO(t,i.data_offset,o,a);var s=i.palette_offset,l=i.transparent_index;null===l&&(l=256);var h=i.width,u=n-h,c=h,f=4*(i.y*n+i.x),d=4*((i.y+i.height)*n+i.x),p=f,g=4*u;!0===i.interlaced&&(g+=4*n*7);for(var m=8,v=0,b=o.length;v=d&&(g=4*u+4*n*(m-1),p=f+(h+u)*(m<<1),m>>=1)),y===l)p+=4;else{var w=t[s+3*y],_=t[s+3*y+1],x=t[s+3*y+2];r[p++]=x,r[p++]=_,r[p++]=w,r[p++]=255}--c}},this.decodeAndBlitFrameRGBA=function(e,r){var i=this.frameInfo(e),a=i.width*i.height,o=new Uint8Array(a);hO(t,i.data_offset,o,a);var s=i.palette_offset,l=i.transparent_index;null===l&&(l=256);var h=i.width,u=n-h,c=h,f=4*(i.y*n+i.x),d=4*((i.y+i.height)*n+i.x),p=f,g=4*u;!0===i.interlaced&&(g+=4*n*7);for(var m=8,v=0,b=o.length;v=d&&(g=4*u+4*n*(m-1),p=f+(h+u)*(m<<1),m>>=1)),y===l)p+=4;else{var w=t[s+3*y],_=t[s+3*y+1],x=t[s+3*y+2];r[p++]=w,r[p++]=_,r[p++]=x,r[p++]=255}--c}}}function hO(t,e,n,r){for(var i=t[e++],a=1<>=l,u-=l,m!==a){if(m===o)break;for(var v=ma;)y=p[y]>>8,++b;var w=y;if(f+b+ +(v!==m)>r)return void si("Warning, gif stream longer than expected.");n[f++]=w;var _=f+=b;for(v!==m&&(n[f++]=w),y=v;b--;)y=p[y],n[--_]=255&y,y>>=8;null!==g&&s<4096&&(p[s++]=g<<8|w,s>=h+1&&l<12&&(++l,h=h<<1|1)),g=m}else s=o+1,h=(1<<(l=i+1))-1,g=null}return f!==r&&si("Warning, gif stream shorter than expected."),n}function hT(t){var e,n,r,i,a,o=Math.floor,s=Array(64),l=Array(64),h=Array(64),u=Array(64),c=Array(65535),f=Array(65535),d=Array(64),p=Array(64),g=[],m=0,v=7,b=Array(64),y=Array(64),w=Array(64),_=Array(256),x=Array(2048),N=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],A=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],L=[0,1,2,3,4,5,6,7,8,9,10,11],k=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],S=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],C=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],P=[0,1,2,3,4,5,6,7,8,9,10,11],E=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],I=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function j(t,e){for(var n=0,r=0,i=[],a=1;a<=16;a++){for(var o=1;o<=t[a];o++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=a,r++,n++;n*=2}return i}function M(t){for(var e=t[0],n=t[1]-1;n>=0;)e&1<>8&255),F(255&t)}function O(t,e,n,r,i){for(var a,o=i[0],s=i[240],l=function(t,e){var n,r,i,a,o,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],a=t[f+3],o=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),g=n-h,m=r+l,v=r-l,b=i+s,y=i-s,w=a+o,_=a-o,x=p+w,N=p-w,A=m+b,L=m-b;t[f]=x+A,t[f+4]=x-A;var k=.707106781*(L+N);t[f+2]=N+k,t[f+6]=N-k;var S=.382683433*((x=_+y)-(L=v+g)),C=.5411961*x+S,P=1.306562965*L+S,E=.707106781*(A=y+v),I=g+E,j=g-E;t[f+5]=j+C,t[f+3]=j-C,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(f=0,u=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],a=t[f+24],o=t[f+32],s=t[f+40],l=t[f+48];var M=n+(h=t[f+56]),F=n-h,B=r+l,O=r-l,T=i+s,R=i-s,D=a+o,z=a-o,q=M+D,U=M-D,$=B+T,H=B-T;t[f]=q+$,t[f+32]=q-$;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var X=.382683433*((q=z+R)-(H=O+F)),Y=.5411961*q+X,V=1.306562965*H+X,G=.707106781*($=R+O),J=F+G,Z=F-G;t[f+40]=Z+Y,t[f+24]=Z-Y,t[f+8]=J+V,t[f+56]=J-V,f++}for(u=0;u<64;++u)c=t[u]*e[u],d[u]=c>0?c+.5|0:c-.5|0;return d}(t,e),h=0;h<64;++h)p[N[h]]=l[h];var u=p[0]-n;n=p[0],0==u?M(r[0]):(M(r[f[a=32767+u]]),M(c[a]));for(var g=63;g>0&&0==p[g];)g--;if(0==g)return M(o),n;for(var m,v=1;v<=g;){for(var b=v;0==p[v]&&v<=g;)++v;var y=v-b;if(y>=16){m=y>>4;for(var w=1;w<=m;++w)M(s);y&=15}M(i[(y<<4)+f[a=32767+p[v]]]),M(c[a]),v++}return 63!=g&&M(o),n}function T(t){a!=(t=Math.min(Math.max(t,1),100))&&(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=o((e[n]*t+50)/100);r=Math.min(Math.max(r,1),255),s[N[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var c=o((i[a]*t+50)/100);c=Math.min(Math.max(c,1),255),l[N[a]]=c}for(var f=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],d=0,p=0;p<8;p++)for(var g=0;g<8;g++)h[d]=1/(s[N[d]]*f[p]*f[g]*8),u[d]=1/(l[N[d]]*f[p]*f[g]*8),d++}(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),a=t)}this.encode=function(t,a){a&&T(a),g=[],m=0,v=7,B(65496),B(65504),B(16),F(74),F(70),F(73),F(70),F(0),F(1),F(1),F(0),B(1),B(1),F(0),F(0),function(){B(65499),B(132),F(0);for(var t=0;t<64;t++)F(s[t]);F(1);for(var e=0;e<64;e++)F(l[e])}(),d=t.width,p=t.height,B(65472),B(17),F(8),B(p),B(d),F(3),F(1),F(17),F(0),F(2),F(17),F(1),F(3),F(17),F(1),function(){B(65476),B(418),F(0);for(var t=0;t<16;t++)F(A[t+1]);for(var e=0;e<=11;e++)F(L[e]);F(16);for(var n=0;n<16;n++)F(k[n+1]);for(var r=0;r<=161;r++)F(S[r]);F(1);for(var i=0;i<16;i++)F(C[i+1]);for(var a=0;a<=11;a++)F(P[a]);F(17);for(var o=0;o<16;o++)F(E[o+1]);for(var s=0;s<=161;s++)F(I[s])}(),B(65498),B(12),F(3),F(1),F(0),F(2),F(17),F(3),F(17),F(0),F(63),F(0);var o=0,c=0,f=0;m=0,v=7,this.encode.displayName="_encode_";for(var d,p,_,N,j,R,D,z,q,U,$,H=t.data,W=t.width,X=t.height,Y=4*W,V=0;V>3)*Y+(q=4*(7&$)),V+U>=X&&(z-=Y*(V+1+U-X)),_+q>=Y&&(z-=_+q-Y+4),N=H[z++],j=H[z++],R=H[z++],b[$]=(x[N]+x[j+256|0]+x[R+512|0]>>16)-128,y[$]=(x[N+768|0]+x[j+1024|0]+x[R+1280|0]>>16)-128,w[$]=(x[N+1280|0]+x[j+1536|0]+x[R+1792|0]>>16)-128;o=O(b,h,o,e,r),c=O(y,u,c,n,i),f=O(w,u,f,n,i),_+=32}V+=8}if(v>=0){var G=[];G[1]=v+1,G[0]=(1<r;r++)if(t[e+r]!=n.charCodeAt(r))return!0;return!1}function r(t,e,n,r,i){for(var a=0;ar+1?[]:new e),!(i.length>>0;t&n;)n>>>=1;return n?(t&n-1)+n:t}function h(t,n,r,i,a){e(!(i%r));do t[n+(i-=r)]=a;while(0=o),512>=o)var s=a(512);else if(null==(s=a(o)))return 0;return function(t,n,r,i,o,s){var u,f,d=n,p=1<u;++u){if(g[u]>1<(x-=g[u]))return 0;for(;0=u;++u,o<<=1){if(_+=x<<=1,0>(x-=g[u]))return 0;for(;0b&&!(0>=(v-=g[b]));)++b,v<<=1;p+=N=1<<(v=b-r),t[n+(b=w&y)].g=v+r,t[n+b].value=d-n-b}i.g=u-r,i.value=s[f++],h(t,d+(w>>r),o,N,i),w=l(w,u)}}return _!=2*m[15]-1?0:p}(t,n,r,i,o,s)}function c(){this.value=this.g=0}function f(){this.value=this.g=0}function d(){this.G=o(5,c),this.H=a(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(nm,f)}function p(t,n,r,i){e(null!=t),e(null!=n),e(0x80000000>i),t.Ca=254,t.I=0,t.b=-8,t.Ka=0,t.oa=n,t.pa=r,t.Jd=n,t.Yc=r+i,t.Zc=4<=i?r+i-4+1:r,k(t)}function g(t,e){for(var n=0;0i),t.Sb=i,t.Ra=0,t.u=0,t.h=0,4>>=8,t.Ra+=t.oa[t.pa+t.bb]<>>0,++t.bb,t.u-=8;N(t)&&(t.h=1,t.u=0)}function y(t,n){if(e(0<=n),!t.h&&n<=nb){var r=x(t)&nv[n];return t.u+=n,b(t),r}return t.h=1,t.u=0}function w(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function _(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function x(t){return t.Ra>>>(t.u&ny-1)>>>0}function N(t){return e(t.bb<=t.Sb),t.h||t.bb==t.Sb&&t.u>ny}function A(t,e){t.u=e,t.h=N(t)}function L(t){t.u>=nw&&(e(t.u>=nw),b(t))}function k(t){e(null!=t&&null!=t.oa),t.pa>>0,t.b+=8):(e(null!=t&&null!=t.oa),t.pat.b&&k(t);var r=t.b,i=n*e>>>8,a=(t.I>>>r>i)+0;for(a?(n-=i,t.I-=i+1<>>0):n=i+1,r=n,i=0;256<=r;)i+=8,r>>=8;return r=7^i+n_[r],t.b-=r,t.Ca=(n<>24&255,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=255&n}function E(t,e){return t[e+0]|t[e+1]<<8}function I(t,e){return E(t,e)|t[e+2]<<16}function j(t,e){return E(t,e)|E(t,e+2)<<16}function M(t,n){return e(null!=t),e(0=a||0>=o?0:(r[0]=a,i[0]=o,1)}function T(t,e){return t+(1<>>e}function R(t,e){return((0xff00ff00&t)+(0xff00ff00&e)>>>0&0xff00ff00)+((0xff00ff&t)+(0xff00ff&e)>>>0&0xff00ff)>>>0}function D(e,n){t[n]=function(n,r,i,a,o,s,l){var h;for(h=0;h>>1)+(t&e)>>>0}function U(t){return 0<=t&&256>t?t:0>t?0:255>1))}function H(t,e,n){return Math.abs(e-n)-Math.abs(t-n)}function W(t,e,n,r,i,a,o){for(r=a[o-1],n=0;n>8&255,l=0xff00ff&(l=(l=0xff00ff&o)+((s<<16)+s));r[i+a]=(0xff00ff00&o)+l>>>0}}function Y(t,e){e.jd=255&t,e.hd=t>>8&255,e.ud=t>>16&255}function V(t,e,n,r,i,a){var o;for(o=0;o>>8,h=s,u=255&(u=(u=s>>>16)+((t.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h+=(t.hd<<24>>24)*(l<<24>>24)>>>5)+((t.ud<<24>>24)*(u<<24>>24)>>>5)),i[a+o]=(0xff00ff00&s)+(u<<16)+h}}function G(e,n,r,i,a){t[n]=function(t,e,n,r,o,s,l,h,u){for(r=l;r>e.b,f=e.Ea,d=e.K[0],p=e.w;if(8>c)for(e=(1<>=c}else t["VP8LMapColor"+r](s,l,d,p,h,u,n,o,f)}}function J(t,e,n,r,i){for(n=e+n;e>16&255,r[i++]=a>>8&255,r[i++]=255&a}}function Z(t,e,n,r,i){for(n=e+n;e>16&255,r[i++]=a>>8&255,r[i++]=255&a,r[i++]=a>>24&255}}function K(t,e,n,r,i){for(n=e+n;e>16&240|o>>12&15,o=240&o|o>>28&15;r[i++]=a,r[i++]=o}}function Q(t,e,n,r,i){for(n=e+n;e>16&248|o>>13&7,o=o>>5&224|o>>3&31;r[i++]=a,r[i++]=o}}function tt(t,e,n,r,i){for(n=e+n;e>8&255,r[i++]=a>>16&255}}function te(t,e,n,i,a,o){if(0==o)for(n=e+n;e>24|o[1]>>8&65280|o[2]<<8&0xff0000|o[3]<<24)>>>0),a+=32;else r(i,a,t,e,n)}function tn(e,n){t[n][0]=t[e+"0"],t[n][1]=t[e+"1"],t[n][2]=t[e+"2"],t[n][3]=t[e+"3"],t[n][4]=t[e+"4"],t[n][5]=t[e+"5"],t[n][6]=t[e+"6"],t[n][7]=t[e+"7"],t[n][8]=t[e+"8"],t[n][9]=t[e+"9"],t[n][10]=t[e+"10"],t[n][11]=t[e+"11"],t[n][12]=t[e+"12"],t[n][13]=t[e+"13"],t[n][14]=t[e+"0"],t[n][15]=t[e+"0"]}function tr(t){return t==ru||t==rc||t==rf||t==rd}function ti(){this.eb=[],this.size=this.A=this.fb=0}function ta(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function to(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new ti,this.f.kb=new ta,this.sd=null}function ts(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function tl(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function th(t){return alert("todo:WebPSamplerProcessPlane"),t.T}function tu(t,e){var n=t.T,i=e.ba.f.RGBA,a=i.eb,o=i.fb+t.ka*i.A,s=rR[e.ba.S],l=t.y,h=t.O,u=t.f,c=t.N,f=t.ea,d=t.W,p=e.cc,g=e.dc,m=e.Mc,v=e.Nc,b=t.ka,y=t.ka+t.T,w=t.U,_=w+1>>1;for(0==b?s(l,h,null,null,u,c,f,d,u,c,f,d,a,o,null,null,w):(s(e.ec,e.fc,l,h,p,g,m,v,u,c,f,d,a,o-i.A,a,o,w),++n);b+2n,i=n==ri||n==ro||n==rs||n==rl||12==n||tr(n);if(e.memory=null,e.Ib=null,e.Jb=null,e.Nd=null,!nd(e.Oa,t,i?11:12))return 0;if(i&&tr(n)&&e6(),t.da)alert("todo:use_scaling");else{if(r){if(e.Ib=th,t.Kb){if(n=t.U+1>>1,e.memory=a(t.U+2*n),null==e.memory)return 0;e.ec=e.memory,e.fc=0,e.cc=e.ec,e.dc=e.fc+t.U,e.Mc=e.cc,e.Nc=e.dc+n,e.Ib=tu,e6()}}else alert("todo:EmitYUV");i&&(e.Jb=tc,r&&e3())}if(r&&!rK){for(t=0;256>t;++t)rQ[t]=89858*(t-128)+rY>>rX,r2[t]=-22014*(t-128)+rY,r0[t]=-45773*(t-128),r1[t]=113618*(t-128)+rY>>rX;for(t=rV;t>rX,r5[t-rV]=tW(e,255),r3[t-rV]=tW(e+8>>4,15);rK=1}return 1}function td(t){var n=t.ma,r=t.U,i=t.T;return e(!(1&t.ka)),0>=r||0>=i?0:(r=n.Ib(t,n),null!=n.Jb&&n.Jb(t,n,r),n.Dc+=r,1)}function tp(t){t.ma.memory=null}function tg(t,e,n,r){return 47!=y(t,8)?0:(e[0]=y(t,14)+1,n[0]=y(t,14)+1,r[0]=y(t,1),0!=y(t,3)?0:!t.h)}function tm(t,e){if(4>t)return t+1;var n=t-2>>1;return(2+(1&t)<>4)*t+(8-(15&n)))?n:1}function tb(t,e,n){var r=x(n),i=t[e+=255&r].g-8;return 0>>0,e(8>=r.g),t.g}function tw(t,n,r){var i=t.xc;return e((n=0==i?0:t.vc[t.md*(r>>i)+(n>>i)])>k.b)*A;v_&&(E=_),(0,nP[S[C++]>>8&15])(p,g+ +P,y,w+P-_,E-P,y,w+P),P=E}g+=_,w+=_,++v&N||(k+=A)}d!=c.nc&&r(u,h-m,u,h+(d-f-1)*m,m);break;case 1:for(m=p,b=g,_=(p=c.Ea)-(w=p&~(y=(g=1<>c.b)*v;f=a),0o.o&&(i=o.o),r=i?r=0:(a[0]+=4*o.v,o.ka=r-o.j,o.U=o.va-o.v,o.T=i-r,r=1),r){if(l=l[0],11>(r=t.ca).S){var c=r.f.RGBA,f=(i=r.S,a=o.U,o=o.T,u=c.eb,c.A),d=o;for(c=c.fb+t.Ma*c.A;0i){var a=t.l.width,o=r.ca,s=r.tb+a*i,l=t.V,h=t.Ba+t.c*i,u=t.gc;e(1==t.ab),e(3==u[0].hc),nS(u[0],i,n,l,h,o,s),tA(r,i,n,o,s,a)}t.C=t.Ma=n}function tk(t,n,r,i,a,o,s){var l=t.$/i,h=t.$%i,u=t.m,c=t.s,f=r+t.$,d=f;a=r+i*a;var p=r+i*o,g=280+c.ua,m=t.Pb?l:0x1000000,v=0=m){var k=f-r;e((m=t).Pb),m.wd=m.m,m.xd=k,0C.g?(A(_,_.u+C.g),k[S]=C.value,_=0):(A(_,_.u+C.g-256),e(256<=C.value),_=C.value),0==_&&(w=!0)}else _=tb(y.G[0],y.H[0],u);if(u.h)break;if(w||256>_){if(!w)if(y.nd)n[f]=(y.qb|_<<8)>>>0;else{if(L(u),w=tb(y.G[1],y.H[1],u),L(u),k=tb(y.G[2],y.H[2],u),S=tb(y.G[3],y.H[3],u),u.h)break;n[f]=(S<<24|w<<16|_<<8|k)>>>0}if(w=!1,++f,++h>=i&&(h=0,++l,null!=s&&l<=o&&!(l%16)&&s(t,l),null!=v))for(;d>>v.Mb]=_}else if(280>_){if(_=tm(_-256,u),k=tb(y.G[4],y.H[4],u),L(u),k=tv(i,k=tm(k,u)),u.h)break;if(f-r=i;)h-=i,++l,null!=s&&l<=o&&!(l%16)&&s(t,l);if(e(f<=a),h&b&&(y=tw(c,h,l)),null!=v)for(;d>>v.Mb]=_}else{if(!(_>>v.Mb]=_;_=f,e(!(w>>>(k=v).Xa)),n[_]=k.X[w],w=!0}w||e(u.h==N(u))}if(t.Pb&&u.h&&fo?o:l),t.a=0,t.$=f-r}return 1}return t.a=3,0}function tS(t){e(null!=t),t.vc=null,t.yc=null,t.Ya=null;var n=t.Wa;null!=n&&(n.X=null),t.vb=null,e(null!=t)}function tC(){var e=new eG;return null==e?null:(e.a=0,e.xb=rO,tn("Predictor","VP8LPredictors"),tn("Predictor","VP8LPredictors_C"),tn("PredictorAdd","VP8LPredictorsAdd"),tn("PredictorAdd","VP8LPredictorsAdd_C"),nA=X,nE=V,nI=J,nj=Z,nM=K,nF=Q,nB=tt,t.VP8LMapColor32b=nk,t.VP8LMapColor8b=nC,e)}function tP(t,n,r,s,l){for(var h=1,f=[t],p=[n],g=s.m,m=s.s,v=null,b=0;;){if(r)for(;h&&y(g,1);){var w=f,_=p,N=1,k=s.m,S=s.gc[s.ab],C=y(k,2);if(s.Oc&1<=s.ab),C){case 0:case 1:S.b=y(k,3)+2,N=tP(T(S.Ea,S.b),T(S.nc,S.b),0,s,S.K),S.K=S.K[0];break;case 3:var P,E=y(k,8)+1,I=16>S.b),B=a(F);if(null==B)P=0;else{var O=S.K[0],D=S.w;for(B[0]=S.K[0][0],j=1;j<+E;++j)B[j]=R(O[D+j],B[j-1]);for(;j<4*F;++j)B[j]=0;S.K[0]=null,S.K[0]=B,P=1}}N=P;break;case 2:break;default:e(0)}h=N}}if(f=f[0],p=p[0],h&&y(g,1)&&!(h=1<=(b=y(g,4))&&11>=b)){s.a=3;break}if(z=h)r:{var z,q,U,$,H=f,W=p,X=b,Y=s.m,V=s.s,G=[null],J=1,Z=0,K=rw[X];i:for(;;){if(r&&y(Y,1)){var Q=y(Y,3)+2,tt=T(H,Q),te=T(W,Q),tn=tt*te;if(!tP(tt,te,0,s,G))break;for(G=G[0],V.xc=Q,q=0;q>8&65535;G[q]=tr,tr>=J&&(J=tr+1)}}if(Y.h)break;for(U=0;5>U;++U){var ti=rm[U];!U&&0=to),tl=ts;var th=a(Z);if(null==tl||null==th||null==ta){s.a=1;break}for(q=$=0;qU;++U){ti=rm[U],tf[U]=ta,td[U]=$,!U&&0tb)break}else tF=tb;for(tB=0;tBtU)th[tB++]=tU,0!=tU&&(tR=tU);else{var t$=16==tU,tH=tU-16,tW=rg[tH],tX=y(tT,rp[tH])+tW;if(tB+tX>tb)break o;for(var tY=t$?tR:0;0=U){var tV,tG=th[0];for(tV=1;tVtG&&(tG=th[tV]);tm+=tG}}if(tc.nd=tg,tc.Qb=0,tg&&(tc.qb=(tf[3][td[3]+0].value<<24|tf[1][td[1]+0].value<<16|tf[2][td[2]+0].value)>>>0,0==tp&&256>tf[0][td[0]+0].value&&(tc.Qb=1,tc.qb+=tf[0][td[0]+0].value<<8)),tc.jc=!tc.Qb&&6>tm,tc.jc)for(tu=0;tu>=ty(tK,8,tZ),tJ>>=ty(tc.G[1][tc.H[1]+tJ],16,tZ),tJ>>=ty(tc.G[2][tc.H[2]+tJ],0,tZ),ty(tc.G[3][tc.H[3]+tJ],24,tZ))}}V.vc=G,V.Wb=J,V.Ya=tl,V.yc=ta,z=1;break r}z=0}if(!(h=z)){s.a=3;break}if(0n+1?[]:0),!(r.lengtht?0:t>e?e:t}function tX(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function tY(){var t=new tH;return null!=t&&(t.a=0,t.sc="OK",t.cb=0,t.Xb=0,rA||(rA=tZ)),t}function tV(t,e,n){return 0==t.a&&(t.a=e,t.sc=n,t.cb=0),0}function tG(t,e,n){return 3<=n&&157==t[e+0]&&1==t[e+1]&&42==t[e+2]}function tJ(t,n){if(null==t)return 0;if(t.a=0,t.sc="OK",null==n)return tV(t,2,"null VP8Io passed to VP8GetHeaders()");var r=n.data,a=n.w,o=n.ha;if(4>o)return tV(t,7,"Truncated header.");var s=r[a+0]|r[a+1]<<8|r[a+2]<<16,l=t.Od;if(l.Rb=!(1&s),l.td=s>>1&7,l.yd=s>>4&1,l.ub=s>>5,3o)return tV(t,7,"cannot parse picture header");if(!tG(r,a,o))return tV(t,3,"Bad code word");h.c=16383&(r[a+4]<<8|r[a+3]),h.Td=r[a+4]>>6,h.i=16383&(r[a+6]<<8|r[a+5]),h.Ud=r[a+6]>>6,a+=7,o-=7,t.za=h.c+15>>4,t.Ub=h.i+15>>4,n.width=h.c,n.height=h.i,n.Da=0,n.j=0,n.v=0,n.va=n.width,n.o=n.height,n.da=0,n.ib=n.width,n.hb=n.height,n.U=n.width,n.T=n.height,i((s=t.Pa).jb,0,255,s.jb.length),e(null!=(s=t.Qa)),s.Cb=0,s.Bb=0,s.Fb=1,i(s.Zb,0,0,s.Zb.length),i(s.Lb,0,0,s.Lb)}if(l.ub>o)return tV(t,7,"bad partition length");p(s=t.m,r,a,l.ub),a+=l.ub,o-=l.ub,l.Rb&&(h.Ld=S(s),h.Kd=S(s)),h=t.Qa;var u,c=t.Pa;if(e(null!=s),e(null!=h),h.Cb=S(s),h.Cb){if(h.Bb=S(s),S(s)){for(h.Fb=S(s),u=0;4>u;++u)h.Zb[u]=S(s)?m(s,7):0;for(u=0;4>u;++u)h.Lb[u]=S(s)?m(s,6):0}if(h.Bb)for(u=0;3>u;++u)c.jb[u]=S(s)?g(s,8):255}else h.Bb=0;if(s.Ka)return tV(t,3,"cannot parse segment header");if((h=t.ed).zd=S(s),h.Tb=g(s,6),h.wb=g(s,3),h.Pc=S(s),h.Pc&&S(s)){for(c=0;4>c;++c)S(s)&&(h.vd[c]=m(s,6));for(c=0;4>c;++c)S(s)&&(h.od[c]=m(s,6))}if(t.L=0==h.Tb?0:h.zd?1:2,s.Ka)return tV(t,3,"cannot parse filter header");var f=o;if(o=u=a,a=u+f,h=f,t.Xb=(1<h&&(d=h),p(t.Jc[+f],r,u,d),u+=d,h-=d,o+=3}p(t.Jc[+c],r,u,h),r=ud;++d){if(f.Cb){var v=f.Zb[d];f.Fb||(v+=r)}else{if(0>16,8>b.Eb[1]&&(b.Eb[1]=8),b.Qc[0]=rx[tW(v+c,117)],b.Qc[1]=rN[tW(v+u,127)],b.lc=v+u}if(!l.Rb)return tV(t,4,"Not a key frame.");for(S(s),l=t.Pa,r=0;4>r;++r){for(o=0;8>o;++o)for(a=0;3>a;++a)for(h=0;11>h;++h)c=C(s,rE[r][o][a][h])?g(s,8):rC[r][o][a][h],l.Wc[r][o].Yb[a][h]=c;for(o=0;17>o;++o)l.Xc[r][o]=l.Wc[r][rI[o]]}return t.kc=S(s),t.kc&&(t.Bd=g(s,8)),t.cb=1}function tZ(t,e,n,r,i,a,o){var s=e[i].Yb[n];for(n=0;16>i;++i){if(!C(t,s[n+0]))return i;for(;!C(t,s[n+1]);)if(s=e[++i].Yb[0],n=0,16==i)return 16;var l=e[i+1].Yb;if(C(t,s[n+2])){var h=t,u=0;if(C(h,(f=s)[(c=n)+3]))if(C(h,f[c+6])){for(s=0,c=2*(u=C(h,f[c+8]))+(f=C(h,f[c+9+u])),u=0,f=rL[c];f[s];++s)u+=u+C(h,f[s]);u+=3+(8<(h=t).b&&k(h);var c,f=h.b,d=(c=h.Ca>>1)-(h.I>>f)>>31;--h.b,h.Ca+=d,h.Ca|=1,h.I-=(c+1&d)<>3),t[e+n+32*r]=-256&i?0>i?0:255:i}function t1(t,e,n,r,i,a){tQ(t,e,0,n,r+i),tQ(t,e,1,n,r+a),tQ(t,e,2,n,r-a),tQ(t,e,3,n,r-i)}function t0(t){return(20091*t>>16)+t}function t2(t,e,n,r){var i,o=0,s=a(16);for(i=0;4>i;++i){var l=t[e+0]+t[e+8],h=t[e+0]-t[e+8],u=(35468*t[e+4]>>16)-t0(t[e+12]),c=t0(t[e+4])+(35468*t[e+12]>>16);s[o+0]=l+c,s[o+1]=h+u,s[o+2]=h-u,s[o+3]=l-c,o+=4,e++}for(i=o=0;4>i;++i)l=(t=s[o+0]+4)+s[o+8],h=t-s[o+8],u=(35468*s[o+4]>>16)-t0(s[o+12]),tQ(n,r,0,0,l+(c=t0(s[o+4])+(35468*s[o+12]>>16))),tQ(n,r,1,0,h+u),tQ(n,r,2,0,h-u),tQ(n,r,3,0,l-c),o++,r+=32}function t5(t,e,n,r){var i=t[e+0]+4,a=35468*t[e+4]>>16,o=t0(t[e+4]),s=35468*t[e+1]>>16;t1(n,r,0,i+o,t=t0(t[e+1]),s),t1(n,r,1,i+a,t,s),t1(n,r,2,i-a,t,s),t1(n,r,3,i-o,t,s)}function t3(t,e,n,r,i){t2(t,e,n,r),i&&t2(t,e+16,n,r+4)}function t4(t,e,n,r){nT(t,e+0,n,r,1),nT(t,e+32,n,r+128,1)}function t6(t,e,n,r){var i;for(t=t[e+0]+4,i=0;4>i;++i)for(e=0;4>e;++e)tQ(n,r,e,i,t)}function t8(t,e,n,r){t[e+0]&&nz(t,e+0,n,r),t[e+16]&&nz(t,e+16,n,r+4),t[e+32]&&nz(t,e+32,n,r+128),t[e+48]&&nz(t,e+48,n,r+128+4)}function t7(t,e,n,r){var i,o=a(16);for(i=0;4>i;++i){var s=t[e+0+i]+t[e+12+i],l=t[e+4+i]+t[e+8+i],h=t[e+4+i]-t[e+8+i],u=t[e+0+i]-t[e+12+i];o[0+i]=s+l,o[8+i]=s-l,o[4+i]=u+h,o[12+i]=u-h}for(i=0;4>i;++i)s=(t=o[0+4*i]+3)+o[3+4*i],l=o[1+4*i]+o[2+4*i],h=o[1+4*i]-o[2+4*i],u=t-o[3+4*i],n[r+0]=s+l>>3,n[r+16]=u+h>>3,n[r+32]=s-l>>3,n[r+48]=u-h>>3,r+=64}function t9(t,e,n){var r,i=e-32,a=255-t[i-1];for(r=0;rn;++n)r(t,e+32*n,t,e-32,16)}function ei(t,e){var n;for(n=16;0r;++r)i(e,n+32*r,t,16)}function eo(t,e){var n,r=16;for(n=0;16>n;++n)r+=t[e-1+32*n]+t[e+n-32];ea(r>>5,t,e)}function es(t,e){var n,r=8;for(n=0;16>n;++n)r+=t[e-1+32*n];ea(r>>4,t,e)}function el(t,e){var n,r=8;for(n=0;16>n;++n)r+=t[e+n-32];ea(r>>4,t,e)}function eh(t,e){ea(128,t,e)}function eu(t,e,n){return t+2*e+n+2>>2}function ec(t,e){var n,i=e-32;for(i=new Uint8Array([eu(t[i-1],t[i+0],t[i+1]),eu(t[i+0],t[i+1],t[i+2]),eu(t[i+1],t[i+2],t[i+3]),eu(t[i+2],t[i+3],t[i+4])]),n=0;4>n;++n)r(t,e+32*n,i,0,i.length)}function ef(t,e){var n=t[e-1],r=t[e-1+32],i=t[e-1+64],a=t[e-1+96];P(t,e+0,0x1010101*eu(t[e-1-32],n,r)),P(t,e+32,0x1010101*eu(n,r,i)),P(t,e+64,0x1010101*eu(r,i,a)),P(t,e+96,0x1010101*eu(i,a,a))}function ed(t,e){var n,r=4;for(n=0;4>n;++n)r+=t[e+n-32]+t[e-1+32*n];for(r>>=3,n=0;4>n;++n)i(t,e+32*n,r,4)}function ep(t,e){var n=t[e-1+0],r=t[e-1+32],i=t[e-1+64],a=t[e-1-32],o=t[e+0-32],s=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+96]=eu(r,i,t[e-1+96]),t[e+1+96]=t[e+0+64]=eu(n,r,i),t[e+2+96]=t[e+1+64]=t[e+0+32]=eu(a,n,r),t[e+3+96]=t[e+2+64]=t[e+1+32]=t[e+0+0]=eu(o,a,n),t[e+3+64]=t[e+2+32]=t[e+1+0]=eu(s,o,a),t[e+3+32]=t[e+2+0]=eu(l,s,o),t[e+3+0]=eu(h,l,s)}function eg(t,e){var n=t[e+1-32],r=t[e+2-32],i=t[e+3-32],a=t[e+4-32],o=t[e+5-32],s=t[e+6-32],l=t[e+7-32];t[e+0+0]=eu(t[e+0-32],n,r),t[e+1+0]=t[e+0+32]=eu(n,r,i),t[e+2+0]=t[e+1+32]=t[e+0+64]=eu(r,i,a),t[e+3+0]=t[e+2+32]=t[e+1+64]=t[e+0+96]=eu(i,a,o),t[e+3+32]=t[e+2+64]=t[e+1+96]=eu(a,o,s),t[e+3+64]=t[e+2+96]=eu(o,s,l),t[e+3+96]=eu(s,l,l)}function em(t,e){var n=t[e-1+0],r=t[e-1+32],i=t[e-1+64],a=t[e-1-32],o=t[e+0-32],s=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+0]=t[e+1+64]=a+o+1>>1,t[e+1+0]=t[e+2+64]=o+s+1>>1,t[e+2+0]=t[e+3+64]=s+l+1>>1,t[e+3+0]=l+h+1>>1,t[e+0+96]=eu(i,r,n),t[e+0+64]=eu(r,n,a),t[e+0+32]=t[e+1+96]=eu(n,a,o),t[e+1+32]=t[e+2+96]=eu(a,o,s),t[e+2+32]=t[e+3+96]=eu(o,s,l),t[e+3+32]=eu(s,l,h)}function ev(t,e){var n=t[e+0-32],r=t[e+1-32],i=t[e+2-32],a=t[e+3-32],o=t[e+4-32],s=t[e+5-32],l=t[e+6-32],h=t[e+7-32];t[e+0+0]=n+r+1>>1,t[e+1+0]=t[e+0+64]=r+i+1>>1,t[e+2+0]=t[e+1+64]=i+a+1>>1,t[e+3+0]=t[e+2+64]=a+o+1>>1,t[e+0+32]=eu(n,r,i),t[e+1+32]=t[e+0+96]=eu(r,i,a),t[e+2+32]=t[e+1+96]=eu(i,a,o),t[e+3+32]=t[e+2+96]=eu(a,o,s),t[e+3+64]=eu(o,s,l),t[e+3+96]=eu(s,l,h)}function eb(t,e){var n=t[e-1+0],r=t[e-1+32],i=t[e-1+64],a=t[e-1+96];t[e+0+0]=n+r+1>>1,t[e+2+0]=t[e+0+32]=r+i+1>>1,t[e+2+32]=t[e+0+64]=i+a+1>>1,t[e+1+0]=eu(n,r,i),t[e+3+0]=t[e+1+32]=eu(r,i,a),t[e+3+32]=t[e+1+64]=eu(i,a,a),t[e+3+64]=t[e+2+64]=t[e+0+96]=t[e+1+96]=t[e+2+96]=t[e+3+96]=a}function ey(t,e){var n=t[e-1+0],r=t[e-1+32],i=t[e-1+64],a=t[e-1+96],o=t[e-1-32],s=t[e+0-32],l=t[e+1-32],h=t[e+2-32];t[e+0+0]=t[e+2+32]=n+o+1>>1,t[e+0+32]=t[e+2+64]=r+n+1>>1,t[e+0+64]=t[e+2+96]=i+r+1>>1,t[e+0+96]=a+i+1>>1,t[e+3+0]=eu(s,l,h),t[e+2+0]=eu(o,s,l),t[e+1+0]=t[e+3+32]=eu(n,o,s),t[e+1+32]=t[e+3+64]=eu(r,n,o),t[e+1+64]=t[e+3+96]=eu(i,r,n),t[e+1+96]=eu(a,i,r)}function ew(t,e){var n;for(n=0;8>n;++n)r(t,e+32*n,t,e-32,8)}function e_(t,e){var n;for(n=0;8>n;++n)i(t,e,t[e-1],8),e+=32}function ex(t,e,n){var r;for(r=0;8>r;++r)i(e,n+32*r,t,8)}function eN(t,e){var n,r=8;for(n=0;8>n;++n)r+=t[e+n-32]+t[e-1+32*n];ex(r>>4,t,e)}function eA(t,e){var n,r=4;for(n=0;8>n;++n)r+=t[e+n-32];ex(r>>3,t,e)}function eL(t,e){var n,r=4;for(n=0;8>n;++n)r+=t[e-1+32*n];ex(r>>3,t,e)}function ek(t,e){ex(128,t,e)}function eS(t,e,n){var r=t[e-n],i=t[e+0],a=3*(i-r)+n9[1020+t[e-2*n]-t[e+n]],o=rt[112+(a+4>>3)];t[e-n]=re[255+r+rt[112+(a+3>>3)]],t[e+0]=re[255+i-o]}function eC(t,e,n,r){var i=t[e+0],a=t[e+n];return rn[255+t[e-2*n]-t[e-n]]>r||rn[255+a-i]>r}function eP(t,e,n,r){return 4*rn[255+t[e-n]-t[e+0]]+rn[255+t[e-2*n]-t[e+n]]<=r}function eE(t,e,n,r,i){var a=t[e-3*n],o=t[e-2*n],s=t[e-n],l=t[e+0],h=t[e+n],u=t[e+2*n],c=t[e+3*n];return 4*rn[255+s-l]+rn[255+o-h]>r?0:rn[255+t[e-4*n]-a]<=i&&rn[255+a-o]<=i&&rn[255+o-s]<=i&&rn[255+c-u]<=i&&rn[255+u-h]<=i&&rn[255+h-l]<=i}function eI(t,e,n,r){var i=2*r+1;for(r=0;16>r;++r)eP(t,e+r,n,i)&&eS(t,e+r,n)}function ej(t,e,n,r){var i=2*r+1;for(r=0;16>r;++r)eP(t,e+r*n,1,i)&&eS(t,e+r*n,1)}function eM(t,e,n,r){var i;for(i=3;0>7,g=18*m+63>>7,m=9*m+63>>7;t[l-3*n]=re[255+t[l-3*n]+m],t[l-2*n]=re[255+h+g],t[l-n]=re[255+u+p],t[l+0]=re[255+c-p],t[l+n]=re[255+f-g],t[l+2*n]=re[255+d-m]}e+=r}}function eO(t,e,n,r,i,a,o,s){for(a=2*a+1;0>3)],d=rt[112+(d+3>>3)],p=f+1>>1;t[l-2*n]=re[255+t[l-2*n]+p],t[l-n]=re[255+h+d],t[l+0]=re[255+u-f],t[l+n]=re[255+c-p]}e+=r}}function eT(t,e,n,r,i,a){eB(t,e,n,1,16,r,i,a)}function eR(t,e,n,r,i,a){eB(t,e,1,n,16,r,i,a)}function eD(t,e,n,r,i,a){var o;for(o=3;0h?0:255:h)&255,h=l,i[a+s]=u}}function e1(t,e,n,r,i,a){for(;0>23,t[s+4*o+1]=t[s+4*o+1]*h>>23,t[s+4*o+2]=t[s+4*o+2]*h>>23)}e+=a}}function e0(t,e,n,r,i){for(;0>4)*l>>16;t[e+2*a+0]=(240&o|o>>4)*l>>16&240|(15&o|o<<4)*l>>16>>4&15,t[e+2*a+1]=240&h|s}e+=i}}function e2(t,e,n,r,i,a,o,s){var l,h,u=255;for(h=0;h>8}function e3(){n1=e1,n0=e0,n2=e2,n5=e5}function e4(n,r,i){t[n]=function(t,n,a,o,s,l,h,u,c,f,d,p,g,m,v,b,y){var w,_=y-1>>1,x=s[l+0]|h[u+0]<<16,N=c[f+0]|d[p+0]<<16;e(null!=t);var A=3*x+N+131074>>2;for(r(t[n+0],255&A,A>>16,g,m),null!=a&&(A=3*N+x+131074>>2,r(a[o+0],255&A,A>>16,v,b)),w=1;w<=_;++w){var L=s[l+w]|h[u+w]<<16,k=c[f+w]|d[p+w]<<16,S=x+L+N+k+524296,C=S+2*(L+N)>>3;A=C+x>>1,x=(S=S+2*(x+k)>>3)+L>>1,r(t[n+2*w-1],255&A,A>>16,g,m+(2*w-1)*i),r(t[n+2*w-0],255&x,x>>16,g,m+(2*w-0)*i),null!=a&&(A=S+N>>1,x=C+k>>1,r(a[o+2*w-1],255&A,A>>16,v,b+(2*w-1)*i),r(a[o+2*w+0],255&x,x>>16,v,b+(2*w+0)*i)),x=L,N=k}1&y||(A=3*x+N+131074>>2,r(t[n+y-1],255&A,A>>16,g,m+(y-1)*i),null!=a&&(A=3*N+x+131074>>2,r(a[o+y-1],255&A,A>>16,v,b+(y-1)*i)))}}function e6(){rR[rr]=rD,rR[ri]=rq,rR[ra]=rz,rR[ro]=rU,rR[rs]=r$,rR[rl]=rH,rR[rh]=rW,rR[ru]=rq,rR[rc]=rU,rR[rf]=r$,rR[rd]=rH}function e8(t){return t&~rZ?0>t?0:255:t>>rJ}function e7(t,e){return e8((19077*t>>8)+(26149*e>>8)-14234)}function e9(t,e,n){return e8((19077*t>>8)-(6419*e>>8)-(13320*n>>8)+8708)}function nt(t,e){return e8((19077*t>>8)+(33050*e>>8)-17685)}function ne(t,e,n,r,i){r[i+0]=e7(t,n),r[i+1]=e9(t,e,n),r[i+2]=nt(t,e)}function nn(t,e,n,r,i){r[i+0]=nt(t,e),r[i+1]=e9(t,e,n),r[i+2]=e7(t,n)}function nr(t,e,n,r,i){var a=e9(t,e,n);e=a<<3&224|nt(t,e)>>3,r[i+0]=248&e7(t,n)|a>>5,r[i+1]=e}function ni(t,e,n,r,i){var a=240&nt(t,e)|15;r[i+0]=240&e7(t,n)|e9(t,e,n)>>4,r[i+1]=a}function na(t,e,n,r,i){r[i+0]=255,ne(t,e,n,r,i+1)}function no(t,e,n,r,i){nn(t,e,n,r,i),r[i+3]=255}function ns(t,e,n,r,i){ne(t,e,n,r,i),r[i+3]=255}function nl(e,n,r){t[e]=function(t,e,i,a,o,s,l,h,u){for(var c=h+(-2&u)*r;h!=c;)n(t[e+0],i[a+0],o[s+0],l,h),n(t[e+1],i[a+0],o[s+0],l,h+r),e+=2,++a,++s,h+=2*r;1&u&&n(t[e+0],i[a+0],o[s+0],l,h)}}function nh(t,e,n){return 0==n?0==t?0==e?6:5:4*(0==e):n}function nu(t,e,n,r,i){switch(t>>>30){case 3:nT(e,n,r,i,0);break;case 2:nR(e,n,r,i);break;case 1:nz(e,n,r,i)}}function nc(t,e){var n,a,o=e.M,s=e.Nb,l=t.oc,h=t.pc+40,u=t.oc,c=t.pc+584,f=t.oc,d=t.pc+600;for(n=0;16>n;++n)l[h+32*n-1]=129;for(n=0;8>n;++n)u[c+32*n-1]=129,f[d+32*n-1]=129;for(0n;++n)r(l,h+32*n-4,l,h+32*n+12,4);for(n=-1;8>n;++n)r(u,c+32*n-4,u,c+32*n+4,4),r(f,d+32*n-4,f,d+32*n+4,4)}var g=t.Gd,m=t.Hd+a,v=p.ad,b=p.Hc;if(0=t.za-1?i(y,w,g[m].y[15],4):r(y,w,g[m+1].y,0,4)),n=0;4>n;n++)y[w+128+n]=y[w+256+n]=y[w+384+n]=y[w+0+n];for(n=0;16>n;++n,b<<=2)y=l,w=h+r4[n],rM[p.Ob[n]](y,w),nu(b,v,16*n,y,w)}else if(rj[y=nh(a,o,p.Ob[0])](l,h),0!=b)for(n=0;16>n;++n,b<<=2)nu(b,v,16*n,l,h+r4[n]);for(n=p.Gc,rF[y=nh(a,o,p.Dd)](u,c),rF[y](f,d),b=v,y=u,w=c,255&(p=0|n)&&(170&p?nD(b,256,y,w):nq(b,256,y,w)),p=f,b=d,255&(n>>=8)&&(170&n?nD(v,320,p,b):nq(v,320,p,b)),on;++n)r(g,m+n*t.R,l,h+32*n,16);for(n=0;8>n;++n)r(v,p+n*t.B,u,c+32*n,8),r(b,y+n*t.B,f,d+32*n,8)}}function nf(t,r,i,a,o,s,l,h,u){var c=[0],f=[0],d=0,p=null!=u?u.kd:0,g=null!=u?u:new eX;if(null==t||12>i)return 7;g.data=t,g.w=r,g.ha=i,r=[r],i=[i],g.gb=[g.gb];n:{var m=r,b=i,y=g.gb;if(e(null!=t),e(null!=b),e(null!=y),y[0]=0,12<=b[0]&&!n(t,m[0],"RIFF")){if(n(t,m[0]+8,"WEBP")){y=3;break n}var w=j(t,m[0]+4);if(12>w||0xfffffff6b[0]-8){y=7;break n}y[0]=w,m[0]+=12,b[0]-=12}y=0}if(0!=y)return y;for(w=0y[0])y=7;else{if(!n(x,b[0],"VP8X")){if(10!=j(x,b[0]+4)){y=3;break n}if(18>y[0]){y=7;break n}var k=j(x,b[0]+8),S=1+I(x,b[0]+12);if(0x80000000<=S*(x=1+I(x,b[0]+15))){y=3;break n}null!=L&&(L[0]=k),null!=N&&(N[0]=S),null!=A&&(A[0]=x),b[0]+=18,y[0]-=18,C[0]=1}y=0}}if(d=d[0],m=m[0],0!=y)return y;if(b=!!(2&m),!w&&d)return 3;if(null!=s&&(s[0]=!!(16&m)),null!=l&&(l[0]=b),null!=h&&(h[0]=0),l=c[0],m=f[0],d&&b&&null==u){y=0;break}if(4>i){y=7;break}if(w&&d||!w&&!d&&!n(t,r[0],"ALPH")){i=[i],g.na=[g.na],g.P=[g.P],g.Sa=[g.Sa];n:{k=t,y=r,w=i;var C=g.gb;N=g.na,A=g.P,L=g.Sa,S=22,e(null!=k),e(null!=w),x=y[0];var P=w[0];for(e(null!=N),e(null!=L),N[0]=null,A[0]=null,L[0]=0;;){if(y[0]=x,w[0]=P,8>P){y=7;break n}var E=j(k,x+4);if(0xfffffff6C){y=3;break n}if(!n(k,x,"VP8 ")||!n(k,x,"VP8L")){y=0;break n}if(P[0]w[0])y=7;else{if(x||S){if(C=j(C,k+4),12<=N&&C>N-12){y=3;break n}if(p&&C>w[0]-8){y=7;break n}A[0]=C,y[0]+=8,w[0]-=8,L[0]=S}else L[0]=5<=w[0]&&47==C[k+0]&&!(C[k+4]>>5),A[0]=w[0];y=0}if(i=i[0],g.Ja=g.Ja[0],g.xa=g.xa[0],r=r[0],0!=y)break;if(0xfffffff6i){y=7;break}h=l,p=m,b=s,null==t||5>i?t=0:5<=i&&47==t[r+0]&&!(t[r+4]>>5)?(w=[0],C=[0],N=[0],v(A=new _,t,r,i),tg(A,w,C,N)?(null!=h&&(h[0]=w[0]),null!=p&&(p[0]=C[0]),null!=b&&(b[0]=N[0]),t=1):t=0):t=0}else{if(10>i){y=7;break}h=m,null==t||10>i||!tG(t,r+3,i-3)?t=0:(p=t[r+0]|t[r+1]<<8|t[r+2]<<16,b=16383&(t[r+7]<<8|t[r+6]),t=16383&(t[r+9]<<8|t[r+8]),1&p||3<(p>>1&7)||!(p>>4&1)||p>>5>=g.Ja||!b||!t?t=0:(l&&(l[0]=b),h&&(h[0]=t),t=1))}if(!t||(l=l[0],m=m[0],d&&(c[0]!=l||f[0]!=m)))return 3;null!=u&&(u[0]=g,u.offset=r-u.w,e(0xfffffff6>r-u.w),e(u.offset==u.ha-i));break}return 0==y||7==y&&d&&null==u?(null!=s&&(s[0]|=null!=g.na&&0n||(a&=-2,o&=-2),0>a||0>o||0>=s||0>=l||a+s>r||o+l>i))return 0;if(e.v=a,e.j=o,e.va=a+s,e.o=o+l,e.U=s,e.T=l,e.da=null!=t&&0t.S){var e=t.f.RGBA;e.fb+=(t.height-1)*e.A,e.A=-e.A}else e=t.f.kb,t=t.height,e.O+=(t-1)*e.fa,e.fa=-e.fa,e.N+=(t-1>>1)*e.Ab,e.Ab=-e.Ab,e.W+=(t-1>>1)*e.Db,e.Db=-e.Db,null!=e.F&&(e.J+=(t-1)*e.lb,e.lb=-e.lb);return 0}function ng(t,e,n,r){if(null==r||0>=t||0>=e)return 2;if(null!=n){if(n.Da){var i=n.cd,o=n.bd,s=-2&n.v,l=-2&n.j;if(0>s||0>l||0>=i||0>=o||s+i>t||l+o>e)return 2;t=i,e=o}if(n.da){if(!O(t,e,i=[n.ib],o=[n.hb]))return 2;t=i[0],e=o[0]}}r.width=t,r.height=e;n:{var h=r.width,u=r.height;if(t=r.S,0>=h||0>=u||!(t>=rr&&13>t))t=2;else{if(0>=r.Rd&&null==r.sd){s=o=i=e=0;var c=(l=h*r7[t])*u;if(11>t||(o=(u+1)/2*(e=(h+1)/2),12==t&&(s=(i=h)*u)),null==(u=a(c+2*o+s))){t=1;break n}r.sd=u,11>t?((h=r.f.RGBA).eb=u,h.fb=0,h.A=l,h.size=c):((h=r.f.kb).y=u,h.O=0,h.fa=l,h.Fd=c,h.f=u,h.N=0+c,h.Ab=e,h.Cd=o,h.ea=u,h.W=0+c+o,h.Db=e,h.Ed=o,12==t&&(h.F=u,h.J=0+c+2*o),h.Tc=s,h.lb=i)}if(e=1,i=r.S,o=r.width,s=r.height,i>=rr&&13>i)if(11>i)e&=(l=Math.abs((t=r.f.RGBA).A))*(s-1)+o<=t.size,e&=l>=o*r7[i],e&=null!=t.eb;else{t=r.f.kb,l=(o+1)/2,c=(s+1)/2,h=Math.abs(t.fa),u=Math.abs(t.Ab);var f=Math.abs(t.Db),d=Math.abs(t.lb),p=d*(s-1)+o;e&=h*(s-1)+o<=t.Fd,e&=u*(c-1)+l<=t.Cd,e=(e&=f*(c-1)+l<=t.Ed)&h>=o&u>=l&f>=l&null!=t.y&null!=t.f&null!=t.ea,12==i&&(e&=d>=o,e&=p<=t.Tc,e&=null!=t.F)}else e=0;t=2*!e}}return 0!=t||null!=n&&n.fd&&(t=np(r)),t}var nm=64,nv=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,0xffffff],nb=24,ny=32,nw=8,n_=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];D("Predictor0","PredictorAdd0"),t.Predictor0=function(){return 0xff000000},t.Predictor1=function(t){return t},t.Predictor2=function(t,e,n){return e[n+0]},t.Predictor3=function(t,e,n){return e[n+1]},t.Predictor4=function(t,e,n){return e[n-1]},t.Predictor5=function(t,e,n){return q(q(t,e[n+1]),e[n+0])},t.Predictor6=function(t,e,n){return q(t,e[n-1])},t.Predictor7=function(t,e,n){return q(t,e[n+0])},t.Predictor8=function(t,e,n){return q(e[n-1],e[n+0])},t.Predictor9=function(t,e,n){return q(e[n+0],e[n+1])},t.Predictor10=function(t,e,n){return q(q(t,e[n-1]),q(e[n+0],e[n+1]))},t.Predictor11=function(t,e,n){var r=e[n+0];return 0>=H(r>>24&255,t>>24&255,(e=e[n-1])>>24&255)+H(r>>16&255,t>>16&255,e>>16&255)+H(r>>8&255,t>>8&255,e>>8&255)+H(255&r,255&t,255&e)?r:t},t.Predictor12=function(t,e,n){var r=e[n+0];return(U((t>>24&255)+(r>>24&255)-((e=e[n-1])>>24&255))<<24|U((t>>16&255)+(r>>16&255)-(e>>16&255))<<16|U((t>>8&255)+(r>>8&255)-(e>>8&255))<<8|U((255&t)+(255&r)-(255&e)))>>>0},t.Predictor13=function(t,e,n){var r=e[n-1];return($((t=q(t,e[n+0]))>>24&255,r>>24&255)<<24|$(t>>16&255,r>>16&255)<<16|$(t>>8&255,r>>8&255)<<8|$(255&t,255&r))>>>0};var nx=t.PredictorAdd0;t.PredictorAdd1=W,D("Predictor2","PredictorAdd2"),D("Predictor3","PredictorAdd3"),D("Predictor4","PredictorAdd4"),D("Predictor5","PredictorAdd5"),D("Predictor6","PredictorAdd6"),D("Predictor7","PredictorAdd7"),D("Predictor8","PredictorAdd8"),D("Predictor9","PredictorAdd9"),D("Predictor10","PredictorAdd10"),D("Predictor11","PredictorAdd11"),D("Predictor12","PredictorAdd12"),D("Predictor13","PredictorAdd13");var nN=t.PredictorAdd2;G("ColorIndexInverseTransform","MapARGB","32b",function(t){return t>>8&255},function(t){return t}),G("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(t){return t},function(t){return t>>8&255});var nA,nL=t.ColorIndexInverseTransform,nk=t.MapARGB,nS=t.VP8LColorIndexInverseTransformAlpha,nC=t.MapAlpha,nP=t.VP8LPredictorsAdd=[];nP.length=16,(t.VP8LPredictors=[]).length=16,(t.VP8LPredictorsAdd_C=[]).length=16,(t.VP8LPredictors_C=[]).length=16;var nE,nI,nj,nM,nF,nB,nO,nT,nR,nD,nz,nq,nU,n$,nH,nW,nX,nY,nV,nG,nJ,nZ,nK,nQ,n1,n0,n2,n5,n3=a(511),n4=a(2041),n6=a(225),n8=a(767),n7=0,n9=n4,rt=n6,re=n8,rn=n3,rr=0,ri=1,ra=2,ro=3,rs=4,rl=5,rh=6,ru=7,rc=8,rf=9,rd=10,rp=[2,3,7],rg=[3,3,11],rm=[280,256,256,256,40],rv=[0,1,1,1,0],rb=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],ry=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],rw=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],r_=8,rx=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],rN=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],rA=null,rL=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],rk=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rS=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],rC=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],rP=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],rE=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],rI=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],rj=[],rM=[],rF=[],rB=1,rO=2,rT=[],rR=[];e4("UpsampleRgbLinePair",ne,3),e4("UpsampleBgrLinePair",nn,3),e4("UpsampleRgbaLinePair",ns,4),e4("UpsampleBgraLinePair",no,4),e4("UpsampleArgbLinePair",na,4),e4("UpsampleRgba4444LinePair",ni,2),e4("UpsampleRgb565LinePair",nr,2);var rD=t.UpsampleRgbLinePair,rz=t.UpsampleBgrLinePair,rq=t.UpsampleRgbaLinePair,rU=t.UpsampleBgraLinePair,r$=t.UpsampleArgbLinePair,rH=t.UpsampleRgba4444LinePair,rW=t.UpsampleRgb565LinePair,rX=16,rY=32768,rV=-227,rG=482,rJ=6,rZ=16383,rK=0,rQ=a(256),r1=a(256),r0=a(256),r2=a(256),r5=a(rG-rV),r3=a(rG-rV);nl("YuvToRgbRow",ne,3),nl("YuvToBgrRow",nn,3),nl("YuvToRgbaRow",ns,4),nl("YuvToBgraRow",no,4),nl("YuvToArgbRow",na,4),nl("YuvToRgba4444Row",ni,2),nl("YuvToRgb565Row",nr,2);var r4=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],r6=[0,2,8],r8=[8,7,6,4,4,2,2,2,1,1,1,1];this.WebPDecodeRGBA=function(t,n,s,l,h){var u=ri,c=new eW,f=new to;c.ba=f,f.S=u,f.width=[f.width],f.height=[f.height];var d=f.width,p=f.height,g=new ts;if(null==g||null==t)var m=2;else e(null!=g),m=nf(t,n,s,g.width,g.height,g.Pd,g.Qd,g.format,null);if(0!=m?d=0:(null!=d&&(d[0]=g.width[0]),null!=p&&(p[0]=g.height[0]),d=1),d){f.width=f.width[0],f.height=f.height[0],null!=l&&(l[0]=f.width),null!=h&&(h[0]=f.height);n:{if(l=new tX,(h=new eX).data=t,h.w=n,h.ha=s,h.kd=1,n=[0],e(null!=h),(0==(t=nf(h.data,h.w,h.ha,null,null,null,n,null,h))||7==t)&&n[0]&&(t=4),0==(n=t)){if(e(null!=c),l.data=h.data,l.w=h.w+h.offset,l.ha=h.ha-h.offset,l.put=td,l.ac=tf,l.bc=tp,l.ma=c,h.xa){if(null==(t=tC())){c=1;break n}if(function(t,n){for(var r=[0],i=[0],a=[0];;){if(null==t)return 0;if(null==n)return t.a=2,0;if(t.l=n,t.a=0,v(t.m,n.data,n.w,n.ha),!tg(t.m,r,i,a)){t.a=3;break}if(t.xb=rO,n.width=r[0],n.height=i[0],!tP(r[0],i[0],1,t,null))break;return 1}return e(0!=t.a),0}(t,l)){if(l=0==(n=ng(l.width,l.height,c.Oa,c.ba))){r:{for(l=t;;){if(null==l){l=0;break r}if(e(null!=l.s.yc),e(null!=l.s.Ya),e(0l.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=l.ca.f.kb.F&&e3()),l.Pb&&0(d=s.Md)?0:100p;++p)12>(m=h.pb[p]).lc&&(m.ia=d*r8[0>m.lc?0:m.lc]>>3),g|=m.ia;g&&(alert("todo:VP8InitRandom"),h.ia=1)}h.Ga=s.Id,100h.Ga&&(h.Ga=0)}(function(t,n){if(null==t)return 0;if(null==n)return tV(t,2,"NULL VP8Io parameter in VP8Decode().");if(!t.cb&&!tJ(t,n))return 0;if(e(t.cb),null==n.ac||n.ac(n)){n.ob&&(t.L=0);var s=r6[t.L];if(2==t.L?(t.yb=0,t.zb=0):(t.yb=n.v-s>>4,t.zb=n.j-s>>4,0>t.yb&&(t.yb=0),0>t.zb&&(t.zb=0)),t.Va=n.o+15+s>>4,t.Hb=n.va+15+s>>4,t.Hb>t.za&&(t.Hb=t.za),t.Va>t.Ub&&(t.Va=t.Ub),0s;++s){if(t.Qa.Cb){var u=t.Qa.Lb[s];t.Qa.Fb||(u+=h.Tb)}else u=h.Tb;for(l=0;1>=l;++l){var c=t.gd[s][l],f=u;if(h.Pc&&(f+=h.vd[0],l&&(f+=h.od[0])),0<(f=0>f?0:63>2:d>>1)>9-h.wb&&(d=9-h.wb),1>d&&(d=1),c.dd=d,c.tc=2*f+d,c.ld=40<=f?2:+(15<=f)}else c.tc=0;c.La=l}}}s=0}else tV(t,6,"Frame setup failed"),s=t.a;if(s=0==s){if(s){t.$c=0,0t.Vb){if(t.Vb=0,t.Ec=a(c),t.Fc=0,null==t.Ec){s=tV(t,1,"no memory during frame initialization.");break r}t.Vb=c}c=t.Ec,f=t.Fc,t.Ac=c,t.Bc=f,f+=h,t.Gd=o(p,t$),t.Hd=0,t.rb=o(g+1,tD),t.sb=1,t.wa=m?o(m,tR):null,t.Y=0,t.D.Nb=0,t.D.wa=t.wa,t.D.Y=t.Y,0=s;++s)n3[255+s]=0>s?-s:s;for(s=-1020;1020>=s;++s)n4[1020+s]=-128>s?-128:127=s;++s)n6[112+s]=-16>s?-16:15=s;++s)n8[255+s]=0>s?0:255c;++c){var y,w=p[0+c];for(y=0;4>y;++y){w=rP[f[d+y]][w];for(var _=rS[C(u,w[0])];0<_;)_=rS[2*_+C(u,w[_])];w=-_,f[d+y]=w}r(m,b,f,d,4),b+=4,p[0+c]=w}}else w=C(u,156)?C(u,128)?1:3:2*!!C(u,163),g.Ob[0]=w,i(f,d,w,4),i(p,0,w,4);g.Dd=C(u,142)?C(u,114)?C(u,183)?1:3:2:0}if(h.m.Ka)return tV(t,7,"Premature end-of-partition0 encountered.");for(;t.ja>3;for(_=0;256>_;_+=16)c[m+_]=E}k=1,S=d[0]}var I=15&u.la,j=15&b.la;for(_=0;4>_;++_){var M=1&j;for(E=A=0;4>E;++E)I=I>>1|(M=(P=rA(f,S,P=M+(1&I),g.Sc,k,c,m))>k)<<7,A=A<<2|(3>=4,j=j>>1|M<<7,y=(y<<8|A)>>>0}for(S=I,k=j>>4,x=0;4>x;x+=2){for(A=0,I=u.la>>4+x,j=b.la>>4+x,_=0;2>_;++_){for(M=1&j,E=0;2>E;++E)P=M+(1&I),I=I>>1|(M=0<(P=rA(f,d[2],P,g.Qc,0,c,m)))<<3,A=A<<2|(3>=2,j=j>>1|M<<5}w|=A<<4*x,S|=I<<4<=s.zb&&s.M<=s.Va,0==s.Aa)r:{if(o.M=s.M,o.uc=u,nc(s,o),h=1,o=(A=s.D).Nb,u=(w=r6[s.L])*s.R,f=w/2*s.B,_=16*o*s.R,E=8*o*s.B,d=s.sa,p=s.ta-u+_,g=s.qa,c=s.ra-f+E,m=s.Ha,b=s.Ia-f+E,j=0==(I=A.M),y=I>=s.Va-1,2==s.Aa&&nc(s,A),A.uc)for(M=(P=s).D.M,e(P.D.uc),A=P.yb;Al.o&&(I=l.o),l.F=null,l.J=null,null!=s.Fa&&0i||0>=o||i+o>l)return null;if(!t.Cc){if(null==t.ga){if(t.ga=new eJ,(k=null==t.ga)||(k=n.width*n.o,e(0==t.Gb.length),t.Gb=a(k),t.Uc=0,null==t.Gb?k=0:(t.mb=t.Gb,t.nb=t.Uc,t.rc=null,k=1),k=!k),!k){k=t.ga;var h=t.Fa,u=t.P,c=t.qc,f=t.mb,d=t.nb,p=u+1,g=c-1,m=k.l;if(e(null!=h&&null!=f&&null!=n),rT[0]=null,rT[1]=eZ,rT[2]=eK,rT[3]=eQ,k.ca=f,k.tb=d,k.c=n.width,k.i=n.height,e(0=c)n=0;else if(k.$a=3&h[u+0],k.Z=h[u+0]>>2&3,k.Lc=h[u+0]>>4&3,u=h[u+0]>>6&3,0>k.$a||1=k.c*k.i;k=!n}if(k)return null;1!=t.ga.Lc?t.Ga=0:o=l-i}e(null!=t.ga),e(i+o<=l);n:{if(n=(h=t.ga).c,l=h.l.o,0==h.$a){if(p=t.rc,g=t.Vc,m=t.Fa,u=t.P+1+i*n,c=t.mb,f=t.nb+i*n,e(u<=t.P+t.qc),0!=h.Z)for(e(null!=rT[h.Z]),k=0;k=n)n=1;else if(h.ic||e3(),h.ic){h=k.V,p=k.Ba,g=k.c;var b=k.i,y=(m=1,u=k.$/g,c=k.$%g,f=k.m,d=k.s,k.$),w=g*b,_=g*n,x=d.wc,A=y<_?tw(d,c,u):null;e(y<=w),e(n<=b),e(tN(d));r:for(;;){for(;!f.h&&y<_;){if(c&x||(A=tw(d,c,u)),e(null!=A),L(f),256>(b=tb(A.G[0],A.H[0],f)))h[p+y]=b,++y,++c>=g&&(c=0,++u<=n&&!(u%16)&&tL(k,u));else{if(!(280>b)){m=0;break r}b=tm(b-256,f);var k,S,C=tb(A.G[4],A.H[4],f);if(L(f),!(y>=(C=tv(g,C=tm(C,f)))&&w-y>=b)){m=0;break r}for(S=0;S=g;)c-=g,++u<=n&&!(u%16)&&tL(k,u);y<_&&c&x&&(A=tw(d,c,u))}e(f.h==N(f))}tL(k,u>n?n:u);break}!m||f.h&&y=l&&(t.Cc=1),o=1}if(!o)return null;if(t.Cc&&(null!=(o=t.ga)&&(o.mc=null),t.ga=null,0>1),l.W+=s.B*(w>>1),null!=l.F&&(l.J+=l.width*w)),A>1,l.W+=l.v>>1,null!=l.F&&(l.J+=l.v),l.ka=A-l.j,l.U=l.va-l.v,l.T=I-A,h=l.put(l))}o+1!=s.Ic||y||(r(s.sa,s.ta-u,d,p+16*s.R,u),r(s.qa,s.ra-f,g,c+8*s.B,f),r(s.Ha,s.Ia-f,m,b+8*s.B,f))}if(!h)return tV(t,6,"Output aborted.")}return 1}(t,n)),null!=n.bc&&n.bc(n),s&=1}return s?(t.cb=0,s):0})(t,l)||(n=t.a)}}else n=t.a;0==n&&null!=c.Oa&&c.Oa.fd&&(n=np(c.ba))}c=n}u=0!=c?null:11>u?f.f.RGBA.eb:f.f.kb.y}else u=null;return u};var r7=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function h(t,e){return(t[e+0]|t[e+1]<<8|t[e+2]<<16)>>>0}function u(t,e){return(t[e+0]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}new l;var c=[0],f=[0],d=[],p=new l,g=function(t,e){var n={},r=0,i=!1,a=0,o=0;if(n.frames=[],!function(t,e){for(var n=0;n<4;n++)if(t[e+n]!="RIFF".charCodeAt(n))return!0;return!1}(t,e)){for(u(t,e+=4),e+=8;e>1&1}"ANMF"!=f&&(e+=p)}return n}}(t,0);g.response=t,g.rgbaoutput=!0,g.dataurl=!1;var m=g.header?g.header:null,v=g.frames?g.frames:null;if(m){m.loop_counter=m.loop_count,c=[m.canvas_height],f=[m.canvas_width];for(var b=0;b=2?t[1]:e[0],e[2]=t.length>=3?t[2]:e[0],e[3]=t.length>=4?t[3]:e[1]),hG.margin=e}});var a=!1;Object.defineProperty(this,"autoPaging",{get:function(){return a},set:function(t){a=t}});var o=0;Object.defineProperty(this,"lastBreak",{get:function(){return o},set:function(t){o=t}});var s=[];Object.defineProperty(this,"pageBreaks",{get:function(){return s},set:function(t){s=t}}),Object.defineProperty(this,"ctx",{get:function(){return hG},set:function(t){t instanceof hJ&&(hG=t)}}),Object.defineProperty(this,"path",{get:function(){return hG.path},set:function(t){hG.path=t}});var l=[];Object.defineProperty(this,"ctxStack",{get:function(){return l},set:function(t){l=t}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(t){var e;e=hK(t),this.ctx.fillStyle=e.style,this.ctx.isFillTransparent=0===e.a,this.ctx.fillOpacity=e.a,this.pdf.setFillColor(e.r,e.g,e.b,{a:e.a}),this.pdf.setTextColor(e.r,e.g,e.b,{a:e.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(t){var e=hK(t);this.ctx.strokeStyle=e.style,this.ctx.isStrokeTransparent=0===e.a,this.ctx.strokeOpacity=e.a,0===e.a?this.pdf.setDrawColor(255,255,255):(e.a,this.pdf.setDrawColor(e.r,e.g,e.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(t){-1!==["butt","round","square"].indexOf(t)&&(this.ctx.lineCap=t,this.pdf.setLineCap(t))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(t){isNaN(t)||(this.ctx.lineWidth=t,this.pdf.setLineWidth(t))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(t){-1!==["bevel","round","miter"].indexOf(t)&&(this.ctx.lineJoin=t,this.pdf.setLineJoin(t))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(t){isNaN(t)||(this.ctx.miterLimit=t,this.pdf.setMiterLimit(t))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(t){this.ctx.textBaseline=t}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(t){-1!==["right","end","center","left","start"].indexOf(t)&&(this.ctx.textAlign=t)}});var h=null,u=null,c=null;Object.defineProperty(this,"fontFaces",{get:function(){return c},set:function(t){h=null,u=null,c=t}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(t){var e;if(this.ctx.font=t,null!==(e=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(t))){var n=e[1];e[2];var r=e[3],i=e[4];e[5];var a=e[6],o=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(i)[2];i="px"===o?Math.floor(parseFloat(i)*this.pdf.internal.scaleFactor):"em"===o?Math.floor(parseFloat(i)*this.pdf.getFontSize()):Math.floor(parseFloat(i)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(i);var s=function(t){var e,n,r=[],i=t.trim();if(""===i)return hk;if(i in lx)return[lx[i]];for(;""!==i;){switch(n=null,e=(i=lA(i)).charAt(0)){case'"':case"'":n=function(t,e){for(var n=0;n=700||"bold"===n)&&(c="bold"),"italic"===n&&(c+="italic"),0===c.length&&(c="normal");for(var f="",d={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},p=0;p=2*Math.PI&&(r=0,i=2*Math.PI),this.path.push({type:"arc",x:t,y:e,radius:n,startAngle:r,endAngle:i,counterclockwise:a})},hZ.prototype.arcTo=function(t,e,n,r,i){throw Error("arcTo not implemented.")},hZ.prototype.rect=function(t,e,n,r){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r))throw so("jsPDF.context2d.rect: Invalid arguments",arguments),Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(t,e),this.lineTo(t+n,e),this.lineTo(t+n,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.lineTo(t+n,e),this.lineTo(t,e)},hZ.prototype.fillRect=function(t,e,n,r){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r))throw so("jsPDF.context2d.fillRect: Invalid arguments",arguments),Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!hQ.call(this)){var i={};"butt"!==this.lineCap&&(i.lineCap=this.lineCap,this.lineCap="butt"),"miter"!==this.lineJoin&&(i.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(t,e,n,r),this.fill(),i.hasOwnProperty("lineCap")&&(this.lineCap=i.lineCap),i.hasOwnProperty("lineJoin")&&(this.lineJoin=i.lineJoin)}},hZ.prototype.strokeRect=function(t,e,n,r){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r))throw so("jsPDF.context2d.strokeRect: Invalid arguments",arguments),Error("Invalid arguments passed to jsPDF.context2d.strokeRect");h1.call(this)||(this.beginPath(),this.rect(t,e,n,r),this.stroke())},hZ.prototype.clearRect=function(t,e,n,r){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r))throw so("jsPDF.context2d.clearRect: Invalid arguments",arguments),Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(t,e,n,r))},hZ.prototype.save=function(t){t="boolean"!=typeof t||t;for(var e=this.pdf.internal.getCurrentPageInfo().pageNumber,n=0;n0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0},hZ.prototype.drawImage=function(t,e,n,r,i,a,o,s,l){var h=this.pdf.getImageProperties(t),u=1,c=1,f=1,d=1;void 0!==r&&void 0!==s&&(f=s/r,d=l/i,u=h.width/r*s/r,c=h.height/i*l/i),void 0===a&&(a=e,o=n,e=0,n=0),void 0!==r&&void 0===s&&(s=r,l=i),void 0===r&&void 0===s&&(s=h.width,l=h.height);var p=this.ctx.transform.decompose(),g=uu(p.rotate.shx),m=new hV,v=(m=(m=(m=m.multiply(p.translate)).multiply(p.skew)).multiply(p.scale)).applyToRectangle(new hY(a-e*f,o-n*d,r*u,i*c));if(this.autoPaging){for(var b,y=h2.call(this,v),w=[],_=0;_x||Av||y0)){for(;l>=0;l--)if(!0!==i[l-1].close&&!0!==i[l-1].begin){i[l-1].deltas.push(n),i[l-1].abs.push(s);break}}break;case"bct":n=[s.x1-a[o-1].x,s.y1-a[o-1].y,s.x2-a[o-1].x,s.y2-a[o-1].y,s.x-a[o-1].x,s.y-a[o-1].y],i[i.length-1].deltas.push(n);break;case"qct":var h=a[o-1].x+2/3*(s.x1-a[o-1].x),u=a[o-1].y+2/3*(s.y1-a[o-1].y),c=s.x+2/3*(s.x1-s.x),f=s.y+2/3*(s.y1-s.y),d=s.x,p=s.y;n=[h-a[o-1].x,u-a[o-1].y,c-a[o-1].x,f-a[o-1].y,d-a[o-1].x,p-a[o-1].y],i[i.length-1].deltas.push(n);break;case"arc":i.push({deltas:[],abs:[],arc:!0}),Array.isArray(i[i.length-1].abs)&&i[i.length-1].abs.push(s)}}r=e?null:"stroke"===t?"stroke":"fill";for(var g=!1,m=0;m=.01&&(r=this.pdf.internal.getFontSize(),this.pdf.setFontSize(r*t.scale),i=this.lineWidth,this.lineWidth=i*t.scale);var C="text"!==this.autoPaging;if(C||S.y+S.h<=_){if(C||S.y>=y&&S.x<=N){var P=C?t.text:this.pdf.splitTextToSize(t.text,t.maxWidth||N-S.x)[0],E=h3([JSON.parse(JSON.stringify(c))],this.posX+this.margin[3],-L+y+this.ctx.prevPageLastElemOffset)[0],I=C&&(b>m||b=.01&&(this.pdf.setFontSize(r),this.lineWidth=i)}}else t.scale>=.01&&(r=this.pdf.internal.getFontSize(),this.pdf.setFontSize(r*t.scale),i=this.lineWidth,this.lineWidth=i*t.scale),this.pdf.text(t.text,l.x+this.posX,l.y+this.posY,{angle:t.angle,align:e,renderingMode:t.renderingMode,maxWidth:t.maxWidth}),t.scale>=.01&&(this.pdf.setFontSize(r),this.lineWidth=i)},ua=function(t,e,n,r){n=n||0,r=r||0,this.pdf.internal.out(hU(t+n)+" "+h$(e+r)+" l")},uo=function(t,e,n){return this.pdf.lines(t,e,n,null,null)},us=function(t,e,n,r,i,a,o,s){this.pdf.internal.out([hq(hH(n+t)),hq(hW(r+e)),hq(hH(i+t)),hq(hW(a+e)),hq(hH(o+t)),hq(hW(s+e)),"c"].join(" "))},ul=function(t,e,n,r){for(var i=2*Math.PI,a=Math.PI/2;e>n;)e-=i;var o=Math.abs(n-e);o1e-5;){var u=h+l*Math.min(o,a);s.push(uh.call(this,t,h,u)),o-=Math.abs(u-h),h=u}return s},uh=function(t,e,n){var r=(n-e)/2,i=t*Math.cos(r),a=t*Math.sin(r),o=-a,s=i*i+o*o,l=s+i*i+o*a,h=4/3*(Math.sqrt(2*s*l)-l)/(i*a-o*i),u=i-h*o,c=o+h*i,f=-c,d=r+e,p=Math.cos(d),g=Math.sin(d);return{x1:t*Math.cos(e),y1:t*Math.sin(e),x2:u*p-c*g,y2:u*g+c*p,x3:u*p-f*g,y3:u*g+f*p,x4:t*Math.cos(n),y4:t*Math.sin(n)}},uu=function(t){return 180*t/Math.PI},uc=function(t,e,n,r,i,a){var o=t+.5*(n-t),s=e+.5*(r-e),l=i+.5*(n-i),h=a+.5*(r-a),u=Math.min(t,i,o,l),c=Math.min(e,a,s,h);return new hY(u,c,Math.max(t,i,o,l)-u,Math.max(e,a,s,h)-c)},uf=function(t,e,n,r,i,a,o,s){var l,h,u,c,f,d,p,g,m,v,b,y,w,_,x=n-t,N=r-e,A=i-n,L=a-r,k=o-i,S=s-a;for(h=0;h<41;h++)m=(p=(u=t+(l=h/40)*x)+l*((f=n+l*A)-u))+l*(f+l*(i+l*k-f)-p),v=(g=(c=e+l*N)+l*((d=r+l*L)-c))+l*(d+l*(a+l*S-d)-g),0==h?(b=m,y=v,w=m,_=v):(b=Math.min(b,m),y=Math.min(y,v),w=Math.max(w,m),_=Math.max(_,v));return new hY(Math.round(b),Math.round(y),Math.round(w-b),Math.round(_-y))},ud=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var t=JSON.stringify({lineDash:this.ctx.lineDash,lineDashOffset:this.ctx.lineDashOffset});this.prevLineDash!==t&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=t)}},up=sB.API,ug=function(t){var e,n,r,i,a,o,s,l,h,u;for(/[^\x00-\xFF]/.test(t),n=[],r=0,i=(t+=e="\0\0\0\0".slice(t.length%4||4)).length;i>r;r+=4)0!==(a=(t.charCodeAt(r)<<24)+(t.charCodeAt(r+1)<<16)+(t.charCodeAt(r+2)<<8)+t.charCodeAt(r+3))?(o=(a=((a=((a=((a=(a-(u=a%85))/85)-(h=a%85))/85)-(l=a%85))/85)-(s=a%85))/85)%85,n.push(o+33,s+33,l+33,h+33,u+33)):n.push(122);return function(t,e){for(var n=e;n>0;n--)t.pop()}(n,e.length),String.fromCharCode.apply(String,n)+"~>"},um=function(t){var e,n,r,i,a,o=String,s="length",l="charCodeAt",h="slice",u="replace";for(t[h](-2),t=t[h](0,-2)[u](/\s/g,"")[u]("z","!!!!!"),r=[],i=0,a=(t+=e="uuuuu"[h](t[s]%5||5))[s];a>i;i+=5)n=0x31c84b1*(t[l](i)-33)+614125*(t[l](i+1)-33)+7225*(t[l](i+2)-33)+85*(t[l](i+3)-33)+(t[l](i+4)-33),r.push(255&n>>24,255&n>>16,255&n>>8,255&n);return function(t,e){for(var n=e;n>0;n--)t.pop()}(r,e[s]),o.fromCharCode.apply(o,r)},uv=function(t){var e=new RegExp(/^([0-9A-Fa-f]{2})+$/);if(-1!==(t=t.replace(/\s/g,"")).indexOf(">")&&(t=t.substr(0,t.indexOf(">"))),t.length%2&&(t+="0"),!1===e.test(t))return"";for(var n="",r=0;r",i.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":r=ub(r),i.push("/FlateDecode");break;default:throw Error('The filter: "'+e[n]+'" is not implemented')}return{data:r,reverseChain:i.reverse().join(" ")}},(uy=sB.API).loadFile=function(t,e,n){var r=e,i=n;r=!1!==r,i="function"==typeof i?i:function(){};var a=void 0;try{a=function(t,e,n){var r=new XMLHttpRequest,i=0,a=function(t){var e=t.length,n=[],r=String.fromCharCode;for(i=0;il&&(s=h,h=l,l=s);else{if("l"!==t&&"landscape"!==t)throw"Invalid orientation: "+t;t="l",l>h&&(s=h,h=l,l=s)}return{width:h,height:l,unit:e,k:i,orientation:t}},e.html=function(t,e){(e=e||{}).callback=e.callback||function(){},e.html2canvas=e.html2canvas||{},e.html2canvas.canvas=e.html2canvas.canvas||this.canvas,e.jsPDF=e.jsPDF||this,e.fontFaces=e.fontFaces?e.fontFaces.map(ly):null;var n=new s(e);return e.worker?n:n.from(t).doCallback()}}(sB.API),sB.API.addJS=function(t){return hw=t,this.internal.events.subscribe("postPutResources",function(){hb=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(hb+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),hy=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+hw+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){void 0!==hb&&void 0!==hy&&this.internal.out("/Names <>")}),this},(uw=sB.API).events.push(["postPutResources",function(){var t=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var e=this.outline.render().split(/\r\n/),n=0;n> endobj")}var u=this.internal.newObject();for(this.internal.write("<< /Names [ "),n=0;n>","endobj"),u_=this.internal.newObject(),this.internal.write("<< /Dests "+u+" 0 R"),this.internal.write(">>","endobj")}}]),uw.events.push(["putCatalog",function(){this.outline.root.children.length>0&&(this.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&this.internal.write("/Names "+u_+" 0 R"))}]),uw.events.push(["initialized",function(){var t=this;t.outline={createNamedDestinations:!1,root:{children:[]}},t.outline.add=function(t,e,n){var r={title:e,options:n,children:[]};return null==t&&(t=this.root),t.children.push(r),r},t.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=t,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},t.outline.genIds_r=function(e){e.id=t.internal.newObjectDeferred();for(var n=0;n0&&(this.line("/First "+this.makeRef(t.children[0])),this.line("/Last "+this.makeRef(t.children[t.children.length-1]))),this.line("/Count "+this.count_r({count:0},t)),this.objEnd()},t.outline.renderItems=function(e){for(var n=this.ctx.pdf.internal.getVerticalCoordinateString,r=0;r0&&this.line("/Prev "+this.makeRef(e.children[r-1])),r0&&(this.line("/First "+this.makeRef(i.children[0])),this.line("/Last "+this.makeRef(i.children[i.children.length-1])));var a=this.count=this.count_r({count:0},i);if(a>0&&this.line("/Count "+a),i.options&&i.options.pageNumber){var o=t.internal.getPageInfo(i.options.pageNumber);this.line("/Dest ["+o.objId+" 0 R /XYZ 0 "+n(0)+" 0]")}this.objEnd()}for(var s=0;s> \r\nendobj\r\n"},t.outline.count_r=function(t,e){for(var n=0;n1){o=!0,l=void 0;var b=e*n;h=new Uint8Array(b);for(var y=new DataView(r.buffer),w=0;w=0;t--){for(var r=this.bottom_up?t:this.height-1-t,i=0;i>7-s&1];this.data[o+4*s]=l.blue,this.data[o+4*s+1]=l.green,this.data[o+4*s+2]=l.red,this.data[o+4*s+3]=255}0!==n&&(this.pos+=4-n)}},hR.prototype.bit4=function(){for(var t=Math.ceil(this.width/2),e=t%4,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i>4,l=15&a,h=this.palette[s];if(this.data[o]=h.blue,this.data[o+1]=h.green,this.data[o+2]=h.red,this.data[o+3]=255,2*i+1>=this.width)break;h=this.palette[l],this.data[o+4]=h.blue,this.data[o+4+1]=h.green,this.data[o+4+2]=h.red,this.data[o+4+3]=255}0!==e&&(this.pos+=4-e)}},hR.prototype.bit8=function(){for(var t=this.width%4,e=this.height-1;e>=0;e--){for(var n=this.bottom_up?e:this.height-1-e,r=0;r=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i>5&e)/e*255|0,l=(a>>10&e)/e*255|0,h=a>>15?255:0,u=r*this.width*4+4*i;this.data[u]=l,this.data[u+1]=s,this.data[u+2]=o,this.data[u+3]=h}this.pos+=t}},hR.prototype.bit16=function(){for(var t=this.width%3,e=parseInt("11111",2),n=parseInt("111111",2),r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,a=0;a>5&n)/n*255|0,h=(o>>11)/e*255|0,u=i*this.width*4+4*a;this.data[u]=h,this.data[u+1]=l,this.data[u+2]=s,this.data[u+3]=255}this.pos+=t}},hR.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,n=0;n=0;t--)for(var e=this.bottom_up?t:this.height-1-t,n=0;nr&&(i.push(t.slice(l,a)),s=0,l=a),s+=e[a],a++;return l!==a&&i.push(t.slice(l,a)),i},hL=function(t,e,n){n||(n={});var r,i,a,o,s,l,h,u=[],c=[u],f=n.textIndent||0,d=0,p=0,g=t.split(" "),m=hx.apply(this,[" ",n])[0];if(l=-1===n.lineIndent?g[0].length+2:n.lineIndent||0){var v=Array(l).join(" "),b=[];g.map(function(t){(t=t.split(/\s*\n/)).length>1?b=b.concat(t.map(function(t,e){return(e&&t.length?"\n":"")+t})):b.push(t[0])}),g=b,l=hN.apply(this,[v,n])}for(a=0,o=g.length;ae||y){if(p>e){for(s=hA.apply(this,[r,i,e-(f+d),e]),u.push(s.shift()),u=[s.pop()];s.length;)c.push([s.shift()]);p=i.slice(r.length-(u[0]?u[0].length:0)).reduce(function(t,e){return t+e},0)}else u=[r];c.push(u),f=p+l,d=m}else u.push(r),f+=d+p,d=m}return h=l?function(t,e){return(e?v:"")+t.join(" ")}:function(t){return t.join(" ")},c.map(h)},h_.splitTextToSize=function(t,e,n){var r,i=(n=n||{}).fontSize||this.internal.getFontSize(),a=(function(t){if(t.widths&&t.kerning)return{widths:t.widths,kerning:t.kerning};var e=this.internal.getFont(t.fontName,t.fontStyle),n="Unicode";return e.metadata[n]?{widths:e.metadata[n].widths||{0:1},kerning:e.metadata[n].kerning||{}}:{font:e.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);r=Array.isArray(t)?t:String(t).split(/\r?\n/);var o=this.internal.scaleFactor*e/i;a.textIndent=n.textIndent?n.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=n.lineIndent;var s,l,h=[];for(s=0,l=r.length;sparseInt(this.internal.getFont().id.substr(1),10)?(e=RegExp(t,"g"),n=this.internal.getNumberOfPages()):(e=RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var i=0;i1){for(u=0;u>")}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},uC=sB.API,uP=function(){var t='',e=unescape(encodeURIComponent('')),n=unescape(encodeURIComponent(t)),r=unescape(encodeURIComponent(this.internal.__metadata__.metadata)),i=unescape(encodeURIComponent("")),a=unescape(encodeURIComponent("")),o=n.length+r.length+i.length+e.length+a.length;this.internal.__metadata__.metadata_object_number=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+o+" >>"),this.internal.write("stream"),this.internal.write(e+n+r+i+a),this.internal.write("endstream"),this.internal.write("endobj")},uE=function(){this.internal.__metadata__.metadata_object_number&&this.internal.write("/Metadata "+this.internal.__metadata__.metadata_object_number+" 0 R")},uC.addMetadata=function(t,e){return void 0===this.internal.__metadata__&&(this.internal.__metadata__={metadata:t,namespaceuri:e||"http://jspdf.default.namespaceuri/"},this.internal.events.subscribe("putCatalog",uE),this.internal.events.subscribe("postPutResources",uP)),this},uj=(uI=sB.API).pdfEscape16=function(t,e){for(var n,r=e.metadata.Unicode.widths,i=["","0","00","000","0000"],a=[""],o=0,s=t.length;o=100&&(a+="\n"+r.length+" beginbfchar\n"+r.join("\n")+"\nendbfchar",r=[]),void 0!==t[e]&&null!==t[e]&&"function"==typeof t[e].toString&&(i=("0000"+t[e].toString(16)).slice(-4),e=("0000"+(+e).toString(16)).slice(-4),r.push("<"+e+"><"+i+">"));return r.length&&(a+="\n"+r.length+" beginbfchar\n"+r.join("\n")+"\nendbfchar\n"),a+"endcmap\nCMapName currentdict /CMap defineresource pop\nend\nend"},uI.events.push(["putFont",function(t){!function(t){var e=t.font,n=t.out,r=t.newObject,i=t.putStream;if(e.metadata instanceof sB.API.TTFFont&&"Identity-H"===e.encoding){for(var a=e.metadata.Unicode.widths,o=e.metadata.subset.encode(e.metadata.glyIdsUsed,1),s="",l=0;l>"),n("endobj");var f=r();n("<<"),n("/Type /Font"),n("/BaseFont /"+sP(e.fontName)),n("/FontDescriptor "+c+" 0 R"),n("/W "+sB.API.PDFObject.convert(a)),n("/CIDToGIDMap /Identity"),n("/DW 1000"),n("/Subtype /CIDFontType2"),n("/CIDSystemInfo"),n("<<"),n("/Supplement 0"),n("/Registry (Adobe)"),n("/Ordering ("+e.encoding+")"),n(">>"),n(">>"),n("endobj"),e.objectNumber=r(),n("<<"),n("/Type /Font"),n("/Subtype /Type0"),n("/ToUnicode "+u+" 0 R"),n("/BaseFont /"+sP(e.fontName)),n("/Encoding /"+e.encoding),n("/DescendantFonts ["+f+" 0 R]"),n(">>"),n("endobj"),e.isAlreadyPutted=!0}}(t)}]),uI.events.push(["putFont",function(t){!function(t){var e=t.font,n=t.out,r=t.newObject,i=t.putStream;if(e.metadata instanceof sB.API.TTFFont&&"WinAnsiEncoding"===e.encoding){for(var a=e.metadata.rawData,o="",s=0;s>"),n("endobj"),e.objectNumber=r();for(var c=0;c>"),n("endobj"),e.isAlreadyPutted=!0}}(t)}]),uF=function(t){var e,n=t.text||"",r=t.x,i=t.y,a=t.options||{},o=t.mutex||{},s=o.pdfEscape,l=o.activeFontKey,h=o.fonts,u=l,c="",f=0,d="",p=h[u].encoding;if("Identity-H"!==h[u].encoding)return{text:n,x:r,y:i,options:a,mutex:o};for(d=n,u=l,Array.isArray(n)&&(d=n[0]),f=0;fd[f].charCodeAt(0)&&h[u].metadata.hasOwnProperty("Unicode")?c+=d[f]:c+="";var g="";return 14>parseInt(u.slice(1))||"WinAnsiEncoding"===p?g=s(c,u).split("").map(function(t){return t.charCodeAt(0).toString(16)}).join(""):"Identity-H"===p&&(g=uj(c,h[u])),o.isHex=!0,{text:g,x:r,y:i,options:a,mutex:o}},uI.events.push(["postProcessText",function(t){var e=t.text||"",n=[],r={text:e,x:t.x,y:t.y,options:t.options,mutex:t.mutex};if(Array.isArray(e)){var i=0;for(i=0;i","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],d=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),p=!1,g=0;this.__bidiEngine__={};var m=function(t){var e=t.charCodeAt(),n=e>>8,r=c[n];return void 0!==r?uT[256*r+(255&e)]:252===n||253===n?"AL":d.test(n)?"L":8===n?"R":"N"},v=function(t){for(var e,n=0;n=a.length||"EN"!==(l=o[s-1])&&"AN"!==l||"EN"!==(h=a[s+1])&&"AN"!==h?f="N":p&&(h="AN"),f=h===l?h:"N";break;case"ES":f="EN"===(l=s>0?o[s-1]:"B")&&s+10&&"EN"===o[s-1]){f="EN";break}if(p){f="N";break}for(u=s+1,c=a.length;u=1425&&d<=2303||64286===d)&&("R"===l||"AL"===l)){f="R";break}}}f=s<1||"B"===(l=a[s-1])?"N":o[s-1];break;case"B":p=!1,e=!0,f=g;break;case"S":n=!0,f="N"}return f},y=function(t,e,n){var r=t.split("");return n&&w(r,n,{hiLevel:g}),r.reverse(),e&&e.reverse(),r.join("")},w=function(t,r,i){var a,o,s,c,f,d=-1,v=t.length,y=0,w=[],_=g?h:l,x=[];for(p=!1,e=!1,n=!1,o=0;o0)if(16===a){for(o=d;o-1){for(o=d;o=0&&"WS"===t[i];i--)e[i]=g}}(x,r,v)},_=function(t,n,r,i,a){if(!(a.hiLevel=t){for(l=c+1;l=t;)l++;for(h=c,s=l-1;h=0&&(t[i]=f[r+1])}(r,n,i),_(2,r,e,n,i),_(1,r,e,n,i),r.join("")};return this.__bidiEngine__.doBidiReorder=function(t,e,n){if(function(t,e){if(e)for(var n=0;n>16)&&(e=-(1+(65535^e))),this.italicAngle=+(e+"."+n)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=1===(i=this.familyClass)||2===i||3===i||4===i||5===i||7===i,this.isScript=10===this.familyClass,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),0!==this.italicAngle&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw Error("No unicode cmap for font")},t.prototype.characterToGlyph=function(t){var e;return(null!=(e=this.cmap.unicode)?e.codeMap[t]:void 0)||0},t.prototype.widthOfGlyph=function(t){var e;return e=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*e},t.prototype.widthOfString=function(t,e,n){var r,i,a,o;for(a=0,i=0,o=(t=""+t).length;0<=o?io;i=0<=o?++i:--i)r=t.charCodeAt(i),a+=this.widthOfGlyph(this.characterToGlyph(r))+1e3/e*n||0;return e/1e3*a},t.prototype.lineHeight=function(t,e){var n;return null==e&&(e=!1),n=e?this.lineGap:0,(this.ascender+n-this.decender)/1e3*t},t}();var hz,hq,hU,h$,hH,hW,hX,hY,hV,hG,hJ,hZ,hK,hQ,h1,h0,h2,h5,h3,h4,h6,h8,h7,h9,ut,ue,un,ur,ui,ua,uo,us,ul,uh,uu,uc,uf,ud,up,ug,um,uv,ub,uy,uw,u_,ux,uN,uA,uL,uk,uS,uC,uP,uE,uI,uj,uM,uF,uB,uO,uT,uR,uD,uz=function(){function t(t){this.data=null!=t?t:[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(t){return this.data[this.pos++]=t},t.prototype.readUInt32=function(){return 0x1000000*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},t.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=0x80000000?t-0x100000000:t},t.prototype.writeInt32=function(t){return t<0&&(t+=0x100000000),this.writeUInt32(t)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},t.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},t.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},t.prototype.readString=function(t){var e,n;for(n=[],e=0;0<=t?et;e=0<=t?++e:--e)n[e]=String.fromCharCode(this.readByte());return n.join("")},t.prototype.writeString=function(t){var e,n,r;for(r=[],e=0,n=t.length;0<=n?en;e=0<=n?++e:--e)r.push(this.writeByte(t.charCodeAt(e)));return r},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(t){return this.writeInt16(t)},t.prototype.readLongLong=function(){var t,e,n,r,i,a,o,s;return t=this.readByte(),e=this.readByte(),n=this.readByte(),r=this.readByte(),i=this.readByte(),a=this.readByte(),o=this.readByte(),s=this.readByte(),128&t?-1*(0x100000000000000*(255^t)+0x1000000000000*(255^e)+0x10000000000*(255^n)+0x100000000*(255^r)+0x1000000*(255^i)+65536*(255^a)+256*(255^o)+(255^s)+1):0x100000000000000*t+0x1000000000000*e+0x10000000000*n+0x100000000*r+0x1000000*i+65536*a+256*o+s},t.prototype.writeLongLong=function(t){var e,n;return e=Math.floor(t/0x100000000),n=0|t,this.writeByte(e>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e),this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(t){return this.writeInt32(t)},t.prototype.read=function(t){var e,n;for(e=[],n=0;0<=t?nt;n=0<=t?++n:--n)e.push(this.readByte());return e},t.prototype.write=function(t){var e,n,r,i;for(i=[],n=0,r=t.length;nr;n=0<=r?++n:--n)e={tag:t.readString(4),checksum:t.readInt(),offset:t.readInt(),length:t.readInt()},this.tables[e.tag]=e}return e.prototype.encode=function(e){var n,r,i,a,o,s,l,h,u,c,f,d,p;for(p in a=Math.floor((u=16*Math.floor(Math.log(f=Object.keys(e).length)/(s=Math.log(2))))/s),h=16*f-u,(r=new uz).writeInt(this.scalarType),r.writeShort(f),r.writeShort(u),r.writeShort(a),r.writeShort(h),i=16*f,l=r.pos+i,o=null,d=[],e)for(c=e[p],r.writeString(p),r.writeInt(t(c)),r.writeInt(l),r.writeInt(c.length),d=d.concat(c),"head"===p&&(o=l),l+=c.length;l%4;)d.push(0),l++;return r.write(d),n=0xb1b0afba-t(r.data),r.pos=o+8,r.writeUInt32(n),r.data},t=function(t){var e,n,r,i;for(t=u1.call(t);t.length%4;)t.push(0);for(r=new uz(t),n=0,e=0,i=t.length;ec;s=0<=c?++e:--e)n.push(t.readUInt16());return n}(),t.pos+=2,d=function(){var e,n;for(n=[],s=e=0;0<=c?ec;s=0<=c?++e:--e)n.push(t.readUInt16());return n}(),l=function(){var e,n;for(n=[],s=e=0;0<=c?ec;s=0<=c?++e:--e)n.push(t.readUInt16());return n}(),h=function(){var e,n;for(n=[],s=e=0;0<=c?ec;s=0<=c?++e:--e)n.push(t.readUInt16());return n}(),r=(this.length-t.pos+this.offset)/2,o=function(){var e,n;for(n=[],s=e=0;0<=r?er;s=0<=r?++e:--e)n.push(t.readUInt16());return n}(),s=g=0,v=i.length;g=p;n=f<=p?++m:--m)0===h[s]?a=n+l[s]:0!==(a=o[h[s]/2+(n-f)-(c-s)]||0)&&(a+=l[s]),this.codeMap[n]=65535&a}t.pos=u}return t.encode=function(t,e){var n,r,i,a,o,s,l,h,u,c,f,d,p,g,m,v,b,y,w,_,x,N,A,L,k,S,C,P,E,I,j,M,F,B,O,T,R,D,z,q,U,$,H,W,X,Y;switch(P=new uz,a=Object.keys(t).sort(function(t,e){return t-e}),e){case"macroman":for(p=0,g=function(){var t=[];for(d=0;d<256;++d)t.push(0);return t}(),v={0:0},i={},E=0,F=a.length;E=32768)for(s.push(0),_.push(2*(f.length+A-d)),r=M=k;k<=h?M<=h:M>=h;r=k<=h?++M:--M)f.push(n[r].new);else s.push(C-k),_.push(0)}for(P.writeUInt16(3),P.writeUInt16(1),P.writeUInt32(12),P.writeUInt16(4),P.writeUInt16(16+8*A+2*f.length),P.writeUInt16(0),P.writeUInt16(L),P.writeUInt16(N),P.writeUInt16(c),P.writeUInt16(x),U=0,T=u.length;Ur;n=0<=r?++n:--n)e=new uW(t,this.offset),this.tables.push(e),e.isUnicode&&null==this.unicode&&(this.unicode=e);return!0},t.encode=function(t,e){var n,r;return null==e&&(e="macroman"),n=uW.encode(t,e),(r=new uz).writeUInt16(0),r.writeUInt16(1),n.table=r.data.concat(n.subtable),n},t}(),uY=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return u$(t,uD),t.prototype.tag="hhea",t.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},t}(),uV=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return u$(t,uD),t.prototype.tag="OS/2",t.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=function(){var e,n;for(n=[],e=0;e<10;++e)n.push(t.readByte());return n}(),this.charRange=function(){var e,n;for(n=[],e=0;e<4;++e)n.push(t.readInt());return n}(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=function(){var e,n;for(n=[],e=0;e<2;e=++e)n.push(t.readInt());return n}(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},t}(),uG=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return u$(t,uD),t.prototype.tag="post",t.prototype.parse=function(t){var e,n,r,i;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:for(n=t.readUInt16(),this.glyphNameIndex=[],i=0;0<=n?in;i=0<=n?++i:--i)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],r=[];t.posn;i=0<=n?++e:--e)r.push(t.readUInt32());return r}).call(this)}},t}(),uJ=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},uZ=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return u$(t,uD),t.prototype.tag="name",t.prototype.parse=function(t){var e,n,r,i,a,o,s,l,h,u;for(t.pos=this.offset,t.readShort(),e=t.readShort(),o=t.readShort(),n=[],i=0;0<=e?ie;i=0<=e?++i:--i)n.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+o+t.readShort()});for(s={},i=l=0,h=n.length;lo;e=0<=o?++e:--e)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(r=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var n,i;for(i=[],e=n=0;0<=r?nr;e=0<=r?++n:--n)i.push(t.readInt16());return i}(),this.widths=(function(){var t,e,n,r;for(r=[],t=0,e=(n=this.metrics).length;tr;e=0<=r?++a:--a)s.push(this.widths.push(n));return s},t.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},t}(),u1=[].slice,u0=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return u$(t,uD),t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(t){var e,n,r,i,a,o,s,l,h,u;return t in this.cache?this.cache[t]:(i=this.file.loca,e=this.file.contents,n=i.indexOf(t),0===(r=i.lengthOf(t))?this.cache[t]=null:(e.pos=this.offset+n,a=(o=new uz(e.read(r))).readShort(),l=o.readShort(),u=o.readShort(),s=o.readShort(),h=o.readShort(),this.cache[t]=-1===a?new u5(o,l,u,s,h):new u2(o,a,l,u,s,h),this.cache[t]))},t.prototype.encode=function(t,e,n){var r,i,a,o,s;for(a=[],i=[],o=0,s=e.length;o0&&(r+=s)}for(var l=Array(4*n.length),h=0;h>8,l[4*h+1]=(0xff0000&n[h])>>16,l[4*h]=(0xff000000&n[h])>>24;return l},t}(),u4=function(){function t(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var t,e,n,r,i;for(e in r=this.font.cmap.tables[0].codeMap,t={},i=this.subset)n=i[e],t[e]=r[n];return t},t.prototype.glyphsFor=function(t){var e,n,r,i,a,o,s;for(r={},a=0,o=t.length;a0)for(i in s=this.glyphsFor(e))n=s[i],r[i]=n;return r},t.prototype.encode=function(t,e){var n,r,i,a,o,s,l,h,u,c,f,d,p,g,m;for(r in n=uX.encode(this.generateCmap(),"unicode"),a=this.glyphsFor(t),f={0:0},m=n.charMap)f[(s=m[r]).old]=s.new;for(d in c=n.maxGlyphID,a)d in f||(f[d]=c++);return u=Object.keys(h=function(t){var e,n;for(e in n={},t)n[t[e]]=e;return n}(f)).sort(function(t,e){return t-e}),p=function(){var t,e,n;for(n=[],t=0,e=u.length;t>"),a.join("\n")}return""+n},e}();let u6=(0,u.forwardRef)(({members:t,rootId:e,onMemberClick:n,onExport:r,relationMode:i=!1,selectedMembers:a=[]},o)=>{console.log("D3OrgChartFlow render, selectedMembers:",a,"relationMode:",i);let l=(0,u.useRef)(null),h=(0,u.useRef)(null),[f,d]=(0,u.useState)(!1),[p,g]=(0,u.useState)(new Map);(0,u.useEffect)(()=>((async()=>{let e=new Map;for(let n of Object.values(t))if(n.avatarImageId)try{let t=await c.db.images.get(n.avatarImageId);if(t){let r=URL.createObjectURL(t.blob);e.set(n.avatarImageId,r)}}catch(t){console.error(`Failed to load avatar for ${n.fullName}:`,t)}g(e)})(),()=>{p.forEach(t=>URL.revokeObjectURL(t))}),[t]),(0,u.useEffect)(()=>{if(!l.current||!e)return;l.current&&(l.current.innerHTML="");let r=(()=>{let n=[];if(!t[e])return[];let r=new Set,i=[e];for(;i.length>0;){let a=i.shift();if(r.has(a))continue;r.add(a);let o=t[a];if(!o)continue;let s=o.spouseIds?.map(e=>t[e]).filter(Boolean)||[],l=null;if(a!==e){let e=o.fatherId?t[o.fatherId]:null,n=o.motherId?t[o.motherId]:null,r=e&&o.surname===e.surname,i=n&&o.surname===n.surname;r?l=o.fatherId||null:i?l=o.motherId||null:e?l=o.fatherId||null:n&&(l=o.motherId||null)}let h=function(t,e){if(!t)return null;let n=new Date(t),r=e?new Date(e):new Date,i=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return(a<0||0===a&&r.getDate()0?s.map(t=>t.fullName).join(", "):"",spouseId:s.length>0?s[0].id:null,hasChildren:Object.values(t).some(t=>t.fatherId===o.id||t.motherId===o.id),ageText:u}),Object.values(t).forEach(t=>{t.fatherId!==a&&t.motherId!==a||r.has(t.id)||i.push(t.id)})}return n})(),i=new n$().container(l.current).data(r).nodeWidth(()=>160).nodeHeight(()=>120).childrenMargin(()=>50).compactMarginBetween(()=>35).compactMarginPair(()=>35).neighbourMargin(()=>35).siblingsMargin(()=>35).linkUpdate(function(t,e,n){tp(n[e]).attr("stroke","#475569").attr("stroke-width",2.5)}).buttonContent(({node:t})=>`
${t.children?'':''} ${t.data._directSubordinates||0}
`).nodeContent(t=>{let e=t.data,n="男"===e.gender?"#3b82f6":"#ec4899",r="男"===e.gender?"#dbeafe":"#fce7f3",i=e.avatarImageId?p.get(e.avatarImageId):null,o=a.includes(e.id);return`
${i?`${e.name}`:(e.gender,'')}
${e.name} ${o?'':""}
${e.generation}
${e.birthYear?`
${e.birthYear}${e.deathYear?` - ${e.deathYear}`:""} ${e.ageText?`${e.ageText}`:""}
`:""} ${e.birthPlace?`
${e.birthPlace}
`:""}
${e.spouseName&&e.spouseId?`
配偶: ${e.spouseName}
`:""} ${e.deathYear?`
`:""}
`}).onNodeClick(t=>{if(n&&t){let e="string"==typeof t?t:t.data?.id||t.id;e&&n(e)}}).render().expandAll();return setTimeout(()=>{let t=l.current?.querySelectorAll(".spouse-area");t?.forEach(t=>{t.addEventListener("click",e=>{e.stopPropagation();let r=t.getAttribute("data-spouse-id");r&&n&&n(r)})})},100),h.current=i,d(!0),()=>{l.current&&(l.current.innerHTML="")}},[t,e,n,p]);let m=()=>{h.current&&h.current.exportImg({save:!0,full:!0,onLoad:()=>{r?.()}})},v=()=>{h.current&&h.current.exportImg({save:!1,full:!0,onLoad:t=>{let e=new sB({orientation:"landscape",unit:"px",format:"a4"}),n=new Image;n.src=t,n.onload=function(){let t=n.width,i=n.height,a=e.internal.pageSize.getWidth(),o=e.internal.pageSize.getHeight(),s=Math.min(a/t,o/i),l=t*s,h=i*s;e.addImage(n,"PNG",(a-l)/2,(o-h)/2,l,h),e.save(`家谱图-${new Date().toISOString().split("T")[0]}.pdf`),r?.()}}})},b=()=>{h.current&&h.current.expandAll()},y=()=>{h.current&&h.current.collapseAll()},w=()=>{h.current&&h.current.fit()};return(0,u.useImperativeHandle)(o,()=>({exportPNG:m,exportPDF:v,expandAll:b,collapseAll:y,fitView:w})),(0,s.jsx)("div",{className:"w-full h-full bg-background rounded-lg border relative",children:(0,s.jsx)("div",{ref:l,className:"w-full h-full",style:{overflow:"hidden"}})},`d3-chart-${e}`)});u6.displayName="D3OrgChartFlow";let u8=(0,u.memo)(u6,(t,e)=>t.rootId===e.rootId&&t.members===e.members);var u7=t.i(60207),u9=t.i(9991),ct=t.i(99495),ce=t.i(90432),cn=t.i(90672),cr=t.i(78657);let ci=(0,g.default)("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),ca=(0,g.default)("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);var co=t.i(42864);let cs=(0,g.default)("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var cl=t.i(49515),ch=t.i(43359),cu=t.i(32301);function cc(){let{treeData:e}=(0,w.useFamily)(),{calculateRelationship:n}=(0,u7.useRelationship)(),r=(0,_.useRouter)(),i=(0,_.useSearchParams)(),[a,o]=(0,u.useState)("traditional"),[h,c]=(0,u.useState)(!1),[f,d]=(0,u.useState)([]),[p,g]=(0,u.useState)(null),[m,v]=(0,u.useState)(!1),b=(0,u.useRef)(h),y=(0,u.useRef)(f);(0,u.useEffect)(()=>{b.current=h,y.current=f},[h,f]),(0,u.useEffect)(()=>{let t=i.get("view");("d3-org-chart"===t||"traditional"===t)&&o(t)},[i]);let[N,A]=(0,u.useState)(1),[L,k]=(0,u.useState)({x:0,y:0}),[S,C]=(0,u.useState)(!1),[P,E]=(0,u.useState)({x:0,y:0}),[I,j]=(0,u.useState)({x:0,y:0}),M=(0,u.useRef)(null),F=(0,u.useRef)(null),B=()=>{C(!1)},O=(0,u.useCallback)(t=>{if(console.log("D3 onMemberClick triggered:",t,"relationMode:",b.current),b.current){console.log("Calling handleMemberClick");let r=(t,e)=>{let n=document.querySelector(".w-full.h-full.bg-background.rounded-lg.border"),r=n?.querySelector("svg");r&&r.querySelectorAll("foreignObject").forEach(n=>{let r=n.parentNode?.__data__?.data;if(r?.id===t){let t=n.querySelector('div[style*="font-size: 13px"]');if(t)if(e)t.querySelector("svg")||(t.style.display="flex",t.style.alignItems="center",t.insertAdjacentHTML("beforeend",''));else{let e=t.querySelector("svg");e&&e.remove()}}})};if(0===y.current.length)r(t,!0),d([t]);else if(1===y.current.length){let[i]=y.current;if(i===t){r(t,!1),d([]);return}r(t,!0);let a=n(i,t);g({from:e.members[i],to:e.members[t],relationship:a}),v(!0),d([]),c(!1)}}else console.log("Navigating to member detail"),r.push(`/members/${t}`)},[r,n,e.members]),T=async()=>{if(M.current)try{let e={...L};k({x:0,y:0}),A(1),await new Promise(t=>setTimeout(t,800));let n=M.current.querySelector('div[style*="transform"]');if(!n)throw Error("找不到族谱容器");let r=n.querySelectorAll("div"),i=[];r.forEach(t=>{String(t.className||"").includes("bg-foreground")&&i.push(t)});let a=n.cloneNode(!0),o=a.querySelectorAll("div"),s=0;o.forEach(t=>{if(String(t.className||"").includes("bg-foreground")&&i[s]){let e=i[s],n=window.getComputedStyle(e);t.style.backgroundColor=n.backgroundColor,t.style.width=n.width,t.style.height=n.height,t.style.position="absolute",t.style.left=n.left,t.style.top=n.top,s++}}),a.querySelectorAll("*").forEach(t=>{let e=String(t.className||"");e.includes("bg-foreground")||e.includes("pointer-events-none")||(t.style.border="none",t.style.outline="none")}),a.style.position="fixed",a.style.left="-9999px",a.style.top="0",document.body.appendChild(a),await new Promise(t=>setTimeout(t,200));let l=await t.A(91205),h=await l.default.toBlob(a,{quality:.95,bgcolor:"#ffffff"});document.body.removeChild(a),k(e),A(N);let u=URL.createObjectURL(h),c=document.createElement("a");c.download=`family-tree-${new Date().toISOString().split("T")[0]}.png`,c.href=u,c.click(),setTimeout(()=>URL.revokeObjectURL(u),100)}catch(t){console.error("导出图片失败:",t)}};return e.rootId?(0,s.jsxs)("div",{className:"h-screen flex flex-col bg-muted/30 overflow-hidden",children:[(0,s.jsx)(l.SiteHeader,{}),(0,s.jsxs)("div",{className:"absolute top-20 right-4 z-30 flex gap-2",children:[(0,s.jsxs)(u9.Button,{variant:h?"default":"outline",className:"gap-2 shadow-lg",onClick:()=>{c(!h),d([]),g(null)},children:[(0,s.jsx)(ch.Users,{className:"h-4 w-4"}),h?0===f.length?"选择第一个成员":"选择第二个成员":"关系查询"]}),(0,s.jsxs)(ct.DropdownMenu,{children:[(0,s.jsx)(ct.DropdownMenuTrigger,{asChild:!0,children:(0,s.jsxs)(u9.Button,{variant:"outline",className:"gap-2 shadow-lg",children:[(0,s.jsx)(cs,{className:"h-4 w-4"}),"traditional"===a?"传统视图":"D3家谱图",(0,s.jsx)(cl.ChevronDown,{className:"h-3 w-3"})]})}),(0,s.jsxs)(ct.DropdownMenuContent,{align:"end",className:"w-48",children:[(0,s.jsx)(ct.DropdownMenuItem,{onClick:()=>{let t=new URLSearchParams(i.toString());t.set("view","traditional"),r.push(`/tree?${t.toString()}`)},className:"traditional"===a?"bg-accent":"",children:(0,s.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,s.jsx)("span",{children:"传统家谱视图"}),"traditional"===a&&(0,s.jsx)("span",{className:"text-primary",children:"✓"})]})}),(0,s.jsx)(ct.DropdownMenuItem,{onClick:()=>{let t=new URLSearchParams(i.toString());t.set("view","d3-org-chart"),r.push(`/tree?${t.toString()}`)},className:"d3-org-chart"===a?"bg-accent":"",children:(0,s.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,s.jsx)("span",{children:"D3 家谱图"}),"d3-org-chart"===a&&(0,s.jsx)("span",{className:"text-primary",children:"✓"})]})})]})]})]}),"traditional"===a?(0,s.jsxs)("div",{className:"flex-1 relative",children:[(0,s.jsxs)("div",{className:"absolute top-4 left-4 z-20 flex flex-col gap-2 bg-background/80 backdrop-blur p-2 rounded-lg border shadow-sm",children:[(0,s.jsx)(u9.Button,{variant:"outline",size:"icon",onClick:()=>A(t=>Math.min(t+.1,2)),children:(0,s.jsx)(cr.ZoomIn,{className:"h-4 w-4"})}),(0,s.jsx)(u9.Button,{variant:"outline",size:"icon",onClick:()=>A(t=>Math.max(t-.1,.1)),children:(0,s.jsx)(ci,{className:"h-4 w-4"})}),(0,s.jsx)(u9.Button,{variant:"outline",size:"icon",onClick:()=>k({x:0,y:0}),children:(0,s.jsx)(ca,{className:"h-4 w-4"})}),(0,s.jsx)("div",{className:"h-px bg-border my-1"}),(0,s.jsx)(u9.Button,{variant:"outline",size:"icon",onClick:T,title:"导出为图片",children:(0,s.jsx)(co.Download,{className:"h-4 w-4"})})]}),(0,s.jsx)("div",{ref:M,className:"w-full h-full overflow-hidden cursor-move relative touch-none bg-[url('https://www.transparenttextures.com/patterns/rice-paper.png')] bg-repeat select-none",onMouseDown:t=>{t.target.closest(".family-node-card")||(C(!0),E({x:t.clientX-L.x,y:t.clientY-L.y}),j({x:t.clientX,y:t.clientY}))},onMouseMove:t=>{if(!S)return;let e=Math.abs(t.clientX-I.x),n=Math.abs(t.clientY-I.y);e<5&&n<5||k({x:t.clientX-P.x,y:t.clientY-P.y})},onMouseUp:B,onMouseLeave:B,children:(0,s.jsx)("div",{style:{transform:`translate(${L.x}px, ${L.y}px) scale(${N})`,transformOrigin:"top center",transition:S?"none":"transform 0.1s ease-out"},className:"absolute min-w-full min-h-full flex justify-center pt-20 pb-20",children:(0,s.jsx)(x,{rootId:e.rootId,relationMode:h,selectedMembers:f,onMemberClick:t=>{if(0===f.length)d([t]);else if(1===f.length){let[r]=f;if(r===t)return void d([]);let i=n(r,t);g({from:e.members[r],to:e.members[t],relationship:i}),v(!0),d([]),c(!1)}}})})})]}):(0,s.jsxs)("div",{className:"flex-1 relative",children:[(0,s.jsxs)("div",{className:"absolute top-4 left-4 z-20 flex flex-col gap-2 bg-background/80 backdrop-blur p-2 rounded-lg border shadow-sm",children:[(0,s.jsx)(u9.Button,{variant:"outline",size:"icon",onClick:()=>F.current?.expandAll(),title:"展开全部",children:(0,s.jsx)(cr.ZoomIn,{className:"h-4 w-4"})}),(0,s.jsx)(u9.Button,{variant:"outline",size:"icon",onClick:()=>F.current?.collapseAll(),title:"折叠全部",children:(0,s.jsx)(ci,{className:"h-4 w-4"})}),(0,s.jsx)(u9.Button,{variant:"outline",size:"icon",onClick:()=>F.current?.fitView(),title:"适应视图",children:(0,s.jsx)(ca,{className:"h-4 w-4"})}),(0,s.jsx)("div",{className:"h-px bg-border my-1"}),(0,s.jsx)(u9.Button,{variant:"outline",size:"icon",onClick:()=>F.current?.exportPNG(),title:"导出PNG",children:(0,s.jsx)(co.Download,{className:"h-4 w-4"})})]}),(0,s.jsx)("div",{className:"w-full h-full p-4",children:(0,s.jsx)(u8,{ref:F,members:e.members,rootId:e.rootId,relationMode:h,selectedMembers:f,onMemberClick:O})})]}),(0,s.jsx)(ce.Dialog,{open:m,onOpenChange:t=>{if(v(t),!t&&p){let t=t=>{let e=document.querySelector(".w-full.h-full.bg-background.rounded-lg.border"),n=e?.querySelector("svg");n&&n.querySelectorAll("foreignObject").forEach(e=>{let n=e.parentNode?.__data__?.data;if(n?.id===t){let t=e.querySelector('div[style*="font-size: 13px"]');if(t){let e=t.querySelector("svg");e&&e.remove()}}})};t(p.from.id),t(p.to.id)}},children:(0,s.jsxs)(ce.DialogContent,{className:"max-w-2xl","aria-describedby":"relation-description",children:[(0,s.jsx)(ce.DialogHeader,{children:(0,s.jsx)(ce.DialogTitle,{children:"关系查询结果"})}),p&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-center gap-4 p-6 bg-muted rounded-lg",children:[(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"text-2xl font-bold font-serif mb-1",children:p.from.fullName}),(0,s.jsxs)("div",{className:"text-sm text-muted-foreground",children:["第",p.from.generation,"世"]})]}),(0,s.jsx)("div",{className:"flex flex-col items-center gap-2",children:(0,s.jsx)(cn.Badge,{variant:"default",className:"text-lg px-4 py-2",children:p.relationship.term})}),(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"text-2xl font-bold font-serif mb-1",children:p.to.fullName}),(0,s.jsxs)("div",{className:"text-sm text-muted-foreground",children:["第",p.to.generation,"世"]})]})]}),(0,s.jsxs)("div",{id:"relation-description",className:"p-4 bg-blue-50 dark:bg-blue-950 rounded-lg",children:[(0,s.jsx)("div",{className:"text-sm font-medium mb-1",children:"关系说明:"}),(0,s.jsxs)("div",{className:"text-muted-foreground",children:[(0,s.jsx)("strong",{children:p.from.fullName})," 是 ",(0,s.jsx)("strong",{children:p.to.fullName})," 的 ",(0,s.jsx)("strong",{className:"text-primary",children:p.relationship.term})]})]}),p.relationship.path&&(0,s.jsxs)("div",{className:"p-4 bg-muted rounded-lg",children:[(0,s.jsx)("div",{className:"text-sm font-medium mb-2",children:"关系路径:"}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground break-all",children:p.relationship.path})]})]})]})})]}):(0,s.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,s.jsx)(l.SiteHeader,{}),(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,s.jsxs)("div",{className:"text-center space-y-4",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 text-primary/80",children:(0,s.jsx)(cu.Network,{className:"h-16 w-16",strokeWidth:1})}),(0,s.jsx)("p",{className:"text-base text-foreground font-light tracking-wide",children:"谱系待续"})]})})]})}t.s(["default",()=>cc],85398)}]);