lucky-canvas
Advanced tools
Comparing version 1.7.12 to 1.7.13
@@ -16,3 +16,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}); | ||
***************************************************************************** */ | ||
var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function i(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function r(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var c,u,h=function(t){return t&&t.Math==Math&&t},l=h("object"==typeof globalThis&&globalThis)||h("object"==typeof window&&window)||h("object"==typeof self&&self)||h("object"==typeof a&&a)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},d=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,g=p.bind?p.bind(p):function(){return p.apply(p,arguments)},v={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,y={f:m&&!v.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:v},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,S=b.bind,C=b.call,x=S&&S.bind(C),z=S?function(t){return t&&x(C,t)}:function(t){return t&&function(){return C.apply(t,arguments)}},O=z({}.toString),k=z("".slice),I=function(t){return k(O(t),8,-1)},E=l.Object,T=z("".split),A=f((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==I(t)?T(t,""):E(t)}:E,P=l.TypeError,_=function(t){if(null==t)throw P("Can't call method on "+t);return t},W=function(t){return A(_(t))},$=function(t){return"function"==typeof t},j=function(t){return"object"==typeof t?null!==t:$(t)},R=function(t){return $(t)?t:void 0},F=function(t,e){return arguments.length<2?R(l[t]):l[t]&&l[t][e]},D=z({}.isPrototypeOf),L=F("navigator","userAgent")||"",H=l.process,M=l.Deno,B=H&&H.versions||M&&M.version,N=B&&B.v8;N&&(u=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!u&&L&&(!(c=L.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=L.match(/Chrome\/(\d+)/))&&(u=+c[1]);var G=u,X=!!Object.getOwnPropertySymbols&&!f((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&G&&G<41})),U=X&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,Y=U?function(t){return"symbol"==typeof t}:function(t){var e=F("Symbol");return $(e)&&D(e.prototype,q(t))},K=l.String,V=l.TypeError,J=function(t){if($(t))return t;throw V(function(t){try{return K(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=l.TypeError,Z=Object.defineProperty,tt=function(t,e){try{Z(l,t,{value:e,configurable:!0,writable:!0})}catch(n){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),nt=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),it=l.Object,rt=function(t){return it(_(t))},ot=z({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ut=z(1..toString),ht=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ut(++st+ct,36)},lt=nt("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ht,gt=function(t){if(!at(lt,t)||!X&&"string"!=typeof lt[t]){var e="Symbol."+t;X&&at(ft,t)?lt[t]=ft[t]:lt[t]=U&&dt?dt(e):pt(e)}return lt[t]},vt=l.TypeError,mt=gt("toPrimitive"),yt=function(t,e){if(!j(t)||Y(t))return t;var n,i,r=null==(n=t[mt])?void 0:J(n);if(r){if(void 0===e&&(e="default"),i=g(r,t,e),!j(i)||Y(i))return i;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&$(n=t.toString)&&!j(i=g(n,t)))return i;if($(n=t.valueOf)&&!j(i=g(n,t)))return i;if("string"!==e&&$(n=t.toString)&&!j(i=g(n,t)))return i;throw Q("Can't convert object to primitive value")}(t,e)},wt=function(t){var e=yt(t,"string");return Y(e)?e:e+""},bt=l.document,St=j(bt)&&j(bt.createElement),Ct=function(t){return St?bt.createElement(t):{}},xt=!d&&!f((function(){return 7!=Object.defineProperty(Ct("div"),"a",{get:function(){return 7}}).a})),zt=Object.getOwnPropertyDescriptor,Ot={f:d?zt:function(t,e){if(t=W(t),e=wt(e),xt)try{return zt(t,e)}catch(t){}if(at(t,e))return w(!g(y.f,t,e),t[e])}},kt=l.String,It=l.TypeError,Et=function(t){if(j(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,At=Object.defineProperty,Pt={f:d?At:function(t,e,n){if(Et(t),e=wt(e),Et(n),xt)try{return At(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Tt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},_t=d?function(t,e,n){return Pt.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},Wt=z(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Wt(t)});var $t,jt,Rt,Ft=et.inspectSource,Dt=l.WeakMap,Lt=$(Dt)&&/native code/.test(Ft(Dt)),Ht=nt("keys"),Mt=function(t){return Ht[t]||(Ht[t]=ht(t))},Bt={},Nt=l.TypeError,Gt=l.WeakMap;if(Lt||et.state){var Xt=et.state||(et.state=new Gt),Ut=z(Xt.get),qt=z(Xt.has),Yt=z(Xt.set);$t=function(t,e){if(qt(Xt,t))throw new Nt("Object already initialized");return e.facade=t,Yt(Xt,t,e),e},jt=function(t){return Ut(Xt,t)||{}},Rt=function(t){return qt(Xt,t)}}else{var Kt=Mt("state");Bt[Kt]=!0,$t=function(t,e){if(at(t,Kt))throw new Nt("Object already initialized");return e.facade=t,_t(t,Kt,e),e},jt=function(t){return at(t,Kt)?t[Kt]:{}},Rt=function(t){return at(t,Kt)}}var Vt,Jt={set:$t,get:jt,has:Rt,enforce:function(t){return Rt(t)?jt(t):$t(t,{})},getterFor:function(t){return function(e){var n;if(!j(e)||(n=jt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return n}}},Qt=Function.prototype,Zt=d&&Object.getOwnPropertyDescriptor,te=at(Qt,"name"),ee={EXISTS:te,PROPER:te&&"something"===function(){}.name,CONFIGURABLE:te&&(!d||d&&Zt(Qt,"name").configurable)},ne=s((function(t){var e=ee.CONFIGURABLE,n=Jt.get,i=Jt.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;$(o)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!at(o,"name")||e&&o.name!==f)&&_t(o,"name",f),(s=i(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:_t(t,n,o)):u?t[n]=o:tt(n,o)})(Function.prototype,"toString",(function(){return $(this)&&n(this).source||Ft(this)}))})),ie=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ie)(e)},ae=Math.max,se=Math.min,ce=Math.min,ue=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},he=function(t){return function(e,n,i){var r,o=W(e),a=ue(o),s=function(t,e){var n=oe(t);return n<0?ae(n+e,0):se(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},le={includes:he(!0),indexOf:he(!1)},fe=le.indexOf,de=z([].push),pe=function(t,e){var n,i=W(t),r=0,o=[];for(n in i)!at(Bt,n)&&at(i,n)&&de(o,n);for(;e.length>r;)at(i,n=e[r++])&&(~fe(o,n)||de(o,n));return o},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),me={f:Object.getOwnPropertyNames||function(t){return pe(t,ve)}},ye={f:Object.getOwnPropertySymbols},we=z([].concat),be=F("Reflect","ownKeys")||function(t){var e=me.f(Et(t)),n=ye.f;return n?we(e,n(t)):e},Se=function(t,e){for(var n=be(e),i=Pt.f,r=Ot.f,o=0;o<n.length;o++){var a=n[o];at(t,a)||i(t,a,r(e,a))}},Ce=/#|\.prototype\./,xe=function(t,e){var n=Oe[ze(t)];return n==Ie||n!=ke&&($(e)?f(e):!!e)},ze=xe.normalize=function(t){return String(t).replace(Ce,".").toLowerCase()},Oe=xe.data={},ke=xe.NATIVE="N",Ie=xe.POLYFILL="P",Ee=xe,Te=Ot.f,Ae=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?l:u?l[s]||tt(s,{}):(l[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=Te(n,i))&&a.value:n[i],!Ee(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ne(n,i,o,t)}},Pe=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var n,i=W(e),r=Pe(e),o=r.length,a=0;o>a;)Pt.f(t,n=r[a++],i[n]);return t},We=F("document","documentElement"),$e=Mt("IE_PROTO"),je=function(){},Re=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(Re("")),t.close();var e=t.parentWindow.Object;return t=null,e},De=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;De="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",We.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Re("document.F=Object")),t.close(),t.F):Fe(Vt);for(var n=ge.length;n--;)delete De.prototype[ge[n]];return De()};Bt[$e]=!0;var Le=Object.create||function(t,e){var n;return null!==t?(je.prototype=Et(t),n=new je,je.prototype=null,n[$e]=t):n=De(),void 0===e?n:_e(n,e)},He=gt("unscopables"),Me=Array.prototype;null==Me[He]&&Pt.f(Me,He,{configurable:!0,value:Le(null)});var Be=function(t){Me[He][t]=!0},Ne=le.includes;Ae({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),Ae({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:Pt.f});var Ge=gt("match"),Xe=l.TypeError,Ue=function(t){if(function(t){var e;return j(t)&&(void 0!==(e=t[Ge])?!!e:"RegExp"==I(t))}(t))throw Xe("The method doesn't accept regular expressions");return t},qe={};qe[gt("toStringTag")]="z";var Ye="[object z]"===String(qe),Ke=gt("toStringTag"),Ve=l.Object,Je="Arguments"==I(function(){return arguments}()),Qe=Ye?I:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?n:Je?I(e):"Object"==(i=I(e))&&$(e.callee)?"Arguments":i},Ze=l.String,tn=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},en=gt("match"),nn=z("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[en]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~nn(tn(_(this)),tn(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var rn,on,an=le.indexOf,sn=z([].indexOf),cn=!!sn&&1/sn([1],1,-0)<0,un=!!(on=[]["indexOf"])&&f((function(){on.call(null,rn||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:cn||!un},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return cn?sn(this,t,e)||0:an(this,t,e)}});var hn=z(z.bind),ln=Array.isArray||function(t){return"Array"==I(t)},fn=function(){},dn=[],pn=F("Reflect","construct"),gn=/^\s*(?:class|function)\b/,vn=z(gn.exec),mn=!gn.exec(fn),yn=function(t){if(!$(t))return!1;try{return pn(fn,dn,t),!0}catch(t){return!1}},wn=!pn||f((function(){var t;return yn(yn.call)||!yn(Object)||!yn((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return mn||!!vn(gn,Ft(t))}:yn,bn=gt("species"),Sn=l.Array,Cn=function(t,e){return new(function(t){var e;return ln(t)&&(e=t.constructor,(wn(e)&&(e===Sn||ln(e.prototype))||j(e)&&null===(e=e[bn]))&&(e=void 0)),void 0===e?Sn:e}(t))(0===e?0:e)},xn=z([].push),zn=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hn?hn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=ue(g),y=0,w=l||Cn,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:xn(b,f)}else switch(t){case 4:return!1;case 7:xn(b,f)}return o?-1:i||r?r:b}},On={forEach:zn(0),map:zn(1),filter:zn(2),some:zn(3),every:zn(4),find:zn(5),findIndex:zn(6),filterReject:zn(7)}.find,kn=!0;"find"in[]&&Array(1).find((function(){kn=!1})),Ae({target:"Array",proto:!0,forced:kn},{find:function(t){return On(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find");var In=Ye?{}.toString:function(){return"[object "+Qe(this)+"]"};Ye||ne(Object.prototype,"toString",In,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var En=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Tn=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!En(r,"object","array"))return r;t=r}return t},An=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Pn=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},_n=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Wn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&En(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},$n=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},jn=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Rn=function(t){return Math.PI/180*t},Fn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=Rn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Dn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},Ln=function(t,e,n,i,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,u=t.height;a.width=c,a.height=u;var h=c/i;return Dn(s,e*h,n*h,i*h,r*h,o*h),s.clip(),s.drawImage(t,0,0,c,u),a},Hn=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;n.width=r,n.height=o,i.drawImage(t,0,0,r,o);var a=i.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var n=Math.ceil(t),i=e*e,r=2*i,o=1/(2*Math.PI*i),a=[],s=0,c=-n;c<=n;c++)for(var u=-n;u<=n;u++){var h=o*Math.exp(-(c*c+u*u)/r);a.push(h),s+=h}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),i.putImageData(a,0,0),n},Mn=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Bn="__proto__"in{};function Nn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Gn=Array.prototype,Xn=Object.create(Gn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Xn[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Gn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Un=function(){function t(t){this.dep=new Mn,Nn(t,"__luckyOb__",this),Array.isArray(t)&&(Bn?t.__proto__=Xn:Object.getOwnPropertyNames(Xn).forEach((function(e){Nn(t,e,Xn[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Yn(t,e,t[e])}))},t}();function qn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Un(t)}function Yn(t,e,n){var i=new Mn,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=qn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Mn.target&&(i.addSub(Mn.target),s&&s.dep.addSub(Mn.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=qn(e),i.notify()))}})}}var Kn=0,Vn=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=Kn++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Mn.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){En(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Mn.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Jn=function(){function t(t,e){var n=this;this.version="1.7.12",this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat("1.7.12")),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([n],i))},t.prototype.getLength=function(t){return En(t,"number")?t:En(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,i,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(i);var a=n.config.unitFunc;return a?a(i,r):i})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!An(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=n.map((function(t){return e.getLength(t)}));return Ln.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e/100)}i.putImageData(a,0,0)}return n}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Hn(t,this.getLength(e))},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Yn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new Vn(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),Qn=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},Zn=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},ti=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return n({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return n({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},o.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]),i.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(i,t)),u[n][e][o]=t,r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},o.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return _n(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Rn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Rn(this.prizeDeg);var c=Rn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;_n(l)&&(o.fillStyle=l,Fn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+Rn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?jn(o,Pn(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(Rn(360)-i-Rn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=Zn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},o.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},o.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=$n(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},o.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=Qn(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=Zn(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},o.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},o}(Jn),ei=function(t){function a(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},a.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},a.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},a.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return n({background:"#ffce98",shadow:""},t.activeStyle)}))},a.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},a.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},a.prototype.handleClick=function(t){var e=this,n=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},a.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if("buttons"===t&&!i.buttons.length&&i.button&&(s=i.button),s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]);var h=[i.loadImg(c.src,c),c.activeSrc&&i.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(h).then((function(t){var a=t[0],s=t[1],h=c.formatter;"function"==typeof h&&(a=h.call(i,a),s&&(s=h.call(i,s))),u[n][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},a.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,a=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,a),a.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=o(o([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,o=t.y,s=t.w,u=t.h,h=Wn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return _n(v)&&(a.fillStyle=n.handleBackground(r,o,s,u,v),Dn(a,r,o,s,u,g),a.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=Tn(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(a,c,r+p,o+g,l,f)}})),{x:r+d,y:o+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),o=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(_n(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(a.shadowColor=p[3],a.shadowOffsetX=p[0]*r.dpr,a.shadowOffsetY=p[1]*r.dpr,a.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=n.handleBackground(o,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Dn(a,o,s,h,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[o+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(a,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;a.font="".concat(i," ").concat(r>>0,"px ").concat(e),a.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=jn(a,Pn(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){a.fillText(e,o+n.getOffsetX(a.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=Zn(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},a.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},a.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=$n(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},a.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=Qn(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=Zn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},a.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},a.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},a}(Jn),ni=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]),i.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(i,t)),u[n][e][o]=t,r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(_n(S)){var C=t.getLength(An(r,"borderRadius")?r.borderRadius:n.borderRadius);Dn(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=Tn(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=jn(m,Pn(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),x=C[0],z=C[1];t.drawImage(m,v,g,y,w,b,x,z,w,b),S+=s}}}))},o.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Wn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return _n(v)&&(Dn(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=Tn(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,x,z,O)}))}},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=Zn(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},o.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},o.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!En(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},o.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=Qn(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=Zn(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},o.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},o.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o}(Jn);exports.LuckyGrid=ei,exports.LuckyWheel=ti,exports.SlotMachine=ni; | ||
var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function i(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function r(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var c,u,h=function(t){return t&&t.Math==Math&&t},l=h("object"==typeof globalThis&&globalThis)||h("object"==typeof window&&window)||h("object"==typeof self&&self)||h("object"==typeof a&&a)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},d=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,g=p.bind?p.bind(p):function(){return p.apply(p,arguments)},v={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,y={f:m&&!v.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:v},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,S=b.bind,C=b.call,x=S&&S.bind(C),z=S?function(t){return t&&x(C,t)}:function(t){return t&&function(){return C.apply(t,arguments)}},O=z({}.toString),k=z("".slice),I=function(t){return k(O(t),8,-1)},E=l.Object,T=z("".split),P=f((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==I(t)?T(t,""):E(t)}:E,A=l.TypeError,_=function(t){if(null==t)throw A("Can't call method on "+t);return t},W=function(t){return P(_(t))},j=function(t){return"function"==typeof t},$=function(t){return"object"==typeof t?null!==t:j(t)},R=function(t){return j(t)?t:void 0},F=function(t,e){return arguments.length<2?R(l[t]):l[t]&&l[t][e]},D=z({}.isPrototypeOf),H=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(u=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!u&&H&&(!(c=H.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=H.match(/Chrome\/(\d+)/))&&(u=+c[1]);var G=u,X=!!Object.getOwnPropertySymbols&&!f((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&G&&G<41})),U=X&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,Y=U?function(t){return"symbol"==typeof t}:function(t){var e=F("Symbol");return j(e)&&D(e.prototype,q(t))},K=l.String,V=l.TypeError,J=function(t){if(j(t))return t;throw V(function(t){try{return K(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=l.TypeError,Z=Object.defineProperty,tt=function(t,e){try{Z(l,t,{value:e,configurable:!0,writable:!0})}catch(n){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),nt=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),it=l.Object,rt=function(t){return it(_(t))},ot=z({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ut=z(1..toString),ht=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ut(++st+ct,36)},lt=nt("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ht,gt=function(t){if(!at(lt,t)||!X&&"string"!=typeof lt[t]){var e="Symbol."+t;X&&at(ft,t)?lt[t]=ft[t]:lt[t]=U&&dt?dt(e):pt(e)}return lt[t]},vt=l.TypeError,mt=gt("toPrimitive"),yt=function(t,e){if(!$(t)||Y(t))return t;var n,i,r=null==(n=t[mt])?void 0:J(n);if(r){if(void 0===e&&(e="default"),i=g(r,t,e),!$(i)||Y(i))return i;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&j(n=t.toString)&&!$(i=g(n,t)))return i;if(j(n=t.valueOf)&&!$(i=g(n,t)))return i;if("string"!==e&&j(n=t.toString)&&!$(i=g(n,t)))return i;throw Q("Can't convert object to primitive value")}(t,e)},wt=function(t){var e=yt(t,"string");return Y(e)?e:e+""},bt=l.document,St=$(bt)&&$(bt.createElement),Ct=function(t){return St?bt.createElement(t):{}},xt=!d&&!f((function(){return 7!=Object.defineProperty(Ct("div"),"a",{get:function(){return 7}}).a})),zt=Object.getOwnPropertyDescriptor,Ot={f:d?zt:function(t,e){if(t=W(t),e=wt(e),xt)try{return zt(t,e)}catch(t){}if(at(t,e))return w(!g(y.f,t,e),t[e])}},kt=l.String,It=l.TypeError,Et=function(t){if($(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,Pt=Object.defineProperty,At={f:d?Pt:function(t,e,n){if(Et(t),e=wt(e),Et(n),xt)try{return Pt(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Tt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},_t=d?function(t,e,n){return At.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},Wt=z(Function.toString);j(et.inspectSource)||(et.inspectSource=function(t){return Wt(t)});var jt,$t,Rt,Ft=et.inspectSource,Dt=l.WeakMap,Ht=j(Dt)&&/native code/.test(Ft(Dt)),Lt=nt("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ht(t))},Bt={},Nt=l.TypeError,Gt=l.WeakMap;if(Ht||et.state){var Xt=et.state||(et.state=new Gt),Ut=z(Xt.get),qt=z(Xt.has),Yt=z(Xt.set);jt=function(t,e){if(qt(Xt,t))throw new Nt("Object already initialized");return e.facade=t,Yt(Xt,t,e),e},$t=function(t){return Ut(Xt,t)||{}},Rt=function(t){return qt(Xt,t)}}else{var Kt=Mt("state");Bt[Kt]=!0,jt=function(t,e){if(at(t,Kt))throw new Nt("Object already initialized");return e.facade=t,_t(t,Kt,e),e},$t=function(t){return at(t,Kt)?t[Kt]:{}},Rt=function(t){return at(t,Kt)}}var Vt,Jt={set:jt,get:$t,has:Rt,enforce:function(t){return Rt(t)?$t(t):jt(t,{})},getterFor:function(t){return function(e){var n;if(!$(e)||(n=$t(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return n}}},Qt=Function.prototype,Zt=d&&Object.getOwnPropertyDescriptor,te=at(Qt,"name"),ee={EXISTS:te,PROPER:te&&"something"===function(){}.name,CONFIGURABLE:te&&(!d||d&&Zt(Qt,"name").configurable)},ne=s((function(t){var e=ee.CONFIGURABLE,n=Jt.get,i=Jt.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;j(o)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!at(o,"name")||e&&o.name!==f)&&_t(o,"name",f),(s=i(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:_t(t,n,o)):u?t[n]=o:tt(n,o)})(Function.prototype,"toString",(function(){return j(this)&&n(this).source||Ft(this)}))})),ie=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ie)(e)},ae=Math.max,se=Math.min,ce=Math.min,ue=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},he=function(t){return function(e,n,i){var r,o=W(e),a=ue(o),s=function(t,e){var n=oe(t);return n<0?ae(n+e,0):se(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},le={includes:he(!0),indexOf:he(!1)},fe=le.indexOf,de=z([].push),pe=function(t,e){var n,i=W(t),r=0,o=[];for(n in i)!at(Bt,n)&&at(i,n)&&de(o,n);for(;e.length>r;)at(i,n=e[r++])&&(~fe(o,n)||de(o,n));return o},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),me={f:Object.getOwnPropertyNames||function(t){return pe(t,ve)}},ye={f:Object.getOwnPropertySymbols},we=z([].concat),be=F("Reflect","ownKeys")||function(t){var e=me.f(Et(t)),n=ye.f;return n?we(e,n(t)):e},Se=function(t,e){for(var n=be(e),i=At.f,r=Ot.f,o=0;o<n.length;o++){var a=n[o];at(t,a)||i(t,a,r(e,a))}},Ce=/#|\.prototype\./,xe=function(t,e){var n=Oe[ze(t)];return n==Ie||n!=ke&&(j(e)?f(e):!!e)},ze=xe.normalize=function(t){return String(t).replace(Ce,".").toLowerCase()},Oe=xe.data={},ke=xe.NATIVE="N",Ie=xe.POLYFILL="P",Ee=xe,Te=Ot.f,Pe=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?l:u?l[s]||tt(s,{}):(l[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=Te(n,i))&&a.value:n[i],!Ee(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ne(n,i,o,t)}},Ae=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var n,i=W(e),r=Ae(e),o=r.length,a=0;o>a;)At.f(t,n=r[a++],i[n]);return t},We=F("document","documentElement"),je=Mt("IE_PROTO"),$e=function(){},Re=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(Re("")),t.close();var e=t.parentWindow.Object;return t=null,e},De=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;De="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",We.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Re("document.F=Object")),t.close(),t.F):Fe(Vt);for(var n=ge.length;n--;)delete De.prototype[ge[n]];return De()};Bt[je]=!0;var He=Object.create||function(t,e){var n;return null!==t?($e.prototype=Et(t),n=new $e,$e.prototype=null,n[je]=t):n=De(),void 0===e?n:_e(n,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&At.f(Me,Le,{configurable:!0,value:He(null)});var Be=function(t){Me[Le][t]=!0},Ne=le.includes;Pe({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),Pe({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:At.f});var Ge=gt("match"),Xe=l.TypeError,Ue=function(t){if(function(t){var e;return $(t)&&(void 0!==(e=t[Ge])?!!e:"RegExp"==I(t))}(t))throw Xe("The method doesn't accept regular expressions");return t},qe={};qe[gt("toStringTag")]="z";var Ye="[object z]"===String(qe),Ke=gt("toStringTag"),Ve=l.Object,Je="Arguments"==I(function(){return arguments}()),Qe=Ye?I:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?n:Je?I(e):"Object"==(i=I(e))&&j(e.callee)?"Arguments":i},Ze=l.String,tn=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},en=gt("match"),nn=z("".indexOf);Pe({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[en]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~nn(tn(_(this)),tn(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var rn,on,an=le.indexOf,sn=z([].indexOf),cn=!!sn&&1/sn([1],1,-0)<0,un=!!(on=[]["indexOf"])&&f((function(){on.call(null,rn||function(){throw 1},1)}));Pe({target:"Array",proto:!0,forced:cn||!un},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return cn?sn(this,t,e)||0:an(this,t,e)}});var hn=z(z.bind),ln=Array.isArray||function(t){return"Array"==I(t)},fn=function(){},dn=[],pn=F("Reflect","construct"),gn=/^\s*(?:class|function)\b/,vn=z(gn.exec),mn=!gn.exec(fn),yn=function(t){if(!j(t))return!1;try{return pn(fn,dn,t),!0}catch(t){return!1}},wn=!pn||f((function(){var t;return yn(yn.call)||!yn(Object)||!yn((function(){t=!0}))||t}))?function(t){if(!j(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return mn||!!vn(gn,Ft(t))}:yn,bn=gt("species"),Sn=l.Array,Cn=function(t,e){return new(function(t){var e;return ln(t)&&(e=t.constructor,(wn(e)&&(e===Sn||ln(e.prototype))||$(e)&&null===(e=e[bn]))&&(e=void 0)),void 0===e?Sn:e}(t))(0===e?0:e)},xn=z([].push),zn=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=rt(c),g=P(p),v=function(t,e){return J(t),void 0===e?t:hn?hn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=ue(g),y=0,w=l||Cn,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:xn(b,f)}else switch(t){case 4:return!1;case 7:xn(b,f)}return o?-1:i||r?r:b}},On={forEach:zn(0),map:zn(1),filter:zn(2),some:zn(3),every:zn(4),find:zn(5),findIndex:zn(6),filterReject:zn(7)}.find,kn=!0;"find"in[]&&Array(1).find((function(){kn=!1})),Pe({target:"Array",proto:!0,forced:kn},{find:function(t){return On(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find");var In=Ye?{}.toString:function(){return"[object "+Qe(this)+"]"};Ye||ne(Object.prototype,"toString",In,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var En=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Tn=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!En(r,"object","array"))return r;t=r}return t},Pn=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},An=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},_n=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Wn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&En(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},jn=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},$n=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Rn=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Fn="__proto__"in{};function Dn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Hn=Array.prototype,Ln=Object.create(Hn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Ln[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Hn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Mn=function(){function t(t){this.dep=new Rn,Dn(t,"__luckyOb__",this),Array.isArray(t)&&(Fn?t.__proto__=Ln:Object.getOwnPropertyNames(Ln).forEach((function(e){Dn(t,e,Ln[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Nn(t,e,t[e])}))},t}();function Bn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Mn(t)}function Nn(t,e,n){var i=new Rn,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=Bn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Rn.target&&(i.addSub(Rn.target),s&&s.dep.addSub(Rn.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=Bn(e),i.notify()))}})}}var Gn=0,Xn=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=Gn++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Rn.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){En(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Rn.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Un=function(){function t(t,e){var n=this;this.version="1.7.13",this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat("1.7.13")),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([n],i))},t.prototype.getLength=function(t){return En(t,"number")?t:En(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;void 0===e&&(e=1);var i=this.config;return Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,r,o){var a={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[o];if(a)return a(r);var s=i.handleCssUnit||i.unitFunc;return s?s(r,o):r})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!Pn(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Nn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new Xn(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),qn=function(t){return Math.PI/180*t},Yn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=qn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Kn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},Vn=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},Jn=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},Qn=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return n({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return n({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},o.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var a=this;return r(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if(u&&u.imgs){var h=u.imgs[o];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]),a.loadImg(h.src,h).then((function(t){return i(a,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return"function"!=typeof h.formatter?[3,2]:[4,Promise.resolve(h.formatter.call(this,t))];case 1:t=i.sent(),i.label=2;case 2:return l[n][e][o]=t,s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),c()}))}}}))]}))}))},o.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return _n(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(qn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=qn(this.prizeDeg);var c=qn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;_n(l)&&(o.fillStyle=l,Yn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+qn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?$n(o,An(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(qn(360)-i-qn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=Jn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},o.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},o.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=jn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},o.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=Vn(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=Jn(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},o.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},o}(Un),Zn=function(t){function a(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},a.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},a.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},a.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return n({background:"#ffce98",shadow:""},t.activeStyle)}))},a.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},a.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},a.prototype.handleClick=function(t){var e=this,n=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},a.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var a=this;return r(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if("buttons"===t&&!a.buttons.length&&a.button&&(u=a.button),u&&u.imgs){var h=u.imgs[o];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]);var f=[a.loadImg(h.src,h),h.activeSrc&&a.loadImg(h.activeSrc,h,"$activeResolve")];Promise.all(f).then((function(t){var c=t[0],u=t[1];return i(a,void 0,void 0,(function(){var t;return r(this,(function(i){switch(i.label){case 0:return"function"!=typeof(t=h.formatter)?[3,3]:[4,Promise.resolve(t.call(this,c))];case 1:return c=i.sent(),u?[4,Promise.resolve(t.call(this,u))]:[3,3];case 2:u=i.sent(),i.label=3;case 3:return l[n][e][o]={defaultImg:c,activeImg:u},s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),c()}))}}}))]}))}))},a.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,a=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,a),a.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=o(o([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,o=t.y,s=t.w,u=t.h,h=Wn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return _n(v)&&(a.fillStyle=n.handleBackground(r,o,s,u,v),Kn(a,r,o,s,u,g),a.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=Tn(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(a,c,r+p,o+g,l,f)}})),{x:r+d,y:o+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),o=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(_n(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(a.shadowColor=p[3],a.shadowOffsetX=p[0]*r.dpr,a.shadowOffsetY=p[1]*r.dpr,a.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=n.handleBackground(o,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Kn(a,o,s,h,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[o+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(a,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;a.font="".concat(i," ").concat(r>>0,"px ").concat(e),a.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=$n(a,An(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){a.fillText(e,o+n.getOffsetX(a.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=Jn(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},a.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},a.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=jn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},a.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=Vn(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=Jn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},a.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},a.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},a}(Un),ti=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var a=this;return r(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if(u&&u.imgs){var h=u.imgs[o];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]),a.loadImg(h.src,h).then((function(t){return i(a,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return"function"!=typeof h.formatter?[3,2]:[4,Promise.resolve(h.formatter.call(this,t))];case 1:t=i.sent(),i.label=2;case 2:return l[n][e][o]=t,s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),c()}))}}}))]}))}))},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(_n(S)){var C=t.getLength(Pn(r,"borderRadius")?r.borderRadius:n.borderRadius);Kn(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=Tn(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=$n(m,An(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),x=C[0],z=C[1];t.drawImage(m,v,g,y,w,b,x,z,w,b),S+=s}}}))},o.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Wn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return _n(v)&&(Kn(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=Tn(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,x,z,O)}))}},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=Jn(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},o.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},o.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!En(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},o.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=Vn(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=Jn(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},o.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},o.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o}(Un);exports.LuckyGrid=Zn,exports.LuckyWheel=Qn,exports.SlotMachine=ti,exports.cutRound=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;return n.width=r,n.height=o,Kn(i,0,0,r,o,e),i.clip(),i.drawImage(t,0,0,r,o),n},exports.opacity=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(100*e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e)}i.putImageData(a,0,0)}return n}; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -15,3 +15,3 @@ /*! ***************************************************************************** | ||
***************************************************************************** */ | ||
var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function i(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function r(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var c,u,h=function(t){return t&&t.Math==Math&&t},l=h("object"==typeof globalThis&&globalThis)||h("object"==typeof window&&window)||h("object"==typeof self&&self)||h("object"==typeof a&&a)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},d=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,g=p.bind?p.bind(p):function(){return p.apply(p,arguments)},v={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,y={f:m&&!v.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:v},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,S=b.bind,C=b.call,z=S&&S.bind(C),x=S?function(t){return t&&z(C,t)}:function(t){return t&&function(){return C.apply(t,arguments)}},O=x({}.toString),k=x("".slice),I=function(t){return k(O(t),8,-1)},E=l.Object,T=x("".split),A=f((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==I(t)?T(t,""):E(t)}:E,P=l.TypeError,_=function(t){if(null==t)throw P("Can't call method on "+t);return t},W=function(t){return A(_(t))},$=function(t){return"function"==typeof t},j=function(t){return"object"==typeof t?null!==t:$(t)},R=function(t){return $(t)?t:void 0},F=function(t,e){return arguments.length<2?R(l[t]):l[t]&&l[t][e]},D=x({}.isPrototypeOf),H=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(u=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!u&&H&&(!(c=H.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=H.match(/Chrome\/(\d+)/))&&(u=+c[1]);var X=u,G=!!Object.getOwnPropertySymbols&&!f((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),U=G&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,Y=U?function(t){return"symbol"==typeof t}:function(t){var e=F("Symbol");return $(e)&&D(e.prototype,q(t))},K=l.String,V=l.TypeError,J=function(t){if($(t))return t;throw V(function(t){try{return K(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=l.TypeError,Z=Object.defineProperty,tt=function(t,e){try{Z(l,t,{value:e,configurable:!0,writable:!0})}catch(n){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),nt=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),it=l.Object,rt=function(t){return it(_(t))},ot=x({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ut=x(1..toString),ht=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ut(++st+ct,36)},lt=nt("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ht,gt=function(t){if(!at(lt,t)||!G&&"string"!=typeof lt[t]){var e="Symbol."+t;G&&at(ft,t)?lt[t]=ft[t]:lt[t]=U&&dt?dt(e):pt(e)}return lt[t]},vt=l.TypeError,mt=gt("toPrimitive"),yt=function(t,e){if(!j(t)||Y(t))return t;var n,i,r=null==(n=t[mt])?void 0:J(n);if(r){if(void 0===e&&(e="default"),i=g(r,t,e),!j(i)||Y(i))return i;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&$(n=t.toString)&&!j(i=g(n,t)))return i;if($(n=t.valueOf)&&!j(i=g(n,t)))return i;if("string"!==e&&$(n=t.toString)&&!j(i=g(n,t)))return i;throw Q("Can't convert object to primitive value")}(t,e)},wt=function(t){var e=yt(t,"string");return Y(e)?e:e+""},bt=l.document,St=j(bt)&&j(bt.createElement),Ct=function(t){return St?bt.createElement(t):{}},zt=!d&&!f((function(){return 7!=Object.defineProperty(Ct("div"),"a",{get:function(){return 7}}).a})),xt=Object.getOwnPropertyDescriptor,Ot={f:d?xt:function(t,e){if(t=W(t),e=wt(e),zt)try{return xt(t,e)}catch(t){}if(at(t,e))return w(!g(y.f,t,e),t[e])}},kt=l.String,It=l.TypeError,Et=function(t){if(j(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,At=Object.defineProperty,Pt={f:d?At:function(t,e,n){if(Et(t),e=wt(e),Et(n),zt)try{return At(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Tt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},_t=d?function(t,e,n){return Pt.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},Wt=x(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Wt(t)});var $t,jt,Rt,Ft=et.inspectSource,Dt=l.WeakMap,Ht=$(Dt)&&/native code/.test(Ft(Dt)),Lt=nt("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ht(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Ht||et.state){var Gt=et.state||(et.state=new Xt),Ut=x(Gt.get),qt=x(Gt.has),Yt=x(Gt.set);$t=function(t,e){if(qt(Gt,t))throw new Nt("Object already initialized");return e.facade=t,Yt(Gt,t,e),e},jt=function(t){return Ut(Gt,t)||{}},Rt=function(t){return qt(Gt,t)}}else{var Kt=Mt("state");Bt[Kt]=!0,$t=function(t,e){if(at(t,Kt))throw new Nt("Object already initialized");return e.facade=t,_t(t,Kt,e),e},jt=function(t){return at(t,Kt)?t[Kt]:{}},Rt=function(t){return at(t,Kt)}}var Vt,Jt={set:$t,get:jt,has:Rt,enforce:function(t){return Rt(t)?jt(t):$t(t,{})},getterFor:function(t){return function(e){var n;if(!j(e)||(n=jt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return n}}},Qt=Function.prototype,Zt=d&&Object.getOwnPropertyDescriptor,te=at(Qt,"name"),ee={EXISTS:te,PROPER:te&&"something"===function(){}.name,CONFIGURABLE:te&&(!d||d&&Zt(Qt,"name").configurable)},ne=s((function(t){var e=ee.CONFIGURABLE,n=Jt.get,i=Jt.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;$(o)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!at(o,"name")||e&&o.name!==f)&&_t(o,"name",f),(s=i(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:_t(t,n,o)):u?t[n]=o:tt(n,o)})(Function.prototype,"toString",(function(){return $(this)&&n(this).source||Ft(this)}))})),ie=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ie)(e)},ae=Math.max,se=Math.min,ce=Math.min,ue=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},he=function(t){return function(e,n,i){var r,o=W(e),a=ue(o),s=function(t,e){var n=oe(t);return n<0?ae(n+e,0):se(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},le={includes:he(!0),indexOf:he(!1)},fe=le.indexOf,de=x([].push),pe=function(t,e){var n,i=W(t),r=0,o=[];for(n in i)!at(Bt,n)&&at(i,n)&&de(o,n);for(;e.length>r;)at(i,n=e[r++])&&(~fe(o,n)||de(o,n));return o},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),me={f:Object.getOwnPropertyNames||function(t){return pe(t,ve)}},ye={f:Object.getOwnPropertySymbols},we=x([].concat),be=F("Reflect","ownKeys")||function(t){var e=me.f(Et(t)),n=ye.f;return n?we(e,n(t)):e},Se=function(t,e){for(var n=be(e),i=Pt.f,r=Ot.f,o=0;o<n.length;o++){var a=n[o];at(t,a)||i(t,a,r(e,a))}},Ce=/#|\.prototype\./,ze=function(t,e){var n=Oe[xe(t)];return n==Ie||n!=ke&&($(e)?f(e):!!e)},xe=ze.normalize=function(t){return String(t).replace(Ce,".").toLowerCase()},Oe=ze.data={},ke=ze.NATIVE="N",Ie=ze.POLYFILL="P",Ee=ze,Te=Ot.f,Ae=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?l:u?l[s]||tt(s,{}):(l[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=Te(n,i))&&a.value:n[i],!Ee(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ne(n,i,o,t)}},Pe=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var n,i=W(e),r=Pe(e),o=r.length,a=0;o>a;)Pt.f(t,n=r[a++],i[n]);return t},We=F("document","documentElement"),$e=Mt("IE_PROTO"),je=function(){},Re=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(Re("")),t.close();var e=t.parentWindow.Object;return t=null,e},De=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;De="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",We.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Re("document.F=Object")),t.close(),t.F):Fe(Vt);for(var n=ge.length;n--;)delete De.prototype[ge[n]];return De()};Bt[$e]=!0;var He=Object.create||function(t,e){var n;return null!==t?(je.prototype=Et(t),n=new je,je.prototype=null,n[$e]=t):n=De(),void 0===e?n:_e(n,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&Pt.f(Me,Le,{configurable:!0,value:He(null)});var Be=function(t){Me[Le][t]=!0},Ne=le.includes;Ae({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),Ae({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:Pt.f});var Xe=gt("match"),Ge=l.TypeError,Ue=function(t){if(function(t){var e;return j(t)&&(void 0!==(e=t[Xe])?!!e:"RegExp"==I(t))}(t))throw Ge("The method doesn't accept regular expressions");return t},qe={};qe[gt("toStringTag")]="z";var Ye="[object z]"===String(qe),Ke=gt("toStringTag"),Ve=l.Object,Je="Arguments"==I(function(){return arguments}()),Qe=Ye?I:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?n:Je?I(e):"Object"==(i=I(e))&&$(e.callee)?"Arguments":i},Ze=l.String,tn=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},en=gt("match"),nn=x("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[en]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~nn(tn(_(this)),tn(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var rn,on,an=le.indexOf,sn=x([].indexOf),cn=!!sn&&1/sn([1],1,-0)<0,un=!!(on=[]["indexOf"])&&f((function(){on.call(null,rn||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:cn||!un},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return cn?sn(this,t,e)||0:an(this,t,e)}});var hn=x(x.bind),ln=Array.isArray||function(t){return"Array"==I(t)},fn=function(){},dn=[],pn=F("Reflect","construct"),gn=/^\s*(?:class|function)\b/,vn=x(gn.exec),mn=!gn.exec(fn),yn=function(t){if(!$(t))return!1;try{return pn(fn,dn,t),!0}catch(t){return!1}},wn=!pn||f((function(){var t;return yn(yn.call)||!yn(Object)||!yn((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return mn||!!vn(gn,Ft(t))}:yn,bn=gt("species"),Sn=l.Array,Cn=function(t,e){return new(function(t){var e;return ln(t)&&(e=t.constructor,(wn(e)&&(e===Sn||ln(e.prototype))||j(e)&&null===(e=e[bn]))&&(e=void 0)),void 0===e?Sn:e}(t))(0===e?0:e)},zn=x([].push),xn=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hn?hn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=ue(g),y=0,w=l||Cn,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:zn(b,f)}else switch(t){case 4:return!1;case 7:zn(b,f)}return o?-1:i||r?r:b}},On={forEach:xn(0),map:xn(1),filter:xn(2),some:xn(3),every:xn(4),find:xn(5),findIndex:xn(6),filterReject:xn(7)}.find,kn=!0;"find"in[]&&Array(1).find((function(){kn=!1})),Ae({target:"Array",proto:!0,forced:kn},{find:function(t){return On(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find");var In=Ye?{}.toString:function(){return"[object "+Qe(this)+"]"};Ye||ne(Object.prototype,"toString",In,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var En=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Tn=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!En(r,"object","array"))return r;t=r}return t},An=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Pn=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},_n=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Wn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&En(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},$n=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},jn=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Rn=function(t){return Math.PI/180*t},Fn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=Rn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Dn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},Hn=function(t,e,n,i,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,u=t.height;a.width=c,a.height=u;var h=c/i;return Dn(s,e*h,n*h,i*h,r*h,o*h),s.clip(),s.drawImage(t,0,0,c,u),a},Ln=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;n.width=r,n.height=o,i.drawImage(t,0,0,r,o);var a=i.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var n=Math.ceil(t),i=e*e,r=2*i,o=1/(2*Math.PI*i),a=[],s=0,c=-n;c<=n;c++)for(var u=-n;u<=n;u++){var h=o*Math.exp(-(c*c+u*u)/r);a.push(h),s+=h}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),i.putImageData(a,0,0),n},Mn=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Bn="__proto__"in{};function Nn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Xn=Array.prototype,Gn=Object.create(Xn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Gn[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Xn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Un=function(){function t(t){this.dep=new Mn,Nn(t,"__luckyOb__",this),Array.isArray(t)&&(Bn?t.__proto__=Gn:Object.getOwnPropertyNames(Gn).forEach((function(e){Nn(t,e,Gn[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Yn(t,e,t[e])}))},t}();function qn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Un(t)}function Yn(t,e,n){var i=new Mn,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=qn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Mn.target&&(i.addSub(Mn.target),s&&s.dep.addSub(Mn.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=qn(e),i.notify()))}})}}var Kn=0,Vn=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=Kn++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Mn.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){En(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Mn.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Jn=function(){function t(t,e){var n=this;this.version="1.7.12",this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat("1.7.12")),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([n],i))},t.prototype.getLength=function(t){return En(t,"number")?t:En(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,i,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(i);var a=n.config.unitFunc;return a?a(i,r):i})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!An(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=n.map((function(t){return e.getLength(t)}));return Hn.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e/100)}i.putImageData(a,0,0)}return n}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Ln(t,this.getLength(e))},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Yn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new Vn(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),Qn=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},Zn=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},ti=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return n({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return n({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},o.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]),i.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(i,t)),u[n][e][o]=t,r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},o.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return _n(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Rn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Rn(this.prizeDeg);var c=Rn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;_n(l)&&(o.fillStyle=l,Fn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+Rn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?jn(o,Pn(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(Rn(360)-i-Rn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=Zn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},o.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},o.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=$n(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},o.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=Qn(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=Zn(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},o.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},o}(Jn),ei=function(t){function a(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},a.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},a.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},a.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return n({background:"#ffce98",shadow:""},t.activeStyle)}))},a.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},a.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},a.prototype.handleClick=function(t){var e=this,n=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},a.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if("buttons"===t&&!i.buttons.length&&i.button&&(s=i.button),s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]);var h=[i.loadImg(c.src,c),c.activeSrc&&i.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(h).then((function(t){var a=t[0],s=t[1],h=c.formatter;"function"==typeof h&&(a=h.call(i,a),s&&(s=h.call(i,s))),u[n][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},a.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,a=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,a),a.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=o(o([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,o=t.y,s=t.w,u=t.h,h=Wn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return _n(v)&&(a.fillStyle=n.handleBackground(r,o,s,u,v),Dn(a,r,o,s,u,g),a.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=Tn(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(a,c,r+p,o+g,l,f)}})),{x:r+d,y:o+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),o=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(_n(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(a.shadowColor=p[3],a.shadowOffsetX=p[0]*r.dpr,a.shadowOffsetY=p[1]*r.dpr,a.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=n.handleBackground(o,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Dn(a,o,s,h,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[o+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(a,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;a.font="".concat(i," ").concat(r>>0,"px ").concat(e),a.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=jn(a,Pn(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){a.fillText(e,o+n.getOffsetX(a.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=Zn(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},a.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},a.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=$n(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},a.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=Qn(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=Zn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},a.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},a.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},a}(Jn),ni=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var i=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=i[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var u=i.ImageCache;u[n][e]||(u[n][e]=[]),i.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(i,t)),u[n][e][o]=t,r()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),a()}))}}}))]}))}))},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(_n(S)){var C=t.getLength(An(r,"borderRadius")?r.borderRadius:n.borderRadius);Dn(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=Tn(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=jn(m,Pn(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),z=C[0],x=C[1];t.drawImage(m,v,g,y,w,b,z,x,w,b),S+=s}}}))},o.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Wn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return _n(v)&&(Dn(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=Tn(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],z=S[1],x=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,z,x,O)}))}},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=Zn(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},o.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},o.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!En(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},o.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=Qn(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=Zn(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},o.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},o.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o}(Jn);export{ei as LuckyGrid,ti as LuckyWheel,ni as SlotMachine}; | ||
var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function i(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function r(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var c,u,h=function(t){return t&&t.Math==Math&&t},l=h("object"==typeof globalThis&&globalThis)||h("object"==typeof window&&window)||h("object"==typeof self&&self)||h("object"==typeof a&&a)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},d=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,g=p.bind?p.bind(p):function(){return p.apply(p,arguments)},v={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,y={f:m&&!v.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:v},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,S=b.bind,C=b.call,z=S&&S.bind(C),x=S?function(t){return t&&z(C,t)}:function(t){return t&&function(){return C.apply(t,arguments)}},O=x({}.toString),k=x("".slice),I=function(t){return k(O(t),8,-1)},E=l.Object,T=x("".split),A=f((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==I(t)?T(t,""):E(t)}:E,P=l.TypeError,_=function(t){if(null==t)throw P("Can't call method on "+t);return t},W=function(t){return A(_(t))},j=function(t){return"function"==typeof t},$=function(t){return"object"==typeof t?null!==t:j(t)},R=function(t){return j(t)?t:void 0},F=function(t,e){return arguments.length<2?R(l[t]):l[t]&&l[t][e]},D=x({}.isPrototypeOf),H=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(u=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!u&&H&&(!(c=H.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=H.match(/Chrome\/(\d+)/))&&(u=+c[1]);var X=u,G=!!Object.getOwnPropertySymbols&&!f((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),U=G&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,Y=U?function(t){return"symbol"==typeof t}:function(t){var e=F("Symbol");return j(e)&&D(e.prototype,q(t))},K=l.String,V=l.TypeError,J=function(t){if(j(t))return t;throw V(function(t){try{return K(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=l.TypeError,Z=Object.defineProperty,tt=function(t,e){try{Z(l,t,{value:e,configurable:!0,writable:!0})}catch(n){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),nt=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),it=l.Object,rt=function(t){return it(_(t))},ot=x({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ut=x(1..toString),ht=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ut(++st+ct,36)},lt=nt("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ht,gt=function(t){if(!at(lt,t)||!G&&"string"!=typeof lt[t]){var e="Symbol."+t;G&&at(ft,t)?lt[t]=ft[t]:lt[t]=U&&dt?dt(e):pt(e)}return lt[t]},vt=l.TypeError,mt=gt("toPrimitive"),yt=function(t,e){if(!$(t)||Y(t))return t;var n,i,r=null==(n=t[mt])?void 0:J(n);if(r){if(void 0===e&&(e="default"),i=g(r,t,e),!$(i)||Y(i))return i;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&j(n=t.toString)&&!$(i=g(n,t)))return i;if(j(n=t.valueOf)&&!$(i=g(n,t)))return i;if("string"!==e&&j(n=t.toString)&&!$(i=g(n,t)))return i;throw Q("Can't convert object to primitive value")}(t,e)},wt=function(t){var e=yt(t,"string");return Y(e)?e:e+""},bt=l.document,St=$(bt)&&$(bt.createElement),Ct=function(t){return St?bt.createElement(t):{}},zt=!d&&!f((function(){return 7!=Object.defineProperty(Ct("div"),"a",{get:function(){return 7}}).a})),xt=Object.getOwnPropertyDescriptor,Ot={f:d?xt:function(t,e){if(t=W(t),e=wt(e),zt)try{return xt(t,e)}catch(t){}if(at(t,e))return w(!g(y.f,t,e),t[e])}},kt=l.String,It=l.TypeError,Et=function(t){if($(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,At=Object.defineProperty,Pt={f:d?At:function(t,e,n){if(Et(t),e=wt(e),Et(n),zt)try{return At(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Tt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},_t=d?function(t,e,n){return Pt.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},Wt=x(Function.toString);j(et.inspectSource)||(et.inspectSource=function(t){return Wt(t)});var jt,$t,Rt,Ft=et.inspectSource,Dt=l.WeakMap,Ht=j(Dt)&&/native code/.test(Ft(Dt)),Lt=nt("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ht(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Ht||et.state){var Gt=et.state||(et.state=new Xt),Ut=x(Gt.get),qt=x(Gt.has),Yt=x(Gt.set);jt=function(t,e){if(qt(Gt,t))throw new Nt("Object already initialized");return e.facade=t,Yt(Gt,t,e),e},$t=function(t){return Ut(Gt,t)||{}},Rt=function(t){return qt(Gt,t)}}else{var Kt=Mt("state");Bt[Kt]=!0,jt=function(t,e){if(at(t,Kt))throw new Nt("Object already initialized");return e.facade=t,_t(t,Kt,e),e},$t=function(t){return at(t,Kt)?t[Kt]:{}},Rt=function(t){return at(t,Kt)}}var Vt,Jt={set:jt,get:$t,has:Rt,enforce:function(t){return Rt(t)?$t(t):jt(t,{})},getterFor:function(t){return function(e){var n;if(!$(e)||(n=$t(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return n}}},Qt=Function.prototype,Zt=d&&Object.getOwnPropertyDescriptor,te=at(Qt,"name"),ee={EXISTS:te,PROPER:te&&"something"===function(){}.name,CONFIGURABLE:te&&(!d||d&&Zt(Qt,"name").configurable)},ne=s((function(t){var e=ee.CONFIGURABLE,n=Jt.get,i=Jt.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;j(o)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!at(o,"name")||e&&o.name!==f)&&_t(o,"name",f),(s=i(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:_t(t,n,o)):u?t[n]=o:tt(n,o)})(Function.prototype,"toString",(function(){return j(this)&&n(this).source||Ft(this)}))})),ie=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ie)(e)},ae=Math.max,se=Math.min,ce=Math.min,ue=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},he=function(t){return function(e,n,i){var r,o=W(e),a=ue(o),s=function(t,e){var n=oe(t);return n<0?ae(n+e,0):se(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},le={includes:he(!0),indexOf:he(!1)},fe=le.indexOf,de=x([].push),pe=function(t,e){var n,i=W(t),r=0,o=[];for(n in i)!at(Bt,n)&&at(i,n)&&de(o,n);for(;e.length>r;)at(i,n=e[r++])&&(~fe(o,n)||de(o,n));return o},ge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ve=ge.concat("length","prototype"),me={f:Object.getOwnPropertyNames||function(t){return pe(t,ve)}},ye={f:Object.getOwnPropertySymbols},we=x([].concat),be=F("Reflect","ownKeys")||function(t){var e=me.f(Et(t)),n=ye.f;return n?we(e,n(t)):e},Se=function(t,e){for(var n=be(e),i=Pt.f,r=Ot.f,o=0;o<n.length;o++){var a=n[o];at(t,a)||i(t,a,r(e,a))}},Ce=/#|\.prototype\./,ze=function(t,e){var n=Oe[xe(t)];return n==Ie||n!=ke&&(j(e)?f(e):!!e)},xe=ze.normalize=function(t){return String(t).replace(Ce,".").toLowerCase()},Oe=ze.data={},ke=ze.NATIVE="N",Ie=ze.POLYFILL="P",Ee=ze,Te=Ot.f,Ae=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?l:u?l[s]||tt(s,{}):(l[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=Te(n,i))&&a.value:n[i],!Ee(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ne(n,i,o,t)}},Pe=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var n,i=W(e),r=Pe(e),o=r.length,a=0;o>a;)Pt.f(t,n=r[a++],i[n]);return t},We=F("document","documentElement"),je=Mt("IE_PROTO"),$e=function(){},Re=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(Re("")),t.close();var e=t.parentWindow.Object;return t=null,e},De=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;De="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",We.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Re("document.F=Object")),t.close(),t.F):Fe(Vt);for(var n=ge.length;n--;)delete De.prototype[ge[n]];return De()};Bt[je]=!0;var He=Object.create||function(t,e){var n;return null!==t?($e.prototype=Et(t),n=new $e,$e.prototype=null,n[je]=t):n=De(),void 0===e?n:_e(n,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&Pt.f(Me,Le,{configurable:!0,value:He(null)});var Be=function(t){Me[Le][t]=!0},Ne=le.includes;Ae({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),Ae({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:Pt.f});var Xe=gt("match"),Ge=l.TypeError,Ue=function(t){if(function(t){var e;return $(t)&&(void 0!==(e=t[Xe])?!!e:"RegExp"==I(t))}(t))throw Ge("The method doesn't accept regular expressions");return t},qe={};qe[gt("toStringTag")]="z";var Ye="[object z]"===String(qe),Ke=gt("toStringTag"),Ve=l.Object,Je="Arguments"==I(function(){return arguments}()),Qe=Ye?I:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?n:Je?I(e):"Object"==(i=I(e))&&j(e.callee)?"Arguments":i},Ze=l.String,tn=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},en=gt("match"),nn=x("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[en]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~nn(tn(_(this)),tn(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var rn,on,an=le.indexOf,sn=x([].indexOf),cn=!!sn&&1/sn([1],1,-0)<0,un=!!(on=[]["indexOf"])&&f((function(){on.call(null,rn||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:cn||!un},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return cn?sn(this,t,e)||0:an(this,t,e)}});var hn=x(x.bind),ln=Array.isArray||function(t){return"Array"==I(t)},fn=function(){},dn=[],pn=F("Reflect","construct"),gn=/^\s*(?:class|function)\b/,vn=x(gn.exec),mn=!gn.exec(fn),yn=function(t){if(!j(t))return!1;try{return pn(fn,dn,t),!0}catch(t){return!1}},wn=!pn||f((function(){var t;return yn(yn.call)||!yn(Object)||!yn((function(){t=!0}))||t}))?function(t){if(!j(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return mn||!!vn(gn,Ft(t))}:yn,bn=gt("species"),Sn=l.Array,Cn=function(t,e){return new(function(t){var e;return ln(t)&&(e=t.constructor,(wn(e)&&(e===Sn||ln(e.prototype))||$(e)&&null===(e=e[bn]))&&(e=void 0)),void 0===e?Sn:e}(t))(0===e?0:e)},zn=x([].push),xn=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hn?hn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=ue(g),y=0,w=l||Cn,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:zn(b,f)}else switch(t){case 4:return!1;case 7:zn(b,f)}return o?-1:i||r?r:b}},On={forEach:xn(0),map:xn(1),filter:xn(2),some:xn(3),every:xn(4),find:xn(5),findIndex:xn(6),filterReject:xn(7)}.find,kn=!0;"find"in[]&&Array(1).find((function(){kn=!1})),Ae({target:"Array",proto:!0,forced:kn},{find:function(t){return On(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find");var In=Ye?{}.toString:function(){return"[object "+Qe(this)+"]"};Ye||ne(Object.prototype,"toString",In,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var En=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Tn=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!En(r,"object","array"))return r;t=r}return t},An=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Pn=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},_n=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Wn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&En(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},jn=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},$n=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Rn=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Fn="__proto__"in{};function Dn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Hn=Array.prototype,Ln=Object.create(Hn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Ln[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Hn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Mn=function(){function t(t){this.dep=new Rn,Dn(t,"__luckyOb__",this),Array.isArray(t)&&(Fn?t.__proto__=Ln:Object.getOwnPropertyNames(Ln).forEach((function(e){Dn(t,e,Ln[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Nn(t,e,t[e])}))},t}();function Bn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Mn(t)}function Nn(t,e,n){var i=new Rn,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=Bn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Rn.target&&(i.addSub(Rn.target),s&&s.dep.addSub(Rn.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=Bn(e),i.notify()))}})}}var Xn=0,Gn=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=Xn++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Rn.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){En(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Rn.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Un=function(){function t(t,e){var n=this;this.version="1.7.13",this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat("1.7.13")),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([n],i))},t.prototype.getLength=function(t){return En(t,"number")?t:En(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;void 0===e&&(e=1);var i=this.config;return Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,r,o){var a={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[o];if(a)return a(r);var s=i.handleCssUnit||i.unitFunc;return s?s(r,o):r})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return En(t,"number")?t:En(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!An(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Nn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new Gn(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),qn=function(t){return Math.PI/180*t},Yn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=qn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Kn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},Vn=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},Jn=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},Qn=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return n({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return n({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},o.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var a=this;return r(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if(u&&u.imgs){var h=u.imgs[o];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]),a.loadImg(h.src,h).then((function(t){return i(a,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return"function"!=typeof h.formatter?[3,2]:[4,Promise.resolve(h.formatter.call(this,t))];case 1:t=i.sent(),i.label=2;case 2:return l[n][e][o]=t,s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),c()}))}}}))]}))}))},o.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return _n(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(qn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=qn(this.prizeDeg);var c=qn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;_n(l)&&(o.fillStyle=l,Yn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+qn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?$n(o,Pn(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(qn(360)-i-qn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&_n(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=Jn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},o.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},o.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=jn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},o.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=Vn(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=Jn(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},o.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},o}(Un),Zn=function(t){function a(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},a.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},a.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},a.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return n({background:"#ffce98",shadow:""},t.activeStyle)}))},a.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},a.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},a.prototype.handleClick=function(t){var e=this,n=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},a.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var a=this;return r(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if("buttons"===t&&!a.buttons.length&&a.button&&(u=a.button),u&&u.imgs){var h=u.imgs[o];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]);var f=[a.loadImg(h.src,h),h.activeSrc&&a.loadImg(h.activeSrc,h,"$activeResolve")];Promise.all(f).then((function(t){var c=t[0],u=t[1];return i(a,void 0,void 0,(function(){var t;return r(this,(function(i){switch(i.label){case 0:return"function"!=typeof(t=h.formatter)?[3,3]:[4,Promise.resolve(t.call(this,c))];case 1:return c=i.sent(),u?[4,Promise.resolve(t.call(this,u))]:[3,3];case 2:u=i.sent(),i.label=3;case 3:return l[n][e][o]={defaultImg:c,activeImg:u},s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),c()}))}}}))]}))}))},a.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,a=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,a),a.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=o(o([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,o=t.y,s=t.w,u=t.h,h=Wn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return _n(v)&&(a.fillStyle=n.handleBackground(r,o,s,u,v),Kn(a,r,o,s,u,g),a.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=Tn(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(a,c,r+p,o+g,l,f)}})),{x:r+d,y:o+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),o=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(_n(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(a.shadowColor=p[3],a.shadowOffsetX=p[0]*r.dpr,a.shadowOffsetY=p[1]*r.dpr,a.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=n.handleBackground(o,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Kn(a,o,s,h,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[o+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(a,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;a.font="".concat(i," ").concat(r>>0,"px ").concat(e),a.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=$n(a,Pn(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){a.fillText(e,o+n.getOffsetX(a.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=Jn(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},a.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},a.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=jn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},a.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=Vn(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=Jn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},a.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},a.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},a}(Un),ti=function(t){function o(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},o.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},o.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},o.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=n({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return n({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},o.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},o.prototype.init=function(){var t,e;return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,n,o){return i(this,void 0,void 0,(function(){var a=this;return r(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if(u&&u.imgs){var h=u.imgs[o];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]),a.loadImg(h.src,h).then((function(t){return i(a,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return"function"!=typeof h.formatter?[3,2]:[4,Promise.resolve(h.formatter.call(this,t))];case 1:t=i.sent(),i.label=2;case 2:return l[n][e][o]=t,s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(o,"] ").concat(n)),c()}))}}}))]}))}))},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(_n(S)){var C=t.getLength(An(r,"borderRadius")?r.borderRadius:n.borderRadius);Kn(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=Tn(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=$n(m,Pn(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),z=C[0],x=C[1];t.drawImage(m,v,g,y,w,b,z,x,w,b),S+=s}}}))},o.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Wn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return _n(v)&&(Kn(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=Tn(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],z=S[1],x=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,z,x,O)}))}},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=Jn(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},o.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},o.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!En(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},o.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=Vn(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=Jn(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},o.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},o.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o}(Un),ei=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;return n.width=r,n.height=o,Kn(i,0,0,r,o,e),i.clip(),i.drawImage(t,0,0,r,o),n},ni=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(100*e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e)}i.putImageData(a,0,0)}return n};export{Zn as LuckyGrid,Qn as LuckyWheel,ti as SlotMachine,ei as cutRound,ni as opacity}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -15,3 +15,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).LuckyCanvas={})}(this,(function(t){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function r(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function o(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function a(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var u,h,l=function(t){return t&&t.Math==Math&&t},f=l("object"==typeof globalThis&&globalThis)||l("object"==typeof window&&window)||l("object"==typeof self&&self)||l("object"==typeof s&&s)||function(){return this}()||Function("return this")(),d=function(t){try{return!!t()}catch(t){return!0}},p=!d((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),g=Function.prototype.call,v=g.bind?g.bind(g):function(){return g.apply(g,arguments)},m={}.propertyIsEnumerable,y=Object.getOwnPropertyDescriptor,w={f:y&&!m.call({1:2},1)?function(t){var e=y(this,t);return!!e&&e.enumerable}:m},b=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},S=Function.prototype,C=S.bind,x=S.call,z=C&&C.bind(x),O=C?function(t){return t&&z(x,t)}:function(t){return t&&function(){return x.apply(t,arguments)}},k=O({}.toString),I=O("".slice),T=function(t){return I(k(t),8,-1)},E=f.Object,A=O("".split),P=d((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==T(t)?A(t,""):E(t)}:E,W=f.TypeError,_=function(t){if(null==t)throw W("Can't call method on "+t);return t},$=function(t){return P(_(t))},j=function(t){return"function"==typeof t},R=function(t){return"object"==typeof t?null!==t:j(t)},F=function(t){return j(t)?t:void 0},D=function(t,e){return arguments.length<2?F(f[t]):f[t]&&f[t][e]},L=O({}.isPrototypeOf),H=D("navigator","userAgent")||"",M=f.process,B=f.Deno,N=M&&M.versions||B&&B.version,G=N&&N.v8;G&&(h=(u=G.split("."))[0]>0&&u[0]<4?1:+(u[0]+u[1])),!h&&H&&(!(u=H.match(/Edge\/(\d+)/))||u[1]>=74)&&(u=H.match(/Chrome\/(\d+)/))&&(h=+u[1]);var X=h,U=!!Object.getOwnPropertySymbols&&!d((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),q=U&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=f.Object,K=q?function(t){return"symbol"==typeof t}:function(t){var e=D("Symbol");return j(e)&&L(e.prototype,Y(t))},V=f.String,J=f.TypeError,Q=function(t){if(j(t))return t;throw J(function(t){try{return V(t)}catch(t){return"Object"}}(t)+" is not a function")},Z=f.TypeError,tt=Object.defineProperty,et=function(t,e){try{tt(f,t,{value:e,configurable:!0,writable:!0})}catch(n){f[t]=e}return e},nt="__core-js_shared__",it=f[nt]||et(nt,{}),rt=c((function(t){(t.exports=function(t,e){return it[t]||(it[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),ot=f.Object,at=function(t){return ot(_(t))},st=O({}.hasOwnProperty),ct=Object.hasOwn||function(t,e){return st(at(t),e)},ut=0,ht=Math.random(),lt=O(1..toString),ft=function(t){return"Symbol("+(void 0===t?"":t)+")_"+lt(++ut+ht,36)},dt=rt("wks"),pt=f.Symbol,gt=pt&&pt.for,vt=q?pt:pt&&pt.withoutSetter||ft,mt=function(t){if(!ct(dt,t)||!U&&"string"!=typeof dt[t]){var e="Symbol."+t;U&&ct(pt,t)?dt[t]=pt[t]:dt[t]=q&>?gt(e):vt(e)}return dt[t]},yt=f.TypeError,wt=mt("toPrimitive"),bt=function(t,e){if(!R(t)||K(t))return t;var n,i,r=null==(n=t[wt])?void 0:Q(n);if(r){if(void 0===e&&(e="default"),i=v(r,t,e),!R(i)||K(i))return i;throw yt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&j(n=t.toString)&&!R(i=v(n,t)))return i;if(j(n=t.valueOf)&&!R(i=v(n,t)))return i;if("string"!==e&&j(n=t.toString)&&!R(i=v(n,t)))return i;throw Z("Can't convert object to primitive value")}(t,e)},St=function(t){var e=bt(t,"string");return K(e)?e:e+""},Ct=f.document,xt=R(Ct)&&R(Ct.createElement),zt=function(t){return xt?Ct.createElement(t):{}},Ot=!p&&!d((function(){return 7!=Object.defineProperty(zt("div"),"a",{get:function(){return 7}}).a})),kt=Object.getOwnPropertyDescriptor,It={f:p?kt:function(t,e){if(t=$(t),e=St(e),Ot)try{return kt(t,e)}catch(t){}if(ct(t,e))return b(!v(w.f,t,e),t[e])}},Tt=f.String,Et=f.TypeError,At=function(t){if(R(t))return t;throw Et(Tt(t)+" is not an object")},Pt=f.TypeError,Wt=Object.defineProperty,_t={f:p?Wt:function(t,e,n){if(At(t),e=St(e),At(n),Ot)try{return Wt(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Pt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},$t=p?function(t,e,n){return _t.f(t,e,b(1,n))}:function(t,e,n){return t[e]=n,t},jt=O(Function.toString);j(it.inspectSource)||(it.inspectSource=function(t){return jt(t)});var Rt,Ft,Dt,Lt=it.inspectSource,Ht=f.WeakMap,Mt=j(Ht)&&/native code/.test(Lt(Ht)),Bt=rt("keys"),Nt=function(t){return Bt[t]||(Bt[t]=ft(t))},Gt={},Xt="Object already initialized",Ut=f.TypeError,qt=f.WeakMap;if(Mt||it.state){var Yt=it.state||(it.state=new qt),Kt=O(Yt.get),Vt=O(Yt.has),Jt=O(Yt.set);Rt=function(t,e){if(Vt(Yt,t))throw new Ut(Xt);return e.facade=t,Jt(Yt,t,e),e},Ft=function(t){return Kt(Yt,t)||{}},Dt=function(t){return Vt(Yt,t)}}else{var Qt=Nt("state");Gt[Qt]=!0,Rt=function(t,e){if(ct(t,Qt))throw new Ut(Xt);return e.facade=t,$t(t,Qt,e),e},Ft=function(t){return ct(t,Qt)?t[Qt]:{}},Dt=function(t){return ct(t,Qt)}}var Zt,te={set:Rt,get:Ft,has:Dt,enforce:function(t){return Dt(t)?Ft(t):Rt(t,{})},getterFor:function(t){return function(e){var n;if(!R(e)||(n=Ft(e)).type!==t)throw Ut("Incompatible receiver, "+t+" required");return n}}},ee=Function.prototype,ne=p&&Object.getOwnPropertyDescriptor,ie=ct(ee,"name"),re={EXISTS:ie,PROPER:ie&&"something"===function(){}.name,CONFIGURABLE:ie&&(!p||p&&ne(ee,"name").configurable)},oe=c((function(t){var e=re.CONFIGURABLE,n=te.get,i=te.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,l=a&&void 0!==a.name?a.name:n;j(o)&&("Symbol("===String(l).slice(0,7)&&(l="["+String(l).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!ct(o,"name")||e&&o.name!==l)&&$t(o,"name",l),(s=i(o)).source||(s.source=r.join("string"==typeof l?l:""))),t!==f?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:$t(t,n,o)):u?t[n]=o:et(n,o)})(Function.prototype,"toString",(function(){return j(this)&&n(this).source||Lt(this)}))})),ae=Math.ceil,se=Math.floor,ce=function(t){var e=+t;return e!=e||0===e?0:(e>0?se:ae)(e)},ue=Math.max,he=Math.min,le=Math.min,fe=function(t){return(e=t.length)>0?le(ce(e),9007199254740991):0;var e},de=function(t){return function(e,n,i){var r,o=$(e),a=fe(o),s=function(t,e){var n=ce(t);return n<0?ue(n+e,0):he(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},pe={includes:de(!0),indexOf:de(!1)},ge=pe.indexOf,ve=O([].push),me=function(t,e){var n,i=$(t),r=0,o=[];for(n in i)!ct(Gt,n)&&ct(i,n)&&ve(o,n);for(;e.length>r;)ct(i,n=e[r++])&&(~ge(o,n)||ve(o,n));return o},ye=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],we=ye.concat("length","prototype"),be={f:Object.getOwnPropertyNames||function(t){return me(t,we)}},Se={f:Object.getOwnPropertySymbols},Ce=O([].concat),xe=D("Reflect","ownKeys")||function(t){var e=be.f(At(t)),n=Se.f;return n?Ce(e,n(t)):e},ze=function(t,e){for(var n=xe(e),i=_t.f,r=It.f,o=0;o<n.length;o++){var a=n[o];ct(t,a)||i(t,a,r(e,a))}},Oe=/#|\.prototype\./,ke=function(t,e){var n=Te[Ie(t)];return n==Ae||n!=Ee&&(j(e)?d(e):!!e)},Ie=ke.normalize=function(t){return String(t).replace(Oe,".").toLowerCase()},Te=ke.data={},Ee=ke.NATIVE="N",Ae=ke.POLYFILL="P",Pe=ke,We=It.f,_e=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?f:u?f[s]||et(s,{}):(f[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=We(n,i))&&a.value:n[i],!Pe(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;ze(o,r)}(t.sham||r&&r.sham)&&$t(o,"sham",!0),oe(n,i,o,t)}},$e=Object.keys||function(t){return me(t,ye)},je=p?Object.defineProperties:function(t,e){At(t);for(var n,i=$(e),r=$e(e),o=r.length,a=0;o>a;)_t.f(t,n=r[a++],i[n]);return t},Re=D("document","documentElement"),Fe=Nt("IE_PROTO"),De=function(){},Le=function(t){return"<script>"+t+"</"+"script>"},He=function(t){t.write(Le("")),t.close();var e=t.parentWindow.Object;return t=null,e},Me=function(){try{Zt=new ActiveXObject("htmlfile")}catch(t){}var t,e;Me="undefined"!=typeof document?document.domain&&Zt?He(Zt):((e=zt("iframe")).style.display="none",Re.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Le("document.F=Object")),t.close(),t.F):He(Zt);for(var n=ye.length;n--;)delete Me.prototype[ye[n]];return Me()};Gt[Fe]=!0;var Be=Object.create||function(t,e){var n;return null!==t?(De.prototype=At(t),n=new De,De.prototype=null,n[Fe]=t):n=Me(),void 0===e?n:je(n,e)},Ne=mt("unscopables"),Ge=Array.prototype;null==Ge[Ne]&&_t.f(Ge,Ne,{configurable:!0,value:Be(null)});var Xe=function(t){Ge[Ne][t]=!0},Ue=pe.includes;_e({target:"Array",proto:!0},{includes:function(t){return Ue(this,t,arguments.length>1?arguments[1]:void 0)}}),Xe("includes"),_e({target:"Object",stat:!0,forced:!p,sham:!p},{defineProperty:_t.f});var qe=mt("match"),Ye=f.TypeError,Ke=function(t){if(function(t){var e;return R(t)&&(void 0!==(e=t[qe])?!!e:"RegExp"==T(t))}(t))throw Ye("The method doesn't accept regular expressions");return t},Ve={};Ve[mt("toStringTag")]="z";var Je="[object z]"===String(Ve),Qe=mt("toStringTag"),Ze=f.Object,tn="Arguments"==T(function(){return arguments}()),en=Je?T:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ze(t),Qe))?n:tn?T(e):"Object"==(i=T(e))&&j(e.callee)?"Arguments":i},nn=f.String,rn=function(t){if("Symbol"===en(t))throw TypeError("Cannot convert a Symbol value to a string");return nn(t)},on=mt("match"),an=O("".indexOf);_e({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[on]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~an(rn(_(this)),rn(Ke(t)),arguments.length>1?arguments[1]:void 0)}});var sn,cn,un=pe.indexOf,hn=O([].indexOf),ln=!!hn&&1/hn([1],1,-0)<0,fn=!!(cn=[]["indexOf"])&&d((function(){cn.call(null,sn||function(){throw 1},1)}));_e({target:"Array",proto:!0,forced:ln||!fn},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return ln?hn(this,t,e)||0:un(this,t,e)}});var dn=O(O.bind),pn=Array.isArray||function(t){return"Array"==T(t)},gn=function(){},vn=[],mn=D("Reflect","construct"),yn=/^\s*(?:class|function)\b/,wn=O(yn.exec),bn=!yn.exec(gn),Sn=function(t){if(!j(t))return!1;try{return mn(gn,vn,t),!0}catch(t){return!1}},Cn=!mn||d((function(){var t;return Sn(Sn.call)||!Sn(Object)||!Sn((function(){t=!0}))||t}))?function(t){if(!j(t))return!1;switch(en(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return bn||!!wn(yn,Lt(t))}:Sn,xn=mt("species"),zn=f.Array,On=function(t,e){return new(function(t){var e;return pn(t)&&(e=t.constructor,(Cn(e)&&(e===zn||pn(e.prototype))||R(e)&&null===(e=e[xn]))&&(e=void 0)),void 0===e?zn:e}(t))(0===e?0:e)},kn=O([].push),In=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=at(c),g=P(p),v=function(t,e){return Q(t),void 0===e?t:dn?dn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=fe(g),y=0,w=l||On,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:kn(b,f)}else switch(t){case 4:return!1;case 7:kn(b,f)}return o?-1:i||r?r:b}},Tn={forEach:In(0),map:In(1),filter:In(2),some:In(3),every:In(4),find:In(5),findIndex:In(6),filterReject:In(7)}.find,En="find",An=!0;En in[]&&Array(1).find((function(){An=!1})),_e({target:"Array",proto:!0,forced:An},{find:function(t){return Tn(this,t,arguments.length>1?arguments[1]:void 0)}}),Xe(En);var Pn=Je?{}.toString:function(){return"[object "+en(this)+"]"};Je||oe(Object.prototype,"toString",Pn,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var Wn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},_n=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!Wn(r,"object","array"))return r;t=r}return t},$n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},jn=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Rn=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Fn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&Wn(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},Dn=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},Ln=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Hn=function(t){return Math.PI/180*t},Mn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=Hn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Bn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},Nn=function(t,e,n,i,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,u=t.height;a.width=c,a.height=u;var h=c/i;return Bn(s,e*h,n*h,i*h,r*h,o*h),s.clip(),s.drawImage(t,0,0,c,u),a},Gn=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;n.width=r,n.height=o,i.drawImage(t,0,0,r,o);var a=i.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var n=Math.ceil(t),i=e*e,r=2*i,o=1/(2*Math.PI*i),a=[],s=0,c=-n;c<=n;c++)for(var u=-n;u<=n;u++){var h=o*Math.exp(-(c*c+u*u)/r);a.push(h),s+=h}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),i.putImageData(a,0,0),n},Xn="1.7.12",Un=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),qn="__proto__"in{};function Yn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Kn=Array.prototype,Vn=Object.create(Kn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Vn[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Kn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Jn=function(){function t(t){this.dep=new Un,Yn(t,"__luckyOb__",this),Array.isArray(t)&&(qn?t.__proto__=Vn:Object.getOwnPropertyNames(Vn).forEach((function(e){Yn(t,e,Vn[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Zn(t,e,t[e])}))},t}();function Qn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Jn(t)}function Zn(t,e,n){var i=new Un,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=Qn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Un.target&&(i.addSub(Un.target),s&&s.dep.addSub(Un.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=Qn(e),i.notify()))}})}}var ti=0,ei=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=ti++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Un.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){Wn(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Un.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),ni=function(){function t(t,e){var n=this;this.version=Xn,this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat(Xn)),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var o=this.config,s=o.flag,c=o.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,a([n],i))},t.prototype.getLength=function(t){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,i,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(i);var a=n.config.unitFunc;return a?a(i,r):i})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!$n(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=n.map((function(t){return e.getLength(t)}));return Nn.apply(void 0,a([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e/100)}i.putImageData(a,0,0)}return n}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Gn(t,this.getLength(e))},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Zn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new ei(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),ii=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},ri=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},oi=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return i({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return i({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},e.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if(s&&s.imgs){var c=s.imgs[i];if(c){var u=r.ImageCache;u[n][e]||(u[n][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),u[n][e][i]=t,o()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),a()}))}}}))]}))}))},e.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return Rn(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Hn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Hn(this.prizeDeg);var c=Hn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;Rn(l)&&(o.fillStyle=l,Mn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+Hn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?Ln(o,jn(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(Hn(360)-i-Hn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),Rn(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&Rn(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=ri(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},e.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},e.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=Dn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},e.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=ii(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=ri(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},e.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},e}(ni),ai=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return i({background:"#ffce98",shadow:""},t.activeStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},e.prototype.handleClick=function(t){var e=this,n=this.ctx;a(a([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if("buttons"===t&&!r.buttons.length&&r.button&&(s=r.button),s&&s.imgs){var c=s.imgs[i];if(c){var u=r.ImageCache;u[n][e]||(u[n][e]=[]);var h=[r.loadImg(c.src,c),c.activeSrc&&r.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(h).then((function(t){var a=t[0],s=t[1],h=c.formatter;"function"==typeof h&&(a=h.call(r,a),s&&(s=h.call(r,s))),u[n][e][i]={defaultImg:a,activeImg:s},o()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),a()}))}}}))]}))}))},e.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=a(a([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,a=t.y,s=t.w,u=t.h,h=Fn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return Rn(v)&&(o.fillStyle=n.handleBackground(r,a,s,u,v),Bn(o,r,a,s,u,g),o.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=_n(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(o,c,r+p,a+g,l,f)}})),{x:r+d,y:a+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),a=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(Rn(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(o.shadowColor=p[3],o.shadowOffsetX=p[0]*r.dpr,o.shadowOffsetY=p[1]*r.dpr,o.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],a-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),o.fillStyle=n.handleBackground(a,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Bn(o,a,s,h,l,g),o.fill(),o.shadowColor="rgba(0, 0, 0, 0)",o.shadowOffsetX=0,o.shadowOffsetY=0,o.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[a+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(o,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;o.font="".concat(i," ").concat(r>>0,"px ").concat(e),o.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=Ln(o,jn(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){o.fillText(e,a+n.getOffsetX(o.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=ri(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},e.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},e.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=Dn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},e.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=ii(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=ri(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},e.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},e.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},e}(ni),si=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var r=this;return o(this,(function(o){return[2,new Promise((function(o,a){var s=r[t][e];if(s&&s.imgs){var c=s.imgs[i];if(c){var u=r.ImageCache;u[n][e]||(u[n][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),u[n][e][i]=t,o()})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),a()}))}}}))]}))}))},e.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(Rn(S)){var C=t.getLength($n(r,"borderRadius")?r.borderRadius:n.borderRadius);Bn(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=_n(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=Ln(m,jn(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),x=C[0],z=C[1];t.drawImage(m,v,g,y,w,b,x,z,w,b),S+=s}}}))},e.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Fn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return Rn(v)&&(Bn(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=_n(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},e.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,x,z,O)}))}},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=ri(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},e.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},e.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!Wn(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},e.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=ii(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=ri(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},e.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},e.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},e}(ni);t.LuckyGrid=ai,t.LuckyWheel=oi,t.SlotMachine=si,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
***************************************************************************** */var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function r(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((i=i.apply(t,e||[])).next())}))}function o(t,e){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function a(t,e){for(var n=0,i=e.length,r=t.length;n<i;n++,r++)t[r]=e[n];return t}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var u,h,l=function(t){return t&&t.Math==Math&&t},f=l("object"==typeof globalThis&&globalThis)||l("object"==typeof window&&window)||l("object"==typeof self&&self)||l("object"==typeof s&&s)||function(){return this}()||Function("return this")(),d=function(t){try{return!!t()}catch(t){return!0}},p=!d((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),g=Function.prototype.call,v=g.bind?g.bind(g):function(){return g.apply(g,arguments)},m={}.propertyIsEnumerable,y=Object.getOwnPropertyDescriptor,w={f:y&&!m.call({1:2},1)?function(t){var e=y(this,t);return!!e&&e.enumerable}:m},b=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},S=Function.prototype,C=S.bind,x=S.call,z=C&&C.bind(x),O=C?function(t){return t&&z(x,t)}:function(t){return t&&function(){return x.apply(t,arguments)}},k=O({}.toString),I=O("".slice),T=function(t){return I(k(t),8,-1)},E=f.Object,P=O("".split),A=d((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==T(t)?P(t,""):E(t)}:E,W=f.TypeError,_=function(t){if(null==t)throw W("Can't call method on "+t);return t},j=function(t){return A(_(t))},$=function(t){return"function"==typeof t},R=function(t){return"object"==typeof t?null!==t:$(t)},F=function(t){return $(t)?t:void 0},D=function(t,e){return arguments.length<2?F(f[t]):f[t]&&f[t][e]},H=O({}.isPrototypeOf),L=D("navigator","userAgent")||"",M=f.process,B=f.Deno,N=M&&M.versions||B&&B.version,G=N&&N.v8;G&&(h=(u=G.split("."))[0]>0&&u[0]<4?1:+(u[0]+u[1])),!h&&L&&(!(u=L.match(/Edge\/(\d+)/))||u[1]>=74)&&(u=L.match(/Chrome\/(\d+)/))&&(h=+u[1]);var X=h,U=!!Object.getOwnPropertySymbols&&!d((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),q=U&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=f.Object,K=q?function(t){return"symbol"==typeof t}:function(t){var e=D("Symbol");return $(e)&&H(e.prototype,Y(t))},V=f.String,J=f.TypeError,Q=function(t){if($(t))return t;throw J(function(t){try{return V(t)}catch(t){return"Object"}}(t)+" is not a function")},Z=f.TypeError,tt=Object.defineProperty,et=function(t,e){try{tt(f,t,{value:e,configurable:!0,writable:!0})}catch(n){f[t]=e}return e},nt="__core-js_shared__",it=f[nt]||et(nt,{}),rt=c((function(t){(t.exports=function(t,e){return it[t]||(it[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),ot=f.Object,at=function(t){return ot(_(t))},st=O({}.hasOwnProperty),ct=Object.hasOwn||function(t,e){return st(at(t),e)},ut=0,ht=Math.random(),lt=O(1..toString),ft=function(t){return"Symbol("+(void 0===t?"":t)+")_"+lt(++ut+ht,36)},dt=rt("wks"),pt=f.Symbol,gt=pt&&pt.for,vt=q?pt:pt&&pt.withoutSetter||ft,mt=function(t){if(!ct(dt,t)||!U&&"string"!=typeof dt[t]){var e="Symbol."+t;U&&ct(pt,t)?dt[t]=pt[t]:dt[t]=q&>?gt(e):vt(e)}return dt[t]},yt=f.TypeError,wt=mt("toPrimitive"),bt=function(t,e){if(!R(t)||K(t))return t;var n,i,r=null==(n=t[wt])?void 0:Q(n);if(r){if(void 0===e&&(e="default"),i=v(r,t,e),!R(i)||K(i))return i;throw yt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,i;if("string"===e&&$(n=t.toString)&&!R(i=v(n,t)))return i;if($(n=t.valueOf)&&!R(i=v(n,t)))return i;if("string"!==e&&$(n=t.toString)&&!R(i=v(n,t)))return i;throw Z("Can't convert object to primitive value")}(t,e)},St=function(t){var e=bt(t,"string");return K(e)?e:e+""},Ct=f.document,xt=R(Ct)&&R(Ct.createElement),zt=function(t){return xt?Ct.createElement(t):{}},Ot=!p&&!d((function(){return 7!=Object.defineProperty(zt("div"),"a",{get:function(){return 7}}).a})),kt=Object.getOwnPropertyDescriptor,It={f:p?kt:function(t,e){if(t=j(t),e=St(e),Ot)try{return kt(t,e)}catch(t){}if(ct(t,e))return b(!v(w.f,t,e),t[e])}},Tt=f.String,Et=f.TypeError,Pt=function(t){if(R(t))return t;throw Et(Tt(t)+" is not an object")},At=f.TypeError,Wt=Object.defineProperty,_t={f:p?Wt:function(t,e,n){if(Pt(t),e=St(e),Pt(n),Ot)try{return Wt(t,e,n)}catch(t){}if("get"in n||"set"in n)throw At("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},jt=p?function(t,e,n){return _t.f(t,e,b(1,n))}:function(t,e,n){return t[e]=n,t},$t=O(Function.toString);$(it.inspectSource)||(it.inspectSource=function(t){return $t(t)});var Rt,Ft,Dt,Ht=it.inspectSource,Lt=f.WeakMap,Mt=$(Lt)&&/native code/.test(Ht(Lt)),Bt=rt("keys"),Nt=function(t){return Bt[t]||(Bt[t]=ft(t))},Gt={},Xt="Object already initialized",Ut=f.TypeError,qt=f.WeakMap;if(Mt||it.state){var Yt=it.state||(it.state=new qt),Kt=O(Yt.get),Vt=O(Yt.has),Jt=O(Yt.set);Rt=function(t,e){if(Vt(Yt,t))throw new Ut(Xt);return e.facade=t,Jt(Yt,t,e),e},Ft=function(t){return Kt(Yt,t)||{}},Dt=function(t){return Vt(Yt,t)}}else{var Qt=Nt("state");Gt[Qt]=!0,Rt=function(t,e){if(ct(t,Qt))throw new Ut(Xt);return e.facade=t,jt(t,Qt,e),e},Ft=function(t){return ct(t,Qt)?t[Qt]:{}},Dt=function(t){return ct(t,Qt)}}var Zt,te={set:Rt,get:Ft,has:Dt,enforce:function(t){return Dt(t)?Ft(t):Rt(t,{})},getterFor:function(t){return function(e){var n;if(!R(e)||(n=Ft(e)).type!==t)throw Ut("Incompatible receiver, "+t+" required");return n}}},ee=Function.prototype,ne=p&&Object.getOwnPropertyDescriptor,ie=ct(ee,"name"),re={EXISTS:ie,PROPER:ie&&"something"===function(){}.name,CONFIGURABLE:ie&&(!p||p&&ne(ee,"name").configurable)},oe=c((function(t){var e=re.CONFIGURABLE,n=te.get,i=te.enforce,r=String(String).split("String");(t.exports=function(t,n,o,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,h=!!a&&!!a.noTargetGet,l=a&&void 0!==a.name?a.name:n;$(o)&&("Symbol("===String(l).slice(0,7)&&(l="["+String(l).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!ct(o,"name")||e&&o.name!==l)&&jt(o,"name",l),(s=i(o)).source||(s.source=r.join("string"==typeof l?l:""))),t!==f?(c?!h&&t[n]&&(u=!0):delete t[n],u?t[n]=o:jt(t,n,o)):u?t[n]=o:et(n,o)})(Function.prototype,"toString",(function(){return $(this)&&n(this).source||Ht(this)}))})),ae=Math.ceil,se=Math.floor,ce=function(t){var e=+t;return e!=e||0===e?0:(e>0?se:ae)(e)},ue=Math.max,he=Math.min,le=Math.min,fe=function(t){return(e=t.length)>0?le(ce(e),9007199254740991):0;var e},de=function(t){return function(e,n,i){var r,o=j(e),a=fe(o),s=function(t,e){var n=ce(t);return n<0?ue(n+e,0):he(n,e)}(i,a);if(t&&n!=n){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}},pe={includes:de(!0),indexOf:de(!1)},ge=pe.indexOf,ve=O([].push),me=function(t,e){var n,i=j(t),r=0,o=[];for(n in i)!ct(Gt,n)&&ct(i,n)&&ve(o,n);for(;e.length>r;)ct(i,n=e[r++])&&(~ge(o,n)||ve(o,n));return o},ye=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],we=ye.concat("length","prototype"),be={f:Object.getOwnPropertyNames||function(t){return me(t,we)}},Se={f:Object.getOwnPropertySymbols},Ce=O([].concat),xe=D("Reflect","ownKeys")||function(t){var e=be.f(Pt(t)),n=Se.f;return n?Ce(e,n(t)):e},ze=function(t,e){for(var n=xe(e),i=_t.f,r=It.f,o=0;o<n.length;o++){var a=n[o];ct(t,a)||i(t,a,r(e,a))}},Oe=/#|\.prototype\./,ke=function(t,e){var n=Te[Ie(t)];return n==Pe||n!=Ee&&($(e)?d(e):!!e)},Ie=ke.normalize=function(t){return String(t).replace(Oe,".").toLowerCase()},Te=ke.data={},Ee=ke.NATIVE="N",Pe=ke.POLYFILL="P",Ae=ke,We=It.f,_e=function(t,e){var n,i,r,o,a,s=t.target,c=t.global,u=t.stat;if(n=c?f:u?f[s]||et(s,{}):(f[s]||{}).prototype)for(i in e){if(o=e[i],r=t.noTargetGet?(a=We(n,i))&&a.value:n[i],!Ae(c?i:s+(u?".":"#")+i,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;ze(o,r)}(t.sham||r&&r.sham)&&jt(o,"sham",!0),oe(n,i,o,t)}},je=Object.keys||function(t){return me(t,ye)},$e=p?Object.defineProperties:function(t,e){Pt(t);for(var n,i=j(e),r=je(e),o=r.length,a=0;o>a;)_t.f(t,n=r[a++],i[n]);return t},Re=D("document","documentElement"),Fe=Nt("IE_PROTO"),De=function(){},He=function(t){return"<script>"+t+"</"+"script>"},Le=function(t){t.write(He("")),t.close();var e=t.parentWindow.Object;return t=null,e},Me=function(){try{Zt=new ActiveXObject("htmlfile")}catch(t){}var t,e;Me="undefined"!=typeof document?document.domain&&Zt?Le(Zt):((e=zt("iframe")).style.display="none",Re.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(He("document.F=Object")),t.close(),t.F):Le(Zt);for(var n=ye.length;n--;)delete Me.prototype[ye[n]];return Me()};Gt[Fe]=!0;var Be=Object.create||function(t,e){var n;return null!==t?(De.prototype=Pt(t),n=new De,De.prototype=null,n[Fe]=t):n=Me(),void 0===e?n:$e(n,e)},Ne=mt("unscopables"),Ge=Array.prototype;null==Ge[Ne]&&_t.f(Ge,Ne,{configurable:!0,value:Be(null)});var Xe=function(t){Ge[Ne][t]=!0},Ue=pe.includes;_e({target:"Array",proto:!0},{includes:function(t){return Ue(this,t,arguments.length>1?arguments[1]:void 0)}}),Xe("includes"),_e({target:"Object",stat:!0,forced:!p,sham:!p},{defineProperty:_t.f});var qe=mt("match"),Ye=f.TypeError,Ke=function(t){if(function(t){var e;return R(t)&&(void 0!==(e=t[qe])?!!e:"RegExp"==T(t))}(t))throw Ye("The method doesn't accept regular expressions");return t},Ve={};Ve[mt("toStringTag")]="z";var Je="[object z]"===String(Ve),Qe=mt("toStringTag"),Ze=f.Object,tn="Arguments"==T(function(){return arguments}()),en=Je?T:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ze(t),Qe))?n:tn?T(e):"Object"==(i=T(e))&&$(e.callee)?"Arguments":i},nn=f.String,rn=function(t){if("Symbol"===en(t))throw TypeError("Cannot convert a Symbol value to a string");return nn(t)},on=mt("match"),an=O("".indexOf);_e({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[on]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~an(rn(_(this)),rn(Ke(t)),arguments.length>1?arguments[1]:void 0)}});var sn,cn,un=pe.indexOf,hn=O([].indexOf),ln=!!hn&&1/hn([1],1,-0)<0,fn=!!(cn=[]["indexOf"])&&d((function(){cn.call(null,sn||function(){throw 1},1)}));_e({target:"Array",proto:!0,forced:ln||!fn},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return ln?hn(this,t,e)||0:un(this,t,e)}});var dn=O(O.bind),pn=Array.isArray||function(t){return"Array"==T(t)},gn=function(){},vn=[],mn=D("Reflect","construct"),yn=/^\s*(?:class|function)\b/,wn=O(yn.exec),bn=!yn.exec(gn),Sn=function(t){if(!$(t))return!1;try{return mn(gn,vn,t),!0}catch(t){return!1}},Cn=!mn||d((function(){var t;return Sn(Sn.call)||!Sn(Object)||!Sn((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(en(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return bn||!!wn(yn,Ht(t))}:Sn,xn=mt("species"),zn=f.Array,On=function(t,e){return new(function(t){var e;return pn(t)&&(e=t.constructor,(Cn(e)&&(e===zn||pn(e.prototype))||R(e)&&null===(e=e[xn]))&&(e=void 0)),void 0===e?zn:e}(t))(0===e?0:e)},kn=O([].push),In=function(t){var e=1==t,n=2==t,i=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,u,h,l){for(var f,d,p=at(c),g=A(p),v=function(t,e){return Q(t),void 0===e?t:dn?dn(t,e):function(){return t.apply(e,arguments)}}(u,h),m=fe(g),y=0,w=l||On,b=e?w(c,m):n||a?w(c,0):void 0;m>y;y++)if((s||y in g)&&(d=v(f=g[y],y,p),t))if(e)b[y]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return y;case 2:kn(b,f)}else switch(t){case 4:return!1;case 7:kn(b,f)}return o?-1:i||r?r:b}},Tn={forEach:In(0),map:In(1),filter:In(2),some:In(3),every:In(4),find:In(5),findIndex:In(6),filterReject:In(7)}.find,En="find",Pn=!0;En in[]&&Array(1).find((function(){Pn=!1})),_e({target:"Array",proto:!0,forced:Pn},{find:function(t){return Tn(this,t,arguments.length>1?arguments[1]:void 0)}}),Xe(En);var An=Je?{}.toString:function(){return"[object "+en(this)+"]"};Je||oe(Object.prototype,"toString",An,{unsafe:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:i-Math.abs(a),0);for(;s<i;){if((r=n[s])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;s++}return!1}}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var o=e[r];if(t.call(i,o,r,e))return o;r++}}});var Wn=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},_n=function(t,e){for(var n=0,i=e.split(".");n<i.length;n++){var r=t[i[n]];if(!Wn(r,"object","array"))return r;t=r}return t},jn=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},$n=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Rn=function(t){if("string"!=typeof t)return!1;if("transparent"===(t=t.toLocaleLowerCase().trim()))return!1;if(/^rgba/.test(t)){var e=/([^\s,]+)\)$/.exec(t);if(0===(null===(n=e)?0:"object"==typeof n?NaN:"number"==typeof n?n:"string"==typeof n?"%"===n[n.length-1]?Number(n.slice(0,-1))/100:Number(n):NaN))return!1}var n;return!0},Fn=function(t){var e,n=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],i=0,r=0,o=0,a=0;switch(n.length){case 1:i=r=o=a=n[0];break;case 2:i=r=n[0],o=a=n[1];break;case 3:i=n[0],o=a=n[1],r=n[2];break;default:i=n[0],r=n[1],o=n[2],a=n[3]}var s={paddingTop:i,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&Wn(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[i,r,o,a]},Dn=function(t){var e=[],n=t.map((function(t){return Number(t)})).reduce((function(t,n){if(n>0){var i=t+n;return e.push(i),i}return e.push(NaN),t}),0),i=Math.random()*n;return e.findIndex((function(t){return i<=t}))},Hn=function(t,e,n,i){void 0===i&&(i=1/0),i<=0&&(i=1/0);for(var r="",o=[],a=t.measureText("...").width,s=0;s<e.length;s++){r+=e[s];var c=t.measureText(r).width,u=n(o);if(i===o.length+1&&(c+=a),u<0)return o;if(c>u&&(o.push(r.slice(0,-1)),r=e[s]),i===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Ln="1.7.13",Mn=function(){function t(){this.subs=[]}return t.prototype.addSub=function(t){this.subs.includes(t)||this.subs.push(t)},t.prototype.notify=function(){this.subs.forEach((function(t){t.update()}))},t}(),Bn="__proto__"in{};function Nn(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var Gn=Array.prototype,Xn=Object.create(Gn);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Xn[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=Gn[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),i}}));var Un=function(){function t(t){this.dep=new Mn,Nn(t,"__luckyOb__",this),Array.isArray(t)&&(Bn?t.__proto__=Xn:Object.getOwnPropertyNames(Xn).forEach((function(e){Nn(t,e,Xn[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Yn(t,e,t[e])}))},t}();function qn(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Un(t)}function Yn(t,e,n){var i=new Mn,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(n=t[e]);var s=qn(n);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):n;return Mn.target&&(i.addSub(Mn.target),s&&s.dep.addSub(Mn.target)),e},set:function(e){e!==n&&(n=e,o&&!a||(a?a.call(t,e):n=e,s=qn(e),i.notify()))}})}}var Kn=0,Vn=function(){function t(t,e,n,i){void 0===i&&(i={}),this.id=Kn++,this.$lucky=t,this.expr=e,this.deep=!!i.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],n="",i=0;i<t.length;i++){var r=t[i];if(/\[|\./.test(r))e.push(n),n="";else{if(/\W/.test(r))continue;n+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=n,this.value=this.get()}return t.prototype.get=function(){Mn.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){Wn(t,"array","object")&&Object.keys(t).forEach((function(n){var i=t[n];e(i)}))};e(t)}(t),Mn.target=null,t},t.prototype.update=function(){var t=this.get(),e=this.value;this.value=t,this.cb.call(this.$lucky,t,e)},t}(),Jn=function(){function t(t,e){var n=this;this.version=Ln,this.htmlFontSize=16,this.rAF=function(){},this.boxWidth=0,this.boxHeight=0,"string"==typeof t?t={el:t}:1===t.nodeType&&(t={el:"",divElement:t}),t=t,this.config=t,this.data=e,t.flag||(t.flag="WEB"),t.el&&(t.divElement=document.querySelector(t.el)),t.divElement&&(t.canvasElement=document.createElement("canvas"),t.divElement.appendChild(t.canvasElement)),t.canvasElement&&(t.ctx=t.canvasElement.getContext("2d"),t.canvasElement.setAttribute("package","".concat("lucky-canvas","@").concat(Ln)),t.canvasElement.addEventListener("click",(function(t){return n.handleClick(t)}))),this.ctx=t.ctx,this.initWindowFunction(),this.config.ctx||console.error("无法获取到 CanvasContext2D"),window&&"function"==typeof window.addEventListener&&window.addEventListener("resize",function(t,e){void 0===e&&(e=300);var n=null;return function(){for(var i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){t.apply(i,r),clearTimeout(n),n=null}),e))}}((function(){return n.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){n.resize()})).observe(document.documentElement,{attributes:!0})}return t.prototype.resize=function(){var t,e;null===(e=(t=this.config).beforeResize)||void 0===e||e.call(t),this.setHTMLFontSize(),this.setDpr(),this.resetWidthAndHeight(),this.zoomCanvas()},t.prototype.initLucky=function(){if(this.resize(),!this.boxWidth||!this.boxHeight)return console.error("无法获取到宽度或高度")},t.prototype.handleClick=function(t){},t.prototype.setHTMLFontSize=function(){window&&(this.htmlFontSize=+window.getComputedStyle(document.documentElement).fontSize.slice(0,-2))},t.prototype.clearCanvas=function(){var t=[this.boxWidth,this.boxHeight],e=t[0],n=t[1];this.ctx.clearRect(-e,-n,2*e,2*n)},t.prototype.setDpr=function(){var t=this.config;t.dpr||(window?window.dpr=t.dpr=window.devicePixelRatio||1:t.dpr||console.error(t,"未传入 dpr 可能会导致绘制异常"))},t.prototype.resetWidthAndHeight=function(){var t=this.config,e=this.data,n=0,i=0;t.divElement&&(n=t.divElement.offsetWidth,i=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||n,this.boxHeight=this.getLength(e.height||t.height)||i,t.divElement&&(t.divElement.style.overflow="hidden",t.divElement.style.width=this.boxWidth+"px",t.divElement.style.height=this.boxHeight+"px")},t.prototype.zoomCanvas=function(){var t=this.config,e=this.ctx,n=t.canvasElement,i=t.dpr,r=[this.boxWidth*i,this.boxHeight*i],o=r[0],a=r[1];n&&(n.width=o,n.height=a,n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),n.style["transform-origin"]="left top",n.style.transform="scale(".concat(1/i,")"),e.scale(i,i))},t.prototype.initWindowFunction=function(){var t=this.config;if(window)return this.rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},t.setTimeout=window.setTimeout,t.setInterval=window.setInterval,t.clearTimeout=window.clearTimeout,void(t.clearInterval=window.clearInterval);if(t.rAF)this.rAF=t.rAF;else if(t.setTimeout){var e=t.setTimeout;this.rAF=function(t){return e(t,16.7)}}else this.rAF=function(t){return setTimeout(t,16.7)}},t.prototype.loadImg=function(t,e,n){var i=this;return void 0===n&&(n="$resolve"),new Promise((function(r,o){if(t||o("=> '".concat(e.src,"' 不能为空或不合法")),"WEB"!==i.config.flag)return e[n]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '".concat(e.src,"' 图片加载失败"))},a.src=t}))},t.prototype.drawImage=function(t,e){for(var n,i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var o=this.config,s=o.flag,c=o.dpr;if(["WEB","MP-WX"].includes(s))n=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");n=e.path}return 8===i.length&&(i=i.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,a([n],i))},t.prototype.getLength=function(t){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var n=this;void 0===e&&(e=1);var i=this.config;return Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,r,o){var a={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*n.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[o];if(a)return a(r);var s=i.handleCssUnit||i.unitFunc;return s?s(r,o):r})))},t.prototype.computedWidthAndHeight=function(t,e,n,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,n);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,i);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,n),this.getHeight(e.height,i)]},t.prototype.getWidth=function(t,e){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t,e):0},t.prototype.getHeight=function(t,e){return Wn(t,"number")?t:Wn(t,"string")?this.changeUnits(t,e):0},t.prototype.getOffsetX=function(t,e){return void 0===e&&(e=0),(e-t)/2},t.prototype.getOffscreenCanvas=function(t,e){if(!jn(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var n=this.config.dpr,i=this._offscreenCanvas;i.width=(t||300)*n,i.height=(e||150)*n;var r=i.getContext("2d");return r.clearRect(0,0,t,e),r.scale(n,n),r.dpr=n,{_offscreenCanvas:i,_ctx:r}},t.prototype.$set=function(t,e,n){t&&"object"==typeof t&&Yn(t,e,n)},t.prototype.$computed=function(t,e,n){var i=this;Object.defineProperty(t,e,{get:function(){return n.call(i)}})},t.prototype.$watch=function(t,e,n){void 0===n&&(n={}),"object"==typeof e&&(e=(n=e).handler);var i=new Vn(this,t,e,n);return n.immediate&&e.call(this,i.value),function(){}},t}(),Qn=function(t){return Math.PI/180*t},Zn=function(t,e,n,i,r,o){t.beginPath();var a,s,c=Qn(90/Math.PI/n*o),u=i+c,h=r-c;t.arc(0,0,n,u,h,!1),t.lineTo.apply(t,(a=(i+r)/2,s=o/2/Math.abs(Math.sin((i-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},ti=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),u=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+s,r),t.lineTo(i+o-s,r),t.arc(i+o-s,r+s,s,-u/2,0),t.lineTo(i+o,r+a-s),t.arc(i+o-s,r+a-s,s,0,u/2),t.lineTo(i+s,r+a),t.arc(i+s,r+a-s,s,u/2,u),t.lineTo(i,r+s),t.arc(i+s,r+s,s,u,-u/2),t.closePath()},ei=function(t,e,n,i){return t>=i&&(t=i),n*(t/=i)*t+e},ni=function(t,e,n,i){return t>=i&&(t=i),-n*(t/=i)*(t-2)+e},ii=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r._defaultConfig={},r._defaultStyle={},r.Radius=0,r.prizeRadius=0,r.prizeDeg=0,r.prizeRadian=0,r.rotateDeg=0,r.maxBtnRadius=0,r.startTime=0,r.endTime=0,r.stopDeg=0,r.endDeg=0,r.FPS=16.6,r.step=0,r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.Radius=0,this.prizeRadius=0,this.prizeDeg=0,this.prizeRadian=0,this.rotateDeg=0,this.maxBtnRadius=0,this.startTime=0,this.endTime=0,this.stopDeg=0,this.endDeg=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){return i({gutter:"0px",offsetDegree:0,speed:20,speedFunction:"quad",accelerationTime:2500,decelerationTime:2500,stopRange:0},t.defaultConfig)})),this.$computed(this,"_defaultStyle",(function(){return i({fontSize:"18px",fontColor:"#000",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:t.buttons.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},e.prototype.handleClick=function(t){var e,n=this.ctx;n.beginPath(),n.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),n.isPointInPath(t.offsetX,t.offsetY)&&0===this.step&&(null===(e=this.startCallback)||void 0===e||e.call(this,t))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var a=this;return o(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if(u&&u.imgs){var h=u.imgs[i];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]),a.loadImg(h.src,h).then((function(t){return r(a,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return"function"!=typeof h.formatter?[3,2]:[4,Promise.resolve(h.formatter.call(this,t))];case 1:t=r.sent(),r.label=2;case 2:return l[n][e][i]=t,s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),c()}))}}}))]}))}))},e.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,a=i._defaultConfig,s=i._defaultStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(-this.Radius,-this.Radius,2*this.Radius,2*this.Radius),this.prizeRadius=this.blocks.reduce((function(t,e,i){return Rn(e.background)&&(o.beginPath(),o.fillStyle=e.background,o.arc(0,0,t,0,2*Math.PI,!1),o.fill()),e.imgs&&e.imgs.forEach((function(e,r){var a=n.ImageCache.blocks;if(a&&a[i]){var s=a[i][r];if(s){var c=n.computedWidthAndHeight(s,e,2*t,2*t),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Qn(n.rotateDeg)),n.drawImage(o,s,f,d,u,h),o.restore()}}})),t-n.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Qn(this.prizeDeg);var c=Qn(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),u=function(t){return n.getOffsetX(o.measureText(t).width)},h=function(t,e,i){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return n.getHeight(t.top,e)+(i+1)*n.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var i=c+e*n.prizeRadian,r=n.prizeRadius-n.maxBtnRadius,l=t.background||s.background;Rn(l)&&(o.fillStyle=l,Zn(o,n.maxBtnRadius,n.prizeRadius,i-n.prizeRadian/2,i+n.prizeRadian/2,n.getLength(a.gutter)),o.fill());var f=Math.cos(i)*n.prizeRadius,d=Math.sin(i)*n.prizeRadius;o.translate(f,d),o.rotate(i+Qn(90)),t.imgs&&t.imgs.forEach((function(t,i){var a=n.ImageCache.prizes;if(a&&a[e]){var s=a[e][i];if(s){var c=n.computedWidthAndHeight(s,t,n.prizeRadian*n.prizeRadius,r),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,r)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,i=t.fontWeight||s.fontWeight,c=n.getLength(t.fontSize||s.fontSize),l=t.fontStyle||s.fontStyle,f=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:s.wordWrap,d=t.lengthLimit||s.lengthLimit,p=t.lineClamp||s.lineClamp;o.fillStyle=e,o.font="".concat(i," ").concat(c>>0,"px ").concat(l);var g=String(t.text);(f?Hn(o,$n(g),(function(e){var i=2*((n.prizeRadius-h(t,r,e.length))*Math.tan(n.prizeRadian/2))-n.getLength(a.gutter);return n.getWidth(d,i)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,n){o.fillText(e,u(e),h(t,r,n))}))})),o.rotate(Qn(360)-i-Qn(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var i=n.getHeight(t.radius,n.prizeRadius);n.maxBtnRadius=Math.max(n.maxBtnRadius,i),Rn(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,i,0,2*Math.PI,!1),o.fill()),t.pointer&&Rn(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-i,0),o.lineTo(i,0),o.lineTo(0,2*-i),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=n.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=n.computedWidthAndHeight(s,t,2*i,2*i),u=c[0],h=c[1],l=[n.getOffsetX(u),n.getHeight(t.top,i)],f=l[0],d=l[1];n.drawImage(o,s,f,d,u,h)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=n.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font="".concat(r," ").concat(a>>0,"px ").concat(c),String(t.text).split("\n").forEach((function(e,n){o.fillText(e,u(e),h(t,i,n))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*i-i/2)*this.getLength(e.stopRange),c=0,u=0,h=0;++c;){var l=360*c-n*i-r-e.offsetDegree+s-i/2,f=ni(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-u>f-a?l:h;break}h=l,u=f}},e.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},e.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=Dn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},e.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizeFlag,a=n.stopDeg,s=n.endDeg,c=n._defaultConfig,u=c.accelerationTime,h=c.decelerationTime,l=c.speed;if(0!==r){if(-1!==o){3!==r||this.endDeg||this.carveOnGunwaleOfAMovingBoat();var f=Date.now()-this.startTime,d=Date.now()-this.endTime,p=this.rotateDeg;if(1===r||f<u){this.FPS=f/t;var g=ei(f,0,l,u);g===l&&(this.step=2),p+=g%360}else 2===r?(p+=l%360,void 0!==o&&o>=0&&(this.step=3,this.stopDeg=0,this.endDeg=0)):3===r?(p=ni(d,a,s,h),d>=h&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===o}))||{})},e.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr-this.Radius,e/n.dpr-this.Radius]},e}(Jn),ri=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.rows=3,r.cols=3,r.blocks=[],r.prizes=[],r.buttons=[],r.defaultConfig={},r.defaultStyle={},r.activeStyle={},r._defaultConfig={},r._defaultStyle={},r._activeStyle={},r.cellWidth=0,r.cellHeight=0,r.startTime=0,r.endTime=0,r.currIndex=0,r.stopIndex=0,r.endIndex=0,r.demo=!1,r.timer=0,r.FPS=16.6,r.step=0,r.prizeFlag=-1,r.cells=[],r.ImageCache={blocks:[],prizes:[],buttons:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.startTime=0,this.endTime=0,this.currIndex=0,this.stopIndex=0,this.endIndex=0,this.demo=!1,this.timer=0,this.FPS=16.6,this.prizeFlag=-1,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"rows",Number(t.rows)||3),this.$set(this,"cols",Number(t.cols)||3),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"buttons",t.buttons||[]),this.$set(this,"button",t.button),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"activeStyle",t.activeStyle||{}),this.$set(this,"startCallback",t.start),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({gutter:5,speed:20,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.gutter=t.getLength(e.gutter),e.speed=e.speed/40,e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:20,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",shadow:"",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)})),this.$computed(this,"_activeStyle",(function(){return i({background:"#ffce98",shadow:""},t.activeStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("buttons",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("rows",(function(){return t.init()})),this.$watch("cols",(function(){return t.init()})),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("activeStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("startCallback",(function(){return t.init()})),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n=t.buttons.map((function(t){return t.imgs}));t.button&&n.push(t.button.imgs);var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:n};Object.keys(i).forEach((function(n){var r=i[n],o=[];r&&r.forEach((function(e,i){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(n,i,n,r))}))})),Promise.all(o).then((function(){t.draw(),e()}))}))}))},e.prototype.handleClick=function(t){var e=this,n=this.ctx;a(a([],this.buttons),[this.button]).forEach((function(i){var r;if(i){var o=e.getGeometricProperty([i.x,i.y,i.col||1,i.row||1]),a=o[0],s=o[1],c=o[2],u=o[3];n.beginPath(),n.rect(a,s,c,u),n.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof i.callback&&i.callback.call(e,i),null===(r=e.startCallback)||void 0===r||r.call(e,t,i))}}))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var a=this;return o(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if("buttons"===t&&!a.buttons.length&&a.button&&(u=a.button),u&&u.imgs){var h=u.imgs[i];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]);var f=[a.loadImg(h.src,h),h.activeSrc&&a.loadImg(h.activeSrc,h,"$activeResolve")];Promise.all(f).then((function(t){var c=t[0],u=t[1];return r(a,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return"function"!=typeof(t=h.formatter)?[3,3]:[4,Promise.resolve(t.call(this,c))];case 1:return c=r.sent(),u?[4,Promise.resolve(t.call(this,u))]:[3,3];case 2:u=r.sent(),r.label=3;case 3:return l[n][e][i]={defaultImg:c,activeImg:u},s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),c()}))}}}))]}))}))},e.prototype.draw=function(){var t,e,n=this,i=this,r=i.config,o=i.ctx,s=i._defaultConfig,c=i._defaultStyle,u=i._activeStyle;null===(t=r.beforeDraw)||void 0===t||t.call(this,o),o.clearRect(0,0,this.boxWidth,this.boxHeight),this.cells=a(a([],this.prizes),this.buttons),this.button&&this.cells.push(this.button),this.cells.forEach((function(t){t.col=t.col||1,t.row=t.row||1})),this.prizeArea=this.blocks.reduce((function(t,e,i){var r=t.x,a=t.y,s=t.w,u=t.h,h=Fn(e),l=h[0],f=h[1],d=h[2],p=h[3],g=e.borderRadius?n.getLength(e.borderRadius):0,v=e.background||c.background;return Rn(v)&&(o.fillStyle=n.handleBackground(r,a,s,u,v),ti(o,r,a,s,u,g),o.fill()),e.imgs&&e.imgs.forEach((function(t,e){var c=_n(n.ImageCache,"blocks.".concat(i,".").concat(e,".defaultImg"));if(c){var h=n.computedWidthAndHeight(c,t,s,u),l=h[0],f=h[1],d=[n.getOffsetX(l,s),n.getHeight(t.top,u)],p=d[0],g=d[1];n.drawImage(o,c,r+p,a+g,l,f)}})),{x:r+d,y:a+l,w:s-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight}),this.cellWidth=(this.prizeArea.w-s.gutter*(this.cols-1))/this.cols,this.cellHeight=(this.prizeArea.h-s.gutter*(this.rows-1))/this.rows,this.cells.forEach((function(t,e){var i=n.getGeometricProperty([t.x,t.y,t.col,t.row]),a=i[0],s=i[1],h=i[2],l=i[3],f=!1;(void 0===n.prizeFlag||n.prizeFlag>-1)&&(f=e===n.currIndex%n.prizes.length>>0);var d=f?u.background:t.background||c.background;if(Rn(d)){var p=(f?u.shadow:t.shadow||c.shadow).replace(/px/g,"").split(",")[0].split(" ").map((function(t,e){return e<3?Number(t):t}));4===p.length&&(o.shadowColor=p[3],o.shadowOffsetX=p[0]*r.dpr,o.shadowOffsetY=p[1]*r.dpr,o.shadowBlur=p[2],p[0]>0?h-=p[0]:(h+=p[0],a-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),o.fillStyle=n.handleBackground(a,s,h,l,d);var g=n.getLength(t.borderRadius?t.borderRadius:c.borderRadius);ti(o,a,s,h,l,g),o.fill(),o.shadowColor="rgba(0, 0, 0, 0)",o.shadowOffsetX=0,o.shadowOffsetY=0,o.shadowBlur=0}var v="prizes";e>=n.prizes.length&&(v="buttons",e-=n.prizes.length),t.imgs&&t.imgs.forEach((function(t,i){var r=n.ImageCache[v];if(r[e]){var c=r[e][i];if(c){var u=f&&c.activeImg||c.defaultImg;if(u){var d=n.computedWidthAndHeight(u,t,h,l),p=d[0],g=d[1],m=[a+n.getOffsetX(p,h),s+n.getHeight(t.top,l)],y=m[0],w=m[1];n.drawImage(o,u,y,w,p,g)}}}})),t.fonts&&t.fonts.forEach((function(t){var e=f&&u.fontStyle?u.fontStyle:t.fontStyle||c.fontStyle,i=f&&u.fontWeight?u.fontWeight:t.fontWeight||c.fontWeight,r=f&&u.fontSize?n.getLength(u.fontSize):n.getLength(t.fontSize||c.fontSize),d=f&&u.lineHeight?u.lineHeight:t.lineHeight||c.lineHeight||t.fontSize||c.fontSize,p=Object.prototype.hasOwnProperty.call(t,"wordWrap")?t.wordWrap:c.wordWrap,g=t.lengthLimit||c.lengthLimit,v=t.lineClamp||c.lineClamp;o.font="".concat(i," ").concat(r>>0,"px ").concat(e),o.fillStyle=f&&u.fontColor?u.fontColor:t.fontColor||c.fontColor;var m=[],y=String(t.text);if(p){var w=n.getWidth(g,h);m=Hn(o,$n(y),(function(){return w}),v)}else m=y.split("\n");m.forEach((function(e,i){o.fillText(e,a+n.getOffsetX(o.measureText(e).width,h),s+n.getHeight(t.top,l)+(i+1)*n.getLength(d))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.handleBackground=function(t,e,n,i,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,n,i,r,o){var a=/linear-gradient\((.+)\)/.exec(o)[1].split(",").map((function(t){return t.trim()})),s=a.shift(),c=[0,0,0,0];if(s.includes("deg")){var u=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,n+r,e+i,n+r-i*u(s-0)]:s>=45&&s<90?c=[e,n+r,e+i-r*u(s-45),n]:s>=90&&s<135?c=[e+i,n+r,e+i-r*u(s-90),n]:s>=135&&s<180?c=[e+i,n+r,e,n+i*u(s-135)]:s>=180&&s<225?c=[e+i,n,e,n+i*u(s-180)]:s>=225&&s<270?c=[e+i,n,e+r*u(s-225),n+r]:s>=270&&s<315?c=[e,n,e+r*u(s-270),n+r]:s>=315&&s<360&&(c=[e,n,e+i,n+r-i*u(s-315)])}else s.includes("top")?c=[e,n+r,e,n]:s.includes("bottom")?c=[e,n,e,n+r]:s.includes("left")?c=[e+i,n,e,n]:s.includes("right")&&(c=[e,n,e+i,n]);var h=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,n){var i=e.split(" ");return 1===i.length?t.addColorStop(n,i[0]):2===i.length&&t.addColorStop.apply(t,i),t}),h)}(o,t,e,n,i,r)),r},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,n=t.prizeFlag,i=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=i,o=e.speed,a=0,s=0,c=0;++a;){var u=this.prizes.length*a+n-r,h=ni(this.FPS,r,u,e.decelerationTime)-r;if(h>o){this.endIndex=o-s>h-o?u:c;break}c=u,s=h}},e.prototype.play=function(){var t,e;0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,null===(e=(t=this.config).afterStart)||void 0===e||e.call(t),this.run())},e.prototype.stop=function(t){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=Dn(e)}t<0?(this.step=0,this.prizeFlag=-1):(this.step=2,this.prizeFlag=t%this.prizes.length)}},e.prototype.run=function(t){var e;void 0===t&&(t=0);var n=this,i=n.rAF,r=n.step,o=n.prizes,a=n.prizeFlag,s=n.stopIndex,c=n.endIndex,u=n._defaultConfig,h=u.accelerationTime,l=u.decelerationTime,f=u.speed;if(0!==r){if(-1!==a){3!==r||this.endIndex||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime,g=this.currIndex;if(1===r||d<h){this.FPS=d/t;var v=ei(d,.1,f-.1,h);v===f&&(this.step=2),g+=v%o.length}else 2===r?(g+=f%o.length,void 0!==a&&a>=0&&(this.step=3,this.stopIndex=0,this.endIndex=0)):3===r?(g=ni(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),i(this.run.bind(this,t+1))}}else null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{})},e.prototype.getGeometricProperty=function(t){var e=t[0],n=t[1],i=t[2],r=void 0===i?1:i,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,u=this._defaultConfig.gutter,h=[this.prizeArea.x+(s+u)*e,this.prizeArea.y+(c+u)*n];return r&&a&&h.push(s*r+u*(r-1),c*a+u*(a-1)),h},e.prototype.conversionAxis=function(t,e){var n=this.config;return[t/n.dpr,e/n.dpr]},e}(Jn),oi=function(t){function e(e,n){var i,r=t.call(this,e,{width:n.width,height:n.height})||this;return r.blocks=[],r.prizes=[],r.slots=[],r.defaultConfig={},r._defaultConfig={},r.defaultStyle={},r._defaultStyle={},r.endCallback=function(){},r.cellWidth=0,r.cellHeight=0,r.cellAndSpacing=0,r.widthAndSpacing=0,r.heightAndSpacing=0,r.FPS=16.6,r.scroll=[],r.stopScroll=[],r.endScroll=[],r.startTime=0,r.endTime=0,r.step=0,r.prizeFlag=void 0,r.ImageCache={blocks:[],prizes:[]},r.initData(n),r.initWatch(),r.initComputed(),null===(i=e.beforeCreate)||void 0===i||i.call(r),r.init(),r}return n(e,t),e.prototype.resize=function(){var e,n;t.prototype.resize.call(this),this.draw(),null===(n=(e=this.config).afterResize)||void 0===n||n.call(e)},e.prototype.initLucky=function(){this.cellWidth=0,this.cellHeight=0,this.cellAndSpacing=0,this.widthAndSpacing=0,this.heightAndSpacing=0,this.FPS=16.6,this.scroll=[],this.stopScroll=[],this.endScroll=[],this.startTime=0,this.endTime=0,this.prizeFlag=void 0,this.step=0,t.prototype.initLucky.call(this)},e.prototype.initData=function(t){this.$set(this,"width",t.width||"300px"),this.$set(this,"height",t.height||"300px"),this.$set(this,"blocks",t.blocks||[]),this.$set(this,"prizes",t.prizes||[]),this.$set(this,"slots",t.slots||[]),this.$set(this,"defaultConfig",t.defaultConfig||{}),this.$set(this,"defaultStyle",t.defaultStyle||{}),this.$set(this,"endCallback",t.end)},e.prototype.initComputed=function(){var t=this;this.$computed(this,"_defaultConfig",(function(){var e=i({mode:"vertical",rowSpacing:0,colSpacing:5,speed:20,direction:1,accelerationTime:2500,decelerationTime:2500},t.defaultConfig);return e.rowSpacing=t.getLength(e.rowSpacing),e.colSpacing=t.getLength(e.colSpacing),e})),this.$computed(this,"_defaultStyle",(function(){return i({borderRadius:0,fontColor:"#000",fontSize:"18px",fontStyle:"sans-serif",fontWeight:"400",background:"rgba(0,0,0,0)",wordWrap:!0,lengthLimit:"90%"},t.defaultStyle)}))},e.prototype.initWatch=function(){var t=this;this.$watch("width",(function(e){t.data.width=e,t.resize()})),this.$watch("height",(function(e){t.data.height=e,t.resize()})),this.$watch("blocks",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("prizes",(function(e){t.initImageCache()}),{deep:!0}),this.$watch("slots",(function(e){t.drawOffscreenCanvas(),t.draw()}),{deep:!0}),this.$watch("defaultConfig",(function(){return t.draw()}),{deep:!0}),this.$watch("defaultStyle",(function(){return t.draw()}),{deep:!0}),this.$watch("endCallback",(function(){return t.init()}))},e.prototype.init=function(){var t,e;return r(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.initLucky(),n=this.config,null===(t=n.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return i.sent(),null===(e=n.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};Object.keys(n).forEach((function(i){var r=n[i],o=[];r&&r.forEach((function(e,n){e&&e.forEach((function(e,r){o.push(t.loadAndCacheImg(i,n,i,r))}))})),Promise.all(o).then((function(){t.drawOffscreenCanvas(),t.draw(),e()}))}))}))},e.prototype.loadAndCacheImg=function(t,e,n,i){return r(this,void 0,void 0,(function(){var a=this;return o(this,(function(s){return[2,new Promise((function(s,c){var u=a[t][e];if(u&&u.imgs){var h=u.imgs[i];if(h){var l=a.ImageCache;l[n][e]||(l[n][e]=[]),a.loadImg(h.src,h).then((function(t){return r(a,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return"function"!=typeof h.formatter?[3,2]:[4,Promise.resolve(h.formatter.call(this,t))];case 1:t=r.sent(),r.label=2;case 2:return l[n][e][i]=t,s(),[2]}}))}))})).catch((function(n){console.error("".concat(t,"[").concat(e,"].imgs[").concat(i,"] ").concat(n)),c()}))}}}))]}))}))},e.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,n=this._defaultStyle,i=this.drawBlocks(),r=i.w,o=i.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,u=s.cellHeight,h=s.widthAndSpacing,l=s.heightAndSpacing,f=new Array(a).fill(void 0).map((function(t,e){return e})),d=0,p=0;this.slots.forEach((function(e,n){void 0===t.scroll[n]&&(t.scroll[n]=0),e.order=e.order||f;var i=e.order.length;d=Math.max(d,r+h*i),p=Math.max(p,o+l*i)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(i,r){var o=c*r,a=u*r,s=0,f=function(t,e){for(var n={},i=[],r=0;r<t.length;r++)n[r]=t[r];for(r=0;r<e.length;r++){var o=n[e[r]];o&&(i[r]=o)}return i}(t.prizes,i.order);if(f.length){f.forEach((function(r,f){if(r){var d=i.order[f],p=h*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,h]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||n.background;if(Rn(S)){var C=t.getLength(jn(r,"borderRadius")?r.borderRadius:n.borderRadius);ti(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,n){var i=_n(t.ImageCache,"prizes.".concat(d,".").concat(n));if(i){var r=t.computedWidthAndHeight(i,e,c,u),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,u)],h=s[0],l=s[1];t.drawImage(m,i,h,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var i=e.fontStyle||n.fontStyle,r=e.fontWeight||n.fontWeight,o=t.getLength(e.fontSize||n.fontSize),a=e.lineHeight||n.lineHeight||e.fontSize||n.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:n.wordWrap,h=e.lengthLimit||n.lengthLimit,l=e.lineClamp||n.lineClamp;m.font="".concat(r," ").concat(o>>0,"px ").concat(i),m.fillStyle=e.fontColor||n.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(h,c);f=Hn(m,$n(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(n,i){m.fillText(n,y+t.getOffsetX(m.measureText(n).width,c),w+t.getHeight(e.top,u)+(i+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,u]),g=d[0],y=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,y]),x=C[0],z=C[1];t.drawImage(m,v,g,y,w,b,x,z,w,b),S+=s}}}))},e.prototype.drawBlocks=function(){var t=this,e=this;e.config;var n=e.ctx;e._defaultConfig;var i=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,u=e.h,h=Fn(r),l=h[0],f=h[1],d=h[2],p=h[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||i.background;return Rn(v)&&(ti(n,a,s,c,u,g),n.fillStyle=v,n.fill()),r.imgs&&r.imgs.forEach((function(e,i){var r=_n(t.ImageCache,"blocks.".concat(o,".").concat(i));if(r){var h=t.computedWidthAndHeight(r,e,c,u),l=h[0],f=h[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,u)],p=d[0],g=d[1];t.drawImage(n,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:u-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},e.prototype.draw=function(){var t,e=this,n=this,i=n.config,r=n.ctx;n._defaultConfig,n._defaultStyle,null===(t=i.beforeDraw)||void 0===t||t.call(this,r),r.clearRect(0,0,this.boxWidth,this.boxHeight);var o=this.drawBlocks(),a=o.x,s=o.y,c=o.w,u=o.h;if(this._offscreenCanvas){var h=this,l=h.cellWidth,f=h.cellHeight,d=h.cellAndSpacing,p=h.widthAndSpacing,g=h.heightAndSpacing;this.slots.forEach((function(t,n){var i=d*t.order.length,o=e.displacement(-(u-g)/2,-(c-p)/2),h=e.scroll[n]+o;h<0&&(h=h%i+i),h>i&&(h%=i);var v=e.displacement([l*n,h,l,u],[h,f*n,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*n,s,l,u],[a,s+g*n,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,m,y,w,b,C,x,z,O)}))}},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,n=e._defaultConfig,i=e.prizeFlag,r=e.cellAndSpacing;this.endTime=Date.now(),this.slots.forEach((function(e,o){var a=e.order;if(a.length)for(var s=e.speed||n.speed,c=e.direction||n.direction,u=a.findIndex((function(t){return t===i[o]})),h=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*u+h*f*c-l,p=ni(t.FPS,l,d,n.decelerationTime)-l;if(Math.abs(p)>s){t.endScroll[o]=d;break}}}))},e.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,this.run())},e.prototype.stop=function(t){var e;if(0!==this.step&&3!==this.step){if("number"==typeof t)this.prizeFlag=new Array(this.slots.length).fill(t);else{if(!Wn(t,"array"))return this.stop(-1),console.error("stop() 无法识别的参数类型 ".concat(typeof t));if(t.length!==this.slots.length)return this.stop(-1),console.error("stop([".concat(t,"]) 参数长度的不正确"));this.prizeFlag=t}(null===(e=this.prizeFlag)||void 0===e?void 0:e.includes(-1))?(this.prizeFlag=[],this.step=0):this.step=2}},e.prototype.run=function(t){var e,n,i=this;void 0===t&&(t=0);var r=this,o=r.rAF,a=r.step,s=r.prizeFlag,c=r._defaultConfig,u=r.cellAndSpacing,h=r.slots,l=c.accelerationTime,f=c.decelerationTime;if(0!==this.step||(null==s?void 0:s.length)!==h.length){if(void 0===s||s.length){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var d=Date.now()-this.startTime,p=Date.now()-this.endTime;h.forEach((function(e,n){var r=e.order;if(r&&r.length){var o=u*r.length,g=Math.abs(e.speed||c.speed),v=e.direction||c.direction,m=0,y=i.scroll[n];if(1===a||d<l){i.FPS=d/t;var w=ei(d,0,g,l);w===g&&(i.step=2),m=(y+w*v)%o}else if(2===a)m=(y+g*v)%o,(null==s?void 0:s.length)===h.length&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===a&&p){var b=i.stopScroll[n],S=i.endScroll[n];m=ni(p,b,S,f),p>=f&&(i.step=0)}i.scroll[n]=m}})),this.draw(),o(this.run.bind(this,t+1))}}else{for(var g=s[0],v=0;v<h.length;v++){var m=h[v],y=s[v];if(!(null===(e=m.order)||void 0===e?void 0:e.includes(y))||g!==y){g=-1;break}}null===(n=this.endCallback)||void 0===n||n.call(this,this.prizes.find((function(t,e){return e===g}))||void 0)}},e.prototype.displacement=function(t,e){return"horizontal"===this._defaultConfig.mode?e:t},e.prototype.displacementWidthOrHeight=function(){var t=this._defaultConfig.mode,e=this.slots.length,n=this._defaultConfig,i=n.colSpacing,r=n.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,u=o.h,h=0,l=0;return"horizontal"===t?(l=this.cellHeight=(u-r*(e-1))/e,h=this.cellWidth=l):(h=this.cellWidth=(c-i*(e-1))/e,l=this.cellHeight=h),a=this.widthAndSpacing=this.cellWidth+i,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:h,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},e}(Jn);t.LuckyGrid=ri,t.LuckyWheel=ii,t.SlotMachine=oi,t.cutRound=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;return n.width=r,n.height=o,ti(i,0,0,r,o,e),i.clip(),i.drawImage(t,0,0,r,o),n},t.opacity=function(t,e){var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.width,o=t.height;if(n.width=r,n.height=o,"string"==typeof i.filter)i.filter="opacity(".concat(100*e,"%)"),i.drawImage(t,0,0,r,o);else{i.drawImage(t,0,0,r,o);for(var a=i.getImageData(0,0,r,o),s=a.data,c=s.length,u=0;u<c;u+=4){var h=s[u+3];0!==h&&(s[u+3]=h*e)}i.putImageData(a,0,0)}return n},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "lucky-canvas", | ||
"version": "1.7.12", | ||
"version": "1.7.13", | ||
"description": "一个基于原生 js 的(大转盘 / 九宫格 / 老虎机)抽奖插件", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -36,3 +36,3 @@ declare type FontItemType = { | ||
dpr: number; | ||
unitFunc?: (num: number, unit: string) => number; | ||
handleCssUnit?: (num: number, unit: string) => number; | ||
rAF?: Function; | ||
@@ -176,14 +176,2 @@ setTimeout: Function; | ||
/** | ||
* 图片裁剪 | ||
*/ | ||
$clip(img: ImgType, ...params: (string | number)[]): ImgType; | ||
/** | ||
* 透明度 | ||
*/ | ||
$opacity(img: ImgType, value: string | number): ImgType; | ||
/** | ||
* 高斯模糊 | ||
*/ | ||
$blur(img: ImgType, radius: string | number): ImgType; | ||
/** | ||
* 添加一个新的响应式数据 (临时) | ||
@@ -759,2 +747,17 @@ * @param data 数据 | ||
export { LuckyGrid, LuckyWheel, SlotMachine }; | ||
/** | ||
* 切割圆角 | ||
* @param img 将要裁剪的图片对象 | ||
* @param radius 裁剪的圆角半径 | ||
* @returns 返回一个离屏 canvas 用于渲染 | ||
*/ | ||
declare const cutRound: (img: ImgType, radius: number) => ImgType; | ||
/** | ||
* 透明度 | ||
* @param img 将要处理的图片对象 | ||
* @param opacity 透明度 | ||
* @returns 返回一个离屏 canvas 用于渲染 | ||
*/ | ||
declare const opacity: (img: ImgType, opacity: number) => ImgType; | ||
export { LuckyGrid, LuckyWheel, SlotMachine, cutRound, opacity }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
928047
1448