P[2]&&(P[2]=S);break t}}return{mu:a,occupied:k,bounds:P,gw:y,gh:x,fillTextOffsetX:g,fillTextOffsetY:m,fillTextWidth:h,fillTextHeight:u,fontSize:i}},L=function(t,e,r,i,a){for(var o=a.length;o--;){var s=t+a[o][0],l=e+a[o][1];if(s>=u||l>=c||s<0||l<0){if(!n.drawOutOfBound)return!1}else if(!h[s][l])return!1}return!0},F=function(e,r,i,a,o,s,l,h,u){var c,f=i.fontSize;c=g?g(a,o,f,s,l):n.color;var d;d=_?_(a,o,f,s,l):n.classes;var v=i.bounds;v[3],v[0],v[1],v[3],v[2],v[0],t.forEach(function(t){if(t.getContext){var o=t.getContext("2d"),s=i.mu;o.save(),o.scale(1/s,1/s),o.font=n.fontWeight+" "+(f*s).toString(10)+"px "+n.fontFamily,o.fillStyle=c,o.translate((e+i.gw/2)*p*s,(r+i.gh/2)*p*s),0!==h&&o.rotate(-h),o.textBaseline="middle",o.fillText(a,i.fillTextOffsetX*s,(i.fillTextOffsetY+.5*f)*s),o.restore()}else{var l=document.createElement("span"),v="";v="rotate("+-h/Math.PI*180+"deg) ",1!==i.mu&&(v+="translateX(-"+i.fillTextWidth/4+"px) scale("+1/i.mu+")");var g={position:"absolute",display:"block",font:n.fontWeight+" "+f*i.mu+"px "+n.fontFamily,left:(e+i.gw/2)*p+i.fillTextOffsetX+"px",top:(r+i.gh/2)*p+i.fillTextOffsetY+"px",width:i.fillTextWidth+"px",height:i.fillTextHeight+"px",lineHeight:f+"px",whiteSpace:"nowrap",transform:v,webkitTransform:v,msTransform:v,transformOrigin:"50% 40%",webkitTransformOrigin:"50% 40%",msTransformOrigin:"50% 40%"};c&&(g.color=c),l.textContent=a;for(var m in g)l.style[m]=g[m];if(u)for(var x in u)l.setAttribute(x,u[x]);d&&(l.className+=d),t.appendChild(l)}})},R=function(e,r,n,i,a){if(!(e>=u||r>=c||e<0||r<0)){if(h[e][r]=!1,n){t[0].getContext("2d").fillRect(e*p,r*p,m,m)}S&&(M[e][r]={item:a,dimension:i})}},B=function(e,r,i,a,o,s){var l,h=o.occupied,f=n.drawMask;f&&(l=t[0].getContext("2d"),l.save(),l.fillStyle=n.maskColor);var d;if(S){var v=o.bounds;d={x:(e+v[3])*p,y:(r+v[0])*p,w:(v[1]-v[3]+1)*p,h:(v[2]-v[0]+1)*p}}for(var g=h.length;g--;){var m=e+h[g][0],x=r+h[g][1];m>=u||x>=c||m<0||x<0||R(m,x,f,d,s)}f&&l.restore()},z=function(t){var e,r,i;Array.isArray(t)?(e=t[0],r=t[1]):(e=t.word,r=t.weight,i=t.attributes);var a=O(),o=D(e,r,a);if(!o)return!1;if(A())return!1;if(!n.drawOutOfBound){var l=o.bounds;if(l[1]-l[3]+1>u||l[2]-l[0]+1>c)return!1}for(var h=d+1;h--;){var f=I(d-h);n.shuffle&&(f=[].concat(f),s(f));for(var v=0;v