tencentcloud-webar 2.0.0-alpha.6 → 2.0.0

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],{4385:(e,t,i)=>{i.d(t,{g:()=>be,b:()=>me});var n,r=i(9522),s=i(3044),o=i(9124),a=i(1206),c=i(3125),u=i(9560),h=i(401),p=i(1347),l=i(1084),f=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},d=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,s,o,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=s,this._key=o,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=s.iV[n].textures,o=Object.keys(r).map((function(e){return r[e]}));i=i.concat(o)})),(e=new u.Kg(i)).animationSpeed=(this._config.fps||30)/60,e.play()}else{var n=this._src[0],r=a.P6.kN[n];e=new u.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 o=[.5,.5];this._config.anchor&&(o=this._config.anchor),e.anchor.set(o[0],o[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=h.Jp.map((function(e){return t[e]})),n=(0,p.Sp)(i[0],i[1]),r=e.wxAnchorArea,s=(e.wxAnchorOffset,e.wxWeights),o=n/h.jw,a=r.map((function(e){var i=t[e];return{x:i.x,y:i.y,z:0}}));this._container.scale.set(o);var c={x:a[0].x*s[0]+a[1].x*s[1]+a[2].x*s[2],y:a[0].y*s[0]+a[1].y*s[1]+a[2].y*s[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},f([(0,l.M)("StickerLayer"),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",Boolean)],e.prototype,"checkAnimated",null),f([(0,l.M)("StickerLayer"),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],e.prototype,"destroy",null),e}(),_=function(){function e(e,t,i,n,r,s,o){void 0===o&&(o=1);var a=this;this._stickers=[],this._visible=!0,this._parentIntensity=1,this._target=i,this._options=r,this._landmarks=n;var u=new c.LE;u.setPlanes(400,10,1e4,!0),this._camera=u,this._stickers=t.map((function(t){var o=new y(t.name,t.src,t,i,n,r,e,s);return o.parentIntensity=a.parentIntensity,o.load(),a._camera.addChild(o.getDisplay()),o}))}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}(),g=i(6878),m=i(6879),b=i(6109),v=i(201),k=i(617),x=i(3849),w=(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)}),M=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},T=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},S=(0,b.jl)("merged-makeup-layer");var E=function(){function e(e,t,i,n,r){this._destroyed=!1,this.type="makeup",this._parentIntensity=1,this._jsonIntensity=1,this.textures=[],this.files=[],this._options=e,this._container=t,this._lipMaskTexture=r,this.renderer=i,this.type=n||"makeup"}return e.prototype.setParentIntensityAt=function(e,t){if(this.shader&&this.files.length)for(var i=0;i<this.files.length;i++){if(this.files[i].parentKey===e)this.files[i].parentIntensity=t,this.shader.uniforms["parentIntensity".concat(i)]=t}},Object.defineProperty(e.prototype,"lipMask",{set:function(e){null===e||(this._lipMaskTexture=e.texture,this.shader&&(this.shader.uniforms.uSamplerLipMask=this._lipMaskTexture))},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){this.files=e;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 uniform sampler2D uSamplerLipMask;\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 ").concat(e.map((function(e,t){return"uniform float parentIntensity".concat(t,";")})).join("\n"),"\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 u.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\n if (mirror == 1) {\n baseCoord = vec2(1.0 - bUvs.x, bUvs.y);\n }\n \n vec4 baseColor = texture2D(baseImage, baseCoord);\n\n vec4 makeupColor = vec4(0.0);\n float alphaFromMask = 1.0 - texture2D(uSamplerLipMask, bUvs).a; \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").concat(t,";\n\n makeupColor = texture2D(uSamplerMakeup").concat(t,", vUvs) * realIntensity").concat(t," * alphaFromMask;\n \n if (makeupColor.a > 0.) {\n \n\n // 混合\n baseColor.rgb = blend").concat(u.Lc[e.blend].key,"(baseColor.rgb, makeupColor.rgb/makeupColor.a , makeupColor.a);\n \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(u.Lc[this.irisBlendMode].key,"(baseColor.rgb, irisColor.rgb/irisColor.a , irisColor.a);\n }\n "):"","\n \n \n // 输出\n gl_FragColor = baseColor;\n // gl_FragColor = makeupColor;\n }"),s={enable:1},o=this._options,c=o.width,h=o.height;s.baseImage=me.baseTexture,s.size=[c*h/me.baseTexture.height,h];var p=me.baseTexture.width*h/me.baseTexture.height;s.imageOffset=[(p-c)/2/p,0],e.forEach((function(e,t){var n=e.src,r=a.P6.kN[n];s["uSamplerMakeup".concat(t)]=r,s["intensity".concat(t)]=e.intensity,s["parentIntensity".concat(t)]=null==e.parentIntensity?1:e.parentIntensity,s.mirror=x.t.instance.options.mirror?1:0,i.textures.push(r)})),this.irisRenderTexture&&(s.uSamplerIris=this.irisRenderTexture),s.uSamplerLipMask=this._lipMaskTexture;var l=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,s);this.shader=l,x.t.instance.on("mirrorChange",(function(e){var t=e.mirror;i.shader.uniforms.mirror=t?1:0}));var f=new a.Kj(t,l);return this._mesh=f,this._container.addChild(f),f}},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)},M([(0,l.M)("MakeupLayer"),T("design:type",Function),T("design:paramtypes",[Array]),T("design:returntype",void 0)],e.prototype,"updateGeometry",null),M([(0,l.M)("MakeupLayer"),T("design:type",Function),T("design:paramtypes",[]),T("design:returntype",void 0)],e.prototype,"destroy",null),e}(),C=function(e){function t(t,i,n,r,s,o,c,u){var h=e.call(this,t,o)||this;return h._maskGraphics=new a.TC,h.maxLConSize=.42,h.maxRConSize=.42,h._parentIntensity=1,h.parentKey=c,h.jsonIntensity=r,h._parentIntensity=u||1,h.getTexture(i,n),h._config=s,h.renderTexture=a.TI.create({width:t.width,height:t.height}),h}var i,n;return w(t,e),Object.defineProperty(t.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){S.info("IrisLayer call set parentIntensity",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=e,n=a.P6.kN[i];if(n){var r=new a.jy(n),s=new a.jy(n.clone());r.anchor.set(.5),s.anchor.set(.5),this._leftIris=r,this._rightIris=s;var o=new a.W2;this._maskGraphics||(this._maskGraphics=new a.TC),o.addChild(this._maskGraphics),o.addChild(r),o.addChild(s),S.info("IrisLayer getTexture alpha",o.alpha,this.parentIntensity,this.jsonIntensity),o.alpha=this.parentIntensity*this.jsonIntensity,o.mask=this._maskGraphics,this._container=o}},t.prototype.setIrisProps=function(e,t){if(!this._destroyed&&e.length)try{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),s=i.RIGHT_EYE_ORDER,o=(n.left_eye_center,n.right_eye_center,void 0),a=void 0,c=void 0,u=void 0,h=void 0,l=void 0;if(e.length>=163){var f=e.slice(123,143),d=e.slice(143,163);a=o=this._getXRange(f),u=c=this._getXRange(d),h=e[123],l=e[143]}else{var y=(0,p.Sp)(e[52],e[55]),_=(0,p.Sp)(e[58],e[61]);a=o=y*this.maxLConSize,u=c=_*this.maxLConSize,h=(0,p.qg)(e[74],e[104]),l=(0,p.qg)(e[77],e[105])}var g=o,m=a,b=c,v=u,k=h,x=l,w=me.baseTexture.width*this._options.height/me.baseTexture.height;k.x-=(w-this._options.width)/2,x.x-=(w-this._options.width)/2;var M=this._leftIris,T=this._rightIris;M.width=g*(this._options.irisScale||1),M.height=m*(this._options.irisScale||1),M.x=k.x,M.y=k.y,T.width=b*(this._options.irisScale||1),T.height=v*(this._options.irisScale||1),T.x=x.x,T.y=x.y,this._maskGraphics.clear(),this._drawMaskGraphics(r,e),this._drawMaskGraphics(s,e),t.render(this._container,{renderTexture:this.renderTexture})}catch(e){}},t.prototype._drawMaskGraphics=function(e,t){var i=this._maskGraphics;i.beginFill(16724736),i.lineStyle(1,16767232,1);var n,r,s=t[e[0]];i.moveTo(s.x,s.y),s=t[e[1]],i.lineTo(s.x,s.y),n=t[e[2]],r=t[e[3]],i.quadraticCurveTo(n.x,n.y+(n.y-(0,p.qg)(s,r).y),r.x,r.y),s=t[e[4]],i.lineTo(s.x,s.y),s=t[e[5]],i.lineTo(s.x,s.y),n=t[e[6]],r=t[e[7]],i.quadraticCurveTo(n.x,n.y-((0,p.qg)(s,r).y-n.y),r.x,r.y),i.closePath(),i.endFill()},t.prototype._getPixelPosition=function(e,t){return{x:e,y:t}},t.prototype._getXRange=function(e){if(0===e.length)return 0;var t=e.reduce((function(e,t){return{min:Math.min(e.min,t.x),max:Math.max(e.max,t.x)}}),{min:e[0].x,max:e[0].x}),i=t.min;return t.max-i},t.prototype.resize=function(t,i){var n;e.prototype.resize.call(this,t,i),null===(n=this.renderTexture)||void 0===n||n.resize(t,i)},t.prototype.destroy=function(){S.info("irisLayer destroy"),this._destroyed=!0,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})},M([(0,l.M)("IrisLayer"),T("design:type",Function),T("design:paramtypes",["function"==typeof(i="undefined"!=typeof Array&&Array)?i:Object,"function"==typeof(n=void 0!==a.Th&&a.Th)?n:Object]),T("design:returntype",void 0)],t.prototype,"setIrisProps",null),t}(E),I=i(3120),P=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},j=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},O=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(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(o,a)}c((n=n.apply(e,t||[])).next())}))},R=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},F=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.")},L=(0,b.jl)("makeup-mer"),V=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 O(this,void 0,void 0,(function(){var e,t,i,n;return R(this,(function(r){switch(r.label){case 0:return this._config?[3,2]:(this._config=new k.M,[4,this._config.load()]);case 1:r.sent(),r.label=2;case 2:return this._lipMask?[3,4]:[4,this._getMask()];case 3:r.sent(),r.label=4;case 4:return this._maskSprite&&!this._maskSprite.destroyed||(e=this._options,t=e.width,i=e.height,this._maskRenderTexture=a.TI.create({width:t,height:i}),n=new a.jy(this._maskRenderTexture),this._maskSprite=n),[2,{maskSprite:this._maskSprite,lipmask:this._lipMask,lipmaskmesh:this._lipMaskMesh}]}}))}))},e.prototype.update=function(e){if(this._lipMaskMesh){this._lipMaskMesh.geometry.getBuffer("aVertexPosition").update(e);var t=this._lipMaskMesh.getBounds();this._lipMaskMesh.mask.clear(),this._lipMaskMesh.mask.drawRect(t.x,t.y,t.width,t.height),this.render()}},e.prototype.render=function(){this.renderer&&this._lipMask&&this.renderer.render(this._lipMask,{renderTexture:this._maskRenderTexture})},e.prototype.resize=function(e,t){var i;L.info("ReuseableLipMask resize",e,t,this._maskSprite),null===(i=this._maskRenderTexture)||void 0===i||i.resize(e,t)},e.prototype._getMask=function(){return O(this,void 0,void 0,(function(){var e,t,i,n,r,s,o;return R(this,(function(c){switch(c.label){case 0:return this._lipMask?[2,this._lipMask]:(e=this._lipVertex,t=this._config.getDataConfig(29),[4,this._loadLipImage()]);case 1:return i=c.sent(),n=(new a.wG).addAttribute("aVertexPosition",e).addAttribute("aUvs",t),"\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 }",r={uSamplerMakeup:i},s=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 }",r),(o=new a.Kj(n,s)).mask=new a.TC,this._lipMaskMesh=o,this._lipMask=o,[2,o]}}))}))},e.prototype._loadLipImage=function(){return O(this,void 0,Promise,(function(){var e=this;return R(this,(function(t){return[2,new Promise((function(t,i){return O(e,void 0,void 0,(function(){var e,i,n;return R(this,(function(r){switch(r.label){case 0:return[4,(e=new I.KI).init()];case 1:return i=r.sent(),[4,e.loadImage(i)];case 2:return n=r.sent(),t(n[I.X_]),[2]}}))}))}))]}))}))},P([(0,l.M)("ReuseableLipMask"),j("design:type",Function),j("design:paramtypes",[]),j("design:returntype",void 0)],e.prototype,"destroy",null),P([(0,l.o)("ReuseableLipMask"),j("design:type",Function),j("design:paramtypes",[]),j("design:returntype",Promise)],e.prototype,"_getMask",null),e}(),A=function(){function e(e,t,i,n,r,s,o){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=s,this.faceLandMarks=r,this.renderer=o;var c=new a.jy(a.xE.WHITE);c.alpha=0,c.width=i.width,c.height=i.height,this._container.addChild(c)}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}),e.prototype.renderMesh=function(){this._lipMaskIns&&this._lipMaskIns.render(),this._makeupMeshes.forEach((function(e){e.renderMesh()}))},e.prototype.load=function(){return O(this,void 0,void 0,(function(){var e,t,i,n,r,s,o,a;return R(this,(function(c){switch(c.label){case 0:return this._config=new k.M,[4,this._config.load()];case 1:if(c.sent(),e=this._data,L.info("makeup info",this._data),t=[],e&&e.length){try{for(i=F(e),n=i.next();!n.done;n=i.next())"iris"===(r=n.value).type?(L.info("generate iris layer",r),this._irises=this._getIris(this.getFilename(r.src,r.parentKey),r.blend,r.intensity,r.parentKey,r.parentIntensity),this.irisBlendMode=r.blend):(r.blend+"",t.push({src:this.getFilename(r.src,r.parentKey),intensity:r.intensity,type:r.type,blend:r.blend,parentIntensity:r.parentIntensity,parentKey:r.parentKey}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}L.info("makeupLayersByBlendMode",t),s=this._getMeshLayerByBlendMode(t),this._makeupMeshes.push(s)}return[4,this._initLipMask()];case 2:return c.sent(),[2]}}))}))},e.prototype.getFilename=function(e,t){return"dafault"===t?e:"".concat(t,"|").concat(e)},e.prototype.setParentIntensity=function(e,t){L.info("setParentIntensity",e,t),this._makeupMeshes.forEach((function(i){i.setParentIntensityAt(e,t)})),this._irises&&this._irises.parentKey===e&&(this._irises.parentIntensity=t)},e.prototype._getIris=function(e,t,i,n,r){return new C(this._options,e,t,i,this._config,this._container,n,r)},e.prototype._getMeshLayerByBlendMode=function(e){var t=e.some((function(e){return"lips"===e.type}))?"lips":"makeup",i=new E(this._options,this._container,this.renderer,t);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){var i,n;this._makeupMeshes.forEach((function(i){i.resize(e,t)})),null===(i=this._irises)||void 0===i||i.resize(e,t),null===(n=this._lipMaskIns)||void 0===n||n.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){if(!this._applyed){if(!e)return L.info("_applyMakeup failed: container is null");this._applyed=!0,e.filters||(e.filters=[]),e.addChild(this._container)}},e.prototype._removeMakeup=function(e){if(this._applyed){if(!e)return L.info("_removeMakeup failed: container is null");this._applyed=!1,e.filters&&e.removeChild(this._container)}},e.prototype._initLipMask=function(){return O(this,void 0,void 0,(function(){var e,t,i=this;return R(this,(function(n){switch(n.label){case 0:return(e=new V(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(){L.info("makeup destroy"),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()},P([(0,l.M)("Makeup"),j("design:type",Function),j("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),j("design:returntype",void 0)],e.prototype,"_removeMakeup",null),P([(0,l.M)("Makeup"),j("design:type",Function),j("design:paramtypes",[]),j("design:returntype",void 0)],e.prototype,"destroy",null),e}(),U=i(7959),N=function(){return N=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},N.apply(this,arguments)},D=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(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(o,a)}c((n=n.apply(e,t||[])).next())}))},B=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},z=(0,b.jl)("makeup-merge-hub"),G=function(){function e(){this._visible=!0,this._makeupConfigs={},this._applied=!1,this._mesh=[],this._faceLandMarks=[],this._lipmesh=[]}return Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._visible=e,this.currentMakeupInstance&&(this.currentMakeupInstance.visible=e)},enumerable:!1,configurable:!0}),e.prototype.addMakeupConfig=function(e,t,i){this._makeupConfigs[e]={config:t,visible:!0,parentIntensity:i}},e.prototype.setMakeupConfigVisible=function(e,t){this._makeupConfigs[e]&&(this._makeupConfigs[e].visible=t)},e.prototype.MakeupConfigExist=function(e){return void 0!==this._makeupConfigs[e]},e.prototype.setMakeupConfigParentIntensity=function(e,t){var i;this._makeupConfigs[e]&&(z.info("setMakeupConfigParentIntensity",e,t),this._makeupConfigs[e].parentIntensity=t,null===(i=this.currentMakeupInstance)||void 0===i||i.setParentIntensity(e,t))},e.prototype.removeMakeupConfig=function(e){delete this._makeupConfigs[e]},e.prototype.generateFinalConfig=function(){var e=this,t=[],i=function(i){n._makeupConfigs[i].visible&&n._makeupConfigs[i].config.forEach((function(n){var r=N(N({},n),{parentIntensity:e._makeupConfigs[i].parentIntensity,parentKey:i});t.push(r)}))},n=this;for(var r in this._makeupConfigs)i(r);return t},e.prototype.generateMakeup=function(e,t,i,n){return D(this,void 0,void 0,(function(){var r,s;return B(this,(function(o){switch(o.label){case 0:return r=this.generateFinalConfig(),z.info("generateMakeup",r),U.s.checkEnabled("beautify")?r.length?[4,(s=new A("merged-".concat((new Date).getTime()),r,x.t.instance.options,e,t,i,n)).load()]:[2,null]:[2,null];case 1:return o.sent(),[2,s]}}))}))},e.prototype.updateMakeupFilter=function(e,t,i,n){return D(this,void 0,void 0,(function(){var r;return B(this,(function(s){switch(s.label){case 0:return console.log("updateMakeupFilter called"),U.s.checkEnabled("beautify")?[4,this.generateMakeup(e,t,i,n)]:[2];case 1:return(r=s.sent())?(this.mesh=e,this.faceLandMarks=t,this.lipmesh=i,[4,r.load()]):(this.currentMakeupInstance&&this.currentMakeupInstance.destroy(),this._applied=!1,[2]);case 2:return s.sent(),this.currentMakeupInstance&&this.currentMakeupInstance.destroy(),r&&(this.currentMakeupInstance=r),this._applied&&this.currentMakeupInstance.apply(this._target),[2]}}))}))},e.prototype.updateMakeupConfigShortcut=function(e){return D(this,void 0,void 0,(function(){return B(this,(function(t){switch(t.label){case 0:return[4,this.updateMakeupFilter(this.mesh,this.faceLandMarks,this.lipmesh,e)];case 1:return[2,t.sent()]}}))}))},e.prototype.resize=function(e,t){z.info("resize",e,t),this.currentMakeupInstance&&this.currentMakeupInstance.resize(e,t)},e.prototype.renderMesh=function(){this.currentMakeupInstance&&this.currentMakeupInstance.renderMesh()},e.prototype.applyIfNot=function(e){this._applied||this.currentMakeupInstance&&(this.currentMakeupInstance.apply(e),this._target=e,this._applied=!0)},Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},set:function(e){this.currentMakeupInstance&&(this.currentMakeupInstance.mesh=e),this._mesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{get:function(){return this._lipmesh},set:function(e){this.currentMakeupInstance&&(this.currentMakeupInstance.lipmesh=e),this._lipmesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{get:function(){return this._faceLandMarks},set:function(e){this.currentMakeupInstance&&(this.currentMakeupInstance.faceLandMarks=e),this._faceLandMarks=e},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.currentMakeupInstance&&this.currentMakeupInstance.destroy(),this._applied=!1,this._makeupConfigs={}},e.instance=new e,e}(),H=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)}}(),J=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},X=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},W=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(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(o,a)}c((n=n.apply(e,t||[])).next())}))},K=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},q=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.")},Y=(0,b.jl)("Effect"),Z=function(){function e(e,t,i,n,r,s,o,a,c,u,h){this.type="face",this._filters=[],this._destroyed=!1,this._visible=!0,this._intensity=1,this._filterIntensity=1,this.localSpriteSheets={},this._filtersActived=!0,this.makeupConfig=[],Y.info("effect constructor",this._key,t),this._target=t,this._stickerTarget=i,this._url=e,this._key=e,this._options=r,this.mesh=s,this.lipmesh=a,this.faceLandMarks=o,c&&(this.angles=c),void 0!==u&&(this.intensity=u),this._app3d=n,this._canvas=h}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&&(g.Nd.trigger("error",{message:r.Z.t("0015"),code:m.U.SET_INTENSITY_ERROR}),e=1),null!=e&&(G.instance.setMakeupConfigParentIntensity(this._key,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,G.instance.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,G.instance.mesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._destroyed||(this._lipVertex=e,G.instance.lipmesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{get:function(){return this._faceLandMarks},set:function(e){this._destroyed||(this._faceLandMarks=e,G.instance.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 W(this,void 0,Promise,(function(){var e;return K(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(),b.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(e){return W(this,void 0,Promise,(function(){var t,i,n,r,s,o;return K(this,(function(a){switch(a.label){case 0:return[4,this.download()];case 1:return t=a.sent(),i=t.filter,n=t.makeup,r=t.beautify,s=t.sticker,o=t.sticker3d,e&&e(!!(null==o?void 0:o.length)),[4,this._loadImages(t)];case 2:return a.sent(),this.loadFilter(i),[4,this.setMakeup(n)];case 3:return a.sent(),s?[4,this.loadStickers(s)]:[3,5];case 4:a.sent(),a.label=5;case 5:return[4,this.load3d(o)];case 6:return a.sent(),this.sticker3d=o,[4,this._getLoader()];case 7:return a.sent().removeFromCache(this._url),[2,r]}}))}))},e.prototype._getLoader=function(){return W(this,void 0,void 0,(function(){return K(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new s.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return W(this,void 0,void 0,(function(){var e;return K(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 W(this,void 0,Promise,(function(){var e,t,i,n,r,s,o,a;return K(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=q(t),r=n.next();!r.done;r=n.next())if("iris"===(s=r.value).type||"eyes"===s.type){i=!0;break}}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(o)throw o.error}}return[2,i]}}))}))},e.prototype.needDetection=function(){return W(this,void 0,Promise,(function(){var e,t,i,n;return K(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 W(this,void 0,Promise,(function(){var e,t;return K(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 W(this,void 0,Promise,(function(){var t;return K(this,(function(i){return e.length?((t=new _(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=[]),W(this,void 0,Promise,(function(){return K(this,(function(e){return[2]}))}))},e.prototype.load3d=function(e){return W(this,void 0,void 0,(function(){return K(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return W(this,void 0,void 0,(function(){return K(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.setMakeup=function(e){if(!e.length)return Promise.resolve();G.instance.addMakeupConfig(this._key,e,this.intensity),this.makeupConfig=e},e.prototype.resize=function(e,t){G.instance.resize(e,t)},e.prototype.apply=function(e){var t=this;this._destroyed||this._applyed||(this.filterActived&&this._applyFilter(e.filterTarget),this._filters.length&&e.filterCallback&&e.filterCallback(),this._filterTarget=e.filterTarget,G.instance.MakeupConfigExist(this._key)||G.instance.addMakeupConfig(this._key,this.makeupConfig,this.intensity),G.instance.setMakeupConfigVisible(this._key,!0),G.instance.updateMakeupFilter(this._meshVertex,this.faceLandMarks,this._lipVertex,this.renderer).then((function(){Y.info("merged makeup updated,start apply"),G.instance.applyIfNot(t._target)})),this._sticker&&this._sticker.apply(),this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(e){void 0===e&&(e=!1),G.instance.removeMakeupConfig(this._key),e||G.instance.updateMakeupConfigShortcut(this.renderer),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(){G.instance.renderMesh()},e.prototype.destroy=function(e){void 0===e&&(e=!1),this._destroyed=!0,this.remove(e),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 o.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)s.iV[e]&&s.iV[e]instanceof a.c2&&(s.iV[e].destroy(),delete s.iV[e])},e.prototype._loadImages=function(e){var t,i,n=this,r=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),o=this._loader.getIndeLoader(),c={};this.localSpriteSheets=c;try{for(var u=q(r),h=u.next();!h.done;h=u.next()){var p=h.value;if(p.src instanceof Array)p.src.forEach((function(e,t){var i=n.checkSpriteSheetJSON(e);if(i){var r=i.meta.image,s="".concat(n._key,"|").concat(r);if(a.P6.kN[s])return;if(0===r.indexOf("blob:")){var u=a.xE.from(r);a.xE.addToCache(u,s)}else o.add(s,r);i.meta.image="",c[s]=i}else{if(a.P6.kN[e])return;if(o.resources[e])return;o.add(e,e)}}));else{var l="".concat(this._key,"|").concat(p.src);if(a.P6.kN[l])continue;if(0===p.src.indexOf("blob:")){var f=a.xE.from(p.src);a.xE.addToCache(f,l)}else o.add(l,p.src)}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}return new Promise((function(e){o.load((function(t,i){return W(n,void 0,void 0,(function(){var t,n,r,o,u;return K(this,(function(h){switch(h.label){case 0:for(r in t=function(e){var t;return K(this,(function(i){switch(i.label){case 0:return s.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(){s.iV[e]=t,i()}))}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))},n=[],a.P6.kN)n.push(r);o=0,h.label=1;case 1:return o<n.length?(u=n[o],[5,t(u)]):[3,4];case 2:h.sent(),h.label=3;case 3:return o++,[3,1];case 4:for(u in i)s.iV[u]||c[u]||(s.iV[u]=i[u]);return e(),[2]}}))}))}))}))},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},J([(0,l.M)("Effect"),X("design:type",Function),X("design:paramtypes",[Boolean]),X("design:returntype",void 0)],e.prototype,"remove",null),J([(0,l.M)("Effect"),X("design:type",Function),X("design:paramtypes",[Boolean]),X("design:returntype",void 0)],e.prototype,"destroy",null),J([(0,l.M)("Effect"),X("design:type",Function),X("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),X("design:returntype",void 0)],e.prototype,"_removeFilter",null),e}(),$=function(e){function t(t,i,n,r,s,o,a,c){var u=e.call(this,"default",i,n,r,s,o,a,c)||this;return u._json=t,u._app3d=r,u}return H(t,e),t.prototype.load=function(e){return W(this,void 0,Promise,(function(){var t,i,n,r,s,o;return K(this,(function(a){switch(a.label){case 0:return t=this._json,i=t.filter,n=t.makeup,r=t.beautify,s=t.sticker,o=t.sticker3d,e&&e(!!(null==o?void 0:o.length)),[4,this._loadImages(t)];case 1:return a.sent(),this.loadFilter(i),[4,this.setMakeup(n)];case 2:return a.sent(),s?[4,this.loadStickers(s)]:[3,4];case 3:a.sent(),a.label=4;case 4:return o?this._app3d?[3,6]:[4,this.initThreeApp()]:[3,8];case 5:a.sent(),a.label=6;case 6:return[4,this.loadSticker3d(o||[])];case 7:a.sent(),a.label=8;case 8:return[2,r]}}))}))},t.prototype.loadImage=function(){return W(this,void 0,void 0,(function(){return K(this,(function(e){return[2]}))}))},t.prototype._loadImages=function(e){var t,i,n=this,r=new a.aN,o=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),c={},u=function(e){if(e.src instanceof Array)e.src.forEach((function(t,i){var s=n.checkSpriteSheetJSON(t);if(s){var o=s.meta.image,u="".concat(n._key,"|").concat(o);if(a.P6.kN[u])return;if(e.objectSrc&&e.objectSrc.length){var h=a.xE.from(e.objectSrc[i]);a.xE.addToCache(h,u)}else if(0===o.indexOf("blob:")){h=a.xE.from(o);a.xE.addToCache(h,u)}else r.add(u,o);s.meta.image="",c[u]=s}else{if(a.P6.kN[t])return;if(r.resources[t])return;if(e.objectSrc&&e.objectSrc.length){h=a.xE.from(e.objectSrc[i],{resolution:(0,v.u)()});a.xE.addToCache(h,t)}else r.add(t,t)}}));else{if(a.P6.kN[e.src])return"continue";if(r.resources[e.src])return Y.info("already loaded file",e.src),"continue";if(e.objectSrc){Y.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);Y.info("JSONEffect blob texture",t),a.xE.addToCache(t,e.src)}else r.add(e.src)}};try{for(var h=q(o),p=h.next();!p.done;p=h.next()){u(p.value)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(t)throw t.error}}return new Promise((function(e){return W(n,void 0,void 0,(function(){var t=this;return K(this,(function(i){return r.load((function(i,n){return W(t,void 0,void 0,(function(){var t,i,r,o,u;return K(this,(function(h){switch(h.label){case 0:for(r in t=function(e){var t;return K(this,(function(i){switch(i.label){case 0:return s.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(){s.iV[e]=t,i()}))}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))},i=[],a.P6.kN)i.push(r);o=0,h.label=1;case 1:return o<i.length?(u=i[o],[5,t(u)]):[3,4];case 2:h.sent(),h.label=3;case 3:return o++,[3,1];case 4:for(u in n)s.iV[u]||c[u]||(s.iV[u]=n[u]);return e(),[2]}}))}))})),[2]}))}))}))},t.prototype.loadSticker3d=function(e){return W(this,void 0,Promise,(function(){return K(this,(function(e){return[2]}))}))},t}(Z),Q=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)}}(),ee=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},te=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ie=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(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(o,a)}c((n=n.apply(e,t||[])).next())}))},ne=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},re=((0,b.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 ie(this,void 0,Promise,(function(){var e;return ne(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(),b.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return ie(this,void 0,Promise,(function(){var e,t;return ne(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 ie(this,void 0,void 0,(function(){return ne(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new s.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return ie(this,void 0,void 0,(function(){var e;return ne(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 ie(this,void 0,void 0,(function(){return ne(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return ie(this,void 0,void 0,(function(){return ne(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)s.iV[e]&&s.iV[e]instanceof a.c2&&(s.iV[e].destroy(),delete s.iV[e])},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},ee([(0,l.M)("Effect"),te("design:type",Function),te("design:paramtypes",[]),te("design:returntype",void 0)],e.prototype,"remove",null),ee([(0,l.M)("Effect"),te("design:type",Function),te("design:paramtypes",[]),te("design:returntype",void 0)],e.prototype,"destroy",null),e}()),se=function(e){function t(t,i,n,r){var s=e.call(this,"default",i,n,r)||this;return s._json=t,s._app3d=i,s}return Q(t,e),t.prototype.load=function(){return ie(this,void 0,Promise,(function(){var e,t;return ne(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 ie(this,void 0,void 0,(function(){return ne(this,(function(e){return[2]}))}))},t.prototype.loadSticker3d=function(e){return ie(this,void 0,Promise,(function(){return ne(this,(function(e){return[2]}))}))},t.prototype.loadHand3d=function(e){return ie(this,void 0,Promise,(function(){return ne(this,(function(e){return[2]}))}))},t}(re),oe=i(5156),ae=i(6309),ce=i(5562),ue=(0,b.jl)("videoFrameTextureManager"),he=function(){function e(e){this.id=(new Date).getTime().toString(),this.pixiTexture=null,this.glTexture=null,this._width=0,this._height=0,console.log("VideoFrameTextureManager constructor"),this.renderer=e}return e.prototype.check=function(){var e=this.renderer.gl.isTexture(this.glTexture);return ue.info("check",e),e},e.prototype.update=function(e,t){void 0===t&&(t=!1);var i=this.renderer.gl,n=e.displayWidth,r=e.displayHeight;if(!this.pixiTexture||this._width!==n||this._height!==r||t){ue.info("VideoFrameTextureManager update",this._width,this._height,n,r),this.destroy(),this._width=n,this._height=r,this.glTexture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.glTexture),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this._width,this._height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);var s=new a.VL(null,{width:this._width,height:this._height,format:i.RGBA,type:i.UNSIGNED_BYTE}),o=this.renderer,c=o.CONTEXT_UID||0;s._glTextures[c]||(s._glTextures[c]=o.texture.initTexture(s));var u=s._glTextures[c];this.glTexture&&(u.texture=this.glTexture),this.pixiTexture=new a.xE(s),a.P6.kN["videoframe-".concat(this.id)]=this.pixiTexture,a.P6.V8["videoframe-".concat(this.id)]=this.pixiTexture.baseTexture}if(this.glTexture){try{i.bindTexture(i.TEXTURE_2D,this.glTexture)}catch(e){ue.error("gl.bindTexture error",e)}e.width=e.displayWidth,e.height=e.displayHeight,i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),this.pixiTexture&&this.pixiTexture.baseTexture.update()}else if(console.error("WebGLTexture 未初始化!"),!this.pixiTexture)return a.xE.EMPTY;return this.pixiTexture},e.prototype.destroy=function(){ue.info("videoFrameTextureManager destroy"),this.pixiTexture&&(this.pixiTexture.destroy(!0),this.pixiTexture=null),delete a.P6.kN["videoframe-".concat(this.id)],delete a.P6.V8["videoframe-".concat(this.id)],this._width=0,this._height=0},e.prototype.getTexture=function(){return this.pixiTexture},e}(),pe=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)}}(),le=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},fe=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},de=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(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(o,a)}c((n=n.apply(e,t||[])).next())}))},ye=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},_e=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.")},ge=(0,b.jl)("Renderer"),me=function(){};var be=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.lastCheckTime=0,i.need3dRefresh=!1,i.lib3dLoaded=!1,i.libHand3dLoaded=!1,ge.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._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,autoDensity:!0}),i.setRenderer(),i.initRenderContext(t),i.handleLoading(),i.setup(),i}return pe(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._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._makeupContainer=new a.W2,this._frontContainer=new a.W2,this._frontContainer.sortableChildren=!0,this._finalContainer=new a.W2,this._makeupRenderTexture=a.TI.create({width:e.width,height:e.height}),this._finalContainer.addChild(this._makeupContainer),this._finalContainer.addChild(this._frontContainer),this._target=this._finalContainer},t.prototype.loadLib3d=function(){return de(this,void 0,Promise,(function(){var e;return ye(this,(function(t){switch(t.label){case 0:return e=new ae.e({}),ge.info("loader init"),[4,e.init()];case 1:return t.sent(),ge.info("loader init done"),this._options.plugin3d&&this._options.plugin3d(Z,$,e,wx.window),[2]}}))}))},t.prototype.loadHand3d=function(){return de(this,void 0,Promise,(function(){var e;return ye(this,(function(t){switch(t.label){case 0:return e=new ae.e({}),ge.info("+++++loader init"),[4,e.init()];case 1:return t.sent(),ge.info("+++++loader init done"),this._options.plugin3d&&this._options.pluginHand(re,se,e,wx.window),[2]}}))}))},t.prototype.setup=function(){return de(this,void 0,void 0,(function(){return ye(this,(function(e){switch(e.label){case 0:return this._setup?[2]:(this._config=new k.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 o.f("mirror",{width:x.t.instance.options.width,height:x.t.instance.options.height})),this._mirrorFilter},enumerable:!1,configurable:!0}),t.prototype.switchMode=function(e){b.bH.info("switchMode",e),e!==this._mode3d&&("Sticker"===e&&this.setAvatar(null),this._mode3d=e)},t.prototype.logTime=function(e){var t=+new Date;ge.info("".concat(e," time:").concat(t-this.currentTime)),this.currentTime=t},t.prototype.tick=function(t,i){var n=t.landmarks,r=t.meshVertex,s=t.lipVertex,o=t.image,c=t.angles,u=(t.backgroundType,t.background,t.segmentation,t.blendshapes,t.isLivePusher);t.hair;if(!this._destroyed)if(this._renderer)if(this._setup){this.currentTime=+new Date,this._image=o;try{(this.need3dRefresh&&U.s.checkEnabled("beautify")&&"Sticker"===this._mode3d||U.s.checkEnabled("beautify")&&"AR"===this._mode3d||U.s.checkEnabled("handLandmark"))&&this._renderer.reset()}catch(e){}if(this._isVR)try{this._renderer.render(this._backgroundVR)}catch(e){}else{if(u)if(this._baseSprite)this._baseSprite.texture.update();else{d=a.xE.from(o);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._makeupContainer.addChild(this._baseSprite)}else{var h=o,p=h.width,l=h.height,f=h.data;if(this._baseSprite){if(this._baseSprite.texture.width===p&&this._baseSprite.texture.height===l)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),p,l)}else{var d=a.xE.fromBuffer(new Uint8Array(f),p,l);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 y=Math.max(this._options.width/p,this._options.height/l);this._baseSprite.scale.set(y*(0,v.u)()),this._makeupContainer.addChild(this._baseSprite)}}(U.s.checkEnabled("beautify")||U.s.checkEnabled("segmentation")||U.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=s,this.detected=!0,this._effects.forEach((function(e){e.visible||(e.visible=!0),e.lipmesh=s,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 b.b_.info("_renderer waiting for setup");else b.b_.info("_renderer waiting for renderer")},t.prototype.getBackgroungInstance=function(e,t,i,n){var r;return"image"===e?r=new ImageBackground(this._options,t,i):"video"===e?r=new VideoBackground(this._options,t,i):"blur"===e?r=new BlurBackground(this._options,i,n,this._videoFrameTextureManager,this._renderer):"green"===e&&(r=new ColorBackground(this._options,i)),r},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(),U.s.checkEnabled("beautify")&&"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&this._app3d.render(),U.s.checkEnabled("handLandmark")&&this._appHand3d&&this._appHand3d.render()},t.prototype.renderLayers=function(){e.prototype.renderDermabrasion.call(this),this._renderer.render(this._finalContainer)},t.prototype.preUploadBaseTexture=function(e,t){var i=this;if(this._baseSprite)if("undefined"!=typeof VideoFrame&&e instanceof VideoFrame){var n=this._videoFrameTextureManager.update(e),r=this._baseSprite.texture;this._baseSprite.texture=n,this._baseSprite.texture.update(),r!==this._baseSprite.texture&&(me.baseTexture=this._baseSprite.texture,G.instance.updateMakeupConfigShortcut(this._renderer))}else if(e instanceof ImageData){var s=this._baseSprite.texture.baseTexture.resource;s.width!==e.width||s.height!==e.height?(this._baseSprite.texture=a.xE.fromBuffer(e.data,e.width,e.height),me.baseTexture=this._baseSprite.texture,G.instance.updateMakeupConfigShortcut(this._renderer)):this._baseSprite.texture.baseTexture.resource.data=e.data}else{var o=this._baseSprite.texture.baseTexture.resource,c=o.source;if(c.width!==e.width||c.height!==e.height){r=this._baseSprite.texture;this._baseSprite.texture=a.xE.from(e),r!==this._baseSprite.texture&&(me.baseTexture=this._baseSprite.texture,G.instance.updateMakeupConfigShortcut(this._renderer))}else o.source!==e&&(o.source=e)}else{var u=void 0;"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(this._videoFrameTextureManager||(this._videoFrameTextureManager=new he(this._renderer)),u=this._videoFrameTextureManager.update(e)):u=e instanceof ImageData?a.xE.fromBuffer(e.data,e.width,e.height):a.xE.from(e),this._baseSprite=new a.jy(u),this._baseSprite.width=this._options.width,this._baseSprite.height=this._options.height,this._baseSprite.filters=x.t.instance.options.mirror?[this.mirrorFilter]:[],x.t.instance.on("mirrorChange",(function(e){var t=e.mirror;if(ge.info("renderer mirror change",t),t)i._baseSprite.filters.push(i.mirrorFilter);else{var n=i._baseSprite.filters.findIndex((function(e){return e===i.mirrorFilter}));n>-1&&i._baseSprite.filters.splice(n,1)}})),this._makeupContainer.addChild(this._baseSprite),me.baseTexture=this._baseSprite.texture}if(this._baseSprite.texture.update(),t)return this._prerenderer||(this._prerenderer=new a.Th({width:this._options.width/2-this._options.width/2%2,height:this._options.height/2-this._options.height/2%2})),this._prerenderer.extract.pixels(this._baseSprite,t),t},t.prototype.getBaseTexture=function(){return this._baseSprite.texture},t.prototype.removeBackground=function(){this.background&&(this.background.remove(),this.background=null)},t.prototype.disableEdgeOptimization=function(){this.background&&this.background.disableEdgeOptimization()},t.prototype.enableEdgeOptimization=function(){this.background&&this.background.enableEdgeOptimization()},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,s=x.t.instance.options,o=s.width,c=s.height,h="data"in i?a.xE.fromBuffer(new Uint8Array(i.data.buffer),i.width,i.height):a.xE.from(i),p=new u.jy(h);"video"===n&&(p.blendMode_1=6),p.width=o,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._finalContainer.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(!this.points){for(var t=[],i=0;i<e.length;i++){var n=this.getCircle(2);t.push(n),this._finalContainer.addChild(n)}this.points=t}for(i=0;i<e.length;i++)this.points[i].x=e[i].x*x.t.instance.options.width,this.points[i].y=e[i].y*x.t.instance.options.height},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 de(this,void 0,Promise,(function(){var r,s=this;return ye(this,(function(o){return r=!0,this.latestEffectUrls&&this.latestEffectUrls.length===e.length&&e.every((function(e){return s.latestEffectUrls.indexOf(e)>-1}))&&(r=!1,this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)),this.latestEffectUrls=e,[2,new Promise((function(o,a){r?(s.debounceTimer&&(clearTimeout(s.debounceTimer),s.debounceTimer=null),s.debounceTimer=setTimeout((function(){return s._setEffect(e,t,i,n).then((function(e){clearTimeout(s.debounceTimer),s.debounceTimer=null,o(e)}))}),100)):s._setEffect(e,t,i).then((function(e){o(e)}))}))]}))}))},t.prototype._setEffect=function(e,t,i,n){return de(this,void 0,Promise,(function(){var r,o=this;return ye(this,(function(a){return b.b_.time("AI init duration"),U.s.checkEnabled("beautify")&&!this._meshVertex?[2,new Promise((function(r){clearTimeout(o._meshVertexTimer),o._meshVertexTimer=setInterval((function(){b.b_.info("waiting for AI init..."),o._meshVertex&&(b.b_.info("waiting for AI init...done"),clearTimeout(o._meshVertexTimer),o._setEffect(e,t,i,n).then((function(){r(o._effects)})))}),200)}))]:(b.b_.timeEnd("AI init duration"),r="uid_"+Math.floor(1e8*Math.random()),[2,new Promise((function(a,c){return de(o,void 0,void 0,(function(){var o,c,u,h,p,l,f,d,y,_,g,m,v,k,x,w,M,T=this;return ye(this,(function(S){switch(S.label){case 0:for(o=[].concat(this._effects),c=[],u=[],h=[],p=[],l=[],f=[],d=[],y=[],e.length||(this.filterActivedEffect=null),_=[],g=function(n){var r=o.findIndex((function(t){return t.url===e[n]}));if(r>-1)c.push(o[r]),o[r],u.push(t[n]),h.push(i[n]),o.splice(r,1);else{var a=e[n];y.push(function(e){return de(this,void 0,Promise,(function(){var t,i;return ye(this,(function(n){switch(n.label){case 0:return[4,(t=new s.pF).init()];case 1:return n.sent(),[4,t.preload(e)];case 2:return n.sent(),i=t.readJSON("content.json",e),b.D4.info("download:",e,i),[2,i]}}))}))}(a)),_.push(a),l.push(t[n]),f.push(i[n])}},m=0;m<e.length;m++)g(m);return[4,Promise.all(y)];case 1:for(v=S.sent(),!1,k=!1,x=0;x<v.length;x++)w=_[x],M=void 0,(M=new Z(w,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex,this._angles,l[x],this._canvas)).filterIntensity=f[x],v[x].sticker3d&&v[x].sticker3d.length&&(k=!0),M.renderer=this._renderer,p.push(M);return b.b_.time("require 3d lib"),this.lib3dLoaded||!k?[3,3]:(b.b_.info("check useFace3d",n()),n&&!n()?[2]:(ge.info("require 3d lib"),[4,this.loadLib3d()]));case 2:S.sent(),this.lib3dLoaded=!0,S.label=3;case 3:return b.b_.timeEnd("require 3d lib"),p.forEach((function(e){d.push(e.load((function(e){e&&(T.need3dRefresh=!0)})).then((function(){return e.intensity=e.intensity,T._app3d||"face"!==e.type||(T._app3d=e.app3d),T._appHand3d||"hand"!==e.type||(T._appHand3d=e.app3d),e})).catch((function(e){ge.error("effect load error",e)})))})),b.b_.time("renderer parse effect"),Promise.all(d).then((function(e){b.b_.timeEnd("renderer parse effect"),b.b_.time("renderer apply effect");for(var t=!1,i=0;i<p.length;i++){var n=p[i];T.latestEffectUrls&&-1===T.latestEffectUrls.indexOf(n.getUrl())&&(n.destroy(!0),t=!0)}if(t)ge.info(r+"end");else{o.forEach((function(e){e.remove(!0)})),T._effects=c,c.forEach((function(e,t){e.intensity=u[t],e.filterIntensity=h[t]}));for(i=0;i<p.length;i++){n=p[i];T._effects.push(n),n.apply({filterTarget:T._makeupContainer,filterCallback:function(){}})}o.forEach((function(e){e.destroy(!0)})),b.b_.timeEnd("renderer apply effect"),(p.length||o.length)&&G.instance.updateMakeupConfigShortcut(T._renderer),a(T._effects)}})),[2]}}))}))}))])}))}))},t.prototype.setEffectJSON=function(e){return de(this,void 0,void 0,(function(){var t,i,n,r,s,o=this;return ye(this,(function(a){switch(a.label){case 0:return i=e.sticker3d,n=e.hand,i&&i.length&&!this.lib3dLoaded?(ge.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?(ge.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,(s=function(){U.s.checkEnabled("beautify")&&o._meshVertex&&(t&&clearTimeout(t),r=!0,o.getJSONEffectForFace(e)),U.s.checkEnabled("handLandmark")&&n&&n.length&&(r=!0,o.getJSONEffectForHand(e)),r||(t=setTimeout(s,20))})(),[2]}}))}))},t.prototype.getJSONEffectForHand=function(e){var t=this,i=new se(e,this._appHand3d,this._options,this._canvas);i.renderer=this._renderer,b.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 $(e,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex);return i.renderer=this._renderer,i.load((function(e){e&&(t.need3dRefresh=!0)})).then((function(){t._app3d||(t._app3d=i.app3d);var e=[].concat(t._effects);t._effects=[i],i.apply({filterTarget:t._makeupContainer}),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 Z(e,i._makeupContainer,i._finalContainer,i._app3d,i._options,i._meshVertex,i._faceLandmarks,i.lipVertex,i._angles,t);r.filterIntensity=t,r.load((function(e){e&&(i.need3dRefresh=!0)})).then((function(){i.exclusiveFilter&&i.exclusiveFilter.destroy(),i.exclusiveFilter=r,r.renderer=i._renderer,r.apply({filterTarget:i._makeupContainer}),n()}))}}()}))},t.prototype.resize=function(t,i,n){if(void 0===n&&(n=!0),e.prototype.resize.call(this,t,i),ge.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),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._backgroundVR){var r=this._backgroundVR,s=r.width,o=r.height,a=Math.max(t/s,i/o);this._backgroundVR.width*=a,this._backgroundVR.height*=a}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._makeupContainer,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._makeupContainer,filterCallback:function(){}})}))},t.prototype.removeExclusiveFilter=function(){this.exclusiveFilter&&(this.exclusiveFilter.destroy(),this.exclusiveFilter=null)},t.prototype.initAvatarApp=function(e,t){return de(this,void 0,void 0,(function(){return ye(this,(function(e){return[2]}))}))},t.prototype.setAvatar=function(e,t){return de(this,void 0,void 0,(function(){return ye(this,(function(e){return[2]}))}))},t.prototype.registerAvatar=function(e){},t.prototype.reCorrectAvatar=function(){return de(this,void 0,void 0,(function(){return ye(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 de(this,void 0,Promise,(function(){var t,i,n,r,o,a,c;return ye(this,(function(u){switch(u.label){case 0:return e.length?[4,(t=new s.pF).init()]:[2];case 1:u.sent(),i=[];try{for(n=_e(e),r=n.next();!r.done;r=n.next())(o=r.value)&&i.push(t.preload(o))}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 s=t.loading=new oe.Z(r);s.zIndex=20;var o=this._options,a=o.width,c=o.height;s.x=a/2,s.y=c/2,this._finalContainer.addChild(s)}},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&&me.baseTexture&&(me.baseTexture.destroy(!0),me.baseTexture=null),G.instance.clear(),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)},le([(0,l.M)("ArRenderer"),fe("design:type",Function),fe("design:paramtypes",[Object]),fe("design:returntype",void 0)],t.prototype,"destroy",null),t}(ce.F)}}]);
1
+ var self = wx;(self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[321],{4385:(e,t,i)=>{i.d(t,{g:()=>be,b:()=>me});var n,r=i(9522),o=i(3044),s=i(9124),a=i(1206),c=i(3125),u=i(9560),h=i(401),p=i(1347),l=i(1084),f=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},d=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,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 u.Kg(i)).animationSpeed=(this._config.fps||30)/60,e.play()}else{var n=this._src[0],r=a.P6.kN[n];e=new u.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=h.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/h.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},f([(0,l.M)("StickerLayer"),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",Boolean)],e.prototype,"checkAnimated",null),f([(0,l.M)("StickerLayer"),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],e.prototype,"destroy",null),e}(),_=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 u=new c.LE;u.setPlanes(400,10,1e4,!0),this._camera=u,this._stickers=t.map((function(t){var s=new y(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}(),g=i(6878),m=i(6879),b=i(6109),v=i(201),k=i(617),x=i(3849),w=(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)}),M=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},T=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},S=(0,b.jl)("merged-makeup-layer");var C=function(){function e(e,t,i,n,r){this._destroyed=!1,this.type="makeup",this._parentIntensity=1,this._jsonIntensity=1,this.textures=[],this.files=[],this._options=e,this._container=t,this._lipMaskTexture=r,this.renderer=i,this.type=n||"makeup"}return e.prototype.setParentIntensityAt=function(e,t){if(this.shader&&this.files.length)for(var i=0;i<this.files.length;i++){if(this.files[i].parentKey===e)this.files[i].parentIntensity=t,this.shader.uniforms["parentIntensity".concat(i)]=t}},Object.defineProperty(e.prototype,"lipMask",{set:function(e){null===e||(this._lipMaskTexture=e.texture,this.shader&&(this.shader.uniforms.uSamplerLipMask=this._lipMaskTexture))},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){this.files=e;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 uniform sampler2D uSamplerLipMask;\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 ").concat(e.map((function(e,t){return"uniform float parentIntensity".concat(t,";")})).join("\n"),"\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 u.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\n if (mirror == 1) {\n baseCoord = vec2(1.0 - bUvs.x, bUvs.y);\n }\n \n vec4 baseColor = texture2D(baseImage, baseCoord);\n\n vec4 makeupColor = vec4(0.0);\n float alphaFromMask = 1.0 - texture2D(uSamplerLipMask, bUvs).a; \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").concat(t,";\n\n makeupColor = texture2D(uSamplerMakeup").concat(t,", vUvs) * realIntensity").concat(t," * alphaFromMask;\n \n if (makeupColor.a > 0.) {\n \n\n // 混合\n baseColor.rgb = blend").concat(u.Lc[e.blend].key,"(baseColor.rgb, makeupColor.rgb/makeupColor.a , makeupColor.a);\n \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(u.Lc[this.irisBlendMode].key,"(baseColor.rgb, irisColor.rgb/irisColor.a , irisColor.a);\n }\n "):"","\n \n \n // 输出\n gl_FragColor = baseColor;\n // gl_FragColor = makeupColor;\n }"),o={enable:1},s=this._options,c=s.width,h=s.height;o.baseImage=me.baseTexture,o.size=[c*h/me.baseTexture.height,h];var p=me.baseTexture.width*h/me.baseTexture.height;o.imageOffset=[(p-c)/2/p,0],e.forEach((function(e,t){var n=e.src,r=a.P6.kN[n];o["uSamplerMakeup".concat(t)]=r,o["intensity".concat(t)]=e.intensity,o["parentIntensity".concat(t)]=null==e.parentIntensity?1:e.parentIntensity,o.mirror=x.t.instance.options.mirror?1:0,i.textures.push(r)})),this.irisRenderTexture&&(o.uSamplerIris=this.irisRenderTexture,o.mirror=x.t.instance.options.mirror?1:0),o.uSamplerLipMask=this._lipMaskTexture;var l=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=l,this.mirrorChangeHandler=function(e){i.shader&&(i.shader.uniforms.mirror=(null==e?void 0:e.mirror)?1:0)},x.t.instance.on("mirrorChange",this.mirrorChangeHandler);var f=new a.Kj(t,l);return this._mesh=f,this._container.addChild(f),f}},e.prototype.destroy=function(){var e;S.info("MakeupLayer destroy"),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),this.shader&&(null===(e=this.shader)||void 0===e||e.destroy(),this.shader=null),this.mirrorChangeHandler&&x.t.instance.off("mirrorChange",this.mirrorChangeHandler)},M([(0,l.M)("MakeupLayer"),T("design:type",Function),T("design:paramtypes",[Array]),T("design:returntype",void 0)],e.prototype,"updateGeometry",null),M([(0,l.M)("MakeupLayer"),T("design:type",Function),T("design:paramtypes",[]),T("design:returntype",void 0)],e.prototype,"destroy",null),e}(),E=function(e){function t(t,i,n,r,o,s,c,u){var h=e.call(this,t,s)||this;return h._maskGraphics=new a.TC,h.maxLConSize=.42,h.maxRConSize=.42,h._parentIntensity=1,h.parentKey=c,h.jsonIntensity=r,h._parentIntensity=u||1,h.getTexture(i,n),h._config=o,h.renderTexture=a.TI.create({width:t.width,height:t.height}),h}var i,n;return w(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=e,n=a.P6.kN[i];if(n){var 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(!this._destroyed&&e.length)try{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,void 0),a=void 0,c=void 0,u=void 0,h=void 0,l=void 0;if(e.length>=163){var f=e.slice(123,143),d=e.slice(143,163);a=s=this._getXRange(f),u=c=this._getXRange(d),h=e[123],l=e[143]}else{var y=(0,p.Sp)(e[52],e[55]),_=(0,p.Sp)(e[58],e[61]);a=s=y*this.maxLConSize,u=c=_*this.maxLConSize,h=(0,p.qg)(e[74],e[104]),l=(0,p.qg)(e[77],e[105])}var g=s,m=a,b=c,v=u,k=h,x=l,w=me.baseTexture.width*this._options.height/me.baseTexture.height;k.x-=(w-this._options.width)/2,x.x-=(w-this._options.width)/2;var M=this._leftIris,T=this._rightIris;M.width=g*(this._options.irisScale||1),M.height=m*(this._options.irisScale||1),M.x=k.x,M.y=k.y,T.width=b*(this._options.irisScale||1),T.height=v*(this._options.irisScale||1),T.x=x.x,T.y=x.y,this._maskGraphics.clear(),this._drawMaskGraphics(r,e),this._drawMaskGraphics(o,e),t.render(this._container,{renderTexture:this.renderTexture})}catch(e){}},t.prototype._drawMaskGraphics=function(e,t){var i=this._maskGraphics;i.beginFill(16724736),i.lineStyle(1,16767232,1);var n,r,o=t[e[0]];i.moveTo(o.x,o.y),o=t[e[1]],i.lineTo(o.x,o.y),n=t[e[2]],r=t[e[3]],i.quadraticCurveTo(n.x,n.y+(n.y-(0,p.qg)(o,r).y),r.x,r.y),o=t[e[4]],i.lineTo(o.x,o.y),o=t[e[5]],i.lineTo(o.x,o.y),n=t[e[6]],r=t[e[7]],i.quadraticCurveTo(n.x,n.y-((0,p.qg)(o,r).y-n.y),r.x,r.y),i.closePath(),i.endFill()},t.prototype._getPixelPosition=function(e,t){return{x:e,y:t}},t.prototype._getXRange=function(e){if(0===e.length)return 0;var t=e.reduce((function(e,t){return{min:Math.min(e.min,t.x),max:Math.max(e.max,t.x)}}),{min:e[0].x,max:e[0].x}),i=t.min;return t.max-i},t.prototype.resize=function(t,i){var n;e.prototype.resize.call(this,t,i),null===(n=this.renderTexture)||void 0===n||n.resize(t,i)},t.prototype.destroy=function(){S.info("irisLayer destroy"),this._destroyed=!0,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})},M([(0,l.M)("IrisLayer"),T("design:type",Function),T("design:paramtypes",["function"==typeof(i="undefined"!=typeof Array&&Array)?i:Object,"function"==typeof(n=void 0!==a.Th&&a.Th)?n:Object]),T("design:returntype",void 0)],t.prototype,"setIrisProps",null),t}(C),I=i(3120),P=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},O=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},j=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())}))},R=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])}}},F=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.")},L=(0,b.jl)("makeup-mer"),V=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 j(this,void 0,void 0,(function(){var e,t,i,n;return R(this,(function(r){switch(r.label){case 0:return this._config?[3,2]:(this._config=new k.M,[4,this._config.load()]);case 1:r.sent(),r.label=2;case 2:return this._lipMask?[3,4]:[4,this._getMask()];case 3:r.sent(),r.label=4;case 4:return this._maskSprite&&!this._maskSprite.destroyed||(e=this._options,t=e.width,i=e.height,this._maskRenderTexture=a.TI.create({width:t,height:i}),n=new a.jy(this._maskRenderTexture),this._maskSprite=n),[2,{maskSprite:this._maskSprite,lipmask:this._lipMask,lipmaskmesh:this._lipMaskMesh}]}}))}))},e.prototype.update=function(e){if(this._lipMaskMesh){this._lipMaskMesh.geometry.getBuffer("aVertexPosition").update(e);var t=this._lipMaskMesh.getBounds();this._lipMaskMesh.mask.clear(),this._lipMaskMesh.mask.drawRect(t.x,t.y,t.width,t.height),this.render()}},e.prototype.render=function(){this.renderer&&this._lipMask&&this.renderer.render(this._lipMask,{renderTexture:this._maskRenderTexture})},e.prototype.resize=function(e,t){var i;L.info("ReuseableLipMask resize",e,t,this._maskSprite),null===(i=this._maskRenderTexture)||void 0===i||i.resize(e,t)},e.prototype._getMask=function(){return j(this,void 0,void 0,(function(){var e,t,i,n,r,o,s;return R(this,(function(c){switch(c.label){case 0:return this._lipMask?[2,this._lipMask]:(e=this._lipVertex,t=this._config.getDataConfig(29),[4,this._loadLipImage()]);case 1:return i=c.sent(),n=(new a.wG).addAttribute("aVertexPosition",e).addAttribute("aUvs",t),"\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 }",r={uSamplerMakeup:i},o=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 }",r),(s=new a.Kj(n,o)).mask=new a.TC,this._lipMaskMesh=s,this._lipMask=s,[2,s]}}))}))},e.prototype._loadLipImage=function(){return j(this,void 0,Promise,(function(){var e=this;return R(this,(function(t){return[2,new Promise((function(t,i){return j(e,void 0,void 0,(function(){var e,i,n;return R(this,(function(r){switch(r.label){case 0:return[4,(e=new I.KI).init()];case 1:return i=r.sent(),[4,e.loadImage(i)];case 2:return n=r.sent(),t(n[I.X_]),[2]}}))}))}))]}))}))},P([(0,l.M)("ReuseableLipMask"),O("design:type",Function),O("design:paramtypes",[]),O("design:returntype",void 0)],e.prototype,"destroy",null),P([(0,l.o)("ReuseableLipMask"),O("design:type",Function),O("design:paramtypes",[]),O("design:returntype",Promise)],e.prototype,"_getMask",null),e}(),A=function(){function e(e,t,i,n,r,o,s){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;var c=new a.jy(a.xE.WHITE);c.alpha=0,c.width=i.width,c.height=i.height,this._container.addChild(c)}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}),e.prototype.renderMesh=function(){this._lipMaskIns&&this._lipMaskIns.render(),this._makeupMeshes.forEach((function(e){e.renderMesh()}))},e.prototype.load=function(){return j(this,void 0,void 0,(function(){var e,t,i,n,r,o,s,a;return R(this,(function(c){switch(c.label){case 0:return this._config=new k.M,[4,this._config.load()];case 1:if(c.sent(),e=this._data,L.info("makeup info",this._data),t=[],e&&e.length){try{for(i=F(e),n=i.next();!n.done;n=i.next())"iris"===(r=n.value).type?(L.info("generate iris layer",r),this._irises=this._getIris(this.getFilename(r.src,r.parentKey),r.blend,r.intensity,r.parentKey,r.parentIntensity),this.irisBlendMode=r.blend):(r.blend+"",t.push({src:this.getFilename(r.src,r.parentKey),intensity:r.intensity,type:r.type,blend:r.blend,parentIntensity:r.parentIntensity,parentKey:r.parentKey}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}}L.info("makeupLayersByBlendMode",t),o=this._getMeshLayerByBlendMode(t),this._makeupMeshes.push(o)}return[4,this._initLipMask()];case 2:return c.sent(),[2]}}))}))},e.prototype.getFilename=function(e,t){return"dafault"===t?e:"".concat(t,"|").concat(e)},e.prototype.setParentIntensity=function(e,t){L.info("setParentIntensity",e,t),this._makeupMeshes.forEach((function(i){i.setParentIntensityAt(e,t)})),this._irises&&this._irises.parentKey===e&&(this._irises.parentIntensity=t)},e.prototype._getIris=function(e,t,i,n,r){return new E(this._options,e,t,i,this._config,this._container,n,r)},e.prototype._getMeshLayerByBlendMode=function(e){var t=e.some((function(e){return"lips"===e.type}))?"lips":"makeup",i=new C(this._options,this._container,this.renderer,t);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){var i,n;this._makeupMeshes.forEach((function(i){i.resize(e,t)})),null===(i=this._irises)||void 0===i||i.resize(e,t),null===(n=this._lipMaskIns)||void 0===n||n.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){if(!this._applyed){if(!e)return L.info("_applyMakeup failed: container is null");this._applyed=!0,e.filters||(e.filters=[]);try{e.addChild(this._container)}catch(e){L.info("_applyMakeup error",e)}}},e.prototype._removeMakeup=function(e){if(this._applyed){if(!e)return L.info("_removeMakeup failed: container is null");this._applyed=!1,e.filters&&e.removeChild(this._container)}},e.prototype._initLipMask=function(){return j(this,void 0,void 0,(function(){var e,t,i=this;return R(this,(function(n){switch(n.label){case 0:return(e=new V(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(){L.info("makeup destroy"),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()},P([(0,l.M)("Makeup"),O("design:type",Function),O("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),O("design:returntype",void 0)],e.prototype,"_removeMakeup",null),P([(0,l.M)("Makeup"),O("design:type",Function),O("design:paramtypes",[]),O("design:returntype",void 0)],e.prototype,"destroy",null),e}(),U=i(7959),N=function(){return N=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},N.apply(this,arguments)},D=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())}))},B=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,b.jl)("makeup-merge-hub"),G=function(){function e(){this._visible=!0,this._makeupConfigs={},this._applied=!1,this._mesh=[],this._faceLandMarks=[],this._lipmesh=[]}return Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._visible=e,this.currentMakeupInstance&&(this.currentMakeupInstance.visible=e)},enumerable:!1,configurable:!0}),e.prototype.addMakeupConfig=function(e,t,i){this._makeupConfigs[e]={config:t,visible:!0,parentIntensity:i}},e.prototype.setMakeupConfigVisible=function(e,t){this._makeupConfigs[e]&&(this._makeupConfigs[e].visible=t)},e.prototype.MakeupConfigExist=function(e){return void 0!==this._makeupConfigs[e]},e.prototype.setMakeupConfigParentIntensity=function(e,t){var i;this._makeupConfigs[e]&&(z.info("setMakeupConfigParentIntensity",e,t),this._makeupConfigs[e].parentIntensity=t,null===(i=this.currentMakeupInstance)||void 0===i||i.setParentIntensity(e,t))},e.prototype.removeMakeupConfig=function(e){delete this._makeupConfigs[e]},e.prototype.generateFinalConfig=function(){var e=this,t=[],i=function(i){n._makeupConfigs[i].visible&&n._makeupConfigs[i].config.forEach((function(n){var r=N(N({},n),{parentIntensity:e._makeupConfigs[i].parentIntensity,parentKey:i});t.push(r)}))},n=this;for(var r in this._makeupConfigs)i(r);return t},e.prototype.generateMakeup=function(e,t,i,n){return D(this,void 0,void 0,(function(){var r,o;return B(this,(function(s){switch(s.label){case 0:return r=this.generateFinalConfig(),z.info("generateMakeup",r),U.s.checkEnabled("beautify")?r.length?[4,(o=new A("merged-".concat((new Date).getTime()),r,x.t.instance.options,e,t,i,n)).load()]:[2,null]:[2,null];case 1:return s.sent(),[2,o]}}))}))},e.prototype.updateMakeupFilter=function(e,t,i,n){return D(this,void 0,void 0,(function(){var r;return B(this,(function(o){switch(o.label){case 0:return console.log("updateMakeupFilter called"),U.s.checkEnabled("beautify")?[4,this.generateMakeup(e,t,i,n)]:[2];case 1:return(r=o.sent())?(this.mesh=e,this.faceLandMarks=t,this.lipmesh=i,[4,r.load()]):(this.currentMakeupInstance&&this.currentMakeupInstance.destroy(),this._applied=!1,[2]);case 2:return o.sent(),this.currentMakeupInstance&&this.currentMakeupInstance.destroy(),r&&(this.currentMakeupInstance=r),this._applied&&this.currentMakeupInstance.apply(this._target),[2]}}))}))},e.prototype.updateMakeupConfigShortcut=function(e){return D(this,void 0,void 0,(function(){return B(this,(function(t){switch(t.label){case 0:return[4,this.updateMakeupFilter(this.mesh,this.faceLandMarks,this.lipmesh,e)];case 1:return[2,t.sent()]}}))}))},e.prototype.resize=function(e,t){z.info("resize",e,t),this.currentMakeupInstance&&this.currentMakeupInstance.resize(e,t)},e.prototype.renderMesh=function(){this.currentMakeupInstance&&this.currentMakeupInstance.renderMesh()},e.prototype.applyIfNot=function(e){this._applied||this.currentMakeupInstance&&(this.currentMakeupInstance.apply(e),this._target=e,this._applied=!0)},Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},set:function(e){this.currentMakeupInstance&&(this.currentMakeupInstance.mesh=e),this._mesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{get:function(){return this._lipmesh},set:function(e){this.currentMakeupInstance&&(this.currentMakeupInstance.lipmesh=e),this._lipmesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{get:function(){return this._faceLandMarks},set:function(e){this.currentMakeupInstance&&(this.currentMakeupInstance.faceLandMarks=e),this._faceLandMarks=e},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.currentMakeupInstance&&this.currentMakeupInstance.destroy(),this._applied=!1,this._makeupConfigs={}},e.instance=new e,e}(),H=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)}}(),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},X=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},W=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())}))},K=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])}}},q=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.")},Y=(0,b.jl)("Effect"),Z=function(){function e(e,t,i,n,r,o,s,a,c,u,h){this.type="face",this._filters=[],this._destroyed=!1,this._visible=!0,this._intensity=1,this._filterIntensity=1,this.localSpriteSheets={},this._filtersActived=!0,this.makeupConfig=[],Y.info("effect constructor",this._key,t),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!==u&&(this.intensity=u),this._app3d=n,this._canvas=h}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&&(g.Nd.trigger("error",{message:r.Z.t("0015"),code:m.U.SET_INTENSITY_ERROR}),e=1),null!=e&&(G.instance.setMakeupConfigParentIntensity(this._key,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,G.instance.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,G.instance.mesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._destroyed||(this._lipVertex=e,G.instance.lipmesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{get:function(){return this._faceLandMarks},set:function(e){this._destroyed||(this._faceLandMarks=e,G.instance.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 W(this,void 0,Promise,(function(){var e;return K(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(),b.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(e){return W(this,void 0,Promise,(function(){var t,i,n,r,o,s;return K(this,(function(a){switch(a.label){case 0:return[4,this.download()];case 1:return t=a.sent(),i=t.filter,n=t.makeup,r=t.beautify,o=t.sticker,s=t.sticker3d,e&&e(!!(null==s?void 0:s.length)),[4,this._loadImages(t)];case 2:return a.sent(),this.loadFilter(i),[4,this.setMakeup(n)];case 3:return a.sent(),o?[4,this.loadStickers(o)]:[3,5];case 4:a.sent(),a.label=5;case 5:return[4,this.load3d(s)];case 6:return a.sent(),this.sticker3d=s,[4,this._getLoader()];case 7:return a.sent().removeFromCache(this._url),[2,r]}}))}))},e.prototype._getLoader=function(){return W(this,void 0,void 0,(function(){return K(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 W(this,void 0,void 0,(function(){var e;return K(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 W(this,void 0,Promise,(function(){var e,t,i,n,r,o,s,a;return K(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=q(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 W(this,void 0,Promise,(function(){var e,t,i,n;return K(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 W(this,void 0,Promise,(function(){var e,t;return K(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 W(this,void 0,Promise,(function(){var t;return K(this,(function(i){return e.length?((t=new _(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=[]),W(this,void 0,Promise,(function(){return K(this,(function(e){return[2]}))}))},e.prototype.load3d=function(e){return W(this,void 0,void 0,(function(){return K(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return W(this,void 0,void 0,(function(){return K(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.setMakeup=function(e){if(!e.length)return Promise.resolve();G.instance.addMakeupConfig(this._key,e,this.intensity),this.makeupConfig=e},e.prototype.resize=function(e,t){G.instance.resize(e,t)},e.prototype.apply=function(e){var t=this;this._destroyed||this._applyed||(this.filterActived&&this._applyFilter(e.filterTarget),this._filters.length&&e.filterCallback&&e.filterCallback(),this._filterTarget=e.filterTarget,G.instance.MakeupConfigExist(this._key)||G.instance.addMakeupConfig(this._key,this.makeupConfig,this.intensity),G.instance.setMakeupConfigVisible(this._key,!0),G.instance.updateMakeupFilter(this._meshVertex,this.faceLandMarks,this._lipVertex,this.renderer).then((function(){Y.info("merged makeup updated,start apply"),G.instance.applyIfNot(t._target)})),this._sticker&&this._sticker.apply(),this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(e){void 0===e&&(e=!1),G.instance.removeMakeupConfig(this._key),e||G.instance.updateMakeupConfigShortcut(this.renderer),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(){G.instance.renderMesh()},e.prototype.destroy=function(e){void 0===e&&(e=!1),this._destroyed=!0,this.remove(e),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 u=q(r),h=u.next();!h.done;h=u.next()){var p=h.value;if(p.src instanceof Array)p.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 u=a.xE.from(r);a.xE.addToCache(u,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 l="".concat(this._key,"|").concat(p.src);if(a.P6.kN[l])continue;if(0===p.src.indexOf("blob:")){var f=a.xE.from(p.src);a.xE.addToCache(f,l)}else s.add(l,p.src)}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}return new Promise((function(e){s.load((function(t,i){return W(n,void 0,void 0,(function(){var t,n,r,s,u;return K(this,(function(h){switch(h.label){case 0:for(r in t=function(e){var t;return K(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,h.label=1;case 1:return s<n.length?(u=n[s],[5,t(u)]):[3,4];case 2:h.sent(),h.label=3;case 3:return s++,[3,1];case 4:for(u in i)o.iV[u]||c[u]||(o.iV[u]=i[u]);return e(),[2]}}))}))}))}))},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},J([(0,l.M)("Effect"),X("design:type",Function),X("design:paramtypes",[Boolean]),X("design:returntype",void 0)],e.prototype,"remove",null),J([(0,l.M)("Effect"),X("design:type",Function),X("design:paramtypes",[Boolean]),X("design:returntype",void 0)],e.prototype,"destroy",null),J([(0,l.M)("Effect"),X("design:type",Function),X("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),X("design:returntype",void 0)],e.prototype,"_removeFilter",null),e}(),$=function(e){function t(t,i,n,r,o,s,a,c){var u=e.call(this,"default",i,n,r,o,s,a,c)||this;return u._json=t,u._app3d=r,u}return H(t,e),t.prototype.load=function(e){return W(this,void 0,Promise,(function(){var t,i,n,r,o,s;return K(this,(function(a){switch(a.label){case 0:return t=this._json,i=t.filter,n=t.makeup,r=t.beautify,o=t.sticker,s=t.sticker3d,e&&e(!!(null==s?void 0:s.length)),[4,this._loadImages(t)];case 1:return a.sent(),this.loadFilter(i),[4,this.setMakeup(n)];case 2:return a.sent(),o?[4,this.loadStickers(o)]:[3,4];case 3:a.sent(),a.label=4;case 4:return s?this._app3d?[3,6]:[4,this.initThreeApp()]:[3,8];case 5:a.sent(),a.label=6;case 6:return[4,this.loadSticker3d(s||[])];case 7:a.sent(),a.label=8;case 8:return[2,r]}}))}))},t.prototype.loadImage=function(){return W(this,void 0,void 0,(function(){return K(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={},u=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,u="".concat(n._key,"|").concat(s);if(a.P6.kN[u])return;if(e.objectSrc&&e.objectSrc.length){var h=a.xE.from(e.objectSrc[i]);a.xE.addToCache(h,u)}else if(0===s.indexOf("blob:")){h=a.xE.from(s);a.xE.addToCache(h,u)}else r.add(u,s);o.meta.image="",c[u]=o}else{if(a.P6.kN[t])return;if(r.resources[t])return;if(e.objectSrc&&e.objectSrc.length){h=a.xE.from(e.objectSrc[i],{resolution:(0,v.u)()});a.xE.addToCache(h,t)}else r.add(t,t)}}));else{if(a.P6.kN[e.src])return"continue";if(r.resources[e.src])return Y.info("already loaded file",e.src),"continue";if(e.objectSrc){Y.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);Y.info("JSONEffect blob texture",t),a.xE.addToCache(t,e.src)}else r.add(e.src)}};try{for(var h=q(s),p=h.next();!p.done;p=h.next()){u(p.value)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(t)throw t.error}}return new Promise((function(e){return W(n,void 0,void 0,(function(){var t=this;return K(this,(function(i){return r.load((function(i,n){return W(t,void 0,void 0,(function(){var t,i,r,s,u;return K(this,(function(h){switch(h.label){case 0:for(r in t=function(e){var t;return K(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,h.label=1;case 1:return s<i.length?(u=i[s],[5,t(u)]):[3,4];case 2:h.sent(),h.label=3;case 3:return s++,[3,1];case 4:for(u in n)o.iV[u]||c[u]||(o.iV[u]=n[u]);return e(),[2]}}))}))})),[2]}))}))}))},t.prototype.loadSticker3d=function(e){return W(this,void 0,Promise,(function(){return K(this,(function(e){return[2]}))}))},t}(Z),Q=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)}}(),ee=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},te=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ie=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())}))},ne=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])}}},re=((0,b.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 ie(this,void 0,Promise,(function(){var e;return ne(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(),b.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return ie(this,void 0,Promise,(function(){var e,t;return ne(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 ie(this,void 0,void 0,(function(){return ne(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 ie(this,void 0,void 0,(function(){var e;return ne(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 ie(this,void 0,void 0,(function(){return ne(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return ie(this,void 0,void 0,(function(){return ne(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}},ee([(0,l.M)("Effect"),te("design:type",Function),te("design:paramtypes",[]),te("design:returntype",void 0)],e.prototype,"remove",null),ee([(0,l.M)("Effect"),te("design:type",Function),te("design:paramtypes",[]),te("design:returntype",void 0)],e.prototype,"destroy",null),e}()),oe=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 Q(t,e),t.prototype.load=function(){return ie(this,void 0,Promise,(function(){var e,t;return ne(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 ie(this,void 0,void 0,(function(){return ne(this,(function(e){return[2]}))}))},t.prototype.loadSticker3d=function(e){return ie(this,void 0,Promise,(function(){return ne(this,(function(e){return[2]}))}))},t.prototype.loadHand3d=function(e){return ie(this,void 0,Promise,(function(){return ne(this,(function(e){return[2]}))}))},t}(re),se=i(5156),ae=i(6309),ce=i(5562),ue=(0,b.jl)("videoFrameTextureManager"),he=function(){function e(e){this.id=(new Date).getTime().toString(),this.pixiTexture=null,this.glTexture=null,this._width=0,this._height=0,console.log("VideoFrameTextureManager constructor"),this.renderer=e}return e.prototype.check=function(){var e=this.renderer.gl.isTexture(this.glTexture);return ue.info("check",e),e},e.prototype.update=function(e,t){void 0===t&&(t=!1);var i=this.renderer.gl,n=e.displayWidth,r=e.displayHeight;if(!this.pixiTexture||this._width!==n||this._height!==r||t){ue.info("VideoFrameTextureManager update",this._width,this._height,n,r),this.destroy(),this._width=n,this._height=r,this.glTexture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.glTexture),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this._width,this._height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);var o=new a.VL(null,{width:this._width,height:this._height,format:i.RGBA,type:i.UNSIGNED_BYTE}),s=this.renderer,c=s.CONTEXT_UID||0;o._glTextures[c]||(o._glTextures[c]=s.texture.initTexture(o));var u=o._glTextures[c];this.glTexture&&(u.texture=this.glTexture),this.pixiTexture=new a.xE(o),a.P6.kN["videoframe-".concat(this.id)]=this.pixiTexture,a.P6.V8["videoframe-".concat(this.id)]=this.pixiTexture.baseTexture}if(this.glTexture){try{i.bindTexture(i.TEXTURE_2D,this.glTexture)}catch(e){ue.error("gl.bindTexture error",e)}e.width=e.displayWidth,e.height=e.displayHeight,i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),this.pixiTexture&&this.pixiTexture.baseTexture.update()}else if(console.error("WebGLTexture 未初始化!"),!this.pixiTexture)return a.xE.EMPTY;return this.pixiTexture},e.prototype.destroy=function(){ue.info("videoFrameTextureManager destroy"),this.pixiTexture&&(this.pixiTexture.destroy(!0),this.pixiTexture=null),delete a.P6.kN["videoframe-".concat(this.id)],delete a.P6.V8["videoframe-".concat(this.id)],this._width=0,this._height=0},e.prototype.getTexture=function(){return this.pixiTexture},e}(),pe=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)}}(),le=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},fe=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},de=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())}))},ye=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])}}},_e=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.")},ge=(0,b.jl)("Renderer"),me=function(){};var be=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.lastCheckTime=0,i.need3dRefresh=!1,i.lib3dLoaded=!1,i.libHand3dLoaded=!1,ge.info("[@#$] AR Renderer Constructed",t),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._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,autoDensity:!0}),i.setRenderer(),i.initRenderContext(t),i.handleLoading(),i.setup(),i}return pe(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._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._makeupContainer=new a.W2,this._frontContainer=new a.W2,this._frontContainer.sortableChildren=!0,this._finalContainer=new a.W2,this._makeupRenderTexture=a.TI.create({width:e.width,height:e.height}),this._finalContainer.addChild(this._makeupContainer),this._finalContainer.addChild(this._frontContainer),this._target=this._finalContainer},t.prototype.loadLib3d=function(){return de(this,void 0,Promise,(function(){var e;return ye(this,(function(t){switch(t.label){case 0:return e=new ae.e({}),ge.info("loader init"),[4,e.init()];case 1:return t.sent(),ge.info("loader init done"),this._options.plugin3d&&this._options.plugin3d(Z,$,e,wx.window),[2]}}))}))},t.prototype.loadHand3d=function(){return de(this,void 0,Promise,(function(){var e;return ye(this,(function(t){switch(t.label){case 0:return e=new ae.e({}),ge.info("+++++loader init"),[4,e.init()];case 1:return t.sent(),ge.info("+++++loader init done"),this._options.plugin3d&&this._options.pluginHand(re,oe,e,wx.window),[2]}}))}))},t.prototype.setup=function(){return de(this,void 0,void 0,(function(){return ye(this,(function(e){switch(e.label){case 0:return this._setup?[2]:(this._config=new k.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:x.t.instance.options.width,height:x.t.instance.options.height})),this._mirrorFilter},enumerable:!1,configurable:!0}),t.prototype.switchMode=function(e){b.bH.info("switchMode",e),e!==this._mode3d&&("Sticker"===e&&this.setAvatar(null),this._mode3d=e)},t.prototype.logTime=function(e){var t=+new Date;ge.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,u=(t.backgroundType,t.background,t.segmentation,t.blendshapes,t.isLivePusher);t.hair;if(!this._destroyed)if(this._renderer)if(this._setup){this.currentTime=+new Date;try{(this.need3dRefresh&&U.s.checkEnabled("beautify")&&"Sticker"===this._mode3d||U.s.checkEnabled("beautify")&&"AR"===this._mode3d||U.s.checkEnabled("handLandmark"))&&this._renderer.reset()}catch(e){}if(this._isVR)try{this._renderer.render(this._backgroundVR)}catch(e){}else{if(u)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._makeupContainer.addChild(this._baseSprite)}else{var h=s,p=h.width,l=h.height,f=h.data;if(this._baseSprite){if(this._baseSprite.texture.width===p&&this._baseSprite.texture.height===l)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),p,l)}else{var d=a.xE.fromBuffer(new Uint8Array(f),p,l);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 y=Math.max(this._options.width/p,this._options.height/l);this._baseSprite.scale.set(y*(0,v.u)()),this._makeupContainer.addChild(this._baseSprite)}}(U.s.checkEnabled("beautify")||U.s.checkEnabled("segmentation")||U.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 b.b_.info("_renderer waiting for setup");else b.b_.info("_renderer waiting for renderer")},t.prototype.getBackgroungInstance=function(e,t,i,n){var r;return"image"===e?r=new ImageBackground(this._options,t,i):"video"===e?r=new VideoBackground(this._options,t,i):"blur"===e?r=new BlurBackground(this._options,i,n,this._videoFrameTextureManager,this._renderer):"green"===e&&(r=new ColorBackground(this._options,i)),r},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(),U.s.checkEnabled("beautify")&&"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&this._app3d.render(),U.s.checkEnabled("handLandmark")&&this._appHand3d&&this._appHand3d.render()},t.prototype.renderLayers=function(){e.prototype.renderDermabrasion.call(this),this._renderer.render(this._finalContainer)},t.prototype.preUploadBaseTexture=function(e,t){var i=this;if(this._baseSprite)if("undefined"!=typeof VideoFrame&&e instanceof VideoFrame){var n=this._videoFrameTextureManager.update(e),r=this._baseSprite.texture;this._baseSprite.texture=n,this._baseSprite.texture.update(),r!==this._baseSprite.texture&&(me.baseTexture=this._baseSprite.texture,G.instance.updateMakeupConfigShortcut(this._renderer))}else if(e instanceof ImageData){var o=this._baseSprite.texture.baseTexture.resource;o.width!==e.width||o.height!==e.height?(this._baseSprite.texture=a.xE.fromBuffer(e.data,e.width,e.height),me.baseTexture=this._baseSprite.texture,G.instance.updateMakeupConfigShortcut(this._renderer)):this._baseSprite.texture.baseTexture.resource.data=e.data}else{var s=this._baseSprite.texture.baseTexture.resource,c=s.source;if(c.width!==e.width||c.height!==e.height){r=this._baseSprite.texture;this._baseSprite.texture=a.xE.from(e),r!==this._baseSprite.texture&&(me.baseTexture=this._baseSprite.texture,G.instance.updateMakeupConfigShortcut(this._renderer))}else s.source!==e&&(s.source=e)}else{var u=void 0;"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(this._videoFrameTextureManager||(this._videoFrameTextureManager=new he(this._renderer)),u=this._videoFrameTextureManager.update(e)):u=e instanceof ImageData?a.xE.fromBuffer(e.data,e.width,e.height):a.xE.from(e),this._baseSprite=new a.jy(u),this._baseSprite.width=this._options.width,this._baseSprite.height=this._options.height,this._baseSprite.filters=x.t.instance.options.mirror?[this.mirrorFilter]:[],x.t.instance.on("mirrorChange",(function(e){var t=e.mirror;if(ge.info("renderer mirror change",t),t)i._baseSprite.filters.push(i.mirrorFilter);else{var n=i._baseSprite.filters.findIndex((function(e){return e===i.mirrorFilter}));n>-1&&i._baseSprite.filters.splice(n,1)}})),this._makeupContainer.addChild(this._baseSprite),me.baseTexture=this._baseSprite.texture}if(this._baseSprite.texture.update(),t)return this._prerenderer||(this._prerenderer=new a.Th({width:this._options.width/2-this._options.width/2%2,height:this._options.height/2-this._options.height/2%2})),this._prerenderer.extract.pixels(this._baseSprite,t),t},t.prototype.getBaseTexture=function(){return this._baseSprite.texture},t.prototype.removeBackground=function(){this.background&&(this.background.remove(),this.background=null)},t.prototype.disableEdgeOptimization=function(){this.background&&this.background.disableEdgeOptimization()},t.prototype.enableEdgeOptimization=function(){this.background&&this.background.enableEdgeOptimization()},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=x.t.instance.options,s=o.width,c=o.height,h="data"in i?a.xE.fromBuffer(new Uint8Array(i.data.buffer),i.width,i.height):a.xE.from(i),p=new u.jy(h);"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(e){if(!this.points){for(var t=[],i=0;2*i<e.length;i++){var n=this.getCircle(2);t.push(n),this._finalContainer.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(e){if(!this.points){for(var t=[],i=0;i<e.length;i++){var n=this.getCircle(2);t.push(n),this._finalContainer.addChild(n)}this.points=t}for(i=0;i<e.length;i++)this.points[i].x=e[i].x*x.t.instance.options.width,this.points[i].y=e[i].y*x.t.instance.options.height}},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 de(this,void 0,Promise,(function(){var r,o=this;return ye(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 de(this,void 0,Promise,(function(){var r,s=this;return ye(this,(function(a){return b.b_.time("AI init duration"),U.s.checkEnabled("beautify")&&!this._meshVertex?[2,new Promise((function(r){clearTimeout(s._meshVertexTimer),s._meshVertexTimer=setInterval((function(){b.b_.info("waiting for AI init..."),s._meshVertex&&(b.b_.info("waiting for AI init...done"),clearTimeout(s._meshVertexTimer),s._setEffect(e,t,i,n).then((function(){r(s._effects)})))}),200)}))]:(b.b_.timeEnd("AI init duration"),r="uid_"+Math.floor(1e8*Math.random()),[2,new Promise((function(a,c){return de(s,void 0,void 0,(function(){var s,c,u,h,p,l,f,d,y,_,g,m,v,k,x,w,M,T=this;return ye(this,(function(S){switch(S.label){case 0:for(s=[].concat(this._effects),c=[],u=[],h=[],p=[],l=[],f=[],d=[],y=[],e.length||(this.filterActivedEffect=null),_=[],g=function(n){var r=s.findIndex((function(t){return t.url===e[n]}));if(r>-1)c.push(s[r]),s[r],u.push(t[n]),h.push(i[n]),s.splice(r,1);else{var a=e[n];y.push(function(e){return de(this,void 0,Promise,(function(){var t,i;return ye(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),b.D4.info("download:",e,i),[2,i]}}))}))}(a)),_.push(a),l.push(t[n]),f.push(i[n])}},m=0;m<e.length;m++)g(m);return[4,Promise.all(y)];case 1:for(v=S.sent(),!1,k=!1,x=0;x<v.length;x++)w=_[x],M=void 0,(M=new Z(w,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex,this._angles,l[x],this._canvas)).filterIntensity=f[x],v[x].sticker3d&&v[x].sticker3d.length&&(k=!0),M.renderer=this._renderer,p.push(M);return b.b_.time("require 3d lib"),this.lib3dLoaded||!k?[3,3]:(b.b_.info("check useFace3d",n()),n&&!n()?[2]:(ge.info("require 3d lib"),[4,this.loadLib3d()]));case 2:S.sent(),this.lib3dLoaded=!0,S.label=3;case 3:return b.b_.timeEnd("require 3d lib"),p.forEach((function(e){d.push(e.load((function(e){e&&(T.need3dRefresh=!0)})).then((function(){return e.intensity=e.intensity,T._app3d||"face"!==e.type||(T._app3d=e.app3d),T._appHand3d||"hand"!==e.type||(T._appHand3d=e.app3d),e})).catch((function(e){ge.error("effect load error",e)})))})),b.b_.time("renderer parse effect"),Promise.all(d).then((function(e){b.b_.timeEnd("renderer parse effect"),b.b_.time("renderer apply effect");for(var t=!1,i=0;i<p.length;i++){var n=p[i];T.latestEffectUrls&&-1===T.latestEffectUrls.indexOf(n.getUrl())&&(n.destroy(!0),t=!0)}if(t)ge.info(r+"end");else{s.forEach((function(e){e.remove(!0)})),T._effects=c,c.forEach((function(e,t){e.intensity=u[t],e.filterIntensity=h[t]}));for(i=0;i<p.length;i++){n=p[i];T._effects.push(n),n.apply({filterTarget:T._makeupContainer,filterCallback:function(){}})}s.forEach((function(e){e.destroy(!0)})),b.b_.timeEnd("renderer apply effect"),(p.length||s.length)&&G.instance.updateMakeupConfigShortcut(T._renderer),a(T._effects)}})),[2]}}))}))}))])}))}))},t.prototype.setEffectJSON=function(e){return de(this,void 0,void 0,(function(){var t,i,n,r,o,s=this;return ye(this,(function(a){switch(a.label){case 0:return i=e.sticker3d,n=e.hand,i&&i.length&&!this.lib3dLoaded?(ge.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?(ge.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(){U.s.checkEnabled("beautify")&&s._meshVertex&&(t&&clearTimeout(t),r=!0,s.getJSONEffectForFace(e)),U.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 oe(e,this._appHand3d,this._options,this._canvas);i.renderer=this._renderer,b.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 $(e,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex);return i.renderer=this._renderer,i.load((function(e){e&&(t.need3dRefresh=!0)})).then((function(){t._app3d||(t._app3d=i.app3d);var e=[].concat(t._effects);t._effects=[i],i.apply({filterTarget:t._makeupContainer}),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 Z(e,i._makeupContainer,i._finalContainer,i._app3d,i._options,i._meshVertex,i._faceLandmarks,i.lipVertex,i._angles,t);r.filterIntensity=t,r.load((function(e){e&&(i.need3dRefresh=!0)})).then((function(){i.exclusiveFilter&&i.exclusiveFilter.destroy(),i.exclusiveFilter=r,r.renderer=i._renderer,r.apply({filterTarget:i._makeupContainer}),n()}))}}()}))},t.prototype.resize=function(t,i,n){if(void 0===n&&(n=!0),e.prototype.resize.call(this,t,i),ge.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),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._backgroundVR){var r=this._backgroundVR,o=r.width,s=r.height,a=Math.max(t/o,i/s);this._backgroundVR.width*=a,this._backgroundVR.height*=a}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._makeupContainer,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._makeupContainer,filterCallback:function(){}})}))},t.prototype.removeExclusiveFilter=function(){this.exclusiveFilter&&(this.exclusiveFilter.destroy(),this.exclusiveFilter=null)},t.prototype.initAvatarApp=function(e,t){return de(this,void 0,void 0,(function(){return ye(this,(function(e){return[2]}))}))},t.prototype.setAvatar=function(e,t){return de(this,void 0,void 0,(function(){return ye(this,(function(e){return[2]}))}))},t.prototype.registerAvatar=function(e){},t.prototype.reCorrectAvatar=function(){return de(this,void 0,void 0,(function(){return ye(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 de(this,void 0,Promise,(function(){var t,i,n,r,s,a,c;return ye(this,(function(u){switch(u.label){case 0:return e.length?[4,(t=new o.pF).init()]:[2];case 1:u.sent(),i=[];try{for(n=_e(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 se.Z(r);o.zIndex=20;var s=this._options,a=s.width,c=s.height;o.x=a/2,o.y=c/2,this._finalContainer.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&&me.baseTexture&&(me.baseTexture.destroy(!0),me.baseTexture=null),G.instance.clear(),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)},le([(0,l.M)("ArRenderer"),fe("design:type",Function),fe("design:paramtypes",[Object]),fe("design:returntype",void 0)],t.prototype,"destroy",null),t}(ce.F)}}]);