New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lucky-canvas

Package Overview
Dependencies
Maintainers
2
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucky-canvas - npm Package Compare versions

Comparing version 1.7.9 to 1.7.10

2

dist/index.cjs.js

@@ -16,3 +16,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});

***************************************************************************** */
var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};function e(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function n(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function r(t,e){var i,n,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(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=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++,n=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],n=0}finally{i=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 i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var c,h,u=function(t){return t&&t.Math==Math&&t},l=u("object"==typeof globalThis&&globalThis)||u("object"==typeof window&&window)||u("object"==typeof self&&self)||u("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,W=l.TypeError,_=function(t){if(null==t)throw W("Can't call method on "+t);return t},P=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]},H=z({}.isPrototypeOf),D=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(h=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!h&&D&&(!(c=D.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=D.match(/Chrome\/(\d+)/))&&(h=+c[1]);var X=h,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)&&H(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(i){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),it=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),nt=l.Object,rt=function(t){return nt(_(t))},ot=z({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ht=z(1..toString),ut=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ht(++st+ct,36)},lt=it("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ut,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 i,n,r=null==(i=t[mt])?void 0:J(i);if(r){if(void 0===e&&(e="default"),n=g(r,t,e),!j(n)||Y(n))return n;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&$(i=t.toString)&&!j(n=g(i,t)))return n;if($(i=t.valueOf)&&!j(n=g(i,t)))return n;if("string"!==e&&$(i=t.toString)&&!j(n=g(i,t)))return n;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=P(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,Wt={f:d?At:function(t,e,i){if(Et(t),e=wt(e),Et(i),xt)try{return At(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Tt("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},_t=d?function(t,e,i){return Wt.f(t,e,w(1,i))}:function(t,e,i){return t[e]=i,t},Pt=z(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Pt(t)});var $t,jt,Rt,Ft=et.inspectSource,Ht=l.WeakMap,Dt=$(Ht)&&/native code/.test(Ft(Ht)),Lt=it("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ut(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Dt||et.state){var Gt=et.state||(et.state=new Xt),Ut=z(Gt.get),qt=z(Gt.has),Yt=z(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 i;if(!j(e)||(i=jt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return i}}},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)},ie=s((function(t){var e=ee.CONFIGURABLE,i=Jt.get,n=Jt.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:i;$(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=n(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:_t(t,i,o)):h?t[i]=o:tt(i,o)})(Function.prototype,"toString",(function(){return $(this)&&i(this).source||Ft(this)}))})),ne=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ne)(e)},ae=Math.max,se=Math.min,ce=Math.min,he=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},ue=function(t){return function(e,i,n){var r,o=P(e),a=he(o),s=function(t,e){var i=oe(t);return i<0?ae(i+e,0):se(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},le={includes:ue(!0),indexOf:ue(!1)},fe=le.indexOf,de=z([].push),pe=function(t,e){var i,n=P(t),r=0,o=[];for(i in n)!at(Bt,i)&&at(n,i)&&de(o,i);for(;e.length>r;)at(n,i=e[r++])&&(~fe(o,i)||de(o,i));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)),i=ye.f;return i?we(e,i(t)):e},Se=function(t,e){for(var i=be(e),n=Wt.f,r=Ot.f,o=0;o<i.length;o++){var a=i[o];at(t,a)||n(t,a,r(e,a))}},Ce=/#|\.prototype\./,xe=function(t,e){var i=Oe[ze(t)];return i==Ie||i!=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 i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?l:h?l[s]||tt(s,{}):(l[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Te(i,n))&&a.value:i[n],!Ee(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ie(i,n,o,t)}},We=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var i,n=P(e),r=We(e),o=r.length,a=0;o>a;)Wt.f(t,i=r[a++],n[i]);return t},Pe=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},He=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;He="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",Pe.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 i=ge.length;i--;)delete He.prototype[ge[i]];return He()};Bt[$e]=!0;var De=Object.create||function(t,e){var i;return null!==t?(je.prototype=Et(t),i=new je,je.prototype=null,i[$e]=t):i=He(),void 0===e?i:_e(i,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&Wt.f(Me,Le,{configurable:!0,value:De(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:Wt.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,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?i:Je?I(e):"Object"==(n=I(e))&&$(e.callee)?"Arguments":n},Ze=l.String,ti=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},ei=gt("match"),ii=z("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ei]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~ii(ti(_(this)),ti(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var ni,ri,oi=le.indexOf,ai=z([].indexOf),si=!!ai&&1/ai([1],1,-0)<0,ci=!!(ri=[]["indexOf"])&&f((function(){ri.call(null,ni||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:si||!ci},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return si?ai(this,t,e)||0:oi(this,t,e)}});var hi=z(z.bind),ui=Array.isArray||function(t){return"Array"==I(t)},li=function(){},fi=[],di=F("Reflect","construct"),pi=/^\s*(?:class|function)\b/,gi=z(pi.exec),vi=!pi.exec(li),mi=function(t){if(!$(t))return!1;try{return di(li,fi,t),!0}catch(t){return!1}},yi=!di||f((function(){var t;return mi(mi.call)||!mi(Object)||!mi((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return vi||!!gi(pi,Ft(t))}:mi,wi=gt("species"),bi=l.Array,Si=function(t,e){return new(function(t){var e;return ui(t)&&(e=t.constructor,(yi(e)&&(e===bi||ui(e.prototype))||j(e)&&null===(e=e[wi]))&&(e=void 0)),void 0===e?bi:e}(t))(0===e?0:e)},Ci=z([].push),xi=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hi?hi(t,e):function(){return t.apply(e,arguments)}}(h,u),m=he(g),y=0,w=l||Si,b=e?w(c,m):i||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:Ci(b,f)}else switch(t){case 4:return!1;case 7:Ci(b,f)}return o?-1:n||r?r:b}},zi={forEach:xi(0),map:xi(1),filter:xi(2),some:xi(3),every:xi(4),find:xi(5),findIndex:xi(6),filterReject:xi(7)}.find,Oi=!0;"find"in[]&&Array(1).find((function(){Oi=!1})),Ae({target:"Array",proto:!0,forced:Oi},{find:function(t){return zi(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find"),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 i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[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),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var ki=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Ii=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!ki(r,"object","array"))return r;t=r}return t},Ei=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Ti=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Ai=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===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},Wi=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&ki(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},_i=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Pi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=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,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},$i=function(t){return Math.PI/180*t},ji=function(t,e,i,n,r,o){t.beginPath();var a,s,c=$i(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Ri=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Fi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return Ri(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Hi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Di=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}(),Li="__proto__"in{};function Mi(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var Bi=Array.prototype,Ni=Object.create(Bi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Ni[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=Bi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Xi=function(){function t(t){this.dep=new Di,Mi(t,"__luckyOb__",this),Array.isArray(t)&&(Li?t.__proto__=Ni:Object.getOwnPropertyNames(Ni).forEach((function(e){Mi(t,e,Ni[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ui(t,e,t[e])}))},t}();function Gi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Xi(t)}function Ui(t,e,i){var n=new Di,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Gi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Di.target&&(n.addSub(Di.target),s&&s.dep.addSub(Di.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Gi(e),n.notify()))}})}}var qi=0,Yi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Di.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){ki(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Di.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}(),Ki=function(){function t(t,e){var i=this;this.version="1.7.9",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","lucky-canvas@1.7.9"),t.canvasElement.addEventListener("click",(function(t){return i.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 i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.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.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,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,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,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},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,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([i],n))},t.prototype.getLength=function(t){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Ei(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Fi.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Hi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ui(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Yi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),Vi=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},Ji=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},Qi=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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 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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={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(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()}))}))}))},o.prototype.handleClick=function(t){var e,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.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,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._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,n){return Ai(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=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate($i(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=$i(this.prizeDeg);var c=$i(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;Ai(l)&&(o.fillStyle=l,ji(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+$i(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.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=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Pi(o,Ti(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate($i(360)-n-$i(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=Ji(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=f}},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){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=_i(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 i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=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<h){this.FPS=f/t;var g=Vi(f,0,l,h);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=Ji(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(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.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t){return-t/2},o.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},o}(Ki),Zi=function(t){function a(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};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()}))}))}))},a.prototype.handleClick=function(t){var e=this,i=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},a.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if("buttons"===t&&!n.buttons.length&&n.button&&(s=n.button),s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]);var u=[n.loadImg(c.src,c),c.activeSrc&&n.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(n,a),s&&(s=u.call(n,s))),h[i][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},a.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},a.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,a=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._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){var n=t.x,r=t.y,o=t.w,s=t.h,h=Wi(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return Ai(g)&&(a.fillStyle=i.handleBackground(n,r,o,s,g),Ri(a,n,r,o,s,p),a.fill()),{x:n+f,y:r+u,w:o-f-d,h:s-u-l}}),{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 n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),o=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if(Ai(d)){var p=(f?h.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?u-=p[0]:(u+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=i.handleBackground(o,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Ri(a,o,s,u,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[o+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],m=g[0],y=g[1];i.drawImage(a,u,m,y,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;a.font=r+" "+(u>>0)+"px "+n,a.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],m=String(e.text);if(d){var y=i.getWidth(p,t.col);v=Pi(a,Ti(m),(function(){return y}),g)}else v=m.split("\n");v.forEach((function(n,r){a.fillText(n,o+i.getOffsetX(a.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,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 h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=Ji(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},a.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,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=_i(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 i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.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<u){this.FPS=d/t;var v=Vi(d,.1,f-.1,u);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=Ji(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(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],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},a.prototype.getWidth=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getHeight=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},a.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},a}(Ki),tn=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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=-1,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=-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,"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=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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};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.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=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,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if(Ai(S)){var C=t.getLength(Ei(r,"borderRadius")?r.borderRadius:i.borderRadius);Ri(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Ii(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(m,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;m.font=r+" "+(o>>0)+"px "+n,m.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Pi(m,Ti(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){m.fillText(i,y+t.getOffsetX(m.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),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 i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=Wi(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return Ai(v)&&(Ri(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Ii(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.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,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,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,i=e._defaultConfig,n=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||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=Ji(t.FPS,l,d,i.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){0!==this.step&&3!==this.step&&(this.prizeFlag=t,this.step=t<0?0:2)},o.prototype.run=function(t){var e,i=this;void 0===t&&(t=0);var n=this,r=n.rAF,o=n.step,a=n.prizeFlag,s=n._defaultConfig,c=n.cellAndSpacing,h=s.accelerationTime,u=s.decelerationTime;if(0===this.step&&void 0!==a&&a>=0)null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{});else if(-1!==a){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var l=Date.now()-this.startTime,f=Date.now()-this.endTime;this.slots.forEach((function(e,n){var r=e.order;if(r&&r.length){var d=c*r.length,p=Math.abs(e.speed||s.speed),g=e.direction||s.direction,v=0,m=i.scroll[n];if(1===o||l<h){i.FPS=l/t;var y=Vi(l,0,p,h);y===p&&(i.step=2),v=(m+y*g)%d}else if(2===o)v=(m+p*g)%d,void 0!==a&&a>=0&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===o&&f){var w=i.stopScroll[n],b=i.endScroll[n];v=Ji(f,w,b,u),f>=u&&(i.step=0)}i.scroll[n]=v}})),this.draw(),r(this.run.bind(this,t+1))}},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,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o.prototype.getWidth=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t,e){return(e-t)/2},o}(Ki);exports.LuckyGrid=Zi,exports.LuckyWheel=Qi,exports.SlotMachine=tn;
var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};function e(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function n(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function r(t,e){var i,n,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(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=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++,n=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],n=0}finally{i=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 i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var c,h,u=function(t){return t&&t.Math==Math&&t},l=u("object"==typeof globalThis&&globalThis)||u("object"==typeof window&&window)||u("object"==typeof self&&self)||u("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),W=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},P=function(t){return W(_(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]},H=z({}.isPrototypeOf),D=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(h=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!h&&D&&(!(c=D.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=D.match(/Chrome\/(\d+)/))&&(h=+c[1]);var X=h,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)&&H(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(i){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),it=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),nt=l.Object,rt=function(t){return nt(_(t))},ot=z({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ht=z(1..toString),ut=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ht(++st+ct,36)},lt=it("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ut,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 i,n,r=null==(i=t[mt])?void 0:J(i);if(r){if(void 0===e&&(e="default"),n=g(r,t,e),!j(n)||Y(n))return n;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&$(i=t.toString)&&!j(n=g(i,t)))return n;if($(i=t.valueOf)&&!j(n=g(i,t)))return n;if("string"!==e&&$(i=t.toString)&&!j(n=g(i,t)))return n;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=P(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,Wt=Object.defineProperty,At={f:d?Wt:function(t,e,i){if(Et(t),e=wt(e),Et(i),xt)try{return Wt(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Tt("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},_t=d?function(t,e,i){return At.f(t,e,w(1,i))}:function(t,e,i){return t[e]=i,t},Pt=z(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Pt(t)});var $t,jt,Rt,Ft=et.inspectSource,Ht=l.WeakMap,Dt=$(Ht)&&/native code/.test(Ft(Ht)),Lt=it("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ut(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Dt||et.state){var Gt=et.state||(et.state=new Xt),Ut=z(Gt.get),qt=z(Gt.has),Yt=z(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 i;if(!j(e)||(i=jt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return i}}},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)},ie=s((function(t){var e=ee.CONFIGURABLE,i=Jt.get,n=Jt.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:i;$(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=n(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:_t(t,i,o)):h?t[i]=o:tt(i,o)})(Function.prototype,"toString",(function(){return $(this)&&i(this).source||Ft(this)}))})),ne=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ne)(e)},ae=Math.max,se=Math.min,ce=Math.min,he=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},ue=function(t){return function(e,i,n){var r,o=P(e),a=he(o),s=function(t,e){var i=oe(t);return i<0?ae(i+e,0):se(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},le={includes:ue(!0),indexOf:ue(!1)},fe=le.indexOf,de=z([].push),pe=function(t,e){var i,n=P(t),r=0,o=[];for(i in n)!at(Bt,i)&&at(n,i)&&de(o,i);for(;e.length>r;)at(n,i=e[r++])&&(~fe(o,i)||de(o,i));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)),i=ye.f;return i?we(e,i(t)):e},Se=function(t,e){for(var i=be(e),n=At.f,r=Ot.f,o=0;o<i.length;o++){var a=i[o];at(t,a)||n(t,a,r(e,a))}},Ce=/#|\.prototype\./,xe=function(t,e){var i=Oe[ze(t)];return i==Ie||i!=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,We=function(t,e){var i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?l:h?l[s]||tt(s,{}):(l[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Te(i,n))&&a.value:i[n],!Ee(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ie(i,n,o,t)}},Ae=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var i,n=P(e),r=Ae(e),o=r.length,a=0;o>a;)At.f(t,i=r[a++],n[i]);return t},Pe=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},He=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;He="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",Pe.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 i=ge.length;i--;)delete He.prototype[ge[i]];return He()};Bt[$e]=!0;var De=Object.create||function(t,e){var i;return null!==t?(je.prototype=Et(t),i=new je,je.prototype=null,i[$e]=t):i=He(),void 0===e?i:_e(i,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&At.f(Me,Le,{configurable:!0,value:De(null)});var Be=function(t){Me[Le][t]=!0},Ne=le.includes;We({target:"Array",proto:!0},{includes:function(t){return Ne(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("includes"),We({target:"Object",stat:!0,forced:!d,sham:!d},{defineProperty:At.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,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?i:Je?I(e):"Object"==(n=I(e))&&$(e.callee)?"Arguments":n},Ze=l.String,ti=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},ei=gt("match"),ii=z("".indexOf);We({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ei]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~ii(ti(_(this)),ti(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var ni,ri,oi=le.indexOf,ai=z([].indexOf),si=!!ai&&1/ai([1],1,-0)<0,ci=!!(ri=[]["indexOf"])&&f((function(){ri.call(null,ni||function(){throw 1},1)}));We({target:"Array",proto:!0,forced:si||!ci},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return si?ai(this,t,e)||0:oi(this,t,e)}});var hi=z(z.bind),ui=Array.isArray||function(t){return"Array"==I(t)},li=function(){},fi=[],di=F("Reflect","construct"),pi=/^\s*(?:class|function)\b/,gi=z(pi.exec),vi=!pi.exec(li),mi=function(t){if(!$(t))return!1;try{return di(li,fi,t),!0}catch(t){return!1}},yi=!di||f((function(){var t;return mi(mi.call)||!mi(Object)||!mi((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return vi||!!gi(pi,Ft(t))}:mi,wi=gt("species"),bi=l.Array,Si=function(t,e){return new(function(t){var e;return ui(t)&&(e=t.constructor,(yi(e)&&(e===bi||ui(e.prototype))||j(e)&&null===(e=e[wi]))&&(e=void 0)),void 0===e?bi:e}(t))(0===e?0:e)},Ci=z([].push),xi=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=rt(c),g=W(p),v=function(t,e){return J(t),void 0===e?t:hi?hi(t,e):function(){return t.apply(e,arguments)}}(h,u),m=he(g),y=0,w=l||Si,b=e?w(c,m):i||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:Ci(b,f)}else switch(t){case 4:return!1;case 7:Ci(b,f)}return o?-1:n||r?r:b}},zi={forEach:xi(0),map:xi(1),filter:xi(2),some:xi(3),every:xi(4),find:xi(5),findIndex:xi(6),filterReject:xi(7)}.find,Oi=!0;"find"in[]&&Array(1).find((function(){Oi=!1})),We({target:"Array",proto:!0,forced:Oi},{find:function(t){return zi(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find"),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 i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[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),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var ki=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Ii=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!ki(r,"object","array"))return r;t=r}return t},Ei=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Ti=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Wi=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===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},Ai=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&ki(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},_i=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Pi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=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,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},$i=function(t){return Math.PI/180*t},ji=function(t,e,i,n,r,o){t.beginPath();var a,s,c=$i(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Ri=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Fi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return Ri(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Hi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Di=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}(),Li="__proto__"in{};function Mi(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var Bi=Array.prototype,Ni=Object.create(Bi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Ni[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=Bi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Xi=function(){function t(t){this.dep=new Di,Mi(t,"__luckyOb__",this),Array.isArray(t)&&(Li?t.__proto__=Ni:Object.getOwnPropertyNames(Ni).forEach((function(e){Mi(t,e,Ni[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ui(t,e,t[e])}))},t}();function Gi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Xi(t)}function Ui(t,e,i){var n=new Di,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Gi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Di.target&&(n.addSub(Di.target),s&&s.dep.addSub(Di.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Gi(e),n.notify()))}})}}var qi=0,Yi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Di.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){ki(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Di.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}(),Ki=function(){function t(t,e){var i=this;this.version="1.7.10",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","lucky-canvas@1.7.10"),t.canvasElement.addEventListener("click",(function(t){return i.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 i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.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],i=t[1];this.ctx.clearRect(-e,-i,2*e,2*i)},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,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,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,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},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,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([i],n))},t.prototype.getLength=function(t){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Ei(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Fi.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Hi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ui(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Yi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),Vi=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},Ji=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},Qi=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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 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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={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(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()}))}))}))},o.prototype.handleClick=function(t){var e,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.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,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._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,n){return Wi(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=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate($i(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=$i(this.prizeDeg);var c=$i(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;Wi(l)&&(o.fillStyle=l,ji(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+$i(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.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=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Pi(o,Ti(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate($i(360)-n-$i(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),Wi(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&Wi(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=Ji(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=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=_i(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 i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=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<h){this.FPS=f/t;var g=Vi(f,0,l,h);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=Ji(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(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.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t){return-t/2},o.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},o}(Ki),Zi=function(t){function a(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};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()}))}))}))},a.prototype.handleClick=function(t){var e=this,i=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},a.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if("buttons"===t&&!n.buttons.length&&n.button&&(s=n.button),s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]);var u=[n.loadImg(c.src,c),c.activeSrc&&n.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(n,a),s&&(s=u.call(n,s))),h[i][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},a.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},a.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,a=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._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){var n=t.x,r=t.y,o=t.w,s=t.h,h=Ai(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return Wi(g)&&(a.fillStyle=i.handleBackground(n,r,o,s,g),Ri(a,n,r,o,s,p),a.fill()),{x:n+f,y:r+u,w:o-f-d,h:s-u-l}}),{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 n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),o=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if(Wi(d)){var p=(f?h.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?u-=p[0]:(u+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=i.handleBackground(o,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Ri(a,o,s,u,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[o+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],m=g[0],y=g[1];i.drawImage(a,u,m,y,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;a.font=r+" "+(u>>0)+"px "+n,a.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],m=String(e.text);if(d){var y=i.getWidth(p,t.col);v=Pi(a,Ti(m),(function(){return y}),g)}else v=m.split("\n");v.forEach((function(n,r){a.fillText(n,o+i.getOffsetX(a.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,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 h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=Ji(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},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=_i(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 i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.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<u){this.FPS=d/t;var v=Vi(d,.1,f-.1,u);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=Ji(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(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],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},a.prototype.getWidth=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getHeight=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},a.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},a}(Ki),tn=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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=-1,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=-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,"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=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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};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.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=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,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if(Wi(S)){var C=t.getLength(Ei(r,"borderRadius")?r.borderRadius:i.borderRadius);Ri(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Ii(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(m,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;m.font=r+" "+(o>>0)+"px "+n,m.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Pi(m,Ti(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){m.fillText(i,y+t.getOffsetX(m.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),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 i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=Ai(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return Wi(v)&&(Ri(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Ii(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.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,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,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,i=e._defaultConfig,n=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||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=Ji(t.FPS,l,d,i.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){0!==this.step&&3!==this.step&&(this.prizeFlag=t,this.step=t<0?0:2)},o.prototype.run=function(t){var e,i=this;void 0===t&&(t=0);var n=this,r=n.rAF,o=n.step,a=n.prizeFlag,s=n._defaultConfig,c=n.cellAndSpacing,h=s.accelerationTime,u=s.decelerationTime;if(0===this.step&&void 0!==a&&a>=0)null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{});else if(-1!==a){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var l=Date.now()-this.startTime,f=Date.now()-this.endTime;this.slots.forEach((function(e,n){var r=e.order;if(r&&r.length){var d=c*r.length,p=Math.abs(e.speed||s.speed),g=e.direction||s.direction,v=0,m=i.scroll[n];if(1===o||l<h){i.FPS=l/t;var y=Vi(l,0,p,h);y===p&&(i.step=2),v=(m+y*g)%d}else if(2===o)v=(m+p*g)%d,void 0!==a&&a>=0&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===o&&f){var w=i.stopScroll[n],b=i.endScroll[n];v=Ji(f,w,b,u),f>=u&&(i.step=0)}i.scroll[n]=v}})),this.draw(),r(this.run.bind(this,t+1))}},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,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o.prototype.getWidth=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t,e){return(e-t)/2},o}(Ki);exports.LuckyGrid=Zi,exports.LuckyWheel=Qi,exports.SlotMachine=tn;
//# sourceMappingURL=index.cjs.js.map

@@ -15,3 +15,3 @@ /*! *****************************************************************************

***************************************************************************** */
var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};function e(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function n(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function r(t,e){var i,n,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(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=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++,n=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],n=0}finally{i=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 i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var c,h,u=function(t){return t&&t.Math==Math&&t},l=u("object"==typeof globalThis&&globalThis)||u("object"==typeof window&&window)||u("object"==typeof self&&self)||u("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,W=l.TypeError,_=function(t){if(null==t)throw W("Can't call method on "+t);return t},P=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]},H=x({}.isPrototypeOf),D=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(h=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!h&&D&&(!(c=D.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=D.match(/Chrome\/(\d+)/))&&(h=+c[1]);var X=h,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)&&H(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(i){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),it=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),nt=l.Object,rt=function(t){return nt(_(t))},ot=x({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ht=x(1..toString),ut=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ht(++st+ct,36)},lt=it("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ut,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 i,n,r=null==(i=t[mt])?void 0:J(i);if(r){if(void 0===e&&(e="default"),n=g(r,t,e),!j(n)||Y(n))return n;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&$(i=t.toString)&&!j(n=g(i,t)))return n;if($(i=t.valueOf)&&!j(n=g(i,t)))return n;if("string"!==e&&$(i=t.toString)&&!j(n=g(i,t)))return n;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=P(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,Wt={f:d?At:function(t,e,i){if(Et(t),e=wt(e),Et(i),zt)try{return At(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Tt("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},_t=d?function(t,e,i){return Wt.f(t,e,w(1,i))}:function(t,e,i){return t[e]=i,t},Pt=x(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Pt(t)});var $t,jt,Rt,Ft=et.inspectSource,Ht=l.WeakMap,Dt=$(Ht)&&/native code/.test(Ft(Ht)),Lt=it("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ut(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Dt||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 i;if(!j(e)||(i=jt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return i}}},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)},ie=s((function(t){var e=ee.CONFIGURABLE,i=Jt.get,n=Jt.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:i;$(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=n(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:_t(t,i,o)):h?t[i]=o:tt(i,o)})(Function.prototype,"toString",(function(){return $(this)&&i(this).source||Ft(this)}))})),ne=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ne)(e)},ae=Math.max,se=Math.min,ce=Math.min,he=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},ue=function(t){return function(e,i,n){var r,o=P(e),a=he(o),s=function(t,e){var i=oe(t);return i<0?ae(i+e,0):se(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},le={includes:ue(!0),indexOf:ue(!1)},fe=le.indexOf,de=x([].push),pe=function(t,e){var i,n=P(t),r=0,o=[];for(i in n)!at(Bt,i)&&at(n,i)&&de(o,i);for(;e.length>r;)at(n,i=e[r++])&&(~fe(o,i)||de(o,i));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)),i=ye.f;return i?we(e,i(t)):e},Se=function(t,e){for(var i=be(e),n=Wt.f,r=Ot.f,o=0;o<i.length;o++){var a=i[o];at(t,a)||n(t,a,r(e,a))}},Ce=/#|\.prototype\./,ze=function(t,e){var i=Oe[xe(t)];return i==Ie||i!=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 i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?l:h?l[s]||tt(s,{}):(l[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Te(i,n))&&a.value:i[n],!Ee(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ie(i,n,o,t)}},We=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var i,n=P(e),r=We(e),o=r.length,a=0;o>a;)Wt.f(t,i=r[a++],n[i]);return t},Pe=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},He=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;He="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",Pe.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 i=ge.length;i--;)delete He.prototype[ge[i]];return He()};Bt[$e]=!0;var De=Object.create||function(t,e){var i;return null!==t?(je.prototype=Et(t),i=new je,je.prototype=null,i[$e]=t):i=He(),void 0===e?i:_e(i,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&Wt.f(Me,Le,{configurable:!0,value:De(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:Wt.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,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?i:Je?I(e):"Object"==(n=I(e))&&$(e.callee)?"Arguments":n},Ze=l.String,ti=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},ei=gt("match"),ii=x("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ei]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~ii(ti(_(this)),ti(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var ni,ri,oi=le.indexOf,ai=x([].indexOf),si=!!ai&&1/ai([1],1,-0)<0,ci=!!(ri=[]["indexOf"])&&f((function(){ri.call(null,ni||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:si||!ci},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return si?ai(this,t,e)||0:oi(this,t,e)}});var hi=x(x.bind),ui=Array.isArray||function(t){return"Array"==I(t)},li=function(){},fi=[],di=F("Reflect","construct"),pi=/^\s*(?:class|function)\b/,gi=x(pi.exec),vi=!pi.exec(li),mi=function(t){if(!$(t))return!1;try{return di(li,fi,t),!0}catch(t){return!1}},yi=!di||f((function(){var t;return mi(mi.call)||!mi(Object)||!mi((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return vi||!!gi(pi,Ft(t))}:mi,wi=gt("species"),bi=l.Array,Si=function(t,e){return new(function(t){var e;return ui(t)&&(e=t.constructor,(yi(e)&&(e===bi||ui(e.prototype))||j(e)&&null===(e=e[wi]))&&(e=void 0)),void 0===e?bi:e}(t))(0===e?0:e)},Ci=x([].push),zi=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hi?hi(t,e):function(){return t.apply(e,arguments)}}(h,u),m=he(g),y=0,w=l||Si,b=e?w(c,m):i||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:Ci(b,f)}else switch(t){case 4:return!1;case 7:Ci(b,f)}return o?-1:n||r?r:b}},xi={forEach:zi(0),map:zi(1),filter:zi(2),some:zi(3),every:zi(4),find:zi(5),findIndex:zi(6),filterReject:zi(7)}.find,Oi=!0;"find"in[]&&Array(1).find((function(){Oi=!1})),Ae({target:"Array",proto:!0,forced:Oi},{find:function(t){return xi(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find"),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 i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[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),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var ki=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Ii=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!ki(r,"object","array"))return r;t=r}return t},Ei=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Ti=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Ai=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===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},Wi=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&ki(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},_i=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Pi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=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,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},$i=function(t){return Math.PI/180*t},ji=function(t,e,i,n,r,o){t.beginPath();var a,s,c=$i(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Ri=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Fi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return Ri(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Hi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Di=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}(),Li="__proto__"in{};function Mi(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var Bi=Array.prototype,Ni=Object.create(Bi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Ni[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=Bi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Xi=function(){function t(t){this.dep=new Di,Mi(t,"__luckyOb__",this),Array.isArray(t)&&(Li?t.__proto__=Ni:Object.getOwnPropertyNames(Ni).forEach((function(e){Mi(t,e,Ni[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ui(t,e,t[e])}))},t}();function Gi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Xi(t)}function Ui(t,e,i){var n=new Di,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Gi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Di.target&&(n.addSub(Di.target),s&&s.dep.addSub(Di.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Gi(e),n.notify()))}})}}var qi=0,Yi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Di.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){ki(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Di.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}(),Ki=function(){function t(t,e){var i=this;this.version="1.7.9",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","lucky-canvas@1.7.9"),t.canvasElement.addEventListener("click",(function(t){return i.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 i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.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.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,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,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,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},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,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([i],n))},t.prototype.getLength=function(t){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Ei(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Fi.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Hi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ui(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Yi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),Vi=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},Ji=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},Qi=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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 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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={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(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()}))}))}))},o.prototype.handleClick=function(t){var e,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.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,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._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,n){return Ai(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=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate($i(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=$i(this.prizeDeg);var c=$i(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;Ai(l)&&(o.fillStyle=l,ji(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+$i(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.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=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Pi(o,Ti(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate($i(360)-n-$i(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=Ji(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=f}},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){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=_i(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 i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=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<h){this.FPS=f/t;var g=Vi(f,0,l,h);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=Ji(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(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.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t){return-t/2},o.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},o}(Ki),Zi=function(t){function a(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};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()}))}))}))},a.prototype.handleClick=function(t){var e=this,i=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},a.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if("buttons"===t&&!n.buttons.length&&n.button&&(s=n.button),s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]);var u=[n.loadImg(c.src,c),c.activeSrc&&n.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(n,a),s&&(s=u.call(n,s))),h[i][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},a.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},a.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,a=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._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){var n=t.x,r=t.y,o=t.w,s=t.h,h=Wi(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return Ai(g)&&(a.fillStyle=i.handleBackground(n,r,o,s,g),Ri(a,n,r,o,s,p),a.fill()),{x:n+f,y:r+u,w:o-f-d,h:s-u-l}}),{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 n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),o=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if(Ai(d)){var p=(f?h.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?u-=p[0]:(u+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=i.handleBackground(o,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Ri(a,o,s,u,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[o+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],m=g[0],y=g[1];i.drawImage(a,u,m,y,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;a.font=r+" "+(u>>0)+"px "+n,a.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],m=String(e.text);if(d){var y=i.getWidth(p,t.col);v=Pi(a,Ti(m),(function(){return y}),g)}else v=m.split("\n");v.forEach((function(n,r){a.fillText(n,o+i.getOffsetX(a.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,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 h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=Ji(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},a.prototype.play=function(){0===this.step&&(this.startTime=Date.now(),this.prizeFlag=void 0,this.step=1,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=_i(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 i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.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<u){this.FPS=d/t;var v=Vi(d,.1,f-.1,u);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=Ji(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(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],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},a.prototype.getWidth=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getHeight=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},a.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},a}(Ki),tn=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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=-1,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=-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,"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=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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};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.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=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,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if(Ai(S)){var C=t.getLength(Ei(r,"borderRadius")?r.borderRadius:i.borderRadius);Ri(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Ii(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(m,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;m.font=r+" "+(o>>0)+"px "+n,m.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Pi(m,Ti(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){m.fillText(i,y+t.getOffsetX(m.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),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 i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=Wi(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return Ai(v)&&(Ri(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Ii(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.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,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,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,i=e._defaultConfig,n=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||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=Ji(t.FPS,l,d,i.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){0!==this.step&&3!==this.step&&(this.prizeFlag=t,this.step=t<0?0:2)},o.prototype.run=function(t){var e,i=this;void 0===t&&(t=0);var n=this,r=n.rAF,o=n.step,a=n.prizeFlag,s=n._defaultConfig,c=n.cellAndSpacing,h=s.accelerationTime,u=s.decelerationTime;if(0===this.step&&void 0!==a&&a>=0)null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{});else if(-1!==a){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var l=Date.now()-this.startTime,f=Date.now()-this.endTime;this.slots.forEach((function(e,n){var r=e.order;if(r&&r.length){var d=c*r.length,p=Math.abs(e.speed||s.speed),g=e.direction||s.direction,v=0,m=i.scroll[n];if(1===o||l<h){i.FPS=l/t;var y=Vi(l,0,p,h);y===p&&(i.step=2),v=(m+y*g)%d}else if(2===o)v=(m+p*g)%d,void 0!==a&&a>=0&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===o&&f){var w=i.stopScroll[n],b=i.endScroll[n];v=Ji(f,w,b,u),f>=u&&(i.step=0)}i.scroll[n]=v}})),this.draw(),r(this.run.bind(this,t+1))}},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,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o.prototype.getWidth=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t,e){return(e-t)/2},o}(Ki);export{Zi as LuckyGrid,Qi as LuckyWheel,tn as SlotMachine};
var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};function e(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function n(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function r(t,e){var i,n,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(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=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++,n=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],n=0}finally{i=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 i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var c,h,u=function(t){return t&&t.Math==Math&&t},l=u("object"==typeof globalThis&&globalThis)||u("object"==typeof window&&window)||u("object"==typeof self&&self)||u("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,W=l.TypeError,_=function(t){if(null==t)throw W("Can't call method on "+t);return t},P=function(t){return A(_(t))},$=function(t){return"function"==typeof t},R=function(t){return"object"==typeof t?null!==t:$(t)},j=function(t){return $(t)?t:void 0},F=function(t,e){return arguments.length<2?j(l[t]):l[t]&&l[t][e]},H=z({}.isPrototypeOf),D=F("navigator","userAgent")||"",L=l.process,M=l.Deno,B=L&&L.versions||M&&M.version,N=B&&B.v8;N&&(h=(c=N.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!h&&D&&(!(c=D.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=D.match(/Chrome\/(\d+)/))&&(h=+c[1]);var X=h,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)&&H(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(i){l[t]=e}return e},et=l["__core-js_shared__"]||tt("__core-js_shared__",{}),it=s((function(t){(t.exports=function(t,e){return et[t]||(et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),nt=l.Object,rt=function(t){return nt(_(t))},ot=z({}.hasOwnProperty),at=Object.hasOwn||function(t,e){return ot(rt(t),e)},st=0,ct=Math.random(),ht=z(1..toString),ut=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ht(++st+ct,36)},lt=it("wks"),ft=l.Symbol,dt=ft&&ft.for,pt=U?ft:ft&&ft.withoutSetter||ut,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(!R(t)||Y(t))return t;var i,n,r=null==(i=t[mt])?void 0:J(i);if(r){if(void 0===e&&(e="default"),n=g(r,t,e),!R(n)||Y(n))return n;throw vt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&$(i=t.toString)&&!R(n=g(i,t)))return n;if($(i=t.valueOf)&&!R(n=g(i,t)))return n;if("string"!==e&&$(i=t.toString)&&!R(n=g(i,t)))return n;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=R(bt)&&R(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=P(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(R(t))return t;throw It(kt(t)+" is not an object")},Tt=l.TypeError,At=Object.defineProperty,Wt={f:d?At:function(t,e,i){if(Et(t),e=wt(e),Et(i),xt)try{return At(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Tt("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},_t=d?function(t,e,i){return Wt.f(t,e,w(1,i))}:function(t,e,i){return t[e]=i,t},Pt=z(Function.toString);$(et.inspectSource)||(et.inspectSource=function(t){return Pt(t)});var $t,Rt,jt,Ft=et.inspectSource,Ht=l.WeakMap,Dt=$(Ht)&&/native code/.test(Ft(Ht)),Lt=it("keys"),Mt=function(t){return Lt[t]||(Lt[t]=ut(t))},Bt={},Nt=l.TypeError,Xt=l.WeakMap;if(Dt||et.state){var Gt=et.state||(et.state=new Xt),Ut=z(Gt.get),qt=z(Gt.has),Yt=z(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},Rt=function(t){return Ut(Gt,t)||{}},jt=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},Rt=function(t){return at(t,Kt)?t[Kt]:{}},jt=function(t){return at(t,Kt)}}var Vt,Jt={set:$t,get:Rt,has:jt,enforce:function(t){return jt(t)?Rt(t):$t(t,{})},getterFor:function(t){return function(e){var i;if(!R(e)||(i=Rt(e)).type!==t)throw Nt("Incompatible receiver, "+t+" required");return i}}},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)},ie=s((function(t){var e=ee.CONFIGURABLE,i=Jt.get,n=Jt.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:i;$(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=n(o)).source||(s.source=r.join("string"==typeof f?f:""))),t!==l?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:_t(t,i,o)):h?t[i]=o:tt(i,o)})(Function.prototype,"toString",(function(){return $(this)&&i(this).source||Ft(this)}))})),ne=Math.ceil,re=Math.floor,oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?re:ne)(e)},ae=Math.max,se=Math.min,ce=Math.min,he=function(t){return(e=t.length)>0?ce(oe(e),9007199254740991):0;var e},ue=function(t){return function(e,i,n){var r,o=P(e),a=he(o),s=function(t,e){var i=oe(t);return i<0?ae(i+e,0):se(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},le={includes:ue(!0),indexOf:ue(!1)},fe=le.indexOf,de=z([].push),pe=function(t,e){var i,n=P(t),r=0,o=[];for(i in n)!at(Bt,i)&&at(n,i)&&de(o,i);for(;e.length>r;)at(n,i=e[r++])&&(~fe(o,i)||de(o,i));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)),i=ye.f;return i?we(e,i(t)):e},Se=function(t,e){for(var i=be(e),n=Wt.f,r=Ot.f,o=0;o<i.length;o++){var a=i[o];at(t,a)||n(t,a,r(e,a))}},Ce=/#|\.prototype\./,xe=function(t,e){var i=Oe[ze(t)];return i==Ie||i!=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 i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?l:h?l[s]||tt(s,{}):(l[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Te(i,n))&&a.value:i[n],!Ee(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Se(o,r)}(t.sham||r&&r.sham)&&_t(o,"sham",!0),ie(i,n,o,t)}},We=Object.keys||function(t){return pe(t,ge)},_e=d?Object.defineProperties:function(t,e){Et(t);for(var i,n=P(e),r=We(e),o=r.length,a=0;o>a;)Wt.f(t,i=r[a++],n[i]);return t},Pe=F("document","documentElement"),$e=Mt("IE_PROTO"),Re=function(){},je=function(t){return"<script>"+t+"<\/script>"},Fe=function(t){t.write(je("")),t.close();var e=t.parentWindow.Object;return t=null,e},He=function(){try{Vt=new ActiveXObject("htmlfile")}catch(t){}var t,e;He="undefined"!=typeof document?document.domain&&Vt?Fe(Vt):((e=Ct("iframe")).style.display="none",Pe.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(je("document.F=Object")),t.close(),t.F):Fe(Vt);for(var i=ge.length;i--;)delete He.prototype[ge[i]];return He()};Bt[$e]=!0;var De=Object.create||function(t,e){var i;return null!==t?(Re.prototype=Et(t),i=new Re,Re.prototype=null,i[$e]=t):i=He(),void 0===e?i:_e(i,e)},Le=gt("unscopables"),Me=Array.prototype;null==Me[Le]&&Wt.f(Me,Le,{configurable:!0,value:De(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:Wt.f});var Xe=gt("match"),Ge=l.TypeError,Ue=function(t){if(function(t){var e;return R(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,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ke))?i:Je?I(e):"Object"==(n=I(e))&&$(e.callee)?"Arguments":n},Ze=l.String,ti=function(t){if("Symbol"===Qe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ze(t)},ei=gt("match"),ii=z("".indexOf);Ae({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ei]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~ii(ti(_(this)),ti(Ue(t)),arguments.length>1?arguments[1]:void 0)}});var ni,ri,oi=le.indexOf,ai=z([].indexOf),si=!!ai&&1/ai([1],1,-0)<0,ci=!!(ri=[]["indexOf"])&&f((function(){ri.call(null,ni||function(){throw 1},1)}));Ae({target:"Array",proto:!0,forced:si||!ci},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return si?ai(this,t,e)||0:oi(this,t,e)}});var hi=z(z.bind),ui=Array.isArray||function(t){return"Array"==I(t)},li=function(){},fi=[],di=F("Reflect","construct"),pi=/^\s*(?:class|function)\b/,gi=z(pi.exec),vi=!pi.exec(li),mi=function(t){if(!$(t))return!1;try{return di(li,fi,t),!0}catch(t){return!1}},yi=!di||f((function(){var t;return mi(mi.call)||!mi(Object)||!mi((function(){t=!0}))||t}))?function(t){if(!$(t))return!1;switch(Qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return vi||!!gi(pi,Ft(t))}:mi,wi=gt("species"),bi=l.Array,Si=function(t,e){return new(function(t){var e;return ui(t)&&(e=t.constructor,(yi(e)&&(e===bi||ui(e.prototype))||R(e)&&null===(e=e[wi]))&&(e=void 0)),void 0===e?bi:e}(t))(0===e?0:e)},Ci=z([].push),xi=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=rt(c),g=A(p),v=function(t,e){return J(t),void 0===e?t:hi?hi(t,e):function(){return t.apply(e,arguments)}}(h,u),m=he(g),y=0,w=l||Si,b=e?w(c,m):i||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:Ci(b,f)}else switch(t){case 4:return!1;case 7:Ci(b,f)}return o?-1:n||r?r:b}},zi={forEach:xi(0),map:xi(1),filter:xi(2),some:xi(3),every:xi(4),find:xi(5),findIndex:xi(6),filterReject:xi(7)}.find,Oi=!0;"find"in[]&&Array(1).find((function(){Oi=!1})),Ae({target:"Array",proto:!0,forced:Oi},{find:function(t){return zi(this,t,arguments.length>1?arguments[1]:void 0)}}),Be("find"),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 i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[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),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var ki=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Ii=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!ki(r,"object","array"))return r;t=r}return t},Ei=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},Ti=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},Ai=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===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},Wi=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&ki(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},_i=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Pi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=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,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},$i=function(t){return Math.PI/180*t},Ri=function(t,e,i,n,r,o){t.beginPath();var a,s,c=$i(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},ji=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Fi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return ji(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Hi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Di=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}(),Li="__proto__"in{};function Mi(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var Bi=Array.prototype,Ni=Object.create(Bi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Ni[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=Bi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Xi=function(){function t(t){this.dep=new Di,Mi(t,"__luckyOb__",this),Array.isArray(t)&&(Li?t.__proto__=Ni:Object.getOwnPropertyNames(Ni).forEach((function(e){Mi(t,e,Ni[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ui(t,e,t[e])}))},t}();function Gi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Xi(t)}function Ui(t,e,i){var n=new Di,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Gi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Di.target&&(n.addSub(Di.target),s&&s.dep.addSub(Di.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Gi(e),n.notify()))}})}}var qi=0,Yi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Di.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){ki(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Di.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}(),Ki=function(){function t(t,e){var i=this;this.version="1.7.10",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","lucky-canvas@1.7.10"),t.canvasElement.addEventListener("click",(function(t){return i.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 i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.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],i=t[1];this.ctx.clearRect(-e,-i,2*e,2*i)},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,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,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,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},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,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=this.config,s=a.flag,c=a.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,o([i],n))},t.prototype.getLength=function(t){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Ei(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Fi.apply(void 0,o([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Hi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ui(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Yi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),Vi=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},Ji=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},Qi=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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 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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={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(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()}))}))}))},o.prototype.handleClick=function(t){var e,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.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,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._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,n){return Ai(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=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate($i(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=$i(this.prizeDeg);var c=$i(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;Ai(l)&&(o.fillStyle=l,Ri(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+$i(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.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=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Pi(o,Ti(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate($i(360)-n-$i(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&Ai(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},o.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=Ji(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=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=_i(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 i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=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<h){this.FPS=f/t;var g=Vi(f,0,l,h);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=Ji(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(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.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t){return-t/2},o.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},o}(Ki),Zi=function(t){function a(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(a,t),a.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},a.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};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()}))}))}))},a.prototype.handleClick=function(t){var e=this,i=this.ctx;o(o([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},a.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if("buttons"===t&&!n.buttons.length&&n.button&&(s=n.button),s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]);var u=[n.loadImg(c.src,c),c.activeSrc&&n.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(n,a),s&&(s=u.call(n,s))),h[i][e][o]={defaultImg:a,activeImg:s},r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},a.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},a.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,a=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._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){var n=t.x,r=t.y,o=t.w,s=t.h,h=Wi(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return Ai(g)&&(a.fillStyle=i.handleBackground(n,r,o,s,g),ji(a,n,r,o,s,p),a.fill()),{x:n+f,y:r+u,w:o-f-d,h:s-u-l}}),{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 n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),o=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if(Ai(d)){var p=(f?h.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?u-=p[0]:(u+=p[0],o-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),a.fillStyle=i.handleBackground(o,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);ji(a,o,s,u,l,g),a.fill(),a.shadowColor="rgba(0, 0, 0, 0)",a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[o+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],m=g[0],y=g[1];i.drawImage(a,u,m,y,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;a.font=r+" "+(u>>0)+"px "+n,a.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],m=String(e.text);if(d){var y=i.getWidth(p,t.col);v=Pi(a,Ti(m),(function(){return y}),g)}else v=m.split("\n");v.forEach((function(n,r){a.fillText(n,o+i.getOffsetX(a.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,a)},a.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,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 h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},a.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=Ji(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},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=_i(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 i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.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<u){this.FPS=d/t;var v=Vi(d,.1,f-.1,u);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=Ji(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(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],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},a.prototype.getWidth=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getHeight=function(t,e){return void 0===e&&(e=1),ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},a.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},a.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},a}(Ki),tn=function(t){function o(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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=-1,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return e(o,t),o.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=-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,"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=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)}))},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 n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},o.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};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.drawOffscreenCanvas(),t.draw(),e()}))}))}))},o.prototype.loadAndCacheImg=function(t,e,i,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){var s=n[t][e];if(s&&s.imgs){var c=s.imgs[o];if(c){var h=n.ImageCache;h[i][e]||(h[i][e]=[]),n.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(n,t)),h[i][e][o]=t,r()})).catch((function(i){console.error(t+"["+e+"].imgs["+o+"] "+i),a()}))}}}))]}))}))},o.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},o.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=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,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,m=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),y=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if(Ai(S)){var C=t.getLength(Ei(r,"borderRadius")?r.borderRadius:i.borderRadius);ji(m,y,w,c,c,C),m.fillStyle=S,m.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Ii(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[y+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(m,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;m.font=r+" "+(o>>0)+"px "+n,m.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Pi(m,Ti(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){m.fillText(i,y+t.getOffsetX(m.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),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 i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=Wi(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return Ai(v)&&(ji(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Ii(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},o.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.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,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),m=v[0],y=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,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,i=e._defaultConfig,n=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||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=Ji(t.FPS,l,d,i.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){0!==this.step&&3!==this.step&&(this.prizeFlag=t,this.step=t<0?0:2)},o.prototype.run=function(t){var e,i=this;void 0===t&&(t=0);var n=this,r=n.rAF,o=n.step,a=n.prizeFlag,s=n._defaultConfig,c=n.cellAndSpacing,h=s.accelerationTime,u=s.decelerationTime;if(0===this.step&&void 0!==a&&a>=0)null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{});else if(-1!==a){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var l=Date.now()-this.startTime,f=Date.now()-this.endTime;this.slots.forEach((function(e,n){var r=e.order;if(r&&r.length){var d=c*r.length,p=Math.abs(e.speed||s.speed),g=e.direction||s.direction,v=0,m=i.scroll[n];if(1===o||l<h){i.FPS=l/t;var y=Vi(l,0,p,h);y===p&&(i.step=2),v=(m+y*g)%d}else if(2===o)v=(m+p*g)%d,void 0!==a&&a>=0&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===o&&f){var w=i.stopScroll[n],b=i.endScroll[n];v=Ji(f,w,b,u),f>=u&&(i.step=0)}i.scroll[n]=v}})),this.draw(),r(this.run.bind(this,t+1))}},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,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},o.prototype.getWidth=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getHeight=function(t,e){return ki(t,"number")?t:ki(t,"string")?this.changeUnits(t,e):0},o.prototype.getOffsetX=function(t,e){return(e-t)/2},o}(Ki);export{Zi as LuckyGrid,Qi as LuckyWheel,tn as SlotMachine};
//# 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,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},e(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function r(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var i,n,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(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=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++,n=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],n=0}finally{i=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 i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var h,u,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)},y={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,w={f:m&&!y.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:y},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),W=d((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==T(t)?A(t,""):E(t)}:E,P=f.TypeError,_=function(t){if(null==t)throw P("Can't call method on "+t);return t},$=function(t){return W(_(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},H=function(t,e){return arguments.length<2?F(f[t]):f[t]&&f[t][e]},D=O({}.isPrototypeOf),L=H("navigator","userAgent")||"",M=f.process,B=f.Deno,N=M&&M.versions||B&&B.version,X=N&&N.v8;X&&(u=(h=X.split("."))[0]>0&&h[0]<4?1:+(h[0]+h[1])),!u&&L&&(!(h=L.match(/Edge\/(\d+)/))||h[1]>=74)&&(h=L.match(/Chrome\/(\d+)/))&&(u=+h[1]);var G=u,U=!!Object.getOwnPropertySymbols&&!d((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&G&&G<41})),q=U&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=f.Object,K=q?function(t){return"symbol"==typeof t}:function(t){var e=H("Symbol");return j(e)&&D(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(i){f[t]=e}return e},it="__core-js_shared__",nt=f[it]||et(it,{}),rt=c((function(t){(t.exports=function(t,e){return nt[t]||(nt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",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)},ht=0,ut=Math.random(),lt=O(1..toString),ft=function(t){return"Symbol("+(void 0===t?"":t)+")_"+lt(++ht+ut,36)},dt=rt("wks"),pt=f.Symbol,gt=pt&&pt.for,vt=q?pt:pt&&pt.withoutSetter||ft,yt=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?gt(e):vt(e)}return dt[t]},mt=f.TypeError,wt=yt("toPrimitive"),bt=function(t,e){if(!R(t)||K(t))return t;var i,n,r=null==(i=t[wt])?void 0:Q(i);if(r){if(void 0===e&&(e="default"),n=v(r,t,e),!R(n)||K(n))return n;throw mt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&j(i=t.toString)&&!R(n=v(i,t)))return n;if(j(i=t.valueOf)&&!R(n=v(i,t)))return n;if("string"!==e&&j(i=t.toString)&&!R(n=v(i,t)))return n;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")},Wt=f.TypeError,Pt=Object.defineProperty,_t={f:p?Pt:function(t,e,i){if(At(t),e=St(e),At(i),Ot)try{return Pt(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Wt("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},$t=p?function(t,e,i){return _t.f(t,e,b(1,i))}:function(t,e,i){return t[e]=i,t},jt=O(Function.toString);j(nt.inspectSource)||(nt.inspectSource=function(t){return jt(t)});var Rt,Ft,Ht,Dt=nt.inspectSource,Lt=f.WeakMap,Mt=j(Lt)&&/native code/.test(Dt(Lt)),Bt=rt("keys"),Nt=function(t){return Bt[t]||(Bt[t]=ft(t))},Xt={},Gt="Object already initialized",Ut=f.TypeError,qt=f.WeakMap;if(Mt||nt.state){var Yt=nt.state||(nt.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(Gt);return e.facade=t,Jt(Yt,t,e),e},Ft=function(t){return Kt(Yt,t)||{}},Ht=function(t){return Vt(Yt,t)}}else{var Qt=Nt("state");Xt[Qt]=!0,Rt=function(t,e){if(ct(t,Qt))throw new Ut(Gt);return e.facade=t,$t(t,Qt,e),e},Ft=function(t){return ct(t,Qt)?t[Qt]:{}},Ht=function(t){return ct(t,Qt)}}var Zt,te={set:Rt,get:Ft,has:Ht,enforce:function(t){return Ht(t)?Ft(t):Rt(t,{})},getterFor:function(t){return function(e){var i;if(!R(e)||(i=Ft(e)).type!==t)throw Ut("Incompatible receiver, "+t+" required");return i}}},ee=Function.prototype,ie=p&&Object.getOwnPropertyDescriptor,ne=ct(ee,"name"),re={EXISTS:ne,PROPER:ne&&"something"===function(){}.name,CONFIGURABLE:ne&&(!p||p&&ie(ee,"name").configurable)},oe=c((function(t){var e=re.CONFIGURABLE,i=te.get,n=te.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,l=a&&void 0!==a.name?a.name:i;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=n(o)).source||(s.source=r.join("string"==typeof l?l:""))),t!==f?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:$t(t,i,o)):h?t[i]=o:et(i,o)})(Function.prototype,"toString",(function(){return j(this)&&i(this).source||Dt(this)}))})),ae=Math.ceil,se=Math.floor,ce=function(t){var e=+t;return e!=e||0===e?0:(e>0?se:ae)(e)},he=Math.max,ue=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,i,n){var r,o=$(e),a=fe(o),s=function(t,e){var i=ce(t);return i<0?he(i+e,0):ue(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},pe={includes:de(!0),indexOf:de(!1)},ge=pe.indexOf,ve=O([].push),ye=function(t,e){var i,n=$(t),r=0,o=[];for(i in n)!ct(Xt,i)&&ct(n,i)&&ve(o,i);for(;e.length>r;)ct(n,i=e[r++])&&(~ge(o,i)||ve(o,i));return o},me=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],we=me.concat("length","prototype"),be={f:Object.getOwnPropertyNames||function(t){return ye(t,we)}},Se={f:Object.getOwnPropertySymbols},Ce=O([].concat),xe=H("Reflect","ownKeys")||function(t){var e=be.f(At(t)),i=Se.f;return i?Ce(e,i(t)):e},ze=function(t,e){for(var i=xe(e),n=_t.f,r=It.f,o=0;o<i.length;o++){var a=i[o];ct(t,a)||n(t,a,r(e,a))}},Oe=/#|\.prototype\./,ke=function(t,e){var i=Te[Ie(t)];return i==Ae||i!=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",We=ke,Pe=It.f,_e=function(t,e){var i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?f:h?f[s]||et(s,{}):(f[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Pe(i,n))&&a.value:i[n],!We(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;ze(o,r)}(t.sham||r&&r.sham)&&$t(o,"sham",!0),oe(i,n,o,t)}},$e=Object.keys||function(t){return ye(t,me)},je=p?Object.defineProperties:function(t,e){At(t);for(var i,n=$(e),r=$e(e),o=r.length,a=0;o>a;)_t.f(t,i=r[a++],n[i]);return t},Re=H("document","documentElement"),Fe=Nt("IE_PROTO"),He=function(){},De=function(t){return"<script>"+t+"</"+"script>"},Le=function(t){t.write(De("")),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(De("document.F=Object")),t.close(),t.F):Le(Zt);for(var i=me.length;i--;)delete Me.prototype[me[i]];return Me()};Xt[Fe]=!0;var Be=Object.create||function(t,e){var i;return null!==t?(He.prototype=At(t),i=new He,He.prototype=null,i[Fe]=t):i=Me(),void 0===e?i:je(i,e)},Ne=yt("unscopables"),Xe=Array.prototype;null==Xe[Ne]&&_t.f(Xe,Ne,{configurable:!0,value:Be(null)});var Ge=function(t){Xe[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)}}),Ge("includes"),_e({target:"Object",stat:!0,forced:!p,sham:!p},{defineProperty:_t.f});var qe=yt("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[yt("toStringTag")]="z";var Je="[object z]"===String(Ve),Qe=yt("toStringTag"),Ze=f.Object,ti="Arguments"==T(function(){return arguments}()),ei=Je?T:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ze(t),Qe))?i:ti?T(e):"Object"==(n=T(e))&&j(e.callee)?"Arguments":n},ii=f.String,ni=function(t){if("Symbol"===ei(t))throw TypeError("Cannot convert a Symbol value to a string");return ii(t)},ri=yt("match"),oi=O("".indexOf);_e({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ri]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~oi(ni(_(this)),ni(Ke(t)),arguments.length>1?arguments[1]:void 0)}});var ai,si,ci=pe.indexOf,hi=O([].indexOf),ui=!!hi&&1/hi([1],1,-0)<0,li=!!(si=[]["indexOf"])&&d((function(){si.call(null,ai||function(){throw 1},1)}));_e({target:"Array",proto:!0,forced:ui||!li},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return ui?hi(this,t,e)||0:ci(this,t,e)}});var fi=O(O.bind),di=Array.isArray||function(t){return"Array"==T(t)},pi=function(){},gi=[],vi=H("Reflect","construct"),yi=/^\s*(?:class|function)\b/,mi=O(yi.exec),wi=!yi.exec(pi),bi=function(t){if(!j(t))return!1;try{return vi(pi,gi,t),!0}catch(t){return!1}},Si=!vi||d((function(){var t;return bi(bi.call)||!bi(Object)||!bi((function(){t=!0}))||t}))?function(t){if(!j(t))return!1;switch(ei(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return wi||!!mi(yi,Dt(t))}:bi,Ci=yt("species"),xi=f.Array,zi=function(t,e){return new(function(t){var e;return di(t)&&(e=t.constructor,(Si(e)&&(e===xi||di(e.prototype))||R(e)&&null===(e=e[Ci]))&&(e=void 0)),void 0===e?xi:e}(t))(0===e?0:e)},Oi=O([].push),ki=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=at(c),g=W(p),v=function(t,e){return Q(t),void 0===e?t:fi?fi(t,e):function(){return t.apply(e,arguments)}}(h,u),y=fe(g),m=0,w=l||zi,b=e?w(c,y):i||a?w(c,0):void 0;y>m;m++)if((s||m in g)&&(d=v(f=g[m],m,p),t))if(e)b[m]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:Oi(b,f)}else switch(t){case 4:return!1;case 7:Oi(b,f)}return o?-1:n||r?r:b}},Ii={forEach:ki(0),map:ki(1),filter:ki(2),some:ki(3),every:ki(4),find:ki(5),findIndex:ki(6),filterReject:ki(7)}.find,Ti="find",Ei=!0;Ti in[]&&Array(1).find((function(){Ei=!1})),_e({target:"Array",proto:!0,forced:Ei},{find:function(t){return Ii(this,t,arguments.length>1?arguments[1]:void 0)}}),Ge(Ti),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 i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[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),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var Ai=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Wi=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!Ai(r,"object","array"))return r;t=r}return t},Pi=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},_i=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},$i=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===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},ji=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&Ai(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},Ri=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Fi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=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,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Hi=function(t){return Math.PI/180*t},Di=function(t,e,i,n,r,o){t.beginPath();var a,s,c=Hi(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Li=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Mi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return Li(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Bi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Ni="1.7.9",Xi=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}(),Gi="__proto__"in{};function Ui(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var qi=Array.prototype,Yi=Object.create(qi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Yi[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=qi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Ki=function(){function t(t){this.dep=new Xi,Ui(t,"__luckyOb__",this),Array.isArray(t)&&(Gi?t.__proto__=Yi:Object.getOwnPropertyNames(Yi).forEach((function(e){Ui(t,e,Yi[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ji(t,e,t[e])}))},t}();function Vi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Ki(t)}function Ji(t,e,i){var n=new Xi,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Vi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Xi.target&&(n.addSub(Xi.target),s&&s.dep.addSub(Xi.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Vi(e),n.notify()))}})}}var Qi=0,Zi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=Qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Xi.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){Ai(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Xi.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}(),tn=function(){function t(t,e){var i=this;this.version=Ni,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","lucky-canvas@1.7.9"),t.canvasElement.addEventListener("click",(function(t){return i.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 i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.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.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,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,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,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},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,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.config,s=o.flag,c=o.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,a([i],n))},t.prototype.getLength=function(t){return Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Pi(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Mi.apply(void 0,a([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Bi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ji(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Zi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),en=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},nn=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},rn=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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 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)}))},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 i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={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(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,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.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,i,n){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[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),h[i][e][n]=t,o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},e.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._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,n){return $i(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=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Hi(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Hi(this.prizeDeg);var c=Hi(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;$i(l)&&(o.fillStyle=l,Di(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+Hi(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.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=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Fi(o,_i(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate(Hi(360)-n-Hi(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),$i(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&$i(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=nn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=f}},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){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=Ri(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 i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=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<h){this.FPS=f/t;var g=en(f,0,l,h);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=nn(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(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.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,e):0},e.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,e):0},e.prototype.getOffsetX=function(t){return-t/2},e.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},e}(tn),on=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=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)}))},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 i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};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=this,i=this.ctx;a(a([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},e.prototype.loadAndCacheImg=function(t,e,i,n){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[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]);var u=[r.loadImg(c.src,c),c.activeSrc&&r.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(r,a),s&&(s=u.call(r,s))),h[i][e][n]={defaultImg:a,activeImg:s},o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},e.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._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){var n=t.x,r=t.y,a=t.w,s=t.h,h=ji(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return $i(g)&&(o.fillStyle=i.handleBackground(n,r,a,s,g),Li(o,n,r,a,s,p),o.fill()),{x:n+f,y:r+u,w:a-f-d,h:s-u-l}}),{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 n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),a=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if($i(d)){var p=(f?h.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?u-=p[0]:(u+=p[0],a-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),o.fillStyle=i.handleBackground(a,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Li(o,a,s,u,l,g),o.fill(),o.shadowColor="rgba(0, 0, 0, 0)",o.shadowOffsetX=0,o.shadowOffsetY=0,o.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[a+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],y=g[0],m=g[1];i.drawImage(o,u,y,m,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;o.font=r+" "+(u>>0)+"px "+n,o.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],y=String(e.text);if(d){var m=i.getWidth(p,t.col);v=Fi(o,_i(y),(function(){return m}),g)}else v=y.split("\n");v.forEach((function(n,r){o.fillText(n,a+i.getOffsetX(o.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,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 h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=nn(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},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){if(0!==this.step&&3!==this.step){if(!t&&0!==t){var e=this.prizes.map((function(t){return t.range}));t=Ri(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 i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.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<u){this.FPS=d/t;var v=en(d,.1,f-.1,u);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=nn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(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],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},e.prototype.getWidth=function(t,e){return void 0===e&&(e=1),Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},e.prototype.getHeight=function(t,e){return void 0===e&&(e=1),Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},e.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},e.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},e}(tn),an=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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=-1,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=-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,"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=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)}))},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 i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};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.drawOffscreenCanvas(),t.draw(),e()}))}))}))},e.prototype.loadAndCacheImg=function(t,e,i,n){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[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),h[i][e][n]=t,o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},e.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=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,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,y=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),m=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if($i(S)){var C=t.getLength(Pi(r,"borderRadius")?r.borderRadius:i.borderRadius);Li(y,m,w,c,c,C),y.fillStyle=S,y.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Wi(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[m+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(y,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;y.font=r+" "+(o>>0)+"px "+n,y.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Fi(y,_i(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){y.fillText(i,m+t.getOffsetX(y.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),g=d[0],m=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,m]),x=C[0],z=C[1];t.drawImage(y,v,g,m,w,b,x,z,w,b),S+=s}}}))},e.prototype.drawBlocks=function(){var t=this,e=this;e.config;var i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=ji(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return $i(v)&&(Li(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Wi(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},e.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.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,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),y=v[0],m=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,y,m,w,b,C,x,z,O)}))}},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,i=e._defaultConfig,n=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||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=nn(t.FPS,l,d,i.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){0!==this.step&&3!==this.step&&(this.prizeFlag=t,this.step=t<0?0:2)},e.prototype.run=function(t){var e,i=this;void 0===t&&(t=0);var n=this,r=n.rAF,o=n.step,a=n.prizeFlag,s=n._defaultConfig,c=n.cellAndSpacing,h=s.accelerationTime,u=s.decelerationTime;if(0===this.step&&void 0!==a&&a>=0)null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{});else if(-1!==a){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var l=Date.now()-this.startTime,f=Date.now()-this.endTime;this.slots.forEach((function(e,n){var r=e.order;if(r&&r.length){var d=c*r.length,p=Math.abs(e.speed||s.speed),g=e.direction||s.direction,v=0,y=i.scroll[n];if(1===o||l<h){i.FPS=l/t;var m=en(l,0,p,h);m===p&&(i.step=2),v=(y+m*g)%d}else if(2===o)v=(y+p*g)%d,void 0!==a&&a>=0&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===o&&f){var w=i.stopScroll[n],b=i.endScroll[n];v=nn(f,w,b,u),f>=u&&(i.step=0)}i.scroll[n]=v}})),this.draw(),r(this.run.bind(this,t+1))}},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,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},e.prototype.getWidth=function(t,e){return Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,e):0},e.prototype.getHeight=function(t,e){return Ai(t,"number")?t:Ai(t,"string")?this.changeUnits(t,e):0},e.prototype.getOffsetX=function(t,e){return(e-t)/2},e}(tn);t.LuckyGrid=on,t.LuckyWheel=rn,t.SlotMachine=an,Object.defineProperty(t,"__esModule",{value:!0})}));
***************************************************************************** */var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},e(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};function r(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var i,n,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(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=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++,n=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],n=0}finally{i=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 i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}var h,u,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)},y={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,w={f:m&&!y.call({1:2},1)?function(t){var e=m(this,t);return!!e&&e.enumerable}:y},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,W=O("".split),A=d((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==T(t)?W(t,""):E(t)}:E,P=f.TypeError,_=function(t){if(null==t)throw P("Can't call method on "+t);return t},$=function(t){return A(_(t))},R=function(t){return"function"==typeof t},j=function(t){return"object"==typeof t?null!==t:R(t)},F=function(t){return R(t)?t:void 0},H=function(t,e){return arguments.length<2?F(f[t]):f[t]&&f[t][e]},D=O({}.isPrototypeOf),L=H("navigator","userAgent")||"",M=f.process,B=f.Deno,N=M&&M.versions||B&&B.version,X=N&&N.v8;X&&(u=(h=X.split("."))[0]>0&&h[0]<4?1:+(h[0]+h[1])),!u&&L&&(!(h=L.match(/Edge\/(\d+)/))||h[1]>=74)&&(h=L.match(/Chrome\/(\d+)/))&&(u=+h[1]);var G=u,U=!!Object.getOwnPropertySymbols&&!d((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&G&&G<41})),q=U&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=f.Object,K=q?function(t){return"symbol"==typeof t}:function(t){var e=H("Symbol");return R(e)&&D(e.prototype,Y(t))},V=f.String,J=f.TypeError,Q=function(t){if(R(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(i){f[t]=e}return e},it="__core-js_shared__",nt=f[it]||et(it,{}),rt=c((function(t){(t.exports=function(t,e){return nt[t]||(nt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.2",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)},ht=0,ut=Math.random(),lt=O(1..toString),ft=function(t){return"Symbol("+(void 0===t?"":t)+")_"+lt(++ht+ut,36)},dt=rt("wks"),pt=f.Symbol,gt=pt&&pt.for,vt=q?pt:pt&&pt.withoutSetter||ft,yt=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?gt(e):vt(e)}return dt[t]},mt=f.TypeError,wt=yt("toPrimitive"),bt=function(t,e){if(!j(t)||K(t))return t;var i,n,r=null==(i=t[wt])?void 0:Q(i);if(r){if(void 0===e&&(e="default"),n=v(r,t,e),!j(n)||K(n))return n;throw mt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var i,n;if("string"===e&&R(i=t.toString)&&!j(n=v(i,t)))return n;if(R(i=t.valueOf)&&!j(n=v(i,t)))return n;if("string"!==e&&R(i=t.toString)&&!j(n=v(i,t)))return n;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=j(Ct)&&j(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,Wt=function(t){if(j(t))return t;throw Et(Tt(t)+" is not an object")},At=f.TypeError,Pt=Object.defineProperty,_t={f:p?Pt:function(t,e,i){if(Wt(t),e=St(e),Wt(i),Ot)try{return Pt(t,e,i)}catch(t){}if("get"in i||"set"in i)throw At("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},$t=p?function(t,e,i){return _t.f(t,e,b(1,i))}:function(t,e,i){return t[e]=i,t},Rt=O(Function.toString);R(nt.inspectSource)||(nt.inspectSource=function(t){return Rt(t)});var jt,Ft,Ht,Dt=nt.inspectSource,Lt=f.WeakMap,Mt=R(Lt)&&/native code/.test(Dt(Lt)),Bt=rt("keys"),Nt=function(t){return Bt[t]||(Bt[t]=ft(t))},Xt={},Gt="Object already initialized",Ut=f.TypeError,qt=f.WeakMap;if(Mt||nt.state){var Yt=nt.state||(nt.state=new qt),Kt=O(Yt.get),Vt=O(Yt.has),Jt=O(Yt.set);jt=function(t,e){if(Vt(Yt,t))throw new Ut(Gt);return e.facade=t,Jt(Yt,t,e),e},Ft=function(t){return Kt(Yt,t)||{}},Ht=function(t){return Vt(Yt,t)}}else{var Qt=Nt("state");Xt[Qt]=!0,jt=function(t,e){if(ct(t,Qt))throw new Ut(Gt);return e.facade=t,$t(t,Qt,e),e},Ft=function(t){return ct(t,Qt)?t[Qt]:{}},Ht=function(t){return ct(t,Qt)}}var Zt,te={set:jt,get:Ft,has:Ht,enforce:function(t){return Ht(t)?Ft(t):jt(t,{})},getterFor:function(t){return function(e){var i;if(!j(e)||(i=Ft(e)).type!==t)throw Ut("Incompatible receiver, "+t+" required");return i}}},ee=Function.prototype,ie=p&&Object.getOwnPropertyDescriptor,ne=ct(ee,"name"),re={EXISTS:ne,PROPER:ne&&"something"===function(){}.name,CONFIGURABLE:ne&&(!p||p&&ie(ee,"name").configurable)},oe=c((function(t){var e=re.CONFIGURABLE,i=te.get,n=te.enforce,r=String(String).split("String");(t.exports=function(t,i,o,a){var s,c=!!a&&!!a.unsafe,h=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet,l=a&&void 0!==a.name?a.name:i;R(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=n(o)).source||(s.source=r.join("string"==typeof l?l:""))),t!==f?(c?!u&&t[i]&&(h=!0):delete t[i],h?t[i]=o:$t(t,i,o)):h?t[i]=o:et(i,o)})(Function.prototype,"toString",(function(){return R(this)&&i(this).source||Dt(this)}))})),ae=Math.ceil,se=Math.floor,ce=function(t){var e=+t;return e!=e||0===e?0:(e>0?se:ae)(e)},he=Math.max,ue=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,i,n){var r,o=$(e),a=fe(o),s=function(t,e){var i=ce(t);return i<0?he(i+e,0):ue(i,e)}(n,a);if(t&&i!=i){for(;a>s;)if((r=o[s++])!=r)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===i)return t||s||0;return!t&&-1}},pe={includes:de(!0),indexOf:de(!1)},ge=pe.indexOf,ve=O([].push),ye=function(t,e){var i,n=$(t),r=0,o=[];for(i in n)!ct(Xt,i)&&ct(n,i)&&ve(o,i);for(;e.length>r;)ct(n,i=e[r++])&&(~ge(o,i)||ve(o,i));return o},me=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],we=me.concat("length","prototype"),be={f:Object.getOwnPropertyNames||function(t){return ye(t,we)}},Se={f:Object.getOwnPropertySymbols},Ce=O([].concat),xe=H("Reflect","ownKeys")||function(t){var e=be.f(Wt(t)),i=Se.f;return i?Ce(e,i(t)):e},ze=function(t,e){for(var i=xe(e),n=_t.f,r=It.f,o=0;o<i.length;o++){var a=i[o];ct(t,a)||n(t,a,r(e,a))}},Oe=/#|\.prototype\./,ke=function(t,e){var i=Te[Ie(t)];return i==We||i!=Ee&&(R(e)?d(e):!!e)},Ie=ke.normalize=function(t){return String(t).replace(Oe,".").toLowerCase()},Te=ke.data={},Ee=ke.NATIVE="N",We=ke.POLYFILL="P",Ae=ke,Pe=It.f,_e=function(t,e){var i,n,r,o,a,s=t.target,c=t.global,h=t.stat;if(i=c?f:h?f[s]||et(s,{}):(f[s]||{}).prototype)for(n in e){if(o=e[n],r=t.noTargetGet?(a=Pe(i,n))&&a.value:i[n],!Ae(c?n:s+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;ze(o,r)}(t.sham||r&&r.sham)&&$t(o,"sham",!0),oe(i,n,o,t)}},$e=Object.keys||function(t){return ye(t,me)},Re=p?Object.defineProperties:function(t,e){Wt(t);for(var i,n=$(e),r=$e(e),o=r.length,a=0;o>a;)_t.f(t,i=r[a++],n[i]);return t},je=H("document","documentElement"),Fe=Nt("IE_PROTO"),He=function(){},De=function(t){return"<script>"+t+"</"+"script>"},Le=function(t){t.write(De("")),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",je.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(De("document.F=Object")),t.close(),t.F):Le(Zt);for(var i=me.length;i--;)delete Me.prototype[me[i]];return Me()};Xt[Fe]=!0;var Be=Object.create||function(t,e){var i;return null!==t?(He.prototype=Wt(t),i=new He,He.prototype=null,i[Fe]=t):i=Me(),void 0===e?i:Re(i,e)},Ne=yt("unscopables"),Xe=Array.prototype;null==Xe[Ne]&&_t.f(Xe,Ne,{configurable:!0,value:Be(null)});var Ge=function(t){Xe[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)}}),Ge("includes"),_e({target:"Object",stat:!0,forced:!p,sham:!p},{defineProperty:_t.f});var qe=yt("match"),Ye=f.TypeError,Ke=function(t){if(function(t){var e;return j(t)&&(void 0!==(e=t[qe])?!!e:"RegExp"==T(t))}(t))throw Ye("The method doesn't accept regular expressions");return t},Ve={};Ve[yt("toStringTag")]="z";var Je="[object z]"===String(Ve),Qe=yt("toStringTag"),Ze=f.Object,ti="Arguments"==T(function(){return arguments}()),ei=Je?T:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ze(t),Qe))?i:ti?T(e):"Object"==(n=T(e))&&R(e.callee)?"Arguments":n},ii=f.String,ni=function(t){if("Symbol"===ei(t))throw TypeError("Cannot convert a Symbol value to a string");return ii(t)},ri=yt("match"),oi=O("".indexOf);_e({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[ri]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~oi(ni(_(this)),ni(Ke(t)),arguments.length>1?arguments[1]:void 0)}});var ai,si,ci=pe.indexOf,hi=O([].indexOf),ui=!!hi&&1/hi([1],1,-0)<0,li=!!(si=[]["indexOf"])&&d((function(){si.call(null,ai||function(){throw 1},1)}));_e({target:"Array",proto:!0,forced:ui||!li},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return ui?hi(this,t,e)||0:ci(this,t,e)}});var fi=O(O.bind),di=Array.isArray||function(t){return"Array"==T(t)},pi=function(){},gi=[],vi=H("Reflect","construct"),yi=/^\s*(?:class|function)\b/,mi=O(yi.exec),wi=!yi.exec(pi),bi=function(t){if(!R(t))return!1;try{return vi(pi,gi,t),!0}catch(t){return!1}},Si=!vi||d((function(){var t;return bi(bi.call)||!bi(Object)||!bi((function(){t=!0}))||t}))?function(t){if(!R(t))return!1;switch(ei(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return wi||!!mi(yi,Dt(t))}:bi,Ci=yt("species"),xi=f.Array,zi=function(t,e){return new(function(t){var e;return di(t)&&(e=t.constructor,(Si(e)&&(e===xi||di(e.prototype))||j(e)&&null===(e=e[Ci]))&&(e=void 0)),void 0===e?xi:e}(t))(0===e?0:e)},Oi=O([].push),ki=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,a=7==t,s=5==t||o;return function(c,h,u,l){for(var f,d,p=at(c),g=A(p),v=function(t,e){return Q(t),void 0===e?t:fi?fi(t,e):function(){return t.apply(e,arguments)}}(h,u),y=fe(g),m=0,w=l||zi,b=e?w(c,y):i||a?w(c,0):void 0;y>m;m++)if((s||m in g)&&(d=v(f=g[m],m,p),t))if(e)b[m]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:Oi(b,f)}else switch(t){case 4:return!1;case 7:Oi(b,f)}return o?-1:n||r?r:b}},Ii={forEach:ki(0),map:ki(1),filter:ki(2),some:ki(3),every:ki(4),find:ki(5),findIndex:ki(6),filterReject:ki(7)}.find,Ti="find",Ei=!0;Ti in[]&&Array(1).find((function(){Ei=!1})),_e({target:"Array",proto:!0,forced:Ei},{find:function(t){return Ii(this,t,arguments.length>1?arguments[1]:void 0)}}),Ge(Ti),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 i=Object(this),n=i.length>>>0;if(0===n)return!1;var r,o,a=0|e,s=Math.max(a>=0?a:n-Math.abs(a),0);for(;s<n;){if((r=i[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),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r<i;){var o=e[r];if(t.call(n,o,r,e))return o;r++}}});var Wi=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.some((function(e){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()===e}))},Ai=function(t,e){for(var i=0,n=e.split(".");i<n.length;i++){var r=t[n[i]];if(!Wi(r,"object","array"))return r;t=r}return t},Pi=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},_i=function(t){return[].filter.call(t,(function(t){return"\n"!==t})).join("")},$i=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===(i=e)?0:"object"==typeof i?NaN:"number"==typeof i?i:"string"==typeof i?"%"===i[i.length-1]?Number(i.slice(0,-1))/100:Number(i):NaN))return!1}var i;return!0},Ri=function(t){var e,i=(null===(e=t.padding)||void 0===e?void 0:e.replace(/px/g,"").split(" ").map((function(t){return~~t})))||[0],n=0,r=0,o=0,a=0;switch(i.length){case 1:n=r=o=a=i[0];break;case 2:n=r=i[0],o=a=i[1];break;case 3:n=i[0],o=a=i[1],r=i[2];break;default:n=i[0],r=i[1],o=i[2],a=i[3]}var s={paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:a};for(var c in s)s[c]=Object.prototype.hasOwnProperty.call(t,c)&&Wi(t[c],"string","number")?~~String(t[c]).replace(/px/g,""):s[c];return[n,r,o,a]},ji=function(t){var e=[],i=t.map((function(t){return Number(t)})).reduce((function(t,i){if(i>0){var n=t+i;return e.push(n),n}return e.push(NaN),t}),0),n=Math.random()*i;return e.findIndex((function(t){return n<=t}))},Fi=function(t,e,i,n){void 0===n&&(n=1/0),n<=0&&(n=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,h=i(o);if(n===o.length+1&&(c+=a),h<0)return o;if(c>h&&(o.push(r.slice(0,-1)),r=e[s]),n===o.length)return o[o.length-1]+="...",o}return r&&o.push(r),o.length||o.push(e),o},Hi=function(t){return Math.PI/180*t},Di=function(t,e,i,n,r,o){t.beginPath();var a,s,c=Hi(90/Math.PI/i*o),h=n+c,u=r-c;t.arc(0,0,i,h,u,!1),t.lineTo.apply(t,(a=(n+r)/2,s=o/2/Math.abs(Math.sin((n-r)/2)),[+(Math.cos(a)*s).toFixed(8),+(Math.sin(a)*s).toFixed(8)])),t.closePath()},Li=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=Math.min(o,a),h=Math.PI;s>c/2&&(s=c/2),t.beginPath(),t.moveTo(n+s,r),t.lineTo(n+s,r),t.lineTo(n+o-s,r),t.arc(n+o-s,r+s,s,-h/2,0),t.lineTo(n+o,r+a-s),t.arc(n+o-s,r+a-s,s,0,h/2),t.lineTo(n+s,r+a),t.arc(n+s,r+a-s,s,h/2,h),t.lineTo(n,r+s),t.arc(n+s,r+s,s,h,-h/2),t.closePath()},Mi=function(t,e,i,n,r,o){var a=document.createElement("canvas"),s=a.getContext("2d"),c=t.width,h=t.height;a.width=c,a.height=h;var u=c/n;return Li(s,e*u,i*u,n*u,r*u,o*u),s.clip(),s.drawImage(t,0,0,c,h),a},Bi=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;i.width=r,i.height=o,n.drawImage(t,0,0,r,o);var a=n.getImageData(0,0,r,o),s=a.data,c=function(t,e){e=e||t/3;for(var i=Math.ceil(t),n=e*e,r=2*n,o=1/(2*Math.PI*n),a=[],s=0,c=-i;c<=i;c++)for(var h=-i;h<=i;h++){var u=o*Math.exp(-(c*c+h*h)/r);a.push(u),s+=u}for(var l=0;l<a.length;l++)a[l]/=s;return a}(e);return s.length,c.length,console.log(a),n.putImageData(a,0,0),i},Ni="1.7.10",Xi=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}(),Gi="__proto__"in{};function Ui(t,e,i,n){Object.defineProperty(t,e,{value:i,enumerable:!!n,writable:!0,configurable:!0})}var qi=Array.prototype,Yi=Object.create(qi);["push","pop","shift","unshift","sort","splice","reverse"].forEach((function(t){Yi[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=qi[t].apply(this,e),r=this.__luckyOb__;return["push","unshift","splice"].includes(t)&&r.walk(this),r.dep.notify(),n}}));var Ki=function(){function t(t){this.dep=new Xi,Ui(t,"__luckyOb__",this),Array.isArray(t)&&(Gi?t.__proto__=Yi:Object.getOwnPropertyNames(Yi).forEach((function(e){Ui(t,e,Yi[e])}))),this.walk(t)}return t.prototype.walk=function(t){Object.keys(t).forEach((function(e){Ji(t,e,t[e])}))},t}();function Vi(t){if(t&&"object"==typeof t)return"__luckyOb__"in t?t.__luckyOb__:new Ki(t)}function Ji(t,e,i){var n=new Xi,r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=r&&r.get,a=r&&r.set;o&&!a||2!==arguments.length||(i=t[e]);var s=Vi(i);Object.defineProperty(t,e,{get:function(){var e=o?o.call(t):i;return Xi.target&&(n.addSub(Xi.target),s&&s.dep.addSub(Xi.target)),e},set:function(e){e!==i&&(i=e,o&&!a||(a?a.call(t,e):i=e,s=Vi(e),n.notify()))}})}}var Qi=0,Zi=function(){function t(t,e,i,n){void 0===n&&(n={}),this.id=Qi++,this.$lucky=t,this.expr=e,this.deep=!!n.deep,this.getter="function"==typeof e?e:function(t){t+=".";for(var e=[],i="",n=0;n<t.length;n++){var r=t[n];if(/\[|\./.test(r))e.push(i),i="";else{if(/\W/.test(r))continue;i+=r}}return function(t){return e.reduce((function(t,e){return t[e]}),t)}}(e),this.cb=i,this.value=this.get()}return t.prototype.get=function(){Xi.target=this;var t=this.getter.call(this.$lucky,this.$lucky);return this.deep&&function(t){var e=function(t){Wi(t,"array","object")&&Object.keys(t).forEach((function(i){var n=t[i];e(n)}))};e(t)}(t),Xi.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}(),tn=function(){function t(t,e){var i=this;this.version=Ni,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","lucky-canvas@1.7.10"),t.canvasElement.addEventListener("click",(function(t){return i.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 i=null;return function(){for(var n=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i||(i=setTimeout((function(){t.apply(n,r),clearTimeout(i),i=null}),e))}}((function(){return i.resize()}),300)),window&&"function"==typeof window.MutationObserver&&new window.MutationObserver((function(){i.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],i=t[1];this.ctx.clearRect(-e,-i,2*e,2*i)},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,i=0,n=0;t.divElement&&(i=t.divElement.offsetWidth,n=t.divElement.offsetHeight),this.boxWidth=this.getLength(e.width||t.width)||i,this.boxHeight=this.getLength(e.height||t.height)||n,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,i=t.canvasElement,n=t.dpr,r=[this.boxWidth*n,this.boxHeight*n],o=r[0],a=r[1];i&&(i.width=o,i.height=a,i.style.width=o+"px",i.style.height=a+"px",i.style["transform-origin"]="left top",i.style.transform="scale("+1/n+")",e.scale(n,n))},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,i){var n=this;return void 0===i&&(i="$resolve"),new Promise((function(r,o){if(t||o("=> '"+e.src+"' 不能为空或不合法"),"WEB"!==n.config.flag)return e[i]=r,void(e.$reject=o);var a=new Image;a.onload=function(){return r(a)},a.onerror=function(){return o("=> '"+e.src+"' 图片加载失败")},a.src=t}))},t.prototype.drawImage=function(t,e){for(var i,n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.config,s=o.flag,c=o.dpr;if(["WEB","MP-WX"].includes(s))i=e;else{if(!["UNI-H5","UNI-MP","TARO-H5","TARO-MP"].includes(s))return console.error("意料之外的 flag, 该平台尚未兼容!");i=e.path}return 8===n.length&&(n=n.map((function(t,e){return e<4?t*c:t}))),t.drawImage.apply(t,a([i],n))},t.prototype.getLength=function(t){return Wi(t,"number")?t:Wi(t,"string")?this.changeUnits(t):0},t.prototype.changeUnits=function(t,e){var i=this;return void 0===e&&(e=1),Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/,(function(t,n,r){var o={"%":function(t){return t*(e/100)},px:function(t){return 1*t},rem:function(t){return t*i.htmlFontSize},vw:function(t){return t/100*window.innerWidth}}[r];if(o)return o(n);var a=i.config.unitFunc;return a?a(n,r):n})))},t.prototype.getOffscreenCanvas=function(t,e){if(!Pi(this,"_offscreenCanvas")){if(!window||!window.document)return console.error("无法创建离屏Canvas!");this._offscreenCanvas=document.createElement("canvas")}var i=this.config.dpr,n=this._offscreenCanvas;n.width=(t||300)*i,n.height=(e||150)*i;var r=n.getContext("2d");return r.clearRect(0,0,t,e),r.scale(i,i),r.dpr=i,{_offscreenCanvas:n,_ctx:r}},t.prototype.$clip=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var r=i.map((function(t){return e.getLength(t)}));return Mi.apply(void 0,a([t],r))},t.prototype.$opacity=function(t,e){return function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),r=t.width,o=t.height;if(i.width=r,i.height=o,"string"==typeof n.filter)n.filter="opacity("+e+"%)",n.drawImage(t,0,0,r,o);else{n.drawImage(t,0,0,r,o);for(var a=n.getImageData(0,0,r,o),s=a.data,c=s.length,h=0;h<c;h+=4){var u=s[h+3];0!==u&&(s[h+3]=u*e/100)}n.putImageData(a,0,0)}return i}(t,this.getLength(e))},t.prototype.$blur=function(t,e){return Bi(t,this.getLength(e))},t.prototype.$set=function(t,e,i){t&&"object"==typeof t&&Ji(t,e,i)},t.prototype.$computed=function(t,e,i){var n=this;Object.defineProperty(t,e,{get:function(){return i.call(n)}})},t.prototype.$watch=function(t,e,i){void 0===i&&(i={}),"object"==typeof e&&(e=(i=e).handler);var n=new Zi(this,t,e,i);return i.immediate&&e.call(this,n.value),function(){}},t}(),en=function(t,e,i,n){return t>=n&&(t=n),i*(t/=n)*t+e},nn=function(t,e,i,n){return t>=n&&(t=n),-i*(t/=n)*(t-2)+e},rn=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.Radius=Math.min(this.boxWidth,this.boxHeight)/2,this.ctx.translate(this.Radius,this.Radius),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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 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)}))},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 i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={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(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,i=this.ctx;i.beginPath(),i.arc(0,0,this.maxBtnRadius,0,2*Math.PI,!1),i.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,i,n){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[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),h[i][e][n]=t,o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},e.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,a=n._defaultConfig,s=n._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,n){return $i(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=i.ImageCache.blocks;if(a&&a[n]){var s=a[n][r];if(s){var c=i.computedWidthAndHeight(s,e,2*t,2*t),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(e.top,2*t)-t],f=l[0],d=l[1];o.save(),e.rotate&&o.rotate(Hi(i.rotateDeg)),i.drawImage(o,s,f,d,h,u),o.restore()}}})),t-i.getLength(e.padding&&e.padding.split(" ")[0])}),this.Radius),this.prizeDeg=360/this.prizes.length,this.prizeRadian=Hi(this.prizeDeg);var c=Hi(this.rotateDeg-90+this.prizeDeg/2+a.offsetDegree),h=function(t){return i.getOffsetX(o.measureText(t).width)},u=function(t,e,n){var r=t.lineHeight||s.lineHeight||t.fontSize||s.fontSize;return i.getHeight(t.top,e)+(n+1)*i.getLength(r)};o.save(),this.prizes.forEach((function(t,e){var n=c+e*i.prizeRadian,r=i.prizeRadius-i.maxBtnRadius,l=t.background||s.background;$i(l)&&(o.fillStyle=l,Di(o,i.maxBtnRadius,i.prizeRadius,n-i.prizeRadian/2,n+i.prizeRadian/2,i.getLength(a.gutter)),o.fill());var f=Math.cos(n)*i.prizeRadius,d=Math.sin(n)*i.prizeRadius;o.translate(f,d),o.rotate(n+Hi(90)),t.imgs&&t.imgs.forEach((function(t,n){var a=i.ImageCache.prizes;if(a&&a[e]){var s=a[e][n];if(s){var c=i.computedWidthAndHeight(s,t,i.prizeRadian*i.prizeRadius,r),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,r)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,n=t.fontWeight||s.fontWeight,c=i.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=n+" "+(c>>0)+"px "+l;var g=String(t.text);(f?Fi(o,_i(g),(function(e){var n=2*((i.prizeRadius-u(t,r,e.length))*Math.tan(i.prizeRadian/2))-i.getLength(a.gutter);return i.getWidth(d,n)}),p):g.split("\n")).filter((function(t){return!!t})).forEach((function(e,i){o.fillText(e,h(e),u(t,r,i))}))})),o.rotate(Hi(360)-n-Hi(90)),o.translate(-f,-d)})),o.restore(),this.buttons.forEach((function(t,e){var n=i.getHeight(t.radius);i.maxBtnRadius=Math.max(i.maxBtnRadius,n),$i(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.arc(0,0,n,0,2*Math.PI,!1),o.fill()),t.pointer&&$i(t.background)&&(o.beginPath(),o.fillStyle=t.background,o.moveTo(-n,0),o.lineTo(n,0),o.lineTo(0,2*-n),o.closePath(),o.fill()),t.imgs&&t.imgs.forEach((function(t,r){var a=i.ImageCache.buttons;if(a&&a[e]){var s=a[e][r];if(s){var c=i.computedWidthAndHeight(s,t,2*n,2*n),h=c[0],u=c[1],l=[i.getOffsetX(h),i.getHeight(t.top,n)],f=l[0],d=l[1];i.drawImage(o,s,f,d,h,u)}}})),t.fonts&&t.fonts.forEach((function(t){var e=t.fontColor||s.fontColor,r=t.fontWeight||s.fontWeight,a=i.getLength(t.fontSize||s.fontSize),c=t.fontStyle||s.fontStyle;o.fillStyle=e,o.font=r+" "+(a>>0)+"px "+c,String(t.text).split("\n").forEach((function(e,i){o.fillText(e,h(e),u(t,n,i))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.prizeDeg,r=t.rotateDeg;this.endTime=Date.now();for(var o=this.stopDeg=r,a=e.speed,s=(Math.random()*n-n/2)*this.getLength(e.stopRange),c=0,h=0,u=0;++c;){var l=360*c-i*n-r-e.offsetDegree+s-n/2,f=nn(this.FPS,o,l,e.decelerationTime)-o;if(f>a){this.endDeg=a-h>f-a?l:u;break}u=l,h=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=ji(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 i=this,n=i.rAF,r=i.step,o=i.prizeFlag,a=i.stopDeg,s=i.endDeg,c=i._defaultConfig,h=c.accelerationTime,u=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<h){this.FPS=f/t;var g=en(f,0,l,h);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=nn(d,a,s,u),d>=u&&(this.step=0)):this.stop(-1);this.rotateDeg=p,this.draw(),n(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.getWidth=function(t,e){return void 0===e&&(e=this.prizeRadian*this.prizeRadius),Wi(t,"number")?t:Wi(t,"string")?this.changeUnits(t,e):0},e.prototype.getHeight=function(t,e){return void 0===e&&(e=this.prizeRadius),Wi(t,"number")?t:Wi(t,"string")?this.changeUnits(t,e):0},e.prototype.getOffsetX=function(t){return-t/2},e.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr-this.Radius,e/i.dpr-this.Radius]},e}(tn),on=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=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)}))},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 i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i=t.buttons.map((function(t){return t.imgs}));t.button&&i.push(t.button.imgs);var n={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs})),buttons:i};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=this,i=this.ctx;a(a([],this.buttons),[this.button]).forEach((function(n){var r;if(n){var o=e.getGeometricProperty([n.x,n.y,n.col||1,n.row||1]),a=o[0],s=o[1],c=o[2],h=o[3];i.beginPath(),i.rect(a,s,c,h),i.isPointInPath(t.offsetX,t.offsetY)&&0===e.step&&("function"==typeof n.callback&&n.callback.call(e,n),null===(r=e.startCallback)||void 0===r||r.call(e,t,n))}}))},e.prototype.loadAndCacheImg=function(t,e,i,n){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[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]);var u=[r.loadImg(c.src,c),c.activeSrc&&r.loadImg(c.activeSrc,c,"$activeResolve")];Promise.all(u).then((function(t){var a=t[0],s=t[1],u=c.formatter;"function"==typeof u&&(a=u.call(r,a),s&&(s=u.call(r,s))),h[i][e][n]={defaultImg:a,activeImg:s},o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var n=this.getWidth(e.width,i.col);return[n,t.height*(n/t.width)]}if(!e.width&&e.height){var r=this.getHeight(e.height,i.row);return[t.width*(r/t.height),r]}return[this.getWidth(e.width,i.col),this.getHeight(e.height,i.row)]},e.prototype.draw=function(){var t,e,i=this,n=this,r=n.config,o=n.ctx,s=n._defaultConfig,c=n._defaultStyle,h=n._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){var n=t.x,r=t.y,a=t.w,s=t.h,h=Ri(e),u=h[0],l=h[1],f=h[2],d=h[3],p=e.borderRadius?i.getLength(e.borderRadius):0,g=e.background||c.background;return $i(g)&&(o.fillStyle=i.handleBackground(n,r,a,s,g),Li(o,n,r,a,s,p),o.fill()),{x:n+f,y:r+u,w:a-f-d,h:s-u-l}}),{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 n=i.getGeometricProperty([t.x,t.y,t.col,t.row]),a=n[0],s=n[1],u=n[2],l=n[3],f=!1;(void 0===i.prizeFlag||i.prizeFlag>-1)&&(f=e===i.currIndex%i.prizes.length>>0);var d=f?h.background:t.background||c.background;if($i(d)){var p=(f?h.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?u-=p[0]:(u+=p[0],a-=p[0]),p[1]>0?l-=p[1]:(l+=p[1],s-=p[1])),o.fillStyle=i.handleBackground(a,s,u,l,d);var g=i.getLength(t.borderRadius?t.borderRadius:c.borderRadius);Li(o,a,s,u,l,g),o.fill(),o.shadowColor="rgba(0, 0, 0, 0)",o.shadowOffsetX=0,o.shadowOffsetY=0,o.shadowBlur=0}var v="prizes";e>=i.prizes.length&&(v="buttons",e-=i.prizes.length),t.imgs&&t.imgs.forEach((function(n,r){var c=i.ImageCache[v];if(c[e]){var h=c[e][r];if(h){var u=f&&h.activeImg||h.defaultImg;if(u){var l=i.computedWidthAndHeight(u,n,t),d=l[0],p=l[1],g=[a+i.getOffsetX(d,t.col),s+i.getHeight(n.top,t.row)],y=g[0],m=g[1];i.drawImage(o,u,y,m,d,p)}}}})),t.fonts&&t.fonts.forEach((function(e){var n=f&&h.fontStyle?h.fontStyle:e.fontStyle||c.fontStyle,r=f&&h.fontWeight?h.fontWeight:e.fontWeight||c.fontWeight,u=f&&h.fontSize?i.getLength(h.fontSize):i.getLength(e.fontSize||c.fontSize),l=f&&h.lineHeight?h.lineHeight:e.lineHeight||c.lineHeight||e.fontSize||c.fontSize,d=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:c.wordWrap,p=e.lengthLimit||c.lengthLimit,g=e.lineClamp||c.lineClamp;o.font=r+" "+(u>>0)+"px "+n,o.fillStyle=f&&h.fontColor?h.fontColor:e.fontColor||c.fontColor;var v=[],y=String(e.text);if(d){var m=i.getWidth(p,t.col);v=Fi(o,_i(y),(function(){return m}),g)}else v=y.split("\n");v.forEach((function(n,r){o.fillText(n,a+i.getOffsetX(o.measureText(n).width,t.col),s+i.getHeight(e.top,t.row)+(r+1)*i.getLength(l))}))}))})),null===(e=r.afterDraw)||void 0===e||e.call(this,o)},e.prototype.handleBackground=function(t,e,i,n,r){var o=this.ctx;return r.includes("linear-gradient")&&(r=function(t,e,i,n,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 h=function(t){return Math.tan(t/180*Math.PI)};(s=s.slice(0,-3)%360)>=0&&s<45?c=[e,i+r,e+n,i+r-n*h(s-0)]:s>=45&&s<90?c=[e,i+r,e+n-r*h(s-45),i]:s>=90&&s<135?c=[e+n,i+r,e+n-r*h(s-90),i]:s>=135&&s<180?c=[e+n,i+r,e,i+n*h(s-135)]:s>=180&&s<225?c=[e+n,i,e,i+n*h(s-180)]:s>=225&&s<270?c=[e+n,i,e+r*h(s-225),i+r]:s>=270&&s<315?c=[e,i,e+r*h(s-270),i+r]:s>=315&&s<360&&(c=[e,i,e+n,i+r-n*h(s-315)])}else s.includes("top")?c=[e,i+r,e,i]:s.includes("bottom")?c=[e,i,e,i+r]:s.includes("left")?c=[e+n,i,e,i]:s.includes("right")&&(c=[e,i,e+n,i]);var u=t.createLinearGradient.apply(t,c.map((function(t){return t>>0})));return a.reduce((function(t,e,i){var n=e.split(" ");return 1===n.length?t.addColorStop(i,n[0]):2===n.length&&t.addColorStop.apply(t,n),t}),u)}(o,t,e,i,n,r)),r},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=t._defaultConfig,i=t.prizeFlag,n=t.currIndex;this.endTime=Date.now();for(var r=this.stopIndex=n,o=e.speed,a=0,s=0,c=0;++a;){var h=this.prizes.length*a+i-r,u=nn(this.FPS,r,h,e.decelerationTime)-r;if(u>o){this.endIndex=o-s>u-o?h:c;break}c=h,s=u}},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=ji(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 i=this,n=i.rAF,r=i.step,o=i.prizes,a=i.prizeFlag,s=i.stopIndex,c=i.endIndex,h=i._defaultConfig,u=h.accelerationTime,l=h.decelerationTime,f=h.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<u){this.FPS=d/t;var v=en(d,.1,f-.1,u);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=nn(p,s,c,l),p>=l&&(this.step=0)):this.stop(-1);this.currIndex=g,this.draw(),n(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],i=t[1],n=t[2],r=void 0===n?1:n,o=t[3],a=void 0===o?1:o,s=this.cellWidth,c=this.cellHeight,h=this._defaultConfig.gutter,u=[this.prizeArea.x+(s+h)*e,this.prizeArea.y+(c+h)*i];return r&&a&&u.push(s*r+h*(r-1),c*a+h*(a-1)),u},e.prototype.getWidth=function(t,e){return void 0===e&&(e=1),Wi(t,"number")?t:Wi(t,"string")?this.changeUnits(t,this.cellWidth*e+this._defaultConfig.gutter*(e-1)):0},e.prototype.getHeight=function(t,e){return void 0===e&&(e=1),Wi(t,"number")?t:Wi(t,"string")?this.changeUnits(t,this.cellHeight*e+this._defaultConfig.gutter*(e-1)):0},e.prototype.getOffsetX=function(t,e){return void 0===e&&(e=1),(this.cellWidth*e+this._defaultConfig.gutter*(e-1)-t)/2},e.prototype.conversionAxis=function(t,e){var i=this.config;return[t/i.dpr,e/i.dpr]},e}(tn),an=function(t){function e(e,i){var n,r=t.call(this,e,{width:i.width,height:i.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=-1,r.ImageCache={blocks:[],prizes:[]},r.initData(i),r.initWatch(),r.initComputed(),null===(n=e.beforeCreate)||void 0===n||n.call(r),r.init(),r}return i(e,t),e.prototype.resize=function(){var e,i;t.prototype.resize.call(this),this.draw(),null===(i=(e=this.config).afterResize)||void 0===i||i.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=-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,"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=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)}))},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 i;return o(this,(function(n){switch(n.label){case 0:return this.initLucky(),i=this.config,null===(t=i.beforeInit)||void 0===t||t.call(this),this.drawOffscreenCanvas(),this.draw(),[4,this.initImageCache()];case 1:return n.sent(),null===(e=i.afterInit)||void 0===e||e.call(this),[2]}}))}))},e.prototype.initImageCache=function(){var t=this;return new Promise((function(e){var i={blocks:t.blocks.map((function(t){return t.imgs})),prizes:t.prizes.map((function(t){return t.imgs}))};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.drawOffscreenCanvas(),t.draw(),e()}))}))}))},e.prototype.loadAndCacheImg=function(t,e,i,n){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[n];if(c){var h=r.ImageCache;h[i][e]||(h[i][e]=[]),r.loadImg(c.src,c).then((function(t){"function"==typeof c.formatter&&(t=c.formatter.call(r,t)),h[i][e][n]=t,o()})).catch((function(i){console.error(t+"["+e+"].imgs["+n+"] "+i),a()}))}}}))]}))}))},e.prototype.computedWidthAndHeight=function(t,e,i,n){if(!e.width&&!e.height)return[t.width,t.height];if(e.width&&!e.height){var r=this.getWidth(e.width,i);return[r,t.height*(r/t.width)]}if(!e.width&&e.height){var o=this.getHeight(e.height,n);return[t.width*(o/t.height),o]}return[this.getWidth(e.width,i),this.getHeight(e.height,n)]},e.prototype.drawOffscreenCanvas=function(){var t=this,e=this._defaultConfig,i=this._defaultStyle,n=this.drawBlocks(),r=n.w,o=n.h,a=this.prizes.length,s=this.displacementWidthOrHeight(),c=s.cellWidth,h=s.cellHeight,u=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,i){void 0===t.scroll[i]&&(t.scroll[i]=0),e.order=e.order||f;var n=e.order.length;d=Math.max(d,r+u*n),p=Math.max(p,o+l*n)}));var g=this.getOffscreenCanvas(d,p),v=g._offscreenCanvas,y=g._ctx;this._offscreenCanvas=v,this.slots.forEach((function(n,r){var o=c*r,a=h*r,s=0,f=function(t,e){for(var i={},n=[],r=0;r<t.length;r++)i[r]=t[r];for(r=0;r<e.length;r++){var o=i[e[r]];o&&(n[r]=o)}return n}(t.prizes,n.order);if(f.length){f.forEach((function(r,f){if(r){var d=n.order[f],p=u*f+e.colSpacing/2,g=l*f+e.rowSpacing/2,v=t.displacement([o,g,l],[p,a,u]),m=v[0],w=v[1],b=v[2];s+=b;var S=r.background||i.background;if($i(S)){var C=t.getLength(Pi(r,"borderRadius")?r.borderRadius:i.borderRadius);Li(y,m,w,c,c,C),y.fillStyle=S,y.fill()}r.imgs&&r.imgs.forEach((function(e,i){var n=Ai(t.ImageCache,"prizes."+d+"."+i);if(n){var r=t.computedWidthAndHeight(n,e,c,h),o=r[0],a=r[1],s=[m+t.getOffsetX(o,c),w+t.getHeight(e.top,h)],u=s[0],l=s[1];t.drawImage(y,n,u,l,o,a)}})),r.fonts&&r.fonts.forEach((function(e){var n=e.fontStyle||i.fontStyle,r=e.fontWeight||i.fontWeight,o=t.getLength(e.fontSize||i.fontSize),a=e.lineHeight||i.lineHeight||e.fontSize||i.fontSize,s=Object.prototype.hasOwnProperty.call(e,"wordWrap")?e.wordWrap:i.wordWrap,u=e.lengthLimit||i.lengthLimit,l=e.lineClamp||i.lineClamp;y.font=r+" "+(o>>0)+"px "+n,y.fillStyle=e.fontColor||i.fontColor;var f=[],d=String(e.text);if(s){var p=t.getWidth(u,c);f=Fi(y,_i(d),(function(){return p}),l)}else f=d.split("\n");f.forEach((function(i,n){y.fillText(i,m+t.getOffsetX(y.measureText(i).width,c),w+t.getHeight(e.top,h)+(n+1)*t.getLength(a))}))}))}}));for(var d=t.displacement([o,0,c,s],[0,a,s,h]),g=d[0],m=d[1],w=d[2],b=d[3],S=s;S<p+s;){var C=t.displacement([g,S],[S,m]),x=C[0],z=C[1];t.drawImage(y,v,g,m,w,b,x,z,w,b),S+=s}}}))},e.prototype.drawBlocks=function(){var t=this,e=this;e.config;var i=e.ctx;e._defaultConfig;var n=e._defaultStyle;return this.prizeArea=this.blocks.reduce((function(e,r,o){var a=e.x,s=e.y,c=e.w,h=e.h,u=Ri(r),l=u[0],f=u[1],d=u[2],p=u[3],g=r.borderRadius?t.getLength(r.borderRadius):0,v=r.background||n.background;return $i(v)&&(Li(i,a,s,c,h,g),i.fillStyle=v,i.fill()),r.imgs&&r.imgs.forEach((function(e,n){var r=Ai(t.ImageCache,"blocks."+o+"."+n);if(r){var u=t.computedWidthAndHeight(r,e,c,h),l=u[0],f=u[1],d=[t.getOffsetX(l,c),t.getHeight(e.top,h)],p=d[0],g=d[1];t.drawImage(i,r,a+p,s+g,l,f)}})),{x:a+d,y:s+l,w:c-d-p,h:h-l-f}}),{x:0,y:0,w:this.boxWidth,h:this.boxHeight})},e.prototype.draw=function(){var t,e=this,i=this,n=i.config,r=i.ctx;i._defaultConfig,i._defaultStyle,null===(t=n.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,h=o.h;if(this._offscreenCanvas){var u=this,l=u.cellWidth,f=u.cellHeight,d=u.cellAndSpacing,p=u.widthAndSpacing,g=u.heightAndSpacing;this.slots.forEach((function(t,i){var n=d*t.order.length,o=e.displacement(-(h-g)/2,-(c-p)/2),u=e.scroll[i]+o;u<0&&(u=u%n+n),u>n&&(u%=n);var v=e.displacement([l*i,u,l,h],[u,f*i,c,f]),y=v[0],m=v[1],w=v[2],b=v[3],S=e.displacement([a+p*i,s,l,h],[a,s+g*i,c,f]),C=S[0],x=S[1],z=S[2],O=S[3];e.drawImage(r,e._offscreenCanvas,y,m,w,b,C,x,z,O)}))}},e.prototype.carveOnGunwaleOfAMovingBoat=function(){var t=this,e=this,i=e._defaultConfig,n=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||i.speed,c=e.direction||i.direction,h=a.findIndex((function(t){return t===n})),u=r*a.length,l=t.stopScroll[o]=t.scroll[o],f=0;++f;){var d=r*h+u*f*c-l,p=nn(t.FPS,l,d,i.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){0!==this.step&&3!==this.step&&(this.prizeFlag=t,this.step=t<0?0:2)},e.prototype.run=function(t){var e,i=this;void 0===t&&(t=0);var n=this,r=n.rAF,o=n.step,a=n.prizeFlag,s=n._defaultConfig,c=n.cellAndSpacing,h=s.accelerationTime,u=s.decelerationTime;if(0===this.step&&void 0!==a&&a>=0)null===(e=this.endCallback)||void 0===e||e.call(this,this.prizes.find((function(t,e){return e===a}))||{});else if(-1!==a){3!==this.step||this.endScroll.length||this.carveOnGunwaleOfAMovingBoat();var l=Date.now()-this.startTime,f=Date.now()-this.endTime;this.slots.forEach((function(e,n){var r=e.order;if(r&&r.length){var d=c*r.length,p=Math.abs(e.speed||s.speed),g=e.direction||s.direction,v=0,y=i.scroll[n];if(1===o||l<h){i.FPS=l/t;var m=en(l,0,p,h);m===p&&(i.step=2),v=(y+m*g)%d}else if(2===o)v=(y+p*g)%d,void 0!==a&&a>=0&&(i.step=3,i.stopScroll=[],i.endScroll=[]);else if(3===o&&f){var w=i.stopScroll[n],b=i.endScroll[n];v=nn(f,w,b,u),f>=u&&(i.step=0)}i.scroll[n]=v}})),this.draw(),r(this.run.bind(this,t+1))}},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,i=this._defaultConfig,n=i.colSpacing,r=i.rowSpacing,o=this.prizeArea||this.drawBlocks();o.x,o.y;var a,s,c=o.w,h=o.h,u=0,l=0;return"horizontal"===t?(l=this.cellHeight=(h-r*(e-1))/e,u=this.cellWidth=l):(u=this.cellWidth=(c-n*(e-1))/e,l=this.cellHeight=u),a=this.widthAndSpacing=this.cellWidth+n,s=this.heightAndSpacing=this.cellHeight+r,this.cellAndSpacing="horizontal"===t?a:s,{cellWidth:u,cellHeight:l,widthAndSpacing:a,heightAndSpacing:s}},e.prototype.getWidth=function(t,e){return Wi(t,"number")?t:Wi(t,"string")?this.changeUnits(t,e):0},e.prototype.getHeight=function(t,e){return Wi(t,"number")?t:Wi(t,"string")?this.changeUnits(t,e):0},e.prototype.getOffsetX=function(t,e){return(e-t)/2},e}(tn);t.LuckyGrid=on,t.LuckyWheel=rn,t.SlotMachine=an,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.js.map
{
"name": "lucky-canvas",
"version": "1.7.9",
"version": "1.7.10",
"description": "一个基于原生 js 的(大转盘 / 九宫格 / 老虎机)抽奖插件",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

@@ -49,2 +49,3 @@ declare type FontItemType = {

afterDraw?: Function;
afterStart?: Function;
};

@@ -98,2 +99,3 @@ declare type RequireKey = 'width' | 'height';

protected setHTMLFontSize(): void;
clearCanvas(): void;
/**

@@ -100,0 +102,0 @@ * 设备像素比

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc