"use strict";var _slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],a=!0,n=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(e){n=!0,i=e}finally{try{!a&&s.return&&s.return()}finally{if(n)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function _asyncToGenerator(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function a(n,i){try{var o=t[n](i),s=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(s).then(function(e){a("next",e)},function(e){a("throw",e)});e(s)}("next")})}}drill.define(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var r,a,n,i,o,s,c,h,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=function(e){var t=/[\d\.]+(.+)/.exec(e);return t?t[1]:""},a=$(".p_main"),e.next=4,t("data -r");case 4:return n=e.sent,i=n.mainPage.width,o=n.mainPage.height,(s=i>o)||(c=function(){var e=$("body").height(),t=$("body").width();t/e>1?a.css({width:i/o*e+"px",height:e+"px",left:(t-i/o*e)/2+"px"}):a.css({width:"",height:"",left:""})},h=void 0,$(window).on("resize",function(e){clearTimeout(h),h=setTimeout(c,300)}),c()),u={refreshView:function e(t){var n=t.pageData,i=t.eleData,o=$(t);if(n)o.children().each(function(t,r){e(r)});else if(i){var c=o.find(".p_ele"),h=a.width(),u=a.height();switch(i.target){case"safe":var p=h/u;s&&(p>2?(o.css({left:(h-2*u)/2+"px",width:2*u+"px",height:u+"px"}),h=2*u):p<1?(o.css({top:(u-h)/2+"px",width:h+"px",height:h+"px"}),u=h):o.css({left:"",top:"",width:"",height:""}))}var l=i.w,f=i.h,d=i.hor,w=i.ver,v=i.x,x=i.y,b=void 0,g=void 0,y=void 0,m=void 0;switch(r(l)){case"px":b=parseFloat(l);break;case"%":b=parseFloat(l)/100*h}var F=b/100;switch(r(f)){case"px":g=parseFloat(f);break;case"%":g=parseFloat(f)/100*u;break;case"bw":g=parseFloat(f)*F}switch(d){case"start":y=0;break;case"center":y=(h-b)/2;break;case"end":y=h-b}switch(r(v)){case"px":y+=parseFloat(v);break;case"%":y+=parseFloat(v)/100*h;break;case"bw":y+=parseFloat(v)*F}switch(w){case"start":m=u-g;break;case"center":m=(u-g)/2;break;case"end":m=0}switch(r(x)){case"px":m+=parseFloat(x);break;case"%":m+=parseFloat(x)/100*u;break;case"bw":m+=parseFloat(x)*F}b+="px",g+="px",y+="px",m+="px",c.length&&(c.css({width:b,height:g,left:y,bottom:m}),[["letterSpacing","letterSpacing"],["fontSize","fontSize"]].forEach(function(e){var t=_slicedToArray(e,2),a=t[0],n=t[1],o=i[n];"bw"==r(o)&&(o=(parseFloat(o)*F).toFixed(3)+"px"),c.css(a,o)}),["textAlign"].forEach(function(e){var t=i[e];c.css(e,t)}))}}},e.abrupt("return",u);case 12:case"end":return e.stop()}},e,void 0)}));return function(t){return e.apply(this,arguments)}}());