UNPKG

tinyjs-plugin-mars

Version:
1 lines 361 kB
console.log("[tinyjs-plugin-mars]version:1.2.2"),window.Tiny&&void 0===window.Tiny.three&&(console.warn("[mars-plugin]tiny3d not import, if it will be used, import tiny3d before mars plugin"),window.Tiny.three={Container3D:function(){},Transform3D:function(){}});var mars=function(e){"use strict";var t=function(e){var t;return e&&e.__esModule?e:(t=Object.create(null),e&&Object.keys(e).forEach((function(r){var n;"default"!==r&&(n=Object.getOwnPropertyDescriptor(e,r),Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}}))})),t.default=e,Object.freeze(t))}(Tiny),r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}))(e,t)},n=function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i="[Mars Player]",o="https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor",a=console.log.bind(console),s=console.warn.bind(console),u=console.error.bind(console);function l(e,t,r){e&&(a=e),t&&(s=t),r&&(u=r)}function c(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];a.apply(void 0,[i+e].concat(r))}function h(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];s.apply(void 0,[i+e].concat(r))}function f(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];u.apply(void 0,[i+e].concat(r))}function d(){d=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",o=m.asyncIterator||"@@asyncIterator",a=m.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function u(e,t,r,i){var o,a,s,u;t=t&&t.prototype instanceof h?t:h,t=Object.create(t.prototype),i=new x(i||[]);return n(t,"_invoke",{value:(o=e,a=r,s=i,u="suspendedStart",function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=r.method,i=t.iterator[n];return void 0===i?(r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),c):"throw"===(n=l(i,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(i=n.arg)?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===u)throw u="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(u="executing","normal"===(r=l(o,a,s)).type){if(u=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(u="completed",s.method="throw",s.arg=r.arg)}})}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function h(){}function f(){}function p(){}var m,v,_=((v=(v=(s(m={},i,(function(){return this})),Object.getPrototypeOf))&&v(v(R([]))))&&v!==t&&r.call(v,i)&&(m=v),p.prototype=h.prototype=Object.create(m));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){var i;n(this,"_invoke",{value:function(n,o){function a(){return new t((function(i,a){!function n(i,o,a,s){var u;if("throw"!==(i=l(e[i],e,o)).type)return(o=(u=i.arg).value)&&"object"==typeof o&&r.call(o,"__await")?t.resolve(o.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(o).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}));s(i.arg)}(n,o,i,a)}))}return i=i?i.then(a,a):a()}})}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function R(e){if(e){var t,n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(n=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=n}return{next:A}}function A(){return{value:void 0,done:!0}}return n(_,"constructor",{value:f.prototype=p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=s(p,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,a,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},g(E.prototype),s(E.prototype,o,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new E(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(_),s(_,a,"Generator"),s(_,i,(function(){return this})),s(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=Object(e),n=[];for(t in r)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},e.values=R,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,T(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function p(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function m(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){p(o,n,i,a,s,"next",e)}function s(e){p(o,n,i,a,s,"throw",e)}a(void 0)}))}}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function(e){return e=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return String(e);if("object"!=typeof(r=r.call(e,"string")))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e),"symbol"==typeof e?e:String(e)}(n.key),n)}}function _(e,t,r){t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function E(e,t){e.prototype=Object.create(t.prototype),y(e.prototype.constructor=e,t)}function y(e,t){return(y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x="lookup_texture",R="load_image_bitmap",A="offscreen_canvas",b=("undefined"==typeof __MarsConfig__&&("object"==typeof window?window.__MarsConfig__={}:global.__MarsConfig__={}),__MarsConfig__);function O(e){return b[e]}function C(e,t){return b[e]=t}var S=Object.assign;function I(e){var t=arguments;if(S)return S.apply(this,arguments);for(var r=1;r<arguments.length;r++)!function(){var n=t[r];n&&Object.keys(n).forEach((function(t){e[t]=n[t]}))}();return e}var L="function"==typeof createImageBitmap;function M(e){L&&(e instanceof ImageBitmap?e.close():e instanceof Array&&e.forEach(M))}function w(e,t){var r,n,i;if(e instanceof Blob)L&&O(R),r=URL.createObjectURL(e),n=!0;else if(!(L&&e instanceof ImageBitmap))if(e instanceof HTMLImageElement){if(e.complete)return Promise.resolve(e);r=e.src}else"string"==typeof e&&(r=e);return r?L&&O(R)&&!t?G(r,{responseType:"blob"}).then((function(e){return createImageBitmap(e)})).catch((function(e){throw Error("load image fail:"+r)})):(i=new Image,/^data:/.test(r)||(i.crossOrigin="*"),i.src=r,new Promise((function(e,t){i.onload=function(){return i.onload=null,n&&URL.revokeObjectURL(r),e(i)},i.onerror=function(e){return i.onerror=null,n&&URL.revokeObjectURL(r),t(Error("load image fail:"+r))}}))):Promise.reject(Error("invalid url type "+e))}function P(e,t){-1<(t=e.indexOf(t))&&e.splice(t,1)}function N(e,t){return!e.includes(t)&&(e.push(t),!0)}var D=Object.prototype.hasOwnProperty;function F(e,t,r){if(U(e))if(void 0===r&&(r=e),e instanceof Array||"length"in e)for(var n=e.length,i=0;i<n;i++)t.call(r,e[i],i);else for(var o in e)D.call(e,o)&&t.call(r,e[o],o)}function V(e){return"function"==typeof e}function U(e){return"object"==typeof e&&e}function B(e){return"string"==typeof e}function k(){}function z(e,t){return e+Math.random()*(t-e)}function G(e,t){return t=t||{},new Promise((function(r,n){var i=new XMLHttpRequest;i.responseType=t.responseType||"json",i.addEventListener("load",(function(){return r(i.response)})),i.addEventListener("error",(function(){return n(Error("load "+e+" fail"))})),i.open(t.method||"get",e),i.send(t.data)}))}function X(e,t,r,n){if(!e.includes(t)&&(e.push(t),1!==e.length)){var i=e.length-1;if(i){var o=e[i];if(n)for(;e[i-1][r]<o[r]&&(e[i]=e[i-1],0!=--i););else for(;e[i-1][r]>o[r]&&(e[i]=e[i-1],0!=--i););e[i]=o}}}function H(e){if(Array.isArray(e))return e.map(H);if(U(e)){if(ArrayBuffer.isView(e))return e.slice();for(var t={},r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];t[i]=H(e[i])}return t}return e}Y=new Float32Array(1),j=new Int32Array(Y.buffer);var Y,j,W,Z,q,K=function(e){Y[0]=e;var t=(e=j[0])>>16&32768,r=e>>12&2047,n=e>>23&255;if(!(n<103)){if(142<n)return 31744|t|((255==n?0:1)&&8388607&e);if(n<113)return t|((r|=2048)>>114-n)+(r>>113-n&1);t=(t|n-112<<10|r>>1)+(1&r)}return t},J=(Q.prototype.set=function(e,t){for(var r=0;r<e.length;r++)this.data[r+t]=K(e[r])},Q);function Q(e){if(Number.isInteger(e))this.data=new Uint16Array(e);else if(U(e)&&Number.isInteger(e.length))for(var t=this.data=new Uint16Array(e.length),r=0;r<t.length;r++)t[r]=K(e[r])}function $(e){var t=[];return e instanceof Array?e.forEach((function(e){var r=e[0],n=e[1],i=e[2],o=e[3];e=e[4];t.push({stop:ie(r),color:[n,i,o,e]})})):F(e,(function(e,r){e=ne(e),t.push({stop:ie(r),color:e})})),(t=t.sort((function(e,t){return e.stop-t.stop}))).length&&(0!==t[0].stop&&t.unshift({stop:0,color:t[0].color.slice()}),1!==(e=t[t.length-1]).stop)&&t.push({stop:1,color:e.color.slice()}),t}function ee(e,t){return{width:e,height:t,data:new Uint8Array(e*t*4)}}function te(e){var t=ee(128,1),r=t.data,n=$(e);if(n.length){r.set(n[0].color,0);for(var i=1;i<127;i++){for(var o=i/128,a=void 0,s=void 0,u=0;u<n.length&&(a=n[u],s=n[u+1],!(a.stop<=o&&s.stop>o));u++);var l=re(a.color,s.color,(o-a.stop)/(s.stop-a.stop));r.set(l,4*i)}r.set(n[n.length-1].color,508)}return t}function re(e,t,r,n){var i=[],o=1-r;if(n)for(var a=0;a<4;a++)i[a]=e[a]*o+t[a]*r;else{for(var s=0;s<3;s++)i[s]=Math.round(Math.sqrt(e[s]*e[s]*o+t[s]*t[s]*r));i[3]=Math.round(e[3]*o+t[3]*r)}return i}function ne(e,t){var r,n,i;if(B(e)?(e=e.replace(/[\s\t\r\n]/g,""),(r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(e))?(n=+r[4],i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]):/^#[a-f\d]{3}$/i.test(e)?i=[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])):e instanceof Array&&(i=[e[0],e[1],e[2],isNaN(e[3])?255:e[3]]),t)for(var o=0;o<4;o++)i[o]/=255;return i}function ie(e){var t=/^(-)?([\d+.]+)%$/.exec(e);return t?+t[2]/100*(t[1]?-1:1):+e}(ir=W=W||{})[ir.NONE=0]="NONE",ir[ir.SPHERE=1]="SPHERE",ir[ir.CONE=2]="CONE",ir[ir.HEMISPHERE=3]="HEMISPHERE",ir[ir.CIRCLE=4]="CIRCLE",ir[ir.DONUT=5]="DONUT",ir[ir.RECTANGLE=6]="RECTANGLE",ir[ir.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",ir[ir.RECTANGLEEDGE=7]="RECTANGLEEDGE",ir[ir.EDGE=8]="EDGE",ir[ir.TEXTURE=9]="TEXTURE",(ir=Z=Z||{})[ir.CLICK=0]="CLICK",ir[ir.MESSAGE=1]="MESSAGE",ir[ir.DRAG=2]="DRAG",(ir=hl=hl||{})[ir.NONE=0]="NONE",ir[ir.NOTIFY=1]="NOTIFY",ir[ir.RESUME_PLAYER=2]="RESUME_PLAYER",ir[ir.REMOVE=3]="REMOVE",ir[ir.PAUSE=4]="PAUSE",(ir=q=q||{}).base="0",ir.sprite="1",ir.particle="2",ir.null="3",ir.interact="4",ir.plugin="5",ir.camera="6",ir.composition="7",ir.filter="8",ir.spine="spine",(ir=oe=oe||{})[ir.left=0]="left",ir[ir.middle=1]="middle",ir[ir.right=2]="right",(ir=ae=ae||{})[ir.normal=0]="normal",ir[ir.italic=1]="italic",ir[ir.oblique=2]="oblique",(ir=se=se||{})[ir.CONSTANT=0]="CONSTANT",ir[ir.CONSTANT_VEC2=1]="CONSTANT_VEC2",ir[ir.CONSTANT_VEC3=2]="CONSTANT_VEC3",ir[ir.CONSTANT_VEC4=3]="CONSTANT_VEC4",ir[ir.RANDOM=4]="RANDOM",ir[ir.LINE=5]="LINE",ir[ir.CURVE=6]="CURVE",ir[ir.BEZIER_PATH=7]="BEZIER_PATH",ir[ir.RGBA_COLOR=8]="RGBA_COLOR",ir[ir.GRADIENT_COLOR=9]="GRADIENT_COLOR",ir[ir.SHAPE_POINTS=10]="SHAPE_POINTS",ir[ir.SHAPE_SPLITS=11]="SHAPE_SPLITS",ir[ir.LINEAR_PATH=12]="LINEAR_PATH",ir[ir.COLORS=13]="COLORS",ir[ir.BINARY=20]="BINARY",(ir=ue=ue||{})[ir.destroy=0]="destroy",ir[ir.loop=5]="loop",ir[ir.forward=4]="forward";var oe,ae,se,ue,le="not_implement",ce={[se.RANDOM]:e=>new(e[0]instanceof Array?Ae:Te)(e),[se.CONSTANT]:e=>new me(e),[se.CONSTANT_VEC2]:e=>new me(e),[se.CONSTANT_VEC3]:e=>new me(e),[se.CONSTANT_VEC4]:e=>new me(e),[se.CURVE]:e=>new Pe(e),[se.RGBA_COLOR]:e=>new me(e),[se.COLORS]:e=>new ge(e.map((function(e){return ne(e,!1)}))),[se.LINE]:e=>2===e.length&&0===e[0][0]&&1===e[1][0]?new Ce([e[0][1],e[1][1]]):new Fe(e),[se.GRADIENT_COLOR]:e=>new Le(e),[se.LINEAR_PATH]:e=>new Be(e),[se.BEZIER_PATH]:e=>new Ge(e)};function he(e){return e&&isNaN(+e)?e instanceof fe?e:ce[e[0]](e[1]):new me(e||0)}(ir=de.prototype).onCreate=function(e){throw Error(le)},ir.getIntegrateValue=function(e,t,r){throw Error(le)},ir.getIntegrateByTime=function(e,t){throw Error(le)},ir.getValue=function(e){throw Error(le)},ir.toUniform=function(e){throw Error(le)},ir.map=function(e){throw Error(le)},ir.scaleXCoord=function(e){return this};var fe=de;function de(e){this.onCreate(e)}E(ve,pe=fe),(ir=ve.prototype).onCreate=function(e){this._value=e},ir.getIntegrateValue=function(e,t,r){return this._value*(t-e)},ir.getIntegrateByTime=function(e,t){return.5*this._value*(t*t-e*e)},ir.getValue=function(e){return this._value},ir.toUniform=function(e){return new Float32Array([0,this._value,0,0])},ir.map=function(e){var t=this._value;return this._value=e(t),this};var pe,me=ve;function ve(){return pe.apply(this,arguments)||this}E(Ee,_e=fe),(ir=Ee.prototype).onCreate=function(e){this._items=e},ir.getValue=function(e){var t=this._items;return t[Math.floor(Math.random()*t.length)]},ir.map=function(e){return this._items=this._items.map(e),this};var _e,ge=Ee;function Ee(){return _e.apply(this,arguments)||this}E(xe,ye=fe),(ir=xe.prototype).onCreate=function(e){this._min=e[0],this._max=e[1]},ir.getValue=function(e){return z(this._min,this._max)},ir.toUniform=function(e){return new Float32Array([4,this._min,this._max,0])},ir.map=function(e){return this._min=e(this._min),this._max=e(this._max),this};var ye,Te=xe;function xe(){return ye.apply(this,arguments)||this}E(be,Re=fe),(ir=be.prototype).onCreate=function(e){this._min=e[0],this._max=e[1]},ir.getValue=function(e){for(var t=this._min,r=this._max,n=[],i=0;i<t.length;i++){var o=Math.random();n[i]=t[i]*(1-o)+r[i]*o}return n},ir.map=function(e){return this._min=this._min.map(e),this._max=this._max.map(e),this};var Re,Ae=be;function be(){return Re.apply(this,arguments)||this}E(Se,Oe=fe),(ir=Se.prototype).onCreate=function(e){this._min=e[0],this._max=e[1],this._xCoord=1},ir.getValue=function(e){return e/=this._xCoord,this._min*(1-e)+this._max*e},ir.toUniform=function(){return new Float32Array([1,this._min,this._max,this._xCoord])},ir.getIntegrateValue=function(e,t,r){var n=this._min,i=this._max;return((n+t/(r=this._xCoord*(r||1))*(i-n)+n)*t-(n+e/r*(i-n)+n)*e)/2},ir.getIntegrateByTime=function(e,t){return Ye(t,0,this._xCoord,this._min,this._max)-Ye(e,0,this._xCoord,this._min,this._max)},ir.map=function(e){return this._min=e(this._min),this._max=e(this._max),this},ir.scaleXCoord=function(e){return this._xCoord=e,this};var Oe,Ce=Se;function Se(){return Oe.apply(this,arguments)||this}E(Me,Ie=fe),(ir=Me.prototype).onCreate=function(e){this.stops=$(e)},ir.getStops=function(){return this.stops},ir.getValue=function(e){for(var t=this.stops,r=t.length-1,n=0;n<r;n++){var i,o=t[n],a=t[n+1];if(o.stop<=e&&a.stop>e)return i=(e-o.stop)/(a.stop-o.stop),re(o.color,a.color,i,!0)}return t[r].color.slice()};var Ie,Le=Me;function Me(){return Ie.apply(this,arguments)||this}E(Ne,we=fe),Ne.getAllData=function(e,t){for(var r=new(t?J:Float32Array)(4*e.index),n=0,i=0,o=e.curves;n<o.length;n++){var a=o[n].toData();r.set(a,i),i+=a.length}return t?r.data:r},(ir=Ne.prototype).onCreate=function(e){var t=1/0,r=-1/0;if(Number.isFinite(e[0])&&Number.isFinite(e[1])){for(var n=[],i=2;i<e.length;i++)n.push(e[i].slice(0,4));this.keys=n,this.min=e[0],this.dist=e[1]-e[0]}else{var o,a=this.keys=e.map((function(e){if(e instanceof Array)return t=Math.min(t,e[1]),r=Math.max(r,e[1]),e.slice(0,4);if(U(e))return t=Math.min(t,e.value),r=Math.max(r,e.value),[e.time,e.value,e.inTangent||0,e.outTangent||0];throw Error("invalid keyframe")})),s=r-t;if(0!=s)for(var u=0;u<a.length;u++){var l=a[u];l[1]=(l[1]-t)/s}(o=(0<(o=a[0])[0]&&(o[2]=0,a.unshift([0,o[1],0,0])),a[a.length-1]))[0]<1&&(o[3]=0,a.push([1,o[1],0,0])),this.min=t,this.dist=s}this.isCurveValue=!0},ir.getValue=function(e){var t=this.keys,r=this.min,n=this.dist;if(e<=t[0][0])return t[0][1]*n+r;for(var i=t.length-1,o=0;o<i;o++){var a=t[o],s=t[o+1];if(e>a[0]&&e<=s[0])return je(e,a,s)*n+r}return t[i][1]*n+r},ir.getIntegrateByTime=function(e,t){var r=this._integrate(t,!0)-this._integrate(e,!0);return.5*this.min*(t-e)*(t-e)+r*this.dist},ir.getIntegrateValue=function(e,t,r){var n=(this._integrate(t/(r=r||1),!1)-this._integrate(e/r,!1))*r;return this.min*((t-e)/r)+n*this.dist},ir._integrate=function(e,t){var r=this.keys;if(e<=r[0][0])return 0;for(var n=0,i=r.length-1,o=t?Ze:We,a=0;a<i;a++){var s=r[a],u=r[a+1],l=s[0],c=u[0];if(l<e&&e<=c)return n+o(e,s,u);n+=o(c,s,u)}return n},ir.toData=function(){for(var e=this.keys,t=new Float32Array(4*e.length),r=0,n=0;r<e.length;r++,n+=4)t.set(e[r],n);return t},ir.toUniform=function(e){var t=e.index,r=this.keys;return e.curves.push(this),e.index+=r.length,e.max=Math.max(e.max,r.length),e.curveCount+=r.length,new Float32Array([2,t+1/r.length,this.min,this.dist])},ir.map=function(e){return this.keys.forEach((function(t){t[1]=e(t[1])})),this},ir.scaleXCoord=function(e){return this.keys.forEach((function(t){return t[0]=e*t[0]})),this};var we,Pe=Ne;function Ne(){return we.apply(this,arguments)||this}E(Ve,De=fe),(ir=Ve.prototype).onCreate=function(e){var t;e=this.keys=e.map((function(e){return e.slice?e.slice(0,2):[e.time,e.value]})).sort((function(e,t){return e[0]-t[0]}));0<(t=((t=e[e.length-1])[0]<1&&e.push([1,t[1]]),e[0]))[0]&&e.unshift([0,t[1]]),this.isLineSeg=!0},ir.getValue=function(e){var t=this.keys;if(e<t[0][0])return t[0][1];for(var r=t.length-1,n=0;n<r;n++){var i=t[n],o=t[n+1],a=i[0],s=o[0];if(a<=e&&e<=s)return(i=i[1])+(e-a)/(s-a)*(o[1]-i)}return t[r][1]},ir.getIntegrateValue=function(e,t,r){return void 0===r&&(r=1),(this._integrate(t,!1)-this._integrate(e,!1))*r},ir.getIntegrateByTime=function(e,t){return this._integrate(t,!0)-this._integrate(e,!0)},ir._integrate=function(e,t){var r=this.keys;if(e<=r[0][0])return 0;for(var n=0,i=r.length-1,o=t?Ye:He,a=0;a<i;a++){var s=r[a],u=r[a+1],l=s[0],c=u[0];if(l<e&&e<=c)return n+o(e,l,c,s[1],u[1]);n+=o(c,l,c,s[1],u[1])}return n},ir.toData=function(){for(var e=this.keys,t=new Float32Array(4*Math.ceil(e.length/2)),r=0,n=0;r<e.length;r++,n+=2)t.set(e[r],n);return t.set(e[e.length-1],t.length-2),t},ir.toUniform=function(e){var t=e.index,r=this.keys;r=Math.ceil(r.length/2);return e.lineSegCount+=r,e.curves.push(this),e.index+=r,e.max=Math.max(e.max,r),new Float32Array([3,t,r,0])},ir.map=function(e){return this.keys.forEach((function(t){return t[1]=e(t[1])})),this},ir.scaleXCoord=function(e){return this.keys.forEach((function(t){return t[0]=e*t[0]})),this};var De,Fe=Ve;function Ve(){return De.apply(this,arguments)||this}E(ke,Ue=fe),(ir=ke.prototype).onCreate=function(e){this.keys=e[0],this.values=e[1]},ir.getValue=function(e){for(var t=this.keys,r=this.values,n=0;n<t.length-1;n++){var i,o,a=t[n],s=t[n+1];if(a[0]<=e&&s[0]>=e)return void 0,o=0==(i=s[1]-a[1])?(e-a[0])/(s[0]-a[0]):(je(e,a,s)-a[1])/i,this._calculateVec(n,o)}return(e<=t[0][0]?r[0]:r[r.length-1]).slice()},ir._calculateVec=function(e,t){for(var r=this.values[e],n=this.values[e+1],i=[0,0,0],o=0;o<r.length;o++)i[o]=r[o]*(1-t)+n[o]*t;return i};var Ue,Be=ke;function ke(){return Ue.apply(this,arguments)||this}E(Xe,ze=Be),(ir=Xe.prototype).onCreate=function(e){ze.prototype.onCreate.call(this,e),this.cps=e[2]},ir._calculateVec=function(e,t){for(var r=this.values[e],n=this.values[e+1],i=this.cps[e+e],o=this.cps[e+e+1],a=[0,0,0],s=(e=1-t)*e*e,u=3*t*e*e,l=3*t*t*e,c=t*t*t,h=0;h<r.length;h++)a[h]=s*r[h]+u*i[h]+l*o[h]+c*n[h];return a};var ze,Ge=Xe;function Xe(){return ze.apply(this,arguments)||this}function He(e,t,r,n,i){return(n+n+(i-n)*(e-=t)/(r-t))*e/2}function Ye(e,t,r,n,i){var o=e*e,a=t*t;return(o*e*2*(n-i)+3*o*(t*i-r*n)-a*t*(2*n+i)+3*a*r*n)/(6*(t-r))}function je(e,t,r){var n=r[0]-t[0],i=t[3]*n,o=r[2]*n,a=(n=(e=(e-t[0])/n)*e)*e;return(2*a-3*n+1)*t[1]+(a-2*n+e)*i+(a-n)*o+(-2*a+3*n)*r[1]}function We(e,t,r){var n,i=r[0]-t[0],o=t[3]*i,a=r[2]*i,s=(e=(n=(n=t[0])-e)*n)*n;return(o+a+2*(t=t[1])-2*(r=r[1]))*s*n/(4*i*i*i)+(2*o+a+3*t-3*r)*s/(3*i*i)+o*e/2/i-t*n}function Ze(e,t,r){var n=r[0]-t[0],i=t[3]*n,o=r[2]*n,a=t[0],s=a-e,u=s*s,l=u*s,c=n*n,h=c*n;return(-30*h*(t=t[1])*(a+e)*s+10*c*i*(a+2*e)*u+5*n*(a+3*e)*(2*i+o+3*t-3*(r=r[1]))*l+3*(a+4*e)*(i+o+2*t-2*r)*l*s)/60/h}function qe(e,t){var r,n;e&&(n=e[0],e=e[1],n===se.CURVE?(t.curves.push(e),r=e.length,0<e[0][0]&&r++,e[e.length-1][0]<1&&r++,t.index+=r,t.max=Math.max(t.max,r),t.curveCount+=r):n!==se.LINE||2===(r=e.length)&&0===e[0][0]&&1===e[1][0]||(0<e[0][0]&&r++,e[e.length-1][0]<1&&r++,n=Math.ceil(r/2),t.lineSegCount+=n,t.curves.push(e),t.index+=n,t.max=Math.max(t.max,n)))}var Ke=.017453292519943295,Je=180/Math.PI,Qe=Math.cos,$e=Math.sin;function et(e,t,r){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]+r[n];return e}function tt(e,t){for(var r=0,n=e.length;r<n;r++)e[r]=t;return e}function rt(e,t,r){if(t&&r){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]+r[n];return e}return t||r}function nt(e,t,r,n){void 0===n&&(n=0);for(var i=0;i<r;i++)e[i]=t[i+n];return e}function it(e,t,r){if(t&&r)for(var n=0,i=t.length;n<i;n++)e[n]=t[n]*r[n];else if(t){if(e!==t)for(var o=0;o<t.length;o++)e[o]=t[o]}else if(r&&e!==r)for(var a=0;a<r.length;a++)e[a]=r[a];return e}function ot(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7],c=t[8],h=t[9],f=t[10],d=t[11],p=t[12],m=t[13],v=t[14],_=r*s-n*a,g=r*u-i*a,E=r*l-o*a,y=n*u-i*s,T=n*l-o*s,x=i*l-o*u,R=c*m-h*p,A=c*v-f*p,b=h*v-f*m;return(d=_*(f=f*(t=t[15])-d*v)-g*(h=h*t-d*m)+E*b+y*(c=c*t-d*p)-T*A+x*R)?(e[0]=(s*f-u*h+l*b)*(d=1/d),e[1]=(u*c-a*f-l*A)*d,e[2]=(a*h-s*c+l*R)*d,e[3]=(i*h-n*f-o*b)*d,e[4]=(r*f-i*c+o*A)*d,e[5]=(n*c-r*h-o*R)*d,e[6]=(m*x-v*T+t*y)*d,e[7]=(v*E-p*x-t*g)*d,e[8]=(p*T-m*E+t*_)*d,e):null}function at(e,t,r){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]-r[n];return e}function st(e,t){for(var r=0,n=0,i=e.length;n<i;n++){var o=e[n]-t[n];r+=o*o}return r}var ut=Number.EPSILON||Math.pow(2,-32);function lt(e,t){1===arguments.length&&(t=e,e=[]);var r=Math.hypot.apply(Math,t);if(0===r)return nt(e,t,t.length);for(var n=0;n<t.length;n++)e[n]=t[n]/r;return e}function ct(e,t,r){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]*r;return e}function ht(e,t,r){if(isNaN(r)){for(var n=0,i=0,o=t.length;i<o;i++)n+=e[i]*t[i];return n}for(var a=0,s=t.length;a<s;a++)e[a]=t[a]*r;return e}function ft(e,t,r){var n=t[0],i=t[1],o=(t=t[2],r[0]),a=r[1];r=r[2];return e[0]=i*r-t*a,e[1]=t*o-n*r,e[2]=n*a-i*o,e}function dt(e,t,r){var n=t[0],i=t[1],o=(t=t[2],r[3]*n+r[7]*i+r[11]*t+r[15]);return e[0]=(r[0]*n+r[4]*i+r[8]*t+r[12])/(o=o||1),e[1]=(r[1]*n+r[5]*i+r[9]*t+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*t+r[14])/o,e}function pt(e,t,r){return e[0]=t[0]+r[12],e[1]=t[1]+r[13],e[2]=t[2]+r[14],e}function mt(e,t,r){var n=t[0],i=t[1],o=(t=t[2],r[3]*n+r[7]*i+r[11]*t+r[15]||1);return e[0]=(r[0]*n+r[4]*i+r[8]*t)/o,e[1]=(r[1]*n+r[5]*i+r[9]*t)/o,e[2]=(r[2]*n+r[6]*i+r[10]*t)/o,e}function vt(e,t,r){var n=t[0],i=t[1];t=t[2];return e[0]=n*r[0]+i*r[3]+t*r[6],e[1]=n*r[1]+i*r[4]+t*r[7],e[2]=n*r[2]+i*r[5]+t*r[8],e}var _t=[0,0,0,0,0,0,0,0,0];function gt(e,t){e=e||_t;var r=$e(t);t=Qe(t);return e[0]=t,e[1]=r,e[2]=0,e[3]=-r,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Et(e,t){return r=-t[0],n=-t[1],t=-t[2],i=Qe(r*Ke),o=Qe(n*Ke),a=Qe(t*Ke),r=$e(r*Ke),n=$e(n*Ke),t=$e(t*Ke),e[0]=o*a,e[1]=o*t,e[2]=-n,e[3]=-i*t+r*n*a,e[4]=i*a+r*n*t,e[5]=r*o,e[6]=t*r+i*n*a,e[7]=-r*a+i*n*t,e[8]=i*o,e;var r,n,i,o,a}function yt(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7],c=t[8],h=t[9],f=t[10],d=t[11],p=t[12],m=t[13],v=t[14],_=r*s-n*a,g=r*u-i*a,E=r*l-o*a,y=n*u-i*s,T=n*l-o*s,x=i*l-o*u,R=c*m-h*p,A=c*v-f*p,b=c*(t=t[15])-d*p,O=h*v-f*m,C=h*t-d*m,S=f*t-d*v,I=_*S-g*C+E*O+y*b-T*A+x*R;return I?(e[0]=(s*S-u*C+l*O)*(I=1/I),e[1]=(i*C-n*S-o*O)*I,e[2]=(m*x-v*T+t*y)*I,e[3]=(f*T-h*x-d*y)*I,e[4]=(u*b-a*S-l*A)*I,e[5]=(r*S-i*b+o*A)*I,e[6]=(v*E-p*x-t*g)*I,e[7]=(c*x-f*E+d*g)*I,e[8]=(a*C-s*b+l*R)*I,e[9]=(n*b-r*C-o*R)*I,e[10]=(p*T-m*E+t*_)*I,e[11]=(h*E-c*T-d*_)*I,e[12]=(s*A-a*O-u*R)*I,e[13]=(r*O-n*A+i*R)*I,e[14]=(m*g-p*y-v*_)*I,e[15]=(c*y-h*g+f*_)*I,e):null}function Tt(e){for(var t=0,r=e.length;t<r;t++)if(Math.abs(e[t])>ut)return!1;return!0}var xt=Array.isArray;function Rt(e){return xt(e)?[e[0],e[1],e[2]]:[0,0,0]}function At(e,t,r){var n=Qe(r),i=(r=$e(r),t[0]);t=t[1];return e[0]=n*i+r*t,e[1]=-r*i+n*t,e}function bt(e,t){var r,n,i,o,a,s,u,l;return r=e,i=t[0],o=t[3],t[6],a=t[1],s=t[4],t[7],u=t[2],l=t[5],n=t[8],r[1]=Math.asin(Ct(-u,-1,1))*Je,Math.abs(u)<.9999999?(r[0]=Math.atan2(l,n)*Je,r[2]=Math.atan2(a,i)*Je):(r[0]=0,r[2]=Math.atan2(-o,s)*Je),e}function Ot(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],h=(t=t[8],r[0]),f=r[1],d=r[2],p=r[3],m=r[4],v=r[5],_=r[6],g=r[7];r=r[8];return e[0]=h*n+f*a+d*l,e[1]=h*i+f*s+d*c,e[2]=h*o+f*u+d*t,e[3]=p*n+m*a+v*l,e[4]=p*i+m*s+v*c,e[5]=p*o+m*u+v*t,e[6]=_*n+g*a+r*l,e[7]=_*i+g*s+r*c,e[8]=_*o+g*u+r*t,e}function Ct(e,t,r){return r<e?r:e<t?t:e}var St=Math.PI/180;function It(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function Lt(e,t,r,n,i,o){return t=1/Math.tan(t*St/2),e[0]=o?t:t/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o?t*r:t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(e[10]=(i+n)*(o=1/(n-i)),e[14]=2*i*n*o):(e[10]=-1,e[14]=-2*n),e}function Mt(e,t,r,n){var i=(a=t[0])*(c=a+a),o=a*(h=(u=t[1])+u),a=a*(f=(l=t[2])+l),s=u*h,u=u*f,l=l*f,c=(t=t[3])*c,h=t*h,f=(t=t*f,n[0]),d=n[1];n=n[2];return e[0]=(1-(s+l))*f,e[1]=(o+t)*f,e[2]=(a-h)*f,e[3]=0,e[4]=(o-t)*d,e[5]=(1-(i+l))*d,e[6]=(u+c)*d,e[7]=0,e[8]=(a+h)*n,e[9]=(u-c)*n,e[10]=(1-(i+s))*n,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}var wt=[],Pt=new Float32Array(9),Nt=[0,0,0,1];function Dt(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],s=e[6],u=e[7],l=e[8],c=e[9],h=e[10],f=e[11],d=e[12],p=e[13],m=e[14];return(t*a-r*o)*(h*(e=e[15])-f*m)-(t*s-n*o)*(c*e-f*p)+(t*u-i*o)*(c*m-h*p)+(r*s-n*a)*(l*e-f*d)-(r*u-i*a)*(l*m-h*d)+(n*u-i*s)*(l*p-c*d)}function Ft(e,t,r,n){var i,o,a,s=e[0],u=e[1],l=e[2],c=e[4],h=e[5],f=e[6],d=e[8],p=e[9],m=e[10];r&&(o=1/n[0],i=1/n[1],n=1/n[2],Pt[0]=s*o,Pt[1]=u*o,Pt[2]=l*o,Pt[3]=c*i,Pt[4]=h*i,Pt[5]=f*i,Pt[6]=d*n,Pt[7]=p*n,Pt[8]=m*n,0<(s=Pt[0]+Pt[4]+Pt[8])?(a=Math.sqrt(s+1),Nt[3]=.5*a,Nt[0]=(Pt[5]-Pt[7])*(a=.5/a),Nt[1]=(Pt[6]-Pt[2])*a,Nt[2]=(Pt[1]-Pt[3])*a):(Pt[4]>Pt[u=0]&&(u=1),l=((u=Pt[8]>Pt[3*u+u]?2:u)+1)%3,o=(u+2)%3,a=Math.sqrt(Pt[3*u+u]-Pt[3*l+l]-Pt[3*o+o]+1),Nt[u]=.5*a,Nt[3]=(Pt[3*l+o]-Pt[3*o+l])*(a=.5/a),Nt[l]=(Pt[3*l+u]+Pt[3*u+l])*a,Nt[o]=(Pt[3*o+u]+Pt[3*u+o])*a),r[0]=Nt[0],r[1]=Nt[1],r[2]=Nt[2],r[3]=Nt[3]),t&&(t[0]=e[12],t[1]=e[13],t[2]=e[14])}function Vt(e,t,r,n){var i=e[0],o=e[1],a=e[2],s=e[4],u=e[5],l=e[6],c=e[8],h=e[9],f=e[10],d=Dt(e);return(n=void 0===n?wt:n)[0]=Math.hypot(i,o,a),n[1]=Math.hypot(s,u,l),n[2]=Math.hypot(c,h,f),d<0&&(n[0]=-n[0]),Ft(e,t,r,n)}function Ut(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],m=t[12],v=t[13],_=t[14],g=(t=t[15],r[0]),E=r[1],y=r[2],T=r[3];return e[0]=g*n+E*s+y*h+T*m,e[1]=g*i+E*u+y*f+T*v,e[2]=g*o+E*l+y*d+T*_,e[3]=g*a+E*c+y*p+T*t,g=r[4],E=r[5],y=r[6],T=r[7],e[4]=g*n+E*s+y*h+T*m,e[5]=g*i+E*u+y*f+T*v,e[6]=g*o+E*l+y*d+T*_,e[7]=g*a+E*c+y*p+T*t,g=r[8],E=r[9],y=r[10],T=r[11],e[8]=g*n+E*s+y*h+T*m,e[9]=g*i+E*u+y*f+T*v,e[10]=g*o+E*l+y*d+T*_,e[11]=g*a+E*c+y*p+T*t,g=r[12],E=r[13],y=r[14],T=r[15],e[12]=g*n+E*s+y*h+T*m,e[13]=g*i+E*u+y*f+T*v,e[14]=g*o+E*l+y*d+T*_,e[15]=g*a+E*c+y*p+T*t,e}function Bt(e,t){for(var r=0;r<16;r++)e[r]=t[r];return e}function kt(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7],c=t[8],h=t[9],f=t[10],d=t[11],p=t[12],m=t[13],v=t[14],_=r*s-n*a,g=r*u-i*a,E=r*l-o*a,y=n*u-i*s,T=n*l-o*s,x=i*l-o*u,R=c*m-h*p,A=c*v-f*p,b=c*(t=t[15])-d*p,O=h*v-f*m,C=h*t-d*m,S=f*t-d*v,I=_*S-g*C+E*O+y*b-T*A+x*R;if(I)e[0]=(s*S-u*C+l*O)*(I=1/I),e[1]=(i*C-n*S-o*O)*I,e[2]=(m*x-v*T+t*y)*I,e[3]=(f*T-h*x-d*y)*I,e[4]=(u*b-a*S-l*A)*I,e[5]=(r*S-i*b+o*A)*I,e[6]=(v*E-p*x-t*g)*I,e[7]=(c*x-f*E+d*g)*I,e[8]=(a*C-s*b+l*R)*I,e[9]=(n*b-r*C-o*R)*I,e[10]=(p*T-m*E+t*_)*I,e[11]=(h*E-c*T-d*_)*I,e[12]=(s*A-a*O-u*R)*I,e[13]=(r*O-n*A+i*R)*I,e[14]=(m*g-p*y-v*_)*I,e[15]=(c*y-h*g+f*_)*I;else for(var L=0;L<16;L++)e[L]=NaN;return e}var zt=Math.PI/180,Gt=Math.cos,Xt=Math.sin;function Ht(e,t,r,n){var i=Gt(t*zt/2),o=Gt(r*zt/2),a=Gt(n*zt/2);t=Xt(t*zt/2),r=Xt(r*zt/2),n=Xt(n*zt/2);return e[0]=t*o*a-i*r*n,e[1]=i*r*a+t*o*n,e[2]=i*o*n-t*r*a,e[3]=i*o*a+t*r*n,e}function Yt(e,t){var r=t[0],n=t[1],i=t[2];t=t[3];return e[0]=-r,e[1]=-n,e[2]=-i,e[3]=t,e}var jt=[],Wt=[],Zt=[],qt=1,Kt=(Jt.getRotation=function(e,t){var r,n,i,o,a,s,u,l,c,h;t=Yt(Zt,t);return r=jt,n=t[0],n*=c=n+n,s=(i=t[1])*c,i*=h=i+i,u=(o=t[2])*c,l=o*h,o*=a=o+o,c*=t=t[3],h*=t,t*=a,r[0]=1-i-o,r[3]=s-t,r[6]=u+h,r[1]=s+t,r[4]=1-n-o,r[7]=l-c,r[2]=u-h,r[5]=l+c,r[8]=1-n-i,bt(e,r)},(ir=Jt.prototype).clone=function(){return new Jt(this)},ir.setTransform=function(e,t){var r=e.position,n=e.rotation,i=e.scale,o=e.quat;r&&this.setPosition(r[0],r[1],r[2]),o?this.setQuat(o[0],o[1],o[2],o[3]):n&&this.setRotation(n[0]*(r=t?-1:1),n[1]*r,n[2]*r),i&&this.setScale(i[0],i[1],i[2]),e.name&&(this.name=e.name)},ir.getRotation=function(e){return Jt.getRotation(e,this.quat)},ir.update=function(){Mt(this._matrix,this.quat,this.position,this.scale),this._dirty=!1,this._worldTRSCache.dirty=!0},ir.setQuat=function(e,t,r,n){this._dirty=!0;var i=this.quat;i[0]=e,i[1]=t,i[2]=r,i[3]=n},ir.setPosition=function(e,t,r){var n=this.position;n[0]=e,n[1]=t,n[2]=r,this.invalid()},ir.setRotation=function(e,t,r){this.invalid(),Ht(this.quat,e,t,r),Yt(this.quat,this.quat)},ir.setScale=function(e,t,r){this.invalid();var n=this.scale;n[0]=e,n[1]=t,n[2]=r},ir.rotate=function(e){var t,r,n,i,o,a,s,u;this.invalid(),t=this.quat,n=(r=this.quat)[0],i=r[1],o=r[2],r=r[3],a=e[0],s=e[1],u=e[2],e=e[3],t[0]=n*e+r*a+i*u-o*s,t[1]=i*e+r*s+o*a-n*u,t[2]=o*e+r*u+n*s-i*a,t[3]=r*e-n*a-i*s-o*u},ir.translate=function(e,t,r){this.invalid();var n=this.position;n[0]+=e,n[1]+=t,n[2]+=r},ir.scaleBy=function(e,t,r){this.invalid();var n=this.scale;n[0]*=e,n[1]*=t,n[2]*=r},ir.invalid=function(){this._dirty=!0,this._parentMat=void 0,this._children.forEach((function(e){return e.invalid()}))},ir.getWorldScale=function(e){var t;return it(e||[1,1,1],this.scale,null==(t=this.parentTransform)?void 0:t.getWorldScale(e||[1,1,1]))},ir.getWorldMatrix=function(e){var t=this.parentTransform;return!t||this._parentMat&&!t.dirty||(this._parentMat=t.getWorldMatrix(t._worldMat),this._worldScale=this.getWorldScale(),this._dirty=!0),(t=this._parentMat?(this._dirty&&(this._worldMat=Ut(this._worldMat,this._parentMat,this.matrix),this._worldTRSCache.dirty=!0),this._worldMat):this.matrix)===e?t:Bt(e||Wt,t)},ir.fromMat4=function(e,t){return this._dirty=!0,t?(Ft(e,this.position,this.quat,t),nt(this.scale,t,3)):Vt(e,this.position,this.quat,this.scale),this},ir.getWorldTRS=function(e,t,r){var n=this.getWorldMatrix(this._worldMat),i=this._worldScale||this.scale,o=this._worldTRSCache;o.dirty&&(Ft(n,o.position,o.quat,i),o.dirty=!1),e&&nt(e,o.position,3),t&&nt(t,o.quat,4),r&&nt(r,i,3)},_(Jt,[{key:"parentTransform",get:function(){return this._pt},set:function(e){if(this._pt&&P(this._pt._children,this),(this._pt=e)&&N(e._children,this),e===this)throw Error("set self to parent transform");this.invalid()}},{key:"rotation",get:function(){return Jt.getRotation([],this.quat)}},{key:"matrix",get:function(){return this._dirty&&this.update(),this._matrix}},{key:"dirty",get:function(){var e=this.parentTransform;return!(!e||!e.dirty)||this._dirty}}]),Jt);function Jt(e,t){this._dirty=!0,this._matrix=It(),this.position=[0,0,0],this.quat=[0,0,0,1],this.scale=[1,1,1],this._worldMat=It(),this._worldTRSCache={dirty:!0,position:[0,0,0],quat:[0,0,0,1]},this.name=(null==e?void 0:e.name)||"transform_"+qt++,this._children=[],e&&this.setTransform(e),t&&(this.parentTransform=t)}var Qt=[0,0,0],$t=[0,0,0],er=((ir=tr.prototype)._onCreate=function(e){var t=this.transform,r=e.options;this.clipMode=e.options.clipMode,this.options={position:nt([0,0,0],t.position||[0,0,0],3),rotation:nt([0,0,0],t.rotation||[0,0,0],3),near:he(r.near),far:he(r.far),fov:he(r.fov)},e.positionOverLifetime&&(t=e.positionOverLifetime,this.translateOverLifetime={path:t.path&&he(t.path),x:he(t.linearX||0),y:he(t.linearY||0),z:he(t.linearZ||0)}),e.rotationOverLifetime&&(r=e.rotationOverLifetime,this.rotationOverLifetime={separateAxes:r.separateAxes,x:he(r.x||0),y:he(r.y||0),z:he(r.z||0)})},ir.onEnd=function(e){this.onItemUpdate(1,e)},ir.onItemUpdate=function(e,t){var r=this.options,n=nt(Qt,r.position,3),i=(r=nt($t,r.rotation,3),(i=((i=(e=Ct(e,0,1),this.translateOverLifetime))&&(n[0]+=i.x.getValue(e),n[1]+=i.y.getValue(e),n[2]+=i.z.getValue(e),i.path)&&et(n,n,i.path.getValue(e)),this.rotationOverLifetime))&&(o=i.z.getValue(e),r[2]+=o,i.separateAxes?(r[0]+=i.x.getValue(e),r[1]+=i.y.getValue(e)):(r[0]+=o,r[1]+=o)),this.options.far.getValue(e)),o=this.options.near.getValue(e),a=(e=this.options.fov.getValue(e),this.transform.setPosition(n[0],n[1],n[2]),this.transform.setRotation(r[0],r[1],r[2]),[0,0,0,1]);return this.transform.getWorldTRS(n,a),t.camera={near:o,far:i,fov:e,position:n,rotation:Kt.getRotation(r,a),clipMode:this.clipMode}},tr);function tr(e,t,r){this.composition=e,this.transform=r,this._onCreate(t)}(ir=nr.prototype)._onHideChanged=function(e){},ir._onFrozenChanged=function(e){},ir.getWorldTransform=function(e){return(e||new Kt).fromMat4(this.transform.getWorldMatrix())},ir.start=function(){return this._started&&!this.ended||(this._started=!0,this._delaying=!0,this._timeInms=0,this._callEnd=!1,this.ended=!1),this},ir.createContent=function(){return this._content||(this._content=this._createContent(this.composition)),this._content},ir.stop=function(){this._stop(),this._started=!1},ir.reset=function(){var e=this.composition;return this.composition&&(this.onItemRemoved(e,this._content),this._content=null),this._started=!1,this},ir.destroy=function(){this.composition&&(this.composition.destroyItem(this),this.reset(),this._onUpdate=function(){return-1},this.composition=null,this.transform=new Kt)},ir.onConstructed=function(e){},ir._stop=function(){this._content&&this._content.stop&&this._content.stop()},ir.onItemRemoved=function(e,t){},ir.onLifetimeBegin=function(e,t){},ir._createContent=function(e){},ir.onItemUpdate=function(e,t){},ir.getCurrentPosition=function(){var e=[0,0,0];return this.transform.getWorldTRS(e),e},ir._onUpdate=function(e){if(this._started&&!this.frozen){var t=(this._timeInms+=e)-this._delayInms,r=(this.transform.invalid(),this.composition);if(this._delaying&&0<=t&&(this._delaying=!1,n=this.composition,this.createContent(),this.onLifetimeBegin(n,this._content),r.itemLifetimeEvent(this,!0)),!this._delaying){var n=this.endBehavior,i=t/this._durInms,o=!0;if(this._isEnded(t))if(o=!1,this._callEnd||(this._callEnd=!0,r.itemLifetimeEvent(this,!1),this.onEnd()),2!==n&&5!==n){if(this.ended=!0,1===n||3===n?this.composition.pausePlayer(this):4===n&&(o=!0,i=1),this.reusable)0===n&&(this.hide=!0);else{if(0===n||3===n||6===n)return this.destroy();1===n&&(this.endBehavior=2)}i=Math.min(i,1)}else o=!0,5===n&&(this.ended=!0,i%=1);else this._callEnd&&this.reusable&&(this.hide=!1,this._callEnd=!1);this.lifetime=i,o&&this.onItemUpdate(e,i)}}},ir._isEnded=function(e){return.001<e-this._durInms},ir.onEnd=function(){},ir.getHitTestParams=function(e){},_(nr,[{key:"contentVisible",get:function(){return this._contentVisible&&!this._hide}},{key:"content",get:function(){return this._content},set:function(e){}},{key:"type",get:function(){return"0"},set:function(e){}},{key:"hide",get:function(){return this._hide},set:function(e){this._hide!=e&&this._onHideChanged(this._hide=!!e)}},{key:"frozen",get:function(){return this._frozen},set:function(e){this._onFrozenChanged(this._frozen=!!e)}},{key:"lifetimeStarted",get:function(){return this._started&&!this._delaying}}]);var rr=nr;function nr(e,t){if(this._v_priority=0,this._hide=!1,this._frozen=!1,this._contentVisible=!1,this.composition=t,this.id=e.id,this.name=e.name,this.reusable=t.willReverseTime,this.delay=e.delay,this.transform=new Kt(e.transform),this.parentId=e.parentId,this._timeInms=0,this.duration=e.duration||0,this._delayInms=1e3*(e.delay||0),this._durInms=1e3*this.duration,this.endBehavior=e.endBehavior,this.lifetime=-this._delayInms/this._durInms,this.listIndex=e.listIndex||0,this.transform.parentTransform=t.rootTransform,this.onConstructed(e),t=this.duration,this.transform.name=this.name,t<=0)throw Error("item duration "+t+" invalid,please see https://yuque.antfin.com/yf4elw/knaszl/wozlz0#vFPqF")}or.processRawJSONAsync=function(e,t){return Promise.resolve(void 0)},or.prepareResourceAsync=function(e,t){return Promise.resolve(void 0)},or.precompileAsync=function(e,t){return Promise.resolve()},or.onPlayerDestroyed=function(e){},or.onPlayerCreated=function(e){},(ir=or.prototype).onCompositionConstructed=function(e,t){},ir.onCompositionItemLifeBegin=function(e,t){},ir.onCompositionItemLifeEnd=function(e,t){},ir.onCompositionItemRemoved=function(e,t){},ir.onCompositionReset=function(e,t){},ir.onCompositionWillReset=function(e,t){},ir.onCompositionDestroyed=function(e){},ir.onCompositionUpdate=function(e,t){},ir.prepareRenderFrame=function(e,t){return!1},ir.postProcessFrame=function(e,t){};var ir=or;function or(){this.order=100}var ar={},sr={},ur=[];function lr(e,t,r,n){sr[e]=r,ar[e]=t,n&&N(ur,e)}function cr(e,t){F(ar,(function(r){(r=t?r.onPlayerCreated:r.onPlayerDestroyed)&&r(e)}))}function hr(e){delete sr[e],delete ar[e],P(ur,e)}(mr=dr.prototype).initializeComposition=function(e,t){this.plugins.forEach((function(r){return r.onCompositionConstructed(e,t)}))},mr.destroyComposition=function(e){this.plugins.forEach((function(t){return t.onCompositionDestroyed(e)}))},mr.resetComposition=function(e,t){this.plugins.forEach((function(r){return r.onCompositionReset(e,t)}))},mr.createPluginItem=function(e,t,r){var n=sr[e];if(!n)throw Error("plugin "+e+" no registered constructor");if((n=new n(t,r))instanceof rr)return n;throw Error("plugin "+e+" invalid constructor type")},mr.onPlayerDestroyed=function(e){for(var t=this.plugins,r=0;r<t.length;r++){var n=t[r];(n=ar[n.name]).onPlayerDestroyed&&n.onPlayerDestroyed(e)}},mr.processRawJSONAsync=function(e,t){return this.callStaticAsync("processRawJSONAsync",e,t)},mr.callStaticAsync=function(e){for(var t=[],r=this.plugins,n=arguments.length,i=new Array(1<n?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];for(var a=0;a<r.length;a++){var s=r[a];(s=ar[s.name])[e]&&t.push(Promise.resolve(s[e].apply(s,i)))}return Promise.all(t)},mr.precompileAsync=function(e,t){return this.callStaticAsync("precompileAsync",e,t)},mr.loadResourcesAsync=function(e,t){return this.callStaticAsync("prepareResourceAsync",e,t)};var fr=dr;function dr(e){var t={},r=[];function n(e){var n=ar[e];r.includes(n)||(r.push(n),t[e]=n)}ur.forEach(n),e.forEach(n),this.plugins=Object.keys(t).map((function(e){var t=ar[e];if(t)return(t=new t).name=e,t;throw Error("plugin:"+e+" not found, see link: "+o)})).sort((function(e,t){return e.order-t.order}))}E(vr,pr=rr),(mr=vr.prototype).onConstructed=function(e){this.model=e.content},mr._createContent=function(e){if(!this.delegate)return this.delegate=new er(this.composition,this.model,this.transform)},mr.getCurrentPosition=function(){return this.delegate.position},mr.onItemUpdate=function(e,t){this.delegate&&this.delegate.onItemUpdate(t,this.composition)},_(vr,[{key:"type",get:function(){return"6"},set:function(e){}}]);var pr,mr=vr;function vr(){return pr.apply(this,arguments)||this}E(Er,_r=ir);var _r,gr=Er;function Er(){return _r.apply(this,arguments)||this}var yr=function(e,t){return(yr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}))(e,t)},Tr=function(){return(Tr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function xr(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var Rr,Ar,br="[Mars RI]";function Or(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,xr([br+e],t,!1))}function Cr(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.error.apply(console,xr([br+e],t,!1))}(_n=Rr=Rr||{})[_n.destroy=0]="destroy",_n[_n.keep=1]="keep",_n[_n.force=0]="force",(_n=Ar=Ar||{})[_n.force=0]="force",_n[_n.keep=1]="keep",_n[_n.keepExternal=2]="keepExternal",_n[_n.destroy=0]="destroy",(_n=Sr=Sr||{})[_n.whatever=0]="whatever",_n[_n.clear=2]="clear",(_n=Ir=Ir||{})[_n.store=0]="store",_n[_n.clear=2]="clear",(_n=Lr=Lr||{})[_n.none=0]="none",_n[_n.color=1]="color",_n[_n.stencil_8_opaque=2]="stencil_8_opaque",_n[_n.depth_16_opaque=3]="depth_16_opaque",_n[_n.depth_stencil_opaque=4]="depth_stencil_opaque",_n[_n.depth_16_texture=5]="depth_16_texture",_n[_n.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",(_n=Mr=Mr||{})[_n.none=1]="none",_n[_n.ascending=2]="ascending",_n[_n.descending=3]="descending",(_n=wr=wr||{})[_n.none=0]="none",_n[_n.data=1]="data",_n[_n.image=2]="image",_n[_n.compressed=3]="compressed",_n[_n.video=4]="video",_n[_n.canvas=5]="canvas",_n[_n.framebuffer=6]="framebuffer",_n[_n.mipmaps=7]="mipmaps";var Sr,Ir,Lr,Mr,wr,Pr={};function Nr(e){for(var t in e)/^[A-Z_]/.test(t)&&(Pr[t]=e[t])}"function"==typeof WebGL2RenderingContext?Nr(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(Nr(WebGLRenderingContext),Nr(WebGLRenderingContext.prototype)):Cr("WebGL not in global"),Pr.HALF_FLOAT=5131,(_n={})[Pr.INT]=Int32Array,_n[Pr.FLOAT]=Float32Array,_n[Pr.SHORT]=Int16Array,_n[Pr.BYTE]=Int8Array,_n[Pr.UNSIGNED_BYTE]=Uint8Array,_n[Pr.UNSIGNED_INT]=Uint32Array,_n[Pr.UNSIGNED_SHORT]=Uint16Array;var Dr,Fr=_n;function Vr(e){return(null==(e=Fr[e])?void 0:e.BYTES_PER_ELEMENT)||0}(_n=Dr=Dr||{})[_n.noShader=0]="noShader",_n[_n.success=1]="success",_n[_n.fail=2]="fail",_n[_n.compiling=3]="compiling",Br.prototype.addShader=function(e,t){return""},Br.prototype.compileAllShaders=function(e){return[]},Br.prototype.deleteShader=function(e){},Br.prototype.compileShader=function(e){return{status:Dr.fail}},Br.prototype.destroy=function(){};var Ur=Br;function Br(){this.shaderResults={}}function kr(e){return"function"==typeof e}function zr(e){return"object"==typeof e&&e}function Gr(e,t){var r="string"==typeof e;return t?r&&0<e.length:r}function Xr(e,t){-1<(t=e.indexOf(t))&&e.splice(t,1)}function Hr(e,t){return!e.includes(t)&&(e.push(t),!0)}function Yr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=0,n=0;n<arguments.length;n++)for(var i=e[n],o=0;o<i.length;o++)r=Math.imul(31,r)+i.charCodeAt(o)|0;return r}function jr(e,t,r){if(r=r||Mr.ascending,!e.includes(t)&&(e.push(t),1!==e.length)&&r!==Mr.none){var n=e.length-1;if(n){var i=e[n];if(r!==Mr.ascending)for(;e[n-1].priority<i.priority&&(e[n]=e[n-1],0!=--n););else for(;e[n-1].priority>i.priority&&(e[n]=e[n-1],0!=--n););e[n]=i}}}function Wr(e,t){var r=t||Mr.ascending;if(0===e.length||1===e.length)return e;if(r===Mr.none)return e;if(e.length<=30){for(var n=e.length,i=1;i<n;i++){var o=e[i],a=i;if(r!==Mr.ascending)for(;1<=a&&e[a-1].priority<o.priority&&(e[a]=e[a-1],0!=--a););else for(;1<=a&&e[a-1].priority>o.priority&&(e[a]=e[a-1],0!=--a););e[a]=o}return e}return function e(t,r,n,i){var o,a;if(!((i=void 0===i?t.length-1:i)<=(n=void 0===n?0:n))){for(var s=n,u=i,l=t[n];s<u;){if(r===Mr.ascending){for(;t[u].priority>l.priority&&s<=u;)u--;for(;t[s].priority<=l.priority&&s<u;)s++}else{for(;t[u].priority<l.priority&&s<=u;)u--;for(;t[s].priority>=l.priority&&s<u;)s++}o=[t[u],t[s]],t[s]=o[0],t[u]=o[1]}a=[t[s],t[n]],t[n]=a[0],t[s]=a[1],e(t,r,n,s-1),e(t,r,u+1,i)}return t}(e,r)}var Zr=Object.prototype.hasOwnProperty;function qr(e,t,r){if(zr(e))for(var n in void 0===r&&(r=e),e)Zr.call(e,n)&&t.call(r,e[n],n)}function Kr(){throw Error("destroyed item cannot be used again")}Qr.render=function(e){var t=e._renderPasses,r=e.renderer;if(r.isDestroyed)return Cr("renderer is destroyed",r);e.renderer.shaderLibrary.compileAllShaders(),$r(r.internal,e.clearAction);for(var n={currentFrame:e},i=0;i<t.length;i++){var o=t[i],a=o.delegate;o.isDestroyed?Cr("render pass ".concat(o.name," destroyed"),o):(a.willBeginRenderPass&&null!=a&&a.willBeginRenderPass(o,n),this.renderRenderPass(r,o,n),a.didEndRenderPass&&null!=a&&a.didEndRenderPass(o,n))}},Qr.renderRenderPass=function(e,t,r){r.currentPass=t,n=e,(o=t).assignRenderer(n),n=n.internal,o.bind(),o.clearAction&&$r(n,o.clearAction);var n=t.camera,i=e,o=n,a=r;a.currentCamera=o;for(var s=a.currentPass.meshes,u=a.currentPass.delegate,l=0;l<s.length;l++){var c=s[l];c.isDestroyed?Cr("mesh ".concat(c.name," destroyed"),c):c.hide||(u.willRenderMesh&&u.willRenderMesh(c,a),function(e,t,r){(r.currentMesh=t).material.assignRenderer(e);var n,i=t.material.materialInternal;i&&(n=i.getProgram())&&(i.setupStates(),n.setupUniforms(r),t.geometries.forEach((function(t){t.assignRenderer(e),t.flush();var i=n.setupAttributes(t.internal);t.internal.draw(r),i&&i.unbind()})))}(i,c,a),u.didiRenderMesh&&u.didiRenderMesh(c,a))}for(l=0;l<s.length;l++){var h=s[l].material;h&&h.dataBlocks.forEach((function(e){return e.clearFlags()}))}n=e,(r=t).storeAction&&$r(n.internal,r.storeAction),r.unbind()};var Jr=Qr;function Qr(){}function $r(e,t){e=e.state;var r,n=0;t.colorAction===Sr.clear&&((r=t.clearColor)&&e.clearColor(r[0],r[1],r[2],r[3]),e.colorMask(!0,!0,!0,!0),n=Pr.COLOR_BUFFER_BIT),t.stencilAction===Sr.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),n|=Pr.STENCIL_BUFFER_BIT),t.depthAction===Sr.clear&&(r=t.clearDepth,e.depthMask(!0),e.clearDepth(Number.isFinite(r)?r:1),n|=Pr.DEPTH_BUFFER_BIT),n&&e.clear(n)}tn.prototype.toObject=function(){return Object.assign({},this.semantics)},tn.prototype.setSemantic=function(e,t){void 0===t?delete this.semantics[e]:this.semantics[e]=t},tn.prototype.getSemanticValue=function(e,t){return kr(e=this.semantics[e])?e(t)