"use strict";const t=require("../../../../common/vendor.js");var e=function(){return e=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function R(t){return"number"==typeof t}function F(t){return"auto"===t||null===t}function A(t){return/%$/.test(t)}var j=u,E=f,C=l,H=p,$=v,Y=y,D=x;function U(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function N(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o0;)"("===t[a+=1]&&(s+=1),")"===t[a]&&(s-=1);n="".concat(N(t.slice(o+1,a))),o=a}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var h=parseFloat(n);switch(i){case"+":e.push(h);break;case"-":e.push(-h);break;case"*":e.push(e.pop()*h);break;case"/":e.push(e.pop()/h)}i=t[o],n=""}}for(var c=0;e.length;)c+=e.pop();return c}var X,_=0,q=function(){function t(){W(this,"elements",[]),W(this,"afterElements",[]),W(this,"beforeElements",[]),W(this,"ids",[]),W(this,"width",0),W(this,"height",0),W(this,"top",0),W(this,"left",0),W(this,"pre",null),W(this,"offsetX",0),W(this,"offsetY",0),_++,this.id=_}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth&&(this.closeLine(),1))},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0)1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return"flex-end"===e?n:"center"===e?n/2:"stretch"===e?(n&&t.name==l&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(q),J=u,Q=f,Z=l,K=g,et=v,it="flex",nt=y,rt=x,ot=0,st={left:null,top:null,width:null,height:null},at=new Map,ht=function(){function t(t,e,i,n){var r=this;W(this,"id",ot++),W(this,"style",{left:null,top:null,width:null,height:null}),W(this,"computedStyle",{}),W(this,"originStyle",{}),W(this,"children",{}),W(this,"layoutBox",P({},st)),W(this,"contentSize",P({},st)),W(this,"clientSize",P({},st)),W(this,"borderSize",P({},st)),W(this,"offsetSize",P({},st)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var s=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],r=t.type,s=void 0===r?C:r,a=t.styles,h=void 0===a?{}:a,c=(e||{}).computedStyle,d=Object.assign({},b);if([E,j,H].includes(s)&&!h.display&&(d.display=$),c)for(var l=0;l=0&&l<0,Y=c>=0&&u<0;return i==h[0]&&(this[i].left=t.left+s+v+E+($?2*-l:0),this[i].top=t.top+c+x+W+(Y?2*-u:0),this[i].width=t.width+(this[i].widthAdd?0:C),this[i].height=t.height+(this[i].heightAdd?0:H),this[i].widthAdd=C,this[i].heightAdd=H),i==h[1]&&(this[i].left=t.left+s+E+($<0?-l:0),this[i].top=t.top+c+W+(Y?-u:0),this[i].width=t.width+v+w,this[i].height=t.height+x+S),i==h[2]&&(this[i].left=t.left+s+E/2+($<0?-l:0),this[i].top=t.top+c+W/2+(Y?-u:0),this[i].width=t.width+v+w+E/2+F/2,this[i].height=t.height+x+S+T/2+W/2),i==h[3]&&(this[i].left=t.left+($<0?-l:0),this[i].top=t.top+(Y?-u:0),this[i].width=t.width+v+w+E+F+s+l,this[i].height=t.height+x+S+T+W+u+c),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,a=(s=void 0===s?{}:s).borderWidth,c=void 0===a?0:a,d=o.borderTop,l=(d=void 0===d?{}:d).borderTopWidth,f=void 0===l?c:l,u=o.borderBottom,p=(u=void 0===u?{}:u).borderBottomWidth,g=void 0===p?c:p,v=o.borderRight,y=(v=void 0===v?{}:v).borderRightWidth,x=void 0===y?c:y,b=o.borderLeft,w=(b=void 0===b?{}:b).borderLeftWidth,m=void 0===w?c:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,k=void 0===M?0:M,B=S.paddingBottom,W=void 0===B?0:B,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+k+x+m),1!==i||n||(t.height-=I+W+f+g)}this.layoutBox&&(h.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,a=P({},this.contentSize,{left:r,top:s}),h=this.contentSize.top-this.offsetSize.top,c=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var d,l=L(this.root.fixedLine.elements);!(d=l()).done;){var f=d.value;f.setPosition(f,this.root.offsetSize),f.getBoxPosition()}}if(e)for(var u,p=L(e.elements);!(u=p()).done;){var g=u.value,v=P({},this.borderSize,{left:r,top:s});g.setPosition(g,v);var y=this.borderSize.top-this.offsetSize.top,x=this.borderSize.left-this.offsetSize.left;g.style.left+=r+x,g.style.top+=s+y,g.getBoxPosition()}if(i)for(var b,w=L(i);!(b=w()).done;)b.value.layout(a.top+h,a.left+c);return this.layoutBoxUpdate(a,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==K},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==it},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&!!t.parent&&(!(!t.parent||t.parent.style.display!==it)||void 0)},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==et},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,a=this.getChildren(),h=i.left,c=void 0===h?0:h,d=i.top,l=void 0===d?0:d,f=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,x=i.minHeight,b=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,k=i.fontStyle,B=i.position;i.textIndent;var W=i.lineClamp,P=i.lineHeight,O=i.padding,T=void 0===O?{}:O,L=i.margin,R=void 0===L?{}:L,j=i.border,E=(j=void 0===j?{}:j).borderWidth,C=void 0===E?0:E,H=i.borderRight,$=(H=void 0===H?{}:H).borderRightWidth,Y=void 0===$?C:$,D=i.borderLeft,U=(D=void 0===D?{}:D).borderLeftWidth,N=void 0===U?C:U,X=o.contentSize&&o.contentSize.width,_=o.contentSize&&o.contentSize.height;if(A(g)&&X&&(g=M(g,X)),A(g)&&!X&&(g=null),A(m)&&_&&(m=M(m,_)),A(m)&&!_&&(m=null),A(v)&&X&&(v=M(v,X)),A(y)&&X&&(y=M(y,X)),A(x)&&_&&(x=M(x,_)),A(b)&&_&&(b=M(b,_)),i.padding&&X)for(var G in i.padding)Object.hasOwnProperty.call(T,G)&&(T[G]=M(T[G],X));var K=T.paddingRight,tt=void 0===K?0:K,et=T.paddingLeft,it=void 0===et?0:et;if(i.margin&&[R.marginLeft,R.marginRight].includes("auto"))if(g){var rt=X&&X-g-tt-it-N-Y||0;R.marginLeft==R.marginRight?R.marginLeft=R.marginRight=rt/2:F(R.marginLeft)?R.marginLeft=rt:R.marginRight=rt}else R.marginLeft=R.marginRight=0;var ot=R.marginRight,st=void 0===ot?0:ot,ht=R.marginLeft,ct={width:g,height:m,left:0,top:0},dt=it+tt+N+Y+(void 0===ht?0:ht)+st;if(this.offsetWidth=dt,e==Q&&!this.attributes.widths){var lt=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:k}),lt.length,"\n"==lt&&(lt="",this.isBr=!0),(""+lt).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+k,n=at.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return at.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==J&&null==g){var ft=n.width,ut=n.height;ct.width=this.contrastSize(Math.round(ft*m/ut)||0,v,y),this.layoutBoxUpdate(ct,i,0)}if(e==Q&&null==g){var pt=this.attributes.widths,gt=Math.max.apply(Math,pt.map((function(t){return t.total})));o&&X>0&&(gt>X||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed&&(gt=X),ct.width=this.contrastSize(gt,v,y),this.layoutBoxUpdate(ct,i,0)}if(e==Q&&(o.style.flex||!this.attributes.lines)){var vt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>ct.width?(vt++,e.width):t+e.width}),0)})),vt=W&&vt>W?W:vt,this.attributes.lines=vt}if(e==J&&null==m){var yt=n.width,xt=n.height;n.text,ct.height=this.contrastSize(M(ct.width*xt/yt)||0,x,b),this.layoutBoxUpdate(ct,i,1)}e==Q&&null==m&&(P=M(P,S),ct.height=this.contrastSize(M(this.attributes.lines*P),x,b),this.layoutBoxUpdate(ct,i,1,!0)),!g&&o&&o.children&&X&&(!this.isFlex(o)||o.isFlexCalc)&&([Z,Q].includes(e)&&this.isFlex()||e==Z&&this.isBlock(this)&&this.isInFlow())&&(ct.width=this.contrastSize(X-(o.isFlexCalc?0:dt),v,y),this.layoutBoxUpdate(ct,i)),g&&!A(g)&&(ct.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(ct,i,0)),m&&!A(m)&&(ct.height=this.contrastSize(ct.height,x,b),this.layoutBoxUpdate(ct,i,1));var bt=0;if(a.length){var wt=null,mt=!1;a.forEach((function(e,n){e.getBoxWidthHeight();var r=a[n+1];if(r&&r.isInFlow()&&(e.next=r),!t.line||!t.line.ids.includes(e.id))if(e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(wt,e);if(e.isBr)return mt=!0;t.line&&t.line.canIEnter(e)&&!o&&!mt?t.line.add(e):(mt=!1,(new q).bind(e)),wt=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new V).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new q).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new q).fixedBind(e,1)})),this.lines&&(bt=this.lines.reduce((function(t,e){return t+e.height}),0))}var St=0,zt=0;if(!g&&(this.isAbsolute||this.isFixed)&&X){var It=B==nt?X:this.root.width,Mt=It-(A(c)?M(c,It):c)-(A(u)?M(u,It):u);St=i.left?Mt:this.lineMaxWidth}if(!m&&(null!=l?l:this.isAbsolute||this.isFixed&&_)){var kt=B==nt?_:this.root.height,Bt=kt-(A(l)?M(l,kt):l)-(A(f)?M(f,kt):f);zt=i.top?Bt:0}if(g&&!A(g)||ct.width||(ct.width=St||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?X||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(ct,i,0)),m||!bt&&!zt||(ct.height=zt||this.contrastSize(bt,x,b),this.layoutBoxUpdate(ct,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var G in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,G)&&(i.borderRadius[G]=M(i.borderRadius[G],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),ct=function(){var t,e,i,n,r,o,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],a=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],h=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],c=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],d=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],l=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],f=[],u=[],p=[],g=[],v=[],y=2;function x(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,g[i+=t]=1}function b(t,i){var n;for(p[t+e*i]=1,n=-2;n<2;n++)p[t+n+e*(i-2)]=1,p[t-2+e*(i+n+1)]=1,p[t+2+e*(i+n)]=1,p[t+n+1+e*(i+2)]=1;for(n=0;n<2;n++)x(t-1,i+n),x(t+1,i-n),x(t-n,i-1),x(t+n,i+1)}function w(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var m=[];function S(t,e,i,n){var r,o,s;for(r=0;re&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,g[i+=t]}function I(t){var i,n,r,o;switch(t){case 0:for(n=0;n>1&1,i=0;i=5&&(i+=3+v[e]-5);for(e=3;et||3*v[e-3]>=4*v[e]||3*v[e+3]>=4*v[e])&&(i+=40);return i}function k(){var t,i,n,r,o,s=0,a=0;for(i=0;ie*e;)h-=e*e,c++;for(s+=10*c,t=0;t1)for(P=s[t],B=e-7;;){for(M=e-7;M>P-3&&(b(M,B),!(M6)for(P=a[t-7],W=17,M=0;M<6;M++)for(B=0;B<3;B++,W--)1&(W>11?t>>W-12:P>>W)?(p[5-M+e*(2-B+e-11)]=1,p[2-B+e-11+e*(5-M)]=1):(x(5-M,2-B+e-11),x(2-B+e-11,5-M));for(B=0;B=(M=r*(i+n)+n)-2&&(O=M-2,t>9&&O--),T=O,t>9){for(f[T+2]=0,f[T+3]=0;T--;)P=f[T],f[T+3]|=255&P<<4,f[T+2]=P>>4;f[2]|=255&O<<4,f[1]=O>>4,f[0]=64|O>>12}else{for(f[T+1]=0,f[T+2]=0;T--;)P=f[T],f[T+2]|=255&P<<4,f[T+1]=P>>4;f[1]|=255&O<<4,f[0]=64|O>>4}for(T=O+3-(t<10);T0;L--)m[L]=m[L]?m[L-1]^l[w(d[m[L]]+T)]:m[L-1];m[0]=l[w(d[m[0]]+T)]}for(T=0;T<=o;T++)m[T]=d[m[T]];for(W=M,B=0,T=0;T>=1)1&B&&(p[e-1-W+8*e]=1,W<6?p[8+e*W]=1:p[8+e*(W+1)]=1);for(W=0;W<7;W++,B>>=1)1&B&&(p[8+e*(e-7+W)]=1,W?p[6-W+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i=1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|63&r)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|63&r));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,c=a.height,d=a.left,l=a.top;r.borderRadius,r.backgroundColor;var f=r.color,u=void 0===f?"#000000":f;if(r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top,y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,c);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var x=0;x=360&&(s-=360),s<0&&(s+=360),0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var a=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===a)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-a)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+a)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-a)return{x0:e+n,y0:i+r,x1:n,y1:r};var h,c=0,d=0,l=0,f=0;if(s180-a&&s<180||s>180&&s<180+a||s>360-a){var u=s*Math.PI/180,p=s360-a?i/2:-i/2,g=Math.tan(u)*p,v=s180-a&&s<180?e/2-g:-e/2-g;c=-(l=g+(h=Math.pow(Math.sin(u),2)*v)),d=-(f=p+h/Math.tan(u))}return(s>a&&s<90||s>90&&s<90+a||s>180+a&&s<270||s>270&&s<360-a)&&(u=(90-s)*Math.PI/180,g=s>a&&s<90||s>90&&s<90+a?e/2:-e/2,p=Math.tan(u)*g,v=s>a&&s<90||s>270&&s<360-a?i/2-p:-i/2-p,c=-(l=g+(h=Math.pow(Math.sin(u),2)*v)/Math.tan(u)),d=-(f=p+h)),{x0:c=Math.round(c+e/2)+n,y0:d=Math.round(i/2-d)+r,x1:l=Math.round(l+e/2)+n,y1:f=Math.round(i/2-f)+r}}(r,t,e,i,n),a=s.x0,h=s.y0,c=s.x1,d=s.y1,l=o.createLinearGradient(a,h,c,d),f=r.match(/linear-gradient\((.+)\)/)[1],u=B(f.substring(f.indexOf(",")+1)),p=0;p=s||n==c&&o=s)&&(a=e.width/i.width);var d=i.width*a,l=i.height*a,f=r||[],u=f[0],p=f[1],g=I(u)?M(u,e.width):(e.width-d)*(k(u)?M(u,1):{left:0,center:.5,right:1}[u||"center"]),v=I(p)?M(p,e.height):(e.height-l)*(k(p)?M(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/a,(e-v)/a]},x=y(0,0),b=x[0],w=x[1],m=y(e.width,e.height),S=m[0],z=m[1],B=Math.max,W=Math.min;return{sx:B(b,0),sy:B(w,0),sw:W(S-b,i.width),sh:W(z-w,i.height),dx:B(g,0),dy:B(v,0),dw:W(d,e.width),dh:W(l,e.height)}}({objectFit:u,objectPosition:v},e.contentSize,t),o=n.sx,s=n.sy,a=n.sh,h=n.sw,c=n.dx,d=n.dy,l=n.dh,f=n.dw;m==r.MP_BAIDU?i.drawImage(t.src,c+S,d+z,f,l,o,s,h,a):i.drawImage(t.src,o,s,h,a,c+S,d+z,f,l)}else i.drawImage(t.src,S,z,b,w)},O=function(){i.restore(),T.drawView(e,o,!1,!0,!1),h(1)},function(t){P(t),O()}(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},t.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,a=e.contentSize,h=e.left,c=e.top,d=a.width,l=a.height,f=a.left-s.left||0,u=a.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,x=i.fontFamily,b=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,k=i.verticalAlign,B=void 0===k?gt:k,W=i.backgroundColor,P=i.lineClamp,O=i.backgroundClip,T=i.textShadow,L=i.textDecoration;if(m=I(m)?m:0,this.drawView(e,i,O!=lt),g=M(g,v),t){o.save(),h+=f,c+=u;var R=n.fontHeight,F=n.descent,A=void 0===F?0:F,j=n.ascent,E=A+(void 0===j?0:j);switch(o.setFonts({fontFamily:x,fontSize:v,fontWeight:y,fontStyle:b}),o.setTextBaseline(gt),o.setTextAlign(S),O?this.setBackground(W,d,l,h,c):o.setFillStyle(p),S){case yt:break;case xt:h+=.5*d;break;case bt:h+=d}var C=n.lines*g,H=Math.ceil((l-C)/2);switch(H<0&&(H=0),B){case pt:break;case gt:c+=H;break;case vt:c+=2*H}var $=(g-R)/2,Y=g/2,D=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return B==pt?{fix:E?void 0===r?0:r:Y-$/2,lineY:E?0:$-$/2}:B==gt?{fix:E?Y+n/4:Y,lineY:E?0:$}:B==vt?{fix:E?g-n:Y+$/2,lineY:E?2*$:$+$/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case yt:r+=i;break;case xt:r=(t-=i/2)+i;break;case bt:r=t,t-=i}if(L){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(L)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(L)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(L)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:T}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:T}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:T}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=a.width){var X=D(t),_=X.fix,q=void 0===_?0:_,G=X.lineY;return N(t,h+m,c+q),U(h+m,c+G,n&&n.widths&&n.widths[0].total||n.text),c+=g,o.restore(),void this.setBorder(e,i)}for(var V=c,J=h,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eta.width){Z>=P&&(Q+="…"),Z++,nt=0;var ct=D(Q);q=ct.fix,G=ct.lineY,N(Q,J,c+q),U(J,c+G,nt),c+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==P&&K+ntV+l||Z>P)break}}o.restore()}},t.prototype.source=function(t){return i(this,0,void 0,(function(){var e,i,r,o=this;return n(this,(function(n){switch(n.label){case 0:if(this.node=null,"{}"==JSON.stringify(t))return[2];if(t.styles=t.styles||t.css||{},!t.type)for(e in t.type=ut,t)["views","children","type","css","styles"].includes(e)||(t.styles[e]=t[e],delete t[e]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(i=n.sent())?(r=i.layout()||{},this.size=r,this.node=i,this.onEffectFinished().then((function(t){return o.lifecycle("onEffectSuccess",t)})).catch((function(t){return o.lifecycle("onEffectFail",t)})),this.performance,[2,this.size]):[2,void 0]}}))}))},t.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},t.prototype.create=function(t,r){return i(this,0,void 0,(function(){function i(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var s=[];return t.forEach((function(t){var a=t.styles,h=void 0===a?{}:a,c=t.css,d=void 0===c?{}:c,l=t.children,f=void 0===l?[]:l,u=t.views,p=void 0===u?[]:u,g=t.text,v=void 0===g?"":g,y=t.type,x=void 0===y?"":y;!f&&p&&(t.children=f=p);var b;b=e(e(r?e({},n):{},h),d);var w={},m={},S={};if(Object.keys(b).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=function(t,e){var i,n,r,s,a=[s=(r=t).match(/([a-z]+)/)[1],U(r.split(s)[1])],h=a[0],c=a[1],d=e.split(" ");if(c)return(i={})[h+c]=e,i;if(d.length&&!c){var l=d[0],f=d[1],u=d[2],p=d[3];return(n={})[h+o[0]]=l,n[h+o[1]]=f||l,n[h+o[2]]=u||l,n[h+o[3]]=p||f||l,n}}(t,b[t]);Object.keys(e).map((function(t){t.includes("Left")?m[t]=e[t]:t.includes("Right")?S[t]=e[t]:w[t]=e[t]}))}})),b.textIndent&&(m.textIndent=b.textIndent,delete n.textIndent),""!==v){var z=Array.from(v);z.forEach((function(t,e){var i=Object.assign({},b,w);0===e?Object.assign(i,m):e==z.length-1&&Object.assign(i,S),delete i.padding,delete i.margin,s.push({type:"text",text:t,styles:i})}))}if(x==dt||x==ft)s.push(t);else if("block"===h.display&&f.length>0){var I=i(f,b,!1);t.children=I,t.flattened=!0,s.push(t)}else f.length>0&&(I=i(f,b,r),s=s.concat(I))})),s}var s,a,h,c,d,l,f,u,p,g,v,y,x,b,w,m,S,z,I,M,k,B,W,P;return n(this,(function(n){switch(n.label){case 0:if(!t)return[2];if(t.styles||(t.styles=t.css||{}),s=t.type,a=t.show,h=void 0===a||a,c=s==dt,d=[lt,ft].includes(s),l="textBox"==s,f=t.styles||{},u=f.backgroundImage,p=f.display,c&&!t.src&&!t.url)return[2];if("none"==p||!h)return[2];if(d||l){if(g=t.children,v=t.views,!g&&v&&(t.children=g=v),!t.text&&(!g||g&&!g.length))return[2];g&&g.length&&!t.flattened&&(y=i(t.children||t.views),t.type="view",t.children=y)}if(!(c||t.type==ut&&u))return[3,4];x=c?t.src:"",b=/url\(['"]?(.*?)['"]?\)/.exec(u),u&&b&&b[1]&&(x=b[1]||""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.getImageInfo(x)];case 2:return w=n.sent(),m=w.width,S=w.height,!(z=w.path)&&c?[2]:(z&&(t.attributes=Object.assign(t.attributes||{},{width:m,height:S,path:z,src:z,naturalSrc:x})),[3,4]);case 3:return I=n.sent(),t.type!=ut?[2]:(this.lifecycle("onEffectFail",e(e({},I),{src:x})),[3,4]);case 4:if(this.count+=1,M=new ht(t,r,this.root,this.ctx),!(k=t.children||t.views))return[3,8];B=0,n.label=5;case 5:return B