tencentcloud-webar 1.0.26-9 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var self = wx;(self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[321],{6237:(e,t,i)=>{i.d(t,{g:()=>le,b:()=>ue});var n,r=i(337),o=i(3044),s=i(3650),a=i(1206),c=i(617),h=i(9560),u=i(1084),l=i(3849),p=i(1347),f=(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),d=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},y=function(){function e(e,t,i,n,r,o){this._destroyed=!1,this.type="makeup",this._parentIntensity=1,this._jsonIntensity=1,this.textures=[],this._dir=t,this._options=e,this._container=i,this._lipMaskTexture=o,this.renderer=n,this.type=r||"makeup"}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this.shader&&(this.shader.uniforms.parentIntensity=e);this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipMask",{set:function(e){null===e?(this._mesh.removeChild(this._cacheMask),this._mesh.mask=e):(this._mesh.addChild(e),this._mesh.mask=e,this._cacheMask=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{set:function(e){this.shader&&(this.shader.uniforms.enable=e?1:0)},enumerable:!1,configurable:!0}),e.prototype.updateGeometry=function(e){this._destroyed},e.prototype.renderMesh=function(){},e.prototype.resize=function(e,t){this._options.width=e,this._options.height=t,this.shader&&(this.shader.uniforms.size=[e,t])},e.prototype.drawMeshBatch=function(e,t){var i=this;if(!this._destroyed){var n=Array.from(e.reduce((function(e,t){return e.add(t.blend),e}),new Set));this.irisRenderTexture&&!n.includes(this.irisBlendMode)&&n.push(this.irisBlendMode);var r="\n precision mediump float;\n varying vec2 vUvs;\n varying vec2 bUvs;\n \n\n ".concat(e.map((function(e,t){return"uniform sampler2D uSamplerMakeup".concat(t,";")})).join("\n"),"\n ").concat(e.map((function(e,t){return"uniform float intensity".concat(t,";")})).join("\n"),"\n uniform float parentIntensity;\n uniform int enable;\n uniform sampler2D baseImage;\n \n uniform sampler2D uSamplerIris;\n\n // uniform int mirror;\n uniform vec2 imageOffset;\n \n ").concat(n.map((function(e){return h.Lc[e].shader})).join("\n"),"\n \n void main() {\n if (enable == 0) {\n gl_FragColor = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n // todo:适配镜像与非镜像\n vec2 baseCoord = bUvs;\n baseCoord += imageOffset;\n // if (mirror == 1) {\n // baseCoord = vec2(1.0 - bUvs.x, bUvs.y);\n // }\n vec4 baseColor = texture2D(baseImage, baseCoord);\n\n vec4 makeupColor = vec4(0.0);\n\n ").concat(e.map((function(e,t){return"\n \n vec4 color".concat(t," = texture2D(uSamplerMakeup").concat(t,", vUvs);\n float a").concat(t," = color").concat(t,".a;\n float realIntensity").concat(t," = intensity").concat(t," * parentIntensity;\n makeupColor = texture2D(uSamplerMakeup").concat(t,", vUvs) * realIntensity").concat(t,";\n if (makeupColor.a>0.) {\n // 混合\n baseColor.rgb = blend").concat(h.Lc[e.blend].key,"(baseColor.rgb, makeupColor.rgb/makeupColor.a , makeupColor.a);\n }\n \n \n \n\n ")})).join("\n"),"\n\n ").concat(this.irisRenderTexture?"\n // 混合美瞳\n vec4 irisColor = texture2D(uSamplerIris, bUvs);\n if (irisColor.a > 0.) {\n baseColor.rgb = blend".concat(h.Lc[this.irisBlendMode].key,"(baseColor.rgb, irisColor.rgb/irisColor.a , irisColor.a);\n }\n "):"","\n \n \n\n // 输出\n gl_FragColor = baseColor;\n }"),o={enable:1};o.parentIntensity=this.parentIntensity;var s=this._options,c=s.width,u=s.height;o.baseImage=ue.baseTexture,o.size=[c*u/ue.baseTexture.height,u];var p=ue.baseTexture.width*u/ue.baseTexture.height;o.imageOffset=[(p-c)/2/p,0],e.forEach((function(e,t){var n="default"===i._dir?e.src:"".concat(i._dir,"|").concat(e.src),r=a.P6.kN[n];o["uSamplerMakeup".concat(t)]=r,o["intensity".concat(t)]=e.intensity,i.textures.push(r)})),this.irisRenderTexture&&(o.uSamplerIris=this.irisRenderTexture);var f=a.ex.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n uniform vec2 size;\n varying vec2 vUvs;\n varying vec2 bUvs;\n\n \n void main() {\n vUvs = aUvs;\n bUvs = aVertexPosition.xy /size;\n // lipUvs = lipAuvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }",r,o);this.shader=f,l.t.instance.on("mirrorChange",(function(e){}));var d=new a.Kj(t,f);return this._mesh=d,this._container.addChild(d),d}},e.prototype.destroy=function(){this._destroyed=!0,this._mesh&&(this._mesh.destroy({children:!0,texture:!1,baseTexture:!1}),this._mesh.mask=null,this._mesh=null),this._maskRenderTexure&&this._maskRenderTexure.destroy(!1)},d([(0,u.M)("MakeupLayer"),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",void 0)],e.prototype,"updateGeometry",null),d([(0,u.M)("MakeupLayer"),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",void 0)],e.prototype,"destroy",null),e}(),b=function(e){function t(t,i,n,r,o,s,c){var h=e.call(this,t,i,c)||this;return h._maskGraphics=new a.TC,h.maxLConSize=0,h.maxRConSize=0,h._parentIntensity=1,h.jsonIntensity=o,h.getTexture(n,r),h._config=s,h.renderTexture=a.TI.create({width:t.width,height:t.height}),h}var i,n;return f(t,e),Object.defineProperty(t.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._container&&(this._container.alpha=this.jsonIntensity*e),this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visible",{set:function(e){this._container.visible=e},enumerable:!1,configurable:!0}),t.prototype.getTexture=function(e,t){var i="default"===this._dir?e:"".concat(this._dir,"|").concat(e),n=a.P6.kN[i],r=new a.jy(n),o=new a.jy(n.clone());r.anchor.set(.5),o.anchor.set(.5),this._leftIris=r,this._rightIris=o;var s=new a.W2;this._maskGraphics||(this._maskGraphics=new a.TC),s.addChild(this._maskGraphics),s.addChild(r),s.addChild(o),s.alpha=this.parentIntensity*this.jsonIntensity,s.mask=this._maskGraphics,this._container=s},t.prototype.setIrisProps=function(e,t){if(e.length){var i=this._config.getConfigByKeys(["POINTS_MAP","LEFT_IRIS","RIGHT_IRIS","LEFT_EYE_ORDER","RIGHT_EYE_ORDER"]),n=i.POINTS_MAP,r=(i.LEFT_IRIS,i.RIGHT_IRIS,i.LEFT_EYE_ORDER),o=i.RIGHT_EYE_ORDER,s=(n.left_eye_center,n.right_eye_center,(0,p.Sp)(e[52],e[55])),a=(0,p.Sp)(e[58],e[61]),c=Math.max(this.maxLConSize,(0,p.Sp)(e[72],e[73])/s),h=Math.max(this.maxRConSize,(0,p.Sp)(e[75],e[76])/a),u=s*c,l=s*c,f=a*h,d=a*h;this.maxLConSize=Math.max(Math.min(c,.7),.4),this.maxRConSize=Math.max(Math.min(h,.7),.4);var _=ue.baseTexture.width*this._options.height/ue.baseTexture.height,y=(0,p.qg)(e[74],e[104]),b=(0,p.qg)(e[77],e[105]);y.x-=(_-this._options.width)/2,b.x-=(_-this._options.width)/2;var m=this._leftIris,v=this._rightIris;m.width=u*(this._options.irisScale||1),m.height=l*(this._options.irisScale||1),m.x=y.x,m.y=y.y,v.width=f*(this._options.irisScale||1),v.height=d*(this._options.irisScale||1),v.x=b.x,v.y=b.y,this._maskGraphics.clear(),this._drawMaskGraphics(r,e),this._drawMaskGraphics(o,e),t.render(this._container,{renderTexture:this.renderTexture})}},t.prototype._drawMaskGraphics=function(e,t){var i=this,n=this._maskGraphics;n.beginFill(16724736),n.lineStyle(1,16767232,1);var r=[];e.forEach((function(o,s){var a=t[o],c=i._getPixelPosition(a.x,a.y),h=c.x,u=c.y;r.push({x:h,y:u}),0===s?n.moveTo(h,u):s===e.length-1?(n.closePath(),n.endFill()):n.lineTo(h,u)}))},t.prototype._getPixelPosition=function(e,t){return{x:e,y:t}},t.prototype.resize=function(t,i){e.prototype.resize.call(this,t,i),this.renderTexture.resize(t,i)},t.prototype.destroy=function(){this._leftIris&&this._leftIris.destroy({children:!0,texture:!1,baseTexture:!1}),this._rightIris&&this._rightIris.destroy({children:!0,texture:!1,baseTexture:!1}),this._maskGraphics&&this._maskGraphics.destroy({children:!0,texture:!1,baseTexture:!1})},d([(0,u.M)("IrisLayer"),_("design:type",Function),_("design:paramtypes",["function"==typeof(i="undefined"!=typeof Array&&Array)?i:Object,"function"==typeof(n=void 0!==a.Th&&a.Th)?n:Object]),_("design:returntype",void 0)],t.prototype,"setIrisProps",null),t}(y),m=i(3120),v=i(6109),g=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},k=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},x=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},w=function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},S=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},M=(0,v.jl)("makeup"),T=function(){function e(e,t,i){e&&(this._options=e),t&&(this._lipVertex=t),i&&(this.renderer=i)}return e.prototype.destroy=function(){var e=this._lipMask;this._lipMask=null;try{e.destroy(!0)}catch(e){}try{this._lipMaskMesh.destroy(!0),this._lipMaskMesh=null}catch(e){}try{this._maskRenderTexture.destroy(!0),this._maskRenderTexture=null}catch(e){}this._config=null;try{this._maskSprite.destroy(!0),this._maskSprite=null}catch(e){}},e.prototype.load=function(){return x(this,void 0,void 0,(function(){var e,t,i,n,r;return w(this,(function(o){switch(o.label){case 0:return this._config?[3,2]:(this._config=new c.M,[4,this._config.load()]);case 1:o.sent(),o.label=2;case 2:return this._lipMask?[3,4]:[4,this._getMask()];case 3:o.sent(),o.label=4;case 4:return this._maskSprite&&!this._maskSprite.destroyed||(e=this._options,t=e.width,i=e.height,n=new a.jd({width:t,height:i}),this._maskRenderTexture=new a.TI(n),r=new a.jy(this._maskRenderTexture),this._maskSprite=r),[2,{maskSprite:this._maskSprite,lipmask:this._lipMask,lipmaskmesh:this._lipMaskMesh}]}}))}))},e.prototype.update=function(e){this._lipMaskMesh&&(this._lipMaskMesh.geometry.getBuffer("aVertexPosition").update(e),this.render())},e.prototype.render=function(){this.renderer&&this._lipMask&&this.renderer.render(this._lipMask,{renderTexture:this._maskRenderTexture})},e.prototype._getMask=function(){return x(this,void 0,void 0,(function(){var e,t,i,n,r,o,s,c,h;return w(this,(function(u){switch(u.label){case 0:return this._lipMask?[2,this._lipMask]:(e=new a.W2,(t=new a.jy(a.xE.WHITE)).width=this._options.width,t.height=this._options.height,e.addChild(t),i=this._lipVertex,n=this._config.getDataConfig(29),[4,this._loadLipImage()]);case 1:return r=u.sent(),o=(new a.wG).addAttribute("aVertexPosition",i).addAttribute("aUvs",n),"\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n\n \n void main() {\n gl_FragColor = texture2D(uSamplerMakeup, vUvs);\n }",s={uSamplerMakeup:r},c=a.ex.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n\n \n void main() {\n gl_FragColor = texture2D(uSamplerMakeup, vUvs);\n }",s),h=new a.Kj(o,c),this._lipMaskMesh=h,e.addChild(h),this._lipMask=e,[2,e]}}))}))},e.prototype._loadLipImage=function(){return x(this,void 0,Promise,(function(){var e=this;return w(this,(function(t){return[2,new Promise((function(t,i){return x(e,void 0,void 0,(function(){var e,i,n;return w(this,(function(r){switch(r.label){case 0:return[4,(e=new m.KI).init()];case 1:return i=r.sent(),[4,e.loadImage(i)];case 2:return n=r.sent(),t(n[m.X_]),[2]}}))}))}))]}))}))},g([(0,u.M)("ReuseableLipMask"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",void 0)],e.prototype,"destroy",null),g([(0,u.o)("ReuseableLipMask"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",Promise)],e.prototype,"_getMask",null),e}(),P=function(){function e(e,t,i,n,r,o,s,c){void 0===c&&(c=1),this._container=new a.W2,this._makeupMeshes=[],this._visible=!0,this.mouthShut=!0,this._applyed=!1,this._key=e,this._data=t,this._options=i,this.mesh=n,this.lipmesh=o,this.faceLandMarks=r,this.renderer=s,this.parentIntensity=c;var h=new a.jy(a.xE.WHITE);h.alpha=0,h.width=i.width,h.height=i.height,this._container.addChild(h)}var t;return Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){var t=this;this._target&&e!==this._visible&&(this._visible=e,this._makeupMeshes.forEach((function(i){e?t.apply(t._target):t.remove()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{set:function(e){(this._meshVertex=e,this.geometry)&&(this.geometry.getBuffer("aVertexPosition").update(e),this._makeupMeshes.forEach((function(t){t.updateGeometry(e)})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._lipVertex=e,this._lipMaskIns&&this._lipMaskIns.update(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){var t=this;e&&e.length&&(this._irises&&this._irises.setIrisProps(e,this.renderer),(0,p.Sp)(e[98],e[102])<.03*(0,p.Sp)(e[0],e[32])?this.mouthShut||(this._makeupMeshes.forEach((function(e){"lips"===e.type&&(e.lipMask=null)})),this.mouthShut=!0):this.mouthShut&&(this._makeupMeshes.forEach((function(e){"lips"===e.type&&t._lipMaskIns&&(e.lipMask=t._lipMaskIns._maskSprite)})),this.mouthShut=!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._intensity},set:function(e){this._irises&&(this._irises.parentIntensity=e),this._makeupMeshes.forEach((function(t){t.parentIntensity=e})),this._intensity=e},enumerable:!1,configurable:!0}),e.prototype.renderMesh=function(){this._lipMaskIns&&this._lipMaskIns.render(),this._makeupMeshes.forEach((function(e){e.renderMesh()}))},e.prototype.load=function(){return x(this,void 0,void 0,(function(){var e,t,i,n,r,o,s,a;return w(this,(function(h){switch(h.label){case 0:return this._config=new c.M,[4,this._config.load()];case 1:if(h.sent(),e=this._data,M.info("makeup info",this._data),t=[],e&&e.length){try{for(i=S(e),n=i.next();!n.done;n=i.next())"iris"===(r=n.value).type?(this._irises=this._getIris(r.src,r.blend,r.intensity),this.irisBlendMode=r.blend):(r.blend+"",t.push({src:r.src,intensity:r.intensity,type:r.type,blend:r.blend}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}}M.info("makeupLayersByBlendMode",t),o=this._getMeshLayerByBlendMode(t),this._makeupMeshes.push(o)}return[4,this._initLipMask()];case 2:return h.sent(),[2]}}))}))},e.prototype._getIris=function(e,t,i){return new b(this._options,this._key,e,t,i,this._config,this._container)},e.prototype._getMeshLayerByBlendMode=function(e){var t=e.some((function(e){return"lips"===e.type}))?"lips":"makeup",i=new y(this._options,this._key,this._container,this.renderer,t);i.parentIntensity=this.parentIntensity,this._irises&&(i.irisRenderTexture=this._irises.renderTexture.baseTexture,i.irisBlendMode=this.irisBlendMode);var n=this._config.getDataConfig(26);if(!this.geometry){var r=(new a.wG).addAttribute("aVertexPosition",this._meshVertex).addAttribute("aUvs",n);this.geometry=r}return i.drawMeshBatch(e,this.geometry),i},e.prototype.resize=function(e,t){this._makeupMeshes.forEach((function(i){i.resize(e,t)})),this._irises&&this._irises.resize(e,t)},e.prototype.apply=function(e){this._target=e,this._applyMakeup(e)},e.prototype.remove=function(){this._removeMakeup(this._target)},e.prototype._applyMakeup=function(e){this._applyed||(this._applyed=!0,e.filters||(e.filters=[]),e.addChild(this._container))},e.prototype._removeMakeup=function(e){this._applyed&&(this._applyed=!1,e.filters&&e.removeChild(this._container))},e.prototype._initLipMask=function(){return x(this,void 0,void 0,(function(){var e,t,i=this;return w(this,(function(n){switch(n.label){case 0:return(e=new T(this._options,this._lipVertex,this.renderer))._options=this._options,e._lipVertex=this._lipVertex,e.renderer=this.renderer,this._lipMaskIns=e,[4,e.load()];case 1:return t=n.sent().maskSprite,this._makeupMeshes.forEach((function(e){"lips"!==e.type||i.mouthShut||(e.lipMask=t)})),[2]}}))}))},e.prototype.destroy=function(){this.remove(),this._makeupMeshes.forEach((function(e){return e.destroy()})),this._makeupMeshes=[],this._irises&&this._irises.destroy(),this._irises=null,this._container.destroy(),this._target=null,this._lipMaskIns&&this._lipMaskIns.destroy()},g([(0,u.M)("Makeup"),k("design:type",Function),k("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),k("design:returntype",void 0)],e.prototype,"_removeMakeup",null),g([(0,u.M)("Makeup"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",void 0)],e.prototype,"destroy",null),e}(),C=i(3125),E=i(401),j=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},I=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},O=function(){function e(e,t,i,n,r,o,s,c){this._container=new a.W2,this._name=e,this._src=t,this._target=n,this._config=i,this._jsonIntensity=i.intensity,this._landmarks=r,this._options=o,this._key=s,this._angles=c}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._parentIntensity=e,this._sticker&&(this._sticker.alpha=this._jsonIntensity*e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){this._landmarks=e,this._sticker&&this.setStickerProps()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._angles=e,this._sticker&&this.setStickerProps()},enumerable:!1,configurable:!0}),e.prototype.getCircle=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},e.prototype.getCircle2=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(255),t.drawCircle(0,0,e),t.endFill(),t},e.prototype.getDisplay=function(){return this._container},e.prototype.load=function(){var e,t=this;if(this.checkAnimated()){var i=[];this._src.forEach((function(e){var n;n=e.indexOf(".json")>-1?e:"".concat(t._key,"|").concat(JSON.parse(e).meta.image);var r=o.iV[n].textures,s=Object.keys(r).map((function(e){return r[e]}));i=i.concat(s)})),(e=new h.Kg(i)).animationSpeed=(this._config.fps||30)/60,e.play()}else{var n=this._src[0],r=a.P6.kN[n];e=new h.jy(r)}this._config.blend&&(e.blendMode_1=this._config.blend);this._config.wxAnchorOffset;e.width=this._config.width,e.height=this._config.height;var s=[.5,.5];this._config.anchor&&(s=this._config.anchor),e.anchor.set(s[0],s[1]),e.alpha=this._jsonIntensity*this.parentIntensity,this._sticker=e,this._container.addChild(this._sticker),this._container.convertTo3d(),this.setStickerProps()},e.prototype.setStickerProps=function(){var e=this._config,t=this._landmarks,i=E.Jp.map((function(e){return t[e]})),n=(0,p.Sp)(i[0],i[1]),r=e.wxAnchorArea,o=(e.wxAnchorOffset,e.wxWeights),s=n/E.jw,a=r.map((function(e){var i=t[e];return{x:i.x,y:i.y,z:0}}));this._container.scale.set(s);var c={x:a[0].x*o[0]+a[1].x*o[1]+a[2].x*o[2],y:a[0].y*o[0]+a[1].y*o[1]+a[2].y*o[2]};this._container.position.x=c.x,this._container.position.y=c.y,this._angles&&(this._container.euler.z=this._angles.roll,this._container.euler.y=this._angles.yaw,this._container.euler.x=this._angles.pitch)},e.prototype.checkAnimated=function(){if(this._src instanceof Array&&this._src.length>1)return!0;try{return JSON.parse(this._src[0]),!0}catch(e){return"json"===this._src[0].split(".").pop()}},e.prototype.tick=function(){},e.prototype.apply=function(){},e.prototype.remove=function(){},e.prototype.destroy=function(){this._sticker.destroy(),this._container.destroy(),this._sticker=null,this._target=null},j([(0,u.M)("StickerLayer"),I("design:type",Function),I("design:paramtypes",[]),I("design:returntype",Boolean)],e.prototype,"checkAnimated",null),j([(0,u.M)("StickerLayer"),I("design:type",Function),I("design:paramtypes",[]),I("design:returntype",void 0)],e.prototype,"destroy",null),e}(),R=function(){function e(e,t,i,n,r,o,s){void 0===s&&(s=1);var a=this;this._stickers=[],this._visible=!0,this._parentIntensity=1,this._target=i,this._options=r,this._landmarks=n;var c=new C.LE;c.setPlanes(400,10,1e4,!0),this._camera=c,this._stickers=t.map((function(t){var s=new O(t.name,t.src,t,i,n,r,e,o);return s.parentIntensity=a.parentIntensity,s.load(),a._camera.addChild(s.getDisplay()),s}))}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._stickers.forEach((function(t){t.parentIntensity=e})),this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){this._stickers.forEach((function(t){t.faceLandMarks=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._stickers.forEach((function(t){t.angles=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._target&&e!==this._visible&&(this._visible=e,e?this.apply():this.remove())},enumerable:!1,configurable:!0}),e.prototype.tick=function(){this._stickers.forEach((function(e){return e.tick()}))},e.prototype.apply=function(){this._target.addChild(this._camera)},e.prototype.remove=function(){this._target.removeChild(this._camera)},e.prototype.destroy=function(){this.remove(),this._stickers.forEach((function(e){return e.destroy()})),this._camera.destroy(),this._stickers=[]},e}(),F=i(6878),L=i(6879),V=i(201),A=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(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)}}(),N=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},U=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},z=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},D=function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},G=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},H=(0,v.jl)("Effect"),B=function(){function e(e,t,i,n,r,o,s,a,c,h,u){this.type="face",this._filters=[],this._destroyed=!1,this._visible=!0,this._intensity=1,this._filterIntensity=1,this.localSpriteSheets={},this._filtersActived=!0,this._target=t,this._stickerTarget=i,this._url=e,this._key=e,this._options=r,this.mesh=o,this.lipmesh=a,this.faceLandMarks=s,c&&(this.angles=c),void 0!==h&&(this.intensity=h),this._app3d=n,this._canvas=u}var t;return Object.defineProperty(e.prototype,"isPureFilter",{get:function(){var e=this._config;return!!e&&((!e.makeup||!e.makeup.length)&&((!e.sticker||!e.sticker.length)&&((!e.sticker3d||!e.sticker3d.length)&&(!e.beautify||!Object.keys(e.beautify).find((function(t){return!!e.beautify[t]}))))))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filterActived",{get:function(){return this._filtersActived},set:function(e){e!==this._filtersActived&&(this._filterTarget&&(e?this._applyFilter(this._filterTarget):this._removeFilter(this._filterTarget)),this._filtersActived=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app3d",{get:function(){return this._app3d},set:function(e){this._app3d=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(e){e>1&&(F.Nd.trigger("error",{message:r.Z.t("0015"),code:L.U.SET_INTENSITY_ERROR}),e=1),null!=e&&(this._makeup&&(this._makeup.parentIntensity=e),this._sticker&&(this._sticker.parentIntensity=e),this._intensity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filterIntensity",{get:function(){return this._filterIntensity},set:function(e){null!=e&&(this._filters&&this._filters.forEach((function(t){t.uniforms.parentIntensity=e})),this._filterIntensity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._destroyed||(this._visible=e,this._makeup&&(this._makeup.visible=e),this._sticker&&(this._sticker.visible=e),this._app3d&&(this._app3d.visible=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{set:function(e){this._destroyed||(this._meshVertex=e,this._makeup&&(this._makeup.mesh=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._destroyed||(this._lipVertex=e,this._makeup&&(this._makeup.lipmesh=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{get:function(){return this._faceLandMarks},set:function(e){this._destroyed||(this._faceLandMarks=e,this._makeup&&(this._makeup.faceLandMarks=e),this._sticker&&(this._sticker.faceLandMarks=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._angles=e,this._sticker&&(this._sticker.angles=e)},enumerable:!1,configurable:!0}),e.prototype.download=function(){return z(this,void 0,Promise,(function(){var e;return D(this,(function(t){switch(t.label){case 0:return[4,this._getLoader()];case 1:return[4,t.sent().preload(this._url)];case 2:return t.sent(),[4,this._getConfig()];case 3:return e=t.sent(),v.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return z(this,void 0,Promise,(function(){var e,t,i,n,r,o;return D(this,(function(s){switch(s.label){case 0:return[4,this.download()];case 1:return e=s.sent(),t=e.filter,i=e.makeup,n=e.beautify,r=e.sticker,o=e.sticker3d,[4,this._loadImages(e)];case 2:return s.sent(),this.loadFilter(t),[4,this.setMakeup(i)];case 3:return s.sent(),r?[4,this.loadStickers(r)]:[3,5];case 4:s.sent(),s.label=5;case 5:return[4,this.load3d(o)];case 6:return s.sent(),this.sticker3d=o,[4,this._getLoader()];case 7:return s.sent().removeFromCache(this._url),[2,n]}}))}))},e.prototype._getLoader=function(){return z(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new o.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return z(this,void 0,void 0,(function(){var e;return D(this,(function(t){switch(t.label){case 0:return this._config?[3,3]:[4,this._getLoader()];case 1:return[4,(e=t.sent()).preload(this._url)];case 2:t.sent(),this._config=e.readJSON("content.json",this._key),t.label=3;case 3:return[2,this._config]}}))}))},e.prototype.hasEyeMakeup=function(){return z(this,void 0,Promise,(function(){var e,t,i,n,r,o,s,a;return D(this,(function(c){switch(c.label){case 0:return[4,this._getConfig()];case 1:e=c.sent(),t=e.makeup,i=!1;try{for(n=G(t),r=n.next();!r.done;r=n.next())if("iris"===(o=r.value).type||"eyes"===o.type){i=!0;break}}catch(e){s={error:e}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}}return[2,i]}}))}))},e.prototype.needDetection=function(){return z(this,void 0,Promise,(function(){var e,t,i,n;return D(this,(function(r){switch(r.label){case 0:return[4,this._getConfig()];case 1:return e=r.sent(),t=e.makeup,i=e.sticker,n=e.sticker3d,[2,t&&t.length||i&&i.length||n&&n.length]}}))}))},e.prototype.hasFilter=function(){return z(this,void 0,Promise,(function(){var e,t;return D(this,(function(i){switch(i.label){case 0:return[4,this._getConfig()];case 1:return e=i.sent(),[2,!(!(t=e.filter)||!t.length)]}}))}))},e.prototype.loadStickers=function(e){return z(this,void 0,Promise,(function(){var t;return D(this,(function(i){return e.length?((t=new R(this._key,e,this._stickerTarget,this.faceLandMarks,this._options,this._angles)).parentIntensity=this.intensity,this._sticker=t,[2]):[2,Promise.resolve()]}))}))},e.prototype.loadSticker3d=function(e){return void 0===e&&(e=[]),z(this,void 0,Promise,(function(){return D(this,(function(e){return[2]}))}))},e.prototype.load3d=function(e){return z(this,void 0,void 0,(function(){return D(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return z(this,void 0,void 0,(function(){return D(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.setMakeup=function(e){return e.length?(this._makeup=new P(this._key,e,this._options,this._meshVertex,this.faceLandMarks,this._lipVertex,this.renderer,this.intensity),this._makeup.load()):Promise.resolve()},e.prototype.resize=function(e,t){this._makeup&&this._makeup.resize(e,t)},e.prototype.apply=function(e){this._destroyed||this._applyed||(this.filterActived&&this._applyFilter(e.filterTarget),this._filters.length&&e.filterCallback&&e.filterCallback(),this._filterTarget=e.filterTarget,this._makeup&&this._makeup.apply(this._target),this._sticker&&this._sticker.apply(),this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(){this._makeup&&this._makeup.remove(),this._sticker&&this._sticker.remove(),this.removeForConsole(),this._removeFilter(this._filterTarget),this._applyed=!1},e.prototype.tick=function(){this._sticker&&this._sticker.tick()},e.prototype.tickMesh=function(){this._makeup&&this._makeup.renderMesh()},e.prototype.destroy=function(){this._destroyed=!0,this.remove(),this._makeup&&(this._makeup.destroy(),this._makeup=null),this._sticker&&(this._sticker.destroy(),this._sticker=null),this.destroyForConosle(),this._filters=[],this.clearTexture()},e.prototype.loadFilter=function(e){var t=this;this._destroyed||e&&e.length&&e.forEach((function(e){var i=t._createFilterSync(e.src,e.intensity,t.filterIntensity);t._filters.push(i)}))},e.prototype._applyFilter=function(e){e.filters||(e.filters=[]),e.filters=this._filters.concat(e.filters)},e.prototype._removeFilter=function(e){e&&e.filters&&e.filters.length&&this._filters.forEach((function(t){var i=e.filters.findIndex((function(e){return e===t}));i>-1&&e.filters.splice(i,1)}))},e.prototype._createFilterSync=function(e,t,i){var n="default"===this._key?e:"".concat(this._key,"|").concat(e),r=a.P6.kN[n];return r.baseTexture.scaleMode=a.aH.LINEAR,r.baseTexture.mipmap=a.KI.OFF,new s.f("lut",this._options,{uniforms:{lut:r,intensity:t,parentIntensity:i}})},e.prototype.clearTexture=function(){for(var e in a.P6.kN)if(e.indexOf(this._key)>-1){var t=a.P6.kN[e];a.xE.removeFromCache(t),t.destroy(!0)}for(var e in this.localSpriteSheets)o.iV[e]&&o.iV[e]instanceof a.c2&&(o.iV[e].destroy(),delete o.iV[e])},e.prototype._loadImages=function(e){var t,i,n=this,r=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),s=this._loader.getIndeLoader(),c={};this.localSpriteSheets=c;try{for(var h=G(r),u=h.next();!u.done;u=h.next()){var l=u.value;if(l.src instanceof Array)l.src.forEach((function(e,t){var i=n.checkSpriteSheetJSON(e);if(i){var r=i.meta.image,o="".concat(n._key,"|").concat(r);if(a.P6.kN[o])return;if(0===r.indexOf("blob:")){var h=a.xE.from(r);a.xE.addToCache(h,o)}else s.add(o,r);i.meta.image="",c[o]=i}else{if(a.P6.kN[e])return;if(s.resources[e])return;s.add(e,e)}}));else{var p="".concat(this._key,"|").concat(l.src);if(a.P6.kN[p])continue;if(0===l.src.indexOf("blob:")){var f=a.xE.from(l.src);a.xE.addToCache(f,p)}else s.add(p,l.src)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=h.return)&&i.call(h)}finally{if(t)throw t.error}}return new Promise((function(e){s.load((function(t,i){return z(n,void 0,void 0,(function(){var t,n,r,s,h;return D(this,(function(u){switch(u.label){case 0:for(r in t=function(e){var t;return D(this,(function(i){switch(i.label){case 0:return o.iV[e]?[2,"continue"]:c[e]?(t=new a.c2(a.P6.kN[e],c[e],"@".concat((0,V.u)(),"x")),[4,new Promise((function(i){t.parse((function(){o.iV[e]=t,i()}))}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))},n=[],a.P6.kN)n.push(r);s=0,u.label=1;case 1:return s<n.length?(h=n[s],[5,t(h)]):[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:for(h in i)o.iV[h]||c[h]||(o.iV[h]=i[h]);return e(),[2]}}))}))}))}))},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},N([(0,u.M)("Effect"),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"remove",null),N([(0,u.M)("Effect"),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"destroy",null),N([(0,u.M)("Effect"),U("design:type",Function),U("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),U("design:returntype",void 0)],e.prototype,"_removeFilter",null),e}(),J=function(e){function t(t,i,n,r,o,s,a,c){var h=e.call(this,"default",i,n,r,o,s,a,c)||this;return h._json=t,h._app3d=r,h}return A(t,e),t.prototype.load=function(){return z(this,void 0,Promise,(function(){var e,t,i,n,r,o;return D(this,(function(s){switch(s.label){case 0:return e=this._json,t=e.filter,i=e.makeup,n=e.beautify,r=e.sticker,o=e.sticker3d,[4,this._loadImages(e)];case 1:return s.sent(),this.loadFilter(t),[4,this.setMakeup(i)];case 2:return s.sent(),r?[4,this.loadStickers(r)]:[3,4];case 3:s.sent(),s.label=4;case 4:return o?this._app3d?[3,6]:[4,this.initThreeApp()]:[3,8];case 5:s.sent(),s.label=6;case 6:return[4,this.loadSticker3d(o||[])];case 7:s.sent(),s.label=8;case 8:return[2,n]}}))}))},t.prototype.loadImage=function(){return z(this,void 0,void 0,(function(){return D(this,(function(e){return[2]}))}))},t.prototype._loadImages=function(e){var t,i,n=this,r=new a.aN,s=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),c={},h=function(e){if(e.src instanceof Array)e.src.forEach((function(t,i){var o=n.checkSpriteSheetJSON(t);if(o){var s=o.meta.image,h="".concat(n._key,"|").concat(s);if(a.P6.kN[h])return;if(e.objectSrc&&e.objectSrc.length){var u=a.xE.from(e.objectSrc[i]);a.xE.addToCache(u,h)}else if(0===s.indexOf("blob:")){u=a.xE.from(s);a.xE.addToCache(u,h)}else r.add(h,s);o.meta.image="",c[h]=o}else{if(a.P6.kN[t])return;if(r.resources[t])return;if(e.objectSrc&&e.objectSrc.length){u=a.xE.from(e.objectSrc[i],{resolution:(0,V.u)()});a.xE.addToCache(u,t)}else r.add(t,t)}}));else{if(a.P6.kN[e.src])return"continue";if(r.resources[e.src])return H.info("already loaded file",e.src),"continue";if(e.objectSrc){H.info("use imagebitmap to create texture");var t=a.xE.from(e.objectSrc);a.xE.addToCache(t,e.src)}else if(0===e.src.indexOf("blob:")){t=a.xE.from(e.src);H.info("JSONEffect blob texture",t),a.xE.addToCache(t,e.src)}else r.add(e.src)}};try{for(var u=G(s),l=u.next();!l.done;l=u.next()){h(l.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}return new Promise((function(e){return z(n,void 0,void 0,(function(){var t=this;return D(this,(function(i){return r.load((function(i,n){return z(t,void 0,void 0,(function(){var t,i,r,s,h;return D(this,(function(u){switch(u.label){case 0:for(r in t=function(e){var t;return D(this,(function(i){switch(i.label){case 0:return o.iV[e]?[2,"continue"]:c[e]?(t=new a.c2(a.P6.kN[e],c[e],"@".concat((0,V.u)(),"x")),[4,new Promise((function(i){t.parse((function(){o.iV[e]=t,i()}))}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))},i=[],a.P6.kN)i.push(r);s=0,u.label=1;case 1:return s<i.length?(h=i[s],[5,t(h)]):[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:for(h in n)o.iV[h]||c[h]||(o.iV[h]=n[h]);return e(),[2]}}))}))})),[2]}))}))}))},t.prototype.loadSticker3d=function(e){return z(this,void 0,Promise,(function(){return D(this,(function(e){return[2]}))}))},t}(B),W=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(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)}}(),q=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},K=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Y=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},X=function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Z=((0,v.jl)("Effect"),function(){function e(e,t,i,n){this.type="hand",this._destroyed=!1,this._visible=!0,this._intensity=1,this.localSpriteSheets={},this._url=e,this._key=e,this._app3d=t,this._canvas=n,this._options=i}return Object.defineProperty(e.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app3d",{get:function(){return this._app3d},set:function(e){this._app3d=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(e){this._intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._destroyed||(this._visible=e)},enumerable:!1,configurable:!0}),e.prototype.download=function(){return Y(this,void 0,Promise,(function(){var e;return X(this,(function(t){switch(t.label){case 0:return[4,this._getLoader()];case 1:return[4,t.sent().preload(this._url)];case 2:return t.sent(),[4,this._getConfig()];case 3:return e=t.sent(),v.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return Y(this,void 0,Promise,(function(){var e,t;return X(this,(function(i){switch(i.label){case 0:return[4,this.download()];case 1:return e=i.sent(),t=e.hand,[4,this.load3d(t||[])];case 2:return i.sent(),[4,this._getLoader()];case 3:return i.sent().removeFromCache(this._url),[2,null]}}))}))},e.prototype._getLoader=function(){return Y(this,void 0,void 0,(function(){return X(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new o.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return Y(this,void 0,void 0,(function(){var e;return X(this,(function(t){switch(t.label){case 0:return this._config?[3,3]:[4,this._getLoader()];case 1:return[4,(e=t.sent()).preload(this._url)];case 2:t.sent(),this._config=e.readJSON("content.json",this._key),t.label=3;case 3:return[2,this._config]}}))}))},e.prototype.load3d=function(e){return Y(this,void 0,void 0,(function(){return X(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return Y(this,void 0,void 0,(function(){return X(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.apply=function(){this._destroyed||this._applyed||(this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(){this.removeForConsole(),this._applyed=!1},e.prototype.tick=function(){},e.prototype.tickMesh=function(){},e.prototype.destroy=function(){this._destroyed=!0,this.remove(),this.destroyForConosle(),this.clearTexture()},e.prototype.clearTexture=function(){for(var e in a.P6.kN)if(e.indexOf(this._key)>-1){var t=a.P6.kN[e];a.xE.removeFromCache(t),t.destroy(!0)}for(var e in this.localSpriteSheets)o.iV[e]&&o.iV[e]instanceof a.c2&&(o.iV[e].destroy(),delete o.iV[e])},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},q([(0,u.M)("Effect"),K("design:type",Function),K("design:paramtypes",[]),K("design:returntype",void 0)],e.prototype,"remove",null),q([(0,u.M)("Effect"),K("design:type",Function),K("design:paramtypes",[]),K("design:returntype",void 0)],e.prototype,"destroy",null),e}()),$=function(e){function t(t,i,n,r){var o=e.call(this,"default",i,n,r)||this;return o._json=t,o._app3d=i,o}return W(t,e),t.prototype.load=function(){return Y(this,void 0,Promise,(function(){var e,t;return X(this,(function(i){switch(i.label){case 0:return e=this._json,(t=e.hand)?this._app3d?[3,2]:[4,this.initThreeApp()]:[3,4];case 1:i.sent(),i.label=2;case 2:return[4,this.loadHand3d(t||[])];case 3:i.sent(),i.label=4;case 4:return[2,null]}}))}))},t.prototype.loadImage=function(){return Y(this,void 0,void 0,(function(){return X(this,(function(e){return[2]}))}))},t.prototype.loadSticker3d=function(e){return Y(this,void 0,Promise,(function(){return X(this,(function(e){return[2]}))}))},t.prototype.loadHand3d=function(e){return Y(this,void 0,Promise,(function(){return X(this,(function(e){return[2]}))}))},t}(Z),Q=i(5156),ee=i(7959),te=i(6309),ie=i(1077),ne=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(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)}}(),re=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},oe=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},se=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},ae=function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ce=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},he=(0,v.jl)("Renderer"),ue=function(){};var le=function(e){function t(t){var i=e.call(this,t)||this;return i._setup=!1,i._effects=[],i._debug=!0,i._destroyed=!1,i._isVR=!1,i._meshVertexTimer=0,i.lib3dLoaded=!1,i.libHand3dLoaded=!1,he.info("[@#$] AR Renderer Constructed",location),i._debug=!1,t.output?i._canvas=new wx.window.Canvas(t.output):i._canvas=new wx.window.Canvas(wx.createOffscreenCanvas({type:"webgl",width:t.width,height:t.height})),i._stage=new a.W2,i._options=t,a.Xd.RESOLUTION=(0,V.u)(),a.Xd.FILTER_RESOLUTION=(0,V.u)(),i._renderer=new a.Th({view:i._canvas,width:t.width,height:t.height,useContextAlpha:!1,preserveDrawingBuffer:!1,antialias:!1}),i.setRenderer(),i.initRenderContext(t),i.handleLoading(),i.setup(),i}return ne(t,e),Object.defineProperty(t.prototype,"mirror",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backGroundVR",{set:function(e){if(e){this._backgroundVR=new a.jy(a.xE.from(e));var t=this._backgroundVR,i=t.width,n=t.height,r=Math.max(this._options.width/i,this._options.height/n);this._backgroundVR.width*=r,this._backgroundVR.height*=r}else this._backgroundVR=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{set:function(e){var t=e.width,i=e.height;this._canvas.width=t,this._canvas.height=i,this._renderer&&this.resize(t,i),this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=i,this._baseSprite.position.set(t/2,i/2),this._baseSprite.anchor.set(.5,.5)),this._baseRenderTexture.resize(t,i),this._makeupRenderTexture.resize(t,i),this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app3d",{get:function(){return this._app3d},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"avatar3d",{get:function(){return this._avatar3d},enumerable:!1,configurable:!0}),t.prototype.initRenderContext=function(e){this._baseContainer=new a.W2,this._makeupContainer=new a.W2,this._frontContainer=new a.W2,this._frontContainer.sortableChildren=!0,this._finalContainer=new a.W2,this._baseRenderTexture=a.TI.create({width:e.width,height:e.height}),this._makeupRenderTexture=a.TI.create({width:e.width,height:e.height}),this._makeupContainer.addChild(new a.jy(this._baseRenderTexture)),ue.baseTexture=this._baseRenderTexture,this._finalContainer.addChild(new a.jy(this._makeupRenderTexture)),this._finalContainer.addChild(this._frontContainer),this._stage.addChild(this._finalContainer),this._target=this._finalContainer},t.prototype.loadLib3d=function(){return se(this,void 0,Promise,(function(){var e;return ae(this,(function(t){switch(t.label){case 0:return e=new te.e({}),he.info("loader init"),[4,e.init()];case 1:return t.sent(),he.info("loader init done"),this._options.plugin3d&&this._options.plugin3d(B,J,e,wx.window),[2]}}))}))},t.prototype.loadHand3d=function(){return se(this,void 0,Promise,(function(){var e;return ae(this,(function(t){switch(t.label){case 0:return e=new te.e({}),he.info("+++++loader init"),[4,e.init()];case 1:return t.sent(),he.info("+++++loader init done"),this._options.plugin3d&&this._options.pluginHand(Z,$,e,wx.window),[2]}}))}))},t.prototype.setup=function(){return se(this,void 0,void 0,(function(){return ae(this,(function(e){switch(e.label){case 0:return this._setup?[2]:(this._config=new c.M,[4,this._config.load()]);case 1:return e.sent(),this._setup=!0,[2]}}))}))},Object.defineProperty(t.prototype,"meshVertex",{get:function(){return this._meshVertex},set:function(e){this._meshVertex=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mirrorFilter",{get:function(){return this._mirrorFilter||(this._mirrorFilter=new s.f("mirror",{width:l.t.instance.options.width,height:l.t.instance.options.height})),this._mirrorFilter},enumerable:!1,configurable:!0}),t.prototype.switchMode=function(e){v.bH.info("switchMode",e),e!==this._mode3d&&("Sticker"===e&&this.setAvatar(null),this._mode3d=e)},t.prototype.logTime=function(e){var t=+new Date;he.info("".concat(e," time:").concat(t-this.currentTime)),this.currentTime=t},t.prototype.tick=function(t,i){var n=t.landmarks,r=t.meshVertex,o=t.lipVertex,s=t.image,c=t.angles,h=(t.backgroundType,t.background,t.segmentation,t.blendshapes,t.isLivePusher);t.hair;if(!this._destroyed)if(this._renderer)if(this._stage)if(this._setup){this.currentTime=+new Date;try{this._renderer.reset()}catch(e){}if(this._isVR)try{this._renderer.render(this._backgroundVR)}catch(e){}else{if(h)if(this._baseSprite)this._baseSprite.texture.update();else{d=a.xE.from(s);this._baseSprite=new a.jy(d),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2),this._baseSprite.scale.set(1,-1),this._baseContainer.addChild(this._baseSprite)}else{var u=s,l=u.width,p=u.height,f=u.data;if(this._baseSprite){if(this._baseSprite.texture.width===l&&this._baseSprite.texture.height===p)this._baseSprite.texture.baseTexture.resource.data=new Uint8Array(f),this._baseSprite.texture.update();else this._baseSprite.texture.destroy(!0),this._baseSprite.texture=a.xE.fromBuffer(new Uint8Array(f),l,p)}else{var d=a.xE.fromBuffer(new Uint8Array(f),l,p);this._baseSprite=new a.jy(d),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2);var _=Math.max(this._options.width/l,this._options.height/p);this._baseSprite.scale.set(_),this._baseContainer.addChild(this._baseSprite)}}(ee.s.checkEnabled("beautify")||ee.s.checkEnabled("segmentation")||ee.s.checkEnabled("hair"))&&(e.prototype.setMesh.call(this,r),e.prototype.setReshapeMarks.call(this,n),n&&n.length?(this._faceLandmarks=n,this._angles=c,this.meshVertex=r,this.lipVertex=o,this.detected=!0,this._effects.forEach((function(e){e.visible||(e.visible=!0),e.lipmesh=o,e.mesh=r,e.angles=c,e.faceLandMarks=n,e.tick()})),"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=n,this._app3d.angles=c)):(this.handleNoFace(),this.detected=!1)),this._render()}}else v.b_.info("_renderer waiting for setup");else v.b_.info("_renderer waiting for stage");else v.b_.info("_renderer waiting for renderer")},t.prototype.handleNoFace=function(){this._effects.forEach((function(e){return e.visible=!1})),this._effects.forEach((function(e){e.tickMesh()}));new Date;"AR"===this._mode3d||"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=[],this._app3d.angles={})},t.prototype._render=function(){this.renderLayers(),ee.s.checkEnabled("beautify")&&"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&this._app3d.render(),ee.s.checkEnabled("handLandmark")&&this._appHand3d&&this._appHand3d.render()},t.prototype.renderLayers=function(){this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture}),this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture}),this._renderer.render(this._stage)},t.prototype.getBaseTexture=function(){return this._baseSprite.texture},t.prototype.removeBackground=function(){this.background&&(this.background.remove(),this.background=null)},t.prototype.applyBackground=function(e){this.background},t.prototype.removeForeground=function(){this._frontContainer&&(this._frontContainer.children.forEach((function(e){e.destroy()})),this._frontContainer.removeChildren())},t.prototype.addForeground=function(e){var t=this;if(Array.isArray(e)){var i={};for(var n in this._frontContainer.children.forEach((function(e){i[e.id]=e})),e.forEach((function(e,n){var r=i[e.id];r?(r.zIndex=n,delete i[e.id]):t._addForeground(e,n)})),i)i[n].destroy(),this._frontContainer.removeChild(i[n]);this._frontContainer.sortChildren()}else this._addForeground(e)},t.prototype._addForeground=function(e,t){var i=e.image,n=e.type,r=e.id,o=l.t.instance.options,s=o.width,c=o.height,u="data"in i?a.xE.fromBuffer(new Uint8Array(i.data.buffer),i.width,i.height):a.xE.from(i),p=new h.jy(u);"video"===n&&(p.blendMode_1=6),p.width=s,p.height=c,p.id=r,t&&(p.zIndex=t),this._frontContainer.addChild(p)},t.prototype.debugDraw=function(e){if(!this.points){for(var t=[],i=0;2*i<e.length;i++){var n=this.getCircle(2);t.push(n),this._baseContainer.addChild(n)}this.points=t}for(i=0;2*i<e.length;i++)this.points[i].x=e[2*i],this.points[i].y=e[2*i+1]},t.prototype.debugDraw2=function(e){if(he.info("debug draw 2",e.length),!this.points){for(var t=[],i=0;i<e.length;i++){var n=this.getCircle(2);t.push(n),this._baseContainer.addChild(n)}this.points=t}for(i=0;i<e.length;i++)this.points[i].x=540*e[i].x,this.points[i].y=540*e[i].y},t.prototype.getPixels=function(){var e=this._options,t=e.width,i=e.height,n=new Uint8Array(t*i*4),r=this._renderer.gl;return r.readPixels(0,0,t,i,r.RGBA,r.UNSIGNED_BYTE,n),{data:n,width:t,height:i}},t.prototype.setEffect=function(e,t,i,n){return se(this,void 0,Promise,(function(){var r,o=this;return ae(this,(function(s){return r=!0,this.latestEffectUrls&&this.latestEffectUrls.length===e.length&&e.every((function(e){return o.latestEffectUrls.indexOf(e)>-1}))&&(r=!1,this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)),this.latestEffectUrls=e,[2,new Promise((function(s,a){r?(o.debounceTimer&&(clearTimeout(o.debounceTimer),o.debounceTimer=null),o.debounceTimer=setTimeout((function(){return o._setEffect(e,t,i,n).then((function(e){clearTimeout(o.debounceTimer),o.debounceTimer=null,s(e)}))}),100)):o._setEffect(e,t,i).then((function(e){s(e)}))}))]}))}))},t.prototype._setEffect=function(e,t,i,n){return se(this,void 0,Promise,(function(){var r,s=this;return ae(this,(function(a){return v.b_.time("waiting for AI init..."),ee.s.checkEnabled("beautify")&&!this._meshVertex?[2,new Promise((function(r){clearTimeout(s._meshVertexTimer),s._meshVertexTimer=setInterval((function(){v.b_.info("waiting for AI init..."),s._meshVertex&&(v.b_.info("waiting for AI init...done"),clearTimeout(s._meshVertexTimer),s._setEffect(e,t,i,n).then((function(){r(s._effects)})))}),200)}))]:(v.b_.timeEnd("waiting for AI init..."),r="uid_"+Math.floor(1e8*Math.random()),[2,new Promise((function(a,c){return se(s,void 0,void 0,(function(){var s,c,h,u,l,p,f,d,_,y,b,m,g,k,x,w,S,M=this;return ae(this,(function(T){switch(T.label){case 0:for(s=[].concat(this._effects),c=[],h=[],u=[],l=[],p=[],f=[],d=[],_=[],e.length||(this.filterActivedEffect=null),y=[],b=function(n){var r=s.findIndex((function(t){return t.url===e[n]}));if(r>-1)c.push(s[r]),s[r],h.push(t[n]),u.push(i[n]),s.splice(r,1);else{var a=e[n];_.push(function(e){return se(this,void 0,Promise,(function(){var t,i;return ae(this,(function(n){switch(n.label){case 0:return[4,(t=new o.pF).init()];case 1:return n.sent(),[4,t.preload(e)];case 2:return n.sent(),i=t.readJSON("content.json",e),v.D4.info("download:",e,i),[2,i]}}))}))}(a)),y.push(a),p.push(t[n]),f.push(i[n])}},m=0;m<e.length;m++)b(m);return[4,Promise.all(_)];case 1:for(g=T.sent(),!1,k=!1,x=0;x<g.length;x++)w=y[x],S=void 0,(S=new B(w,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex,this._angles,p[x],this._canvas)).filterIntensity=f[x],g[x].sticker3d&&g[x].sticker3d.length&&(k=!0),S.renderer=this._renderer,l.push(S);return v.b_.time("require 3d lib"),this.lib3dLoaded||!k?[3,3]:n&&!n()?[2]:(he.info("require 3d lib"),[4,this.loadLib3d()]);case 2:T.sent(),this.lib3dLoaded=!0,T.label=3;case 3:return v.b_.timeEnd("require 3d lib"),v.b_.info("check all new Effects",l,s),l.forEach((function(e){d.push(e.load().then((function(){return e.intensity=e.intensity,M._app3d||"face"!==e.type||(M._app3d=e.app3d),M._appHand3d||"hand"!==e.type||(M._appHand3d=e.app3d),e})).catch((function(e){he.warn("effect load error",e)})))})),v.b_.time("renderer parse effect"),Promise.all(d).then((function(e){v.b_.timeEnd("renderer parse effect"),v.b_.time("renderer apply effect");for(var t=!1,i=0;i<l.length;i++){var n=l[i];M.latestEffectUrls&&-1===M.latestEffectUrls.indexOf(n.getUrl())&&(n.destroy(),t=!0)}if(t)he.info(r+"end");else{s.forEach((function(e){e.remove()})),M._effects=c,c.forEach((function(e,t){e.intensity=h[t],e.filterIntensity=u[t]}));for(i=0;i<l.length;i++){n=l[i];M._effects.push(n),n.apply({filterTarget:M._baseSprite,filterCallback:function(){}})}s.forEach((function(e){e.destroy()})),v.b_.timeEnd("renderer apply effect"),a(M._effects)}})),[2]}}))}))}))])}))}))},t.prototype.setEffectJSON=function(e){return se(this,void 0,void 0,(function(){var t,i,n,r,o,s=this;return ae(this,(function(a){switch(a.label){case 0:return i=e.sticker3d,n=e.hand,i&&i.length&&!this.lib3dLoaded?(he.info("require 3d lib"),[4,this.loadLib3d()]):[3,2];case 1:a.sent(),this.lib3dLoaded=!0,a.label=2;case 2:return n&&n.length&&!this.libHand3dLoaded?(he.info("require 3d hand lib"),[4,this.loadHand3d()]):[3,4];case 3:a.sent(),this.libHand3dLoaded=!0,a.label=4;case 4:return r=!1,(o=function(){ee.s.checkEnabled("beautify")&&s._meshVertex&&(t&&clearTimeout(t),r=!0,s.getJSONEffectForFace(e)),ee.s.checkEnabled("handLandmark")&&n&&n.length&&(r=!0,s.getJSONEffectForHand(e)),r||(t=setTimeout(o,20))})(),[2]}}))}))},t.prototype.getJSONEffectForHand=function(e){var t=this,i=new $(e,this._appHand3d,this._options,this._canvas);i.renderer=this._renderer,v.b_.info("getJSONEffectForHand"),i.load().then((function(){t._appHand3d||(t._appHand3d=i.app3d),i.apply()}))},t.prototype.getJSONEffectForFace=function(e){var t=this,i=new J(e,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex);return i.renderer=this._renderer,i.load().then((function(){t._app3d||(t._app3d=i.app3d);var e=[].concat(t._effects);t._effects=[i],i.apply({filterTarget:t._baseSprite}),e.forEach((function(e){e.destroy()}))})),i},t.prototype.setExclusiveFilter=function(e,t){var i=this;return void 0===t&&(t=1),new Promise((function(n,r){!function(){if(i.exclusiveFilter&&i.exclusiveFilter.getUrl()===e)i.exclusiveFilter.intensity=t,i.exclusiveFilter.filterIntensity=t;else{var r=new B(e,i._makeupContainer,i._finalContainer,i._app3d,i._options,i._meshVertex,i._faceLandmarks,i.lipVertex,i._angles,t);r.filterIntensity=t,r.load().then((function(){i.exclusiveFilter&&i.exclusiveFilter.destroy(),i.exclusiveFilter=r,r.renderer=i._renderer,r.apply({filterTarget:i._baseSprite}),n()}))}}()}))},t.prototype.resize=function(t,i,n){void 0===n&&(n=!0),e.prototype.resize.call(this,t,i),he.info("renderer resize",t,i,n),this._options.width=t,this._options.height=i,this._renderer.resize(t,i),this.background&&this.background.resize(t,i),this._app3d?this._app3d.resize(t,i):this._avatar3d&&this._avatar3d.resize(t,i),this._makeupRenderTexture&&this._makeupRenderTexture.resize(t,i),this._baseRenderTexture&&this._baseRenderTexture.resize(t,i),n&&this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=i,this._baseSprite.position.set(t/2,i/2),this._baseSprite.anchor.set(.5,.5),this._baseSprite.scale.set(1)),this._effects.forEach((function(e){e.resize(t,i)}))},t.prototype.disableExclusiveFilter=function(){this.exclusiveFilter&&this.exclusiveFilter.remove()},t.prototype.enableExclusiveFilter=function(){this.exclusiveFilter&&this.exclusiveFilter.apply({filterTarget:this._baseSprite,filterCallback:function(){}})},t.prototype.disableEffects=function(e){void 0===e&&(e=!1),this._effects.forEach((function(t){!e&&t.isPureFilter||"hand"===t.type||t.remove()}))},t.prototype.enableEffects=function(){var e=this;this._effects.forEach((function(t){t.apply({filterTarget:e._baseSprite,filterCallback:function(){}})}))},t.prototype.removeExclusiveFilter=function(){this.exclusiveFilter&&(this.exclusiveFilter.destroy(),this.exclusiveFilter=null)},t.prototype.initAvatarApp=function(e,t){return se(this,void 0,void 0,(function(){return ae(this,(function(e){return[2]}))}))},t.prototype.setAvatar=function(e,t){return se(this,void 0,void 0,(function(){return ae(this,(function(e){return[2]}))}))},t.prototype.registerAvatar=function(e){},t.prototype.reCorrectAvatar=function(){return se(this,void 0,void 0,(function(){return ae(this,(function(e){return[2]}))}))},t.prototype.getCanvas=function(){return this._canvas},t.prototype.setOptions=function(e){},t.prototype.mount=function(e){this._canvas&&e.appendChild(this._canvas)},t.prototype.getCircle=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},t.preloadEffects=function(e){return se(this,void 0,Promise,(function(){var t,i,n,r,s,a,c;return ae(this,(function(h){switch(h.label){case 0:return e.length?[4,(t=new o.pF).init()]:[2];case 1:h.sent(),i=[];try{for(n=ce(e),r=n.next();!r.done;r=n.next())(s=r.value)&&i.push(t.preload(s))}catch(e){a={error:e}}finally{try{r&&!r.done&&(c=n.return)&&c.call(n)}finally{if(a)throw a.error}}return[2,Promise.all(i).then((function(){return Promise.resolve()})).catch((function(e){return Promise.reject(e)}))]}}))}))},t.prototype.handleLoading=function(){var e=this._options,i=e.enableLoadingIcon,n=e.loadingIconOptions,r=void 0===n?{}:n;if(i){var o=t.loading=new Q.Z(r);o.zIndex=20;var s=this._options,a=s.width,c=s.height;o.x=a/2,o.y=c/2,this._stage.addChild(o)}},t.prototype.showLoading=function(){t.loading&&t.loading.show()},t.prototype.hideLoading=function(){t.loading&&t.loading.hide()},t.prototype.destroy=function(e){void 0===e&&(e=!0),this.hideLoading(),t.loading&&t.loading.destroy(),e&&ue.baseTexture&&(ue.baseTexture.destroy(!0),ue.baseTexture=null),this._destroyed=!0,this._effects.forEach((function(e){e.destroy()})),this.exclusiveFilter&&this.exclusiveFilter.destroy(),this._stage&&this._stage.destroy(!0),this._renderer&&this._renderer.destroy(!0),this.background&&this.background.destroy(),this._app3d&&this._app3d.destroy(),this._appHand3d&&this._appHand3d.destroy(),this._meshVertexTimer&&clearTimeout(this._meshVertexTimer),this.destroyAvatar()},t.prototype.destroyAvatar=function(){this._avatar3d&&(this._avatar3d.destroy(),this._avatar3d=null)},re([(0,u.M)("ArRenderer"),oe("design:type",Function),oe("design:paramtypes",[Object]),oe("design:returntype",void 0)],t.prototype,"destroy",null),t}(ie.F)}}]);
1
+ var self = wx;(self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[321],{6237:(e,t,i)=>{i.d(t,{g:()=>le,b:()=>ue});var n,r=i(9522),o=i(3044),s=i(3650),a=i(1206),c=i(617),h=i(9560),u=i(1084),l=i(3849),p=i(1347),f=(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),d=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},y=function(){function e(e,t,i,n,r,o){this._destroyed=!1,this.type="makeup",this._parentIntensity=1,this._jsonIntensity=1,this.textures=[],this._dir=t,this._options=e,this._container=i,this._lipMaskTexture=o,this.renderer=n,this.type=r||"makeup"}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this.shader&&(this.shader.uniforms.parentIntensity=e);this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipMask",{set:function(e){null===e?(this._mesh.removeChild(this._cacheMask),this._mesh.mask=e):(this._mesh.addChild(e),this._mesh.mask=e,this._cacheMask=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{set:function(e){this.shader&&(this.shader.uniforms.enable=e?1:0)},enumerable:!1,configurable:!0}),e.prototype.updateGeometry=function(e){this._destroyed},e.prototype.renderMesh=function(){},e.prototype.resize=function(e,t){this._options.width=e,this._options.height=t,this.shader&&(this.shader.uniforms.size=[e,t])},e.prototype.drawMeshBatch=function(e,t){var i=this;if(!this._destroyed){var n=Array.from(e.reduce((function(e,t){return e.add(t.blend),e}),new Set));this.irisRenderTexture&&!n.includes(this.irisBlendMode)&&n.push(this.irisBlendMode);var r="\n precision mediump float;\n varying vec2 vUvs;\n varying vec2 bUvs;\n \n\n ".concat(e.map((function(e,t){return"uniform sampler2D uSamplerMakeup".concat(t,";")})).join("\n"),"\n ").concat(e.map((function(e,t){return"uniform float intensity".concat(t,";")})).join("\n"),"\n uniform float parentIntensity;\n uniform int enable;\n uniform sampler2D baseImage;\n \n uniform sampler2D uSamplerIris;\n\n // uniform int mirror;\n uniform vec2 imageOffset;\n \n ").concat(n.map((function(e){return h.Lc[e].shader})).join("\n"),"\n \n void main() {\n if (enable == 0) {\n gl_FragColor = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n // todo:适配镜像与非镜像\n vec2 baseCoord = bUvs;\n baseCoord += imageOffset;\n // if (mirror == 1) {\n // baseCoord = vec2(1.0 - bUvs.x, bUvs.y);\n // }\n vec4 baseColor = texture2D(baseImage, baseCoord);\n\n vec4 makeupColor = vec4(0.0);\n\n ").concat(e.map((function(e,t){return"\n \n vec4 color".concat(t," = texture2D(uSamplerMakeup").concat(t,", vUvs);\n float a").concat(t," = color").concat(t,".a;\n float realIntensity").concat(t," = intensity").concat(t," * parentIntensity;\n makeupColor = texture2D(uSamplerMakeup").concat(t,", vUvs) * realIntensity").concat(t,";\n if (makeupColor.a>0.) {\n // 混合\n baseColor.rgb = blend").concat(h.Lc[e.blend].key,"(baseColor.rgb, makeupColor.rgb/makeupColor.a , makeupColor.a);\n }\n \n \n \n\n ")})).join("\n"),"\n\n ").concat(this.irisRenderTexture?"\n // 混合美瞳\n vec4 irisColor = texture2D(uSamplerIris, bUvs);\n if (irisColor.a > 0.) {\n baseColor.rgb = blend".concat(h.Lc[this.irisBlendMode].key,"(baseColor.rgb, irisColor.rgb/irisColor.a , irisColor.a);\n }\n "):"","\n \n \n\n // 输出\n gl_FragColor = baseColor;\n }"),o={enable:1};o.parentIntensity=this.parentIntensity;var s=this._options,c=s.width,u=s.height;o.baseImage=ue.baseTexture,o.size=[c*u/ue.baseTexture.height,u];var p=ue.baseTexture.width*u/ue.baseTexture.height;o.imageOffset=[(p-c)/2/p,0],e.forEach((function(e,t){var n="default"===i._dir?e.src:"".concat(i._dir,"|").concat(e.src),r=a.P6.kN[n];o["uSamplerMakeup".concat(t)]=r,o["intensity".concat(t)]=e.intensity,i.textures.push(r)})),this.irisRenderTexture&&(o.uSamplerIris=this.irisRenderTexture);var f=a.ex.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n uniform vec2 size;\n varying vec2 vUvs;\n varying vec2 bUvs;\n\n \n void main() {\n vUvs = aUvs;\n bUvs = aVertexPosition.xy /size;\n // lipUvs = lipAuvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }",r,o);this.shader=f,l.t.instance.on("mirrorChange",(function(e){}));var d=new a.Kj(t,f);return this._mesh=d,this._container.addChild(d),d}},e.prototype.destroy=function(){this._destroyed=!0,this._mesh&&(this._mesh.destroy({children:!0,texture:!1,baseTexture:!1}),this._mesh.mask=null,this._mesh=null),this._maskRenderTexure&&this._maskRenderTexure.destroy(!1)},d([(0,u.M)("MakeupLayer"),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",void 0)],e.prototype,"updateGeometry",null),d([(0,u.M)("MakeupLayer"),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",void 0)],e.prototype,"destroy",null),e}(),b=function(e){function t(t,i,n,r,o,s,c){var h=e.call(this,t,i,c)||this;return h._maskGraphics=new a.TC,h.maxLConSize=0,h.maxRConSize=0,h._parentIntensity=1,h.jsonIntensity=o,h.getTexture(n,r),h._config=s,h.renderTexture=a.TI.create({width:t.width,height:t.height}),h}var i,n;return f(t,e),Object.defineProperty(t.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._container&&(this._container.alpha=this.jsonIntensity*e),this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visible",{set:function(e){this._container.visible=e},enumerable:!1,configurable:!0}),t.prototype.getTexture=function(e,t){var i="default"===this._dir?e:"".concat(this._dir,"|").concat(e),n=a.P6.kN[i],r=new a.jy(n),o=new a.jy(n.clone());r.anchor.set(.5),o.anchor.set(.5),this._leftIris=r,this._rightIris=o;var s=new a.W2;this._maskGraphics||(this._maskGraphics=new a.TC),s.addChild(this._maskGraphics),s.addChild(r),s.addChild(o),s.alpha=this.parentIntensity*this.jsonIntensity,s.mask=this._maskGraphics,this._container=s},t.prototype.setIrisProps=function(e,t){if(e.length){var i=this._config.getConfigByKeys(["POINTS_MAP","LEFT_IRIS","RIGHT_IRIS","LEFT_EYE_ORDER","RIGHT_EYE_ORDER"]),n=i.POINTS_MAP,r=(i.LEFT_IRIS,i.RIGHT_IRIS,i.LEFT_EYE_ORDER),o=i.RIGHT_EYE_ORDER,s=(n.left_eye_center,n.right_eye_center,(0,p.Sp)(e[52],e[55])),a=(0,p.Sp)(e[58],e[61]),c=Math.max(this.maxLConSize,(0,p.Sp)(e[72],e[73])/s),h=Math.max(this.maxRConSize,(0,p.Sp)(e[75],e[76])/a),u=s*c,l=s*c,f=a*h,d=a*h;this.maxLConSize=Math.max(Math.min(c,.7),.4),this.maxRConSize=Math.max(Math.min(h,.7),.4);var _=ue.baseTexture.width*this._options.height/ue.baseTexture.height,y=(0,p.qg)(e[74],e[104]),b=(0,p.qg)(e[77],e[105]);y.x-=(_-this._options.width)/2,b.x-=(_-this._options.width)/2;var m=this._leftIris,v=this._rightIris;m.width=u*(this._options.irisScale||1),m.height=l*(this._options.irisScale||1),m.x=y.x,m.y=y.y,v.width=f*(this._options.irisScale||1),v.height=d*(this._options.irisScale||1),v.x=b.x,v.y=b.y,this._maskGraphics.clear(),this._drawMaskGraphics(r,e),this._drawMaskGraphics(o,e),t.render(this._container,{renderTexture:this.renderTexture})}},t.prototype._drawMaskGraphics=function(e,t){var i=this,n=this._maskGraphics;n.beginFill(16724736),n.lineStyle(1,16767232,1);var r=[];e.forEach((function(o,s){var a=t[o],c=i._getPixelPosition(a.x,a.y),h=c.x,u=c.y;r.push({x:h,y:u}),0===s?n.moveTo(h,u):s===e.length-1?(n.closePath(),n.endFill()):n.lineTo(h,u)}))},t.prototype._getPixelPosition=function(e,t){return{x:e,y:t}},t.prototype.resize=function(t,i){e.prototype.resize.call(this,t,i),this.renderTexture.resize(t,i)},t.prototype.destroy=function(){this._leftIris&&this._leftIris.destroy({children:!0,texture:!1,baseTexture:!1}),this._rightIris&&this._rightIris.destroy({children:!0,texture:!1,baseTexture:!1}),this._maskGraphics&&this._maskGraphics.destroy({children:!0,texture:!1,baseTexture:!1})},d([(0,u.M)("IrisLayer"),_("design:type",Function),_("design:paramtypes",["function"==typeof(i="undefined"!=typeof Array&&Array)?i:Object,"function"==typeof(n=void 0!==a.Th&&a.Th)?n:Object]),_("design:returntype",void 0)],t.prototype,"setIrisProps",null),t}(y),m=i(3120),v=i(6109),g=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},k=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},x=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},w=function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},S=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},M=(0,v.jl)("makeup"),T=function(){function e(e,t,i){e&&(this._options=e),t&&(this._lipVertex=t),i&&(this.renderer=i)}return e.prototype.destroy=function(){var e=this._lipMask;this._lipMask=null;try{e.destroy(!0)}catch(e){}try{this._lipMaskMesh.destroy(!0),this._lipMaskMesh=null}catch(e){}try{this._maskRenderTexture.destroy(!0),this._maskRenderTexture=null}catch(e){}this._config=null;try{this._maskSprite.destroy(!0),this._maskSprite=null}catch(e){}},e.prototype.load=function(){return x(this,void 0,void 0,(function(){var e,t,i,n,r;return w(this,(function(o){switch(o.label){case 0:return this._config?[3,2]:(this._config=new c.M,[4,this._config.load()]);case 1:o.sent(),o.label=2;case 2:return this._lipMask?[3,4]:[4,this._getMask()];case 3:o.sent(),o.label=4;case 4:return this._maskSprite&&!this._maskSprite.destroyed||(e=this._options,t=e.width,i=e.height,n=new a.jd({width:t,height:i}),this._maskRenderTexture=new a.TI(n),r=new a.jy(this._maskRenderTexture),this._maskSprite=r),[2,{maskSprite:this._maskSprite,lipmask:this._lipMask,lipmaskmesh:this._lipMaskMesh}]}}))}))},e.prototype.update=function(e){this._lipMaskMesh&&(this._lipMaskMesh.geometry.getBuffer("aVertexPosition").update(e),this.render())},e.prototype.render=function(){this.renderer&&this._lipMask&&this.renderer.render(this._lipMask,{renderTexture:this._maskRenderTexture})},e.prototype._getMask=function(){return x(this,void 0,void 0,(function(){var e,t,i,n,r,o,s,c,h;return w(this,(function(u){switch(u.label){case 0:return this._lipMask?[2,this._lipMask]:(e=new a.W2,(t=new a.jy(a.xE.WHITE)).width=this._options.width,t.height=this._options.height,e.addChild(t),i=this._lipVertex,n=this._config.getDataConfig(29),[4,this._loadLipImage()]);case 1:return r=u.sent(),o=(new a.wG).addAttribute("aVertexPosition",i).addAttribute("aUvs",n),"\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n\n \n void main() {\n gl_FragColor = texture2D(uSamplerMakeup, vUvs);\n }",s={uSamplerMakeup:r},c=a.ex.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n\n \n void main() {\n gl_FragColor = texture2D(uSamplerMakeup, vUvs);\n }",s),h=new a.Kj(o,c),this._lipMaskMesh=h,e.addChild(h),this._lipMask=e,[2,e]}}))}))},e.prototype._loadLipImage=function(){return x(this,void 0,Promise,(function(){var e=this;return w(this,(function(t){return[2,new Promise((function(t,i){return x(e,void 0,void 0,(function(){var e,i,n;return w(this,(function(r){switch(r.label){case 0:return[4,(e=new m.KI).init()];case 1:return i=r.sent(),[4,e.loadImage(i)];case 2:return n=r.sent(),t(n[m.X_]),[2]}}))}))}))]}))}))},g([(0,u.M)("ReuseableLipMask"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",void 0)],e.prototype,"destroy",null),g([(0,u.o)("ReuseableLipMask"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",Promise)],e.prototype,"_getMask",null),e}(),C=function(){function e(e,t,i,n,r,o,s,c){void 0===c&&(c=1),this._container=new a.W2,this._makeupMeshes=[],this._visible=!0,this.mouthShut=!0,this._applyed=!1,this._key=e,this._data=t,this._options=i,this.mesh=n,this.lipmesh=o,this.faceLandMarks=r,this.renderer=s,this.parentIntensity=c;var h=new a.jy(a.xE.WHITE);h.alpha=0,h.width=i.width,h.height=i.height,this._container.addChild(h)}var t;return Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){var t=this;this._target&&e!==this._visible&&(this._visible=e,this._makeupMeshes.forEach((function(i){e?t.apply(t._target):t.remove()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{set:function(e){(this._meshVertex=e,this.geometry)&&(this.geometry.getBuffer("aVertexPosition").update(e),this._makeupMeshes.forEach((function(t){t.updateGeometry(e)})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._lipVertex=e,this._lipMaskIns&&this._lipMaskIns.update(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){var t=this;e&&e.length&&(this._irises&&this._irises.setIrisProps(e,this.renderer),(0,p.Sp)(e[98],e[102])<.03*(0,p.Sp)(e[0],e[32])?this.mouthShut||(this._makeupMeshes.forEach((function(e){"lips"===e.type&&(e.lipMask=null)})),this.mouthShut=!0):this.mouthShut&&(this._makeupMeshes.forEach((function(e){"lips"===e.type&&t._lipMaskIns&&(e.lipMask=t._lipMaskIns._maskSprite)})),this.mouthShut=!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._intensity},set:function(e){this._irises&&(this._irises.parentIntensity=e),this._makeupMeshes.forEach((function(t){t.parentIntensity=e})),this._intensity=e},enumerable:!1,configurable:!0}),e.prototype.renderMesh=function(){this._lipMaskIns&&this._lipMaskIns.render(),this._makeupMeshes.forEach((function(e){e.renderMesh()}))},e.prototype.load=function(){return x(this,void 0,void 0,(function(){var e,t,i,n,r,o,s,a;return w(this,(function(h){switch(h.label){case 0:return this._config=new c.M,[4,this._config.load()];case 1:if(h.sent(),e=this._data,M.info("makeup info",this._data),t=[],e&&e.length){try{for(i=S(e),n=i.next();!n.done;n=i.next())"iris"===(r=n.value).type?(this._irises=this._getIris(r.src,r.blend,r.intensity),this.irisBlendMode=r.blend):(r.blend+"",t.push({src:r.src,intensity:r.intensity,type:r.type,blend:r.blend}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}}M.info("makeupLayersByBlendMode",t),o=this._getMeshLayerByBlendMode(t),this._makeupMeshes.push(o)}return[4,this._initLipMask()];case 2:return h.sent(),[2]}}))}))},e.prototype._getIris=function(e,t,i){return new b(this._options,this._key,e,t,i,this._config,this._container)},e.prototype._getMeshLayerByBlendMode=function(e){var t=e.some((function(e){return"lips"===e.type}))?"lips":"makeup",i=new y(this._options,this._key,this._container,this.renderer,t);i.parentIntensity=this.parentIntensity,this._irises&&(i.irisRenderTexture=this._irises.renderTexture.baseTexture,i.irisBlendMode=this.irisBlendMode);var n=this._config.getDataConfig(26);if(!this.geometry){var r=(new a.wG).addAttribute("aVertexPosition",this._meshVertex).addAttribute("aUvs",n);this.geometry=r}return i.drawMeshBatch(e,this.geometry),i},e.prototype.resize=function(e,t){this._makeupMeshes.forEach((function(i){i.resize(e,t)})),this._irises&&this._irises.resize(e,t)},e.prototype.apply=function(e){this._target=e,this._applyMakeup(e)},e.prototype.remove=function(){this._removeMakeup(this._target)},e.prototype._applyMakeup=function(e){this._applyed||(this._applyed=!0,e.filters||(e.filters=[]),e.addChild(this._container))},e.prototype._removeMakeup=function(e){this._applyed&&(this._applyed=!1,e.filters&&e.removeChild(this._container))},e.prototype._initLipMask=function(){return x(this,void 0,void 0,(function(){var e,t,i=this;return w(this,(function(n){switch(n.label){case 0:return(e=new T(this._options,this._lipVertex,this.renderer))._options=this._options,e._lipVertex=this._lipVertex,e.renderer=this.renderer,this._lipMaskIns=e,[4,e.load()];case 1:return t=n.sent().maskSprite,this._makeupMeshes.forEach((function(e){"lips"!==e.type||i.mouthShut||(e.lipMask=t)})),[2]}}))}))},e.prototype.destroy=function(){this.remove(),this._makeupMeshes.forEach((function(e){return e.destroy()})),this._makeupMeshes=[],this._irises&&this._irises.destroy(),this._irises=null,this._container.destroy(),this._target=null,this._lipMaskIns&&this._lipMaskIns.destroy()},g([(0,u.M)("Makeup"),k("design:type",Function),k("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),k("design:returntype",void 0)],e.prototype,"_removeMakeup",null),g([(0,u.M)("Makeup"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",void 0)],e.prototype,"destroy",null),e}(),P=i(3125),E=i(401),j=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},I=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},O=function(){function e(e,t,i,n,r,o,s,c){this._container=new a.W2,this._name=e,this._src=t,this._target=n,this._config=i,this._jsonIntensity=i.intensity,this._landmarks=r,this._options=o,this._key=s,this._angles=c}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._parentIntensity=e,this._sticker&&(this._sticker.alpha=this._jsonIntensity*e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){this._landmarks=e,this._sticker&&this.setStickerProps()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._angles=e,this._sticker&&this.setStickerProps()},enumerable:!1,configurable:!0}),e.prototype.getCircle=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},e.prototype.getCircle2=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(255),t.drawCircle(0,0,e),t.endFill(),t},e.prototype.getDisplay=function(){return this._container},e.prototype.load=function(){var e,t=this;if(this.checkAnimated()){var i=[];this._src.forEach((function(e){var n;n=e.indexOf(".json")>-1?e:"".concat(t._key,"|").concat(JSON.parse(e).meta.image);var r=o.iV[n].textures,s=Object.keys(r).map((function(e){return r[e]}));i=i.concat(s)})),(e=new h.Kg(i)).animationSpeed=(this._config.fps||30)/60,e.play()}else{var n=this._src[0],r=a.P6.kN[n];e=new h.jy(r)}this._config.blend&&(e.blendMode_1=this._config.blend);this._config.wxAnchorOffset;e.width=this._config.width,e.height=this._config.height;var s=[.5,.5];this._config.anchor&&(s=this._config.anchor),e.anchor.set(s[0],s[1]),e.alpha=this._jsonIntensity*this.parentIntensity,this._sticker=e,this._container.addChild(this._sticker),this._container.convertTo3d(),this.setStickerProps()},e.prototype.setStickerProps=function(){var e=this._config,t=this._landmarks,i=E.Jp.map((function(e){return t[e]})),n=(0,p.Sp)(i[0],i[1]),r=e.wxAnchorArea,o=(e.wxAnchorOffset,e.wxWeights),s=n/E.jw,a=r.map((function(e){var i=t[e];return{x:i.x,y:i.y,z:0}}));this._container.scale.set(s);var c={x:a[0].x*o[0]+a[1].x*o[1]+a[2].x*o[2],y:a[0].y*o[0]+a[1].y*o[1]+a[2].y*o[2]};this._container.position.x=c.x,this._container.position.y=c.y,this._angles&&(this._container.euler.z=this._angles.roll,this._container.euler.y=this._angles.yaw,this._container.euler.x=this._angles.pitch)},e.prototype.checkAnimated=function(){if(this._src instanceof Array&&this._src.length>1)return!0;try{return JSON.parse(this._src[0]),!0}catch(e){return"json"===this._src[0].split(".").pop()}},e.prototype.tick=function(){},e.prototype.apply=function(){},e.prototype.remove=function(){},e.prototype.destroy=function(){this._sticker.destroy(),this._container.destroy(),this._sticker=null,this._target=null},j([(0,u.M)("StickerLayer"),I("design:type",Function),I("design:paramtypes",[]),I("design:returntype",Boolean)],e.prototype,"checkAnimated",null),j([(0,u.M)("StickerLayer"),I("design:type",Function),I("design:paramtypes",[]),I("design:returntype",void 0)],e.prototype,"destroy",null),e}(),R=function(){function e(e,t,i,n,r,o,s){void 0===s&&(s=1);var a=this;this._stickers=[],this._visible=!0,this._parentIntensity=1,this._target=i,this._options=r,this._landmarks=n;var c=new P.LE;c.setPlanes(400,10,1e4,!0),this._camera=c,this._stickers=t.map((function(t){var s=new O(t.name,t.src,t,i,n,r,e,o);return s.parentIntensity=a.parentIntensity,s.load(),a._camera.addChild(s.getDisplay()),s}))}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._stickers.forEach((function(t){t.parentIntensity=e})),this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){this._stickers.forEach((function(t){t.faceLandMarks=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._stickers.forEach((function(t){t.angles=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._target&&e!==this._visible&&(this._visible=e,e?this.apply():this.remove())},enumerable:!1,configurable:!0}),e.prototype.tick=function(){this._stickers.forEach((function(e){return e.tick()}))},e.prototype.apply=function(){this._target.addChild(this._camera)},e.prototype.remove=function(){this._target.removeChild(this._camera)},e.prototype.destroy=function(){this.remove(),this._stickers.forEach((function(e){return e.destroy()})),this._camera.destroy(),this._stickers=[]},e}(),F=i(6878),L=i(6879),V=i(201),A=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(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)}}(),N=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},U=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},z=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},D=function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},G=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},H=(0,v.jl)("Effect"),B=function(){function e(e,t,i,n,r,o,s,a,c,h,u){this.type="face",this._filters=[],this._destroyed=!1,this._visible=!0,this._intensity=1,this._filterIntensity=1,this.localSpriteSheets={},this._filtersActived=!0,this._target=t,this._stickerTarget=i,this._url=e,this._key=e,this._options=r,this.mesh=o,this.lipmesh=a,this.faceLandMarks=s,c&&(this.angles=c),void 0!==h&&(this.intensity=h),this._app3d=n,this._canvas=u}var t;return Object.defineProperty(e.prototype,"isPureFilter",{get:function(){var e=this._config;return!!e&&((!e.makeup||!e.makeup.length)&&((!e.sticker||!e.sticker.length)&&((!e.sticker3d||!e.sticker3d.length)&&(!e.beautify||!Object.keys(e.beautify).find((function(t){return!!e.beautify[t]}))))))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filterActived",{get:function(){return this._filtersActived},set:function(e){e!==this._filtersActived&&(this._filterTarget&&(e?this._applyFilter(this._filterTarget):this._removeFilter(this._filterTarget)),this._filtersActived=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app3d",{get:function(){return this._app3d},set:function(e){this._app3d=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(e){e>1&&(F.Nd.trigger("error",{message:r.Z.t("0015"),code:L.U.SET_INTENSITY_ERROR}),e=1),null!=e&&(this._makeup&&(this._makeup.parentIntensity=e),this._sticker&&(this._sticker.parentIntensity=e),this._intensity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filterIntensity",{get:function(){return this._filterIntensity},set:function(e){null!=e&&(this._filters&&this._filters.forEach((function(t){t.uniforms.parentIntensity=e})),this._filterIntensity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._destroyed||(this._visible=e,this._makeup&&(this._makeup.visible=e),this._sticker&&(this._sticker.visible=e),this._app3d&&(this._app3d.visible=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{set:function(e){this._destroyed||(this._meshVertex=e,this._makeup&&(this._makeup.mesh=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._destroyed||(this._lipVertex=e,this._makeup&&(this._makeup.lipmesh=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{get:function(){return this._faceLandMarks},set:function(e){this._destroyed||(this._faceLandMarks=e,this._makeup&&(this._makeup.faceLandMarks=e),this._sticker&&(this._sticker.faceLandMarks=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._angles=e,this._sticker&&(this._sticker.angles=e)},enumerable:!1,configurable:!0}),e.prototype.download=function(){return z(this,void 0,Promise,(function(){var e;return D(this,(function(t){switch(t.label){case 0:return[4,this._getLoader()];case 1:return[4,t.sent().preload(this._url)];case 2:return t.sent(),[4,this._getConfig()];case 3:return e=t.sent(),v.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return z(this,void 0,Promise,(function(){var e,t,i,n,r,o;return D(this,(function(s){switch(s.label){case 0:return[4,this.download()];case 1:return e=s.sent(),t=e.filter,i=e.makeup,n=e.beautify,r=e.sticker,o=e.sticker3d,[4,this._loadImages(e)];case 2:return s.sent(),this.loadFilter(t),[4,this.setMakeup(i)];case 3:return s.sent(),r?[4,this.loadStickers(r)]:[3,5];case 4:s.sent(),s.label=5;case 5:return[4,this.load3d(o)];case 6:return s.sent(),this.sticker3d=o,[4,this._getLoader()];case 7:return s.sent().removeFromCache(this._url),[2,n]}}))}))},e.prototype._getLoader=function(){return z(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new o.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return z(this,void 0,void 0,(function(){var e;return D(this,(function(t){switch(t.label){case 0:return this._config?[3,3]:[4,this._getLoader()];case 1:return[4,(e=t.sent()).preload(this._url)];case 2:t.sent(),this._config=e.readJSON("content.json",this._key),t.label=3;case 3:return[2,this._config]}}))}))},e.prototype.hasEyeMakeup=function(){return z(this,void 0,Promise,(function(){var e,t,i,n,r,o,s,a;return D(this,(function(c){switch(c.label){case 0:return[4,this._getConfig()];case 1:e=c.sent(),t=e.makeup,i=!1;try{for(n=G(t),r=n.next();!r.done;r=n.next())if("iris"===(o=r.value).type||"eyes"===o.type){i=!0;break}}catch(e){s={error:e}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}}return[2,i]}}))}))},e.prototype.needDetection=function(){return z(this,void 0,Promise,(function(){var e,t,i,n;return D(this,(function(r){switch(r.label){case 0:return[4,this._getConfig()];case 1:return e=r.sent(),t=e.makeup,i=e.sticker,n=e.sticker3d,[2,t&&t.length||i&&i.length||n&&n.length]}}))}))},e.prototype.hasFilter=function(){return z(this,void 0,Promise,(function(){var e,t;return D(this,(function(i){switch(i.label){case 0:return[4,this._getConfig()];case 1:return e=i.sent(),[2,!(!(t=e.filter)||!t.length)]}}))}))},e.prototype.loadStickers=function(e){return z(this,void 0,Promise,(function(){var t;return D(this,(function(i){return e.length?((t=new R(this._key,e,this._stickerTarget,this.faceLandMarks,this._options,this._angles)).parentIntensity=this.intensity,this._sticker=t,[2]):[2,Promise.resolve()]}))}))},e.prototype.loadSticker3d=function(e){return void 0===e&&(e=[]),z(this,void 0,Promise,(function(){return D(this,(function(e){return[2]}))}))},e.prototype.load3d=function(e){return z(this,void 0,void 0,(function(){return D(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return z(this,void 0,void 0,(function(){return D(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.setMakeup=function(e){return e.length?(this._makeup=new C(this._key,e,this._options,this._meshVertex,this.faceLandMarks,this._lipVertex,this.renderer,this.intensity),this._makeup.load()):Promise.resolve()},e.prototype.resize=function(e,t){this._makeup&&this._makeup.resize(e,t)},e.prototype.apply=function(e){this._destroyed||this._applyed||(this.filterActived&&this._applyFilter(e.filterTarget),this._filters.length&&e.filterCallback&&e.filterCallback(),this._filterTarget=e.filterTarget,this._makeup&&this._makeup.apply(this._target),this._sticker&&this._sticker.apply(),this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(){this._makeup&&this._makeup.remove(),this._sticker&&this._sticker.remove(),this.removeForConsole(),this._removeFilter(this._filterTarget),this._applyed=!1},e.prototype.tick=function(){this._sticker&&this._sticker.tick()},e.prototype.tickMesh=function(){this._makeup&&this._makeup.renderMesh()},e.prototype.destroy=function(){this._destroyed=!0,this.remove(),this._makeup&&(this._makeup.destroy(),this._makeup=null),this._sticker&&(this._sticker.destroy(),this._sticker=null),this.destroyForConosle(),this._filters=[],this.clearTexture()},e.prototype.loadFilter=function(e){var t=this;this._destroyed||e&&e.length&&e.forEach((function(e){var i=t._createFilterSync(e.src,e.intensity,t.filterIntensity);t._filters.push(i)}))},e.prototype._applyFilter=function(e){e.filters||(e.filters=[]),e.filters=this._filters.concat(e.filters)},e.prototype._removeFilter=function(e){e&&e.filters&&e.filters.length&&this._filters.forEach((function(t){var i=e.filters.findIndex((function(e){return e===t}));i>-1&&e.filters.splice(i,1)}))},e.prototype._createFilterSync=function(e,t,i){var n="default"===this._key?e:"".concat(this._key,"|").concat(e),r=a.P6.kN[n];return r.baseTexture.scaleMode=a.aH.LINEAR,r.baseTexture.mipmap=a.KI.OFF,new s.f("lut",this._options,{uniforms:{lut:r,intensity:t,parentIntensity:i}})},e.prototype.clearTexture=function(){for(var e in a.P6.kN)if(e.indexOf(this._key)>-1){var t=a.P6.kN[e];a.xE.removeFromCache(t),t.destroy(!0)}for(var e in this.localSpriteSheets)o.iV[e]&&o.iV[e]instanceof a.c2&&(o.iV[e].destroy(),delete o.iV[e])},e.prototype._loadImages=function(e){var t,i,n=this,r=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),s=this._loader.getIndeLoader(),c={};this.localSpriteSheets=c;try{for(var h=G(r),u=h.next();!u.done;u=h.next()){var l=u.value;if(l.src instanceof Array)l.src.forEach((function(e,t){var i=n.checkSpriteSheetJSON(e);if(i){var r=i.meta.image,o="".concat(n._key,"|").concat(r);if(a.P6.kN[o])return;if(0===r.indexOf("blob:")){var h=a.xE.from(r);a.xE.addToCache(h,o)}else s.add(o,r);i.meta.image="",c[o]=i}else{if(a.P6.kN[e])return;if(s.resources[e])return;s.add(e,e)}}));else{var p="".concat(this._key,"|").concat(l.src);if(a.P6.kN[p])continue;if(0===l.src.indexOf("blob:")){var f=a.xE.from(l.src);a.xE.addToCache(f,p)}else s.add(p,l.src)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=h.return)&&i.call(h)}finally{if(t)throw t.error}}return new Promise((function(e){s.load((function(t,i){return z(n,void 0,void 0,(function(){var t,n,r,s,h;return D(this,(function(u){switch(u.label){case 0:for(r in t=function(e){var t;return D(this,(function(i){switch(i.label){case 0:return o.iV[e]?[2,"continue"]:c[e]?(t=new a.c2(a.P6.kN[e],c[e],"@".concat((0,V.u)(),"x")),[4,new Promise((function(i){t.parse((function(){o.iV[e]=t,i()}))}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))},n=[],a.P6.kN)n.push(r);s=0,u.label=1;case 1:return s<n.length?(h=n[s],[5,t(h)]):[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:for(h in i)o.iV[h]||c[h]||(o.iV[h]=i[h]);return e(),[2]}}))}))}))}))},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},N([(0,u.M)("Effect"),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"remove",null),N([(0,u.M)("Effect"),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"destroy",null),N([(0,u.M)("Effect"),U("design:type",Function),U("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),U("design:returntype",void 0)],e.prototype,"_removeFilter",null),e}(),J=function(e){function t(t,i,n,r,o,s,a,c){var h=e.call(this,"default",i,n,r,o,s,a,c)||this;return h._json=t,h._app3d=r,h}return A(t,e),t.prototype.load=function(){return z(this,void 0,Promise,(function(){var e,t,i,n,r,o;return D(this,(function(s){switch(s.label){case 0:return e=this._json,t=e.filter,i=e.makeup,n=e.beautify,r=e.sticker,o=e.sticker3d,[4,this._loadImages(e)];case 1:return s.sent(),this.loadFilter(t),[4,this.setMakeup(i)];case 2:return s.sent(),r?[4,this.loadStickers(r)]:[3,4];case 3:s.sent(),s.label=4;case 4:return o?this._app3d?[3,6]:[4,this.initThreeApp()]:[3,8];case 5:s.sent(),s.label=6;case 6:return[4,this.loadSticker3d(o||[])];case 7:s.sent(),s.label=8;case 8:return[2,n]}}))}))},t.prototype.loadImage=function(){return z(this,void 0,void 0,(function(){return D(this,(function(e){return[2]}))}))},t.prototype._loadImages=function(e){var t,i,n=this,r=new a.aN,s=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),c={},h=function(e){if(e.src instanceof Array)e.src.forEach((function(t,i){var o=n.checkSpriteSheetJSON(t);if(o){var s=o.meta.image,h="".concat(n._key,"|").concat(s);if(a.P6.kN[h])return;if(e.objectSrc&&e.objectSrc.length){var u=a.xE.from(e.objectSrc[i]);a.xE.addToCache(u,h)}else if(0===s.indexOf("blob:")){u=a.xE.from(s);a.xE.addToCache(u,h)}else r.add(h,s);o.meta.image="",c[h]=o}else{if(a.P6.kN[t])return;if(r.resources[t])return;if(e.objectSrc&&e.objectSrc.length){u=a.xE.from(e.objectSrc[i],{resolution:(0,V.u)()});a.xE.addToCache(u,t)}else r.add(t,t)}}));else{if(a.P6.kN[e.src])return"continue";if(r.resources[e.src])return H.info("already loaded file",e.src),"continue";if(e.objectSrc){H.info("use imagebitmap to create texture");var t=a.xE.from(e.objectSrc);a.xE.addToCache(t,e.src)}else if(0===e.src.indexOf("blob:")){t=a.xE.from(e.src);H.info("JSONEffect blob texture",t),a.xE.addToCache(t,e.src)}else r.add(e.src)}};try{for(var u=G(s),l=u.next();!l.done;l=u.next()){h(l.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}return new Promise((function(e){return z(n,void 0,void 0,(function(){var t=this;return D(this,(function(i){return r.load((function(i,n){return z(t,void 0,void 0,(function(){var t,i,r,s,h;return D(this,(function(u){switch(u.label){case 0:for(r in t=function(e){var t;return D(this,(function(i){switch(i.label){case 0:return o.iV[e]?[2,"continue"]:c[e]?(t=new a.c2(a.P6.kN[e],c[e],"@".concat((0,V.u)(),"x")),[4,new Promise((function(i){t.parse((function(){o.iV[e]=t,i()}))}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))},i=[],a.P6.kN)i.push(r);s=0,u.label=1;case 1:return s<i.length?(h=i[s],[5,t(h)]):[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:for(h in n)o.iV[h]||c[h]||(o.iV[h]=n[h]);return e(),[2]}}))}))})),[2]}))}))}))},t.prototype.loadSticker3d=function(e){return z(this,void 0,Promise,(function(){return D(this,(function(e){return[2]}))}))},t}(B),W=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(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)}}(),q=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},K=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Y=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},X=function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Z=((0,v.jl)("Effect"),function(){function e(e,t,i,n){this.type="hand",this._destroyed=!1,this._visible=!0,this._intensity=1,this.localSpriteSheets={},this._url=e,this._key=e,this._app3d=t,this._canvas=n,this._options=i}return Object.defineProperty(e.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app3d",{get:function(){return this._app3d},set:function(e){this._app3d=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(e){this._intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._destroyed||(this._visible=e)},enumerable:!1,configurable:!0}),e.prototype.download=function(){return Y(this,void 0,Promise,(function(){var e;return X(this,(function(t){switch(t.label){case 0:return[4,this._getLoader()];case 1:return[4,t.sent().preload(this._url)];case 2:return t.sent(),[4,this._getConfig()];case 3:return e=t.sent(),v.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return Y(this,void 0,Promise,(function(){var e,t;return X(this,(function(i){switch(i.label){case 0:return[4,this.download()];case 1:return e=i.sent(),t=e.hand,[4,this.load3d(t||[])];case 2:return i.sent(),[4,this._getLoader()];case 3:return i.sent().removeFromCache(this._url),[2,null]}}))}))},e.prototype._getLoader=function(){return Y(this,void 0,void 0,(function(){return X(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new o.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return Y(this,void 0,void 0,(function(){var e;return X(this,(function(t){switch(t.label){case 0:return this._config?[3,3]:[4,this._getLoader()];case 1:return[4,(e=t.sent()).preload(this._url)];case 2:t.sent(),this._config=e.readJSON("content.json",this._key),t.label=3;case 3:return[2,this._config]}}))}))},e.prototype.load3d=function(e){return Y(this,void 0,void 0,(function(){return X(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return Y(this,void 0,void 0,(function(){return X(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.apply=function(){this._destroyed||this._applyed||(this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(){this.removeForConsole(),this._applyed=!1},e.prototype.tick=function(){},e.prototype.tickMesh=function(){},e.prototype.destroy=function(){this._destroyed=!0,this.remove(),this.destroyForConosle(),this.clearTexture()},e.prototype.clearTexture=function(){for(var e in a.P6.kN)if(e.indexOf(this._key)>-1){var t=a.P6.kN[e];a.xE.removeFromCache(t),t.destroy(!0)}for(var e in this.localSpriteSheets)o.iV[e]&&o.iV[e]instanceof a.c2&&(o.iV[e].destroy(),delete o.iV[e])},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},q([(0,u.M)("Effect"),K("design:type",Function),K("design:paramtypes",[]),K("design:returntype",void 0)],e.prototype,"remove",null),q([(0,u.M)("Effect"),K("design:type",Function),K("design:paramtypes",[]),K("design:returntype",void 0)],e.prototype,"destroy",null),e}()),$=function(e){function t(t,i,n,r){var o=e.call(this,"default",i,n,r)||this;return o._json=t,o._app3d=i,o}return W(t,e),t.prototype.load=function(){return Y(this,void 0,Promise,(function(){var e,t;return X(this,(function(i){switch(i.label){case 0:return e=this._json,(t=e.hand)?this._app3d?[3,2]:[4,this.initThreeApp()]:[3,4];case 1:i.sent(),i.label=2;case 2:return[4,this.loadHand3d(t||[])];case 3:i.sent(),i.label=4;case 4:return[2,null]}}))}))},t.prototype.loadImage=function(){return Y(this,void 0,void 0,(function(){return X(this,(function(e){return[2]}))}))},t.prototype.loadSticker3d=function(e){return Y(this,void 0,Promise,(function(){return X(this,(function(e){return[2]}))}))},t.prototype.loadHand3d=function(e){return Y(this,void 0,Promise,(function(){return X(this,(function(e){return[2]}))}))},t}(Z),Q=i(5156),ee=i(7959),te=i(6309),ie=i(1077),ne=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(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)}}(),re=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},oe=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},se=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},ae=function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ce=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},he=(0,v.jl)("Renderer"),ue=function(){};var le=function(e){function t(t){var i=e.call(this,t)||this;return i._setup=!1,i._effects=[],i._debug=!0,i._destroyed=!1,i._isVR=!1,i._meshVertexTimer=0,i.lib3dLoaded=!1,i.libHand3dLoaded=!1,he.info("[@#$] AR Renderer Constructed",location),i._debug=!1,t.output?i._canvas=new wx.window.Canvas(t.output):i._canvas=new wx.window.Canvas(wx.createOffscreenCanvas({type:"webgl",width:t.width,height:t.height})),i._stage=new a.W2,i._options=t,a.Xd.RESOLUTION=(0,V.u)(),a.Xd.FILTER_RESOLUTION=(0,V.u)(),i._renderer=new a.Th({view:i._canvas,width:t.width,height:t.height,useContextAlpha:!1,preserveDrawingBuffer:!1,antialias:!1}),i.setRenderer(),i.initRenderContext(t),i.handleLoading(),i.setup(),i}return ne(t,e),Object.defineProperty(t.prototype,"mirror",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backGroundVR",{set:function(e){if(e){this._backgroundVR=new a.jy(a.xE.from(e));var t=this._backgroundVR,i=t.width,n=t.height,r=Math.max(this._options.width/i,this._options.height/n);this._backgroundVR.width*=r,this._backgroundVR.height*=r}else this._backgroundVR=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{set:function(e){var t=e.width,i=e.height;this._canvas.width=t,this._canvas.height=i,this._renderer&&this.resize(t,i),this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=i,this._baseSprite.position.set(t/2,i/2),this._baseSprite.anchor.set(.5,.5)),this._baseRenderTexture.resize(t,i),this._makeupRenderTexture.resize(t,i),this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app3d",{get:function(){return this._app3d},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"avatar3d",{get:function(){return this._avatar3d},enumerable:!1,configurable:!0}),t.prototype.initRenderContext=function(e){this._baseContainer=new a.W2,this._makeupContainer=new a.W2,this._frontContainer=new a.W2,this._frontContainer.sortableChildren=!0,this._finalContainer=new a.W2,this._baseRenderTexture=a.TI.create({width:e.width,height:e.height}),this._makeupRenderTexture=a.TI.create({width:e.width,height:e.height}),this._makeupContainer.addChild(new a.jy(this._baseRenderTexture)),ue.baseTexture=this._baseRenderTexture,this._finalContainer.addChild(new a.jy(this._makeupRenderTexture)),this._finalContainer.addChild(this._frontContainer),this._stage.addChild(this._finalContainer),this._target=this._finalContainer},t.prototype.loadLib3d=function(){return se(this,void 0,Promise,(function(){var e;return ae(this,(function(t){switch(t.label){case 0:return e=new te.e({}),he.info("loader init"),[4,e.init()];case 1:return t.sent(),he.info("loader init done"),this._options.plugin3d&&this._options.plugin3d(B,J,e,wx.window),[2]}}))}))},t.prototype.loadHand3d=function(){return se(this,void 0,Promise,(function(){var e;return ae(this,(function(t){switch(t.label){case 0:return e=new te.e({}),he.info("+++++loader init"),[4,e.init()];case 1:return t.sent(),he.info("+++++loader init done"),this._options.plugin3d&&this._options.pluginHand(Z,$,e,wx.window),[2]}}))}))},t.prototype.setup=function(){return se(this,void 0,void 0,(function(){return ae(this,(function(e){switch(e.label){case 0:return this._setup?[2]:(this._config=new c.M,[4,this._config.load()]);case 1:return e.sent(),this._setup=!0,[2]}}))}))},Object.defineProperty(t.prototype,"meshVertex",{get:function(){return this._meshVertex},set:function(e){this._meshVertex=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mirrorFilter",{get:function(){return this._mirrorFilter||(this._mirrorFilter=new s.f("mirror",{width:l.t.instance.options.width,height:l.t.instance.options.height})),this._mirrorFilter},enumerable:!1,configurable:!0}),t.prototype.switchMode=function(e){v.bH.info("switchMode",e),e!==this._mode3d&&("Sticker"===e&&this.setAvatar(null),this._mode3d=e)},t.prototype.logTime=function(e){var t=+new Date;he.info("".concat(e," time:").concat(t-this.currentTime)),this.currentTime=t},t.prototype.tick=function(t,i){var n=t.landmarks,r=t.meshVertex,o=t.lipVertex,s=t.image,c=t.angles,h=(t.backgroundType,t.background,t.segmentation,t.blendshapes,t.isLivePusher);t.hair;if(!this._destroyed)if(this._renderer)if(this._stage)if(this._setup){this.currentTime=+new Date,this._image=s;try{this._renderer.reset()}catch(e){}if(this._isVR)try{this._renderer.render(this._backgroundVR)}catch(e){}else{if(h)if(this._baseSprite)this._baseSprite.texture.update();else{d=a.xE.from(s);this._baseSprite=new a.jy(d),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2),this._baseSprite.scale.set(1,-1),this._baseContainer.addChild(this._baseSprite)}else{var u=s,l=u.width,p=u.height,f=u.data;if(this._baseSprite){if(this._baseSprite.texture.width===l&&this._baseSprite.texture.height===p)this._baseSprite.texture.baseTexture.resource.data=new Uint8Array(f),this._baseSprite.texture.update();else this._baseSprite.texture.destroy(!0),this._baseSprite.texture=a.xE.fromBuffer(new Uint8Array(f),l,p)}else{var d=a.xE.fromBuffer(new Uint8Array(f),l,p);this._baseSprite=new a.jy(d),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2);var _=Math.max(this._options.width/l,this._options.height/p);this._baseSprite.scale.set(_),this._baseContainer.addChild(this._baseSprite)}}(ee.s.checkEnabled("beautify")||ee.s.checkEnabled("segmentation")||ee.s.checkEnabled("hair"))&&(e.prototype.setMesh.call(this,r),e.prototype.setReshapeMarks.call(this,n),n&&n.length?(this._faceLandmarks=n,this._angles=c,this.meshVertex=r,this.lipVertex=o,this.detected=!0,this._effects.forEach((function(e){e.visible||(e.visible=!0),e.lipmesh=o,e.mesh=r,e.angles=c,e.faceLandMarks=n,e.tick()})),"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=n,this._app3d.angles=c)):(this.handleNoFace(),this.detected=!1)),this._render()}}else v.b_.info("_renderer waiting for setup");else v.b_.info("_renderer waiting for stage");else v.b_.info("_renderer waiting for renderer")},t.prototype.handleNoFace=function(){this._effects.forEach((function(e){return e.visible=!1})),this._effects.forEach((function(e){e.tickMesh()}));new Date;"AR"===this._mode3d||"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=[],this._app3d.angles={})},t.prototype._render=function(){this.renderLayers(),ee.s.checkEnabled("beautify")&&"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&this._app3d.render(),ee.s.checkEnabled("handLandmark")&&this._appHand3d&&this._appHand3d.render()},t.prototype.renderLayers=function(){this._options.isWxAndroid?(this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture}),this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture})):(this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture}),this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture})),this._renderer.render(this._stage)},t.prototype.getBaseTexture=function(){return this._baseSprite.texture},t.prototype.removeBackground=function(){this.background&&(this.background.remove(),this.background=null)},t.prototype.applyBackground=function(e){this.background},t.prototype.removeForeground=function(){this._frontContainer&&(this._frontContainer.children.forEach((function(e){e.destroy()})),this._frontContainer.removeChildren())},t.prototype.addForeground=function(e){var t=this;if(Array.isArray(e)){var i={};for(var n in this._frontContainer.children.forEach((function(e){i[e.id]=e})),e.forEach((function(e,n){var r=i[e.id];r?(r.zIndex=n,delete i[e.id]):t._addForeground(e,n)})),i)i[n].destroy(),this._frontContainer.removeChild(i[n]);this._frontContainer.sortChildren()}else this._addForeground(e)},t.prototype._addForeground=function(e,t){var i=e.image,n=e.type,r=e.id,o=l.t.instance.options,s=o.width,c=o.height,u="data"in i?a.xE.fromBuffer(new Uint8Array(i.data.buffer),i.width,i.height):a.xE.from(i),p=new h.jy(u);"video"===n&&(p.blendMode_1=6),p.width=s,p.height=c,p.id=r,t&&(p.zIndex=t),this._frontContainer.addChild(p)},t.prototype.debugDraw=function(e){if(!this.points){for(var t=[],i=0;2*i<e.length;i++){var n=this.getCircle(2);t.push(n),this._baseContainer.addChild(n)}this.points=t}for(i=0;2*i<e.length;i++)this.points[i].x=e[2*i],this.points[i].y=e[2*i+1]},t.prototype.debugDraw2=function(e){if(he.info("debug draw 2",e.length),!this.points){for(var t=[],i=0;i<e.length;i++){var n=this.getCircle(2);t.push(n),this._baseContainer.addChild(n)}this.points=t}for(i=0;i<e.length;i++)this.points[i].x=540*e[i].x,this.points[i].y=540*e[i].y},t.prototype.getPixels=function(){var e=this._options,t=e.width,i=e.height,n=new Uint8Array(t*i*4),r=this._renderer.gl;return r.readPixels(0,0,t,i,r.RGBA,r.UNSIGNED_BYTE,n),{data:n,width:t,height:i}},t.prototype.setEffect=function(e,t,i,n){return se(this,void 0,Promise,(function(){var r,o=this;return ae(this,(function(s){return r=!0,this.latestEffectUrls&&this.latestEffectUrls.length===e.length&&e.every((function(e){return o.latestEffectUrls.indexOf(e)>-1}))&&(r=!1,this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)),this.latestEffectUrls=e,[2,new Promise((function(s,a){r?(o.debounceTimer&&(clearTimeout(o.debounceTimer),o.debounceTimer=null),o.debounceTimer=setTimeout((function(){return o._setEffect(e,t,i,n).then((function(e){clearTimeout(o.debounceTimer),o.debounceTimer=null,s(e)}))}),100)):o._setEffect(e,t,i).then((function(e){s(e)}))}))]}))}))},t.prototype._setEffect=function(e,t,i,n){return se(this,void 0,Promise,(function(){var r,s=this;return ae(this,(function(a){return v.b_.time("waiting for AI init..."),ee.s.checkEnabled("beautify")&&!this._meshVertex?[2,new Promise((function(r){clearTimeout(s._meshVertexTimer),s._meshVertexTimer=setInterval((function(){v.b_.info("waiting for AI init..."),s._meshVertex&&(v.b_.info("waiting for AI init...done"),clearTimeout(s._meshVertexTimer),s._setEffect(e,t,i,n).then((function(){r(s._effects)})))}),200)}))]:(v.b_.timeEnd("waiting for AI init..."),r="uid_"+Math.floor(1e8*Math.random()),[2,new Promise((function(a,c){return se(s,void 0,void 0,(function(){var s,c,h,u,l,p,f,d,_,y,b,m,g,k,x,w,S,M=this;return ae(this,(function(T){switch(T.label){case 0:for(s=[].concat(this._effects),c=[],h=[],u=[],l=[],p=[],f=[],d=[],_=[],e.length||(this.filterActivedEffect=null),y=[],b=function(n){var r=s.findIndex((function(t){return t.url===e[n]}));if(r>-1)c.push(s[r]),s[r],h.push(t[n]),u.push(i[n]),s.splice(r,1);else{var a=e[n];_.push(function(e){return se(this,void 0,Promise,(function(){var t,i;return ae(this,(function(n){switch(n.label){case 0:return[4,(t=new o.pF).init()];case 1:return n.sent(),[4,t.preload(e)];case 2:return n.sent(),i=t.readJSON("content.json",e),v.D4.info("download:",e,i),[2,i]}}))}))}(a)),y.push(a),p.push(t[n]),f.push(i[n])}},m=0;m<e.length;m++)b(m);return[4,Promise.all(_)];case 1:for(g=T.sent(),!1,k=!1,x=0;x<g.length;x++)w=y[x],S=void 0,(S=new B(w,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex,this._angles,p[x],this._canvas)).filterIntensity=f[x],g[x].sticker3d&&g[x].sticker3d.length&&(k=!0),S.renderer=this._renderer,l.push(S);return v.b_.time("require 3d lib"),this.lib3dLoaded||!k?[3,3]:n&&!n()?[2]:(he.info("require 3d lib"),[4,this.loadLib3d()]);case 2:T.sent(),this.lib3dLoaded=!0,T.label=3;case 3:return v.b_.timeEnd("require 3d lib"),v.b_.info("check all new Effects",l,s),l.forEach((function(e){d.push(e.load().then((function(){return e.intensity=e.intensity,M._app3d||"face"!==e.type||(M._app3d=e.app3d),M._appHand3d||"hand"!==e.type||(M._appHand3d=e.app3d),e})).catch((function(e){he.warn("effect load error",e)})))})),v.b_.time("renderer parse effect"),Promise.all(d).then((function(e){v.b_.timeEnd("renderer parse effect"),v.b_.time("renderer apply effect");for(var t=!1,i=0;i<l.length;i++){var n=l[i];M.latestEffectUrls&&-1===M.latestEffectUrls.indexOf(n.getUrl())&&(n.destroy(),t=!0)}if(t)he.info(r+"end");else{s.forEach((function(e){e.remove()})),M._effects=c,c.forEach((function(e,t){e.intensity=h[t],e.filterIntensity=u[t]}));for(i=0;i<l.length;i++){n=l[i];M._effects.push(n),n.apply({filterTarget:M._baseSprite,filterCallback:function(){}})}s.forEach((function(e){e.destroy()})),v.b_.timeEnd("renderer apply effect"),a(M._effects)}})),[2]}}))}))}))])}))}))},t.prototype.setEffectJSON=function(e){return se(this,void 0,void 0,(function(){var t,i,n,r,o,s=this;return ae(this,(function(a){switch(a.label){case 0:return i=e.sticker3d,n=e.hand,i&&i.length&&!this.lib3dLoaded?(he.info("require 3d lib"),[4,this.loadLib3d()]):[3,2];case 1:a.sent(),this.lib3dLoaded=!0,a.label=2;case 2:return n&&n.length&&!this.libHand3dLoaded?(he.info("require 3d hand lib"),[4,this.loadHand3d()]):[3,4];case 3:a.sent(),this.libHand3dLoaded=!0,a.label=4;case 4:return r=!1,(o=function(){ee.s.checkEnabled("beautify")&&s._meshVertex&&(t&&clearTimeout(t),r=!0,s.getJSONEffectForFace(e)),ee.s.checkEnabled("handLandmark")&&n&&n.length&&(r=!0,s.getJSONEffectForHand(e)),r||(t=setTimeout(o,20))})(),[2]}}))}))},t.prototype.getJSONEffectForHand=function(e){var t=this,i=new $(e,this._appHand3d,this._options,this._canvas);i.renderer=this._renderer,v.b_.info("getJSONEffectForHand"),i.load().then((function(){t._appHand3d||(t._appHand3d=i.app3d),i.apply()}))},t.prototype.getJSONEffectForFace=function(e){var t=this,i=new J(e,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex);return i.renderer=this._renderer,i.load().then((function(){t._app3d||(t._app3d=i.app3d);var e=[].concat(t._effects);t._effects=[i],i.apply({filterTarget:t._baseSprite}),e.forEach((function(e){e.destroy()}))})),i},t.prototype.setExclusiveFilter=function(e,t){var i=this;return void 0===t&&(t=1),new Promise((function(n,r){!function(){if(i.exclusiveFilter&&i.exclusiveFilter.getUrl()===e)i.exclusiveFilter.intensity=t,i.exclusiveFilter.filterIntensity=t;else{var r=new B(e,i._makeupContainer,i._finalContainer,i._app3d,i._options,i._meshVertex,i._faceLandmarks,i.lipVertex,i._angles,t);r.filterIntensity=t,r.load().then((function(){i.exclusiveFilter&&i.exclusiveFilter.destroy(),i.exclusiveFilter=r,r.renderer=i._renderer,r.apply({filterTarget:i._baseSprite}),n()}))}}()}))},t.prototype.resize=function(t,i,n){void 0===n&&(n=!0),e.prototype.resize.call(this,t,i),he.info("renderer resize",t,i,n),this._options.width=t,this._options.height=i,this._renderer.resize(t,i),this.background&&this.background.resize(t,i),this._app3d?this._app3d.resize(t,i):this._avatar3d&&this._avatar3d.resize(t,i),this._makeupRenderTexture&&this._makeupRenderTexture.resize(t,i),this._baseRenderTexture&&this._baseRenderTexture.resize(t,i),n&&this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=i,this._baseSprite.position.set(t/2,i/2),this._baseSprite.anchor.set(.5,.5),this._baseSprite.scale.set(1)),this._effects.forEach((function(e){e.resize(t,i)}))},t.prototype.disableExclusiveFilter=function(){this.exclusiveFilter&&this.exclusiveFilter.remove()},t.prototype.enableExclusiveFilter=function(){this.exclusiveFilter&&this.exclusiveFilter.apply({filterTarget:this._baseSprite,filterCallback:function(){}})},t.prototype.disableEffects=function(e){void 0===e&&(e=!1),this._effects.forEach((function(t){!e&&t.isPureFilter||"hand"===t.type||t.remove()}))},t.prototype.enableEffects=function(){var e=this;this._effects.forEach((function(t){t.apply({filterTarget:e._baseSprite,filterCallback:function(){}})}))},t.prototype.removeExclusiveFilter=function(){this.exclusiveFilter&&(this.exclusiveFilter.destroy(),this.exclusiveFilter=null)},t.prototype.initAvatarApp=function(e,t){return se(this,void 0,void 0,(function(){return ae(this,(function(e){return[2]}))}))},t.prototype.setAvatar=function(e,t){return se(this,void 0,void 0,(function(){return ae(this,(function(e){return[2]}))}))},t.prototype.registerAvatar=function(e){},t.prototype.reCorrectAvatar=function(){return se(this,void 0,void 0,(function(){return ae(this,(function(e){return[2]}))}))},t.prototype.getCanvas=function(){return this._canvas},t.prototype.setOptions=function(e){},t.prototype.mount=function(e){this._canvas&&e.appendChild(this._canvas)},t.prototype.getCircle=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},t.preloadEffects=function(e){return se(this,void 0,Promise,(function(){var t,i,n,r,s,a,c;return ae(this,(function(h){switch(h.label){case 0:return e.length?[4,(t=new o.pF).init()]:[2];case 1:h.sent(),i=[];try{for(n=ce(e),r=n.next();!r.done;r=n.next())(s=r.value)&&i.push(t.preload(s))}catch(e){a={error:e}}finally{try{r&&!r.done&&(c=n.return)&&c.call(n)}finally{if(a)throw a.error}}return[2,Promise.all(i).then((function(){return Promise.resolve()})).catch((function(e){return Promise.reject(e)}))]}}))}))},t.prototype.handleLoading=function(){var e=this._options,i=e.enableLoadingIcon,n=e.loadingIconOptions,r=void 0===n?{}:n;if(i){var o=t.loading=new Q.Z(r);o.zIndex=20;var s=this._options,a=s.width,c=s.height;o.x=a/2,o.y=c/2,this._stage.addChild(o)}},t.prototype.showLoading=function(){t.loading&&t.loading.show()},t.prototype.hideLoading=function(){t.loading&&t.loading.hide()},t.prototype.destroy=function(e){void 0===e&&(e=!0),this.hideLoading(),t.loading&&t.loading.destroy(),e&&ue.baseTexture&&(ue.baseTexture.destroy(!0),ue.baseTexture=null),this._destroyed=!0,this._effects.forEach((function(e){e.destroy()})),this.exclusiveFilter&&this.exclusiveFilter.destroy(),this._stage&&this._stage.destroy(!0),this._renderer&&this._renderer.destroy(!0),this.background&&this.background.destroy(),this._app3d&&this._app3d.destroy(),this._appHand3d&&this._appHand3d.destroy(),this._meshVertexTimer&&clearTimeout(this._meshVertexTimer),this.destroyAvatar()},t.prototype.destroyAvatar=function(){this._avatar3d&&(this._avatar3d.destroy(),this._avatar3d=null)},re([(0,u.M)("ArRenderer"),oe("design:type",Function),oe("design:paramtypes",[Object]),oe("design:returntype",void 0)],t.prototype,"destroy",null),t}(ie.F)}}]);